@cloudparse/up-miniapps-sdk 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,880 @@
1
- "use strict";var MiniAppSDK=(()=>{var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var h=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},I=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!T.call(n,r)&&r!==t&&c(n,r,{get:()=>e[r],enumerable:!(i=m(e,r))||i.enumerable});return n};var E=n=>I(c({},"__esModule",{value:!0}),n);var O={};h(O,{MiniAppSDK:()=>d,UIEvent:()=>b,default:()=>w,sdk:()=>l});var a=class{callbacks=new Map;eventListeners=new Map;constructor(){if(typeof window<"u"){let e=Object.freeze({onNativeMessage:t=>this.handleNativeMessage(t)});Object.defineProperty(window,"__MiniAppBridge",{value:e,writable:!1,configurable:!1}),window.addEventListener("message",t=>{if(t.data)try{let i=typeof t.data=="string"?JSON.parse(t.data):t.data;i&&typeof i=="object"&&(i.callbackId||i.event)&&this.handleNativeMessage(i)}catch{}})}}handleNativeMessage(e){if(!e||typeof e!="object")return;let t=e.callbackId;if(t&&typeof t=="string"){let r=this.callbacks.get(t);if(r){clearTimeout(r.timeout);let{resolve:o,reject:s}=r;e.success===!1||e.error?s(e.error||"Unknown error"):o(e.value??e.payload??e),this.callbacks.delete(t);return}}let i=e.event;if(i&&typeof i=="string"){let r=this.eventListeners.get(i);if(r)for(let o of r)try{o(e.payload||e.value)}catch(s){console.error(`Error in event listener for ${i}:`,s)}}}on(e,t){let i=this.eventListeners.get(e);return i||(i=[],this.eventListeners.set(e,i)),i.push(t),()=>this.off(e,t)}off(e,t){let i=this.eventListeners.get(e);i&&this.eventListeners.set(e,i.filter(r=>r!==t))}send(e,t,i=3e4){return new Promise((r,o)=>{let s=`${e}_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,u=setTimeout(()=>{this.callbacks.has(s)&&(this.callbacks.delete(s),o(new Error(`Bridge request timeout: ${e}`)))},i);this.callbacks.set(s,{reject:o,resolve:r,timeout:u});let f={callbackId:s,payload:t,type:e},g=window;g.ReactNativeWebView?.postMessage?g.ReactNativeWebView.postMessage(JSON.stringify(f)):(clearTimeout(u),this.callbacks.delete(s),o(new Error("Bridge not available")))})}};function p(n){let e=Object.getOwnPropertyNames(n);for(let t of e){let i=n[t];i&&typeof i=="object"&&!Object.isFrozen(i)&&!(i instanceof a)&&p(i)}return Object.freeze(n)}var d=class{bridge;constructor(){this.bridge=new a,this.initialize=this.initialize.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this)}initialize(e){return this.bridge.send("INITIALIZE",e)}storage=Object.freeze({get:e=>this.bridge.send("STORAGE_GET",{key:e}),getAll:()=>this.bridge.send("STORAGE_GET_ALL"),set:(e,t)=>this.bridge.send("STORAGE_SET",{key:e,value:t})});secureStore=Object.freeze({get:e=>this.bridge.send("SECURE_GET",{key:e}),set:(e,t)=>this.bridge.send("SECURE_SET",{key:e,value:t})});database=Object.freeze({getUserData:()=>this.bridge.send("DATABASE_GET_USER_DATA"),setUserData:e=>this.bridge.send("DATABASE_SET_USER_DATA",{data:e})});location=Object.freeze({getCurrentPosition:()=>this.bridge.send("GET_LOCATION")});user=Object.freeze({getProfile:e=>this.bridge.send("GET_USER_PROFILE",{fields:e})});permission=Object.freeze({request:((e,t)=>this.bridge.send("REQUEST_PERMISSION",{fields:t,type:e}))});payment=Object.freeze({request:e=>this.bridge.send("PAYMENT_REQUEST",e)});activity=Object.freeze({start:(e,t,i)=>this.bridge.send("START_ACTIVITY",{id:e,status:i,title:t})});haptic=Object.freeze({trigger:e=>this.bridge.send("TRIGGER_HAPTIC",{style:e})});network=Object.freeze({request:e=>this.bridge.send("NETWORK_REQUEST",e)});fidelity=Object.freeze({getFidelityBalance:()=>this.bridge.send("GET_FIDELITY_BALANCE"),getFidelityHistory:e=>this.bridge.send("GET_FIDELITY_HISTORY",e),spendFPoints:e=>this.bridge.send("SPEND_FPOINTS",{intentUuid:e})});ui=Object.freeze({exit:()=>this.bridge.send("EXIT"),setScrollConfig:e=>this.bridge.send("SET_SCROLL_CONFIG",e)});debug=Object.freeze({log:(...e)=>this.bridge.send("DEBUG_LOG",{message:e})});on(e,t){return this.bridge.on(e,t)}off(e,t){this.bridge.off(e,t)}},l=p(new d);var b=(t=>(t.TOP_SCROLL_MORE="TOP_SCROLL_MORE",t.BOTTOM_SCROLL_MORE="BOTTOM_SCROLL_MORE",t))(b||{});var w=l;return E(O);})();
1
+ "use strict";var MiniAppSDK=(()=>{var OE=Object.create;var d0=Object.defineProperty;var BE=Object.getOwnPropertyDescriptor;var FE=Object.getOwnPropertyNames;var NE=Object.getPrototypeOf,UE=Object.prototype.hasOwnProperty;var qa=(i,a)=>()=>(a||i((a={exports:{}}).exports,a),a.exports),VE=(i,a)=>{for(var u in a)d0(i,u,{get:a[u],enumerable:!0})},bw=(i,a,u,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let y of FE(a))!UE.call(i,y)&&y!==u&&d0(i,y,{get:()=>a[y],enumerable:!(f=BE(a,y))||f.enumerable});return i};var it=(i,a,u)=>(u=i!=null?OE(NE(i)):{},bw(a||!i||!i.__esModule?d0(u,"default",{value:i,enumerable:!0}):u,i)),jE=i=>bw(d0({},"__esModule",{value:!0}),i);var Pw=qa(mt=>{"use strict";var Z_=Symbol.for("react.transitional.element"),qE=Symbol.for("react.portal"),GE=Symbol.for("react.fragment"),ZE=Symbol.for("react.strict_mode"),HE=Symbol.for("react.profiler"),$E=Symbol.for("react.consumer"),XE=Symbol.for("react.context"),YE=Symbol.for("react.forward_ref"),WE=Symbol.for("react.suspense"),KE=Symbol.for("react.memo"),Mw=Symbol.for("react.lazy"),QE=Symbol.for("react.activity"),xw=Symbol.iterator;function JE(i){return i===null||typeof i!="object"?null:(i=xw&&i[xw]||i["@@iterator"],typeof i=="function"?i:null)}var Ew={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Cw=Object.assign,Aw={};function hh(i,a,u){this.props=i,this.context=a,this.refs=Aw,this.updater=u||Ew}hh.prototype.isReactComponent={};hh.prototype.setState=function(i,a){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,a,"setState")};hh.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function zw(){}zw.prototype=hh.prototype;function H_(i,a,u){this.props=i,this.context=a,this.refs=Aw,this.updater=u||Ew}var $_=H_.prototype=new zw;$_.constructor=H_;Cw($_,hh.prototype);$_.isPureReactComponent=!0;var ww=Array.isArray;function G_(){}var Ti={H:null,A:null,T:null,S:null},Dw=Object.prototype.hasOwnProperty;function X_(i,a,u){var f=u.ref;return{$$typeof:Z_,type:i,key:a,ref:f!==void 0?f:null,props:u}}function eC(i,a){return X_(i.type,a,i.props)}function Y_(i){return typeof i=="object"&&i!==null&&i.$$typeof===Z_}function tC(i){var a={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(u){return a[u]})}var Tw=/\/+/g;function q_(i,a){return typeof i=="object"&&i!==null&&i.key!=null?tC(""+i.key):a.toString(36)}function iC(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(G_,G_):(i.status="pending",i.then(function(a){i.status==="pending"&&(i.status="fulfilled",i.value=a)},function(a){i.status==="pending"&&(i.status="rejected",i.reason=a)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function uh(i,a,u,f,y){var l=typeof i;(l==="undefined"||l==="boolean")&&(i=null);var D=!1;if(i===null)D=!0;else switch(l){case"bigint":case"string":case"number":D=!0;break;case"object":switch(i.$$typeof){case Z_:case qE:D=!0;break;case Mw:return D=i._init,uh(D(i._payload),a,u,f,y)}}if(D)return y=y(i),D=f===""?"."+q_(i,0):f,ww(y)?(u="",D!=null&&(u=D.replace(Tw,"$&/")+"/"),uh(y,a,u,"",function(K){return K})):y!=null&&(Y_(y)&&(y=eC(y,u+(y.key==null||i&&i.key===y.key?"":(""+y.key).replace(Tw,"$&/")+"/")+D)),a.push(y)),1;D=0;var B=f===""?".":f+":";if(ww(i))for(var q=0;q<i.length;q++)f=i[q],l=B+q_(f,q),D+=uh(f,a,u,l,y);else if(q=JE(i),typeof q=="function")for(i=q.call(i),q=0;!(f=i.next()).done;)f=f.value,l=B+q_(f,q++),D+=uh(f,a,u,l,y);else if(l==="object"){if(typeof i.then=="function")return uh(iC(i),a,u,f,y);throw a=String(i),Error("Objects are not valid as a React child (found: "+(a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a)+"). If you meant to render a collection of children, use an array instead.")}return D}function p0(i,a,u){if(i==null)return i;var f=[],y=0;return uh(i,f,"","",function(l){return a.call(u,l,y++)}),f}function nC(i){if(i._status===-1){var a=i._result;a=a(),a.then(function(u){(i._status===0||i._status===-1)&&(i._status=1,i._result=u)},function(u){(i._status===0||i._status===-1)&&(i._status=2,i._result=u)}),i._status===-1&&(i._status=0,i._result=a)}if(i._status===1)return i._result.default;throw i._result}var Sw=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},rC={map:p0,forEach:function(i,a,u){p0(i,function(){a.apply(this,arguments)},u)},count:function(i){var a=0;return p0(i,function(){a++}),a},toArray:function(i){return p0(i,function(a){return a})||[]},only:function(i){if(!Y_(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};mt.Activity=QE;mt.Children=rC;mt.Component=hh;mt.Fragment=GE;mt.Profiler=HE;mt.PureComponent=H_;mt.StrictMode=ZE;mt.Suspense=WE;mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ti;mt.__COMPILER_RUNTIME={__proto__:null,c:function(i){return Ti.H.useMemoCache(i)}};mt.cache=function(i){return function(){return i.apply(null,arguments)}};mt.cacheSignal=function(){return null};mt.cloneElement=function(i,a,u){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var f=Cw({},i.props),y=i.key;if(a!=null)for(l in a.key!==void 0&&(y=""+a.key),a)!Dw.call(a,l)||l==="key"||l==="__self"||l==="__source"||l==="ref"&&a.ref===void 0||(f[l]=a[l]);var l=arguments.length-2;if(l===1)f.children=u;else if(1<l){for(var D=Array(l),B=0;B<l;B++)D[B]=arguments[B+2];f.children=D}return X_(i.type,y,f)};mt.createContext=function(i){return i={$$typeof:XE,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:$E,_context:i},i};mt.createElement=function(i,a,u){var f,y={},l=null;if(a!=null)for(f in a.key!==void 0&&(l=""+a.key),a)Dw.call(a,f)&&f!=="key"&&f!=="__self"&&f!=="__source"&&(y[f]=a[f]);var D=arguments.length-2;if(D===1)y.children=u;else if(1<D){for(var B=Array(D),q=0;q<D;q++)B[q]=arguments[q+2];y.children=B}if(i&&i.defaultProps)for(f in D=i.defaultProps,D)y[f]===void 0&&(y[f]=D[f]);return X_(i,l,y)};mt.createRef=function(){return{current:null}};mt.forwardRef=function(i){return{$$typeof:YE,render:i}};mt.isValidElement=Y_;mt.lazy=function(i){return{$$typeof:Mw,_payload:{_status:-1,_result:i},_init:nC}};mt.memo=function(i,a){return{$$typeof:KE,type:i,compare:a===void 0?null:a}};mt.startTransition=function(i){var a=Ti.T,u={};Ti.T=u;try{var f=i(),y=Ti.S;y!==null&&y(u,f),typeof f=="object"&&f!==null&&typeof f.then=="function"&&f.then(G_,Sw)}catch(l){Sw(l)}finally{a!==null&&u.types!==null&&(a.types=u.types),Ti.T=a}};mt.unstable_useCacheRefresh=function(){return Ti.H.useCacheRefresh()};mt.use=function(i){return Ti.H.use(i)};mt.useActionState=function(i,a,u){return Ti.H.useActionState(i,a,u)};mt.useCallback=function(i,a){return Ti.H.useCallback(i,a)};mt.useContext=function(i){return Ti.H.useContext(i)};mt.useDebugValue=function(){};mt.useDeferredValue=function(i,a){return Ti.H.useDeferredValue(i,a)};mt.useEffect=function(i,a){return Ti.H.useEffect(i,a)};mt.useEffectEvent=function(i){return Ti.H.useEffectEvent(i)};mt.useId=function(){return Ti.H.useId()};mt.useImperativeHandle=function(i,a,u){return Ti.H.useImperativeHandle(i,a,u)};mt.useInsertionEffect=function(i,a){return Ti.H.useInsertionEffect(i,a)};mt.useLayoutEffect=function(i,a){return Ti.H.useLayoutEffect(i,a)};mt.useMemo=function(i,a){return Ti.H.useMemo(i,a)};mt.useOptimistic=function(i,a){return Ti.H.useOptimistic(i,a)};mt.useReducer=function(i,a,u){return Ti.H.useReducer(i,a,u)};mt.useRef=function(i){return Ti.H.useRef(i)};mt.useState=function(i){return Ti.H.useState(i)};mt.useSyncExternalStore=function(i,a,u){return Ti.H.useSyncExternalStore(i,a,u)};mt.useTransition=function(){return Ti.H.useTransition()};mt.version="19.2.7"});var At=qa((Az,Rw)=>{"use strict";Rw.exports=Pw()});var kw=qa(f0=>{"use strict";var aC=Symbol.for("react.transitional.element"),oC=Symbol.for("react.fragment");function Iw(i,a,u){var f=null;if(u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),"key"in a){u={};for(var y in a)y!=="key"&&(u[y]=a[y])}else u=a;return a=u.ref,{$$typeof:aC,type:i,key:f,ref:a!==void 0?a:null,props:u}}f0.Fragment=oC;f0.jsx=Iw;f0.jsxs=Iw});var Qt=qa((Dz,Lw)=>{"use strict";Lw.exports=kw()});var Qw=qa((cy,uy)=>{"use strict";(function(i,a){typeof cy=="object"&&typeof uy<"u"?uy.exports=a():typeof define=="function"&&define.amd?define(a):(i=typeof globalThis<"u"?globalThis:i||self,i.maplibregl=a())})(cy,(function(){"use strict";var i={},a={};function u(y,l,D){if(a[y]=D,y==="index"){var B="var sharedModule = {}; ("+a.shared+")(sharedModule); ("+a.worker+")(sharedModule);",q={};return a.shared(q),a.index(i,q),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([B],{type:"text/javascript"}))),i}}u("shared",["exports"],(function(y){"use strict";function l(r,e,n,s){return new(n||(n=Promise))((function(c,d){function m(b){try{x(s.next(b))}catch(S){d(S)}}function _(b){try{x(s.throw(b))}catch(S){d(S)}}function x(b){var S;b.done?c(b.value):(S=b.value,S instanceof n?S:new n((function(w){w(S)}))).then(m,_)}x((s=s.apply(r,e||[])).next())}))}function D(r,e){this.x=r,this.y=e}function B(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var q,K;typeof SuppressedError=="function"&&SuppressedError,D.prototype={clone(){return new D(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){let e=r.x-this.x,n=r.y-this.y;return e*e+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){let e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){let r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){let e=Math.cos(r),n=Math.sin(r),s=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=s,this},_rotateAround(r,e){let n=Math.cos(r),s=Math.sin(r),c=e.y+s*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-s*(this.y-e.y),this.y=c,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:D},D.convert=function(r){if(r instanceof D)return r;if(Array.isArray(r))return new D(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new D(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var fe=(function(){if(K)return q;function r(e,n,s,c){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=n,this.p2x=s,this.p2y=c}return K=1,q=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,n){if(n===void 0&&(n=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,c=0;c<8;c++){var d=this.sampleCurveX(s)-e;if(Math.abs(d)<n)return s;var m=this.sampleCurveDerivativeX(s);if(Math.abs(m)<1e-6)break;s-=d/m}var _=0,x=1;for(s=e,c=0;c<20&&(d=this.sampleCurveX(s),!(Math.abs(d-e)<n));c++)e>d?_=s:x=s,s=.5*(x-_)+_;return s},solve:function(e,n){return this.sampleCurveY(this.solveCurveX(e,n))}},q})(),de=B(fe);let oe,ce;function ke(){return oe!=null||(oe=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),oe}function Ne(){if(ce==null&&(ce=!1,ke())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){let c=4*s;e.fillStyle=`rgb(${c},${c+1},${c+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}let n=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&n[s]!==s){ce=!0;break}}}return ce||!1}var ve=1e-6,se=typeof Float32Array<"u"?Float32Array:Array;function le(){var r=new se(9);return se!=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 pe(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 ge(){var r=new se(3);return se!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Be(r){var e=r[0],n=r[1],s=r[2];return Math.sqrt(e*e+n*n+s*s)}function qe(r,e,n){var s=new se(3);return s[0]=r,s[1]=e,s[2]=n,s}function Z(r,e,n){return r[0]=e[0]+n[0],r[1]=e[1]+n[1],r[2]=e[2]+n[2],r}function Y(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r}function ne(r,e,n){var s=e[0],c=e[1],d=e[2],m=n[0],_=n[1],x=n[2];return r[0]=c*x-d*_,r[1]=d*m-s*x,r[2]=s*_-c*m,r}var xe,Fe=Be;function Ye(r,e,n){var s=e[0],c=e[1],d=e[2],m=e[3];return r[0]=n[0]*s+n[4]*c+n[8]*d+n[12]*m,r[1]=n[1]*s+n[5]*c+n[9]*d+n[13]*m,r[2]=n[2]*s+n[6]*c+n[10]*d+n[14]*m,r[3]=n[3]*s+n[7]*c+n[11]*d+n[15]*m,r}function ze(){var r=new se(4);return se!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ie(r,e,n,s){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",d=Math.PI/360;e*=d,s*=d,n*=d;var m=Math.sin(e),_=Math.cos(e),x=Math.sin(n),b=Math.cos(n),S=Math.sin(s),w=Math.cos(s);switch(c){case"xyz":r[0]=m*b*w+_*x*S,r[1]=_*x*w-m*b*S,r[2]=_*b*S+m*x*w,r[3]=_*b*w-m*x*S;break;case"xzy":r[0]=m*b*w-_*x*S,r[1]=_*x*w-m*b*S,r[2]=_*b*S+m*x*w,r[3]=_*b*w+m*x*S;break;case"yxz":r[0]=m*b*w+_*x*S,r[1]=_*x*w-m*b*S,r[2]=_*b*S-m*x*w,r[3]=_*b*w+m*x*S;break;case"yzx":r[0]=m*b*w+_*x*S,r[1]=_*x*w+m*b*S,r[2]=_*b*S-m*x*w,r[3]=_*b*w-m*x*S;break;case"zxy":r[0]=m*b*w-_*x*S,r[1]=_*x*w+m*b*S,r[2]=_*b*S+m*x*w,r[3]=_*b*w-m*x*S;break;case"zyx":r[0]=m*b*w-_*x*S,r[1]=_*x*w+m*b*S,r[2]=_*b*S-m*x*w,r[3]=_*b*w+m*x*S;break;default:throw new Error("Unknown angle order "+c)}return r}function Ge(){var r=new se(2);return se!=Float32Array&&(r[0]=0,r[1]=0),r}function We(r,e){var n=new se(2);return n[0]=r,n[1]=e,n}ge(),xe=new se(4),se!=Float32Array&&(xe[0]=0,xe[1]=0,xe[2]=0,xe[3]=0),ge(),qe(1,0,0),qe(0,1,0),ze(),ze(),le(),Ge();let Ke=8192;function yt(r,e,n){return e*(Ke/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function st(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function Nt(r,e){return(r%e+e)%e}function Zt(r,e,n){return r*(1-n)+e*n}function Ut(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,n=e*r;return 4*(r<.5?n:3*(r-e)+n-.75)}function Ji(r,e,n,s){let c=new de(r,e,n,s);return d=>c.solve(d)}let Bi=Ji(.25,.1,.25,1);function ri(r,e,n){return Math.min(n,Math.max(e,r))}function dn(r,e,n){let s=n-e,c=((r-e)%s+s)%s+e;return c===e?n:c}function hi(r,...e){for(let n of e)for(let s in n)r[s]=n[s];return r}let Fr=1;function Sn(r,e,n){let s={};for(let c in r)s[c]=e.call(this,r[c],c,r);return s}function Nr(r,e,n){let s={};for(let c in r)e.call(this,r[c],c,r)&&(s[c]=r[c]);return s}function tt(r){return Array.isArray(r)?r.map(tt):typeof r=="object"&&r?Sn(r,tt):r}let kt={};function Wt(r){kt[r]||(typeof console<"u"&&console.warn(r),kt[r]=!0)}function Fi(r,e,n){return(n.y-r.y)*(e.x-r.x)>(e.y-r.y)*(n.x-r.x)}function di(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Ri=null;function pn(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}let la="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Ht(r,e,n,s,c){return l(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let d=new VideoFrame(r,{timestamp:0});try{let m=d?.format;if(!m||!m.startsWith("BGR")&&!m.startsWith("RGB"))throw new Error(`Unrecognized format ${m}`);let _=m.startsWith("BGR"),x=new Uint8ClampedArray(s*c*4);if(yield d.copyTo(x,(function(b,S,w,A,E){let R=4*Math.max(-S,0),I=(Math.max(0,w)-w)*A*4+R,O=4*A,F=Math.max(0,S),V=Math.max(0,w);return{rect:{x:F,y:V,width:Math.min(b.width,S+A)-F,height:Math.min(b.height,w+E)-V},layout:[{offset:I,stride:O}]}})(r,e,n,s,c)),_)for(let b=0;b<x.length;b+=4){let S=x[b];x[b]=x[b+2],x[b+2]=S}return x}finally{d.close()}}))}let Mn,wr;function Ya(r,e,n,s){return r.addEventListener(e,n,s),{unsubscribe:()=>{r.removeEventListener(e,n,s)}}}function Tr(r){return r*Math.PI/180}function Ur(r){return r/Math.PI*180}let Il={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},kl={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Ms="AbortError";class Eo extends Error{constructor(e=Ms){super(e instanceof Error?e.message:e),this.name=Ms,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function $c(r){return r instanceof Error&&r.name===Ms}function Co(r){if(r.aborted)throw new Eo(r.reason)}let Vr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function jr(r){return Vr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}let fn="global-dispatcher";class Lt extends Error{constructor(e,n,s,c){super(`AJAXError: ${n} (${e}): ${s}`),this.status=e,this.statusText=n,this.url=s,this.body=c}}let Ni=()=>{var r;return di(self)?(r=self.worker)===null||r===void 0?void 0:r.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},mn=function(r,e){return l(this,void 0,void 0,(function*(){var n,s;if(r.url.includes("://")&&!/^https?:|^file:/.test(r.url)){let c=jr(r.url);if(c){let d=yield c(r,e);return d.data||r.type!=="arrayBuffer"?d:hi(d,{data:new ArrayBuffer(0)})}if(di(self)&&(!((n=self.worker)===null||n===void 0)&&n.actor))return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:fn},e)}if(!(c=>{var d;return c.startsWith("file:")||((d=Ni())===null||d===void 0?void 0:d.startsWith("file:"))&&!/^\w+:/.test(c)})(r.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return(function(c,d){return l(this,void 0,void 0,(function*(){let m=new Request(c.url,{method:c.method||"GET",body:c.body,credentials:c.credentials,headers:c.headers,cache:c.cache,referrer:Ni(),referrerPolicy:c.referrerPolicy,signal:d.signal}),_,x;c.type!=="json"||m.headers.has("Accept")||m.headers.set("Accept","application/json");try{_=yield fetch(m)}catch(S){throw $c(S)?S:new Lt(0,st(S).message,c.url,new Blob)}if(!_.ok){let S=yield _.blob();throw new Lt(_.status,_.statusText,c.url,S)}x=c.type==="arrayBuffer"||c.type==="image"?_.arrayBuffer():c.type==="json"?_.json():_.text();let b=yield x;return Co(d.signal),{data:b,cacheControl:_.headers.get("Cache-Control"),expires:_.headers.get("Expires"),etag:_.headers.get("ETag")}}))})(r,e);if(di(self)&&(!((s=self.worker)===null||s===void 0)&&s.actor))return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:fn},e)}return(function(c,d){return new Promise(((m,_)=>{var x;let b=new XMLHttpRequest;b.open(c.method||"GET",c.url,!0),c.type!=="arrayBuffer"&&c.type!=="image"||(b.responseType="arraybuffer");for(let S in c.headers)b.setRequestHeader(S,c.headers[S]);c.type==="json"&&(b.responseType="text",!((x=c.headers)===null||x===void 0)&&x.Accept||b.setRequestHeader("Accept","application/json")),b.withCredentials=c.credentials==="include",b.onerror=()=>{_(new Error(b.statusText))},b.onload=()=>{if(!d.signal.aborted)if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let S=b.response;if(c.type==="json")try{S=JSON.parse(b.response)}catch(w){return void _(w)}m({data:S,cacheControl:b.getResponseHeader("Cache-Control"),expires:b.getResponseHeader("Expires"),etag:b.getResponseHeader("ETag")})}else{let S=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});_(new Lt(b.status,b.statusText,c.url,S))}},d.signal.addEventListener("abort",(()=>{b.abort(),_(new Eo(d.signal.reason))})),b.send(c.body)}))})(r,e)}))};function Et(r){if(!r||r.indexOf("://")<=0||r.startsWith("data:image/")||r.startsWith("blob:"))return!0;let e=new URL(r),n=window.location;return e.protocol===n.protocol&&e.host===n.host}function Ii(r,e,n){var s;!((s=n[r])===null||s===void 0)&&s.includes(e)||(n[r]||(n[r]=[]),n[r].push(e))}function ca(r,e,n){if(n?.[r]){let s=n[r].indexOf(e);s!==-1&&n[r].splice(s,1)}}class Wa{constructor(e,n={}){hi(this,n),this.type=e}}class Ka extends Wa{constructor(e,n={}){super("error",hi({error:e},n))}}class Ao{on(e,n){return this._listeners||(this._listeners={}),Ii(e,n,this._listeners),{unsubscribe:()=>{this.off(e,n)}}}off(e,n){return ca(e,n,this._listeners),ca(e,n,this._oneTimeListeners),this}once(e,n){return n?(this._oneTimeListeners||(this._oneTimeListeners={}),Ii(e,n,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,n){var s,c;typeof e=="string"&&(e=new Wa(e,n||{}));let d=e.type;if(this.listens(d)){e.target=this;let m=!((s=this._listeners)===null||s===void 0)&&s[d]?this._listeners[d].slice():[];for(let b of m)b.call(this,e);let _=!((c=this._oneTimeListeners)===null||c===void 0)&&c[d]?this._oneTimeListeners[d].slice():[];for(let b of _)ca(d,b,this._oneTimeListeners),b.call(this,e);let x=this._eventedParent;x&&(hi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(e))}else e instanceof Ka&&console.error(e.error);return this}listens(e){var n,s,c,d,m;return((s=(n=this._listeners)===null||n===void 0?void 0:n[e])===null||s===void 0?void 0:s.length)>0||((d=(c=this._oneTimeListeners)===null||c===void 0?void 0:c[e])===null||d===void 0?void 0:d.length)>0||((m=this._eventedParent)===null||m===void 0?void 0:m.listens(e))}setEventedParent(e,n){return this._eventedParent=e,this._eventedParentData=n,this}}var Ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let od=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function sd(r,e){let n={};for(let s in r)s!=="ref"&&(n[s]=r[s]);return od.forEach((s=>{s in e&&(n[s]=e[s])})),n}function Ot(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!Ot(r[n],e[n]))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(let n in r)if(!Ot(r[n],e[n]))return!1;return!0}return r===e}function Jn(r,e){r.push(e)}function zo(r,e,n){Jn(n,{command:"addSource",args:[r,e[r]]})}function Bf(r,e,n){Jn(e,{command:"removeSource",args:[r]}),n[r]=!0}function Ff(r,e,n,s){Bf(r,n,s),zo(r,e,n)}function s1(r,e,n){let s;for(s in r[n])if(Object.prototype.hasOwnProperty.call(r[n],s)&&s!=="data"&&!Ot(r[n][s],e[n][s]))return!1;for(s in e[n])if(Object.prototype.hasOwnProperty.call(e[n],s)&&s!=="data"&&!Ot(r[n][s],e[n][s]))return!1;return!0}function Xc(r,e,n,s,c,d){r=r||{},e=e||{};for(let m in r)Object.prototype.hasOwnProperty.call(r,m)&&(Ot(r[m],e[m])||n.push({command:d,args:[s,m,e[m],c]}));for(let m in e)Object.prototype.hasOwnProperty.call(e,m)&&!Object.prototype.hasOwnProperty.call(r,m)&&(Ot(r[m],e[m])||n.push({command:d,args:[s,m,e[m],c]}))}function ld(r){return r.id}function Nf(r,e){return r[e.id]=e,r}class Ue{constructor(e,n,s,c){this.message=(e?`${e}: `:"")+s,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function Do(r,...e){for(let n of e)for(let s in n)r[s]=n[s];return r}class gn extends Error{constructor(e,n){super(n),this.message=n,this.key=e}}class cd{constructor(e,n=[]){this.parent=e,this.bindings={};for(let[s,c]of n)this.bindings[s]=c}concat(e){return new cd(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)}}let Qa={kind:"null"},He={kind:"number"},lt={kind:"string"},pt={kind:"boolean"},sr={kind:"color"},Yc={kind:"projectionDefinition"},za={kind:"object"},ut={kind:"value"},Ll={kind:"collator"},Ol={kind:"formatted"},Wc={kind:"padding"},Es={kind:"colorArray"},Bl={kind:"numberArray"},Cs={kind:"resolvedImage"},Fl={kind:"variableAnchorOffsetCollection"};function _n(r,e){return{kind:"array",itemType:r,N:e}}function Bt(r){if(r.kind==="array"){let e=Bt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}let Kc=[Qa,He,lt,pt,sr,Yc,Ol,za,_n(ut),Wc,Bl,Es,Cs,Fl];function As(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!As(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(let n of Kc)if(!As(n,e))return null}}return`Expected ${Bt(r)} but found ${Bt(e)} instead.`}function Nl(r,e){return e.some((n=>n.kind===r.kind))}function Po(r,e){return e.some((n=>n==="null"?r===null:n==="array"?Array.isArray(r):n==="object"?r&&!Array.isArray(r)&&typeof r=="object":n===typeof r))}function qr(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}let Uf=.96422,Ro=.82521,Qc=4/29,vi=6/29,Vf=3*vi*vi,jf=vi*vi*vi,Ul=Math.PI/180,qf=180/Math.PI;function Gf(r){return(r%=360)<0&&(r+=360),r}function Zf([r,e,n,s]){let c,d,m=ud((.2225045*(r=Jc(r))+.7168786*(e=Jc(e))+.0606169*(n=Jc(n)))/1);r===e&&e===n?c=d=m:(c=ud((.4360747*r+.3850649*e+.1430804*n)/Uf),d=ud((.0139322*r+.0971045*e+.7141733*n)/Ro));let _=116*m-16;return[_<0?0:_,500*(c-m),200*(m-d),s]}function Jc(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function ud(r){return r>jf?Math.pow(r,1/3):r/Vf+Qc}function hd([r,e,n,s]){let c=(r+16)/116,d=isNaN(e)?c:c+e/500,m=isNaN(n)?c:c-n/200;return c=1*pd(c),d=Uf*pd(d),m=Ro*pd(m),[dd(3.1338561*d-1.6168667*c-.4906146*m),dd(-.9787684*d+1.9161415*c+.033454*m),dd(.0719453*d-.2289914*c+1.4052427*m),s]}function dd(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function pd(r){return r>vi?r*r*r:Vf*(r-Qc)}let l1=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function Vl(r,e){return l1(r,e)?r[e]:void 0}function eu(r){return parseInt(r.padEnd(2,r),16)/255}function Hf(r,e){return zs(e?r/100:r,0,1)}function zs(r,e,n){return Math.min(Math.max(e,r),n)}function fd(r){return!r.some(Number.isNaN)}let jl={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Ja(r,e,n){return r+n*(e-r)}function Ds(r,e,n){return r.map(((s,c)=>Ja(s,e[c],n)))}class dt{constructor(e,n,s,c=1,d=!0){this.r=e,this.g=n,this.b=s,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[e,n,s,c]))}static parse(e){if(e instanceof dt)return e;if(typeof e!="string")return;let n=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];let c=Vl(jl,s);if(c){let[m,_,x]=c;return[m/255,_/255,x/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){let m=s.length<6?1:2,_=1;return[eu(s.slice(_,_+=m)),eu(s.slice(_,_+=m)),eu(s.slice(_,_+=m)),eu(s.slice(_,_+m)||"ff")]}if(s.startsWith("rgb")){let m=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(m){let[_,x,b,S,w,A,E,R,I,O,F,V]=m,U=[S||" ",E||" ",O].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){let j=[b,A,I].join(""),H=j==="%%%"?100:j===""?255:0;if(H){let X=[zs(+x/H,0,1),zs(+w/H,0,1),zs(+R/H,0,1),F?Hf(+F,V):1];if(fd(X))return X}}return}}let d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[m,_,x,b,S,w,A,E,R]=d,I=[x||" ",S||" ",A].join("");if(I===" "||I===" /"||I===",,"||I===",,,"){let O=[+_,zs(+b,0,100),zs(+w,0,100),E?Hf(+E,R):1];if(fd(O))return(function([F,V,U,j]){function H(X){let ue=(X+F/30)%12,he=V*Math.min(U,1-U);return U-he*Math.max(-1,Math.min(ue-3,9-ue,1))}return F=Gf(F),V/=100,U/=100,[H(0),H(8),H(4),j]})(O)}}})(e);return n?new dt(...n,!1):void 0}get rgb(){let{r:e,g:n,b:s,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[e/d,n/d,s/d,c])}get hcl(){return this.overwriteGetter("hcl",(function(e){let[n,s,c,d]=Zf(e),m=Math.sqrt(s*s+c*c);return[Math.round(1e4*m)?Gf(Math.atan2(c,s)*qf):NaN,m,n,d]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Zf(this.rgb))}overwriteGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}toString(){let[e,n,s,c]=this.rgb;return`rgba(${[e,n,s].map((d=>Math.round(255*d))).join(",")},${c})`}static interpolate(e,n,s,c="rgb"){switch(c){case"rgb":{let[d,m,_,x]=Ds(e.rgb,n.rgb,s);return new dt(d,m,_,x,!1)}case"hcl":{let[d,m,_,x]=e.hcl,[b,S,w,A]=n.hcl,E,R;if(isNaN(d)||isNaN(b))isNaN(d)?isNaN(b)?E=NaN:(E=b,_!==1&&_!==0||(R=S)):(E=d,w!==1&&w!==0||(R=m));else{let U=b-d;b>d&&U>180?U-=360:b<d&&d-b>180&&(U+=360),E=d+s*U}let[I,O,F,V]=(function([U,j,H,X]){return U=isNaN(U)?0:U*Ul,hd([H,Math.cos(U)*j,Math.sin(U)*j,X])})([E,R??Ja(m,S,s),Ja(_,w,s),Ja(x,A,s)]);return new dt(I,O,F,V,!1)}case"lab":{let[d,m,_,x]=hd(Ds(e.lab,n.lab,s));return new dt(d,m,_,x,!1)}}}}dt.black=new dt(0,0,0,1),dt.white=new dt(1,1,1,1),dt.transparent=new dt(0,0,0,0),dt.red=new dt(1,0,0,1);class md{constructor(e,n,s){this.sensitivity=e?n?"variant":"case":n?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,n){return this.collator.compare(e,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let c1=["bottom","center","top"];class gd{constructor(e,n,s,c,d,m){this.text=e,this.image=n,this.scale=s,this.fontStack=c,this.textColor=d,this.verticalAlign=m}}class er{constructor(e){this.sections=e}static fromString(e){return new er([new gd(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof er?e:er.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class En{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof En)return e;if(typeof e=="number")return new En([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let n of e)if(typeof n!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new En(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s){return new En(Ds(e.values,n.values,s))}}class pi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof pi)return e;if(typeof e=="number")return new pi([e]);if(Array.isArray(e)){for(let n of e)if(typeof n!="number")return;return new pi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s){return new pi(Ds(e.values,n.values,s))}}class ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ot)return e;if(typeof e=="string"){let s=dt.parse(e);return s?new ot([s]):void 0}if(!Array.isArray(e))return;let n=[];for(let s of e){if(typeof s!="string")return;let c=dt.parse(s);if(!c)return;n.push(c)}return new ot(n)}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s,c="rgb"){let d=[];if(e.values.length!=n.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${n.values.length}), cannot interpolate.`);for(let m=0;m<e.values.length;m++)d.push(dt.interpolate(e.values[m],n.values[m],s,c));return new ot(d)}}class $t extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}let eo=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Nn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Nn)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let n=0;n<e.length;n+=2){let s=e[n],c=e[n+1];if(typeof s!="string"||!eo.has(s)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Nn(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s){let c=e.values,d=n.values;if(c.length!==d.length)throw new $t(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${n.toString()}`);let m=[];for(let _=0;_<c.length;_+=2){if(c[_]!==d[_])throw new $t(`Cannot interpolate values containing mismatched anchors. from[${_}]: ${c[_]}, to[${_}]: ${d[_]}`);m.push(c[_]);let[x,b]=c[_+1],[S,w]=d[_+1];m.push([Ja(x,S,s),Ja(b,w,s)])}return new Nn(m)}}class lr{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new lr({name:e,available:!1}):null}}class Un{constructor(e,n,s){this.from=e,this.to=n,this.transition=s}static interpolate(e,n,s){return new Un(e,n,s)}static parse(e){return e instanceof Un?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Un(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Un(e.from,e.to,e.transition):typeof e=="string"?new Un(e,e,1):void 0}}function Ps(r,e,n,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof n=="number"&&n>=0&&n<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,n,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,n,s]:[r,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function to(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Un||r instanceof dt||r instanceof md||r instanceof er||r instanceof En||r instanceof pi||r instanceof ot||r instanceof Nn||r instanceof lr)return!0;if(Array.isArray(r)){for(let e of r)if(!to(e))return!1;return!0}if(typeof r=="object"){for(let e in r)if(!to(r[e]))return!1;return!0}return!1}function Ci(r){if(r===null)return Qa;if(typeof r=="string")return lt;if(typeof r=="boolean")return pt;if(typeof r=="number")return He;if(r instanceof dt)return sr;if(r instanceof Un)return Yc;if(r instanceof md)return Ll;if(r instanceof er)return Ol;if(r instanceof En)return Wc;if(r instanceof pi)return Bl;if(r instanceof ot)return Es;if(r instanceof Nn)return Fl;if(r instanceof lr)return Cs;if(Array.isArray(r)){let e=r.length,n;for(let s of r){let c=Ci(s);if(n){if(n===c)continue;n=ut;break}n=c}return _n(n||ut,e)}return za}function Io(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof dt||r instanceof Un||r instanceof er||r instanceof En||r instanceof pi||r instanceof ot||r instanceof Nn||r instanceof lr?r.toString():JSON.stringify(r)}class ua{constructor(e,n){this.type=e,this.value=n}static parse(e,n){if(e.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!to(e[1]))return n.error("invalid value");let s=e[1],c=Ci(s),d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new ua(c,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let tu={string:lt,number:He,boolean:pt,object:za};class tr{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s,c=1,d=e[0];if(d==="array"){let _,x;if(e.length>2){let b=e[1];if(typeof b!="string"||!(b in tu)||b==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);_=tu[b],c++}else _=ut;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return n.error('The length argument to "array" must be a positive integer literal',2);x=e[2],c++}s=_n(_,x)}else{if(!tu[d])throw new Error(`Types doesn't contain name = ${d}`);s=tu[d]}let m=[];for(;c<e.length;c++){let _=n.parse(e[c],c,ut);if(!_)return null;m.push(_)}return new tr(s,m)}evaluate(e){for(let n=0;n<this.args.length;n++){let s=this.args[n].evaluate(e);if(!As(this.type,Ci(s)))return s;if(n===this.args.length-1)throw new $t(`Expected value to be of type ${Bt(this.type)}, but found ${Bt(Ci(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let ko={"to-boolean":pt,"to-color":sr,"to-number":He,"to-string":lt};class Da{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s=e[0];if(!ko[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return n.error("Expected one argument.");let c=ko[s],d=[];for(let m=1;m<e.length;m++){let _=n.parse(e[m],m,ut);if(!_)return null;d.push(_)}return new Da(c,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let n,s;for(let c of this.args){if(n=c.evaluate(e),s=null,n instanceof dt)return n;if(typeof n=="string"){let d=e.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(s=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:Ps(n[0],n[1],n[2],n[3]),!s))return new dt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new $t(s||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(let s of this.args){n=s.evaluate(e);let c=En.parse(n);if(c)return c}throw new $t(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"numberArray":{let n;for(let s of this.args){n=s.evaluate(e);let c=pi.parse(n);if(c)return c}throw new $t(`Could not parse numberArray from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"colorArray":{let n;for(let s of this.args){n=s.evaluate(e);let c=ot.parse(n);if(c)return c}throw new $t(`Could not parse colorArray from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(let s of this.args){n=s.evaluate(e);let c=Nn.parse(n);if(c)return c}throw new $t(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(let s of this.args){if(n=s.evaluate(e),n===null)return 0;let c=Number(n);if(!isNaN(c))return c}throw new $t(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return er.fromString(Io(this.args[0].evaluate(e)));case"resolvedImage":return lr.fromString(Io(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Io(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let $f=["Unknown","Point","LineString","Polygon"];class _d{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?$f[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let n=this._parseColorCache.get(e);return n||(n=dt.parse(e),this._parseColorCache.set(e,n)),n}}class Lo{constructor(e,n,s=[],c,d=new cd,m=[]){this.registry=e,this.path=s,this.key=s.map((_=>`[${_}]`)).join(""),this.scope=d,this.errors=m,this.expectedType=c,this._isConstant=n}parse(e,n,s,c,d={}){return n?this.concat(n,s,c)._parse(e,d):this._parse(e,d)}_parse(e,n){function s(c,d,m){return m==="assert"?new tr(d,[c]):m==="coerce"?new Da(d,[c]):c}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", []].');let c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let d=this.registry[c];if(d){let m=d.parse(e,this);if(!m)return null;if(this.expectedType){let _=this.expectedType,x=m.type;if(_.kind!=="string"&&_.kind!=="number"&&_.kind!=="boolean"&&_.kind!=="object"&&_.kind!=="array"||x.kind!=="value"){if(_.kind==="projectionDefinition"&&["string","array"].includes(x.kind)||["color","formatted","resolvedImage"].includes(_.kind)&&["value","string"].includes(x.kind)||["padding","numberArray"].includes(_.kind)&&["value","number","array"].includes(x.kind)||_.kind==="colorArray"&&["value","string","array"].includes(x.kind)||_.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(x.kind))m=s(m,_,n.typeAnnotation||"coerce");else if(this.checkSubtype(_,x))return null}else m=s(m,_,n.typeAnnotation||"assert")}if(!(m instanceof ua)&&m.type.kind!=="resolvedImage"&&this._isConstant(m)){let _=new _d;try{m=new ua(m.type,m.evaluate(_))}catch(x){return this.error(x.message),null}}return m}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}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,n,s){let c=typeof e=="number"?this.path.concat(e):this.path,d=s?this.scope.concat(s):this.scope;return new Lo(this.registry,this._isConstant,c,n||null,d,this.errors)}error(e,...n){let s=`${this.key}${n.map((c=>`[${c}]`)).join("")}`;this.errors.push(new gn(s,e))}checkSubtype(e,n){let s=As(e,n);return s&&this.error(s),s}}class Xt{constructor(e,n){this.type=n.type,this.bindings=[].concat(e),this.result=n}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let n of this.bindings)e(n[1]);e(this.result)}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let s=[];for(let d=1;d<e.length-1;d+=2){let m=e[d];if(typeof m!="string")return n.error(`Expected string, but found ${typeof m} instead.`,d);if(/[^a-zA-Z0-9_]/.test(m))return n.error("Variable names must contain only alphanumeric characters or '_'.",d);let _=n.parse(e[d+1],d+1);if(!_)return null;s.push([m,_])}let c=n.parse(e[e.length-1],e.length-1,n.expectedType,s);return c?new Xt(s,c):null}outputDefined(){return this.result.outputDefined()}}class Rs{constructor(e,n){this.type=n.type,this.name=e,this.boundExpression=n}static parse(e,n){if(e.length!==2||typeof e[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");let s=e[1];return n.scope.has(s)?new Rs(s,n.scope.get(s)):n.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}}class vt{constructor(e,n,s){this.type=e,this.index=n,this.input=s}static parse(e,n){if(e.length!==3)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,He),c=n.parse(e[2],2,_n(n.expectedType||ut));return s&&c?new vt(c.type.itemType,s,c):null}evaluate(e){let n=this.index.evaluate(e),s=this.input.evaluate(e);if(n<0)throw new $t(`Array index out of bounds: ${n} < 0.`);if(n>=s.length)throw new $t(`Array index out of bounds: ${n} > ${s.length-1}.`);if(n!==Math.floor(n))throw new $t(`Array index must be an integer, but found ${n} instead.`);return s[n]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ht{constructor(e,n){this.type=pt,this.needle=e,this.haystack=n}static parse(e,n){if(e.length!==3)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,ut),c=n.parse(e[2],2,ut);return s&&c?Nl(s.type,[pt,lt,He,Qa,ut])?new ht(s,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bt(s.type)} instead`):null}evaluate(e){let n=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!Po(n,["boolean","string","number","null"]))throw new $t(`Expected first argument to be of type boolean, string, number or null, but found ${Bt(Ci(n))} instead.`);if(!Po(s,["string","array"]))throw new $t(`Expected second argument to be of type array or string, but found ${Bt(Ci(s))} instead.`);return s.indexOf(n)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Is{constructor(e,n,s){this.type=He,this.needle=e,this.haystack=n,this.fromIndex=s}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,ut),c=n.parse(e[2],2,ut);if(!s||!c)return null;if(!Nl(s.type,[pt,lt,He,Qa,ut]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bt(s.type)} instead`);if(e.length===4){let d=n.parse(e[3],3,He);return d?new Is(s,c,d):null}return new Is(s,c)}evaluate(e){let n=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!Po(n,["boolean","string","number","null"]))throw new $t(`Expected first argument to be of type boolean, string, number or null, but found ${Bt(Ci(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(e)),Po(s,["string"])){let d=s.indexOf(n,c);return d===-1?-1:[...s.slice(0,d)].length}if(Po(s,["array"]))return s.indexOf(n,c);throw new $t(`Expected second argument to be of type array or string, but found ${Bt(Ci(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class bt{constructor(e,n,s,c,d,m){this.inputType=e,this.type=n,this.input=s,this.cases=c,this.outputs=d,this.otherwise=m}static parse(e,n){if(e.length<5)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return n.error("Expected an even number of arguments.");let s,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);let d={},m=[];for(let b=2;b<e.length-1;b+=2){let S=e[b],w=e[b+1];Array.isArray(S)||(S=[S]);let A=n.concat(b);if(S.length===0)return A.error("Expected at least one branch label.");for(let R of S){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,Ci(R)))return null}else s=Ci(R);if(d[String(R)]!==void 0)return A.error("Branch labels must be unique.");d[String(R)]=m.length}let E=n.parse(w,b,c);if(!E)return null;c=c||E.type,m.push(E)}let _=n.parse(e[1],1,ut);if(!_)return null;let x=n.parse(e[e.length-1],e.length-1,c);return x?_.type.kind!=="value"&&n.concat(1).checkSubtype(s,_.type)?null:new bt(s,c,_,d,m,x):null}evaluate(e){let n=this.input.evaluate(e);return(Ci(n)===this.inputType&&this.outputs[this.cases[n]]||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()}}class Gr{constructor(e,n,s){this.type=e,this.branches=n,this.otherwise=s}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return n.error("Expected an odd number of arguments.");let s;n.expectedType&&n.expectedType.kind!=="value"&&(s=n.expectedType);let c=[];for(let m=1;m<e.length-1;m+=2){let _=n.parse(e[m],m,pt);if(!_)return null;let x=n.parse(e[m+1],m+1,s);if(!x)return null;c.push([_,x]),s=s||x.type}let d=n.parse(e[e.length-1],e.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new Gr(s,c,d)}evaluate(e){for(let[n,s]of this.branches)if(n.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[n,s]of this.branches)e(n),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,n])=>n.outputDefined()))&&this.otherwise.outputDefined()}}class ks{constructor(e,n,s,c){this.type=e,this.input=n,this.beginIndex=s,this.endIndex=c}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,ut),c=n.parse(e[2],2,He);if(!s||!c)return null;if(!Nl(s.type,[_n(ut),lt,ut]))return n.error(`Expected first argument to be of type array or string, but found ${Bt(s.type)} instead`);if(e.length===4){let d=n.parse(e[3],3,He);return d?new ks(s.type,s,c,d):null}return new ks(s.type,s,c)}evaluate(e){let n=this.input.evaluate(e),s=this.beginIndex.evaluate(e),c;if(this.endIndex&&(c=this.endIndex.evaluate(e)),Po(n,["string"]))return[...n].slice(s,c).join("");if(Po(n,["array"]))return n.slice(s,c);throw new $t(`Expected first argument to be of type array or string, but found ${Bt(Ci(n))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Oo(r,e){let n=r.length-1,s,c,d=0,m=n,_=0;for(;d<=m;)if(_=Math.floor((d+m)/2),s=r[_],c=r[_+1],s<=e){if(_===n||e<c)return _;d=_+1}else{if(!(s>e))throw new $t("Input is not a number.");m=_-1}return 0}class Ls{constructor(e,n,s){this.type=e,this.input=n,this.labels=[],this.outputs=[];for(let[c,d]of s)this.labels.push(c),this.outputs.push(d)}static parse(e,n){if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");let s=n.parse(e[1],1,He);if(!s)return null;let c=[],d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let m=1;m<e.length;m+=2){let _=m===1?-1/0:e[m],x=e[m+1],b=m,S=m+1;if(typeof _!="number")return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(c.length&&c[c.length-1][0]>=_)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);let w=n.parse(x,S,d);if(!w)return null;d=d||w.type,c.push([_,w])}return new Ls(d,s,c)}evaluate(e){let n=this.labels,s=this.outputs;if(n.length===1)return s[0].evaluate(e);let c=this.input.evaluate(e);if(c<=n[0])return s[0].evaluate(e);let d=n.length;return c>=n[d-1]?s[d-1].evaluate(e):s[Oo(n,c)].evaluate(e)}eachChild(e){e(this.input);for(let n of this.outputs)e(n)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function yd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var iu,Xf,Yf=(function(){if(Xf)return iu;function r(e,n,s,c){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=n,this.p2x=s,this.p2y=c}return Xf=1,iu=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,n){if(n===void 0&&(n=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,c=0;c<8;c++){var d=this.sampleCurveX(s)-e;if(Math.abs(d)<n)return s;var m=this.sampleCurveDerivativeX(s);if(Math.abs(m)<1e-6)break;s-=d/m}var _=0,x=1;for(s=e,c=0;c<20&&(d=this.sampleCurveX(s),!(Math.abs(d-e)<n));c++)e>d?_=s:x=s,s=.5*(x-_)+_;return s},solve:function(e,n){return this.sampleCurveY(this.solveCurveX(e,n))}},iu})(),Wf=yd(Yf);class ki{constructor(e,n,s,c,d){this.type=e,this.operator=n,this.interpolation=s,this.input=c,this.labels=[],this.outputs=[];for(let[m,_]of d)this.labels.push(m),this.outputs.push(_)}static interpolationFactor(e,n,s,c){let d=0;if(e.name==="exponential")d=en(n,e.base,s,c);else if(e.name==="linear")d=en(n,1,s,c);else if(e.name==="cubic-bezier"){let m=e.controlPoints;d=new Wf(m[0],m[1],m[2],m[3]).solve(en(n,1,s,c))}return d}static parse(e,n){let[s,c,d,...m]=e;if(!Array.isArray(c)||c.length===0)return n.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){let b=c[1];if(typeof b!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:b}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{let b=c.slice(1);if(b.length!==4||b.some((S=>typeof S!="number"||S<0||S>1)))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:b}}}if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,He),!d)return null;let _=[],x=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||n.expectedType==Es?n.expectedType&&n.expectedType.kind!=="value"&&(x=n.expectedType):x=sr;for(let b=0;b<m.length;b+=2){let S=m[b],w=m[b+1],A=b+3,E=b+4;if(typeof S!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(_.length&&_[_.length-1][0]>=S)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);let R=n.parse(w,E,x);if(!R)return null;x=x||R.type,_.push([S,R])}return qr(x,He)||qr(x,Yc)||qr(x,sr)||qr(x,Wc)||qr(x,Bl)||qr(x,Es)||qr(x,Fl)||qr(x,_n(He))?new ki(x,s,c,d,_):n.error(`Type ${Bt(x)} is not interpolatable.`)}evaluate(e){let n=this.labels,s=this.outputs;if(n.length===1)return s[0].evaluate(e);let c=this.input.evaluate(e);if(c<=n[0])return s[0].evaluate(e);let d=n.length;if(c>=n[d-1])return s[d-1].evaluate(e);let m=Oo(n,c),_=ki.interpolationFactor(this.interpolation,c,n[m],n[m+1]),x=s[m].evaluate(e),b=s[m+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ja(x,b,_);case"color":return dt.interpolate(x,b,_);case"padding":return En.interpolate(x,b,_);case"colorArray":return ot.interpolate(x,b,_);case"numberArray":return pi.interpolate(x,b,_);case"variableAnchorOffsetCollection":return Nn.interpolate(x,b,_);case"array":return Ds(x,b,_);case"projectionDefinition":return Un.interpolate(x,b,_)}case"interpolate-hcl":switch(this.type.kind){case"color":return dt.interpolate(x,b,_,"hcl");case"colorArray":return ot.interpolate(x,b,_,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return dt.interpolate(x,b,_,"lab");case"colorArray":return ot.interpolate(x,b,_,"lab")}}}eachChild(e){e(this.input);for(let n of this.outputs)e(n)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function en(r,e,n,s){let c=s-n,d=r-n;return c===0?0:e===1?d/c:(Math.pow(e,d)-1)/(Math.pow(e,c)-1)}let cr={color:dt.interpolate,number:Ja,padding:En.interpolate,numberArray:pi.interpolate,colorArray:ot.interpolate,variableAnchorOffsetCollection:Nn.interpolate,array:Ds};class ql{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s=null,c=n.expectedType;c&&c.kind!=="value"&&(s=c);let d=[];for(let _ of e.slice(1)){let x=n.parse(_,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!x)return null;s=s||x.type,d.push(x)}if(!s)throw new Error("No output type");let m=c&&d.some((_=>As(c,_.type)));return new ql(m?ut:s,d)}evaluate(e){let n,s=null,c=0;for(let d of this.args)if(c++,s=d.evaluate(e),s&&s instanceof lr&&!s.available&&(n||(n=s.name),s=null,c===this.args.length&&(s=n)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Gl(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 Hi(r,e,n,s){return s.compare(e,n)===0}function Bo(r,e,n){let s=r!=="=="&&r!=="!=";return class Kw{constructor(d,m,_){this.type=pt,this.lhs=d,this.rhs=m,this.collator=_,this.hasUntypedArgument=d.type.kind==="value"||m.type.kind==="value"}static parse(d,m){if(d.length!==3&&d.length!==4)return m.error("Expected two or three arguments.");let _=d[0],x=m.parse(d[1],1,ut);if(!x)return null;if(!Gl(_,x.type))return m.concat(1).error(`"${_}" comparisons are not supported for type '${Bt(x.type)}'.`);let b=m.parse(d[2],2,ut);if(!b)return null;if(!Gl(_,b.type))return m.concat(2).error(`"${_}" comparisons are not supported for type '${Bt(b.type)}'.`);if(x.type.kind!==b.type.kind&&x.type.kind!=="value"&&b.type.kind!=="value")return m.error(`Cannot compare types '${Bt(x.type)}' and '${Bt(b.type)}'.`);s&&(x.type.kind==="value"&&b.type.kind!=="value"?x=new tr(b.type,[x]):x.type.kind!=="value"&&b.type.kind==="value"&&(b=new tr(x.type,[b])));let S=null;if(d.length===4){if(x.type.kind!=="string"&&b.type.kind!=="string"&&x.type.kind!=="value"&&b.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(S=m.parse(d[3],3,Ll),!S)return null}return new Kw(x,b,S)}evaluate(d){let m=this.lhs.evaluate(d),_=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){let x=Ci(m),b=Ci(_);if(x.kind!==b.kind||x.kind!=="string"&&x.kind!=="number")throw new $t(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${x.kind}, ${b.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){let x=Ci(m),b=Ci(_);if(x.kind!=="string"||b.kind!=="string")return e(d,m,_)}return this.collator?n(d,m,_,this.collator.evaluate(d)):e(d,m,_)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}let vd=Bo("==",(function(r,e,n){return e===n}),Hi),Kf=Bo("!=",(function(r,e,n){return e!==n}),(function(r,e,n,s){return!Hi(0,e,n,s)})),u1=Bo("<",(function(r,e,n){return e<n}),(function(r,e,n,s){return s.compare(e,n)<0})),Os=Bo(">",(function(r,e,n){return e>n}),(function(r,e,n,s){return s.compare(e,n)>0})),nu=Bo("<=",(function(r,e,n){return e<=n}),(function(r,e,n,s){return s.compare(e,n)<=0})),bd=Bo(">=",(function(r,e,n){return e>=n}),(function(r,e,n,s){return s.compare(e,n)>=0}));class ru{constructor(e,n,s){this.type=Ll,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=n}static parse(e,n){if(e.length!==2)return n.error("Expected one argument.");let s=e[1];if(typeof s!="object"||Array.isArray(s))return n.error("Collator options argument must be an object.");let c=n.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,pt);if(!c)return null;let d=n.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,pt);if(!d)return null;let m=null;return s.locale&&(m=n.parse(s.locale,1,lt),!m)?null:new ru(c,d,m)}evaluate(e){return new md(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}}class au{constructor(e,n,s,c,d,m){this.type=lt,this.number=e,this.locale=n,this.currency=s,this.unit=c,this.minFractionDigits=d,this.maxFractionDigits=m}static parse(e,n){if(e.length!==3)return n.error("Expected two arguments.");let s=n.parse(e[1],1,He);if(!s)return null;let c=e[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,lt),!d))return null;let m=null;if(c.currency&&(m=n.parse(c.currency,1,lt),!m))return null;let _=null;if(c.unit&&(_=n.parse(c.unit,1,lt),!_))return null;if(m&&_)return n.error("NumberFormat options `currency` and `unit` are mutually exclusive");let x=null;if(c["min-fraction-digits"]&&(x=n.parse(c["min-fraction-digits"],1,He),!x))return null;let b=null;return c["max-fraction-digits"]&&(b=n.parse(c["max-fraction-digits"],1,He),!b)?null:new au(s,d,m,_,x,b)}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}}class Fo{constructor(e){this.type=Ol,this.sections=e}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s=e[1];if(!Array.isArray(s)&&typeof s=="object")return n.error("First argument must be an image or text section.");let c=[],d=!1;for(let m=1;m<=e.length-1;++m){let _=e[m];if(d&&typeof _=="object"&&!Array.isArray(_)){d=!1;let x=null;if(_["font-scale"]&&(x=n.parse(_["font-scale"],1,He),!x))return null;let b=null;if(_["text-font"]&&(b=n.parse(_["text-font"],1,_n(lt)),!b))return null;let S=null;if(_["text-color"]&&(S=n.parse(_["text-color"],1,sr),!S))return null;let w=null;if(_["vertical-align"]){if(typeof _["vertical-align"]=="string"&&!c1.includes(_["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${_["vertical-align"]}' instead.`);if(w=n.parse(_["vertical-align"],1,lt),!w)return null}let A=c[c.length-1];A.scale=x,A.font=b,A.textColor=S,A.verticalAlign=w}else{let x=n.parse(e[m],1,ut);if(!x)return null;let b=x.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:x,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Fo(c)}evaluate(e){return new er(this.sections.map((n=>{let s=n.content.evaluate(e);return Ci(s)===Cs?new gd("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new gd(Io(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)})))}eachChild(e){for(let n of this.sections)e(n.content),n.scale&&e(n.scale),n.font&&e(n.font),n.textColor&&e(n.textColor),n.verticalAlign&&e(n.verticalAlign)}outputDefined(){return!1}}class Bs{constructor(e){this.type=Cs,this.input=e}static parse(e,n){if(e.length!==2)return n.error("Expected two arguments.");let s=n.parse(e[1],1,lt);return s?new Bs(s):n.error("No image name provided.")}evaluate(e){let n=this.input.evaluate(e),s=lr.fromString(n);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(n)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class ur{constructor(e){this.type=He,this.input=e}static parse(e,n){if(e.length!==2)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);let s=n.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${Bt(s.type)} instead.`):new ur(s):null}evaluate(e){let n=this.input.evaluate(e);if(typeof n=="string")return[...n].length;if(Array.isArray(n))return n.length;throw new $t(`Expected value to be of type string or array, but found ${Bt(Ci(n))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let Zr=8192;function ou(r,e){let n=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(n*c*Zr),Math.round(s*c*Zr)]}function xd(r,e){let n=Math.pow(2,e.z);return[(c=(r[0]/Zr+e.x)/n,360*c-180),(s=(r[1]/Zr+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,c}function No(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 Zl(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function h1(r,e,n){let s=r[0]-e[0],c=r[1]-e[1],d=r[0]-n[0],m=r[1]-n[1];return s*m-d*c==0&&s*d<=0&&c*m<=0}function su(r,e,n,s){return(c=[s[0]-n[0],s[1]-n[1]])[0]*(d=[e[0]-r[0],e[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!Jf(r,e,n,s)||!Jf(n,s,r,e));var c,d}function d1(r,e,n){for(let s of n)for(let c=0;c<s.length-1;++c)if(su(r,e,s[c],s[c+1]))return!0;return!1}function Pa(r,e,n=!1){let s=!1;for(let _ of e)for(let x=0;x<_.length-1;x++){if(h1(r,_[x],_[x+1]))return n;(d=_[x])[1]>(c=r)[1]!=(m=_[x+1])[1]>c[1]&&c[0]<(m[0]-d[0])*(c[1]-d[1])/(m[1]-d[1])+d[0]&&(s=!s)}var c,d,m;return s}function p1(r,e){for(let n of e)if(Pa(r,n))return!0;return!1}function wd(r,e){for(let n of r)if(!Pa(n,e))return!1;for(let n=0;n<r.length-1;++n)if(d1(r[n],r[n+1],e))return!1;return!0}function Qf(r,e){for(let n of e)if(wd(r,n))return!0;return!1}function Jf(r,e,n,s){let c=s[0]-n[0],d=s[1]-n[1],m=(r[0]-n[0])*d-c*(r[1]-n[1]),_=(e[0]-n[0])*d-c*(e[1]-n[1]);return m>0&&_<0||m<0&&_>0}function lu(r,e,n){let s=[];for(let c=0;c<r.length;c++){let d=[];for(let m=0;m<r[c].length;m++){let _=ou(r[c][m],n);No(e,_),d.push(_)}s.push(d)}return s}function em(r,e,n){let s=[];for(let c=0;c<r.length;c++){let d=lu(r[c],e,n);s.push(d)}return s}function tm(r,e,n,s){if(r[0]<n[0]||r[0]>n[2]){let c=.5*s,d=r[0]-n[0]>c?-s:n[0]-r[0]>c?s:0;d===0&&(d=r[0]-n[2]>c?-s:n[2]-r[0]>c?s:0),r[0]+=d}No(e,r)}function im(r,e,n,s){let c=Math.pow(2,s.z)*Zr,d=[s.x*Zr,s.y*Zr],m=[];for(let _ of r)for(let x of _){let b=[x.x+d[0],x.y+d[1]];tm(b,e,n,c),m.push(b)}return m}function nm(r,e,n,s){let c=Math.pow(2,s.z)*Zr,d=[s.x*Zr,s.y*Zr],m=[];for(let x of r){let b=[];for(let S of x){let w=[S.x+d[0],S.y+d[1]];No(e,w),b.push(w)}m.push(b)}if(e[2]-e[0]<=c/2){(_=e)[0]=_[1]=1/0,_[2]=_[3]=-1/0;for(let x of m)for(let b of x)tm(b,e,n,c)}var _;return m}class Uo{constructor(e,n){this.type=pt,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(to(e[1])){let s=e[1];if(s.type==="FeatureCollection"){let c=[];for(let d of s.features){let{type:m,coordinates:_}=d.geometry;m==="Polygon"&&c.push(_),m==="MultiPolygon"&&c.push(..._)}if(c.length)return new Uo(s,{type:"MultiPolygon",coordinates:c})}else if(s.type==="Feature"){let c=s.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Uo(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Uo(s,s)}return n.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(n,s){let c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],m=n.canonicalID();if(s.type==="Polygon"){let _=lu(s.coordinates,d,m),x=im(n.geometry(),c,d,m);if(!Zl(c,d))return!1;for(let b of x)if(!Pa(b,_))return!1}if(s.type==="MultiPolygon"){let _=em(s.coordinates,d,m),x=im(n.geometry(),c,d,m);if(!Zl(c,d))return!1;for(let b of x)if(!p1(b,_))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(n,s){let c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],m=n.canonicalID();if(s.type==="Polygon"){let _=lu(s.coordinates,d,m),x=nm(n.geometry(),c,d,m);if(!Zl(c,d))return!1;for(let b of x)if(!wd(b,_))return!1}if(s.type==="MultiPolygon"){let _=em(s.coordinates,d,m),x=nm(n.geometry(),c,d,m);if(!Zl(c,d))return!1;for(let b of x)if(!Qf(b,_))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Td=class{constructor(r=[],e=(n,s)=>n<s?-1:n>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;let r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){let{data:e,compare:n}=this,s=e[r];for(;r>0;){let c=r-1>>1,d=e[c];if(n(s,d)>=0)break;e[r]=d,r=c}e[r]=s}_down(r){let{data:e,compare:n}=this,s=this.length>>1,c=e[r];for(;r<s;){let d=1+(r<<1),m=d+1;if(m<this.length&&n(e[m],e[d])<0&&(d=m),n(e[d],c)>=0)break;e[r]=e[d],r=d}e[r]=c}};function Sd(r,e,n=0,s=r.length-1,c=f1){for(;s>n;){if(s-n>600){let x=s-n+1,b=e-n+1,S=Math.log(x),w=.5*Math.exp(2*S/3),A=.5*Math.sqrt(S*w*(x-w)/x)*(b-x/2<0?-1:1);Sd(r,e,Math.max(n,Math.floor(e-b*w/x+A)),Math.min(s,Math.floor(e+(x-b)*w/x+A)),c)}let d=r[e],m=n,_=s;for(Fs(r,n,e),c(r[s],d)>0&&Fs(r,n,s);m<_;){for(Fs(r,m,_),m++,_--;c(r[m],d)<0;)m++;for(;c(r[_],d)>0;)_--}c(r[n],d)===0?Fs(r,n,_):(_++,Fs(r,_,s)),_<=e&&(n=_+1),e<=_&&(s=_-1)}}function Fs(r,e,n){let s=r[e];r[e]=r[n],r[n]=s}function f1(r,e){return r<e?-1:r>e?1:0}function cu(r,e){if(r.length<=1)return[r];let n=[],s,c;for(let d of r){let m=g1(d);m!==0&&(d.area=Math.abs(m),c===void 0&&(c=m<0),c===m<0?(s&&n.push(s),s=[d]):s.push(d))}if(s&&n.push(s),e>1)for(let d=0;d<n.length;d++)n[d].length<=e||(Sd(n[d],e,1,n[d].length-1,m1),n[d]=n[d].slice(0,e));return n}function m1(r,e){return e.area-r.area}function g1(r){let e=0;for(let n,s,c=0,d=r.length,m=d-1;c<d;m=c++)n=r[c],s=r[m],e+=(s.x-n.x)*(n.y+s.y);return e}let Hl=1/298.257223563,rm=Hl*(2-Hl),am=Math.PI/180;class Md{constructor(e){let n=6378.137*am*1e3,s=Math.cos(e*am),c=1/(1-rm*(1-s*s)),d=Math.sqrt(c);this.kx=n*d*s,this.ky=n*d*c*(1-rm)}distance(e,n){let s=this.wrap(e[0]-n[0])*this.kx,c=(e[1]-n[1])*this.ky;return Math.sqrt(s*s+c*c)}pointOnLine(e,n){let s,c,d,m,_=1/0;for(let x=0;x<e.length-1;x++){let b=e[x][0],S=e[x][1],w=this.wrap(e[x+1][0]-b)*this.kx,A=(e[x+1][1]-S)*this.ky,E=0;w===0&&A===0||(E=(this.wrap(n[0]-b)*this.kx*w+(n[1]-S)*this.ky*A)/(w*w+A*A),E>1?(b=e[x+1][0],S=e[x+1][1]):E>0&&(b+=w/this.kx*E,S+=A/this.ky*E)),w=this.wrap(n[0]-b)*this.kx,A=(n[1]-S)*this.ky;let R=w*w+A*A;R<_&&(_=R,s=b,c=S,d=x,m=E)}return{point:[s,c],index:d,t:Math.max(0,Math.min(1,m))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function om(r,e){return e[0]-r[0]}function Ns(r){return r[1]-r[0]+1}function ha(r,e){return r[1]>=r[0]&&r[1]<e}function Ed(r,e){if(r[0]>r[1])return[null,null];let n=Ns(r);if(e){if(n===2)return[r,null];let c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];let s=Math.floor(n/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function Cd(r,e){if(!ha(e,r.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)No(n,r[s]);return n}function uu(r){let e=[1/0,1/0,-1/0,-1/0];for(let n of r)for(let s of n)No(e,s);return e}function Ad(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function zd(r,e,n){if(!Ad(r)||!Ad(e))return NaN;let s=0,c=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(c=r[1]-e[3]),r[3]<e[1]&&(c=e[1]-r[3]),n.distance([0,0],[s,c])}function Vo(r,e,n){let s=n.pointOnLine(e,r);return n.distance(r,s.point)}function Dd(r,e,n,s,c){let d=Math.min(Vo(r,[n,s],c),Vo(e,[n,s],c)),m=Math.min(Vo(n,[r,e],c),Vo(s,[r,e],c));return Math.min(d,m)}function sm(r,e,n,s,c){if(!ha(e,r.length)||!ha(s,n.length))return 1/0;let d=1/0;for(let m=e[0];m<e[1];++m){let _=r[m],x=r[m+1];for(let b=s[0];b<s[1];++b){let S=n[b],w=n[b+1];if(su(_,x,S,w))return 0;d=Math.min(d,Dd(_,x,S,w,c))}}return d}function _1(r,e,n,s,c){if(!ha(e,r.length)||!ha(s,n.length))return NaN;let d=1/0;for(let m=e[0];m<=e[1];++m)for(let _=s[0];_<=s[1];++_)if(d=Math.min(d,c.distance(r[m],n[_])),d===0)return d;return d}function y1(r,e,n){if(Pa(r,e,!0))return 0;let s=1/0;for(let c of e){let d=c[0],m=c[c.length-1];if(d!==m&&(s=Math.min(s,Vo(r,[m,d],n)),s===0))return s;let _=n.pointOnLine(c,r);if(s=Math.min(s,n.distance(r,_.point)),s===0)return s}return s}function v1(r,e,n,s){if(!ha(e,r.length))return NaN;for(let d=e[0];d<=e[1];++d)if(Pa(r[d],n,!0))return 0;let c=1/0;for(let d=e[0];d<e[1];++d){let m=r[d],_=r[d+1];for(let x of n)for(let b=0,S=x.length,w=S-1;b<S;w=b++){let A=x[w],E=x[b];if(su(m,_,A,E))return 0;c=Math.min(c,Dd(m,_,A,E,s))}}return c}function lm(r,e){for(let n of r)for(let s of n)if(Pa(s,e,!0))return!0;return!1}function Rt(r,e,n,s=1/0){let c=uu(r),d=uu(e);if(s!==1/0&&zd(c,d,n)>=s)return s;if(Zl(c,d)){if(lm(r,e))return 0}else if(lm(e,r))return 0;let m=1/0;for(let _ of r)for(let x=0,b=_.length,S=b-1;x<b;S=x++){let w=_[S],A=_[x];for(let E of e)for(let R=0,I=E.length,O=I-1;R<I;O=R++){let F=E[O],V=E[R];if(su(w,A,F,V))return 0;m=Math.min(m,Dd(w,A,F,V,n))}}return m}function cm(r,e,n,s,c,d){if(!d)return;let m=zd(Cd(s,d),c,n);m<e&&r.push([m,d,[0,0]])}function hu(r,e,n,s,c,d,m){if(!d||!m)return;let _=zd(Cd(s,d),Cd(c,m),n);_<e&&r.push([_,d,m])}function du(r,e,n,s,c=1/0){let d=Math.min(s.distance(r[0],n[0][0]),c);if(d===0)return d;let m=new Td([[0,[0,r.length-1],[0,0]]],om),_=uu(n);for(;m.length>0;){let x=m.pop();if(x[0]>=d)continue;let b=x[1],S=e?50:100;if(Ns(b)<=S){if(!ha(b,r.length))return NaN;if(e){let w=v1(r,b,n,s);if(isNaN(w)||w===0)return w;d=Math.min(d,w)}else for(let w=b[0];w<=b[1];++w){let A=y1(r[w],n,s);if(d=Math.min(d,A),d===0)return 0}}else{let w=Ed(b,e);cm(m,d,s,r,_,w[0]),cm(m,d,s,r,_,w[1])}}return d}function pu(r,e,n,s,c,d=1/0){let m=Math.min(d,c.distance(r[0],n[0]));if(m===0)return m;let _=new Td([[0,[0,r.length-1],[0,n.length-1]]],om);for(;_.length>0;){let x=_.pop();if(x[0]>=m)continue;let b=x[1],S=x[2],w=e?50:100,A=s?50:100;if(Ns(b)<=w&&Ns(S)<=A){if(!ha(b,r.length)&&ha(S,n.length))return NaN;let E;if(e&&s)E=sm(r,b,n,S,c),m=Math.min(m,E);else if(e&&!s){let R=r.slice(b[0],b[1]+1);for(let I=S[0];I<=S[1];++I)if(E=Vo(n[I],R,c),m=Math.min(m,E),m===0)return m}else if(!e&&s){let R=n.slice(S[0],S[1]+1);for(let I=b[0];I<=b[1];++I)if(E=Vo(r[I],R,c),m=Math.min(m,E),m===0)return m}else E=_1(r,b,n,S,c),m=Math.min(m,E)}else{let E=Ed(b,e),R=Ed(S,s);hu(_,m,c,r,n,E[0],R[0]),hu(_,m,c,r,n,E[0],R[1]),hu(_,m,c,r,n,E[1],R[0]),hu(_,m,c,r,n,E[1],R[1])}}return m}function Pd(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class jo{constructor(e,n){this.type=He,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(to(e[1])){let s=e[1];if(s.type==="FeatureCollection")return new jo(s,s.features.map((c=>Pd(c.geometry))).flat());if(s.type==="Feature")return new jo(s,Pd(s.geometry));if("type"in s&&"coordinates"in s)return new jo(s,Pd(s))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(n,s){let c=n.geometry(),d=c.flat().map((x=>xd([x.x,x.y],n.canonical)));if(c.length===0)return NaN;let m=new Md(d[0][1]),_=1/0;for(let x of s){switch(x.type){case"Point":_=Math.min(_,pu(d,!1,[x.coordinates],!1,m,_));break;case"LineString":_=Math.min(_,pu(d,!1,x.coordinates,!0,m,_));break;case"Polygon":_=Math.min(_,du(d,!1,x.coordinates,m,_))}if(_===0)return _}return _})(e,this.geometries);if(e.geometryType()==="LineString")return(function(n,s){let c=n.geometry(),d=c.flat().map((x=>xd([x.x,x.y],n.canonical)));if(c.length===0)return NaN;let m=new Md(d[0][1]),_=1/0;for(let x of s){switch(x.type){case"Point":_=Math.min(_,pu(d,!0,[x.coordinates],!1,m,_));break;case"LineString":_=Math.min(_,pu(d,!0,x.coordinates,!0,m,_));break;case"Polygon":_=Math.min(_,du(d,!0,x.coordinates,m,_))}if(_===0)return _}return _})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(n,s){let c=n.geometry();if(c.length===0||c[0].length===0)return NaN;let d=cu(c,0).map((x=>x.map((b=>b.map((S=>xd([S.x,S.y],n.canonical))))))),m=new Md(d[0][0][0][1]),_=1/0;for(let x of s)for(let b of d){switch(x.type){case"Point":_=Math.min(_,du([x.coordinates],!1,b,m,_));break;case"LineString":_=Math.min(_,du(x.coordinates,!0,b,m,_));break;case"Polygon":_=Math.min(_,Rt(b,x.coordinates,m,_))}if(_===0)return _}return _})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class $l{constructor(e){this.type=ut,this.key=e}static parse(e,n){if(e.length!==2)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);let s=e[1];return s==null?n.error("Global state property must be defined."):typeof s!="string"?n.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new $l(s)}evaluate(e){var n;let s=(n=e.globals)===null||n===void 0?void 0:n.globalState;return s&&Object.keys(s).length!==0?Vl(s,this.key):null}eachChild(){}outputDefined(){return!1}}let Us={"==":vd,"!=":Kf,">":Os,"<":u1,">=":bd,"<=":nu,array:tr,at:vt,boolean:tr,case:Gr,coalesce:ql,collator:ru,format:Fo,image:Bs,in:ht,"index-of":Is,interpolate:ki,"interpolate-hcl":ki,"interpolate-lab":ki,length:ur,let:Xt,literal:ua,match:bt,number:tr,"number-format":au,object:tr,slice:ks,step:Ls,string:tr,"to-boolean":Da,"to-color":Da,"to-number":Da,"to-string":Da,var:Rs,within:Uo,distance:jo,"global-state":$l};class Sr{constructor(e,n,s,c){this.name=e,this.type=n,this._evaluate=s,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,n){let s=e[0],c=Sr.definitions[s];if(!c)return n.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);let d=Array.isArray(c)?c[0]:c.type,m=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,_=m.filter((([b])=>!Array.isArray(b)||b.length===e.length-1)),x=null;for(let[b,S]of _){x=new Lo(n.registry,fu,n.path,null,n.scope);let w=[],A=!1;for(let E=1;E<e.length;E++){let R=e[E],I=Array.isArray(b)?b[E-1]:b.type,O=x.parse(R,1+w.length,I);if(!O){A=!0;break}w.push(O)}if(!A)if(Array.isArray(b)&&b.length!==w.length)x.error(`Expected ${b.length} arguments, but found ${w.length} instead.`);else{for(let E=0;E<w.length;E++){let R=Array.isArray(b)?b[E]:b.type,I=w[E];x.concat(E+1).checkSubtype(R,I.type)}if(x.errors.length===0)return new Sr(s,d,S,w)}}if(_.length===1)n.errors.push(...x.errors);else{let b=(_.length?_:m).map((([w])=>{return A=w,Array.isArray(A)?`(${A.map(Bt).join(", ")})`:`(${Bt(A.type)}...)`;var A})).join(" | "),S=[];for(let w=1;w<e.length;w++){let A=n.parse(e[w],1+S.length);if(!A)return null;S.push(Bt(A.type))}n.error(`Expected arguments of type ${b}, but found (${S.join(", ")}) instead.`)}return null}static register(e,n){Sr.definitions=n;for(let s in n)e[s]=Sr}}function um(r,[e,n,s,c]){e=e.evaluate(r),n=n.evaluate(r),s=s.evaluate(r);let d=c?c.evaluate(r):1,m=Ps(e,n,s,d);if(m)throw new $t(m);return new dt(e/255,n/255,s/255,d,!1)}function hm(r,e){return r in e}function Rd(r,e){let n=e[r];return n===void 0?null:n}function qo(r){return{type:r}}function fu(r){if(r instanceof Rs)return fu(r.boundExpression);if(r instanceof Sr&&r.name==="error"||r instanceof ru||r instanceof Uo||r instanceof jo||r instanceof $l)return!1;let e=r instanceof Da||r instanceof tr,n=!0;return r.eachChild((s=>{n=e?n&&fu(s):n&&s instanceof ua})),!!n&&mu(r)&&gu(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function mu(r){if(r instanceof Sr&&(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 Uo||r instanceof jo)return!1;let e=!0;return r.eachChild((n=>{e&&!mu(n)&&(e=!1)})),e}function Xl(r){if(r instanceof Sr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((n=>{e&&!Xl(n)&&(e=!1)})),e}function gu(r,e){if(r instanceof Sr&&e.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild((s=>{n&&!gu(s,e)&&(n=!1)})),n}function dm(r){return{result:"success",value:r}}function Vs(r){return{result:"error",value:r}}function js(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function pm(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Id(r){return!!r.expression&&r.expression.interpolated}function ft(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function _u(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Ci(r)===za}function b1(r){return r}function fm(r,e){let n=r.stops&&typeof r.stops[0][0]=="object",s=n||!(n||r.property!==void 0),c=r.type||(Id(e)?"exponential":"interval"),d=(function(S){switch(S.type){case"color":return dt.parse;case"padding":return En.parse;case"numberArray":return pi.parse;case"colorArray":return ot.parse;default:return null}})(e);if(d&&((r=Do({},r)).stops&&(r.stops=r.stops.map((S=>[S[0],d(S[1])]))),r.default=d(r.default?r.default:e.default)),r.colorSpace&&(m=r.colorSpace)!=="rgb"&&m!=="hcl"&&m!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var m;let _=(function(S){switch(S){case"exponential":return mm;case"interval":return w1;case"categorical":return x1;case"identity":return T1;default:throw new Error(`Unknown function type "${S}"`)}})(c),x,b;if(c==="categorical"){x=Object.create(null);for(let S of r.stops)x[S[0]]=S[1];b=typeof r.stops[0][0]}if(n){let S={},w=[];for(let R=0;R<r.stops.length;R++){let I=r.stops[R],O=I[0].zoom;S[O]===void 0&&(S[O]={zoom:O,type:r.type,property:r.property,default:r.default,stops:[]},w.push(O)),S[O].stops.push([I[0].value,I[1]])}let A=[];for(let R of w)A.push([S[R].zoom,fm(S[R],e)]);let E={name:"linear"};return{kind:"composite",interpolationType:E,interpolationFactor:ki.interpolationFactor.bind(void 0,E),zoomStops:A.map((R=>R[0])),evaluate:({zoom:R},I)=>mm({stops:A,base:r.base},e,R).evaluate(R,I)}}if(s){let S=c==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:ki.interpolationFactor.bind(void 0,S),zoomStops:r.stops.map((w=>w[0])),evaluate:({zoom:w})=>_(r,e,w,x,b)}}return{kind:"source",evaluate(S,w){let A=w&&w.properties?w.properties[r.property]:void 0;return A===void 0?Yl(r.default,e.default):_(r,e,A,x,b)}}}function Yl(r,e,n){return r!==void 0?r:e!==void 0?e:n!==void 0?n:void 0}function x1(r,e,n,s,c){return Yl(typeof n===c?s[n]:void 0,r.default,e.default)}function w1(r,e,n){if(ft(n)!=="number")return Yl(r.default,e.default);let s=r.stops.length;if(s===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[s-1][0])return r.stops[s-1][1];let c=Oo(r.stops.map((d=>d[0])),n);return r.stops[c][1]}function mm(r,e,n){let s=r.base!==void 0?r.base:1;if(ft(n)!=="number")return Yl(r.default,e.default);let c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];let d=Oo(r.stops.map((S=>S[0])),n),m=(function(S,w,A,E){let R=E-A,I=S-A;return R===0?0:w===1?I/R:(Math.pow(w,I)-1)/(Math.pow(w,R)-1)})(n,s,r.stops[d][0],r.stops[d+1][0]),_=r.stops[d][1],x=r.stops[d+1][1],b=cr[e.type]||b1;return typeof _.evaluate=="function"?{evaluate(...S){let w=_.evaluate.apply(void 0,S),A=x.evaluate.apply(void 0,S);if(w!==void 0&&A!==void 0)return b(w,A,m,r.colorSpace)}}:b(_,x,m,r.colorSpace)}function T1(r,e,n){switch(e.type){case"color":n=dt.parse(n);break;case"formatted":n=er.fromString(n.toString());break;case"resolvedImage":n=lr.fromString(n.toString());break;case"padding":n=En.parse(n);break;case"colorArray":n=ot.parse(n);break;case"numberArray":n=pi.parse(n);break;default:ft(n)===e.type||e.type==="enum"&&e.values[n]||(n=void 0)}return Yl(n,r.default,e.default)}Sr.register(Us,{error:[{kind:"error"},[lt],(r,[e])=>{throw new $t(e.evaluate(r))}],typeof:[lt,[ut],(r,[e])=>Bt(Ci(e.evaluate(r)))],"to-rgba":[_n(He,4),[sr],(r,[e])=>{let[n,s,c,d]=e.evaluate(r).rgb;return[255*n,255*s,255*c,d]}],rgb:[sr,[He,He,He],um],rgba:[sr,[He,He,He,He],um],has:{type:pt,overloads:[[[lt],(r,[e])=>hm(e.evaluate(r),r.properties())],[[lt,za],(r,[e,n])=>hm(e.evaluate(r),n.evaluate(r))]]},get:{type:ut,overloads:[[[lt],(r,[e])=>Rd(e.evaluate(r),r.properties())],[[lt,za],(r,[e,n])=>Rd(e.evaluate(r),n.evaluate(r))]]},"feature-state":[ut,[lt],(r,[e])=>Rd(e.evaluate(r),r.featureState||{})],properties:[za,[],r=>r.properties()],"geometry-type":[lt,[],r=>r.geometryType()],id:[ut,[],r=>r.id()],zoom:[He,[],r=>r.globals.zoom],"heatmap-density":[He,[],r=>r.globals.heatmapDensity||0],elevation:[He,[],r=>r.globals.elevation||0],"line-progress":[He,[],r=>r.globals.lineProgress||0],accumulated:[ut,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[He,qo(He),(r,e)=>{let n=0;for(let s of e)n+=s.evaluate(r);return n}],"*":[He,qo(He),(r,e)=>{let n=1;for(let s of e)n*=s.evaluate(r);return n}],"-":{type:He,overloads:[[[He,He],(r,[e,n])=>e.evaluate(r)-n.evaluate(r)],[[He],(r,[e])=>-e.evaluate(r)]]},"/":[He,[He,He],(r,[e,n])=>e.evaluate(r)/n.evaluate(r)],"%":[He,[He,He],(r,[e,n])=>e.evaluate(r)%n.evaluate(r)],ln2:[He,[],()=>Math.LN2],pi:[He,[],()=>Math.PI],e:[He,[],()=>Math.E],"^":[He,[He,He],(r,[e,n])=>Math.pow(e.evaluate(r),n.evaluate(r))],sqrt:[He,[He],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[He,[He],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[He,[He],(r,[e])=>Math.log(e.evaluate(r))],log2:[He,[He],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[He,[He],(r,[e])=>Math.sin(e.evaluate(r))],cos:[He,[He],(r,[e])=>Math.cos(e.evaluate(r))],tan:[He,[He],(r,[e])=>Math.tan(e.evaluate(r))],asin:[He,[He],(r,[e])=>Math.asin(e.evaluate(r))],acos:[He,[He],(r,[e])=>Math.acos(e.evaluate(r))],atan:[He,[He],(r,[e])=>Math.atan(e.evaluate(r))],min:[He,qo(He),(r,e)=>Math.min(...e.map((n=>n.evaluate(r))))],max:[He,qo(He),(r,e)=>Math.max(...e.map((n=>n.evaluate(r))))],abs:[He,[He],(r,[e])=>Math.abs(e.evaluate(r))],round:[He,[He],(r,[e])=>{let n=e.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[He,[He],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[He,[He],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[pt,[lt,ut],(r,[e,n])=>r.properties()[e.value]===n.value],"filter-id-==":[pt,[ut],(r,[e])=>r.id()===e.value],"filter-type-==":[pt,[lt],(r,[e])=>r.geometryType()===e.value],"filter-<":[pt,[lt,ut],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s<c}],"filter-id-<":[pt,[ut],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n<s}],"filter->":[pt,[lt,ut],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s>c}],"filter-id->":[pt,[ut],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n>s}],"filter-<=":[pt,[lt,ut],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s<=c}],"filter-id-<=":[pt,[ut],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n<=s}],"filter->=":[pt,[lt,ut],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s>=c}],"filter-id->=":[pt,[ut],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n>=s}],"filter-has":[pt,[ut],(r,[e])=>e.value in r.properties()],"filter-has-id":[pt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[pt,[_n(lt)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[pt,[_n(ut)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[pt,[lt,_n(ut)],(r,[e,n])=>n.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[pt,[lt,_n(ut)],(r,[e,n])=>(function(s,c,d,m){for(;d<=m;){let _=d+m>>1;if(c[_]===s)return!0;c[_]>s?m=_-1:d=_+1}return!1})(r.properties()[e.value],n.value,0,n.value.length-1)],all:{type:pt,overloads:[[[pt,pt],(r,[e,n])=>e.evaluate(r)&&n.evaluate(r)],[qo(pt),(r,e)=>{for(let n of e)if(!n.evaluate(r))return!1;return!0}]]},any:{type:pt,overloads:[[[pt,pt],(r,[e,n])=>e.evaluate(r)||n.evaluate(r)],[qo(pt),(r,e)=>{for(let n of e)if(n.evaluate(r))return!0;return!1}]]},"!":[pt,[pt],(r,[e])=>!e.evaluate(r)],"is-supported-script":[pt,[lt],(r,[e])=>{let n=r.globals&&r.globals.isSupportedScript;return!n||n(e.evaluate(r))}],upcase:[lt,[lt],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[lt,[lt],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[lt,qo(ut),(r,e)=>e.map((n=>Io(n.evaluate(r)))).join("")],split:[_n(lt),[lt,lt],(r,[e,n])=>e.evaluate(r).split(n.evaluate(r))],join:[lt,[_n(lt),lt],(r,[e,n])=>e.evaluate(r).join(n.evaluate(r))],"resolved-locale":[lt,[Ll],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Wl{constructor(e,n,s){this.expression=e,this._warningHistory={},this._evaluator=new _d,this._defaultValue=n?(function(c){if(c.type==="color"&&_u(c.default))return new dt(0,0,0,0);switch(c.type){case"color":return dt.parse(c.default)||null;case"padding":return En.parse(c.default)||null;case"numberArray":return pi.parse(c.default)||null;case"colorArray":return ot.parse(c.default)||null;case"variableAnchorOffsetCollection":return Nn.parse(c.default)||null;case"projectionDefinition":return Un.parse(c.default)||null;default:return c.default===void 0?null:c.default}})(n):null,this._enumValues=n&&n.type==="enum"?n.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,n,s,c,d,m){return this._globalState&&(e=Gs(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=n,this._evaluator.featureState=s,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(e,n,s,c,d,m){this._globalState&&(e=Gs(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=n||null,this._evaluator.featureState=s||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=m||null;try{let _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new $t(`Expected value to be one of ${Object.keys(this._enumValues).map((x=>JSON.stringify(x))).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(_.message)),this._defaultValue}}}function yu(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Us}function Kl(r,e,n){let s=new Lo(Us,fu,[],e?(function(d){let m={color:sr,string:lt,number:He,enum:lt,boolean:pt,formatted:Ol,padding:Wc,numberArray:Bl,colorArray:Es,projectionDefinition:Yc,resolvedImage:Cs,variableAnchorOffsetCollection:Fl};return d.type==="array"?_n(m[d.value]||ut,d.length):m[d.type]})(e):void 0),c=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return c?dm(new Wl(c,e,n)):Vs(s.errors)}class vu{constructor(e,n,s){this.kind=e,this._styleExpression=n,this.isStateDependent=e!=="constant"&&!Xl(n.expression),this.globalStateRefs=qs(n.expression),this._globalState=s}evaluateWithoutErrorHandling(e,n,s,c,d,m){return this._globalState&&(e=Gs(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,n,s,c,d,m)}evaluate(e,n,s,c,d,m){return this._globalState&&(e=Gs(e,this._globalState)),this._styleExpression.evaluate(e,n,s,c,d,m)}}class bu{constructor(e,n,s,c,d){this.kind=e,this.zoomStops=s,this._styleExpression=n,this.isStateDependent=e!=="camera"&&!Xl(n.expression),this.globalStateRefs=qs(n.expression),this.interpolationType=c,this._globalState=d}evaluateWithoutErrorHandling(e,n,s,c,d,m){return this._globalState&&(e=Gs(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,n,s,c,d,m)}evaluate(e,n,s,c,d,m){return this._globalState&&(e=Gs(e,this._globalState)),this._styleExpression.evaluate(e,n,s,c,d,m)}interpolationFactor(e,n,s){return this.interpolationType?ki.interpolationFactor(this.interpolationType,e,n,s):0}}function gm(r,e,n){let s=Kl(r,e,n);if(s.result==="error")return s;let c=s.value.expression,d=mu(c);if(!d&&!js(e))return Vs([new gn("","data expressions not supported")]);let m=gu(c,["zoom"]);if(!m&&!pm(e))return Vs([new gn("","zoom expressions not supported")]);let _=Go(c);return _||m?_ instanceof gn?Vs([_]):_ instanceof ki&&!Id(e)?Vs([new gn("",'"interpolate" expressions cannot be used with this property')]):dm(_?new bu(d?"camera":"composite",s.value,_.labels,_ instanceof ki?_.interpolation:void 0,n):new vu(d?"constant":"source",s.value,n)):Vs([new gn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class xu{constructor(e,n){this._parameters=e,this._specification=n,Do(this,fm(this._parameters,this._specification))}static deserialize(e){return new xu(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Go(r){let e=null;if(r instanceof Xt)e=Go(r.result);else if(r instanceof ql){for(let n of r.args)if(e=Go(n),e)break}else(r instanceof Ls||r instanceof ki)&&r.input instanceof Sr&&r.input.name==="zoom"&&(e=r);return e instanceof gn||r.eachChild((n=>{let s=Go(n);s instanceof gn?e=s:!e&&s?e=new gn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new gn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function qs(r,e=new Set){return r instanceof $l&&e.add(r.key),r.eachChild((n=>{qs(n,e)})),e}function Gs(r,e){let{zoom:n,heatmapDensity:s,elevation:c,lineProgress:d,isSupportedScript:m,accumulated:_}=r??{};return{zoom:n,heatmapDensity:s,elevation:c,lineProgress:d,isSupportedScript:m,accumulated:_,globalState:e}}function kd(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(let e of r.slice(1))if(!kd(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}let S1={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ql(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};kd(r)||(r=Jl(r));let n=Kl(r,S1,e);if(n.result==="error")throw new Error(n.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,c,d)=>n.value.evaluate(s,c,{},d),needGeometry:Ld(r),getGlobalStateRefs:()=>qs(n.value.expression)}}function M1(r,e){return r<e?-1:r>e?1:0}function Ld(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(Ld(r[e]))return!0;return!1}function Jl(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?Od(r[1],r[2],"=="):e==="!="?ec(Od(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Od(r[1],r[2],e):e==="any"?(n=r.slice(1),["any"].concat(n.map(Jl))):e==="all"?["all"].concat(r.slice(1).map(Jl)):e==="none"?["all"].concat(r.slice(1).map(Jl).map(ec)):e==="in"?_m(r[1],r.slice(2)):e==="!in"?ec(_m(r[1],r.slice(2))):e==="has"?Bd(r[1]):e!=="!has"||ec(Bd(r[1]));var n}function Od(r,e,n){switch(r){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,r,e]}}function _m(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((n=>typeof n!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(M1)]]:["filter-in-small",r,["literal",e]]}}function Bd(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ec(r){return["!",r]}function wu(r){let e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(let d of r)c+=`${wu(d)},`;return`${c}]`}let n=Object.keys(r).sort(),s="{";for(let c=0;c<n.length;c++)s+=`${JSON.stringify(n[c])}:${wu(r[n[c]])},`;return`${s}}`}function E1(r){let e="";for(let n of od)e+=`/${wu(r[n])}`;return e}function ym(r){let e=r.value;return e?[new Ue(r.key,e,"constants have been deprecated as of v8")]:[]}function Ai(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Zo(r){if(Array.isArray(r))return r.map(Zo);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let n in r)e[n]=Zo(r[n]);return e}return Ai(r)}function ir(r){let e=r.key,n=r.value,s=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,m=r.styleSpec,_=r.validateSpec,x=[],b=ft(n);if(b!=="object")return[new Ue(e,n,`object expected, ${b} found`)];for(let S in n){let w=S.split(".")[0],A=Vl(s,w)||s["*"],E;if(Vl(c,w))E=c[w];else if(Vl(s,w)){if(n[S]===void 0)continue;E=_}else if(c["*"])E=c["*"];else{if(!s["*"]){x.push(new Ue(e,n[S],`unknown property "${S}"`));continue}E=_}x=x.concat(E({key:(e&&`${e}.`)+S,value:n[S],valueSpec:A,style:d,styleSpec:m,object:n,objectKey:S,validateSpec:_},n))}for(let S in s)c[S]||s[S].required&&s[S].default===void 0&&n[S]===void 0&&x.push(new Ue(e,n,`missing required property "${S}"`));return x}function Tu(r){let e=r.value,n=r.valueSpec,s=r.style,c=r.styleSpec,d=r.key,m=r.arrayElementValidator||r.validateSpec;if(ft(e)!=="array")return[new Ue(d,e,`array expected, ${ft(e)} found`)];if(n.length&&e.length!==n.length)return[new Ue(d,e,`array length ${n.length} expected, length ${e.length} found`)];let _={type:n.value,values:n.values};c.$version<7&&(_.function=n.function),ft(n.value)==="object"&&(_=n.value);let x=[];for(let b=0;b<e.length;b++)x=x.concat(m({array:e,arrayIndex:b,value:e[b],valueSpec:_,validateSpec:r.validateSpec,style:s,styleSpec:c,key:`${d}[${b}]`}));return x}function Zs(r){let e=r.key,n=r.value,s=r.valueSpec,c=ft(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new Ue(e,n,`number expected, ${c} found`)]:"minimum"in s&&n<s.minimum?[new Ue(e,n,`${n} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&n>s.maximum?[new Ue(e,n,`${n} is greater than the maximum value ${s.maximum}`)]:[]}function Su(r){let e=r.valueSpec,n=Ai(r.value.type),s,c,d,m={},_=n!=="categorical"&&r.value.property===void 0,x=!_,b=ft(r.value.stops)==="array"&&ft(r.value.stops[0])==="array"&&ft(r.value.stops[0][0])==="object",S=ir({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(E){if(n==="identity")return[new Ue(E.key,E.value,'identity function may not have a "stops" property')];let R=[],I=E.value;return R=R.concat(Tu({key:E.key,value:I,valueSpec:E.valueSpec,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,arrayElementValidator:w})),ft(I)==="array"&&I.length===0&&R.push(new Ue(E.key,I,"array must have at least one stop")),R},default:function(E){return E.validateSpec({key:E.key,value:E.value,valueSpec:e,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec})}}});return n==="identity"&&_&&S.push(new Ue(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||S.push(new Ue(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!Id(r.valueSpec)&&S.push(new Ue(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(x&&!js(r.valueSpec)?S.push(new Ue(r.key,r.value,"property functions not supported")):_&&!pm(r.valueSpec)&&S.push(new Ue(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!b||r.value.property!==void 0||S.push(new Ue(r.key,r.value,'"property" property is required')),S;function w(E){let R=[],I=E.value,O=E.key;if(ft(I)!=="array")return[new Ue(O,I,`array expected, ${ft(I)} found`)];if(I.length!==2)return[new Ue(O,I,`array length 2 expected, length ${I.length} found`)];if(b){if(ft(I[0])!=="object")return[new Ue(O,I,`object expected, ${ft(I[0])} found`)];if(I[0].zoom===void 0)return[new Ue(O,I,"object stop key must have zoom")];if(I[0].value===void 0)return[new Ue(O,I,"object stop key must have value")];if(d&&d>Ai(I[0].zoom))return[new Ue(O,I[0].zoom,"stop zoom values must appear in ascending order")];Ai(I[0].zoom)!==d&&(d=Ai(I[0].zoom),c=void 0,m={}),R=R.concat(ir({key:`${O}[0]`,value:I[0],valueSpec:{zoom:{}},validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,objectElementValidators:{zoom:Zs,value:A}}))}else R=R.concat(A({key:`${O}[0]`,value:I[0],validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec},I));return yu(Zo(I[1]))?R.concat([new Ue(`${O}[1]`,I[1],"expressions are not allowed in function stops.")]):R.concat(E.validateSpec({key:`${O}[1]`,value:I[1],valueSpec:e,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec}))}function A(E,R){let I=ft(E.value),O=Ai(E.value),F=E.value!==null?E.value:R;if(s){if(I!==s)return[new Ue(E.key,F,`${I} stop domain type must match previous stop domain type ${s}`)]}else s=I;if(I!=="number"&&I!=="string"&&I!=="boolean")return[new Ue(E.key,F,"stop domain value must be a number, string, or boolean")];if(I!=="number"&&n!=="categorical"){let V=`number expected, ${I} found`;return js(e)&&n===void 0&&(V+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ue(E.key,F,V)]}return n!=="categorical"||I!=="number"||isFinite(O)&&Math.floor(O)===O?n!=="categorical"&&I==="number"&&c!==void 0&&O<c?[new Ue(E.key,F,"stop domain values must appear in ascending order")]:(c=O,n==="categorical"&&O in m?[new Ue(E.key,F,"stop domain values must be unique")]:(m[O]=!0,[])):[new Ue(E.key,F,`integer expected, found ${O}`)]}}function io(r){let e=(r.expressionContext==="property"?gm:Kl)(Zo(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new Ue(`${r.key}${s.key}`,r.value,s.message)));let n=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!n.outputDefined())return[new Ue(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Xl(n))return[new Ue(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Xl(n))return[new Ue(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!gu(n,["zoom","feature-state"]))return[new Ue(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!mu(n))return[new Ue(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function tc(r){let e=r.key,n=r.value,s=ft(n);return s!=="string"?[new Ue(e,n,`color expected, ${s} found`)]:dt.parse(String(n))?[]:[new Ue(e,n,`color expected, "${n}" found`)]}function Ho(r){let e=r.key,n=r.value,s=r.valueSpec,c=[];return Array.isArray(s.values)?s.values.indexOf(Ai(n))===-1&&c.push(new Ue(e,n,`expected one of [${s.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(s.values).indexOf(Ai(n))===-1&&c.push(new Ue(e,n,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function Hs(r){return kd(Zo(r.value))?io(Do({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):vm(r)}function vm(r){let e=r.value,n=r.key;if(ft(e)!=="array")return[new Ue(n,e,`array expected, ${ft(e)} found`)];let s=r.styleSpec,c,d=[];if(e.length<1)return[new Ue(n,e,"filter array must have at least 1 element")];switch(d=d.concat(Ho({key:`${n}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),Ai(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ai(e[1])==="$type"&&d.push(new Ue(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new Ue(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=ft(e[1]),c!=="string"&&d.push(new Ue(`${n}[1]`,e[1],`string expected, ${c} found`)));for(let m=2;m<e.length;m++)c=ft(e[m]),Ai(e[1])==="$type"?d=d.concat(Ho({key:`${n}[${m}]`,value:e[m],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new Ue(`${n}[${m}]`,e[m],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let m=1;m<e.length;m++)d=d.concat(vm({key:`${n}[${m}]`,value:e[m],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=ft(e[1]),e.length!==2?d.push(new Ue(n,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new Ue(`${n}[1]`,e[1],`string expected, ${c} found`))}return d}function bm(r,e){let n=r.key,s=r.validateSpec,c=r.style,d=r.styleSpec,m=r.value,_=r.objectKey,x=d[`${e}_${r.layerType}`];if(!x)return[];let b=_.match(/^(.*)-transition$/);if(e==="paint"&&b&&x[b[1]]&&x[b[1]].transition)return s({key:n,value:m,valueSpec:d.transition,style:c,styleSpec:d});let S=r.valueSpec||x[_];if(!S)return[new Ue(n,m,`unknown property "${_}"`)];let w;if(ft(m)==="string"&&js(S)&&!S.tokens&&(w=/^{([^}]+)}$/.exec(m)))return[new Ue(n,m,`"${_}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];let A=[];return r.layerType==="symbol"&&_==="text-font"&&_u(Zo(m))&&Ai(m.type)==="identity"&&A.push(new Ue(n,m,'"text-font" does not support identity functions')),A.concat(s({key:r.key,value:m,valueSpec:S,style:c,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:_}))}function xm(r){return bm(r,"paint")}function wm(r){return bm(r,"layout")}function Tm(r){var e,n;let s=[],c=r.value,d=r.key,m=r.style,_=r.styleSpec;if(ft(c)!=="object")return[new Ue(d,c,`object expected, ${ft(c)} found`)];c.type||c.ref||s.push(new Ue(d,c,'either "type" or "ref" is required'));let x=Ai(c.type),b=Ai(c.ref);if(c.id){let S=Ai(c.id);for(let w=0;w<r.arrayIndex;w++){let A=m.layers[w];Ai(A.id)===S&&s.push(new Ue(d,c.id,`duplicate layer id "${c.id}", previously used at line ${A.id.__line__}`))}}if("ref"in c){let S;["type","source","source-layer","filter","layout"].forEach((w=>{w in c&&s.push(new Ue(d,c[w],`"${w}" is prohibited for ref layers`))})),m.layers.forEach((w=>{Ai(w.id)===b&&(S=w)})),S?S.ref?s.push(new Ue(d,c.ref,"ref cannot reference another ref layer")):x=Ai(S.type):s.push(new Ue(d,c.ref,`ref layer "${b}" not found`))}else if(x!=="background")if(c.source){let S=m.sources&&m.sources[c.source],w=S&&Ai(S.type);S?w==="vector"&&x==="raster"?s.push(new Ue(d,c.source,`layer "${c.id}" requires a raster source`)):w!=="raster-dem"&&x==="hillshade"||w!=="raster-dem"&&x==="color-relief"?s.push(new Ue(d,c.source,`layer "${c.id}" requires a raster-dem source`)):w==="raster"&&x!=="raster"?s.push(new Ue(d,c.source,`layer "${c.id}" requires a vector source`)):w!=="vector"||c["source-layer"]?w==="raster-dem"&&x!=="hillshade"&&x!=="color-relief"?s.push(new Ue(d,c.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||w==="geojson"&&S.lineMetrics||s.push(new Ue(d,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Ue(d,c,`layer "${c.id}" must specify a "source-layer"`)):s.push(new Ue(d,c.source,`source "${c.source}" not found`))}else s.push(new Ue(d,c,'missing required property "source"'));return x==="raster"&&(!((e=c.paint)===null||e===void 0)&&e.resampling)&&(!((n=c.paint)===null||n===void 0)&&n["raster-resampling"])&&s.push(new Ue(d,c.paint,`layer "${c.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),s=s.concat(ir({key:d,value:c,valueSpec:_.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${d}.type`,value:c.type,valueSpec:_.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:c,objectKey:"type"}),filter:Hs,layout:S=>ir({layer:c,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":w=>wm(Do({layerType:x},w))}}),paint:S=>ir({layer:c,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":w=>xm(Do({layerType:x},w))}})}})),s}function no(r){let e=r.value,n=r.key,s=ft(e);return s!=="string"?[new Ue(n,e,`string expected, ${s} found`)]:[]}let Fd={promoteId:function({key:r,value:e}){if(ft(e)==="string")return no({key:r,value:e});{let n=[];for(let s in e)n.push(...no({key:`${r}.${s}`,value:e[s]}));return n}}};function Nd(r){let e=r.value,n=r.key,s=r.styleSpec,c=r.style,d=r.validateSpec;if(!e.type)return[new Ue(n,e,'"type" is required')];let m=Ai(e.type),_;switch(m){case"vector":case"raster":return _=ir({key:n,value:e,valueSpec:s[`source_${m.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:Fd,validateSpec:d}),_;case"raster-dem":return _=(function(x){var b;let S=(b=x.sourceName)!==null&&b!==void 0?b:"",w=x.value,A=x.styleSpec,E=A.source_raster_dem,R=x.style,I=[],O=ft(w);if(w===void 0)return I;if(O!=="object")return I.push(new Ue("source_raster_dem",w,`object expected, ${O} found`)),I;let F=Ai(w.encoding)==="custom",V=["redFactor","greenFactor","blueFactor","baseShift"],U=x.value.encoding?`"${x.value.encoding}"`:"Default";for(let j in w)!F&&V.includes(j)?I.push(new Ue(j,w[j],`In "${S}": "${j}" is only valid when "encoding" is set to "custom". ${U} encoding found`)):E[j]?I=I.concat(x.validateSpec({key:j,value:w[j],valueSpec:E[j],validateSpec:x.validateSpec,style:R,styleSpec:A})):I.push(new Ue(j,w[j],`unknown property "${j}"`));return I})({sourceName:n,value:e,style:r.style,styleSpec:s,validateSpec:d}),_;case"geojson":if(_=ir({key:n,value:e,valueSpec:s.source_geojson,style:c,styleSpec:s,validateSpec:d,objectElementValidators:Fd}),e.cluster)for(let x in e.clusterProperties){let[b,S]=e.clusterProperties[x],w=typeof b=="string"?[b,["accumulated"],["get",x]]:b;_.push(...io({key:`${n}.${x}.map`,value:S,expressionContext:"cluster-map"})),_.push(...io({key:`${n}.${x}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return _;case"video":return ir({key:n,value:e,valueSpec:s.source_video,style:c,validateSpec:d,styleSpec:s});case"image":return ir({key:n,value:e,valueSpec:s.source_image,style:c,validateSpec:d,styleSpec:s});case"canvas":return[new Ue(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ho({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function ic(r){let e=r.value,n=r.styleSpec,s=n.light,c=r.style,d=[],m=ft(e);if(e===void 0)return d;if(m!=="object")return d=d.concat([new Ue("light",e,`object expected, ${m} found`)]),d;for(let _ in e){let x=_.match(/^(.*)-transition$/);d=d.concat(x&&s[x[1]]&&s[x[1]].transition?r.validateSpec({key:_,value:e[_],valueSpec:n.transition,validateSpec:r.validateSpec,style:c,styleSpec:n}):s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Ue(_,e[_],`unknown property "${_}"`)])}return d}function Sm(r){let e=r.value,n=r.styleSpec,s=n.sky,c=r.style,d=ft(e);if(e===void 0)return[];if(d!=="object")return[new Ue("sky",e,`object expected, ${d} found`)];let m=[];for(let _ in e)m=m.concat(s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],style:c,styleSpec:n}):[new Ue(_,e[_],`unknown property "${_}"`)]);return m}function Ud(r){let e=r.value,n=r.styleSpec,s=n.terrain,c=r.style,d=[],m=ft(e);if(e===void 0)return d;if(m!=="object")return d=d.concat([new Ue("terrain",e,`object expected, ${m} found`)]),d;for(let _ in e)d=d.concat(s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Ue(_,e[_],`unknown property "${_}"`)]);return d}function Vd(r){let e=[],n=r.value,s=r.key;if(Array.isArray(n)){let c=[],d=[];for(let m in n)n[m].id&&c.includes(n[m].id)&&e.push(new Ue(s,n,`all the sprites' ids must be unique, but ${n[m].id} is duplicated`)),c.push(n[m].id),n[m].url&&d.includes(n[m].url)&&e.push(new Ue(s,n,`all the sprites' URLs must be unique, but ${n[m].url} is duplicated`)),d.push(n[m].url),e=e.concat(ir({key:`${s}[${m}]`,value:n[m],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return no({key:s,value:n})}function Mm(r){return!!r&&r.constructor===Object}function nc(r){return Mm(r.value)?[]:[new Ue(r.key,r.value,`object expected, ${ft(r.value)} found`)]}let jd={"*":()=>[],array:Tu,boolean:function(r){let e=r.value,n=r.key,s=ft(e);return s!=="boolean"?[new Ue(n,e,`boolean expected, ${s} found`)]:[]},number:Zs,color:tc,constants:ym,enum:Ho,filter:Hs,function:Su,layer:Tm,object:ir,source:Nd,light:ic,sky:Sm,terrain:Ud,projection:function(r){let e=r.value,n=r.styleSpec,s=n.projection,c=r.style,d=ft(e);if(e===void 0)return[];if(d!=="object")return[new Ue("projection",e,`object expected, ${d} found`)];let m=[];for(let _ in e)m=m.concat(s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],style:c,styleSpec:n}):[new Ue(_,e[_],`unknown property "${_}"`)]);return m},projectionDefinition:function(r){let e=r.key,n=r.value;n=n instanceof String?n.valueOf():n;let s=ft(n);return s!=="array"||(function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"})(n)||(function(c){return!!["interpolate","step","literal"].includes(c[0])})(n)?["array","string"].includes(s)?[]:[new Ue(e,n,`projection expected, invalid type "${s}" found`)]:[new Ue(e,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:no,formatted:function(r){return no(r).length===0?[]:io(r)},resolvedImage:function(r){return no(r).length===0?[]:io(r)},padding:function(r){let e=r.key,n=r.value;if(ft(n)==="array"){if(n.length<1||n.length>4)return[new Ue(e,n,`padding requires 1 to 4 values; ${n.length} values found`)];let s={type:"number"},c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${e}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:s}));return c}return Zs({key:e,value:n,valueSpec:{}})},numberArray:function(r){let e=r.key,n=r.value;if(ft(n)==="array"){let s={type:"number"};if(n.length<1)return[new Ue(e,n,"array length at least 1 expected, length 0 found")];let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${e}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:s}));return c}return Zs({key:e,value:n,valueSpec:{}})},colorArray:function(r){let e=r.key,n=r.value;if(ft(n)==="array"){if(n.length<1)return[new Ue(e,n,"array length at least 1 expected, length 0 found")];let s=[];for(let c=0;c<n.length;c++)s=s.concat(tc({key:`${e}[${c}]`,value:n[c]}));return s}return tc({key:e,value:n})},variableAnchorOffsetCollection:function(r){let e=r.key,n=r.value,s=ft(n),c=r.styleSpec;if(s!=="array"||n.length<1||n.length%2!=0)return[new Ue(e,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let m=0;m<n.length;m+=2)d=d.concat(Ho({key:`${e}[${m}]`,value:n[m],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Tu({key:`${e}[${m+1}]`,value:n[m+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:Vd,state:nc,fontFaces:function(r){let e=r.key,n=r.value,s=r.validateSpec,c=r.styleSpec,d=r.style;if(!Mm(n))return[new Ue(e,n,`object expected, ${ft(n)} found`)];let m=[];for(let _ in n){let x=n[_],b=ft(x);if(b==="string")m.push(...no({key:`${e}.${_}`,value:x}));else if(b==="array"){let S={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[w,A]of x.entries())m.push(...ir({key:`${e}.${_}[${w}]`,value:A,valueSpec:S,styleSpec:c,style:d,validateSpec:s}))}else m.push(new Ue(`${e}.${_}`,x,`string or array expected, ${b} found`))}return m}};function rc(r){let e=r.value,n=r.valueSpec,s=r.styleSpec;return r.validateSpec=rc,n.expression&&_u(Ai(e))?Su(r):n.expression&&yu(Zo(e))?io(r):n.type&&jd[n.type]?jd[n.type](r):ir(Do({},r,{valueSpec:n.type?s[n.type]:n}))}function $s(r){let e=r.value,n=r.key,s=no(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Ue(n,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Ue(n,e,'"glyphs" url must include a "{range}" token'))),s}function Mr(r,e=Ce){let n=[];return n=n.concat(rc({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:rc,objectElementValidators:{glyphs:$s,"*":()=>[]}})),r.constants&&(n=n.concat(ym({key:"constants",value:r.constants}))),Em(n)}function Hr(r){return function(e){return r(Object.assign({},e,{validateSpec:rc}))}}function Em(r){return[].concat(r).sort(((e,n)=>e.line-n.line))}function $r(r){return function(...e){return Em(r.apply(this,e))}}Mr.source=$r(Hr(Nd)),Mr.sprite=$r(Hr(Vd)),Mr.glyphs=$r(Hr($s)),Mr.light=$r(Hr(ic)),Mr.sky=$r(Hr(Sm)),Mr.terrain=$r(Hr(Ud)),Mr.state=$r(Hr(nc)),Mr.layer=$r(Hr(Tm)),Mr.filter=$r(Hr(Hs)),Mr.paintProperty=$r(Hr(xm)),Mr.layoutProperty=$r(Hr(wm));let C1={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class A1{constructor(e,n){this._globalState=n,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let n=Kl(e,C1,this._globalState);if(n.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(n.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=n.value,this._globalStateRefs=qs(n.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let ac=Ce,da=Mr,hr=da.light,oc=da.sky,Cm=da.paintProperty,z1=da.layoutProperty;function Am(r,e){let n=!1;if(e?.length)for(let s of e)r.fire(new Ka(new Error(s.message))),n=!0;return n}class Ra{constructor(e,n,s){let c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let m=new Int32Array(this.arrayBuffer);e=m[0],this.d=(n=m[1])+2*(s=m[2]);for(let x=0;x<this.d*this.d;x++){let b=m[3+x],S=m[3+x+1];c.push(b===S?null:m.subarray(b,S))}let _=m[3+c.length+1];this.keys=m.subarray(m[3+c.length],_),this.bboxes=m.subarray(_),this.insert=this._insertReadonly}else{this.d=n+2*s;for(let m=0;m<this.d*this.d;m++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=e,this.padding=s,this.scale=n/e,this.uid=0;let d=s/n*e;this.min=-d,this.max=e+d}insert(e,n,s,c,d){this._forEachCell(n,s,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,n,s,c,d,m){this.cells[d].push(m)}query(e,n,s,c,d){let m=this.min,_=this.max;if(e<=m&&n<=m&&_<=s&&_<=c&&!d)return[...this.keys];{let x=[];return this._forEachCell(e,n,s,c,this._queryCell,x,{},d),x}}_queryCell(e,n,s,c,d,m,_,x){let b=this.cells[d];if(b!==null){let S=this.keys,w=this.bboxes;for(let A of b)if(_[A]===void 0){let E=4*A;(x?x(w[E+0],w[E+1],w[E+2],w[E+3]):e<=w[E+2]&&n<=w[E+3]&&s>=w[E+0]&&c>=w[E+1])?(_[A]=!0,m.push(S[A])):_[A]=!1}}}_forEachCell(e,n,s,c,d,m,_,x){let b=this._convertToCellCoord(e),S=this._convertToCellCoord(n),w=this._convertToCellCoord(s),A=this._convertToCellCoord(c);for(let E=b;E<=w;E++)for(let R=S;R<=A;R++){let I=this.d*R+E;if((!x||x(this._convertFromCellCoord(E),this._convertFromCellCoord(R),this._convertFromCellCoord(E+1),this._convertFromCellCoord(R+1)))&&d.call(this,e,n,s,c,I,m,_,x))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,n=3+this.cells.length+1+1,s=0;for(let m of this.cells)s+=m.length;let c=new Int32Array(n+s+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let m=0;m<e.length;m++){let _=e[m];c[3+m]=d,c.set(_,d),d+=_.length}return c[3+e.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+e.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(e,n){let s=e.toArrayBuffer();return n&&n.push(s),{buffer:s}}static deserialize(e){return new Ra(e.buffer)}}let pa={};function Xe(r,e,n={}){if(pa[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),pa[r]={klass:e,omit:n.omit||[],shallow:n.shallow||[]}}Xe("Object",Object),Xe("Set",Set),Xe("TransferableGridIndex",Ra),Xe("Color",dt),Xe("Error",Error),Xe("AJAXError",Lt),Xe("ResolvedImage",lr),Xe("StylePropertyFunction",xu),Xe("StyleExpression",Wl,{omit:["_evaluator"]}),Xe("ZoomDependentExpression",bu),Xe("ZoomConstantExpression",vu),Xe("CompoundExpression",Sr,{omit:["_evaluate"]});for(let r in Us)Us[r]._classRegistryKey||Xe(`Expression_${r}`,Us[r]);function zm(r){var e;return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||((e=r.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function sc(r){return r.$name||r.constructor._classRegistryKey}function Dm(r){return!(function(e){if(e===null||typeof e!="object")return!1;let n=sc(e);return n&&n!=="Object"})(r)&&(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||r instanceof Blob||r instanceof Error||zm(r)||pn(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Ia(r,e){if(Dm(r))return(zm(r)||pn(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){let d=[];for(let m of r)d.push(Ia(m,e));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);let n=sc(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!pa[n])throw new Error(`${n} is not registered.`);let{klass:s}=pa[n],c=s.serialize?s.serialize(r,e):{};if(s.serialize){if(c===e?.[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let d in r){if(!r.hasOwnProperty(d)||pa[n].omit.includes(d))continue;let m=r[d];c[d]=pa[n].shallow.includes(d)?m:Ia(m,e)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function lc(r){if(Dm(r))return r;if(Array.isArray(r))return r.map(lc);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);let e=sc(r)||"Object";if(!pa[e])throw new Error(`can't deserialize unregistered class ${e}`);let{klass:n}=pa[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(r);let s=Object.create(n.prototype);for(let c of Object.keys(r)){if(c==="$name")continue;let d=r[c];s[c]=pa[e].shallow.includes(c)?d:lc(d)}return s}class qd{constructor(){this.first=!0}update(e,n){let s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=n):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=n),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function D1(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function $o(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Pm(r){return/\s/u.test(String.fromCodePoint(r))}function Gd(r){for(let e of r)if($o(e.codePointAt(0)))return!0;return!1}function Mu(r){for(let e of r)if(!Eu(e.codePointAt(0)))return!1;return!0}function Rm(r){let e=r.map((n=>{try{return new RegExp(`\\p{sc=${n}}`,"u").source}catch{return null}})).filter((n=>n));return new RegExp(e.join("|"),"u")}let Zd=Rm(["Arab","Dupl","Mong","Ougr","Syrc"]);function Eu(r){return!Zd.test(String.fromCodePoint(r))}function Hd(r){return!($o(r)||(e=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}let Im=Rm(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function $d(r){return Im.test(String.fromCodePoint(r))}function km(r,e){return!(!e&&$d(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Xd(r){for(let e of r)if($d(e.codePointAt(0)))return!0;return!1}let ka=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(ka.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return l(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;let n=r.pluginURL,s=new Promise((d=>{this.loadScriptResolve=d}));e(n);let c=new Promise((d=>setTimeout((()=>d()),this.TIMEOUT)));if(yield Promise.race([s,c]),this.isParsed()){let d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}))}};class Yt{constructor(e,n){this.isSupportedScript=Lm,this.zoom=e,n?(this.now=n.now||0,this.fadeDuration=n.fadeDuration||0,this.zoomHistory=n.zoomHistory||new qd,this.transition=n.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new qd,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,n=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*n}}}function Lm(r){return(function(e,n){for(let s of e)if(!km(s.codePointAt(0),n))return!1;return!0})(r,ka.getRTLTextPluginStatus()==="loaded")}let Cu="-transition";class cc{constructor(e,n,s){this.property=e,this.value=n,this.expression=(function(c,d,m){if(_u(c))return new xu(c,d);if(yu(c)){let _=gm(c,d,m);if(_.result==="error")throw new Error(_.value.map((x=>`${x.key}: ${x.message}`)).join(", "));return _.value}{let _=c;return d.type==="color"&&typeof c=="string"?_=dt.parse(c):d.type!=="padding"||typeof c!="number"&&!Array.isArray(c)?d.type!=="numberArray"||typeof c!="number"&&!Array.isArray(c)?d.type!=="colorArray"||typeof c!="string"&&!Array.isArray(c)?d.type==="variableAnchorOffsetCollection"&&Array.isArray(c)?_=Nn.parse(c):d.type==="projectionDefinition"&&typeof c=="string"&&(_=Un.parse(c)):_=ot.parse(c):_=pi.parse(c):_=En.parse(c),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>_}}})(n===void 0?e.specification.default:n,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,n,s){return this.property.possiblyEvaluate(this,e,n,s)}}class Yd{constructor(e,n){this.property=e,this.value=new cc(e,void 0,n)}transitioned(e,n){return new Kd(this.property,this.value,n,hi({},e.transition,this.transition),e.now)}untransitioned(){return new Kd(this.property,this.value,null,{},0)}}class Wd{constructor(e,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=n}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return tt(this._values[e].value.value)}setValue(e,n){Object.hasOwn(this._values,e)||(this._values[e]=new Yd(this._values[e].property,this._globalState)),this._values[e].value=new cc(this._values[e].property,n===null?void 0:tt(n),this._globalState)}getTransition(e){return tt(this._values[e].transition)}setTransition(e,n){Object.hasOwn(this._values,e)||(this._values[e]=new Yd(this._values[e].property,this._globalState)),this._values[e].transition=tt(n)||void 0}serialize(){let e={};for(let n of Object.keys(this._values)){let s=this.getValue(n);s!==void 0&&(e[n]=s);let c=this.getTransition(n);c!==void 0&&(e[`${n}${Cu}`]=c)}return e}transitioned(e,n){let s=new Om(this._properties);for(let c of Object.keys(this._values))s._values[c]=this._values[c].transitioned(e,n._values[c]);return s}untransitioned(){let e=new Om(this._properties);for(let n of Object.keys(this._values))e._values[n]=this._values[n].untransitioned();return e}}class Kd{constructor(e,n,s,c,d){this.property=e,this.value=n,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=s)}possiblyEvaluate(e,n,s){let c=e.now||0,d=this.value.possiblyEvaluate(e,n,s),m=this.prior;if(m){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return m.possiblyEvaluate(e,n,s);{let _=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(e,n,s),d,Ut(_))}}return d}}class Om{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,n,s){let c=new uc(this._properties);for(let d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(e,n,s);return c}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class P1{constructor(e,n){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=n}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return tt(this._values[e].value)}setValue(e,n){this._values[e]=new cc(this._values[e].property,n===null?void 0:tt(n),this._globalState)}serialize(){let e={};for(let n of Object.keys(this._values)){let s=this.getValue(n);s!==void 0&&(e[n]=s)}return e}possiblyEvaluate(e,n,s){let c=new uc(this._properties);for(let d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(e,n,s);return c}}class Xr{constructor(e,n,s){this.property=e,this.value=n,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,n,s,c){return this.property.evaluate(this.value,this.parameters,e,n,s,c)}}class uc{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Je{constructor(e){this.specification=e}possiblyEvaluate(e,n){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(n)}interpolate(e,n,s){let c=cr[this.specification.type];return c?c(e,n,s):e}}class nt{constructor(e,n){this.specification=e,this.overrides=n}possiblyEvaluate(e,n,s,c){return new Xr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(n,null,{},s,c)}:e.expression,n)}interpolate(e,n,s){if(e.value.kind!=="constant"||n.value.kind!=="constant")return e;if(e.value.value===void 0||n.value.value===void 0)return new Xr(this,{kind:"constant",value:void 0},e.parameters);let c=cr[this.specification.type];if(c){let d=c(e.value.value,n.value.value,s);return new Xr(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,n,s,c,d,m){return e.kind==="constant"?e.value:e.evaluate(n,s,c,d,m)}}class ro extends nt{possiblyEvaluate(e,n,s,c){if(e.value===void 0)return new Xr(this,{kind:"constant",value:void 0},n);if(e.expression.kind==="constant"){let d=e.expression.evaluate(n,null,{},s,c),m=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,_=this._calculate(m,m,m,n);return new Xr(this,{kind:"constant",value:_},n)}if(e.expression.kind==="camera"){let d=this._calculate(e.expression.evaluate({zoom:n.zoom-1}),e.expression.evaluate({zoom:n.zoom}),e.expression.evaluate({zoom:n.zoom+1}),n);return new Xr(this,{kind:"constant",value:d},n)}return new Xr(this,e.expression,n)}evaluate(e,n,s,c,d,m){if(e.kind==="source"){let _=e.evaluate(n,s,c,d,m);return this._calculate(_,_,_,n)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(n.zoom)-1},s,c),e.evaluate({zoom:Math.floor(n.zoom)},s,c),e.evaluate({zoom:Math.floor(n.zoom)+1},s,c),n):e.value}_calculate(e,n,s,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:s,to:n}}interpolate(e){return e}}class Bm{constructor(e){this.specification=e}possiblyEvaluate(e,n,s,c){if(e.value!==void 0){if(e.expression.kind==="constant"){let d=e.expression.evaluate(n,null,{},s,c);return this._calculate(d,d,d,n)}return this._calculate(e.expression.evaluate(new Yt(Math.floor(n.zoom-1),n)),e.expression.evaluate(new Yt(Math.floor(n.zoom),n)),e.expression.evaluate(new Yt(Math.floor(n.zoom+1),n)),n)}}_calculate(e,n,s,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:s,to:n}}interpolate(e){return e}}class Xs{constructor(e){this.specification=e}possiblyEvaluate(e,n,s,c){return!!e.expression.evaluate(n,null,{},s,c)}interpolate(){return!1}}class Vn{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let n in e){let s=e[n];s.specification.overridable&&this.overridableProperties.push(n);let c=this.defaultPropertyValues[n]=new cc(s,void 0,void 0),d=this.defaultTransitionablePropertyValues[n]=new Yd(s,void 0);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}Xe("DataDrivenProperty",nt),Xe("DataConstantProperty",Je),Xe("CrossFadedDataDrivenProperty",ro),Xe("CrossFadedProperty",Bm),Xe("ColorRampProperty",Xs);let Fm=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Au=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Er extends Ao{constructor(e,n,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(c,d){return new A1(c,d)})(this.visibility,s),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ql(e.filter,s)),n.layout&&(this._unevaluatedLayout=new P1(n.layout,s)),n.paint)){this._transitionablePaint=new Wd(n.paint,s);for(let c in e.paint)this.setPaintProperty(c,e.paint[c],{validate:!1});for(let c in e.layout)this.setLayoutProperty(c,e.layout[c],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new uc(n.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ql(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var n;if(e==="visibility")return this.visibility;if(!((n=this._transitionablePaint)===null||n===void 0)&&n.hasProperty(e))throw new Error(e+Fm);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let n of this._visibilityExpression.getGlobalStateRefs())e.add(n);if(this._unevaluatedLayout)for(let n in this._unevaluatedLayout._values){let s=this._unevaluatedLayout._values[n];for(let c of s.getGlobalStateRefs())e.add(c)}for(let n of this._featureFilter.getGlobalStateRefs())e.add(n);return e}getPaintAffectingGlobalStateRefs(){var e;let n=new globalThis.Map;if(this._transitionablePaint)for(let s in this._transitionablePaint._values){let c=this._transitionablePaint._values[s].value;for(let d of c.getGlobalStateRefs()){let m=(e=n.get(d))!==null&&e!==void 0?e:[];m.push({name:s,value:c.value}),n.set(d,m)}}return n}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,n,s={}){var c;if(e==="visibility")return this.visibility=n,this._visibilityExpression.setValue(n),void this.recalculateVisibility();!((c=this._transitionablePaint)===null||c===void 0)&&c.hasProperty(e)?this.fire(new Ka(new Error(e+Fm))):n!=null&&this._validate(z1,`layers.${this.id}.layout.${e}`,e,n,s)||this._unevaluatedLayout.setValue(e,n)}getPaintProperty(e){var n,s;if(e.endsWith(Cu)){let c=e.slice(0,-11);if(c==="visibility"||!((n=this._unevaluatedLayout)===null||n===void 0)&&n.hasProperty(c))throw new Error(e+Au);return this._transitionablePaint.getTransition(c)}if(e==="visibility"||!((s=this._unevaluatedLayout)===null||s===void 0)&&s.hasProperty(e))throw new Error(e+Au);return this._transitionablePaint.getValue(e)}setPaintProperty(e,n,s={}){var c;if(e==="visibility"||!((c=this._unevaluatedLayout)===null||c===void 0)&&c.hasProperty(e))return this.fire(new Ka(new Error(e+Au))),!1;if(n!=null&&this._validate(Cm,`layers.${this.id}.paint.${e}`,e,n,s))return!1;if(e.endsWith(Cu))return this._transitionablePaint.setTransition(e.slice(0,-11),n||void 0),!1;{let d=this._transitionablePaint._values[e],m=d.property.specification["property-type"]==="cross-faded-data-driven",_=d.value.isDataDriven(),x=d.value;this._transitionablePaint.setValue(e,n),this._handleSpecialPaintPropertyUpdate(e);let b=this._transitionablePaint._values[e].value;return b.isDataDriven()||_||m||this._handleOverridablePaintPropertyUpdate(e,x,b)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,n,s){return!1}isHidden(e=this.minzoom,n=!1){return!!(this.minzoom&&e<(n?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,n){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,n)}serialize(){var e,n;let s={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)===null||e===void 0?void 0:e.serialize(),paint:(n=this._transitionablePaint)===null||n===void 0?void 0:n.serialize()};return this.visibility&&(s.layout||(s.layout={}),s.layout.visibility=this.visibility),Nr(s,((c,d)=>!(c===void 0||d==="layout"&&!Object.keys(c).length||d==="paint"&&!Object.keys(c).length)))}_validate(e,n,s,c,d={}){return d?.validate!==!1&&Am(this,e.call(da,{key:n,layerType:this.type,objectKey:s,value:c,styleSpec:Ce,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let n=this.paint.get(e);if(n instanceof Xr&&js(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}let Qd;var R1={get paint(){return Qd=Qd||new Vn({"raster-opacity":new Je(Ce.paint_raster["raster-opacity"]),"raster-hue-rotate":new Je(Ce.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Je(Ce.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Je(Ce.paint_raster["raster-brightness-max"]),"raster-saturation":new Je(Ce.paint_raster["raster-saturation"]),"raster-contrast":new Je(Ce.paint_raster["raster-contrast"]),resampling:new Je(Ce.paint_raster.resampling),"raster-resampling":new Je(Ce.paint_raster["raster-resampling"]),"raster-fade-duration":new Je(Ce.paint_raster["raster-fade-duration"])})}};class I1 extends Er{constructor(e,n){super(e,R1,n)}}let k1={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class hc{constructor(e,n){this._structArray=e,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class fi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,n){return e._trim(),n&&(e.isTransferred=!0,n.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let n=Object.create(this.prototype);return n.arrayBuffer=e.arrayBuffer,n.length=e.length,n.capacity=e.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_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);let n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function Kt(r,e=1){let n=0,s=0;return{members:r.map((c=>{let d=k1[c.type].BYTES_PER_ELEMENT,m=n=Nm(n,Math.max(e,d)),_=c.components||1;return s=Math.max(s,d),n+=d*_,{name:c.name,type:c.type,components:_,offset:m}})),size:Nm(n,Math.max(s,e)),alignment:e}}function Nm(r,e){return Math.ceil(r/e)*e}class dc extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,n)}emplace(e,n,s){let c=2*e;return this.int16[c+0]=n,this.int16[c+1]=s,e}}dc.prototype.bytesPerElement=4,Xe("StructArrayLayout2i4",dc);class zu extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.int16[d+0]=n,this.int16[d+1]=s,this.int16[d+2]=c,e}}zu.prototype.bytesPerElement=6,Xe("StructArrayLayout3i6",zu);class Du extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,n,s,c)}emplace(e,n,s,c,d){let m=4*e;return this.int16[m+0]=n,this.int16[m+1]=s,this.int16[m+2]=c,this.int16[m+3]=d,e}}Du.prototype.bytesPerElement=8,Xe("StructArrayLayout4i8",Du);class Pu extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=6*e;return this.int16[x+0]=n,this.int16[x+1]=s,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=m,this.int16[x+5]=_,e}}Pu.prototype.bytesPerElement=12,Xe("StructArrayLayout2i4i12",Pu);class Jd extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=4*e,b=8*e;return this.int16[x+0]=n,this.int16[x+1]=s,this.uint8[b+4]=c,this.uint8[b+5]=d,this.uint8[b+6]=m,this.uint8[b+7]=_,e}}Jd.prototype.bytesPerElement=8,Xe("StructArrayLayout2i4ub8",Jd);class pc extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,n)}emplace(e,n,s){let c=2*e;return this.float32[c+0]=n,this.float32[c+1]=s,e}}pc.prototype.bytesPerElement=8,Xe("StructArrayLayout2f8",pc);class La extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S){let w=this.length;return this.resize(w+1),this.emplace(w,e,n,s,c,d,m,_,x,b,S)}emplace(e,n,s,c,d,m,_,x,b,S,w){let A=10*e;return this.uint16[A+0]=n,this.uint16[A+1]=s,this.uint16[A+2]=c,this.uint16[A+3]=d,this.uint16[A+4]=m,this.uint16[A+5]=_,this.uint16[A+6]=x,this.uint16[A+7]=b,this.uint16[A+8]=S,this.uint16[A+9]=w,e}}La.prototype.bytesPerElement=20,Xe("StructArrayLayout10ui20",La);class Ru extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x){let b=this.length;return this.resize(b+1),this.emplace(b,e,n,s,c,d,m,_,x)}emplace(e,n,s,c,d,m,_,x,b){let S=8*e;return this.uint16[S+0]=n,this.uint16[S+1]=s,this.uint16[S+2]=c,this.uint16[S+3]=d,this.uint16[S+4]=m,this.uint16[S+5]=_,this.uint16[S+6]=x,this.uint16[S+7]=b,e}}Ru.prototype.bytesPerElement=16,Xe("StructArrayLayout8ui16",Ru);class fc extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S,w,A){let E=this.length;return this.resize(E+1),this.emplace(E,e,n,s,c,d,m,_,x,b,S,w,A)}emplace(e,n,s,c,d,m,_,x,b,S,w,A,E){let R=12*e;return this.int16[R+0]=n,this.int16[R+1]=s,this.int16[R+2]=c,this.int16[R+3]=d,this.uint16[R+4]=m,this.uint16[R+5]=_,this.uint16[R+6]=x,this.uint16[R+7]=b,this.int16[R+8]=S,this.int16[R+9]=w,this.int16[R+10]=A,this.int16[R+11]=E,e}}fc.prototype.bytesPerElement=24,Xe("StructArrayLayout4i4ui4i24",fc);class Iu extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.float32[d+0]=n,this.float32[d+1]=s,this.float32[d+2]=c,e}}Iu.prototype.bytesPerElement=12,Xe("StructArrayLayout3f12",Iu);class mc extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint32[1*e+0]=n,e}}mc.prototype.bytesPerElement=4,Xe("StructArrayLayout1ul4",mc);class ep extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b){let S=this.length;return this.resize(S+1),this.emplace(S,e,n,s,c,d,m,_,x,b)}emplace(e,n,s,c,d,m,_,x,b,S){let w=10*e,A=5*e;return this.int16[w+0]=n,this.int16[w+1]=s,this.int16[w+2]=c,this.int16[w+3]=d,this.int16[w+4]=m,this.int16[w+5]=_,this.uint32[A+3]=x,this.uint16[w+8]=b,this.uint16[w+9]=S,e}}ep.prototype.bytesPerElement=20,Xe("StructArrayLayout6i1ul2ui20",ep);class Ys extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=6*e;return this.int16[x+0]=n,this.int16[x+1]=s,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=m,this.int16[x+5]=_,e}}Ys.prototype.bytesPerElement=12,Xe("StructArrayLayout2i2i2i12",Ys);class Xo extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d){let m=this.length;return this.resize(m+1),this.emplace(m,e,n,s,c,d)}emplace(e,n,s,c,d,m){let _=4*e,x=8*e;return this.float32[_+0]=n,this.float32[_+1]=s,this.float32[_+2]=c,this.int16[x+6]=d,this.int16[x+7]=m,e}}Xo.prototype.bytesPerElement=16,Xe("StructArrayLayout2f1f2i16",Xo);class tp extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=16*e,b=4*e,S=8*e;return this.uint8[x+0]=n,this.uint8[x+1]=s,this.float32[b+1]=c,this.float32[b+2]=d,this.int16[S+6]=m,this.int16[S+7]=_,e}}tp.prototype.bytesPerElement=16,Xe("StructArrayLayout2ub2f2i16",tp);class gc extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.uint16[d+0]=n,this.uint16[d+1]=s,this.uint16[d+2]=c,e}}gc.prototype.bytesPerElement=6,Xe("StructArrayLayout3ui6",gc);class Yo extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F){let V=this.length;return this.resize(V+1),this.emplace(V,e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F)}emplace(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V){let U=24*e,j=12*e,H=48*e;return this.int16[U+0]=n,this.int16[U+1]=s,this.uint16[U+2]=c,this.uint16[U+3]=d,this.uint32[j+2]=m,this.uint32[j+3]=_,this.uint32[j+4]=x,this.uint16[U+10]=b,this.uint16[U+11]=S,this.uint16[U+12]=w,this.float32[j+7]=A,this.float32[j+8]=E,this.uint8[H+36]=R,this.uint8[H+37]=I,this.uint8[H+38]=O,this.uint32[j+10]=F,this.int16[U+22]=V,e}}Yo.prototype.bytesPerElement=48,Xe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Yo);class ip extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U,j,H,X,ue,he,be,_e,Me,Ee){let we=this.length;return this.resize(we+1),this.emplace(we,e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U,j,H,X,ue,he,be,_e,Me,Ee)}emplace(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U,j,H,X,ue,he,be,_e,Me,Ee,we){let ye=32*e,Le=16*e;return this.int16[ye+0]=n,this.int16[ye+1]=s,this.int16[ye+2]=c,this.int16[ye+3]=d,this.int16[ye+4]=m,this.int16[ye+5]=_,this.int16[ye+6]=x,this.int16[ye+7]=b,this.uint16[ye+8]=S,this.uint16[ye+9]=w,this.uint16[ye+10]=A,this.uint16[ye+11]=E,this.uint16[ye+12]=R,this.uint16[ye+13]=I,this.uint16[ye+14]=O,this.uint16[ye+15]=F,this.uint16[ye+16]=V,this.uint16[ye+17]=U,this.uint16[ye+18]=j,this.uint16[ye+19]=H,this.uint16[ye+20]=X,this.uint16[ye+21]=ue,this.uint16[ye+22]=he,this.uint32[Le+12]=be,this.float32[Le+13]=_e,this.float32[Le+14]=Me,this.uint16[ye+30]=Ee,this.uint16[ye+31]=we,e}}ip.prototype.bytesPerElement=64,Xe("StructArrayLayout8i15ui1ul2f2ui64",ip);class ku extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.float32[1*e+0]=n,e}}ku.prototype.bytesPerElement=4,Xe("StructArrayLayout1f4",ku);class Lu extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.uint16[6*e+0]=n,this.float32[d+1]=s,this.float32[d+2]=c,e}}Lu.prototype.bytesPerElement=12,Xe("StructArrayLayout1ui2f12",Lu);class np extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=4*e;return this.uint32[2*e+0]=n,this.uint16[d+2]=s,this.uint16[d+3]=c,e}}np.prototype.bytesPerElement=8,Xe("StructArrayLayout1ul2ui8",np);class g extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,n)}emplace(e,n,s){let c=2*e;return this.uint16[c+0]=n,this.uint16[c+1]=s,e}}g.prototype.bytesPerElement=4,Xe("StructArrayLayout2ui4",g);class t extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint16[1*e+0]=n,e}}t.prototype.bytesPerElement=2,Xe("StructArrayLayout1ui2",t);class o extends fi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,n,s,c)}emplace(e,n,s,c,d){let m=4*e;return this.float32[m+0]=n,this.float32[m+1]=s,this.float32[m+2]=c,this.float32[m+3]=d,e}}o.prototype.bytesPerElement=16,Xe("StructArrayLayout4f16",o);class h extends hc{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new D(this.anchorPointX,this.anchorPointY)}}h.prototype.size=20;class p extends ep{get(e){return new h(this,e)}}Xe("CollisionBoxArray",p);class v extends hc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}v.prototype.size=48;class T extends Yo{get(e){return new v(this,e)}}Xe("PlacedSymbolArray",T);class M extends hc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}M.prototype.size=64;class C extends ip{get(e){return new M(this,e)}}Xe("SymbolInstanceArray",C);class z extends ku{getoffsetX(e){return this.float32[1*e+0]}}Xe("GlyphOffsetArray",z);class P extends zu{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Xe("SymbolLineVertexArray",P);class k extends hc{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}k.prototype.size=12;class L extends Lu{get(e){return new k(this,e)}}Xe("TextAnchorOffsetArray",L);class N extends hc{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]}}N.prototype.size=8;class G extends np{get(e){return new N(this,e)}}Xe("FeatureIndexArray",G);class $ extends dc{}class J extends dc{}class W extends dc{}class ee extends Pu{}class ae extends Jd{}class te extends pc{}class Q extends La{}class re extends Ru{}class ie extends fc{}class me extends Iu{}class Te extends mc{}class Se extends Ys{}class Pe extends tp{}class De extends gc{}class Qe extends g{}let je=Kt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ae}=je;class $e{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,n,s,c){let d=this.segments[this.segments.length-1];return e>$e.MAX_VERTEX_ARRAY_LENGTH&&Wt(`Max vertices per segment is ${$e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${$e.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+e>$e.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,s,c):d}createNewSegment(e,n,s){let c={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(c.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(e,n,s){return this.prepareSegment(0,e,n,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let n in e.vaos)e.vaos[n].destroy()}static simpleSegment(e,n,s,c){return new $e([{vertexOffset:e,primitiveOffset:n,vertexLength:s,primitiveLength:c,vaos:{},sortKey:0}])}}function et(r,e){return 256*(r=ri(Math.floor(r),0,255))+ri(Math.floor(e),0,255)}$e.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Xe("SegmentVector",$e);let It=Kt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),zi=Kt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var Vt,Li,Ui,Cn={exports:{}},bi={exports:{}},jn={exports:{}},yn=(function(){if(Ui)return Cn.exports;Ui=1;var r=(Vt||(Vt=1,bi.exports=function(n,s){var c,d,m,_,x,b,S,w;for(d=n.length-(c=3&n.length),m=s,x=3432918353,b=461845907,w=0;w<d;)S=255&n.charCodeAt(w)|(255&n.charCodeAt(++w))<<8|(255&n.charCodeAt(++w))<<16|(255&n.charCodeAt(++w))<<24,++w,m=27492+(65535&(_=5*(65535&(m=(m^=S=(65535&(S=(S=(65535&S)*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(_>>>16)&65535)<<16);switch(S=0,c){case 3:S^=(255&n.charCodeAt(w+2))<<16;case 2:S^=(255&n.charCodeAt(w+1))<<8;case 1:m^=S=(65535&(S=(S=(65535&(S^=255&n.charCodeAt(w)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295}return m^=n.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0}),bi.exports),e=(Li||(Li=1,jn.exports=function(n,s){for(var c,d=n.length,m=s^d,_=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(_)|(255&n.charCodeAt(++_))<<8|(255&n.charCodeAt(++_))<<16|(255&n.charCodeAt(++_))<<24))+((1540483477*(c>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++_;switch(d){case 3:m^=(255&n.charCodeAt(_+2))<<16;case 2:m^=(255&n.charCodeAt(_+1))<<8;case 1:m=1540483477*(65535&(m^=255&n.charCodeAt(_)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0}),jn.exports);return Cn.exports=r,Cn.exports.murmur3=r,Cn.exports.murmur2=e,Cn.exports})(),tn=B(yn);class An{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,n,s,c){this.ids.push(ao(e)),this.positions.push(n,s,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let n=ao(e),s=0,c=this.ids.length-1;for(;s<c;){let m=s+c>>1;this.ids[m]>=n?c=m:s=m+1}let d=[];for(;this.ids[s]===n;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,n){let s=new Float64Array(e.ids),c=new Uint32Array(e.positions);return oo(s,c,0,s.length-1),n&&n.push(s.buffer,c.buffer),{ids:s,positions:c}}static deserialize(e){let n=new An;return n.ids=e.ids,n.positions=e.positions,n.indexed=!0,n}}function ao(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:tn(String(r))}function oo(r,e,n,s){for(;n<s;){let c=r[n+s>>1],d=n-1,m=s+1;for(;;){do d++;while(r[d]<c);do m--;while(r[m]>c);if(d>=m)break;so(r,d,m),so(e,3*d,3*m),so(e,3*d+1,3*m+1),so(e,3*d+2,3*m+2)}m-n<s-m?(oo(r,e,n,m),n=m+1):(oo(r,e,m+1,s),s=m)}}function so(r,e,n){let s=r[e];r[e]=r[n],r[n]=s}Xe("FeaturePositionMap",An);class zn{constructor(e,n){this.gl=e.gl,this.location=n}}class Oa extends zn{constructor(e,n){super(e,n),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class lo extends zn{constructor(e,n){super(e,n),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ou extends zn{constructor(e,n){super(e,n),this.current=dt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let fa=new Float32Array(16);function ma(r){return[et(255*r.r,255*r.g),et(255*r.b,255*r.a)]}class dr{constructor(e,n,s){this.value=e,this.uniformNames=n.map((c=>`u_${c}`)),this.type=s}setUniform(e,n,s){e.set(s.constantOr(this.value))}getBinding(e,n,s){return this.type==="color"?new Ou(e,n):new Oa(e,n)}}class Cr{constructor(e,n){this.uniformNames=n.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,n){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,n.y,n.height,n.width]}setUniform(e,n,s,c){let d=null;c==="u_pattern_to"?d=this.patternTo:c==="u_pattern_from"?d=this.patternFrom:c==="u_dasharray_to"?d=this.dashTo:c==="u_dasharray_from"?d=this.dashFrom:c==="u_pixel_ratio_to"?d=this.pixelRatioTo:c==="u_pixel_ratio_from"&&(d=this.pixelRatioFrom),d!==null&&e.set(d)}getBinding(e,n,s){return s.startsWith("u_pattern")||s.startsWith("u_dasharray_")?new lo(e,n):new Oa(e,n)}}class mi{constructor(e,n,s,c){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=n.map((d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new c}populatePaintArray(e,n,s){let c=this.paintVertexArray.length,d=this.expression.evaluate(new Yt(0,s),n,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(c,e,d)}updatePaintArray(e,n,s,c,d){let m=this.expression.evaluate(new Yt(0,d),s,c);this._setPaintValue(e,n,m)}_setPaintValue(e,n,s){if(this.type==="color"){let c=ma(s);for(let d=e;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=e;c<n;c++)this.paintVertexArray.emplace(c,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){var n,s;!((n=this.paintVertexArray)===null||n===void 0)&&n.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ai{constructor(e,n,s,c,d,m){this.expression=e,this.uniformNames=n.map((_=>`u_${_}_t`)),this.type=s,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=n.map((_=>({name:`a_${_}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new m}populatePaintArray(e,n,s){let c=this.expression.evaluate(new Yt(this.zoom,s),n,{},s.canonical,[],s.formattedSection),d=this.expression.evaluate(new Yt(this.zoom+1,s),n,{},s.canonical,[],s.formattedSection),m=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(m,e,c,d)}updatePaintArray(e,n,s,c,d){let m=this.expression.evaluate(new Yt(this.zoom,d),s,c),_=this.expression.evaluate(new Yt(this.zoom+1,d),s,c);this._setPaintValue(e,n,m,_)}_setPaintValue(e,n,s,c){if(this.type==="color"){let d=ma(s),m=ma(c);for(let _=e;_<n;_++)this.paintVertexArray.emplace(_,d[0],d[1],m[0],m[1])}else{for(let d=e;d<n;d++)this.paintVertexArray.emplace(d,s,c);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(c))}}upload(e){var n,s;!((n=this.paintVertexArray)===null||n===void 0)&&n.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,n){let s=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=ri(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,n,s){return new Oa(e,n)}}class Vi{constructor(e,n,s,c,d,m){this.expression=e,this.type=n,this.useIntegerZoom=s,this.zoom=c,this.layerId=m,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,n,s){let c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,this.getPositionIds(n),s)}updatePaintArray(e,n,s,c,d){this._setPaintValues(e,n,this.getPositionIds(s),d)}_setPaintValues(e,n,s,c){let d=this.getPositions(c);if(!d||!s)return;let m=d[s.min],_=d[s.mid],x=d[s.max];if(m&&_&&x)for(let b=e;b<n;b++)this.emplace(this.zoomInPaintVertexArray,b,_,m),this.emplace(this.zoomOutPaintVertexArray,b,_,x)}upload(e){var n,s;if(!((n=this.zoomInPaintVertexArray)===null||n===void 0)&&n.arrayBuffer.byteLength&&(!((s=this.zoomOutPaintVertexArray)===null||s===void 0)&&s.arrayBuffer.byteLength)){let c=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,c,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,c,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class gi extends Vi{getPositions(e){return e.imagePositions}getPositionIds(e){var n;return(n=e.patterns)===null||n===void 0?void 0:n[this.layerId]}getVertexAttributes(){return It.members}emplace(e,n,s,c){e.emplace(n,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],c.tlbr[0],c.tlbr[1],c.tlbr[2],c.tlbr[3],s.pixelRatio,c.pixelRatio)}}class Wo extends Vi{getPositions(e){return e.dashPositions}getPositionIds(e){var n;return(n=e.dashes)===null||n===void 0?void 0:n[this.layerId]}getVertexAttributes(){return zi.members}emplace(e,n,s,c){e.emplace(n,0,s.y,s.height,s.width,0,c.y,c.height,c.width)}}class Bu{constructor(e,n,s){this.binders={},this._buffers=[];let c=[];for(let d in e.paint._values){if(!s(d))continue;let m=e.paint.get(d);if(!(m instanceof Xr&&js(m.property.specification)))continue;let _=rp(d,e.type),x=m.value,b=m.property.specification.type,S=m.property.useIntegerZoom,w=m.property.specification["property-type"],A=w==="cross-faded"||w==="cross-faded-data-driven";if(x.kind==="constant")this.binders[d]=A?new Cr(x.value,_):new dr(x.value,_,b),c.push(`/u_${d}`);else if(x.kind==="source"||A){let E=Um(d,b,"source");this.binders[d]=A?d==="line-dasharray"?new Wo(x,b,S,n,E,e.id):new gi(x,b,S,n,E,e.id):new mi(x,_,b,E),c.push(`/a_${d}`)}else{let E=Um(d,b,"composite");this.binders[d]=new ai(x,_,b,S,n,E),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){let n=this.binders[e];return n instanceof mi||n instanceof ai?n.maxValue:0}populatePaintArrays(e,n,s){for(let c in this.binders){let d=this.binders[c];(d instanceof mi||d instanceof ai||d instanceof Vi)&&d.populatePaintArray(e,n,s)}}setConstantPatternPositions(e,n){for(let s in this.binders){let c=this.binders[s];c instanceof Cr&&c.setConstantPatternPositions(e,n)}}setConstantDashPositions(e,n){for(let s in this.binders){let c=this.binders[s];c instanceof Cr&&c.setConstantDashPositions(e,n)}}updatePaintArrays(e,n,s,c,d){let m=!1;for(let _ in e){let x=n.getPositions(_);for(let b of x){let S=s.feature(b.index);for(let w in this.binders){let A=this.binders[w];if((A instanceof mi||A instanceof ai||A instanceof Vi)&&A.expression.isStateDependent===!0){let E=c.paint.get(w);A.expression=E.value,A.updatePaintArray(b.start,b.end,S,e[_],d),m=!0}}}}return m}defines(){let e=[];for(let n in this.binders){let s=this.binders[n];(s instanceof dr||s instanceof Cr)&&e.push(...s.uniformNames.map((c=>`#define HAS_UNIFORM_${c}`)))}return e}getBinderAttributes(){let e=[];for(let n in this.binders){let s=this.binders[n];if(s instanceof mi||s instanceof ai)for(let c of s.paintVertexAttributes)e.push(c.name);else if(s instanceof Vi){let c=s.getVertexAttributes();for(let d of c)e.push(d.name)}}return e}getBinderUniforms(){let e=[];for(let n in this.binders){let s=this.binders[n];if(s instanceof dr||s instanceof Cr||s instanceof ai)for(let c of s.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,n){let s=[];for(let c in this.binders){let d=this.binders[c];if(d instanceof dr||d instanceof Cr||d instanceof ai){for(let m of d.uniformNames)if(n[m]){let _=d.getBinding(e,n[m],m);s.push({name:m,property:c,binding:_})}}}return s}setUniforms(e,n,s,c){for(let{name:d,property:m,binding:_}of n)this.binders[m].setUniform(_,c,s.get(m),d)}updatePaintBuffers(e){this._buffers=[];for(let n in this.binders){let s=this.binders[n];if(e&&s instanceof Vi){let c=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(s instanceof mi||s instanceof ai)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(let n in this.binders){let s=this.binders[n];(s instanceof mi||s instanceof ai||s instanceof Vi)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let n=this.binders[e];(n instanceof mi||n instanceof ai||n instanceof Vi)&&n.destroy()}}}class Ba{constructor(e,n,s=()=>!0){this.programConfigurations={};for(let c of e)this.programConfigurations[c.id]=new Bu(c,n,s);this.needsUpload=!1,this._featureMap=new An,this._bufferOffset=0}populatePaintArrays(e,n,s,c){for(let d in this.programConfigurations)this.programConfigurations[d].populatePaintArrays(e,n,c);n.id!==void 0&&this._featureMap.add(n.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,n,s,c){for(let d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,n,d,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let n in this.programConfigurations)this.programConfigurations[n].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function rp(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Um(r,e,n){let s={color:{source:pc,composite:o},number:{source:ku,composite:pc}},c=(function(d){return{"line-pattern":{source:Q,composite:Q},"fill-pattern":{source:Q,composite:Q},"fill-extrusion-pattern":{source:Q,composite:Q},"line-dasharray":{source:re,composite:re}}[d]})(r);return c?.[n]||s[e][n]}Xe("ConstantBinder",dr),Xe("CrossFadedConstantBinder",Cr),Xe("SourceExpressionBinder",mi),Xe("CrossFadedPatternBinder",gi),Xe("CrossFadedDasharrayBinder",Wo),Xe("CompositeExpressionBinder",ai),Xe("ProgramConfiguration",Bu,{omit:["_buffers"]}),Xe("ProgramConfigurationSet",Ba);let ap=Math.pow(2,14)-1,co=-ap-1;function uo(r){let e=Ke/r.extent,n=r.loadGeometry();for(let s of n)for(let c of s){let d=Math.round(c.x*e),m=Math.round(c.y*e);c.x=ri(d,co,ap),c.y=ri(m,co,ap),(d<c.x||d>c.x+1||m<c.y||m>c.y+1)&&Wt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return n}function ho(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?uo(r):[]}}let op=-32768;function sp(r,e,n,s,c){r.emplaceBack(op+8*e+s,op+8*n+c)}class Fu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new J,this.indexArray=new De,this.segments=new $e,this.programConfigurations=new Ba(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){let c=this.layers[0],d=[],m=null,_=!1,x=c.type==="heatmap";if(c.type==="circle"){let S=c;m=S.layout.get("circle-sort-key"),_=!m.isConstant(),x||(x=S.paint.get("circle-pitch-alignment")==="map")}let b=x?n.subdivisionGranularity.circle:1;for(let{feature:S,id:w,index:A,sourceLayerIndex:E}of e){let R=this.layers[0]._featureFilter.needGeometry,I=ho(S,R);if(!this.layers[0]._featureFilter.filter(new Yt(this.zoom),I,s))continue;let O=_?m.evaluate(I,{},s):void 0,F={id:w,properties:S.properties,type:S.type,sourceLayerIndex:E,index:A,geometry:R?I.geometry:uo(S),patterns:{},sortKey:O};d.push(F)}_&&d.sort(((S,w)=>S.sortKey-w.sortKey));for(let S of d){let{geometry:w,index:A,sourceLayerIndex:E}=S,R=e[A].feature;this.addFeature(S,w,A,s,b),n.featureIndex.insert(R,w,A,E,this.index)}}update(e,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ae),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,n,s,c,d=1){let m;switch(d){case 1:m=[0,7];break;case 3:m=[0,2,5,7];break;case 5:m=[0,1,3,4,6,7];break;case 7:m=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}let _=m.length;for(let x of n)for(let b of x){let S=b.x,w=b.y;if(S<0||S>=Ke||w<0||w>=Ke)continue;let A=this.segments.prepareSegment(_*_,this.layoutVertexArray,this.indexArray,e.sortKey),E=A.vertexLength;for(let R=0;R<_;R++)for(let I=0;I<_;I++)sp(this.layoutVertexArray,S,w,m[I],m[R]);for(let R=0;R<_-1;R++)for(let I=0;I<_-1;I++){let O=E+R*_+I,F=E+(R+1)*_+I;this.indexArray.emplaceBack(O,F+1,O+1),this.indexArray.emplaceBack(O,F,F+1)}A.vertexLength+=_*_,A.primitiveLength+=(_-1)*(_-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:c})}}function Nu(r,e){for(let n of r)if(Uu(e,n))return!0;for(let n of e)if(Uu(r,n))return!0;return L1(r,e)}function Vm(r,e,n){return!!Uu(r,e)||O1(e,r,n)}function Qb(r,e){if(r.length===1)return ex(e,r[0]);for(let n of e)for(let s of n)if(Uu(r,s))return!0;for(let n of r)if(ex(e,n))return!0;for(let n of e)if(L1(r,n))return!0;return!1}function jS(r,e,n){if(r.length>1){if(L1(r,e))return!0;for(let s of e)if(O1(s,r,n))return!0}for(let s of r)if(O1(s,e,n))return!0;return!1}function L1(r,e){if(r.length===0||e.length===0)return!1;for(let n=0;n<r.length-1;n++){let s=r[n],c=r[n+1];for(let d=0;d<e.length-1;d++)if(qS(s,c,e[d],e[d+1]))return!0}return!1}function qS(r,e,n,s){return Fi(r,n,s)!==Fi(e,n,s)&&Fi(r,e,n)!==Fi(r,e,s)}function O1(r,e,n){let s=n*n;if(e.length===1)return r.distSqr(e[0])<s;for(let c=1;c<e.length;c++)if(Jb(r,e[c-1],e[c])<s)return!0;return!1}function Jb(r,e,n){let s=e.distSqr(n);if(s===0)return r.distSqr(e);let c=((r.x-e.x)*(n.x-e.x)+(r.y-e.y)*(n.y-e.y))/s;return r.distSqr(c<0?e:c>1?n:n.sub(e)._mult(c)._add(e))}function ex(r,e){let n,s,c,d=!1;for(let m of r){n=m;for(let _=0,x=n.length-1;_<n.length;x=_++)s=n[_],c=n[x],s.y>e.y!=c.y>e.y&&e.x<(c.x-s.x)*(e.y-s.y)/(c.y-s.y)+s.x&&(d=!d)}return d}function Uu(r,e){let n=!1;for(let s=0,c=r.length-1;s<r.length;c=s++){let d=r[s],m=r[c];d.y>e.y!=m.y>e.y&&e.x<(m.x-d.x)*(e.y-d.y)/(m.y-d.y)+d.x&&(n=!n)}return n}function GS(r,e,n){let s=n[0],c=n[2];if(r.x<s.x&&e.x<s.x||r.x>c.x&&e.x>c.x||r.y<s.y&&e.y<s.y||r.y>c.y&&e.y>c.y)return!1;let d=Fi(r,e,n[0]);return d!==Fi(r,e,n[1])||d!==Fi(r,e,n[2])||d!==Fi(r,e,n[3])}function Vu(r,e,n){let s=e.paint.get(r).value;return s.kind==="constant"?s.value:n.programConfigurations.get(e.id).getMaxValue(r)}function jm(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function qm(r,e,n,s,c){if(!e[0]&&!e[1])return r;let d=D.convert(e)._mult(c);n==="viewport"&&d._rotate(-s);let m=[];for(let _ of r)m.push(_.sub(d));return m}function ZS(r){let e=[];for(let n=0;n<r.length;n++){let s=r[n],c=e.at(-1);(n===0||c&&!s.equals(c))&&e.push(s)}return e}function HS({queryGeometry:r,size:e},n){return Vm(r,n,e)}function $S({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c},d){return Vm(r,d,e*(n.projectTileCoordinates(d.x,d.y,s,c).signedDistanceFromCamera/n.cameraToCenterDistance))}function XS({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c},d){let m=n.projectTileCoordinates(d.x,d.y,s,c).signedDistanceFromCamera,_=e*(n.cameraToCenterDistance/m);return Vm(r,B1(d,n,s,c),_)}function YS({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c},d){return Vm(r,B1(d,n,s,c),e)}function tx({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c,pitchAlignment:d="map",pitchScale:m="map"},_){let x=d==="map"?m==="map"?HS:$S:m==="map"?XS:YS,b={queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c};for(let S of _)for(let w of S)if(x(b,w))return!0;return!1}function B1(r,e,n,s){let c=e.projectTileCoordinates(r.x,r.y,n,s).point;return new D((.5*c.x+.5)*e.width,(.5*-c.y+.5)*e.height)}let ix,nx;Xe("CircleBucket",Fu,{omit:["layers"]});var WS={get paint(){return nx=nx||new Vn({"circle-radius":new nt(Ce.paint_circle["circle-radius"]),"circle-color":new nt(Ce.paint_circle["circle-color"]),"circle-blur":new nt(Ce.paint_circle["circle-blur"]),"circle-opacity":new nt(Ce.paint_circle["circle-opacity"]),"circle-translate":new Je(Ce.paint_circle["circle-translate"]),"circle-translate-anchor":new Je(Ce.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Je(Ce.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Je(Ce.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new nt(Ce.paint_circle["circle-stroke-width"]),"circle-stroke-color":new nt(Ce.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new nt(Ce.paint_circle["circle-stroke-opacity"])})},get layout(){return ix=ix||new Vn({"circle-sort-key":new nt(Ce.layout_circle["circle-sort-key"])})}};class KS extends Er{constructor(e,n){super(e,WS,n)}createBucket(e){return new Fu(e)}queryRadius(e){let n=e;return Vu("circle-radius",this,n)+Vu("circle-stroke-width",this,n)+jm(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m,unwrappedTileID:_,getElevation:x}){let b=qm(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,m),S=this.paint.get("circle-radius").evaluate(n,s)+this.paint.get("circle-stroke-width").evaluate(n,s),w=this.paint.get("circle-pitch-scale"),A=this.paint.get("circle-pitch-alignment"),E,R;return A==="map"?(E=b,R=S*m):(E=(function(I,O,F,V){return I.map((U=>B1(U,O,F,V)))})(b,d,_,x),R=S),tx({queryGeometry:E,size:R,transform:d,unwrappedTileID:_,getElevation:x,pitchAlignment:A,pitchScale:w},c)}}class rx extends Fu{}let ax;Xe("HeatmapBucket",rx,{omit:["layers"]});var QS={get paint(){return ax=ax||new Vn({"heatmap-radius":new nt(Ce.paint_heatmap["heatmap-radius"]),"heatmap-weight":new nt(Ce.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Je(Ce.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Xs(Ce.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Je(Ce.paint_heatmap["heatmap-opacity"])})}};function F1(r,{width:e,height:n},s,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*n*s)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*n*s}`)}else c=new Uint8Array(e*n*s);return r.width=e,r.height=n,r.data=c,r}function ox(r,{width:e,height:n},s){if(e===r.width&&n===r.height)return;let c=F1({},{width:e,height:n},s);N1(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,n)},s),r.width=e,r.height=n,r.data=c.data}function N1(r,e,n,s,c,d){if(c.width===0||c.height===0)return e;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||s.x>e.width-c.width||s.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");let m=r.data,_=e.data;if(m===_)throw new Error("srcData equals dstData, so image is already copied");for(let x=0;x<c.height;x++){let b=((n.y+x)*r.width+n.x)*d,S=((s.y+x)*e.width+s.x)*d;for(let w=0;w<c.width*d;w++)_[S+w]=m[b+w]}return e}class lp{constructor(e,n){F1(this,e,1,n)}resize(e){ox(this,e,1)}clone(){return new lp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,n,s,c,d){N1(e,n,s,c,d,1)}}class pr{constructor(e,n){F1(this,e,4,n)}resize(e){ox(this,e,4)}replace(e,n){n?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new pr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,n,s,c,d){N1(e,n,s,c,d,4)}setPixel(e,n,s){let c=4*(e*this.width+n);this.data[c+0]=Math.round(255*s.r/s.a),this.data[c+1]=Math.round(255*s.g/s.a),this.data[c+2]=Math.round(255*s.b/s.a),this.data[c+3]=Math.round(255*s.a)}}function sx(r){let e=new Uint8Array(r.length);for(let n=0;n<r.length;n+=4){let s=r[n+3];e[n+0]=Math.round(r[n+0]*s/255),e[n+1]=Math.round(r[n+1]*s/255),e[n+2]=Math.round(r[n+2]*s/255),e[n+3]=s}return e}function lx(r){let e={},n=r.resolution||256,s=r.clips?r.clips.length:1,c=r.image||new pr({width:n,height:s});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);let d=(m,_,x)=>{e[r.evaluationKey]=x;let b=r.expression.evaluate(e);c.setPixel(m/4/n,_/4,b)};if(r.clips)for(let m=0,_=0;m<s;++m,_+=4*n)for(let x=0,b=0;x<n;x++,b+=4){let S=x/(n-1),{start:w,end:A}=r.clips[m];d(_,b,w*(1-S)+A*S)}else for(let m=0,_=0;m<n;m++,_+=4)d(0,_,m/(n-1));return c}Xe("AlphaImage",lp),Xe("RGBAImage",pr);let U1="big-fb";class JS extends Er{createBucket(e){return new rx(e)}constructor(e,n){super(e,QS,n),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=lx({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(U1)&&this.heatmapFbos.delete(U1)}queryRadius(e){return Vu("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m,unwrappedTileID:_,getElevation:x}){return tx({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(n,s)*m,transform:d,unwrappedTileID:_,getElevation:x},c)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let cx;var e6={get paint(){return cx=cx||new Vn({"hillshade-illumination-direction":new Je(Ce.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Je(Ce.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Je(Ce.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Je(Ce.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Je(Ce.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Je(Ce.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Je(Ce.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Je(Ce.paint_hillshade["hillshade-method"]),resampling:new Je(Ce.paint_hillshade.resampling)})}};class t6 extends Er{constructor(e,n){super(e,e6,n),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,n=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values,d=Math.max(e.length,n.length,s.length,c.length);e=e.concat(Array(d-e.length).fill(e.at(-1))),n=n.concat(Array(d-n.length).fill(n.at(-1))),s=s.concat(Array(d-s.length).fill(s.at(-1))),c=c.concat(Array(d-c.length).fill(c.at(-1)));let m=n.map(Tr);return{directionRadians:e.map(Tr),altitudeRadians:m,shadowColor:c,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let ux;var i6={get paint(){return ux=ux||new Vn({"color-relief-opacity":new Je(Ce["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Xs(Ce["paint_color-relief"]["color-relief-color"]),resampling:new Je(Ce["paint_color-relief"].resampling)})}};function hx(r){return"data"in r}class V1{constructor(e,n,s,c){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(n,c)}update(e,n,s){var c;let{width:d,height:m}=e,_=(((c=this.size)===null||c===void 0?void 0:c[0])!==d||this.size[1]!==m)&&!s,{context:x}=this,{gl:b}=x;this.useMipmap=!!n?.useMipmap,b.bindTexture(b.TEXTURE_2D,this.texture),x.pixelStoreUnpackFlipY.set(!1),x.pixelStoreUnpack.set(1);let S=this.format===b.RGBA&&n?.premultiply!==!1;if(_)this.size=[d,m],hx(e)?(x.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,S,d,m,b)):(x.pixelStoreUnpackPremultiplyAlpha.set(S),this._uploadDomImage(e,b));else{let{x:w,y:A}=s||{x:0,y:0};hx(e)?(x.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,S,w,A,d,m,b)):(x.pixelStoreUnpackPremultiplyAlpha.set(S),this._updateDomImage(e,w,A,b))}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D),x.pixelStoreUnpackFlipY.setDefault(),x.pixelStoreUnpack.setDefault(),x.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,n){n.texImage2D(n.TEXTURE_2D,0,this.format,this.format,n.UNSIGNED_BYTE,e)}_uploadRawData(e,n,s,c,d){let{data:m}=e;n&&m&&(m=sx(m)),d.texImage2D(d.TEXTURE_2D,0,this.format,s,c,0,this.format,d.UNSIGNED_BYTE,m)}_updateDomImage(e,n,s,c){c.texSubImage2D(c.TEXTURE_2D,0,n,s,c.RGBA,c.UNSIGNED_BYTE,e)}_updateRawData(e,n,s,c,d,m,_){let{data:x}=e;n&&x&&(x=sx(x)),_.texSubImage2D(_.TEXTURE_2D,0,s,c,d,m,_.RGBA,_.UNSIGNED_BYTE,x)}bind(e,n,s){let{context:c}=this,{gl:d}=c;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),e!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,e),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||e),this.filter=e),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class dx{constructor(e,n,s,c=1,d=1,m=1,_=0){if(this.uid=e,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void Wt(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=n.height;let x=this.dim=n.height-2;switch(this.data=new Uint32Array(n.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=m,this.baseShift=_;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let b=0;b<x;b++)this.data[this._idx(-1,b)]=this.data[this._idx(0,b)],this.data[this._idx(x,b)]=this.data[this._idx(x-1,b)],this.data[this._idx(b,-1)]=this.data[this._idx(b,0)],this.data[this._idx(b,x)]=this.data[this._idx(b,x-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(x,-1)]=this.data[this._idx(x-1,0)],this.data[this._idx(-1,x)]=this.data[this._idx(0,x-1)],this.data[this._idx(x,x)]=this.data[this._idx(x-1,x-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let b=0;b<x;b++)for(let S=0;S<x;S++){let w=this.get(b,S);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(e,n){let s=new Uint8Array(this.data.buffer),c=4*this._idx(e,n);return this.unpack(s[c],s[c+1],s[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,n){if(e<-1||e>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${n}, dim: ${this.dim}`);return(n+1)*this.stride+(e+1)}unpack(e,n,s){return e*this.redFactor+n*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return px(e,this.getUnpackVector())}getPixels(){return new pr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,n,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,m=s*this.dim,_=s*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(s){case-1:m=_-1;break;case 1:_=m+1}let x=-n*this.dim,b=-s*this.dim;for(let S=m;S<_;S++)for(let w=c;w<d;w++)this.data[this._idx(w,S)]=e.data[this._idx(w+x,S+b)]}}function px(r,e){let n=e[0],s=e[1],c=e[2],d=e[3],m=Math.min(n,s,c),_=Math.round((r+d)/m);return{r:Math.floor(_*m/n)%256,g:Math.floor(_*m/s)%256,b:Math.floor(_*m/c)%256}}Xe("DEMData",dx);class n6 extends Er{constructor(e,n){super(e,i6,n)}_createColorRamp(e){let n={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof vu&&s._styleExpression.expression instanceof ki){this.colorRampExpression=s;let m=s._styleExpression.expression;n.elevationStops=m.labels,n.colorStops=[];for(let _ of n.elevationStops)n.colorStops.push(m.evaluate({globals:{elevation:_}}))}if(n.elevationStops.length<1&&(n.elevationStops=[0],n.colorStops=[dt.transparent]),n.elevationStops.length<2&&(n.elevationStops.push(n.elevationStops[0]+1),n.colorStops.push(n.colorStops[0])),n.elevationStops.length<=e)return n;let c={elevationStops:[],colorStops:[]},d=(n.elevationStops.length-1)/(e-1);for(let m=0;m<n.elevationStops.length-.5;m+=d)c.elevationStops.push(n.elevationStops[Math.round(m)]),c.colorStops.push(n.colorStops[Math.round(m)]);return Wt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${n.elevationStops.length}`),c}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,n,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let c=this._createColorRamp(n),d=new pr({width:c.colorStops.length,height:1}),m=new pr({width:c.colorStops.length,height:1});for(let _=0;_<c.elevationStops.length;_++){let x=px(c.elevationStops[_],s);m.setPixel(0,_,new dt(x.r/255,x.g/255,x.b/255,1)),d.setPixel(0,_,c.colorStops[_])}return this.colorRampTextures={elevationTexture:new V1(e,m,e.gl.RGBA),colorTexture:new V1(e,d,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let r6=Kt([{name:"a_pos",components:2,type:"Int16"}],4),{members:a6}=r6;function Gm(r,e,n){let s=n.patternDependencies,c=!1;for(let d of e){let m=d.paint.get(`${r}-pattern`);m.isConstant()||(c=!0);let _=m.constantOr(null);_&&(c=!0,s[_.to]=!0,s[_.from]=!0)}return c}function j1(r,e,n,s,c){let{zoom:d}=s,m=c.patternDependencies;for(let _ of e){let x=_.paint.get(`${r}-pattern`).value;if(x.kind!=="constant"){let b=x.evaluate({zoom:d-1},n,{},c.availableImages),S=x.evaluate({zoom:d},n,{},c.availableImages),w=x.evaluate({zoom:d+1},n,{},c.availableImages);b=b?.name?b.name:b,S=S?.name?S.name:S,w=w?.name?w.name:w,m[b]=!0,m[S]=!0,m[w]=!0,n.patterns[_.id]={min:b,mid:S,max:w}}}return n}function fx(r,e,n,s,c){let d;if(c===(function(m,_,x,b){let S=0;for(let w=_,A=x-b;w<x;w+=b)S+=(m[A]-m[w])*(m[w+1]+m[A+1]),A=w;return S})(r,e,n,s)>0)for(let m=e;m<n;m+=s)d=yx(m/s|0,r[m],r[m+1],d);else for(let m=n-s;m>=e;m-=s)d=yx(m/s|0,r[m],r[m+1],d);return d&&ju(d,d.next)&&(dp(d),d=d.next),d}function _c(r,e){if(!r)return r;e||(e=r);let n,s=r;do if(n=!1,s.steiner||!ju(s,s.next)&&Oi(s.prev,s,s.next)!==0)s=s.next;else{if(dp(s),s=e=s.prev,s===s.next)break;n=!0}while(n||s!==e);return e}function cp(r,e,n,s,c,d,m){if(!r)return;!m&&d&&(function(x,b,S,w){let A=x;do A.z===0&&(A.z=q1(A.x,A.y,b,S,w)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==x);A.prevZ.nextZ=null,A.prevZ=null,(function(E){let R,I=1;do{let O,F=E;E=null;let V=null;for(R=0;F;){R++;let U=F,j=0;for(let X=0;X<I&&(j++,U=U.nextZ,U);X++);let H=I;for(;j>0||H>0&&U;)j!==0&&(H===0||!U||F.z<=U.z)?(O=F,F=F.nextZ,j--):(O=U,U=U.nextZ,H--),V?V.nextZ=O:E=O,O.prevZ=V,V=O;F=U}V.nextZ=null,I*=2}while(R>1)})(A)})(r,s,c,d);let _=r;for(;r.prev!==r.next;){let x=r.prev,b=r.next;if(d?s6(r,s,c,d):o6(r))e.push(x.i,r.i,b.i),dp(r),r=b.next,_=b.next;else if((r=b)===_){m?m===1?cp(r=l6(_c(r),e),e,n,s,c,d,2):m===2&&c6(r,e,n,s,c,d):cp(_c(r),e,n,s,c,d,1);break}}}function o6(r){let e=r.prev,n=r,s=r.next;if(Oi(e,n,s)>=0)return!1;let c=e.x,d=n.x,m=s.x,_=e.y,x=n.y,b=s.y,S=Math.min(c,d,m),w=Math.min(_,x,b),A=Math.max(c,d,m),E=Math.max(_,x,b),R=s.next;for(;R!==e;){if(R.x>=S&&R.x<=A&&R.y>=w&&R.y<=E&&up(c,_,d,x,m,b,R.x,R.y)&&Oi(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function s6(r,e,n,s){let c=r.prev,d=r,m=r.next;if(Oi(c,d,m)>=0)return!1;let _=c.x,x=d.x,b=m.x,S=c.y,w=d.y,A=m.y,E=Math.min(_,x,b),R=Math.min(S,w,A),I=Math.max(_,x,b),O=Math.max(S,w,A),F=q1(E,R,e,n,s),V=q1(I,O,e,n,s),U=r.prevZ,j=r.nextZ;for(;U&&U.z>=F&&j&&j.z<=V;){if(U.x>=E&&U.x<=I&&U.y>=R&&U.y<=O&&U!==c&&U!==m&&up(_,S,x,w,b,A,U.x,U.y)&&Oi(U.prev,U,U.next)>=0||(U=U.prevZ,j.x>=E&&j.x<=I&&j.y>=R&&j.y<=O&&j!==c&&j!==m&&up(_,S,x,w,b,A,j.x,j.y)&&Oi(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;U&&U.z>=F;){if(U.x>=E&&U.x<=I&&U.y>=R&&U.y<=O&&U!==c&&U!==m&&up(_,S,x,w,b,A,U.x,U.y)&&Oi(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;j&&j.z<=V;){if(j.x>=E&&j.x<=I&&j.y>=R&&j.y<=O&&j!==c&&j!==m&&up(_,S,x,w,b,A,j.x,j.y)&&Oi(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l6(r,e){let n=r;do{let s=n.prev,c=n.next.next;!ju(s,c)&&gx(s,n,n.next,c)&&hp(s,c)&&hp(c,s)&&(e.push(s.i,n.i,c.i),dp(n),dp(n.next),n=r=c),n=n.next}while(n!==r);return _c(n)}function c6(r,e,n,s,c,d){let m=r;do{let _=m.next.next;for(;_!==m.prev;){if(m.i!==_.i&&f6(m,_)){let x=_x(m,_);return m=_c(m,m.next),x=_c(x,x.next),cp(m,e,n,s,c,d,0),void cp(x,e,n,s,c,d,0)}_=_.next}m=m.next}while(m!==r)}function u6(r,e){let n=r.x-e.x;return n===0&&(n=r.y-e.y,n===0)&&(n=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),n}function h6(r,e){let n=(function(c,d){let m=d,_=c.x,x=c.y,b,S=-1/0;if(ju(c,m))return m;do{if(ju(c,m.next))return m.next;if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){let I=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(I<=_&&I>S&&(S=I,b=m.x<m.next.x?m:m.next,I===_))return b}m=m.next}while(m!==d);if(!b)return null;let w=b,A=b.x,E=b.y,R=1/0;m=b;do{if(_>=m.x&&m.x>=A&&_!==m.x&&mx(x<E?_:S,x,A,E,x<E?S:_,x,m.x,m.y)){let I=Math.abs(x-m.y)/(_-m.x);hp(m,c)&&(I<R||I===R&&(m.x>b.x||m.x===b.x&&d6(b,m)))&&(b=m,R=I)}m=m.next}while(m!==w);return b})(r,e);if(!n)return e;let s=_x(n,r);return _c(s,s.next),_c(n,n.next)}function d6(r,e){return Oi(r.prev,r,e.prev)<0&&Oi(e.next,r,r.next)<0}function q1(r,e,n,s,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p6(r){let e=r,n=r;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==r);return n}function mx(r,e,n,s,c,d,m,_){return(c-m)*(e-_)>=(r-m)*(d-_)&&(r-m)*(s-_)>=(n-m)*(e-_)&&(n-m)*(d-_)>=(c-m)*(s-_)}function up(r,e,n,s,c,d,m,_){return!(r===m&&e===_)&&mx(r,e,n,s,c,d,m,_)}function f6(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(n,s){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==s.i&&c.next.i!==s.i&&gx(c,c.next,n,s))return!0;c=c.next}while(c!==n);return!1})(r,e)&&(hp(r,e)&&hp(e,r)&&(function(n,s){let c=n,d=!1,m=(n.x+s.x)/2,_=(n.y+s.y)/2;do c.y>_!=c.next.y>_&&c.next.y!==c.y&&m<(c.next.x-c.x)*(_-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d})(r,e)&&(Oi(r.prev,r,e.prev)||Oi(r,e.prev,e))||ju(r,e)&&Oi(r.prev,r,r.next)>0&&Oi(e.prev,e,e.next)>0)}function Oi(r,e,n){return(e.y-r.y)*(n.x-e.x)-(e.x-r.x)*(n.y-e.y)}function ju(r,e){return r.x===e.x&&r.y===e.y}function gx(r,e,n,s){let c=Hm(Oi(r,e,n)),d=Hm(Oi(r,e,s)),m=Hm(Oi(n,s,r)),_=Hm(Oi(n,s,e));return c!==d&&m!==_||!(c!==0||!Zm(r,n,e))||!(d!==0||!Zm(r,s,e))||!(m!==0||!Zm(n,r,s))||!(_!==0||!Zm(n,e,s))}function Zm(r,e,n){return e.x<=Math.max(r.x,n.x)&&e.x>=Math.min(r.x,n.x)&&e.y<=Math.max(r.y,n.y)&&e.y>=Math.min(r.y,n.y)}function Hm(r){return r>0?1:r<0?-1:0}function hp(r,e){return Oi(r.prev,r,r.next)<0?Oi(r,e,r.next)>=0&&Oi(r,r.prev,e)>=0:Oi(r,e,r.prev)<0||Oi(r,r.next,e)<0}function _x(r,e){let n=G1(r.i,r.x,r.y),s=G1(e.i,e.x,e.y),c=r.next,d=e.prev;return r.next=e,e.prev=r,n.next=c,c.prev=n,s.next=n,n.prev=s,d.next=s,s.prev=d,s}function yx(r,e,n,s){let c=G1(r,e,n);return s?(c.next=s.next,c.prev=s,s.next.prev=c,s.next=c):(c.prev=c,c.next=c),c}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 G1(r,e,n){return{i:r,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class qu{constructor(e,n){if(n>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=n}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class $m{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}$m.noSubdivision=new $m({fill:new qu(0,0),line:new qu(0,0),tile:new qu(0,0),stencil:new qu(0,0),circle:1}),Xe("SubdivisionGranularityExpression",qu),Xe("SubdivisionGranularitySetting",$m);let Gu=-32768,pp=32767;class m6{constructor(e,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Ke/e,this._canonical=n}_getKey(e,n){return(e+=32768)<<16|n+32768}_vertexToIndex(e,n){if(e<-32768||n<-32768||e>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let s=0|Math.round(e),c=0|Math.round(n),d=this._getKey(s,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);let m=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,m),this._vertexBuffer.push(s,c),m}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(c,d){let m=[];for(let _=0;_<d.length;_+=3){let x=d[_],b=d[_+1],S=d[_+2],w=c[2*x],A=c[2*x+1];(c[2*b]-w)*(c[2*S+1]-A)-(c[2*b+1]-A)*(c[2*S]-w)>0?(m.push(x),m.push(S),m.push(b)):(m.push(x),m.push(b),m.push(S))}return m})(this._vertexBuffer,e);let n=[],s=e.length;for(let c=0;c<s;c+=3){let d=[e[c+0],e[c+1],e[c+2]],m=[this._vertexBuffer[2*e[c+0]+0],this._vertexBuffer[2*e[c+0]+1],this._vertexBuffer[2*e[c+1]+0],this._vertexBuffer[2*e[c+1]+1],this._vertexBuffer[2*e[c+2]+0],this._vertexBuffer[2*e[c+2]+1]],_=1/0,x=1/0,b=-1/0,S=-1/0;for(let I=0;I<3;I++){let O=m[2*I],F=m[2*I+1];_=Math.min(_,O),b=Math.max(b,O),x=Math.min(x,F),S=Math.max(S,F)}if(_===b||x===S)continue;let w=Math.floor(_/this._granularityCellSize),A=Math.ceil(b/this._granularityCellSize),E=Math.floor(x/this._granularityCellSize),R=Math.ceil(S/this._granularityCellSize);if(w!==A||E!==R)for(let I=E;I<R;I++){let O=this._scanlineGenerateVertexRingForCellRow(I,m,d);g6(this._vertexBuffer,O,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(e,n,s){let c=e*this._granularityCellSize,d=c+this._granularityCellSize,m=[];for(let _=0;_<3;_++){let x=n[2*_],b=n[2*_+1],S=n[2*(_+1)%6],w=n[(2*(_+1)+1)%6],A=n[2*(_+2)%6],E=n[(2*(_+2)+1)%6],R=S-x,I=w-b,O=R===0,F=I===0,V=(c-b)/I,U=(d-b)/I,j=Math.min(V,U),H=Math.max(V,U);if(!F&&(j>=1||H<=0)||F&&(b<c||b>d)){w>=c&&w<=d&&m.push(s[(_+1)%3]);continue}!F&&j>0&&m.push(this._vertexToIndex(x+R*j,b+I*j));let X=x+R*Math.max(j,0),ue=x+R*Math.min(H,1);O||this._generateIntraEdgeVertices(m,x,b,S,w,X,ue),!F&&H<1&&m.push(this._vertexToIndex(x+R*H,b+I*H)),(F||w>=c&&w<=d)&&m.push(s[(_+1)%3]),!F&&(w<=c||w>=d)&&this._generateInterEdgeVertices(m,x,b,S,w,A,E,ue,c,d)}return m}_generateIntraEdgeVertices(e,n,s,c,d,m,_){let x=c-n,b=d-s,S=b===0,w=S?Math.min(n,c):Math.min(m,_),A=S?Math.max(n,c):Math.max(m,_),E=Math.floor(w/this._granularityCellSize)+1,R=Math.ceil(A/this._granularityCellSize)-1;if(S?n<c:m<_)for(let I=E;I<=R;I++){let O=I*this._granularityCellSize;e.push(this._vertexToIndex(O,s+b*(O-n)/x))}else for(let I=R;I>=E;I--){let O=I*this._granularityCellSize;e.push(this._vertexToIndex(O,s+b*(O-n)/x))}}_generateInterEdgeVertices(e,n,s,c,d,m,_,x,b,S){let w=d-s,A=m-c,E=_-d,R=(b-d)/E,I=(S-d)/E,O=Math.min(R,I),F=Math.max(R,I),V=c+A*O,U=Math.floor(Math.min(V,x)/this._granularityCellSize)+1,j=Math.ceil(Math.max(V,x)/this._granularityCellSize)-1,H=x<V,X=E===0;if(X&&(_===b||_===S))return;if(X||O>=1||F<=0){let he=s-_,be=m+(n-m)*Math.min((b-_)/he,(S-_)/he);U=Math.floor(Math.min(be,x)/this._granularityCellSize)+1,j=Math.ceil(Math.max(be,x)/this._granularityCellSize)-1,H=x<be}let ue=w>0?S:b;if(H)for(let he=U;he<=j;he++)e.push(this._vertexToIndex(he*this._granularityCellSize,ue));else for(let he=j;he>=U;he--)e.push(this._vertexToIndex(he*this._granularityCellSize,ue))}_generateOutline(e){let n=[];for(let s of e){let c=yc(s,this._granularity,!0),d=this._pointArrayToIndices(c),m=[];for(let _=1;_<d.length;_++)m.push(d[_-1]),m.push(d[_]);n.push(m)}return n}_handlePoles(e){let n=!1,s=!1;this._canonical&&(this._canonical.y===0&&(n=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(n||s)&&this._fillPoles(e,n,s)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let n=0;n<e.length;n+=2){let s=e[n+1];s===Gu&&(e[n+1]=-32767),s===pp&&(e[n+1]=32766)}}_generatePoleQuad(e,n,s,c,d,m){c>d!=(m===Gu)?(e.push(n),e.push(s),e.push(this._vertexToIndex(c,m)),e.push(s),e.push(this._vertexToIndex(d,m)),e.push(this._vertexToIndex(c,m))):(e.push(s),e.push(n),e.push(this._vertexToIndex(c,m)),e.push(this._vertexToIndex(d,m)),e.push(s),e.push(this._vertexToIndex(c,m)))}_fillPoles(e,n,s){let c=this._vertexBuffer,d=Ke,m=e.length;for(let _=2;_<m;_+=3){let x=e[_-2],b=e[_-1],S=e[_],w=c[2*x],A=c[2*x+1],E=c[2*b],R=c[2*b+1],I=c[2*S],O=c[2*S+1];n&&(A===0&&R===0&&this._generatePoleQuad(e,x,b,w,E,Gu),R===0&&O===0&&this._generatePoleQuad(e,b,S,E,I,Gu),O===0&&A===0&&this._generatePoleQuad(e,S,x,I,w,Gu)),s&&(A===d&&R===d&&this._generatePoleQuad(e,x,b,w,E,pp),R===d&&O===d&&this._generatePoleQuad(e,b,S,E,I,pp),O===d&&A===d&&this._generatePoleQuad(e,S,x,I,w,pp))}}_initializeVertices(e){for(let n=0;n<e.length;n+=2)this._vertexToIndex(e[n],e[n+1])}subdividePolygonInternal(e,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:s,holeIndices:c}=(function(_){let x=[],b=[];for(let S of _)if(S.length!==0){S!==_[0]&&x.push(b.length/2);for(let w of S)b.push(w.x),b.push(w.y)}return{flattened:b,holeIndices:x}})(e),d;this._initializeVertices(s);try{let _=(function(b,S,w=2){let A=S&&S.length,E=A?S[0]*w:b.length,R=fx(b,0,E,w,!0),I=[];if(!R||R.next===R.prev)return I;let O,F,V;if(A&&(R=(function(U,j,H,X){let ue=[];for(let he=0,be=j.length;he<be;he++){let _e=fx(U,j[he]*X,he<be-1?j[he+1]*X:U.length,X,!1);_e===_e.next&&(_e.steiner=!0),ue.push(p6(_e))}ue.sort(u6);for(let he=0;he<ue.length;he++)H=h6(ue[he],H);return H})(b,S,R,w)),b.length>80*w){O=b[0],F=b[1];let U=O,j=F;for(let H=w;H<E;H+=w){let X=b[H],ue=b[H+1];X<O&&(O=X),ue<F&&(F=ue),X>U&&(U=X),ue>j&&(j=ue)}V=Math.max(U-O,j-F),V=V!==0?32767/V:0}return cp(R,I,w,O,F,V,0),I})(s,c),x=this._convertIndices(s,_);d=this._subdivideTrianglesScanline(x)}catch(_){console.error(_)}let m=[];return n&&(m=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:m}}_convertIndices(e,n){let s=[];for(let c of n)s.push(this._vertexToIndex(e[2*c],e[2*c+1]));return s}_pointArrayToIndices(e){let n=[];for(let s of e)n.push(this._vertexToIndex(s.x,s.y));return n}}function vx(r,e,n,s=!0){return new m6(n,e).subdividePolygonInternal(r,s)}function yc(r,e,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];let s=r[0],c=r[r.length-1],d=n&&(s.x!==c.x||s.y!==c.y);if(e<2)return d?[...r,r[0]]:[...r];let m=Math.floor(Ke/e),_=[];_.push(new D(r[0].x,r[0].y));let x=r.length,b=d?x:x-1;for(let S=0;S<b;S++){let w=r[S],A=S<x-1?r[S+1]:r[0],E=w.x,R=w.y,I=A.x,O=A.y,F=E!==I,V=R!==O;if(!F&&!V)continue;let U=I-E,j=O-R,H=Math.abs(U),X=Math.abs(j),ue=E,he=R;for(;;){let _e=U>0?(Math.floor(ue/m)+1)*m:(Math.ceil(ue/m)-1)*m,Me=j>0?(Math.floor(he/m)+1)*m:(Math.ceil(he/m)-1)*m,Ee=Math.abs(ue-_e),we=Math.abs(he-Me),ye=Math.abs(ue-I),Le=Math.abs(he-O),Ze=F?Ee/H:Number.POSITIVE_INFINITY,Ve=V?we/X:Number.POSITIVE_INFINITY;if((ye<=Ee||!F)&&(Le<=we||!V))break;if(Ze<Ve&&F||!V){ue=_e,he+=j*Ze;let Oe=new D(ue,Math.round(he));_[_.length-1].x===Oe.x&&_[_.length-1].y===Oe.y||_.push(Oe)}else{ue+=U*Ve,he=Me;let Oe=new D(Math.round(ue),he);_[_.length-1].x===Oe.x&&_[_.length-1].y===Oe.y||_.push(Oe)}}let be=new D(I,O);_[_.length-1].x===be.x&&_[_.length-1].y===be.y||_.push(be)}return _}function g6(r,e,n){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,c=r[2*e[0]];for(let x=1;x<e.length;x++){let b=r[2*e[x]];b<c&&(c=b,s=x)}let d=e.length,m=s,_=(m+1)%d;for(;;){let x=m-1>=0?m-1:d-1,b=(_+1)%d,S=r[2*e[x]],w=r[2*e[b]],A=r[2*e[m]],E=r[2*e[m]+1],R=r[2*e[_]+1],I=!1;if(S<w)I=!0;else if(S>w)I=!1;else{let O=R-E,F=-(r[2*e[_]]-A),V=E<R?1:-1;((S-A)*O+(r[2*e[x]+1]-E)*F)*V>((w-A)*O+(r[2*e[b]+1]-E)*F)*V&&(I=!0)}if(I){let O=e[x],F=e[m],V=e[_];O!==F&&O!==V&&F!==V&&n.push(V,F,O),m--,m<0&&(m=d-1)}else{let O=e[b],F=e[m],V=e[_];O!==F&&O!==V&&F!==V&&n.push(V,F,O),_++,_>=d&&(_=0)}if(x===b)break}}function bx(r,e,n,s,c,d,m,_,x){let b=c.length/2,S=m&&_&&x;if(b<$e.MAX_VERTEX_ARRAY_LENGTH){let w=e.prepareSegment(b,n,s),A=w.vertexLength;for(let I=0;I<d.length;I+=3)s.emplaceBack(A+d[I],A+d[I+1],A+d[I+2]);let E,R;w.vertexLength+=b,w.primitiveLength+=d.length/3,S&&(R=m.prepareSegment(b,n,_),E=R.vertexLength,R.vertexLength+=b);for(let I=0;I<c.length;I+=2)r(c[I],c[I+1]);if(S)for(let I of x){for(let O=1;O<I.length;O+=2)_.emplaceBack(E+I[O-1],E+I[O]);R.primitiveLength+=I.length/2}}else(function(w,A,E,R,I,O){let F=[];for(let X=0;X<R.length/2;X++)F.push(-1);let V={count:0},U=0,j=w.getOrCreateLatestSegment(A,E),H=j.vertexLength;for(let X=2;X<I.length;X+=3){let ue=I[X-2],he=I[X-1],be=I[X],_e=F[ue]<U,Me=F[he]<U,Ee=F[be]<U;j.vertexLength+((_e?1:0)+(Me?1:0)+(Ee?1:0))>$e.MAX_VERTEX_ARRAY_LENGTH&&(j=w.createNewSegment(A,E),U=V.count,_e=!0,Me=!0,Ee=!0,H=0);let we=fp(F,R,O,V,ue,_e,j),ye=fp(F,R,O,V,he,Me,j),Le=fp(F,R,O,V,be,Ee,j);E.emplaceBack(H+we-U,H+ye-U,H+Le-U),j.primitiveLength++}})(e,n,s,c,d,r),S&&(function(w,A,E,R,I,O){let F=[];for(let X=0;X<R.length/2;X++)F.push(-1);let V={count:0},U=0,j=w.getOrCreateLatestSegment(A,E),H=j.vertexLength;for(let X of I)for(let ue=1;ue<X.length;ue+=2){let he=X[ue-1],be=X[ue],_e=F[he]<U,Me=F[be]<U;j.vertexLength+((_e?1:0)+(Me?1:0))>$e.MAX_VERTEX_ARRAY_LENGTH&&(j=w.createNewSegment(A,E),U=V.count,_e=!0,Me=!0,H=0);let Ee=fp(F,R,O,V,he,_e,j),we=fp(F,R,O,V,be,Me,j);E.emplaceBack(H+Ee-U,H+we-U),j.primitiveLength++}})(m,n,_,c,x,r),e.forceNewSegmentOnNextPrepare(),m?.forceNewSegmentOnNextPrepare()}function fp(r,e,n,s,c,d,m){if(d){let _=s.count;return n(e[2*c],e[2*c+1]),r[c]=s.count,s.count++,m.vertexLength++,_}return r[c]}class Z1{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new W,this.indexArray=new De,this.indexArray2=new Qe,this.programConfigurations=new Ba(e.layers,e.zoom),this.segments=new $e,this.segments2=new $e,this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){this.hasDependencies=Gm("fill",this.layers,n);let c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),m=[];for(let{feature:_,id:x,index:b,sourceLayerIndex:S}of e){let w=this.layers[0]._featureFilter.needGeometry,A=ho(_,w);if(!this.layers[0]._featureFilter.filter(new Yt(this.zoom),A,s))continue;let E=d?c.evaluate(A,{},s,n.availableImages):void 0,R={id:x,properties:_.properties,type:_.type,sourceLayerIndex:S,index:b,geometry:w?A.geometry:uo(_),patterns:{},sortKey:E};m.push(R)}d&&m.sort(((_,x)=>_.sortKey-x.sortKey));for(let _ of m){let{geometry:x,index:b,sourceLayerIndex:S}=_;if(this.hasDependencies){let w=j1("fill",this.layers,_,{zoom:this.zoom},n);this.patternFeatures.push(w)}else this.addFeature(_,x,b,s,{},n.subdivisionGranularity);n.featureIndex.insert(e[b].feature,x,b,S,this.index)}}update(e,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,n,s){for(let c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,s,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,a6),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,n,s,c,d,m){for(let _ of cu(n,500)){let x=vx(_,c,m.fill.getGranularityForZoomLevel(c.z)),b=this.layoutVertexArray;bx(((S,w)=>{b.emplaceBack(S,w)}),this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles,this.segments2,this.indexArray2,x.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,canonical:c})}}let xx,wx;Xe("FillBucket",Z1,{omit:["layers","patternFeatures"]});var _6={get paint(){return wx=wx||new Vn({"fill-antialias":new Je(Ce.paint_fill["fill-antialias"]),"fill-opacity":new nt(Ce.paint_fill["fill-opacity"]),"fill-color":new nt(Ce.paint_fill["fill-color"]),"fill-outline-color":new nt(Ce.paint_fill["fill-outline-color"]),"fill-translate":new Je(Ce.paint_fill["fill-translate"]),"fill-translate-anchor":new Je(Ce.paint_fill["fill-translate-anchor"]),"fill-pattern":new ro(Ce.paint_fill["fill-pattern"])})},get layout(){return xx=xx||new Vn({"fill-sort-key":new nt(Ce.layout_fill["fill-sort-key"])})}};class y6 extends Er{constructor(e,n){super(e,_6,n)}recalculate(e,n){super.recalculate(e,n);let s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Z1(e)}queryRadius(){return jm(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:n,transform:s,pixelsToTileUnits:c}){return Qb(qm(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,c),n)}isTileClipped(){return!0}}let v6=Kt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),b6=Kt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:x6}=v6;class mp{constructor(e,n,s,c,d){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=c,this._values=d,e.readFields(w6,this,n)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,s=[],c,d=1,m=0,_=0,x=0;for(;e.pos<n;){if(m<=0){let b=e.readVarint();d=7&b,m=b>>3}if(m--,d===1||d===2)_+=e.readSVarint(),x+=e.readSVarint(),d===1&&(c&&s.push(c),c=[]),c&&c.push(new D(_,x));else{if(d!==7)throw new Error(`unknown command ${d}`);c&&c.push(c[0].clone())}}return c&&s.push(c),s}bbox(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,s=1,c=0,d=0,m=0,_=1/0,x=-1/0,b=1/0,S=-1/0;for(;e.pos<n;){if(c<=0){let w=e.readVarint();s=7&w,c=w>>3}if(c--,s===1||s===2)d+=e.readSVarint(),m+=e.readSVarint(),d<_&&(_=d),d>x&&(x=d),m<b&&(b=m),m>S&&(S=m);else if(s!==7)throw new Error(`unknown command ${s}`)}return[_,b,x,S]}toGeoJSON(e,n,s){let c=this.extent*Math.pow(2,s),d=this.extent*e,m=this.extent*n,_=this.loadGeometry();function x(A){return[360*(A.x+d)/c-180,360/Math.PI*Math.atan(Math.exp((1-2*(A.y+m)/c)*Math.PI))-90]}function b(A){return A.map(x)}let S;if(this.type===1){let A=[];for(let R of _)A.push(R[0]);let E=b(A);S=A.length===1?{type:"Point",coordinates:E[0]}:{type:"MultiPoint",coordinates:E}}else if(this.type===2){let A=_.map(b);S=A.length===1?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}}else{if(this.type!==3)throw new Error("unknown feature type");{let A=Tx(_),E=[];for(let R of A)E.push(R.map(b));S=E.length===1?{type:"Polygon",coordinates:E[0]}:{type:"MultiPolygon",coordinates:E}}}let w={type:"Feature",geometry:S,properties:this.properties};return this.id!=null&&(w.id=this.id),w}}function w6(r,e,n){r===1?e.id=n.readVarint():r===2?(function(s,c){let d=s.readVarint()+s.pos;for(;s.pos<d;){let m=c._keys[s.readVarint()],_=c._values[s.readVarint()];c.properties[m]=_}})(n,e):r===3?e.type=n.readVarint():r===4&&(e._geometry=n.pos)}function Tx(r){let e=r.length;if(e<=1)return[r];let n=[],s,c;for(let d=0;d<e;d++){let m=T6(r[d]);m!==0&&(c===void 0&&(c=m<0),c===m<0?(s&&n.push(s),s=[r[d]]):s&&s.push(r[d]))}return s&&n.push(s),n}function T6(r){let e=0;for(let n,s,c=0,d=r.length,m=d-1;c<d;m=c++)n=r[c],s=r[m],e+=(s.x-n.x)*(n.y+s.y);return e}mp.types=["Unknown","Point","LineString","Polygon"];class S6{constructor(e,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(M6,this,n),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new mp(this._pbf,n,this.extent,this._keys,this._values)}}function M6(r,e,n){r===15?e.version=n.readVarint():r===1?e.name=n.readString():r===5?e.extent=n.readVarint():r===2?e._features.push(n.pos):r===3?e._keys.push(n.readString()):r===4&&e._values.push((function(s){let c=null,d=s.readVarint()+s.pos;for(;s.pos<d;){let m=s.readVarint()>>3;c=m===1?s.readString():m===2?s.readFloat():m===3?s.readDouble():m===4?s.readVarint64():m===5?s.readVarint():m===6?s.readSVarint():m===7?s.readBoolean():null}if(c==null)throw new Error("unknown feature value");return c})(n))}class Sx{constructor(e,n){this.layers=e.readFields(E6,{},n)}}function E6(r,e,n){if(r===3){let s=new S6(n,n.readVarint()+n.pos);s.length&&(e[s.name]=s)}}let H1=Math.pow(2,13);function gp(r,e,n,s,c,d,m,_){r.emplaceBack(e,n,2*Math.floor(s*H1)+m,c*H1*2,d*H1*2,Math.round(_))}class $1{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new ee,this.centroidVertexArray=new $,this.indexArray=new De,this.programConfigurations=new Ba(e.layers,e.zoom),this.segments=new $e,this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){this.features=[],this.hasDependencies=Gm("fill-extrusion",this.layers,n);for(let{feature:c,id:d,index:m,sourceLayerIndex:_}of e){let x=this.layers[0]._featureFilter.needGeometry,b=ho(c,x);if(!this.layers[0]._featureFilter.filter(new Yt(this.zoom),b,s))continue;let S={id:d,sourceLayerIndex:_,index:m,geometry:x?b.geometry:uo(c),properties:c.properties,type:c.type,patterns:{}};this.hasDependencies?this.features.push(j1("fill-extrusion",this.layers,S,{zoom:this.zoom},n)):this.addFeature(S,S.geometry,m,s,{},n.subdivisionGranularity),n.featureIndex.insert(c,S.geometry,m,_,this.index,!0)}}addFeatures(e,n,s){for(let c of this.features){let{geometry:d}=c;this.addFeature(c,d,c.index,n,s,e.subdivisionGranularity)}}update(e,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,x6),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,b6.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,n,s,c,d,m){for(let _ of cu(n,500)){let x={x:0,y:0,sampleCount:0},b=this.layoutVertexArray.length;this.processPolygon(x,c,e,_,m);let S=this.layoutVertexArray.length-b,w=Math.floor(x.x/x.sampleCount),A=Math.floor(x.y/x.sampleCount);for(let E=0;E<S;E++)this.centroidVertexArray.emplaceBack(w,A)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,canonical:c})}processPolygon(e,n,s,c,d){if(c.length<1||Mx(c[0]))return;for(let w of c)w.length!==0&&C6(e,w);let m={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},_=d.fill.getGranularityForZoomLevel(n.z),x=mp.types[s.type]==="Polygon";for(let w of c){if(w.length===0||Mx(w))continue;let A=yc(w,_,x);this._generateSideFaces(A,m)}if(!x)return;let b=vx(c,n,_,!1),S=this.layoutVertexArray;bx(((w,A)=>{gp(S,w,A,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,b.verticesFlattened,b.indicesTriangles)}_generateSideFaces(e,n){let s=0;for(let c=1;c<e.length;c++){let d=e[c],m=e[c-1];if(A6(d,m))continue;n.segment.vertexLength+4>$e.MAX_VERTEX_ARRAY_LENGTH&&(n.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let _=d.sub(m)._perp()._unit(),x=m.dist(d);s+x>32768&&(s=0),gp(this.layoutVertexArray,d.x,d.y,_.x,_.y,0,0,s),gp(this.layoutVertexArray,d.x,d.y,_.x,_.y,0,1,s),s+=x,gp(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,0,s),gp(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,1,s);let b=n.segment.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function C6(r,e){for(let n=0;n<e.length;n++){let s=e[n];n===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function A6(r,e){return r.x===e.x&&(r.x<0||r.x>Ke)||r.y===e.y&&(r.y<0||r.y>Ke)}function Mx(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Ke))||r.every((e=>e.y<0))||r.every((e=>e.y>Ke))}let Ex;Xe("FillExtrusionBucket",$1,{omit:["layers","features"]});var z6={get paint(){return Ex=Ex||new Vn({"fill-extrusion-opacity":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new nt(Ce["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ro(Ce["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new nt(Ce["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new nt(Ce["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class D6 extends Er{constructor(e,n){super(e,z6,n)}createBucket(e){return new $1(e)}queryRadius(){return jm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m,pixelPosMatrix:_}){let x=qm(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,m),b=this.paint.get("fill-extrusion-height").evaluate(n,s),S=this.paint.get("fill-extrusion-base").evaluate(n,s),w=(function(E,R){let I=[];for(let O of E){let F=[O.x,O.y,0,1];Ye(F,F,R),I.push(new D(F[0]/F[3],F[1]/F[3]))}return I})(x,_),A=(function(E,R,I,O){let F=[],V=[],U=O[8]*R,j=O[9]*R,H=O[10]*R,X=O[11]*R,ue=O[8]*I,he=O[9]*I,be=O[10]*I,_e=O[11]*I;for(let Me of E){let Ee=[],we=[];for(let ye of Me){let Le=ye.x,Ze=ye.y,Ve=O[0]*Le+O[4]*Ze+O[12],Oe=O[1]*Le+O[5]*Ze+O[13],at=O[2]*Le+O[6]*Ze+O[14],wt=O[3]*Le+O[7]*Ze+O[15],Ct=at+H,Ft=wt+X,Rn=Ve+ue,xi=Oe+he,$i=at+be,an=wt+_e,ci=new D((Ve+U)/Ft,(Oe+j)/Ft);ci.z=Ct/Ft,Ee.push(ci);let bn=new D(Rn/an,xi/an);bn.z=$i/an,we.push(bn)}F.push(Ee),V.push(we)}return[F,V]})(c,S,b,_);return(function(E,R,I){let O=1/0;Qb(I,R)&&(O=Cx(I,R[0]));for(let F=0;F<R.length;F++){let V=R[F],U=E[F];for(let j=0;j<V.length-1;j++){let H=V[j],X=[H,V[j+1],U[j+1],U[j],H];Nu(I,X)&&(O=Math.min(O,Cx(I,X)))}}return O!==1/0&&O})(A[0],A[1],w)}}function _p(r,e){return r.x*e.x+r.y*e.y}function Cx(r,e){if(r.length===1){let n=0,s=e[n++],c;for(;!c||s.equals(c);)if(c=e[n++],!c)return 1/0;for(;n<e.length;n++){let d=e[n],m=r[0],_=c.sub(s),x=d.sub(s),b=m.sub(s),S=_p(_,_),w=_p(_,x),A=_p(x,x),E=_p(b,_),R=_p(b,x),I=S*A-w*w,O=(A*E-w*R)/I,F=(S*R-w*E)/I,V=s.z*(1-O-F)+c.z*O+d.z*F;if(isFinite(V))return V}return 1/0}{let n=1/0;for(let s of e)n=Math.min(n,s.z);return n}}let Ax=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Xm{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[n,s]=new Uint8Array(e,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");let c=s>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);let d=Ax[15&s];if(!d)throw new Error("Unrecognized array type.");let[m]=new Uint16Array(e,2,1),[_]=new Uint32Array(e,4,1);return new Xm(_,m,d,e)}constructor(e,n=64,s=Float64Array,c){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let d=Ax.indexOf(this.ArrayType),m=2*e*this.ArrayType.BYTES_PER_ELEMENT,_=e*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-_%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+x,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+m+_+x),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+x,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){let s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=n,s}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return X1(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,s,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:d,coords:m,nodeSize:_}=this,x=[0,d.length-1,0],b=[];for(;x.length;){let S=x.pop()||0,w=x.pop()||0,A=x.pop()||0;if(w-A<=_){for(let O=A;O<=w;O++){let F=m[2*O],V=m[2*O+1];F>=e&&F<=s&&V>=n&&V<=c&&b.push(d[O])}continue}let E=A+w>>1,R=m[2*E],I=m[2*E+1];R>=e&&R<=s&&I>=n&&I<=c&&b.push(d[E]),(S===0?e<=R:n<=I)&&(x.push(A),x.push(E-1),x.push(1-S)),(S===0?s>=R:c>=I)&&(x.push(E+1),x.push(w),x.push(1-S))}return b}within(e,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:c,coords:d,nodeSize:m}=this,_=[0,c.length-1,0],x=[],b=s*s;for(;_.length;){let S=_.pop()||0,w=_.pop()||0,A=_.pop()||0;if(w-A<=m){for(let O=A;O<=w;O++)Dx(d[2*O],d[2*O+1],e,n)<=b&&x.push(c[O]);continue}let E=A+w>>1,R=d[2*E],I=d[2*E+1];Dx(R,I,e,n)<=b&&x.push(c[E]),(S===0?e-s<=R:n-s<=I)&&(_.push(A),_.push(E-1),_.push(1-S)),(S===0?e+s>=R:n+s>=I)&&(_.push(E+1),_.push(w),_.push(1-S))}return x}}function X1(r,e,n,s,c,d){if(c-s<=n)return;let m=s+c>>1;zx(r,e,m,s,c,d),X1(r,e,n,s,m-1,1-d),X1(r,e,n,m+1,c,1-d)}function zx(r,e,n,s,c,d){for(;c>s;){if(c-s>600){let b=c-s+1,S=n-s+1,w=Math.log(b),A=.5*Math.exp(2*w/3),E=.5*Math.sqrt(w*A*(b-A)/b)*(S-b/2<0?-1:1);zx(r,e,n,Math.max(s,Math.floor(n-S*A/b+E)),Math.min(c,Math.floor(n+(b-S)*A/b+E)),d)}let m=e[2*n+d],_=s,x=c;for(yp(r,e,s,n),e[2*c+d]>m&&yp(r,e,s,c);_<x;){for(yp(r,e,_,x),_++,x--;e[2*_+d]<m;)_++;for(;e[2*x+d]>m;)x--}e[2*s+d]===m?yp(r,e,s,x):(x++,yp(r,e,x,c)),x<=n&&(s=x+1),n<=x&&(c=x-1)}}function yp(r,e,n,s){Y1(r,n,s),Y1(e,2*n,2*s),Y1(e,2*n+1,2*s+1)}function Y1(r,e,n){let s=r[e];r[e]=r[n],r[n]=s}function Dx(r,e,n,s){let c=r-n,d=e-s;return c*c+d*d}function W1(r,e,n,s){let c=s,d=e+(n-e>>1),m,_=n-e,x=r[e],b=r[e+1],S=r[n],w=r[n+1];for(let A=e+3;A<n;A+=3){let E=P6(r[A],r[A+1],x,b,S,w);if(E>c)m=A,c=E;else if(E===c){let R=Math.abs(A-d);R<_&&(m=A,_=R)}}c>s&&(m-e>3&&W1(r,e,m,s),r[m+2]=c,n-m>3&&W1(r,m,n,s))}function P6(r,e,n,s,c,d){let m=c-n,_=d-s;if(m!==0||_!==0){let x=((r-n)*m+(e-s)*_)/(m*m+_*_);x>1?(n=c,s=d):x>0&&(n+=m*x,s+=_*x)}return m=r-n,_=e-s,m*m+_*_}function vn(r,e,n,s){let c={type:e,geom:n},d={id:r??null,type:c.type,geometry:c.geom,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(c.type){case"Point":case"MultiPoint":vp(d,c.geom);break;case"LineString":vp(d,c.geom.points);break;case"Polygon":vp(d,c.geom[0].points);break;case"MultiLineString":for(let m of c.geom)vp(d,m.points);break;case"MultiPolygon":for(let m of c.geom)vp(d,m[0].points)}return d}function K1(r){r.points.length>64&&(r.points=new Float64Array(r.points))}function vp(r,e){for(let n=0;n<e.length;n+=3)r.minX=Math.min(r.minX,e[n]),r.minY=Math.min(r.minY,e[n+1]),r.maxX=Math.max(r.maxX,e[n]),r.maxY=Math.max(r.maxY,e[n+1])}function Q1(r,e){let n=[];switch(r.type){case"FeatureCollection":for(let s=0;s<r.features.length;s++)Ym(n,r.features[s],e,s);break;case"Feature":Ym(n,r,e);break;default:Ym(n,{geometry:r,properties:void 0},e)}return n}function Ym(r,e,n,s){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(_,x,b,S,w){for(let A of b.geometries)Ym(_,{id:x.id,geometry:A,properties:x.properties},S,w)})(r,e,e.geometry,n,s);if(!e.geometry.coordinates?.length)return;let d=(function(_,x,b){return x.promoteId?_.properties?.[x.promoteId]:x.generateId?b||0:_.id})(e,n,s),m=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);switch(e.geometry.type){case"Point":return void(function(_,x,b,S){let w=[];w.push(Zu(b.coordinates[0]),Hu(b.coordinates[1]),0),_.push(vn(x,"Point",w,S))})(r,d,e.geometry,e.properties);case"MultiPoint":return void(function(_,x,b,S){let w=[];for(let A of b.coordinates)w.push(Zu(A[0]),Hu(A[1]),0);_.push(vn(x,"MultiPoint",w,S))})(r,d,e.geometry,e.properties);case"LineString":return void(function(_,x,b,S,w){let A={points:[]};J1(b.coordinates,A,S,!1),_.push(vn(x,"LineString",A,w))})(r,d,e.geometry,m,e.properties);case"MultiLineString":return void(function(_,x,b,S,w,A){if(w.lineMetrics)for(let E of b.coordinates){let R={points:[]};J1(E,R,S,!1),_.push(vn(x,"LineString",R,A))}else{let E=[];e_(b.coordinates,E,S,!1),_.push(vn(x,"MultiLineString",E,A))}})(r,d,e.geometry,m,n,e.properties);case"Polygon":return void(function(_,x,b,S,w){let A=[];e_(b.coordinates,A,S,!0),_.push(vn(x,"Polygon",A,w))})(r,d,e.geometry,m,e.properties);case"MultiPolygon":return void(function(_,x,b,S,w){let A=[];for(let E of b.coordinates){let R=[];e_(E,R,S,!0),A.push(R)}_.push(vn(x,"MultiPolygon",A,w))})(r,d,e.geometry,m,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function J1(r,e,n,s){let c,d,m=0;for(let x=0;x<r.length;x++){let b=Zu(r[x][0]),S=Hu(r[x][1]);e.points.push(b,S,0),x>0&&(m+=s?(c*S-b*d)/2:Math.sqrt(Math.pow(b-c,2)+Math.pow(S-d,2))),c=b,d=S}let _=e.points.length-3;e.points[2]=1,n>0&&W1(e.points,0,_,n),e.points[_+2]=1,K1(e),e.size=Math.abs(m),e.start=0,e.end=e.size}function e_(r,e,n,s){for(let c=0;c<r.length;c++){let d={points:[]};J1(r[c],d,n,s),e.push(d)}}function Zu(r){return r/360+.5}function Hu(r){let e=Math.sin(r*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function Wm(r){let e={type:"Feature",geometry:R6(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function R6(r){let{type:e,geometry:n}=r;switch(e){case"Point":return{type:e,coordinates:Px(n[0],n[1])};case"MultiPoint":return{type:e,coordinates:Km(n)};case"LineString":return{type:e,coordinates:Km(n.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:n.map((s=>Km(s.points)))};case"MultiPolygon":return{type:e,coordinates:n.map((s=>s.map((c=>Km(c.points)))))}}}function Km(r){let e=[];for(let n=0;n<r.length;n+=3)e.push(Px(r[n],r[n+1]));return e}function Px(r,e){return[Rx(r),Ix(e)]}function Rx(r){return 360*(r-.5)}function Ix(r){let e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var qn;function Ko(r,e,n,s,c,d,m,_){if(s/=e,d>=(n/=e)&&m<s)return r;if(m<n||d>=s)return null;let x=[];for(let b of r){let S=c===qn.X?b.minX:b.minY,w=c===qn.X?b.maxX:b.maxY;if(S>=n&&w<s)x.push(b);else if(!(w<n||S>=s))switch(b.type){case"Point":case"MultiPoint":I6(b,x,n,s,c);continue;case"LineString":k6(b,x,n,s,c,_);continue;case"MultiLineString":L6(b,x,n,s,c);continue;case"Polygon":O6(b,x,n,s,c);continue;case"MultiPolygon":B6(b,x,n,s,c);continue}}return x.length?x:null}function I6(r,e,n,s,c){let d=[];(function(m,_,x,b,S){for(let w=0;w<m.length;w+=3){let A=m[w+S];A>=x&&A<=b&&$u(_,m[w],m[w+1],m[w+2])}})(r.geometry,d,n,s,c),d.length&&e.push(vn(r.id,d.length===3?"Point":"MultiPoint",d,r.tags))}function k6(r,e,n,s,c,d){let m=[];if(kx(r.geometry,m,n,s,c,!1,d.lineMetrics),m.length)if(d.lineMetrics)for(let _ of m)e.push(vn(r.id,"LineString",_,r.tags));else e.push(m.length>1?vn(r.id,"MultiLineString",m,r.tags):vn(r.id,"LineString",m[0],r.tags))}function L6(r,e,n,s,c){let d=[];t_(r.geometry,d,n,s,c,!1),d.length&&e.push(d.length!==1?vn(r.id,"MultiLineString",d,r.tags):vn(r.id,"LineString",d[0],r.tags))}function O6(r,e,n,s,c){let d=[];t_(r.geometry,d,n,s,c,!0),d.length&&e.push(vn(r.id,"Polygon",d,r.tags))}function B6(r,e,n,s,c){let d=[];for(let m of r.geometry){let _=[];t_(m,_,n,s,c,!0),_.length&&d.push(_)}d.length&&e.push(vn(r.id,"MultiPolygon",d,r.tags))}function kx(r,e,n,s,c,d,m){let _=Lx(r),x=c===qn.X?F6:N6,b,S,w=r.start;for(let O=0;O<r.points.length-3;O+=3){let F=r.points[O],V=r.points[O+1],U=r.points[O+2],j=r.points[O+3],H=r.points[O+4],X=c===qn.X?F:V,ue=c===qn.X?j:H,he=!1;m&&(b=Math.sqrt(Math.pow(F-j,2)+Math.pow(V-H,2))),X<n?ue>n&&(S=x(_,F,V,j,H,n),m&&(_.start=w+b*S)):X>s?ue<s&&(S=x(_,F,V,j,H,s),m&&(_.start=w+b*S)):$u(_.points,F,V,U),ue<n&&X>=n&&(S=x(_,F,V,j,H,n),he=!0),ue>s&&X<=s&&(S=x(_,F,V,j,H,s),he=!0),!d&&he&&(m&&(_.end=w+b*S),e.push(_),_=Lx(r)),m&&(w+=b)}let A=r.points.length-3,E=r.points[A],R=r.points[A+1],I=c===qn.X?E:R;I>=n&&I<=s&&$u(_.points,E,R,r.points[A+2]),A=_.points.length-3,d&&A>=3&&(_.points[A]!==_.points[0]||_.points[A+1]!==_.points[1])&&$u(_.points,_.points[0],_.points[1],_.points[2]),_.points.length&&(K1(_),e.push(_))}function Lx(r){return{points:[],size:r.size,start:r.start,end:r.end}}function t_(r,e,n,s,c,d){for(let m of r)kx(m,e,n,s,c,d,!1)}function $u(r,e,n,s){r.push(e,n,s)}function F6(r,e,n,s,c,d){let m=(d-e)/(s-e);return $u(r.points,d,n+(c-n)*m,1),m}function N6(r,e,n,s,c,d){let m=(d-n)/(c-n);return $u(r.points,e+(s-e)*m,d,1),m}function i_(r,e){let n=e.buffer/e.extent,s=r,c=Ko(r,1,-1-n,n,qn.X,-1,2,e),d=Ko(r,1,1-n,2+n,qn.X,-1,2,e);return(c||d)&&(s=Ko(r,1,-n,1+n,qn.X,-1,2,e)||[],c&&(s=Ox(c,1).concat(s)),d&&(s=s.concat(Ox(d,-1)))),s}function Ox(r,e){let n=[];for(let s of r)switch(s.type){case"Point":case"MultiPoint":{let c=U6(s.geometry,e);n.push(vn(s.id,s.type,c,s.tags));continue}case"LineString":{let c=n_(s.geometry,e);n.push(vn(s.id,s.type,c,s.tags));continue}case"MultiLineString":case"Polygon":{let c=[];for(let d of s.geometry)c.push(n_(d,e));n.push(vn(s.id,s.type,c,s.tags));continue}case"MultiPolygon":{let c=[];for(let d of s.geometry){let m=[];for(let _ of d)m.push(n_(_,e));c.push(m)}n.push(vn(s.id,s.type,c,s.tags));continue}}return n}function U6(r,e){let n=[];for(let s=0;s<r.length;s+=3)n.push(r[s]+e,r[s+1],r[s+2]);return n}function n_(r,e){let n={points:[],size:r.size};r.start!==void 0&&(n.start=r.start,n.end=r.end);for(let s=0;s<r.points.length;s+=3)n.points.push(r.points[s]+e,r.points[s+1],r.points[s+2]);return K1(n),n}function V6(r,e,n){let s=!!e.newGeometry,c=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(s){let d=r[0],m=Q1({type:"FeatureCollection",features:[{type:"Feature",id:d.id,geometry:e.newGeometry,properties:c?Bx(d.tags,e):d.tags}]},n);return m=i_(m,n),m}if(c){let d=[];for(let m of r){let _={...m};_.tags=Bx(_.tags,e),d.push(_)}return d}return r}function Bx(r,e){if(e.removeAllProperties)return{};let n={...r||{}};if(e.removeProperties)for(let s of e.removeProperties)delete n[s];if(e.addOrUpdateProperties)for(let{key:s,value:c}of e.addOrUpdateProperties)n[s]=c;return n}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(qn||(qn={}));let r_={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class j6{constructor(e){this.options=Object.assign(Object.create(r_),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let n=[];for(let s of e){if(!s.geometry)continue;let[c,d]=s.geometry.coordinates,[m,_]=[Zu(c),Hu(d)];n.push({id:s.id,type:"Point",geometry:[m,_],tags:s.properties})}this.createIndex(n)}initialize(e){let n=[];for(let s of e)s.type==="Point"&&n.push(s);this.createIndex(n)}updateIndex(e,n,s){this.options=Object.assign(Object.create(r_),s.clusterOptions),this.initialize(e)}createIndex(e){let{log:n,minZoom:s,maxZoom:c}=this.options;n&&console.time("total time");let d=`prepare ${e.length} points`;n&&console.time(d),this.points=e;let m=[];for(let x=0;x<e.length;x++){let b=e[x];if(!b?.geometry)continue;let[S,w]=b.geometry;S=Math.fround(S),w=Math.fround(w),m.push(S,w,1/0,x,-1,1),this.options.reduce&&m.push(0)}let _=this.trees[c+1]=this.createTree(m);n&&console.timeEnd(d);for(let x=c;x>=s;x--){let b=Date.now();_=this.trees[x]=this.createTree(this.cluster(_,x)),n&&console.log("z%d: %d clusters in %dms",x,_.numItems,Date.now()-b)}n&&console.timeEnd("total time")}getClusters(e,n){return this.getClustersInternal(e,n).map((s=>Wm(s)))}getClustersInternal(e,n){let s=((e[0]+180)%360+360)%360-180,c=Math.max(-90,Math.min(90,e[1])),d=e[2]===180?180:((e[2]+180)%360+360)%360-180,m=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)s=-180,d=180;else if(s>d){let w=this.getClustersInternal([s,c,180,m],n),A=this.getClustersInternal([-180,c,d,m],n);return w.concat(A)}let _=this.trees[this.limitZoom(n)],x=_.range(Zu(s),Hu(m),Zu(d),Hu(c)),b=_.flatData,S=[];for(let w of x){let A=this.stride*w;S.push(b[A+5]>1?q6(b,A,this.clusterProps):this.points[b[A+3]])}return S}getChildren(e){let n=this.getOriginId(e),s=this.getOriginZoom(e),c=new Error("No cluster with the specified id: "+e),d=this.trees[s];if(!d)throw c;let m=d.flatData;if(n*this.stride>=m.length)throw c;let _=this.options.radius/(this.options.extent*Math.pow(2,s-1)),x=d.within(m[n*this.stride],m[n*this.stride+1],_),b=[];for(let S of x){let w=S*this.stride;m[w+4]===e&&b.push(m[w+5]>1?G6(m,w,this.clusterProps):Wm(this.points[m[w+3]]))}if(b.length===0)throw c;return b}getLeaves(e,n,s){let c=[];return this.appendLeaves(c,e,n=n||10,s=s||0,0),c}getTile(e,n,s){let c=this.trees[this.limitZoom(e)];if(!c)return null;let d=Math.pow(2,e),{extent:m,radius:_}=this.options,x=_/m,b=(s-x)/d,S=(s+1+x)/d,w={transformed:!0,features:[],source:null,x:n,y:s,z:e};return this.addTileFeatures(c.range((n-x)/d,b,(n+1+x)/d,S),c.flatData,n,s,d,w),n===0&&this.addTileFeatures(c.range(1-x/d,b,1,S),c.flatData,d,s,d,w),n===d-1&&this.addTileFeatures(c.range(0,b,x/d,S),c.flatData,-1,s,d,w),w}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,n,s,c,d){let m=this.getChildren(n);for(let _ of m){let x=_.properties;if(x?.cluster?d+x.point_count<=c?d+=x.point_count:d=this.appendLeaves(e,x.cluster_id,s,c,d):d<c?d++:e.push(_),e.length===s)break}return d}createTree(e){let n=new Xm(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let s=0;s<e.length;s+=this.stride)n.add(e[s],e[s+1]);return n.finish(),n.flatData=e,n.data=null,n}addTileFeatures(e,n,s,c,d,m){for(let _ of e){let x=_*this.stride,b=n[x+5]>1,S,w,A;if(b)S=a_(n,x,this.clusterProps),w=n[x],A=n[x+1];else{let I=this.points[n[x+3]];S=I.tags,[w,A]=I.geometry}let E={type:1,geometry:[[Math.round(this.options.extent*(w*d-s)),Math.round(this.options.extent*(A*d-c))]],tags:S},R;R=b||this.options.generateId?n[x+3]:this.points[n[x+3]].id,R!==void 0&&(E.id=R),m.features.push(E)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,n){let{radius:s,extent:c,reduce:d,minPoints:m}=this.options,_=s/(c*Math.pow(2,n)),x=e.flatData,b=[],S=this.stride;for(let w=0;w<x.length;w+=S){if(x[w+2]<=n)continue;x[w+2]=n;let A=x[w],E=x[w+1],R=e.within(x[w],x[w+1],_),I=x[w+5],O=I;for(let F of R){let V=F*S;x[V+2]>n&&(O+=x[V+5])}if(O>I&&O>=m){let F,V=A*I,U=E*I,j=-1,H=(w/S<<5)+(n+1)+this.points.length;for(let X of R){let ue=X*S;if(x[ue+2]<=n)continue;x[ue+2]=n;let he=x[ue+5];V+=x[ue]*he,U+=x[ue+1]*he,x[ue+4]=H,d&&(F||(F=this.map(x,w,!0),j=this.clusterProps.length,this.clusterProps.push(F)),d(F,this.map(x,ue)))}x[w+4]=H,b.push(V/O,U/O,1/0,H,-1,O),d&&b.push(j)}else{for(let F=0;F<S;F++)b.push(x[w+F]);if(O>1)for(let F of R){let V=F*S;if(!(x[V+2]<=n)){x[V+2]=n;for(let U=0;U<S;U++)b.push(x[V+U])}}}}return b}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,n,s){if(e[n+5]>1){let m=this.clusterProps[e[n+6]];return s?Object.assign({},m):m}let c=this.points[e[n+3]].tags,d=this.options.map(c);return s&&d===c?Object.assign({},d):d}}function q6(r,e,n){return{id:r[e+3],type:"Point",tags:a_(r,e,n),geometry:[r[e],r[e+1]]}}function G6(r,e,n){return{type:"Feature",id:r[e+3],properties:a_(r,e,n),geometry:{type:"Point",coordinates:[Rx(r[e]),Ix(r[e+1])]}}}function a_(r,e,n){let s=r[e+5],c=s>=1e4?`${Math.round(s/1e3)}k`:s>=1e3?Math.round(s/100)/10+"k":s,d=r[e+6],m=d===-1?{}:Object.assign({},n[d]);return Object.assign(m,{cluster:!0,cluster_id:r[e+3],point_count:s,point_count_abbreviated:c})}let o_="geojsonvt_clip_start",s_="geojsonvt_clip_end";function Fx(r,e,n,s,c){let d=e===c.maxZoom?0:c.tolerance/((1<<e)*c.extent),m={transformed:!1,features:[],source:null,x:n,y:s,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:r.length};for(let _ of r)Z6(m,_,d,c);return m}function Z6(r,e,n,s){switch(r.minX=Math.min(r.minX,e.minX),r.minY=Math.min(r.minY,e.minY),r.maxX=Math.max(r.maxX,e.maxX),r.maxY=Math.max(r.maxY,e.maxY),e.type){case"Point":case"MultiPoint":return void(function(c,d){let m=[];for(let x=0;x<d.geometry.length;x+=3)m.push(d.geometry[x],d.geometry[x+1]),c.numPoints++,c.numSimplified++;if(!m.length)return;let _={type:1,tags:d.tags||null,geometry:m};d.id!==null&&(_.id=d.id),c.features.push(_)})(r,e);case"LineString":return void(function(c,d,m,_){let x=[];if(l_(x,d.geometry,c,m,!1,!1),!x.length)return;let b=d.tags||null;if(_.lineMetrics){b={};for(let w in d.tags)b[w]=d.tags[w];b[o_]=d.geometry.start/d.geometry.size,b[s_]=d.geometry.end/d.geometry.size}let S={type:2,tags:b,geometry:x};d.id!==null&&(S.id=d.id),c.features.push(S)})(r,e,n,s);case"MultiLineString":case"Polygon":return void(function(c,d,m){let _=[];for(let b=0;b<d.geometry.length;b++)l_(_,d.geometry[b],c,m,d.type==="Polygon",b===0);if(!_.length)return;let x={type:d.type==="Polygon"?3:2,tags:d.tags||null,geometry:_};d.id!==null&&(x.id=d.id),c.features.push(x)})(r,e,n);case"MultiPolygon":return void(function(c,d,m){let _=[];for(let b=0;b<d.geometry.length;b++){let S=d.geometry[b];for(let w=0;w<S.length;w++)l_(_,S[w],c,m,!0,w===0)}if(!_.length)return;let x={type:3,tags:d.tags||null,geometry:_};d.id!==null&&(x.id=d.id),c.features.push(x)})(r,e,n)}}function l_(r,e,n,s,c,d){let m=s*s;if(s>0&&e.size<(c?m:s))return void(n.numPoints+=e.points.length/3);let _=[];for(let x=0;x<e.points.length;x+=3)(s===0||e.points[x+2]>m)&&(n.numSimplified++,_.push(e.points[x],e.points[x+1])),n.numPoints++;c&&(function(x,b){let S=0;for(let w=0,A=x.length,E=A-2;w<A;E=w,w+=2)S+=(x[w]-x[E])*(x[w+1]+x[E+1]);if(S>0===b)for(let w=0,A=x.length;w<A/2;w+=2){let E=x[w],R=x[w+1];x[w]=x[A-2-w],x[w+1]=x[A-1-w],x[A-2-w]=E,x[A-1-w]=R}})(_,d),r.push(_)}function Nx(r,e){if(r.transformed)return r;let n=1<<r.z,s=r.x,c=r.y;for(let d of r.features)d.type===1?H6(d,e,n,s,c):$6(d,e,n,s,c);return r.transformed=!0,r}function H6(r,e,n,s,c){let d=r,m=r.geometry,_=[];for(let x=0;x<m.length;x+=2)_.push(Ux(m[x],m[x+1],e,n,s,c));return d.geometry=_,d}function $6(r,e,n,s,c){let d=r,m=r.geometry,_=[];for(let x of m){let b=[];for(let S=0;S<x.length;S+=2)b.push(Ux(x[S],x[S+1],e,n,s,c));_.push(b)}return d.geometry=_,d}function Ux(r,e,n,s,c,d){return[Math.round(n*(r*s-c)),Math.round(n*(e*s-d))]}class X6{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,n,s){s.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(n),s.debug>1&&console.timeEnd("invalidating");let[c,d,m]=[0,0,0],_=Fx(e,c,d,m,s);_.source=e;let x=Qm(c,d,m);if(this.tiles[x]=_,this.tileCoords.push({z:c,x:d,y:m,id:x}),s.debug){let b=`z${c}`;this.stats[b]=(this.stats[b]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,n,s){return null}getTile(e,n,s){let{extent:c,debug:d}=this.options,m=1<<e,_=Qm(e,n=n+m&m-1,s);if(this.tiles[_])return Nx(this.tiles[_],c);d>1&&console.log("drilling down to z%d-%d-%d",e,n,s);let x,b=e,S=n,w=s;for(;!x&&b>0;)b--,S>>=1,w>>=1,x=this.tiles[Qm(b,S,w)];return x?.source?(d>1&&(console.log("found parent tile z%d-%d-%d",b,S,w),console.time("drilling down")),this.splitTile(x.source,b,S,w,e,n,s),d>1&&console.timeEnd("drilling down"),this.tiles[_]?Nx(this.tiles[_],c):null):null}splitTile(e,n,s,c,d,m,_){let x=[e,n,s,c],b=this.options,S=b.debug;for(;x.length;){c=x.pop(),s=x.pop(),n=x.pop(),e=x.pop();let w=1<<n,A=Qm(n,s,c),E=this.tiles[A];if(!E&&(S>1&&console.time("creation"),E=this.tiles[A]=Fx(e,n,s,c,b),this.tileCoords.push({z:n,x:s,y:c,id:A}),S)){S>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,s,c,E.numFeatures,E.numPoints,E.numSimplified),console.timeEnd("creation"));let he=`z${n}`;this.stats[he]=(this.stats[he]||0)+1,this.total++}if(E.source=e,d==null){if(n===b.indexMaxZoom||E.numPoints<=b.indexMaxPoints)continue}else{if(n===b.maxZoom||n===d)continue;if(d!=null){let he=d-n;if(s!==m>>he||c!==_>>he)continue}}if(E.source=null,!e.length)continue;S>1&&console.time("clipping");let R=.5*b.buffer/b.extent,I=.5-R,O=.5+R,F=1+R,V=null,U=null,j=null,H=null,X=Ko(e,w,s-R,s+O,qn.X,E.minX,E.maxX,b),ue=Ko(e,w,s+I,s+F,qn.X,E.minX,E.maxX,b);X&&(V=Ko(X,w,c-R,c+O,qn.Y,E.minY,E.maxY,b),U=Ko(X,w,c+I,c+F,qn.Y,E.minY,E.maxY,b)),ue&&(j=Ko(ue,w,c-R,c+O,qn.Y,E.minY,E.maxY,b),H=Ko(ue,w,c+I,c+F,qn.Y,E.minY,E.maxY,b)),S>1&&console.timeEnd("clipping"),x.push(V||[],n+1,2*s,2*c),x.push(U||[],n+1,2*s,2*c+1),x.push(j||[],n+1,2*s+1,2*c),x.push(H||[],n+1,2*s+1,2*c+1)}}invalidateTiles(e){if(!e.length)return;let n=this.options,{debug:s}=n,c=1/0,d=-1/0,m=1/0,_=-1/0;for(let S of e)c=Math.min(c,S.minX),d=Math.max(d,S.maxX),m=Math.min(m,S.minY),_=Math.max(_,S.maxY);let x=n.buffer/n.extent,b=new Set;for(let S in this.tiles){let w=this.tiles[S],A=1<<w.z,E=(w.x-x)/A,R=(w.x+1+x)/A,I=(w.y-x)/A,O=(w.y+1+x)/A;if(d<E||c>=R||_<I||m>=O)continue;let F=!1;for(let V of e)if(V.maxX>=E&&V.minX<R&&V.maxY>=I&&V.minY<O){F=!0;break}if(F){if(s){s>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",w.z,w.x,w.y,w.numFeatures,w.numPoints,w.numSimplified);let V=`z${w.z}`;this.stats[V]=(this.stats[V]||0)-1,this.total--}delete this.tiles[S],b.add(S)}}b.size&&(this.tileCoords=this.tileCoords.filter((S=>!b.has(S.id))))}}function Qm(r,e,n){return 32*((1<<r)*n+e)+r}let Y6={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:r_,debug:0},W6=Kt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:K6}=W6,Q6=Kt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:J6}=Q6,eM=Math.cos(Math.PI/180*37.5),Vx=Math.pow(2,14)/.5;class c_{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let n of this.layers)this.gradients[n.id]={};this.layoutVertexArray=new ae,this.layoutVertexArray2=new te,this.indexArray=new De,this.programConfigurations=new Ba(e.layers,e.zoom),this.segments=new $e,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){this.hasDependencies=Gm("line",this.layers,n)||this.hasLineDasharray(this.layers);let c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),m=[];for(let{feature:_,id:x,index:b,sourceLayerIndex:S}of e){let w=this.layers[0]._featureFilter.needGeometry,A=ho(_,w);if(!this.layers[0]._featureFilter.filter(new Yt(this.zoom),A,s))continue;let E=d?c.evaluate(A,{},s):void 0,R={id:x,properties:_.properties,type:_.type,sourceLayerIndex:S,index:b,geometry:w?A.geometry:uo(_),patterns:{},dashes:{},sortKey:E};m.push(R)}d&&m.sort(((_,x)=>_.sortKey-x.sortKey));for(let _ of m){let{geometry:x,index:b,sourceLayerIndex:S}=_;this.hasDependencies?(Gm("line",this.layers,n)?j1("line",this.layers,_,{zoom:this.zoom},n):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,_,this.zoom,n),this.patternFeatures.push(_)):this.addFeature(_,x,b,s,{},{},n.subdivisionGranularity),n.featureIndex.insert(e[b].feature,x,b,S,this.index)}}update(e,n,s,c){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s,dashPositions:c})}addFeatures(e,n,s,c){for(let d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,n,s,c,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,J6)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,K6),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,o_)&&Object.hasOwn(e.properties,s_))return{start:+e.properties[o_],end:+e.properties[s_]}}addFeature(e,n,s,c,d,m,_){let x=this.layers[0].layout,b=x.get("line-join").evaluate(e,{}),S=x.get("line-cap").evaluate(e,{}),w=x.get("line-miter-limit").evaluate(e,{}),A=x.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let E of n)this.addLine(E,e,b,S,w,A,c,_);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,dashPositions:m,canonical:c})}addLine(e,n,s,c,d,m,_,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=yc(e,_?x.line.getGranularityForZoomLevel(_.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let U=0;U<e.length-1;U++)this.totalDistance+=e[U].dist(e[U+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let b=mp.types[n.type]==="Polygon",S=e.length;for(;S>=2&&e[S-1].equals(e[S-2]);)S--;let w=0;for(;w<S-1&&e[w].equals(e[w+1]);)w++;if(S<(b?3:2))return;s==="bevel"&&(d=1.05);let A=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray),R,I,O,F,V;this.e1=this.e2=-1,b&&(R=e[S-2],V=e[w].sub(R)._unit()._perp());for(let U=w;U<S;U++){if(O=U===S-1?b?e[w+1]:void 0:e[U+1],O&&e[U].equals(O))continue;V&&(F=V),R&&(I=R),R=e[U],V=O?O.sub(R)._unit()._perp():F,F||(F=V);let j=F.add(V);j.x===0&&j.y===0||j._unit();let H=F.x*V.x+F.y*V.y,X=j.x*V.x+j.y*V.y,ue=X!==0?1/X:1/0,he=2*Math.sqrt(2-2*X),be=X<eM&&I&&O,_e=F.x*V.y-F.y*V.x>0;if(be&&U>w){let we=R.dist(I);if(we>2*A){let ye=R.sub(R.sub(I)._mult(A/we)._round());this.updateDistance(I,ye),this.addCurrentVertex(ye,F,0,0,E),I=ye}}let Me=I&&O,Ee=Me?s:b?"butt":c;if(Me&&Ee==="round"&&(ue<m?Ee="miter":ue<=2&&(Ee="fakeround")),Ee==="miter"&&ue>d&&(Ee="bevel"),Ee==="bevel"&&(ue>2&&(Ee="flipbevel"),ue<d&&(Ee="miter")),I&&this.updateDistance(I,R),Ee==="miter")j._mult(ue),this.addCurrentVertex(R,j,0,0,E);else if(Ee==="flipbevel"){if(ue>100)j=V.mult(-1);else{let we=ue*F.add(V).mag()/F.sub(V).mag();j._perp()._mult(we*(_e?-1:1))}this.addCurrentVertex(R,j,0,0,E),this.addCurrentVertex(R,j.mult(-1),0,0,E)}else if(Ee==="bevel"||Ee==="fakeround"){let we=-Math.sqrt(ue*ue-1),ye=_e?we:0,Le=_e?0:we;if(I&&this.addCurrentVertex(R,F,ye,Le,E),Ee==="fakeround"){let Ze=Math.round(180*he/Math.PI/20);for(let Ve=1;Ve<Ze;Ve++){let Oe=Ve/Ze;if(Oe!==.5){let wt=Oe-.5;Oe+=Oe*wt*(Oe-1)*((1.0904+H*(H*(3.55645-1.43519*H)-3.2452))*wt*wt+(.848013+H*(.215638*H-1.06021)))}let at=V.sub(F)._mult(Oe)._add(F)._unit()._mult(_e?-1:1);this.addHalfVertex(R,at.x,at.y,!1,_e,0,E)}}O&&this.addCurrentVertex(R,V,-ye,-Le,E)}else if(Ee==="butt")this.addCurrentVertex(R,j,0,0,E);else if(Ee==="square"){let we=I?1:-1;this.addCurrentVertex(R,j,we,we,E)}else Ee==="round"&&(I&&(this.addCurrentVertex(R,F,0,0,E),this.addCurrentVertex(R,F,1,1,E,!0)),O&&(this.addCurrentVertex(R,V,-1,-1,E,!0),this.addCurrentVertex(R,V,0,0,E)));if(be&&U<S-1){let we=R.dist(O);if(we>2*A){let ye=R.add(O.sub(R)._mult(A/we)._round());this.updateDistance(R,ye),this.addCurrentVertex(ye,V,0,0,E),R=ye}}}}addCurrentVertex(e,n,s,c,d,m=!1){let _=n.y*c-n.x,x=-n.y-n.x*c;this.addHalfVertex(e,n.x+n.y*s,n.y-n.x*s,m,!1,s,d),this.addHalfVertex(e,_,x,m,!0,-c,d),this.distance>Vx/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,n,s,c,d,m))}addHalfVertex({x:e,y:n},s,c,d,m,_,x){let b=.5*(this.lineClips?this.scaledDistance*(Vx-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(n<<1)+(m?1:0),Math.round(63*s)+128,Math.round(63*c)+128,1+(_===0?0:_<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let S=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,S,this.e2),x.primitiveLength++),m?this.e2=S:this.e1=S}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,n){this.distance+=e.dist(n),this.updateScaledDistance()}hasLineDasharray(e){for(let n of e){let s=n.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,n,s,c){for(let d of e){let m=d.paint.get("line-dasharray");if(!m||m.value.kind==="constant")continue;let _=d.layout.get("line-cap").evaluate(n,{})==="round",x={dasharray:m.value.evaluate({zoom:s-1},n,{}),round:_},b={dasharray:m.value.evaluate({zoom:s},n,{}),round:_},S={dasharray:m.value.evaluate({zoom:s+1},n,{}),round:_},w=`${x.dasharray.join(",")},${x.round}`,A=`${b.dasharray.join(",")},${b.round}`,E=`${S.dasharray.join(",")},${S.round}`;c.dashDependencies[w]=x,c.dashDependencies[A]=b,c.dashDependencies[E]=S,n.dashes[d.id]={min:w,mid:A,max:E}}}}let jx,qx;Xe("LineBucket",c_,{omit:["layers","patternFeatures"]});var Gx={get paint(){return qx=qx||new Vn({"line-opacity":new nt(Ce.paint_line["line-opacity"]),"line-color":new nt(Ce.paint_line["line-color"]),"line-translate":new Je(Ce.paint_line["line-translate"]),"line-translate-anchor":new Je(Ce.paint_line["line-translate-anchor"]),"line-width":new nt(Ce.paint_line["line-width"]),"line-gap-width":new nt(Ce.paint_line["line-gap-width"]),"line-offset":new nt(Ce.paint_line["line-offset"]),"line-blur":new nt(Ce.paint_line["line-blur"]),"line-dasharray":new ro(Ce.paint_line["line-dasharray"]),"line-pattern":new ro(Ce.paint_line["line-pattern"]),"line-gradient":new Xs(Ce.paint_line["line-gradient"])})},get layout(){return jx=jx||new Vn({"line-cap":new nt(Ce.layout_line["line-cap"]),"line-join":new nt(Ce.layout_line["line-join"]),"line-miter-limit":new nt(Ce.layout_line["line-miter-limit"]),"line-round-limit":new nt(Ce.layout_line["line-round-limit"]),"line-sort-key":new nt(Ce.layout_line["line-sort-key"])})}};class tM extends nt{possiblyEvaluate(e,n){return n=new Yt(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(e,n)}evaluate(e,n,s,c){return n=hi({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(e,n,s,c)}}let Jm;class iM extends Er{constructor(e,n){super(e,Gx,n),this.gradientVersion=0,Jm||(Jm=new tM(Gx.paint.properties["line-width"].specification),Jm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let n=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(n)&&n._styleExpression.expression instanceof Ls,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,n){super.recalculate(e,n),this.paint._values["line-floorwidth"]=Jm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new c_(e)}queryRadius(e){let n=e,s=Zx(Vu("line-width",this,n),Vu("line-gap-width",this,n)),c=Vu("line-offset",this,n);return s/2+Math.abs(c)+jm(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m}){let _=qm(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,m),x=m/2*Zx(this.paint.get("line-width").evaluate(n,s),this.paint.get("line-gap-width").evaluate(n,s)),b=this.paint.get("line-offset").evaluate(n,s);return b&&(c=(function(S,w){let A=[];for(let E of S){let R=ZS(E),I=[];for(let O=0;O<R.length;O++){let F=R[O],V=R[O-1],U=R[O+1],j=O===0?new D(0,0):F.sub(V)._unit()._perp(),H=O===R.length-1?new D(0,0):U.sub(F)._unit()._perp(),X=j._add(H)._unit(),ue=X.x*H.x+X.y*H.y;ue!==0&&X._mult(1/ue),I.push(X._mult(w)._add(F))}A.push(I)}return A})(c,b*m)),(function(S,w,A){for(let E of w){if(S.length>=3){for(let R of E)if(Uu(S,R))return!0}if(jS(S,E,A))return!0}return!1})(_,c,x)}isTileClipped(){return!0}}function Zx(r,e){return e>0?e+2*r:r}let nM=Kt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rM=Kt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Kt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let aM=Kt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Kt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let Hx=Kt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),oM=Kt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function sM(r,e,n){let s=e.layout.get("text-transform").evaluate(n,{});return s==="uppercase"?r=r.toLocaleUpperCase():s==="lowercase"&&(r=r.toLocaleLowerCase()),ka.applyArabicShaping&&(r=ka.applyArabicShaping(r)),r}function lM(r,e,n){for(let s of r.sections)s.text=sM(s.text,e,n);return r}Kt([{name:"triangle",components:3,type:"Uint16"}]),Kt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Kt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Kt([{type:"Float32",name:"offsetX"}]),Kt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Kt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var nn=24;let bp={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u22EF":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},cM={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},uM={40:!0};function $x(r,e,n,s,c,d){if("fontStack"in e){let m=n[e.fontStack],_=m?.[r];return _?_.metrics.advance*e.scale+c:0}{let m=s[e.imageName];return m?m.displaySize[0]*e.scale*nn/d+c:0}}function Xx(r,e,n,s){let c=Math.pow(r-e,2);return s?r<e?c/2:2*c:c+Math.abs(n)*n}function hM(r,e,n){let s=0;return r===10&&(s-=1e4),n&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Yx(r,e,n,s,c,d){let m=null,_=Xx(e,n,c,d);for(let x of s){let b=Xx(e-x.x,n,c,d)+x.badness;b<=_&&(m=x,_=b)}return{index:r,x:e,priorBreak:m,badness:_}}function Wx(r){return r?Wx(r.priorBreak).concat(r.index):[]}class Xu{constructor(e="",n=[],s=[]){this.text=e,this.sections=n,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,n){let s=new Xu;for(let c of e.sections)c.image?s.addImageSection(c):s.addTextSection(c,n);return s}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let n="",s={premature:!0,value:void 0},c=e[Symbol.iterator](),d=c.next(),m=e[Symbol.iterator]();m.next();let _=m.next();for(;!d.done;)n+=!_.done&&Hd(_.value.codePointAt(0))&&!bp[_.value]||!s.premature&&Hd(s.value.codePointAt(0))&&!bp[s.value]||!bp[d.value]?d.value:bp[d.value],s={value:d.value,premature:!1},d=c.next(),_=m.next();return n})(this.text)}hasZeroWidthSpaces(){return this.text.includes("\u200B")}trim(){let e=this.text.match(/^\s*/),n=e?e[0].length:0,s=this.text.match(/\S\s*$/),c=s?s[0].length-1:0;this.text=this.text.substring(n,this.text.length-c),this.sectionIndex=this.sectionIndex.slice(n,this.sectionIndex.length-c)}substring(e,n){let s=[...this.text].slice(e,n).join(""),c=this.sectionIndex.slice(e,n);return new Xu(s,this.sections,c)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,n)=>Math.max(e,this.sections[n].scale)),0)}getMaxImageSize(e){let n=0,s=0;for(let c=0;c<this.length();c++){let d=this.getSection(c);if("imageName"in d){let m=e[d.imageName];if(!m)continue;let _=m.displaySize;n=Math.max(n,_[0]),s=Math.max(s,_[1])}}return{maxImageWidth:n,maxImageHeight:s}}addTextSection(e,n){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||n});let s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){let n=e.image?e.image.name:"";if(n.length===0)return void Wt("Can't add FormattedSection with an empty image.");let s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:n}),this.sectionIndex.push(this.sections.length-1)):Wt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,n,s,c,d){let m=[],_=this.determineAverageLineWidth(e,n,s,c,d),x=this.hasZeroWidthSpaces(),b=0,S=0,w=this.text[Symbol.iterator](),A=w.next(),E=this.text[Symbol.iterator]();E.next();let R=E.next(),I=this.text[Symbol.iterator]();I.next(),I.next();let O=I.next();for(;!A.done;){let F=this.getSection(S),V=A.value.codePointAt(0);if(Pm(V)||(b+=$x(V,F,s,c,e,d)),!R.done){let U=D1(V),j=R.value.codePointAt(0);(cM[V]||U||"imageName"in F||!O.done&&uM[j])&&m.push(Yx(S+1,b,_,m,hM(V,j,U&&x),!1))}S++,A=w.next(),R=E.next(),O=I.next()}return Wx(Yx(this.length(),b,_,m,0,!0))}determineAverageLineWidth(e,n,s,c,d){let m=0,_=0;for(let x of this.text){let b=this.getSection(_);m+=$x(x.codePointAt(0),b,s,c,e,d),_++}return m/Math.max(1,Math.ceil(m/n))}}let u_=4294967296,Kx=1/u_,Qx=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class e0{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,n,s=this.length){for(;this.pos<s;){let c=this.readVarint(),d=c>>3,m=this.pos;this.type=7&c,e(d,n,this),this.pos===m&&this.skip(c)}return n}readMessage(e,n){return this.readFields(e,n,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*u_;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*u_;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let n=this.buf,s,c;return c=n[this.pos++],s=127&c,c<128?s:(c=n[this.pos++],s|=(127&c)<<7,c<128?s:(c=n[this.pos++],s|=(127&c)<<14,c<128?s:(c=n[this.pos++],s|=(127&c)<<21,c<128?s:(c=n[this.pos],s|=(15&c)<<28,(function(d,m,_){let x=_.buf,b,S;if(S=x[_.pos++],b=(112&S)>>4,S<128||(S=x[_.pos++],b|=(127&S)<<3,S<128)||(S=x[_.pos++],b|=(127&S)<<10,S<128)||(S=x[_.pos++],b|=(127&S)<<17,S<128)||(S=x[_.pos++],b|=(127&S)<<24,S<128)||(S=x[_.pos++],b|=(1&S)<<31,S<128))return Yu(d,b,m);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,n=this.pos;return this.pos=e,e-n>=12&&Qx?Qx.decode(this.buf.subarray(n,e)):(function(s,c,d){let m="",_=c;for(;_<d;){let x=s[_],b,S,w,A=null,E=x>239?4:x>223?3:x>191?2:1;if(_+E>d)break;E===1?x<128&&(A=x):E===2?(b=s[_+1],(192&b)==128&&(A=(31&x)<<6|63&b,A<=127&&(A=null))):E===3?(b=s[_+1],S=s[_+2],(192&b)==128&&(192&S)==128&&(A=(15&x)<<12|(63&b)<<6|63&S,(A<=2047||A>=55296&&A<=57343)&&(A=null))):E===4&&(b=s[_+1],S=s[_+2],w=s[_+3],(192&b)==128&&(192&S)==128&&(192&w)==128&&(A=(15&x)<<18|(63&b)<<12|(63&S)<<6|63&w,(A<=65535||A>=1114112)&&(A=null))),A===null?(A=65533,E=1):A>65535&&(A-=65536,m+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),m+=String.fromCharCode(A),_+=E}return m})(this.buf,n,e)}readBytes(){let e=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,e);return this.pos=e,n}readPackedVarint(e=[],n){let s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(n));return e}readPackedSVarint(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){let n=7&e;if(n===0)for(;this.buf[this.pos++]>127;);else if(n===2)this.pos=this.readVarint()+this.pos;else if(n===5)this.pos+=4;else{if(n!==1)throw new Error(`Unimplemented type: ${n}`);this.pos+=8}}writeTag(e,n){this.writeVarint(e<<3|n)}realloc(e){let n=this.length||16;for(;n<this.pos+e;)n*=2;if(n!==this.length){let s=new Uint8Array(n);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=n}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Kx),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Kx),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(n,s){let c,d;if(n>=0?(c=n%4294967296|0,d=n/4294967296|0):(c=~(-n%4294967296),d=~(-n/4294967296),4294967295^c?c=c+1|0:(c=0,d=d+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(m,_,x){x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,x.buf[x.pos]=127&(m>>>=7)})(c,0,s),(function(m,_){let x=(7&m)<<4;_.buf[_.pos++]|=x|((m>>>=3)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m)))))})(d,s)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let n=this.pos;this.pos=(function(c,d,m){for(let _,x,b=0;b<d.length;b++){if(_=d.charCodeAt(b),_>55295&&_<57344){if(!x){_>56319||b+1===d.length?(c[m++]=239,c[m++]=191,c[m++]=189):x=_;continue}if(_<56320){c[m++]=239,c[m++]=191,c[m++]=189,x=_;continue}_=x-55296<<10|_-56320|65536,x=null}else x&&(c[m++]=239,c[m++]=191,c[m++]=189,x=null);_<128?c[m++]=_:(_<2048?c[m++]=_>>6|192:(_<65536?c[m++]=_>>12|224:(c[m++]=_>>18|240,c[m++]=_>>12&63|128),c[m++]=_>>6&63|128),c[m++]=63&_|128)}return m})(this.buf,e,this.pos);let s=this.pos-n;s>=128&&Jx(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let n=e.length;this.writeVarint(n),this.realloc(n);for(let s=0;s<n;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,n){this.pos++;let s=this.pos;e(n,this);let c=this.pos-s;c>=128&&Jx(s,c,this),this.pos=s-1,this.writeVarint(c),this.pos+=c}writeMessage(e,n,s){this.writeTag(e,2),this.writeRawMessage(n,s)}writePackedVarint(e,n){n.length&&this.writeMessage(e,dM,n)}writePackedSVarint(e,n){n.length&&this.writeMessage(e,pM,n)}writePackedBoolean(e,n){n.length&&this.writeMessage(e,gM,n)}writePackedFloat(e,n){n.length&&this.writeMessage(e,fM,n)}writePackedDouble(e,n){n.length&&this.writeMessage(e,mM,n)}writePackedFixed32(e,n){n.length&&this.writeMessage(e,_M,n)}writePackedSFixed32(e,n){n.length&&this.writeMessage(e,yM,n)}writePackedFixed64(e,n){n.length&&this.writeMessage(e,vM,n)}writePackedSFixed64(e,n){n.length&&this.writeMessage(e,bM,n)}writeBytesField(e,n){this.writeTag(e,2),this.writeBytes(n)}writeFixed32Field(e,n){this.writeTag(e,5),this.writeFixed32(n)}writeSFixed32Field(e,n){this.writeTag(e,5),this.writeSFixed32(n)}writeFixed64Field(e,n){this.writeTag(e,1),this.writeFixed64(n)}writeSFixed64Field(e,n){this.writeTag(e,1),this.writeSFixed64(n)}writeVarintField(e,n){this.writeTag(e,0),this.writeVarint(n)}writeSVarintField(e,n){this.writeTag(e,0),this.writeSVarint(n)}writeStringField(e,n){this.writeTag(e,2),this.writeString(n)}writeFloatField(e,n){this.writeTag(e,5),this.writeFloat(n)}writeDoubleField(e,n){this.writeTag(e,1),this.writeDouble(n)}writeBooleanField(e,n){this.writeVarintField(e,+n)}}function Yu(r,e,n){return n?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Jx(r,e,n){let s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(s);for(let c=n.pos-1;c>=r;c--)n.buf[c+s]=n.buf[c]}function dM(r,e){for(let n=0;n<r.length;n++)e.writeVarint(r[n])}function pM(r,e){for(let n=0;n<r.length;n++)e.writeSVarint(r[n])}function fM(r,e){for(let n=0;n<r.length;n++)e.writeFloat(r[n])}function mM(r,e){for(let n=0;n<r.length;n++)e.writeDouble(r[n])}function gM(r,e){for(let n=0;n<r.length;n++)e.writeBoolean(r[n])}function _M(r,e){for(let n=0;n<r.length;n++)e.writeFixed32(r[n])}function yM(r,e){for(let n=0;n<r.length;n++)e.writeSFixed32(r[n])}function vM(r,e){for(let n=0;n<r.length;n++)e.writeFixed64(r[n])}function bM(r,e){for(let n=0;n<r.length;n++)e.writeSFixed64(r[n])}function xM(r,e,n){r===1&&n.readMessage(wM,e)}function wM(r,e,n){if(r===3){let{id:s,bitmap:c,width:d,height:m,left:_,top:x,advance:b}=n.readMessage(TM,{});e.push({id:s,bitmap:new lp({width:d+6,height:m+6},c),metrics:{width:d,height:m,left:_,top:x,advance:b}})}}function TM(r,e,n){r===1?e.id=n.readVarint():r===2?e.bitmap=n.readBytes():r===3?e.width=n.readVarint():r===4?e.height=n.readVarint():r===5?e.left=n.readSVarint():r===6?e.top=n.readSVarint():r===7&&(e.advance=n.readVarint())}function e2(r){let e=0,n=0;for(let m of r)e+=m.w*m.h,n=Math.max(n,m.w);r.sort(((m,_)=>_.h-m.h));let s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}],c=0,d=0;for(let m of r)for(let _=s.length-1;_>=0;_--){let x=s[_];if(!(m.w>x.w||m.h>x.h)){if(m.x=x.x,m.y=x.y,d=Math.max(d,m.y+m.h),c=Math.max(c,m.x+m.w),m.w===x.w&&m.h===x.h){let b=s.pop();b&&_<s.length&&(s[_]=b)}else m.h===x.h?(x.x+=m.w,x.w-=m.w):m.w===x.w?(x.y+=m.h,x.h-=m.h):(s.push({x:x.x+m.w,y:x.y,w:x.w-m.w,h:m.h}),x.y+=m.h,x.h-=m.h);break}}return{w:c,h:d,fill:e/(c*d)||0}}class h_{constructor(e,{pixelRatio:n,version:s,stretchX:c,stretchY:d,content:m,textFitWidth:_,textFitHeight:x}){this.paddedRect=e,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=m,this.version=s,this.textFitWidth=_,this.textFitHeight=x}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class t2{constructor(e,n){let s={},c={};this.haveRenderCallbacks=[];let d=[];this.addImages(e,s,d),this.addImages(n,c,d);let{w:m,h:_}=e2(d),x=new pr({width:m||1,height:_||1});for(let b in e){let S=e[b],w=s[b].paddedRect;pr.copy(S.data,x,{x:0,y:0},{x:w.x+1,y:w.y+1},S.data)}for(let b in n){let S=n[b],w=c[b].paddedRect,A=w.x+1,E=w.y+1,R=S.data.width,I=S.data.height;pr.copy(S.data,x,{x:0,y:0},{x:A,y:E},S.data),pr.copy(S.data,x,{x:0,y:I-1},{x:A,y:E-1},{width:R,height:1}),pr.copy(S.data,x,{x:0,y:0},{x:A,y:E+I},{width:R,height:1}),pr.copy(S.data,x,{x:R-1,y:0},{x:A-1,y:E},{width:1,height:I}),pr.copy(S.data,x,{x:0,y:0},{x:A+R,y:E},{width:1,height:I})}this.image=x,this.iconPositions=s,this.patternPositions=c}addImages(e,n,s){for(let c in e){let d=e[c],m={x:0,y:0,w:d.data.width+2,h:d.data.height+2};s.push(m),n[c]=new h_(m,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,n){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),n),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),n)}patchUpdatedImage(e,n,s){if(!e||!n||e.version===n.version)return;e.version=n.version;let[c,d]=e.tl;s.update(n.data,void 0,{x:c,y:d})}}var Ws;function t0(r,e,n,s,c,d,m,_,x,b,S,w,A,E,R){let I=Xu.fromFeature(r,c),O;w===y.ax.vertical&&I.verticalizePunctuation();let F=I.determineLineBreaks(b,d,e,s,E),{processBidirectionalText:V,processStyledBidirectionalText:U}=ka;if(V&&I.sections.length===1){O=[],F=F.map((ue=>I.toCodeUnitIndex(ue)));let X=V(I.toString(),F);for(let ue of X){let he=[...ue].map((()=>0));O.push(new Xu(ue,I.sections,he))}}else if(U){O=[],F=F.map((be=>I.toCodeUnitIndex(be)));let X=0,ue=[];for(let be of I.text)ue.push(...Array(be.length).fill(I.sectionIndex[X])),X++;let he=U(I.text,ue,F);for(let be of he){let _e=[],Me="";for(let Ee of be[0])_e.push(be[1][Me.length]),Me+=Ee;O.push(new Xu(be[0],I.sections,_e))}}else O=(function(X,ue){let he=[],be=0;for(let _e of ue)he.push(X.substring(be,_e)),be=_e;return be<X.length()&&he.push(X.substring(be,X.length())),he})(I,F);let j=[],H={positionedLines:j,text:I.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:w,iconsInText:!1,verticalizable:!1};return(function(X,ue,he,be,_e,Me,Ee,we,ye,Le,Ze,Ve){let Oe=0,at=0,wt=0,Ct=0,Ft=we==="right"?1:we==="left"?0:.5,Rn=nn/Ve,xi=0;for(let ci of _e){ci.trim();let bn=ci.getMaxScale(),Zn={positionedGlyphs:[],lineOffset:0};X.positionedLines[xi]=Zn;let Hn=Zn.positionedGlyphs,fr=0;if(!ci.length()){at+=Me,++xi;continue}let In=SM(be,ci,Rn),mr=0;for(let on of ci.text){let _i=ci.getSection(mr),ji=on.codePointAt(0),wi=MM(ye,Ze,ji),sn={glyph:ji,imageName:null,x:Oe,y:at+-17,vertical:wi,scale:1,fontStack:"",sectionIndex:ci.getSectionIndex(mr),metrics:null,rect:null},es;if("fontStack"in _i){if(es=EM(_i,ji,wi,In,ue,he),!es)continue;sn.fontStack=_i.fontStack}else{if(X.iconsInText=!0,_i.scale*=Rn,es=CM(_i,wi,bn,In,be),!es)continue;fr=Math.max(fr,es.imageOffset),sn.imageName=_i.imageName}let{rect:Ua,metrics:Mp,baselineOffset:nl}=es;sn.y+=nl,sn.scale=_i.scale,sn.metrics=Mp,sn.rect=Ua,Hn.push(sn),wi?(X.verticalizable=!0,Oe+=("imageName"in _i?Mp.advance:nn)*_i.scale+Le):Oe+=Mp.advance*_i.scale+Le,mr++}Hn.length!==0&&(wt=Math.max(Oe-Le,wt),AM(Hn,0,Hn.length-1,Ft)),Oe=0,Zn.lineOffset=Math.max(fr,(bn-1)*nn);let ga=Me*bn+fr;at+=ga,Ct=Math.max(ga,Ct),++xi}let{horizontalAlign:$i,verticalAlign:an}=d_(Ee);(function(ci,bn,Zn,Hn,fr,In,mr,ga,on){let _i=(bn-Zn)*fr,ji=0;ji=In!==mr?-ga*Hn- -17:-Hn*on*mr+.5*mr;for(let wi of ci)for(let sn of wi.positionedGlyphs)sn.x+=_i,sn.y+=ji})(X.positionedLines,Ft,$i,an,wt,Ct,Me,at,_e.length),X.top+=-an*at,X.bottom=X.top+at,X.left+=-$i*wt,X.right=X.left+wt})(H,e,n,s,O,m,_,x,w,b,A,R),!(function(X){for(let ue of X)if(ue.positionedGlyphs.length!==0)return!1;return!0})(j)&&H}function d_(r){let e=.5,n=.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":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:e,verticalAlign:n}}function SM(r,e,n){let s=e.getMaxScale()*nn,{maxImageWidth:c,maxImageHeight:d}=e.getMaxImageSize(r),m=Math.max(s,d*n);return{verticalLineContentWidth:Math.max(s,c*n),horizontalLineContentHeight:m}}function i2(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function MM(r,e,n){return!(r===y.ax.horizontal||!e&&!$o(n)||e&&(Pm(n)||(s=n,/\p{sc=Arab}/u.test(String.fromCodePoint(s)))));var s}function EM(r,e,n,s,c,d){let m=d[r.fontStack],_=(function(b,S,w,A){if(b?.rect)return b;let E=S[w.fontStack],R=E?.[A];return R?{rect:null,metrics:R.metrics}:null})(m?.[e],c,r,e);if(_===null)return null;let x;if(n)x=s.verticalLineContentWidth-r.scale*nn;else{let b=i2(r.verticalAlign);x=(s.horizontalLineContentHeight-r.scale*nn)*b}return{rect:_.rect,metrics:_.metrics,baselineOffset:x}}function CM(r,e,n,s,c){let d=c[r.imageName];if(!d)return null;let m=d.paddedRect,_=d.displaySize,x={width:_[0],height:_[1],left:1,top:-3,advance:e?_[1]:_[0]},b;if(e)b=s.verticalLineContentWidth-_[1]*r.scale;else{let S=i2(r.verticalAlign);b=(s.horizontalLineContentHeight-_[1]*r.scale)*S}return{rect:m,metrics:x,baselineOffset:b,imageOffset:(e?_[0]:_[1])*r.scale-nn*n}}function AM(r,e,n,s){if(s===0)return;let c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*s;for(let m=e;m<=n;m++)r[m].x-=d}function zM(r,e,n){let{horizontalAlign:s,verticalAlign:c}=d_(n),d=e[0]-r.displaySize[0]*s,m=e[1]-r.displaySize[1]*c;return{image:r,top:m,bottom:m+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function n2(r){var e,n;let s=r.left,c=r.top,d=r.right-s,m=r.bottom-c,_=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",x=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",b=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(x==="proportional"){if(_==="stretchOnly"&&d/m<b||_==="proportional"){let S=Math.ceil(m*b);s*=S/d,d=S}}else if(_==="proportional"&&x==="stretchOnly"&&b!==0&&d/m>b){let S=Math.ceil(d/b);c*=S/m,m=S}return{x1:s,y1:c,x2:s+d,y2:c+m}}function r2(r,e,n,s,c,d){let m=r.image,_;if(m.content){let O=m.content,F=m.pixelRatio||1;_=[O[0]/F,O[1]/F,m.displaySize[0]-O[2]/F,m.displaySize[1]-O[3]/F]}let x=e.left*d,b=e.right*d,S,w,A,E;n==="width"||n==="both"?(E=c[0]+x-s[3],w=c[0]+b+s[1]):(E=c[0]+(x+b-m.displaySize[0])/2,w=E+m.displaySize[0]);let R=e.top*d,I=e.bottom*d;return n==="height"||n==="both"?(S=c[1]+R-s[0],A=c[1]+I+s[2]):(S=c[1]+(R+I-m.displaySize[1])/2,A=S+m.displaySize[1]),{image:m,top:S,right:w,bottom:A,left:E,collisionPadding:_}}Xe("ImagePosition",h_),Xe("ImageAtlas",t2),y.ax=void 0,(Ws=y.ax||(y.ax={}))[Ws.none=0]="none",Ws[Ws.horizontal=1]="horizontal",Ws[Ws.vertical=2]="vertical",Ws[Ws.horizontalOnly=3]="horizontalOnly";let Qo=128,Ks=32640;function a2(r,e){let{expression:n}=e;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Yt(r+1))};if(n.kind==="source")return{kind:"source"};{let{zoomStops:s,interpolationType:c}=n,d=0;for(;d<s.length&&s[d]<=r;)d++;d=Math.max(0,d-1);let m=d;for(;m<s.length&&s[m]<r+1;)m++;m=Math.min(s.length-1,m);let _=s[d],x=s[m];return n.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:x,interpolationType:c}:{kind:"camera",minZoom:_,maxZoom:x,minSize:n.evaluate(new Yt(_)),maxSize:n.evaluate(new Yt(x)),interpolationType:c}}}function p_(r,e,n){let s="never",c=r.get(e);return c?s=c:r.get(n)&&(s="always"),s}let DM=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function i0(r,e,n,s,c,d,m,_,x,b,S,w,A){let E=_?Math.min(Ks,Math.round(_[0])):0,R=_?Math.min(Ks,Math.round(_[1])):0;r.emplaceBack(e,n,Math.round(32*s),Math.round(32*c),d,m,(E<<1)+(x?1:0),R,16*b,16*S,256*w,256*A)}function f_(r,e,n){r.emplaceBack(e.x,e.y,n),r.emplaceBack(e.x,e.y,n),r.emplaceBack(e.x,e.y,n),r.emplaceBack(e.x,e.y,n)}function PM(r){for(let e of r.sections)if(Xd(e.text))return!0;return!1}class m_{constructor(e){this.layoutVertexArray=new ie,this.indexArray=new De,this.programConfigurations=e,this.segments=new $e,this.dynamicLayoutVertexArray=new me,this.opacityVertexArray=new Te,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,n,s,c){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nM.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,rM.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,DM,!0),this.opacityVertexBuffer.itemSize=1),(s||c)&&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())}}Xe("SymbolBuffers",m_);class g_{constructor(e,n,s){this.layoutVertexArray=new e,this.layoutAttributes=n,this.indexArray=new s,this.segments=new $e,this.collisionVertexArray=new Pe}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,aM.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Xe("CollisionBuffers",g_);class Wu{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((m=>m.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=a2(this.zoom,n["text-size"]),this.iconSizeData=a2(this.zoom,n["icon-size"]);let s=this.layers[0].layout,c=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=p_(s,"text-overlap","text-allow-overlap")!=="never"||p_(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((m=>y.ax[m]))),this.stateDependentLayerIds=this.layers.filter((m=>m.isStateDependent())).map((m=>m.id)),this.sourceID=e.sourceID}createArrays(){this.text=new m_(new Ba(this.layers,this.zoom,(e=>e.startsWith("text")))),this.icon=new m_(new Ba(this.layers,this.zoom,(e=>e.startsWith("icon")))),this.glyphOffsetArray=new z,this.lineVertexArray=new P,this.symbolInstances=new C,this.textAnchorOffsets=new L}calculateGlyphDependencies(e,n,s,c,d){for(let m of e)if(n[m.codePointAt(0)]=!0,(s||c)&&d){let _=bp[m];_&&(n[_.codePointAt(0)]=!0)}}populate(e,n,s){var c;let d=this.layers[0],m=d.layout,_=m.get("text-font"),x=m.get("text-field"),b=m.get("icon-image"),S=(x.value.kind!=="constant"||x.value.value instanceof er&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),w=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,A=m.get("symbol-sort-key");if(this.features=[],!S&&!w)return;let E=n.iconDependencies,R=n.glyphDependencies,I=n.availableImages,O=new Yt(this.zoom);for(let{feature:F,id:V,index:U,sourceLayerIndex:j}of e){let H=d._featureFilter.needGeometry,X=ho(F,H);if(!d._featureFilter.filter(O,X,s))continue;let ue,he;if(H||(X.geometry=uo(F)),S){let _e=d.getValueAndResolveTokens("text-field",X,s,I),Me=er.factory(_e);this.hasRTLText||(this.hasRTLText=PM(Me)),(!this.hasRTLText||ka.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&ka.isParsed())&&(ue=lM(Me,d,X))}if(w){let _e=d.getValueAndResolveTokens("icon-image",X,s,I);he=_e instanceof lr?_e:lr.fromString(_e)}if(!ue&&!he)continue;let be=this.sortFeaturesByKey?A.evaluate(X,{},s):void 0;if(this.features.push({id:V,text:ue,icon:he,index:U,sourceLayerIndex:j,geometry:X.geometry,properties:F.properties,type:mp.types[F.type],sortKey:be}),he&&(E[he.name]=!0),ue){let _e=_.evaluate(X,{},s).join(","),Me=m.get("text-rotation-alignment")!=="viewport"&&m.get("symbol-placement")!=="point";this.allowVerticalPlacement=(c=this.writingModes)===null||c===void 0?void 0:c.includes(y.ax.vertical);for(let Ee of ue.sections)if(Ee.image)E[Ee.image.name]=!0;else{let we=Gd(ue.toString()),ye=Ee.fontStack||_e;R[ye]||(R[ye]={}),this.calculateGlyphDependencies(Ee.text,R[ye],Me,this.allowVerticalPlacement,we)}}}m.get("symbol-placement")==="line"&&(this.features=(function(F){let V={},U={},j=[],H=0;function X(_e){j.push(F[_e]),H++}function ue(_e,Me,Ee){let we=U[_e];return delete U[_e],U[Me]=we,j[we].geometry[0].pop(),j[we].geometry[0]=j[we].geometry[0].concat(Ee[0]),we}function he(_e,Me,Ee){let we=V[Me];return delete V[Me],V[_e]=we,j[we].geometry[0].shift(),j[we].geometry[0]=Ee[0].concat(j[we].geometry[0]),we}function be(_e,Me,Ee){let we=Ee?Me[0][Me[0].length-1]:Me[0][0];return`${_e}:${we.x}:${we.y}`}for(let _e=0;_e<F.length;_e++){let Me=F[_e],Ee=Me.geometry,we=Me.text?Me.text.toString():null;if(!we){X(_e);continue}let ye=be(we,Ee),Le=be(we,Ee,!0);if(ye in U&&Le in V&&U[ye]!==V[Le]){let Ze=he(ye,Le,Ee),Ve=ue(ye,Le,j[Ze].geometry);delete V[ye],delete U[Le],U[be(we,j[Ve].geometry,!0)]=Ve,j[Ze].geometry=null}else ye in U?ue(ye,Le,Ee):Le in V?he(ye,Le,Ee):(X(_e),V[ye]=H-1,U[Le]=H-1)}return j.filter((_e=>_e.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((F,V)=>F.sortKey-V.sortKey))}update(e,n,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,n,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,n,this.layers,{imagePositions:s}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,n){let s=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(n[e.segment+1]),d=e.dist(n[e.segment]),m={};for(let _=e.segment+1;_<n.length;_++)m[_]={x:n[_].x,y:n[_].y,tileUnitDistanceFromAnchor:c},_<n.length-1&&(c+=n[_+1].dist(n[_]));for(let _=e.segment||0;_>=0;_--)m[_]={x:n[_].x,y:n[_].y,tileUnitDistanceFromAnchor:d},_>0&&(d+=n[_-1].dist(n[_]));for(let _=0;_<n.length;_++){let x=m[_];this.lineVertexArray.emplaceBack(x.x,x.y,x.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,n,s,c,d,m,_,x,b,S,w,A){let E=e.indexArray,R=e.layoutVertexArray,I=e.segments.prepareSegment(4*n.length,R,E,this.canOverlap?m.sortKey:void 0),O=this.glyphOffsetArray.length,F=I.vertexLength,V=this.allowVerticalPlacement&&_===y.ax.vertical?Math.PI/2:0,U=m.text&&m.text.sections;for(let j=0;j<n.length;j++){let{tl:H,tr:X,bl:ue,br:he,tex:be,pixelOffsetTL:_e,pixelOffsetBR:Me,minFontScaleX:Ee,minFontScaleY:we,glyphOffset:ye,isSDF:Le,sectionIndex:Ze}=n[j],Ve=I.vertexLength,Oe=ye[1];i0(R,x.x,x.y,H.x,Oe+H.y,be.x,be.y,s,Le,_e.x,_e.y,Ee,we),i0(R,x.x,x.y,X.x,Oe+X.y,be.x+be.w,be.y,s,Le,Me.x,_e.y,Ee,we),i0(R,x.x,x.y,ue.x,Oe+ue.y,be.x,be.y+be.h,s,Le,_e.x,Me.y,Ee,we),i0(R,x.x,x.y,he.x,Oe+he.y,be.x+be.w,be.y+be.h,s,Le,Me.x,Me.y,Ee,we),f_(e.dynamicLayoutVertexArray,x,V),E.emplaceBack(Ve,Ve+2,Ve+1),E.emplaceBack(Ve+1,Ve+2,Ve+3),I.vertexLength+=4,I.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ye[0]),j!==n.length-1&&Ze===n[j+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,m,m.index,{imagePositions:{},canonical:A,formattedSection:U?.[Ze]})}e.placedSymbolArray.emplaceBack(x.x,x.y,O,this.glyphOffsetArray.length-O,F,b,S,x.segment,s?s[0]:0,s?s[1]:0,c[0],c[1],_,0,!1,0,w)}_addCollisionDebugVertex(e,n,s,c,d,m){return n.emplaceBack(0,0),e.emplaceBack(s.x,s.y,c,d,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(e,n,s,c,d,m,_){let x=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),b=x.vertexLength,S=d.layoutVertexArray,w=d.collisionVertexArray,A=_.anchorX,E=_.anchorY;this._addCollisionDebugVertex(S,w,m,A,E,new D(e,n)),this._addCollisionDebugVertex(S,w,m,A,E,new D(s,n)),this._addCollisionDebugVertex(S,w,m,A,E,new D(s,c)),this._addCollisionDebugVertex(S,w,m,A,E,new D(e,c)),x.vertexLength+=4;let R=d.indexArray;R.emplaceBack(b,b+1),R.emplaceBack(b+1,b+2),R.emplaceBack(b+2,b+3),R.emplaceBack(b+3,b),x.primitiveLength+=4}addDebugCollisionBoxes(e,n,s,c){for(let d=e;d<n;d++){let m=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,c?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new g_(Se,Hx.members,Qe),this.iconCollisionBox=new g_(Se,Hx.members,Qe);for(let e=0;e<this.symbolInstances.length;e++){let n=this.symbolInstances.get(e);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(e,n,s,c,d,m,_,x,b){let S={};for(let w=n;w<s;w++){let A=e.get(w);S.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.textFeatureIndex=A.featureIndex;break}for(let w=c;w<d;w++){let A=e.get(w);S.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalTextFeatureIndex=A.featureIndex;break}for(let w=m;w<_;w++){let A=e.get(w);S.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.iconFeatureIndex=A.featureIndex;break}for(let w=x;w<b;w++){let A=e.get(w);S.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalIconFeatureIndex=A.featureIndex;break}return S}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){let s=this.symbolInstances.get(n);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}addIndicesForPlacedSymbol(e,n){let s=e.placedSymbolArray.get(n),c=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;d<c;d+=4)e.indexArray.emplaceBack(d,d+2,d+1),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let n=Math.sin(e),s=Math.cos(e),c=[],d=[],m=[];for(let _=0;_<this.symbolInstances.length;++_){m.push(_);let x=this.symbolInstances.get(_);c.push(0|Math.round(n*x.anchorX+s*x.anchorY)),d.push(x.featureIndex)}return m.sort(((_,x)=>c[_]-c[x]||d[x]-d[_])),m}addToSortKeyRanges(e,n){let s=this.sortKeyRanges[this.sortKeyRanges.length-1];s?.sortKey===n?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let n of this.symbolInstanceIndexes){let s=this.symbolInstances.get(n);this.featureSortOrder.push(s.featureIndex);let c=[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex];for(let d=0;d<c.length;d++){let m=c[d];m>=0&&c.indexOf(m)===d&&this.addIndicesForPlacedSymbol(this.text,m)}s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let o2,s2;Xe("SymbolBucket",Wu,{omit:["layers","collisionBoxArray","features","compareText"]}),Wu.MAX_GLYPHS=65535,Wu.addDynamicAttributes=f_;var __={get paint(){return s2=s2||new Vn({"icon-opacity":new nt(Ce.paint_symbol["icon-opacity"]),"icon-color":new nt(Ce.paint_symbol["icon-color"]),"icon-halo-color":new nt(Ce.paint_symbol["icon-halo-color"]),"icon-halo-width":new nt(Ce.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nt(Ce.paint_symbol["icon-halo-blur"]),"icon-translate":new Je(Ce.paint_symbol["icon-translate"]),"icon-translate-anchor":new Je(Ce.paint_symbol["icon-translate-anchor"]),"text-opacity":new nt(Ce.paint_symbol["text-opacity"]),"text-color":new nt(Ce.paint_symbol["text-color"],{runtimeType:sr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new nt(Ce.paint_symbol["text-halo-color"]),"text-halo-width":new nt(Ce.paint_symbol["text-halo-width"]),"text-halo-blur":new nt(Ce.paint_symbol["text-halo-blur"]),"text-translate":new Je(Ce.paint_symbol["text-translate"]),"text-translate-anchor":new Je(Ce.paint_symbol["text-translate-anchor"])})},get layout(){return o2=o2||new Vn({"symbol-placement":new Je(Ce.layout_symbol["symbol-placement"]),"symbol-spacing":new Je(Ce.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Je(Ce.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nt(Ce.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Je(Ce.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Je(Ce.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Je(Ce.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Je(Ce.layout_symbol["icon-ignore-placement"]),"icon-optional":new Je(Ce.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Je(Ce.layout_symbol["icon-rotation-alignment"]),"icon-size":new nt(Ce.layout_symbol["icon-size"]),"icon-text-fit":new Je(Ce.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Je(Ce.layout_symbol["icon-text-fit-padding"]),"icon-image":new nt(Ce.layout_symbol["icon-image"]),"icon-rotate":new nt(Ce.layout_symbol["icon-rotate"]),"icon-padding":new nt(Ce.layout_symbol["icon-padding"]),"icon-keep-upright":new Je(Ce.layout_symbol["icon-keep-upright"]),"icon-offset":new nt(Ce.layout_symbol["icon-offset"]),"icon-anchor":new nt(Ce.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Je(Ce.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Je(Ce.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Je(Ce.layout_symbol["text-rotation-alignment"]),"text-field":new nt(Ce.layout_symbol["text-field"]),"text-font":new nt(Ce.layout_symbol["text-font"]),"text-size":new nt(Ce.layout_symbol["text-size"]),"text-max-width":new nt(Ce.layout_symbol["text-max-width"]),"text-line-height":new Je(Ce.layout_symbol["text-line-height"]),"text-letter-spacing":new nt(Ce.layout_symbol["text-letter-spacing"]),"text-justify":new nt(Ce.layout_symbol["text-justify"]),"text-radial-offset":new nt(Ce.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Je(Ce.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new nt(Ce.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new nt(Ce.layout_symbol["text-anchor"]),"text-max-angle":new Je(Ce.layout_symbol["text-max-angle"]),"text-writing-mode":new Je(Ce.layout_symbol["text-writing-mode"]),"text-rotate":new nt(Ce.layout_symbol["text-rotate"]),"text-padding":new Je(Ce.layout_symbol["text-padding"]),"text-keep-upright":new Je(Ce.layout_symbol["text-keep-upright"]),"text-transform":new nt(Ce.layout_symbol["text-transform"]),"text-offset":new nt(Ce.layout_symbol["text-offset"]),"text-allow-overlap":new Je(Ce.layout_symbol["text-allow-overlap"]),"text-overlap":new Je(Ce.layout_symbol["text-overlap"]),"text-ignore-placement":new Je(Ce.layout_symbol["text-ignore-placement"]),"text-optional":new Je(Ce.layout_symbol["text-optional"])})}};class l2{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Qa,this.defaultValue=e}evaluate(e){if(e.formattedSection){let n=this.defaultValue.property.overrides;if(n?.hasOverride(e.formattedSection))return n.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}}Xe("FormatSectionOverride",l2,{omit:["defaultValue"]});class n0 extends Er{constructor(e,n){super(e,__,n)}recalculate(e,n){if(super.recalculate(e,n),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")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let s=this.layout.get("text-writing-mode");if(s){let c=[];for(let d of s)c.includes(d)||c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,n,s,c){let d=this.layout.get(e).evaluate(n,{},s,c),m=this._unevaluatedLayout._values[e];return m.isDataDriven()||yu(m.value)||!d?d:(function(_,x){return x.replace(/{([^{}]+)}/g,((b,S)=>_&&S in _?String(_[S]):""))})(n.properties,d)}createBucket(e){return new Wu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of __.paint.overridableProperties){if(!n0.hasPaintOverride(this.layout,e))continue;let n=this.paint.get(e),s=new l2(n),c=new Wl(s,n.property.specification),d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new vu("source",c):new bu("composite",c,n.value.zoomStops),this.paint._values[e]=new Xr(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(e,n,s){return!(!this.layout||n.isDataDriven()||s.isDataDriven())&&n0.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,n){let s=e.get("text-field"),c=__.paint.properties[n],d=!1,m=_=>{var x;for(let b of _)if(!((x=c.overrides)===null||x===void 0)&&x.hasOverride(b))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof er)m(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){let _=b=>{d||(b instanceof ua&&Ci(b.value)===Ol?m(b.value.sections):b instanceof Fo?m(b.sections):b.eachChild(_))},x=s.value;x._styleExpression&&_(x._styleExpression.expression)}return d}}let c2;var RM={get paint(){return c2=c2||new Vn({"background-color":new Je(Ce.paint_background["background-color"]),"background-pattern":new Bm(Ce.paint_background["background-pattern"]),"background-opacity":new Je(Ce.paint_background["background-opacity"])})}};class IM extends Er{constructor(e,n){super(e,RM,n)}}class kM extends Er{constructor(e,n){super(e,{},n),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class LM{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)===null||e===void 0||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let OM={once:!0},y_=63710088e-1;class Qs{constructor(e,n){if(isNaN(e)||isNaN(n))throw new Error(`Invalid LngLat object: (${e}, ${n})`);if(this.lng=+e,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Qs(dn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let n=Math.PI/180,s=this.lat*n,c=e.lat*n,d=Math.sin(s)*Math.sin(c)+Math.cos(s)*Math.cos(c)*Math.cos((e.lng-this.lng)*n);return y_*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof Qs)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Qs(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Qs(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>]")}}let u2=2*Math.PI*y_;function h2(r){return u2*Math.cos(r*Math.PI/180)}function d2(r){return(180+r)/360}function p2(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function f2(r,e){return r/h2(e)}function m2(r){return 360*r-180}function r0(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function g2(r,e){return r*h2(r0(e))}class xp{constructor(e,n,s=0){this.x=+e,this.y=+n,this.z=+s}static fromLngLat(e,n=0){let s=Qs.convert(e);return new xp(d2(s.lng),p2(s.lat),f2(n,s.lat))}toLngLat(){return new Qs(m2(this.x),r0(this.y))}toAltitude(){return g2(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/u2*(e=r0(this.y),1/Math.cos(e*Math.PI/180));var e}}function _2(r,e,n){var s=2*Math.PI*6378137/256/Math.pow(2,n);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class v_{constructor(e,n,s){if(!(function(c,d,m){return!(c<0||c>25||m<0||m>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))})(e,n,s))throw new Error(`x=${n}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=n,this.y=s,this.key=Ku(0,e,e,n,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,n,s){let c=(m=this.y,_=this.z,x=_2(256*(d=this.x),256*(m=Math.pow(2,_)-m-1),_),b=_2(256*(d+1),256*(m+1),_),x[0]+","+x[1]+","+b[0]+","+b[1]);var d,m,_,x,b;let S=(function(w,A,E){let R="";for(let I=w;I>0;I--){let O=1<<I-1;R+=(A&O?1:0)+(E&O?2:0)}return R})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,S).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){let n=this.z-e.z;return n>0&&e.x===this.x>>n&&e.y===this.y>>n}getTilePoint(e){let n=Math.pow(2,this.z);return new D((e.x*n-this.x)*Ke,(e.y*n-this.y)*Ke)}toString(){return`${this.z}/${this.x}/${this.y}`}}class y2{constructor(e,n){this.wrap=e,this.canonical=n,this.key=Ku(e,n.z,n.z,n.x,n.y)}}class Ar{constructor(e,n,s,c,d){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=n,this.canonical=new v_(s,+c,+d),this.key=Ku(n,e,s,c,d)}clone(){return new Ar(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?new Ar(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ar(e,this.wrap,e,this.canonical.x>>n,this.canonical.y>>n)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,n){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let s=this.canonical.z-e;return e>this.canonical.z?Ku(this.wrap*+n,e,this.canonical.z,this.canonical.x,this.canonical.y):Ku(this.wrap*+n,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let n=this.canonical.z-e.canonical.z;return!(n<0)&&e.canonical.x===this.canonical.x>>n&&e.canonical.y===this.canonical.y>>n}children(e){if(this.overscaledZ>=e)return[new Ar(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let n=this.canonical.z+1,s=2*this.canonical.x,c=2*this.canonical.y;return[new Ar(n,this.wrap,n,s,c),new Ar(n,this.wrap,n,s+1,c),new Ar(n,this.wrap,n,s,c+1),new Ar(n,this.wrap,n,s+1,c+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 Ar(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ar(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 y2(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new xp(e.x-this.wrap,e.y))}normalizeCoordinates(e,n,s=8192){if(e>=0&&e<s&&n>=0&&n<s)return{tileID:this,x:e,y:n};let c=Math.floor(e/s),d=Math.floor(n/s),m=e-c*s,_=n-d*s,x=this.canonical.z,b=1<<x,S=this.canonical.y+d;if(S<0||S>=b)return null;let w=this.canonical.x+c,A=this.wrap;return w<0?(A-=Math.ceil(-w/b),w=(w%b+b)%b):w>=b&&(A+=Math.floor(w/b),w%=b),{tileID:new Ar(this.overscaledZ,A,x,w,S),x:m,y:_}}}function Ku(r,e,n,s,c){(r*=2)<0&&(r=-1*r-1);let d=1<<n;return(d*d*r+d*c+s).toString(36)+n.toString(36)+e.toString(36)}Xe("CanonicalTileID",v_),Xe("OverscaledTileID",Ar,{omit:["terrainRttPosMatrix32f"]});class vc{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let n=new vc;return n.extend(e(new D(this.minX,this.minY))),n.extend(e(new D(this.maxX,this.minY))),n.extend(e(new D(this.minX,this.maxY))),n.extend(e(new D(this.maxX,this.maxY))),n}static fromPoints(e){let n=new vc;for(let s of e)n.extend(s);return n}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class v2{constructor(e){this._stringToNumber={},this._numberToString=[];for(let n=0;n<e.length;n++){let s=e[n];this._stringToNumber[s]=n,this._numberToString[n]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class b2{constructor(e,n,s,c,d){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=c,this._z=n,this.properties=e.properties,this.id=d}projectPoint(e,n,s,c){return[360*(e.x+n)/c-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/c)*Math.PI))-90]}projectLine(e,n,s,c){return e.map((d=>this.projectPoint(d,n,s,c)))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,n=e.extent*Math.pow(2,this._z),s=e.extent*this._x,c=e.extent*this._y,d=e.loadGeometry();switch(e.type){case 1:{let m=[];for(let x of d)m.push(x[0]);let _=this.projectLine(m,s,c,n);this._geometry=m.length===1?{type:"Point",coordinates:_[0]}:{type:"MultiPoint",coordinates:_};break}case 2:{let m=d.map((_=>this.projectLine(_,s,c,n)));this._geometry=m.length===1?{type:"LineString",coordinates:m[0]}:{type:"MultiLineString",coordinates:m};break}case 3:{let m=Tx(d),_=[];for(let x of m)_.push(x.map((b=>this.projectLine(b,s,c,n))));this._geometry=_.length===1?{type:"Polygon",coordinates:_[0]}:{type:"MultiPolygon",coordinates:_};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&n!=="_x"&&n!=="_y"&&n!=="_z"&&(e[n]=this[n]);return e}}class Qu{constructor(e,n,s){this._name=e,this.dataBuffer=n,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class a0 extends Qu{}class b_ extends a0{getValueFromBuffer(e){return this.dataBuffer[e]}}class x_ extends a0{getValueFromBuffer(e){return this.dataBuffer[e]}}class x2 extends Qu{constructor(e,n,s,c){super(e,n,c),this.delta=s}}class w_ extends x2{constructor(e,n,s,c){super(e,Int32Array.of(n),s,c)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class T_ extends Qu{constructor(e,n,s,c){super(e,c?Int32Array.of(n):Uint32Array.of(n),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class BM{constructor(e,n,s,c,d=4096){this._name=e,this._geometryVector=n,this._idVector=s,this._propertyVectors=c,this._extent=d}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((n=>[n.name,n])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],n=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let c;if(this.idVector){let _=this.idVector.getValue(s);c=this.containsMaxSafeIntegerValues(this.idVector)&&_!==null?Number(_):_}let d={coordinates:n[s],type:this.geometryVector.geometryType(s)},m={};for(let _ of this.propertyVectors){if(!_)continue;let x=_.name,b=_.getValue(s);b!==null&&(m[x]=b)}e.push({id:c,geometry:d,properties:m})}return e}containsMaxSafeIntegerValues(e){return e instanceof b_||e instanceof T_||e instanceof w_||e instanceof x_}}class w2{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var gt,Js;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(gt||(gt={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(Js||(Js={}));let S_=new Uint32Array(33);S_[0]=0;for(let r=1;r<=32;r++)S_[r]=r===32?4294967295:4294967295>>>32-r;let M_=S_,Jo=256;function E_(r,e){return r-r%e}function FM(r){let e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}let C_=(function(){if(!Number.isFinite(65536))return 65536;let r=E_(Math.floor(65536),Jo);return r===0?Jo:r})(),NM=3*C_/Jo+C_|0;function T2(){let r=new Uint8Array(NM);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:r,byteContainerI32:new Int32Array(r.buffer,r.byteOffset,r.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function UM(r,e,n,s,c){switch(c){case 1:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0;_[b++]=A>>>0&1,_[b++]=A>>>1&1,_[b++]=A>>>2&1,_[b++]=A>>>3&1,_[b++]=A>>>4&1,_[b++]=A>>>5&1,_[b++]=A>>>6&1,_[b++]=A>>>7&1,_[b++]=A>>>8&1,_[b++]=A>>>9&1,_[b++]=A>>>10&1,_[b++]=A>>>11&1,_[b++]=A>>>12&1,_[b++]=A>>>13&1,_[b++]=A>>>14&1,_[b++]=A>>>15&1,_[b++]=A>>>16&1,_[b++]=A>>>17&1,_[b++]=A>>>18&1,_[b++]=A>>>19&1,_[b++]=A>>>20&1,_[b++]=A>>>21&1,_[b++]=A>>>22&1,_[b++]=A>>>23&1,_[b++]=A>>>24&1,_[b++]=A>>>25&1,_[b++]=A>>>26&1,_[b++]=A>>>27&1,_[b++]=A>>>28&1,_[b++]=A>>>29&1,_[b++]=A>>>30&1,_[b++]=A>>>31&1}})(r,e,n,s);break;case 2:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0;_[b++]=A>>>0&3,_[b++]=A>>>2&3,_[b++]=A>>>4&3,_[b++]=A>>>6&3,_[b++]=A>>>8&3,_[b++]=A>>>10&3,_[b++]=A>>>12&3,_[b++]=A>>>14&3,_[b++]=A>>>16&3,_[b++]=A>>>18&3,_[b++]=A>>>20&3,_[b++]=A>>>22&3,_[b++]=A>>>24&3,_[b++]=A>>>26&3,_[b++]=A>>>28&3,_[b++]=A>>>30&3,_[b++]=E>>>0&3,_[b++]=E>>>2&3,_[b++]=E>>>4&3,_[b++]=E>>>6&3,_[b++]=E>>>8&3,_[b++]=E>>>10&3,_[b++]=E>>>12&3,_[b++]=E>>>14&3,_[b++]=E>>>16&3,_[b++]=E>>>18&3,_[b++]=E>>>20&3,_[b++]=E>>>22&3,_[b++]=E>>>24&3,_[b++]=E>>>26&3,_[b++]=E>>>28&3,_[b++]=E>>>30&3}})(r,e,n,s);break;case 3:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0;_[b++]=A>>>0&7,_[b++]=A>>>3&7,_[b++]=A>>>6&7,_[b++]=A>>>9&7,_[b++]=A>>>12&7,_[b++]=A>>>15&7,_[b++]=A>>>18&7,_[b++]=A>>>21&7,_[b++]=A>>>24&7,_[b++]=A>>>27&7,_[b++]=7&(A>>>30|(1&E)<<2),_[b++]=E>>>1&7,_[b++]=E>>>4&7,_[b++]=E>>>7&7,_[b++]=E>>>10&7,_[b++]=E>>>13&7,_[b++]=E>>>16&7,_[b++]=E>>>19&7,_[b++]=E>>>22&7,_[b++]=E>>>25&7,_[b++]=E>>>28&7,_[b++]=7&(E>>>31|(3&R)<<1),_[b++]=R>>>2&7,_[b++]=R>>>5&7,_[b++]=R>>>8&7,_[b++]=R>>>11&7,_[b++]=R>>>14&7,_[b++]=R>>>17&7,_[b++]=R>>>20&7,_[b++]=R>>>23&7,_[b++]=R>>>26&7,_[b++]=R>>>29&7}})(r,e,n,s);break;case 4:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0;_[b++]=A>>>0&15,_[b++]=A>>>4&15,_[b++]=A>>>8&15,_[b++]=A>>>12&15,_[b++]=A>>>16&15,_[b++]=A>>>20&15,_[b++]=A>>>24&15,_[b++]=A>>>28&15,_[b++]=E>>>0&15,_[b++]=E>>>4&15,_[b++]=E>>>8&15,_[b++]=E>>>12&15,_[b++]=E>>>16&15,_[b++]=E>>>20&15,_[b++]=E>>>24&15,_[b++]=E>>>28&15,_[b++]=R>>>0&15,_[b++]=R>>>4&15,_[b++]=R>>>8&15,_[b++]=R>>>12&15,_[b++]=R>>>16&15,_[b++]=R>>>20&15,_[b++]=R>>>24&15,_[b++]=R>>>28&15,_[b++]=I>>>0&15,_[b++]=I>>>4&15,_[b++]=I>>>8&15,_[b++]=I>>>12&15,_[b++]=I>>>16&15,_[b++]=I>>>20&15,_[b++]=I>>>24&15,_[b++]=I>>>28&15}})(r,e,n,s);break;case 5:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0;_[b++]=A>>>0&31,_[b++]=A>>>5&31,_[b++]=A>>>10&31,_[b++]=A>>>15&31,_[b++]=A>>>20&31,_[b++]=A>>>25&31,_[b++]=31&(A>>>30|(7&E)<<2),_[b++]=E>>>3&31,_[b++]=E>>>8&31,_[b++]=E>>>13&31,_[b++]=E>>>18&31,_[b++]=E>>>23&31,_[b++]=31&(E>>>28|(1&R)<<4),_[b++]=R>>>1&31,_[b++]=R>>>6&31,_[b++]=R>>>11&31,_[b++]=R>>>16&31,_[b++]=R>>>21&31,_[b++]=R>>>26&31,_[b++]=31&(R>>>31|(15&I)<<1),_[b++]=I>>>4&31,_[b++]=I>>>9&31,_[b++]=I>>>14&31,_[b++]=I>>>19&31,_[b++]=I>>>24&31,_[b++]=31&(I>>>29|(3&O)<<3),_[b++]=O>>>2&31,_[b++]=O>>>7&31,_[b++]=O>>>12&31,_[b++]=O>>>17&31,_[b++]=O>>>22&31,_[b++]=O>>>27&31}})(r,e,n,s);break;case 6:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0,F=d[S++]>>>0;_[b++]=A>>>0&63,_[b++]=A>>>6&63,_[b++]=A>>>12&63,_[b++]=A>>>18&63,_[b++]=A>>>24&63,_[b++]=63&(A>>>30|(15&E)<<2),_[b++]=E>>>4&63,_[b++]=E>>>10&63,_[b++]=E>>>16&63,_[b++]=E>>>22&63,_[b++]=63&(E>>>28|(3&R)<<4),_[b++]=R>>>2&63,_[b++]=R>>>8&63,_[b++]=R>>>14&63,_[b++]=R>>>20&63,_[b++]=R>>>26&63,_[b++]=I>>>0&63,_[b++]=I>>>6&63,_[b++]=I>>>12&63,_[b++]=I>>>18&63,_[b++]=I>>>24&63,_[b++]=63&(I>>>30|(15&O)<<2),_[b++]=O>>>4&63,_[b++]=O>>>10&63,_[b++]=O>>>16&63,_[b++]=O>>>22&63,_[b++]=63&(O>>>28|(3&F)<<4),_[b++]=F>>>2&63,_[b++]=F>>>8&63,_[b++]=F>>>14&63,_[b++]=F>>>20&63,_[b++]=F>>>26&63}})(r,e,n,s);break;case 7:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0,F=d[S++]>>>0,V=d[S++]>>>0;_[b++]=A>>>0&127,_[b++]=A>>>7&127,_[b++]=A>>>14&127,_[b++]=A>>>21&127,_[b++]=127&(A>>>28|(7&E)<<4),_[b++]=E>>>3&127,_[b++]=E>>>10&127,_[b++]=E>>>17&127,_[b++]=E>>>24&127,_[b++]=127&(E>>>31|(63&R)<<1),_[b++]=R>>>6&127,_[b++]=R>>>13&127,_[b++]=R>>>20&127,_[b++]=127&(R>>>27|(3&I)<<5),_[b++]=I>>>2&127,_[b++]=I>>>9&127,_[b++]=I>>>16&127,_[b++]=I>>>23&127,_[b++]=127&(I>>>30|(31&O)<<2),_[b++]=O>>>5&127,_[b++]=O>>>12&127,_[b++]=O>>>19&127,_[b++]=127&(O>>>26|(1&F)<<6),_[b++]=F>>>1&127,_[b++]=F>>>8&127,_[b++]=F>>>15&127,_[b++]=F>>>22&127,_[b++]=127&(F>>>29|(15&V)<<3),_[b++]=V>>>4&127,_[b++]=V>>>11&127,_[b++]=V>>>18&127,_[b++]=V>>>25&127}})(r,e,n,s);break;case 8:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0,F=d[S++]>>>0,V=d[S++]>>>0,U=d[S++]>>>0;_[b++]=A>>>0&255,_[b++]=A>>>8&255,_[b++]=A>>>16&255,_[b++]=A>>>24&255,_[b++]=E>>>0&255,_[b++]=E>>>8&255,_[b++]=E>>>16&255,_[b++]=E>>>24&255,_[b++]=R>>>0&255,_[b++]=R>>>8&255,_[b++]=R>>>16&255,_[b++]=R>>>24&255,_[b++]=I>>>0&255,_[b++]=I>>>8&255,_[b++]=I>>>16&255,_[b++]=I>>>24&255,_[b++]=O>>>0&255,_[b++]=O>>>8&255,_[b++]=O>>>16&255,_[b++]=O>>>24&255,_[b++]=F>>>0&255,_[b++]=F>>>8&255,_[b++]=F>>>16&255,_[b++]=F>>>24&255,_[b++]=V>>>0&255,_[b++]=V>>>8&255,_[b++]=V>>>16&255,_[b++]=V>>>24&255,_[b++]=U>>>0&255,_[b++]=U>>>8&255,_[b++]=U>>>16&255,_[b++]=U>>>24&255}})(r,e,n,s);break;case 16:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<128;w++){let A=d[S++]>>>0;_[b++]=65535&A,_[b++]=A>>>16&65535}})(r,e,n,s);break;default:(function(d,m,_,x,b){let S=M_[b]>>>0,w=m,A=0,E=d[w]>>>0,R=x;for(let I=0;I<8;I++){for(let O=0;O<32;O++)if(A+b<=32)_[R+O]=E>>>A&S,A+=b,A===32&&(A=0,w++,O!==31&&(E=d[w]>>>0));else{let F=32-A,V=E>>>A;w++,E=d[w]>>>0;let U=b-F;_[R+O]=(V|(E&-1>>>32-U>>>0)<<F)&S,A=U}R+=32,A=0,I<7&&(E=d[w]>>>0)}})(r,e,n,s,c)}return e+(c<<3)|0}function VM(r,e,n,s){if(n+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${s} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n}, byteSize=${e})`);let c=r[n++],d=r[n++];if(c>32)throw new Error(`FastPFOR decode: invalid bitWidth=${c} at block=${s} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:c,exceptionCount:d,bytePosIn:n}}function jM(r,e,n,s,c,d,m,_,x){let{maxBits:b,exceptionBitWidth:S,bytePosIn:w}=(function(O,F,V,U,j,H){if(V+1>F)throw new Error(`FastPFOR decode: exception header underflow at block=${H} (need 1 byte for maxBits, bytePos=${V}, byteSize=${F})`);let X=O[V++];if(X<U||X>32)throw new Error(`FastPFOR decode: invalid maxBits=${X} at block=${H} (bitWidth=${U}, expected ${U}..32)`);let ue=X-U|0;if(ue<1||ue>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${ue} at block=${H} (bitWidth=${U}, maxBits=${X})`);if(V+j>F)throw new Error(`FastPFOR decode: exception positions underflow at block=${H} (need=${j}, have=${F-V})`);return{maxBits:X,exceptionBitWidth:ue,bytePosIn:V}})(c,d,m,n,s,x);if(m=w,S===1){let O=1<<n;for(let F=0;F<s;F=F+1|0)r[c[m++]+e|0]|=O;return m}let A=_.dataToBePacked[S];if(!A)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${S} (bitWidth=${n}, maxBits=${b}) at block ${x}`);let E=_.dataPointers,R=0|E[S],I=0|_.exceptionSizes[S];if(R+s>I)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${S} (ptr=${R}, need ${s}, size=${I}) at block ${x}`);for(let O=0;O<s;O=O+1|0){let F=c[m++],V=0|A[R++];r[F+e|0]|=V<<n}return E[S]=R,m}function qM(r,e,n,s,c,d){let m=0|n,_=0|r[m];if(_<=0||m+_>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${_} at pageStart=${m} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);let x=m+1|0,b=m+_|0,S=r[b]>>>0,w=S+3>>>2,A=b+1,E=A+w;if(E>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${S} (metaInts=${w}, pageStart=${m}, packedEnd=${b}, byteContainerStart=${A}) causes bitmapPos=${E} out of bounds (encoded.length=${r.length})`);let R=(function(F,V,U,j){j.byteContainer.length<U&&(j.byteContainer=new Uint8Array(2*U),j.byteContainerI32=void 0);let H=j.byteContainer,X=U>>>2;if(3&H.byteOffset)for(let he=0;he<X;he=he+1|0){let be=0|F[V+he|0],_e=he<<2;H[_e]=255&be,H[_e+1|0]=be>>>8&255,H[_e+2|0]=be>>>16&255,H[_e+3|0]=be>>>24&255}else{let he=j.byteContainerI32;(!he||he.buffer!==H.buffer||he.byteOffset!==H.byteOffset||he.length<X)&&(he=j.byteContainerI32=new Int32Array(H.buffer,H.byteOffset,H.byteLength>>>2)),he.set(F.subarray(V,V+X))}let ue=3&U;if(ue>0){let he=0|F[V+X|0],be=X<<2;for(let _e=0;_e<ue;_e=_e+1|0)H[be+_e|0]=he>>>(_e<<3)&255}return H})(r,A,S,d),I=S,O=(function(F,V,U){let j=0|F[V++],H=U.dataToBePacked;for(let X=2;X<=32;X=X+1|0){if(!(j>>>X-1&1))continue;if(V>=F.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${X}, streamWordIndex=${V}, needWords=1, availableWords=${F.length-V}, encodedWords=${F.length})`);let ue=F[V++]>>>0,he=E_(ue+31,32),be=ue*X+31>>>5;if(V+be>F.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${X}, size=${ue}, streamWordIndex=${V}, needWords=${be}, availableWords=${F.length-V}, encodedWords=${F.length})`);let _e=H[X];(!_e||_e.length<he)&&(_e=H[X]=new Uint32Array(he));let Me=0;for(;Me<ue;Me=Me+32|0)GM(F,V,_e,Me,X),V=V+X|0;V=V-((Me-ue|0)*X>>>5)|0,U.exceptionSizes[X]=ue}return V})(r,E,d);return d.dataPointers.fill(0),(function(F,V,U,j,H,X,ue,he,be,_e){let Me=0|U,Ee=0;for(let we=0;we<ue;we=we+1|0){let ye=VM(he,be,Ee,we);Ee=ye.bytePosIn;let Le=ye.bitWidth,Ze=ye.exceptionCount,Ve=X+we*Jo|0;switch(Le){case 0:H.fill(0,Ve,Ve+Jo);break;case 32:for(let Oe=0;Oe<Jo;Oe=Oe+1|0)H[Ve+Oe|0]=0|F[Me+Oe|0];Me=Me+Jo|0;break;default:Me=UM(F,Me,H,Ve,Le)}Ze>0&&(Ee=jM(H,Ve,Le,Ze,he,be,Ee,_e,we))}if(Me!==j)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${V}, packedStart=${U}, consumedPackedEnd=${Me}, expectedPackedEnd=${j}, packedWords=${j-U}, encoded.length=${F.length})`)})(r,m,x,b,e,0|s,c/Jo|0,R,I,d),O}function GM(r,e,n,s,c){switch(c){case 2:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0;w[E++]=R>>>0&3,w[E++]=R>>>2&3,w[E++]=R>>>4&3,w[E++]=R>>>6&3,w[E++]=R>>>8&3,w[E++]=R>>>10&3,w[E++]=R>>>12&3,w[E++]=R>>>14&3,w[E++]=R>>>16&3,w[E++]=R>>>18&3,w[E++]=R>>>20&3,w[E++]=R>>>22&3,w[E++]=R>>>24&3,w[E++]=R>>>26&3,w[E++]=R>>>28&3,w[E++]=R>>>30&3,w[E++]=I>>>0&3,w[E++]=I>>>2&3,w[E++]=I>>>4&3,w[E++]=I>>>6&3,w[E++]=I>>>8&3,w[E++]=I>>>10&3,w[E++]=I>>>12&3,w[E++]=I>>>14&3,w[E++]=I>>>16&3,w[E++]=I>>>18&3,w[E++]=I>>>20&3,w[E++]=I>>>22&3,w[E++]=I>>>24&3,w[E++]=I>>>26&3,w[E++]=I>>>28&3,w[E]=I>>>30&3})(r,e,n,s);case 3:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0;w[E++]=R>>>0&7,w[E++]=R>>>3&7,w[E++]=R>>>6&7,w[E++]=R>>>9&7,w[E++]=R>>>12&7,w[E++]=R>>>15&7,w[E++]=R>>>18&7,w[E++]=R>>>21&7,w[E++]=R>>>24&7,w[E++]=R>>>27&7,w[E++]=7&(R>>>30|(1&I)<<2),w[E++]=I>>>1&7,w[E++]=I>>>4&7,w[E++]=I>>>7&7,w[E++]=I>>>10&7,w[E++]=I>>>13&7,w[E++]=I>>>16&7,w[E++]=I>>>19&7,w[E++]=I>>>22&7,w[E++]=I>>>25&7,w[E++]=I>>>28&7,w[E++]=7&(I>>>31|(3&O)<<1),w[E++]=O>>>2&7,w[E++]=O>>>5&7,w[E++]=O>>>8&7,w[E++]=O>>>11&7,w[E++]=O>>>14&7,w[E++]=O>>>17&7,w[E++]=O>>>20&7,w[E++]=O>>>23&7,w[E++]=O>>>26&7,w[E]=O>>>29&7})(r,e,n,s);case 4:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0;w[E++]=R>>>0&15,w[E++]=R>>>4&15,w[E++]=R>>>8&15,w[E++]=R>>>12&15,w[E++]=R>>>16&15,w[E++]=R>>>20&15,w[E++]=R>>>24&15,w[E++]=R>>>28&15,w[E++]=I>>>0&15,w[E++]=I>>>4&15,w[E++]=I>>>8&15,w[E++]=I>>>12&15,w[E++]=I>>>16&15,w[E++]=I>>>20&15,w[E++]=I>>>24&15,w[E++]=I>>>28&15,w[E++]=O>>>0&15,w[E++]=O>>>4&15,w[E++]=O>>>8&15,w[E++]=O>>>12&15,w[E++]=O>>>16&15,w[E++]=O>>>20&15,w[E++]=O>>>24&15,w[E++]=O>>>28&15,w[E++]=F>>>0&15,w[E++]=F>>>4&15,w[E++]=F>>>8&15,w[E++]=F>>>12&15,w[E++]=F>>>16&15,w[E++]=F>>>20&15,w[E++]=F>>>24&15,w[E]=F>>>28&15})(r,e,n,s);case 5:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0;w[E++]=R>>>0&31,w[E++]=R>>>5&31,w[E++]=R>>>10&31,w[E++]=R>>>15&31,w[E++]=R>>>20&31,w[E++]=R>>>25&31,w[E++]=31&(R>>>30|(7&I)<<2),w[E++]=I>>>3&31,w[E++]=I>>>8&31,w[E++]=I>>>13&31,w[E++]=I>>>18&31,w[E++]=I>>>23&31,w[E++]=31&(I>>>28|(1&O)<<4),w[E++]=O>>>1&31,w[E++]=O>>>6&31,w[E++]=O>>>11&31,w[E++]=O>>>16&31,w[E++]=O>>>21&31,w[E++]=O>>>26&31,w[E++]=31&(O>>>31|(15&F)<<1),w[E++]=F>>>4&31,w[E++]=F>>>9&31,w[E++]=F>>>14&31,w[E++]=F>>>19&31,w[E++]=F>>>24&31,w[E++]=31&(F>>>29|(3&V)<<3),w[E++]=V>>>2&31,w[E++]=V>>>7&31,w[E++]=V>>>12&31,w[E++]=V>>>17&31,w[E++]=V>>>22&31,w[E]=V>>>27&31})(r,e,n,s);case 6:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0;w[E++]=R>>>0&63,w[E++]=R>>>6&63,w[E++]=R>>>12&63,w[E++]=R>>>18&63,w[E++]=R>>>24&63,w[E++]=63&(R>>>30|(15&I)<<2),w[E++]=I>>>4&63,w[E++]=I>>>10&63,w[E++]=I>>>16&63,w[E++]=I>>>22&63,w[E++]=63&(I>>>28|(3&O)<<4),w[E++]=O>>>2&63,w[E++]=O>>>8&63,w[E++]=O>>>14&63,w[E++]=O>>>20&63,w[E++]=O>>>26&63,w[E++]=F>>>0&63,w[E++]=F>>>6&63,w[E++]=F>>>12&63,w[E++]=F>>>18&63,w[E++]=F>>>24&63,w[E++]=63&(F>>>30|(15&V)<<2),w[E++]=V>>>4&63,w[E++]=V>>>10&63,w[E++]=V>>>16&63,w[E++]=V>>>22&63,w[E++]=63&(V>>>28|(3&U)<<4),w[E++]=U>>>2&63,w[E++]=U>>>8&63,w[E++]=U>>>14&63,w[E++]=U>>>20&63,w[E]=U>>>26&63})(r,e,n,s);case 7:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0;w[E++]=R>>>0&127,w[E++]=R>>>7&127,w[E++]=R>>>14&127,w[E++]=R>>>21&127,w[E++]=127&(R>>>28|(7&I)<<4),w[E++]=I>>>3&127,w[E++]=I>>>10&127,w[E++]=I>>>17&127,w[E++]=I>>>24&127,w[E++]=127&(I>>>31|(63&O)<<1),w[E++]=O>>>6&127,w[E++]=O>>>13&127,w[E++]=O>>>20&127,w[E++]=127&(O>>>27|(3&F)<<5),w[E++]=F>>>2&127,w[E++]=F>>>9&127,w[E++]=F>>>16&127,w[E++]=F>>>23&127,w[E++]=127&(F>>>30|(31&V)<<2),w[E++]=V>>>5&127,w[E++]=V>>>12&127,w[E++]=V>>>19&127,w[E++]=127&(V>>>26|(1&U)<<6),w[E++]=U>>>1&127,w[E++]=U>>>8&127,w[E++]=U>>>15&127,w[E++]=U>>>22&127,w[E++]=127&(U>>>29|(15&j)<<3),w[E++]=j>>>4&127,w[E++]=j>>>11&127,w[E++]=j>>>18&127,w[E]=j>>>25&127})(r,e,n,s);case 8:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0;w[E++]=R>>>0&255,w[E++]=R>>>8&255,w[E++]=R>>>16&255,w[E++]=R>>>24&255,w[E++]=I>>>0&255,w[E++]=I>>>8&255,w[E++]=I>>>16&255,w[E++]=I>>>24&255,w[E++]=O>>>0&255,w[E++]=O>>>8&255,w[E++]=O>>>16&255,w[E++]=O>>>24&255,w[E++]=F>>>0&255,w[E++]=F>>>8&255,w[E++]=F>>>16&255,w[E++]=F>>>24&255,w[E++]=V>>>0&255,w[E++]=V>>>8&255,w[E++]=V>>>16&255,w[E++]=V>>>24&255,w[E++]=U>>>0&255,w[E++]=U>>>8&255,w[E++]=U>>>16&255,w[E++]=U>>>24&255,w[E++]=j>>>0&255,w[E++]=j>>>8&255,w[E++]=j>>>16&255,w[E++]=j>>>24&255,w[E++]=H>>>0&255,w[E++]=H>>>8&255,w[E++]=H>>>16&255,w[E]=H>>>24&255})(r,e,n,s);case 9:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0;w[E++]=R>>>0&511,w[E++]=R>>>9&511,w[E++]=R>>>18&511,w[E++]=511&(R>>>27|(15&I)<<5),w[E++]=I>>>4&511,w[E++]=I>>>13&511,w[E++]=I>>>22&511,w[E++]=511&(I>>>31|(255&O)<<1),w[E++]=O>>>8&511,w[E++]=O>>>17&511,w[E++]=511&(O>>>26|(7&F)<<6),w[E++]=F>>>3&511,w[E++]=F>>>12&511,w[E++]=F>>>21&511,w[E++]=511&(F>>>30|(127&V)<<2),w[E++]=V>>>7&511,w[E++]=V>>>16&511,w[E++]=511&(V>>>25|(3&U)<<7),w[E++]=U>>>2&511,w[E++]=U>>>11&511,w[E++]=U>>>20&511,w[E++]=511&(U>>>29|(63&j)<<3),w[E++]=j>>>6&511,w[E++]=j>>>15&511,w[E++]=511&(j>>>24|(1&H)<<8),w[E++]=H>>>1&511,w[E++]=H>>>10&511,w[E++]=H>>>19&511,w[E++]=511&(H>>>28|(31&X)<<4),w[E++]=X>>>5&511,w[E++]=X>>>14&511,w[E]=X>>>23&511})(r,e,n,s);case 10:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0;w[E++]=R>>>0&1023,w[E++]=R>>>10&1023,w[E++]=R>>>20&1023,w[E++]=1023&(R>>>30|(255&I)<<2),w[E++]=I>>>8&1023,w[E++]=I>>>18&1023,w[E++]=1023&(I>>>28|(63&O)<<4),w[E++]=O>>>6&1023,w[E++]=O>>>16&1023,w[E++]=1023&(O>>>26|(15&F)<<6),w[E++]=F>>>4&1023,w[E++]=F>>>14&1023,w[E++]=1023&(F>>>24|(3&V)<<8),w[E++]=V>>>2&1023,w[E++]=V>>>12&1023,w[E++]=V>>>22&1023,w[E++]=U>>>0&1023,w[E++]=U>>>10&1023,w[E++]=U>>>20&1023,w[E++]=1023&(U>>>30|(255&j)<<2),w[E++]=j>>>8&1023,w[E++]=j>>>18&1023,w[E++]=1023&(j>>>28|(63&H)<<4),w[E++]=H>>>6&1023,w[E++]=H>>>16&1023,w[E++]=1023&(H>>>26|(15&X)<<6),w[E++]=X>>>4&1023,w[E++]=X>>>14&1023,w[E++]=1023&(X>>>24|(3&ue)<<8),w[E++]=ue>>>2&1023,w[E++]=ue>>>12&1023,w[E]=ue>>>22&1023})(r,e,n,s);case 11:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0,he=b[S+10]>>>0;w[E++]=R>>>0&2047,w[E++]=R>>>11&2047,w[E++]=2047&(R>>>22|(1&I)<<10),w[E++]=I>>>1&2047,w[E++]=I>>>12&2047,w[E++]=2047&(I>>>23|(3&O)<<9),w[E++]=O>>>2&2047,w[E++]=O>>>13&2047,w[E++]=2047&(O>>>24|(7&F)<<8),w[E++]=F>>>3&2047,w[E++]=F>>>14&2047,w[E++]=2047&(F>>>25|(15&V)<<7),w[E++]=V>>>4&2047,w[E++]=V>>>15&2047,w[E++]=2047&(V>>>26|(31&U)<<6),w[E++]=U>>>5&2047,w[E++]=U>>>16&2047,w[E++]=2047&(U>>>27|(63&j)<<5),w[E++]=j>>>6&2047,w[E++]=j>>>17&2047,w[E++]=2047&(j>>>28|(127&H)<<4),w[E++]=H>>>7&2047,w[E++]=H>>>18&2047,w[E++]=2047&(H>>>29|(255&X)<<3),w[E++]=X>>>8&2047,w[E++]=X>>>19&2047,w[E++]=2047&(X>>>30|(511&ue)<<2),w[E++]=ue>>>9&2047,w[E++]=ue>>>20&2047,w[E++]=2047&(ue>>>31|(1023&he)<<1),w[E++]=he>>>10&2047,w[E]=he>>>21&2047})(r,e,n,s);case 12:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0,he=b[S+10]>>>0,be=b[S+11]>>>0;w[E++]=R>>>0&4095,w[E++]=R>>>12&4095,w[E++]=4095&(R>>>24|(15&I)<<8),w[E++]=I>>>4&4095,w[E++]=I>>>16&4095,w[E++]=4095&(I>>>28|(255&O)<<4),w[E++]=O>>>8&4095,w[E++]=O>>>20&4095,w[E++]=F>>>0&4095,w[E++]=F>>>12&4095,w[E++]=4095&(F>>>24|(15&V)<<8),w[E++]=V>>>4&4095,w[E++]=V>>>16&4095,w[E++]=4095&(V>>>28|(255&U)<<4),w[E++]=U>>>8&4095,w[E++]=U>>>20&4095,w[E++]=j>>>0&4095,w[E++]=j>>>12&4095,w[E++]=4095&(j>>>24|(15&H)<<8),w[E++]=H>>>4&4095,w[E++]=H>>>16&4095,w[E++]=4095&(H>>>28|(255&X)<<4),w[E++]=X>>>8&4095,w[E++]=X>>>20&4095,w[E++]=ue>>>0&4095,w[E++]=ue>>>12&4095,w[E++]=4095&(ue>>>24|(15&he)<<8),w[E++]=he>>>4&4095,w[E++]=he>>>16&4095,w[E++]=4095&(he>>>28|(255&be)<<4),w[E++]=be>>>8&4095,w[E]=be>>>20&4095})(r,e,n,s);case 16:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0,he=b[S+10]>>>0,be=b[S+11]>>>0,_e=b[S+12]>>>0,Me=b[S+13]>>>0,Ee=b[S+14]>>>0,we=b[S+15]>>>0;w[E++]=R>>>0&65535,w[E++]=R>>>16&65535,w[E++]=I>>>0&65535,w[E++]=I>>>16&65535,w[E++]=O>>>0&65535,w[E++]=O>>>16&65535,w[E++]=F>>>0&65535,w[E++]=F>>>16&65535,w[E++]=V>>>0&65535,w[E++]=V>>>16&65535,w[E++]=U>>>0&65535,w[E++]=U>>>16&65535,w[E++]=j>>>0&65535,w[E++]=j>>>16&65535,w[E++]=H>>>0&65535,w[E++]=H>>>16&65535,w[E++]=X>>>0&65535,w[E++]=X>>>16&65535,w[E++]=ue>>>0&65535,w[E++]=ue>>>16&65535,w[E++]=he>>>0&65535,w[E++]=he>>>16&65535,w[E++]=be>>>0&65535,w[E++]=be>>>16&65535,w[E++]=_e>>>0&65535,w[E++]=_e>>>16&65535,w[E++]=Me>>>0&65535,w[E++]=Me>>>16&65535,w[E++]=Ee>>>0&65535,w[E++]=Ee>>>16&65535,w[E++]=we>>>0&65535,w[E]=we>>>16&65535})(r,e,n,s);case 32:for(let b=0;b<32;b=b+1|0)n[s+b|0]=0|r[e+b|0];return}let d=M_[c]>>>0,m=e,_=0,x=r[m]>>>0;for(let b=0;b<32;b++)if(_+c<=32)n[s+b]=x>>>_&d,_+=c,_===32&&(_=0,m++,b!==31&&(x=r[m]>>>0));else{let S=32-_,w=x>>>_;m++,x=r[m]>>>0,n[s+b]=(w|(x&M_[c-S]>>>0)<<S)&d,_=c-S}}function Gn(r,e,n){let s=new Uint32Array(n),c=0,d=e.get();for(let m=0;m<s.length;m++){let _=r[d++],x=127&_;_<128||(_=r[d++],x|=(127&_)<<7,_<128||(_=r[d++],x|=(127&_)<<14,_<128||(_=r[d++],x|=(127&_)<<21,_<128||(_=r[d++],x|=(15&_)<<28)))),s[c++]=x}return e.set(d),s}function Ju(r,e,n){let s=new BigUint64Array(n);for(let c=0;c<s.length;c++)s[c]=ZM(r,e);return s}function ZM(r,e){let n=0n,s=0,c=e.get();for(;c<r.length;){let d=r[c++];if(n|=BigInt(127&d)<<BigInt(s),!(128&d))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(c),n}function HM(r,e){let n,s;return s=r[e.get()],e.increment(),n=127&s,s<128?n:(s=r[e.get()],e.increment(),n|=(127&s)<<7,s<128?n:(s=r[e.get()],e.increment(),n|=(127&s)<<14,s<128?n:(s=r[e.get()],e.increment(),n|=(127&s)<<21,s<128?n:(s=r[e.get()],n|=(15&s)<<28,(function(c,d,m){let _,x;if(x=d[m.get()],m.increment(),_=(112&x)>>4,x<128||(x=d[m.get()],m.increment(),_|=(127&x)<<3,x<128)||(x=d[m.get()],m.increment(),_|=(127&x)<<10,x<128)||(x=d[m.get()],m.increment(),_|=(127&x)<<17,x<128)||(x=d[m.get()],m.increment(),_|=(127&x)<<24,x<128)||(x=d[m.get()],m.increment(),_|=(1&x)<<31,x<128))return 4294967296*_+(c>>>0);throw new Error("Expected varint not more than 10 bytes")})(n,r,e)))))}function jt(r){return r>>>1^-(1&r)}function nr(r){return r>>1n^-(1n&r)}function eh(r){return r%2==1?(r+1)/-2:r/2}function A_(r,e,n){if(n===void 0){n=0;for(let d=0;d<e;d++)n+=r[d]}let s=new Uint32Array(n),c=0;for(let d=0;d<e;d++){let m=r[d];s.fill(r[d+e],c,c+m),c+=m}return s}function z_(r,e,n){if(n===void 0){n=0;for(let d=0;d<e;d++)n+=Number(r[d])}let s=new BigUint64Array(n),c=0;for(let d=0;d<e;d++){let m=Number(r[d]);s.fill(r[d+e],c,c+m),c+=m}return s}function S2(r,e,n){let s=new Float64Array(n),c=0;for(let d=0;d<e;d++){let m=r[d];s.fill(r[d+e],c,c+m),c+=m}return s}function M2(r){let e=new Int32Array(r.length);e[0]=jt(r[0]);let n=r.length/4*4,s=1;if(n>=4)for(;s<n-4;s+=4){let c=r[s+1],d=r[s+2],m=r[s+3];e[s]=jt(r[s])+e[s-1],e[s+1]=jt(c)+e[s],e[s+2]=jt(d)+e[s+1],e[s+3]=jt(m)+e[s+2]}for(;s!==r.length;++s)e[s]=jt(r[s])+e[s-1];return e}function E2(r){let e=new BigInt64Array(r.length);e[0]=nr(r[0]);let n=r.length/4*4,s=1;if(n>=4)for(;s<n-4;s+=4){let c=r[s+1],d=r[s+2],m=r[s+3];e[s]=nr(r[s])+e[s-1],e[s+1]=nr(c)+e[s],e[s+2]=nr(d)+e[s+1],e[s+3]=nr(m)+e[s+2]}for(;s!==e.length;++s)e[s]=nr(r[s])+e[s-1];return e}function D_(r){let e=r.length/4*4,n=1;if(e>=4)for(let s=r[0];n<e-4;n+=4)s=r[n]+=s,s=r[n+1]+=s,s=r[n+2]+=s,s=r[n+3]+=s;for(;n!==r.length;)r[n]+=r[n-1],++n}var Dn,Fa,bc,zr,li,rn,C2,el;function rr(r,e){let n=(function(s,c){let d=s[c.get()],m=Object.values(Dn)[d>>4],_=null;switch(m){case Dn.DATA:_={dictionaryType:Object.values(Fa)[15&d]};break;case Dn.OFFSET:_={offsetType:Object.values(bc)[15&d]};break;case Dn.LENGTH:_={lengthType:Object.values(zr)[15&d]}}c.increment();let x=s[c.get()],b=Object.values(gt)[x>>5],S=Object.values(gt)[x>>2&7],w=Object.values(Js)[3&x];c.increment();let A=Gn(s,c,2),E=A[0];return{physicalStreamType:m,logicalStreamType:_,logicalLevelTechnique1:b,logicalLevelTechnique2:S,physicalLevelTechnique:w,numValues:E,byteLength:A[1],decompressedCount:E}})(r,e);return n.logicalLevelTechnique1===gt.MORTON?(function(s,c,d){let m=Gn(c,d,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:m[0],coordinateShift:m[1]}})(n,r,e):gt.RLE!==n.logicalLevelTechnique1&&gt.RLE!==n.logicalLevelTechnique2||Js.NONE===n.physicalLevelTechnique?n:(function(s,c,d){let m=Gn(c,d,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:m[1],runs:m[0],numRleValues:m[1]}})(n,r,e)}(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(Dn||(Dn={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(Fa||(Fa={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(bc||(bc={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(zr||(zr={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(li||(li={}));class Na{constructor(e,n){this.values=e,this._size=n}get(e){let n=Math.floor(e/8);return(this.values[n]>>e%8&1)==1}set(e,n){let s=Math.floor(e/8);this.values[s]=this.values[s]|(n?1:0)<<e%8}getInt(e){let n=Math.floor(e/8);return this.values[n]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function th(r,e,n){if(!e)return r;let s=e.size(),c=new r.constructor(s),d=0;for(let m=0;m<s;m++)c[m]=e.get(m)?r[d++]:n;return c}function P_(r,e,n,s,c){return(function(d,m,_,x){let b;switch(m.logicalLevelTechnique1){case gt.DELTA:if(m.logicalLevelTechnique2===gt.RLE){let S=m;if(!x)return(function(w,A,E){let R=new Int32Array(E),I=0,O=0;for(let F=0;F<A;F++){let V=w[F],U=jt(w[F+A]);for(let j=0;j<V;j++)O+=U,R[I++]=O}return R})(d,S.runs,S.numRleValues);b=M2(d=A_(d,S.runs,S.numRleValues))}else b=M2(d);break;case gt.RLE:b=(function(S,w,A){if(A===void 0){A=0;for(let I=0;I<w;I++)A+=S[I]}let E=new Int32Array(A),R=0;for(let I=0;I<w;I++){let O=S[I],F=S[I+w];F=jt(F),E.fill(F,R,R+O),R+=O}return E})(d,m.runs,m.numRleValues);break;case gt.MORTON:D_(d),b=new Int32Array(d);break;case gt.COMPONENTWISE_DELTA:b=(function(S){if(S.length<2)return new Int32Array(S);let w=new Int32Array(S.length);w[0]=jt(S[0]),w[1]=jt(S[1]);let A=S.length/4*4,E=2;if(A>=4)for(;E<A-4;E+=4){let R=S[E+1],I=S[E+2],O=S[E+3];w[E]=jt(S[E])+w[E-2],w[E+1]=jt(R)+w[E-1],w[E+2]=jt(I)+w[E],w[E+3]=jt(O)+w[E+1]}for(;E!==S.length;E+=2)w[E]=jt(S[E])+w[E-2],w[E+1]=jt(S[E+1])+w[E-1];return w})(d);break;case gt.NONE:b=(function(S){let w=new Int32Array(S.length);for(let A=0;A<S.length;A++)w[A]=jt(S[A]);return w})(d);break;default:throw new Error(`The specified Logical level technique is not supported: ${m.logicalLevelTechnique1}`)}return x?th(b,x,0):b})(ih(r,e,n),n,0,c)}function Dr(r,e,n,s,c){return(function(d,m,_,x){let b;switch(m.logicalLevelTechnique1){case gt.DELTA:b=(function(S){let w=new Uint32Array(S.length);w[0]=jt(S[0])>>>0;for(let A=1;A<S.length;A++)w[A]=w[A-1]+jt(S[A])>>>0;return w})(m.logicalLevelTechnique2===gt.RLE?A_(d,m.runs,m.numRleValues):d);break;case gt.RLE:b=A_(d,m.runs,m.numRleValues);break;case gt.MORTON:D_(d),b=d;break;case gt.COMPONENTWISE_DELTA:b=(function(S){if(S.length<2)return new Uint32Array(S);let w=new Uint32Array(S.length);w[0]=jt(S[0])>>>0,w[1]=jt(S[1])>>>0;for(let A=2;A<S.length;A+=2)w[A]=w[A-2]+jt(S[A])>>>0,w[A+1]=w[A-1]+jt(S[A+1])>>>0;return w})(d);break;case gt.NONE:b=d;break;default:throw new Error(`The specified Logical level technique is not supported: ${m.logicalLevelTechnique1}`)}return x?th(b,x,0):b})(ih(r,e,n),n,0,c)}function tl(r,e,n){return(function(s,c){if(c.logicalLevelTechnique1===gt.DELTA&&c.logicalLevelTechnique2===gt.NONE)return(function(d){let m=new Int32Array(d.length+1);m[0]=0,m[1]=jt(d[0]);let _=m[1];for(let x=2;x!==m.length;++x)_+=jt(d[x-1]),m[x]=m[x-1]+_;return new Uint32Array(m)})(s);if(c.logicalLevelTechnique1===gt.RLE&&c.logicalLevelTechnique2===gt.NONE)return(function(d,m,_){let x=new Uint32Array(_+1);x[0]=0;let b=1,S=x[0];for(let w=0;w<m;w++){let A=d[w],E=d[w+m];for(let R=b;R<b+A;R++)x[R]=E+S,S=x[R];b+=A}return x})(s,c.runs,c.numRleValues);if(c.logicalLevelTechnique1===gt.NONE&&c.logicalLevelTechnique2===gt.NONE){(function(m){let _=0;for(let x=0;x<m.length;x++)m[x]+=_,_=m[x]})(s);let d=new Uint32Array(c.numValues+1);return d[0]=0,d.set(s,1),d}if(c.logicalLevelTechnique1===gt.DELTA&&c.logicalLevelTechnique2===gt.RLE){let d=(function(m,_,x){let b=new Int32Array(x+1);b[0]=0;let S=1,w=b[0];for(let A=0;A<_;A++){let E=m[A],R=m[A+_];R=jt(R);for(let I=S;I<S+E;I++)b[I]=R+w,w=b[I];S+=E}return b})(s,c.runs,c.numRleValues);return D_(d),new Uint32Array(d)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(ih(r,e,n),n)}function ih(r,e,n){let s=n.physicalLevelTechnique;switch(s){case Js.FAST_PFOR:return(function(c,d,m,_){return(function(x,b,S,w,A){let E=w.get();if(3&S)throw new Error(`FastPFOR: invalid encodedByteLength=${S} at offset=${E} (encodedBytes.length=${x.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let R=S>>>2,I=(function(F,V){if(V<=F.encodedWords.length)return F.encodedWords;let U=new Uint32Array(Math.max(16,2*V));return F.encodedWords=U,U})(A,R);(function(F,V,U,j){if(V<0||U<0||V+U>F.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${V}, byteLength=${U}, bytes.length=${F.length})`);let H=Math.floor(U/4),X=U%4!=0,ue=X?H+1:H;if(j.length<ue)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${j.length} < ${ue}`);if(H>0){let he=F.byteOffset+V;if(3&he)for(let be=0;be<H;be++){let _e=V+4*be;j[be]=F[_e]<<24|F[_e+1]<<16|F[_e+2]<<8|F[_e+3]}else{let be=new Uint32Array(F.buffer,he,H);for(let _e=0;_e<H;_e++)j[_e]=0|FM(be[_e])}}if(X){let he=V+4*H,be=U-4*H,_e=0;for(let Me=0;Me<be;Me++)_e|=F[he+Me]<<24-8*Me;j[H]=0|_e}})(x,E,S,I);let O=(function(F,V,U){let j=0,H=0,X=new Uint32Array(V),ue=U??T2();if(F.length>0){let he=0|F[j];if(j=j+1|0,255&he)throw new Error(`FastPFOR decode: invalid alignedLength=${he} (expected multiple of 256)`);if(H+he>X.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${H}, alignedLength=${he}, out.length=${X.length})`);j=(function(be,_e,Me,Ee,we,ye){let Le=Ee+E_(we,Jo),Ze=Ee,Ve=Me;for(;Ze!==Le;){let Oe=Math.min(C_,Le-Ze);Ve=qM(be,_e,Ve,Ze,Oe,ye),Ze=Ze+Oe|0}return Ve})(F,X,j,H,he,ue),H=H+he|0}return(function(he,be,_e,Me,Ee,we){if(we===0)return be;let ye=0,Le=be,Ze=be+_e,Ve=Ee,Oe=Ee,at=Ee+we,wt=0,Ct=0;for(;Le<Ze&&Oe<at;){let Ft=he[Le]>>>ye&255;if(ye+=8,Le+=ye>>>5,ye&=31,wt|=(127&Ft)<<Ct,128&Ft)Me[Oe++]=0|wt,wt=0,Ct=0;else if(Ct+=7,Ct>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${Ct}, partial=${wt}, decoded=${Oe-Ve}/${we}, inPos=${Le}, inEnd=${Ze})`)}if(Oe!==at)throw new Error(`FastPFOR VByte: truncated stream (decoded=${Oe-Ve}, expected=${we}, consumedWords=${Le-be}/${_e}, vbyteStart=${be}, vbyteEnd=${Ze})`)})(F,j,F.length-j|0,X,H,V-H|0),X})(I.subarray(0,R),b,A.decoderWorkspace);return w.add(S),O})(c,d,m,_,(function(x=16){if(x<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${x}`);let b=Math.max(16,0|x);return{encodedWords:new Uint32Array(b),decoderWorkspace:T2()}})(m>>>2))})(r,n.numValues,n.byteLength,e);case Js.VARINT:return Gn(r,e,n.numValues);case Js.NONE:{let c=e.get();e.add(n.byteLength);let d=r.subarray(c,e.get());return new Uint32Array(d)}default:throw new Error(`Specified physicalLevelTechnique ${s} is not supported (yet).`)}}function R_(r,e,n){let s=ih(r,e,n);return s.length===1?s[0]:(function(c){return c[1]})(s)}function A2(r,e,n){return(function(s){if(s.length===2){let c=jt(s[1]);return[c,c]}return[jt(s[2]),jt(s[3])]})(ih(r,e,n))}function z2(r,e,n){return(function(s){if(s.length===2){let c=nr(s[1]);return[c,c]}return[nr(s[2]),nr(s[3])]})(Ju(r,e,n.numValues))}function D2(r,e,n,s){return(function(c,d,m){let _;switch(d.logicalLevelTechnique1){case gt.DELTA:_=(function(x){let b=new BigUint64Array(x.length);b[0]=BigInt.asUintN(64,nr(x[0]));for(let S=1;S<x.length;S++)b[S]=BigInt.asUintN(64,b[S-1]+nr(x[S]));return b})(d.logicalLevelTechnique2===gt.RLE?z_(c,d.runs,d.numRleValues):c);break;case gt.RLE:_=z_(c,d.runs,d.numRleValues);break;case gt.NONE:_=c;break;default:throw new Error(`The specified Logical level technique is not supported: ${d.logicalLevelTechnique1}`)}return m?th(_,m,0n):_})(Ju(r,e,n.numValues),n,s)}function P2(r,e,n){let s=Ju(r,e,n.numValues);return s.length===1?s[0]:(function(c){return c[1]})(s)}function o0(r,e,n,s,c="int32"){let d=r.logicalLevelTechnique1;if(d===gt.RLE)return r.runs===1?li.CONST:li.FLAT;if(d!==gt.DELTA||r.logicalLevelTechnique2!==gt.RLE)return r.numValues===1?li.CONST:li.FLAT;let m=e instanceof Na?e.size():e;if(r.numRleValues!==m)return li.FLAT;if(r.runs===1)return li.SEQUENCE;if(r.runs!==2)return r.numValues===1?li.CONST:li.FLAT;let _=s.get();if(r.physicalLevelTechnique===Js.VARINT)return(function(S,w,A){let E=new w2(w.get());if(A==="int64"){let I=Ju(S,E,4);return I[2]===2n&&I[3]===2n}let R=Gn(S,E,4);return R[2]===2&&R[3]===2})(n,s,c)?li.SEQUENCE:r.numValues===1?li.CONST:li.FLAT;let x=s.get(),b=new Int32Array(n.buffer,n.byteOffset+x,4);return s.set(_),b[2]===2&&b[3]===2?li.SEQUENCE:r.numValues===1?li.CONST:li.FLAT}class R2 extends a0{getValueFromBuffer(e){return this.dataBuffer[e]}}class I2 extends x2{constructor(e,n,s,c){super(e,BigInt64Array.of(n),s,c)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function I_(r,e,n){return{x:k2(r,e)-n,y:k2(r>>1,e)-n}}function k2(r,e){let n=0;for(let s=0;s<e;s++)n|=(r&1<<2*s)>>s;return n}function nh(r,e,n,s,c,d,m){return r===el.MORTON?(function(_,x,b,S,w,A){let E=new Array(w?S+1:S);for(let R=0;R<S;R++){let I=I_(_[x[b+R]],A.numBits,A.coordinateShift);E[R]=new D(I.x,I.y)}return w&&(E[E.length-1]=E[0]),E})(e,n,s,c,d,m):(function(_,x,b,S,w){let A=new Array(w?S+1:S);for(let E=0;E<2*S;E+=2){let R=2*x[b+E/2];A[E/2]=new D(_[R],_[R+1])}return w&&(A[A.length-1]=A[0]),A})(e,n,s,c,d)}function rh(r,e,n,s){let c=new Array(s?n+1:n);for(let d=0;d<2*n;d+=2)c[d/2]=new D(r[e+d],r[e+d+1]);return s&&(c[c.length-1]=c[0]),c}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(rn||(rn={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(C2||(C2={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(el||(el={}));class L2{constructor(e,n,s,c,d){this._vertexBufferType=e,this._topologyVector=n,this._vertexOffsets=s,this._vertexBuffer=c,this._mortonSettings=d}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let n=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[n],this.vertexBuffer[n+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let s=I_(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}let n=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[n],this.vertexBuffer[n+1]]}getGeometries(){return(function(e){let n=new Array(e.numGeometries),s=1,c=1,d=1,m=0,_=0,x=0,b=e.mortonSettings,S=e.topologyVector,w=S.geometryOffsets,A=S.partOffsets,E=S.ringOffsets,R=e.vertexOffsets,I=!R||R.length===0,O=e.containsPolygonGeometry(),F=e.vertexBuffer;for(let V=0;V<e.numGeometries;V++)switch(e.geometryType(V)){case rn.POINT:{let U,j;if(I)U=F[_++],j=F[_++];else if(e.vertexBufferType===el.MORTON){let H=I_(F[R[x++]],b.numBits,b.coordinateShift);U=H.x,j=H.y}else{let H=2*R[x++];U=F[H],j=F[H+1]}n[m++]=[[new D(U,j)]],w&&d++,A&&s++,E&&c++}break;case rn.MULTIPOINT:{let U=w[d]-w[d-1];d++;let j=new Array(U);if(I)for(let H=0;H<U;H++){let X=F[_++],ue=F[_++];j[H]=new D(X,ue)}else for(let H=0;H<U;H++){let X=2*R[x++];j[H]=new D(F[X],F[X+1])}n[m++]=j.map((H=>[H])),s+=U,c+=U}break;case rn.LINESTRING:{let U,j;O?(U=E[c]-E[c-1],c++):U=A[s]-A[s-1],s++,I?(j=rh(F,_,U,!1),_+=2*U):(j=nh(e.vertexBufferType,F,R,x,U,!1,b),x+=U),n[m++]=[j],w&&d++}break;case rn.POLYGON:{let U=A[s]-A[s-1];s++;let j=new Array(U-1),H,X=E[c]-E[c-1];if(c++,I){H=rh(F,_,X,!0),_+=2*X;for(let ue=0;ue<j.length;ue++)X=E[c]-E[c-1],c++,j[ue]=rh(F,_,X,!0),_+=2*X}else{H=nh(e.vertexBufferType,F,R,x,X,!0,b),x+=X;for(let ue=0;ue<j.length;ue++)X=E[c]-E[c-1],c++,j[ue]=nh(e.vertexBufferType,F,R,x,X,!0,b),x+=X}n[m++]=[H].concat(j),w&&d++}break;case rn.MULTILINESTRING:{let U=w[d]-w[d-1];d++;let j=new Array(U);for(let H=0;H<U;H++){let X;if(O?(X=E[c]-E[c-1],c++):X=A[s]-A[s-1],s++,I)j[H]=rh(F,_,X,!1),_+=2*X;else{let ue=nh(e.vertexBufferType,F,R,x,X,!1,b);j[H]=ue,x+=X}}n[m++]=j}break;case rn.MULTIPOLYGON:{let U=w[d]-w[d-1];d++;let j=new Array(U);for(let H=0;H<U;H++){let X=A[s]-A[s-1],ue;s++;let he=new Array(X-1),be=E[c]-E[c-1];c++,I?(ue=rh(F,_,be,!0),_+=2*be):(ue=nh(e.vertexBufferType,F,R,x,be,!0,b),x+=be);for(let _e=0;_e<he.length;_e++){let Me=E[c]-E[c-1];c++,I?(he[_e]=rh(F,_,Me,!0),_+=2*Me):(he[_e]=nh(e.vertexBufferType,F,R,x,Me,!0,b),x+=Me)}j[H]=[ue].concat(he)}n[m++]=j.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return n})(this)}get mortonSettings(){return this._mortonSettings}}class O2 extends L2{constructor(e,n,s,c,d,m,_){super(s,c,d,m,_),this._numGeometries=e,this._geometryType=n}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===rn.POLYGON||this._geometryType===rn.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class B2 extends L2{constructor(e,n,s,c,d,m){super(e,s,c,d,m),this._geometryTypes=n}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===rn.POLYGON||this.geometryType(e)===rn.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class F2{constructor(e,n,s,c){this._triangleOffsets=e,this._indexBuffer=n,this._vertexBuffer=s,this._topologyVector=c}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");let e=new Array(this.numGeometries),n=this._topologyVector,s=n.partOffsets,c=n.ringOffsets,d=n.geometryOffsets,m=0,_=1,x=1,b=1;for(let S=0;S<this.numGeometries;S++)switch(this.geometryType(S)){case rn.POLYGON:{let w=s[_]-s[_-1];_++;let A=[];for(let E=0;E<w;E++){let R=c[x]-c[x-1];x++;let I=[];for(let O=0;O<R;O++){let F=this._vertexBuffer[m++],V=this._vertexBuffer[m++];I.push(new D(F,V))}I.length>0&&I.push(I[0]),A.push(I)}e[S]=A,d&&b++}break;case rn.MULTIPOLYGON:{let w=d[b]-d[b-1];b++;let A=[];for(let E=0;E<w;E++){let R=s[_]-s[_-1];_++;for(let I=0;I<R;I++){let O=c[x]-c[x-1];x++;let F=[];for(let V=0;V<O;V++){let U=this._vertexBuffer[m++],j=this._vertexBuffer[m++];F.push(new D(U,j))}F.length>0&&F.push(F[0]),A.push(F)}}e[S]=A}}return e}[Symbol.iterator](){return null}}function N2(r,e,n,s,c,d){return new $M(r,e,n,s,c,d)}class $M extends F2{constructor(e,n,s,c,d,m){super(s,c,d,m),this._numGeometries=e,this._geometryType=n}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function U2(r,e,n,s,c){return new XM(r,e,n,s,c)}class XM extends F2{constructor(e,n,s,c,d){super(n,s,c,d),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function YM(r,e,n,s,c){let d=rr(r,n),m,_,x,b;if(o0(d,s,r,n)===li.CONST){let V=R_(r,n,d),U,j,H,X;for(let ue=0;ue<e-1;ue++){let he=rr(r,n);switch(he.physicalStreamType){case Dn.LENGTH:switch(he.logicalStreamType.lengthType){case zr.GEOMETRIES:U=tl(r,n,he);break;case zr.PARTS:j=tl(r,n,he);break;case zr.RINGS:H=tl(r,n,he);break;case zr.TRIANGLES:X=tl(r,n,he)}break;case Dn.OFFSET:switch(he.logicalStreamType.offsetType){case bc.VERTEX:m=Dr(r,n,he);break;case bc.INDEX:b=Dr(r,n,he)}break;case Dn.DATA:Fa.VERTEX===he.logicalStreamType.dictionaryType?_=P_(r,n,he):(x={numBits:he.numBits,coordinateShift:he.coordinateShift},_=Dr(r,n,he))}}return b?U!==void 0||j!==void 0?N2(s,V,X,b,_,{geometryOffsets:U,partOffsets:j,ringOffsets:H}):N2(s,V,X,b,_):x===void 0?(function(ue,he,be,_e,Me){return new O2(ue,he,el.VEC_2,be,_e,Me)})(s,V,{geometryOffsets:U,partOffsets:j,ringOffsets:H},m,_):(function(ue,he,be,_e,Me,Ee){return new O2(ue,he,el.MORTON,be,_e,Me,Ee)})(s,V,{geometryOffsets:U,partOffsets:j,ringOffsets:H},m,_,x)}let S=Dr(r,n,d),w,A,E,R,I,O,F;for(let V=0;V<e-1;V++){let U=rr(r,n);switch(U.physicalStreamType){case Dn.LENGTH:switch(U.logicalStreamType.lengthType){case zr.GEOMETRIES:w=Dr(r,n,U);break;case zr.PARTS:A=Dr(r,n,U);break;case zr.RINGS:E=Dr(r,n,U);break;case zr.TRIANGLES:R=tl(r,n,U)}break;case Dn.OFFSET:switch(U.logicalStreamType.offsetType){case bc.VERTEX:m=Dr(r,n,U);break;case bc.INDEX:b=Dr(r,n,U)}break;case Dn.DATA:Fa.VERTEX===U.logicalStreamType.dictionaryType?_=P_(r,n,U):(x={numBits:U.numBits,coordinateShift:U.coordinateShift},_=Dr(r,n,U))}}return w?(I=k_(S,w,2),A&&E?(O=V2(S,I,A,!1),F=(function(V,U,j,H){let X=new Uint32Array(j[j.length-1]+1),ue=0;X[0]=ue;let he=1,be=1,_e=0;for(let Me=0;Me<V.length;Me++){let Ee=V[Me],we=U[Me+1]-U[Me];if(Ee!==0&&Ee!==3)for(let ye=0;ye<we;ye++){let Le=j[he]-j[he-1];he++;for(let Ze=0;Ze<Le;Ze++)ue=X[be++]=ue+H[_e++]}else for(let ye=0;ye<we;ye++)X[be++]=++ue,he++}return X})(S,I,O,E)):A&&(O=(function(V,U,j){let H=new Uint32Array(U[U.length-1]+1),X=0;H[0]=X;let ue=1,he=0;for(let be=0;be<V.length;be++){let _e=V[be],Me=U[be+1]-U[be];if(_e===4||_e===1)for(let Ee=0;Ee<Me;Ee++)X=H[ue++]=X+j[he++];else for(let Ee=0;Ee<Me;Ee++)H[ue++]=++X}return H})(S,I,A))):A&&E?(O=k_(S,A,1),F=V2(S,O,E,!0)):A&&(O=k_(S,A,0)),b&&!O?U2(S,R,b,_):b?U2(S,R,b,_,{geometryOffsets:I,partOffsets:O,ringOffsets:F}):x===void 0?(function(V,U,j,H){return new B2(el.VEC_2,V,U,j,H)})(S,{geometryOffsets:I,partOffsets:O,ringOffsets:F},m,_):(function(V,U,j,H,X){return new B2(el.MORTON,V,U,j,H,X)})(S,{geometryOffsets:I,partOffsets:O,ringOffsets:F},m,_,x)}function k_(r,e,n){let s=new Uint32Array(r.length+1),c=0;s[0]=c;let d=0;for(let m=0;m<r.length;m++)c=s[m+1]=c+(r[m]>n?e[d++]:1);return s}function V2(r,e,n,s){let c=new Uint32Array(e[e.length-1]+1),d=0;c[0]=d;let m=1,_=0;for(let x=0;x<r.length;x++){let b=r[x],S=e[x+1]-e[x];if(b===5||b===2||s&&(b===4||b===1))for(let w=0;w<S;w++)d=c[m++]=d+n[_++];else for(let w=0;w<S;w++)c[m++]=++d}return c}class WM extends Qu{constructor(e,n,s){super(e,n.getBuffer(),s),this.dataVector=n}getValueFromBuffer(e){return this.dataVector.get(e)}}class KM extends a0{getValueFromBuffer(e){return this.dataBuffer[e]}}class j2 extends Qu{constructor(e,n,s,c){super(e,c?BigInt64Array.of(n):BigUint64Array.of(n),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function wp(r,e,n,s,c){let d=(function(m,_,x,b){let S=new Uint8Array(_),w=0,A=b.get()+x;for(;w<_&&!(b.get()>=A);){let E=m[b.increment()];if(E<=127){let R=E+3,I=m[b.increment()],O=Math.min(w+R,_);S.fill(I,w,O),w=O}else{let R=256-E;for(let I=0;I<R&&w<_;I++)S[w++]=m[b.increment()]}}return b.set(A),S})(r,Math.ceil(e/8),n,s);return c?(function(m,_,x){if(!x)return m;let b=x.size(),S=new Na(m,_),w=new Na(new Uint8Array(Math.ceil(b/8)),b),A=0;for(let E=0;E<b;E++){let R=!!x.get(E)&&S.get(A++);w.set(E,R)}return w.getBuffer()})(d,e,c):d}let QM=new TextDecoder;function L_(r,e,n){return n-e>=12?QM.decode(r.subarray(e,n)):(function(s,c,d){let m="",_=c;for(;_<d;){let x=s[_],b,S,w,A=null,E=x>239?4:x>223?3:x>191?2:1;if(_+E>d)break;E===1?x<128&&(A=x):E===2?(b=s[_+1],(192&b)==128&&(A=(31&x)<<6|63&b,A<=127&&(A=null))):E===3?(b=s[_+1],S=s[_+2],(192&b)==128&&(192&S)==128&&(A=(15&x)<<12|(63&b)<<6|63&S,(A<=2047||A>=55296&&A<=57343)&&(A=null))):E===4&&(b=s[_+1],S=s[_+2],w=s[_+3],(192&b)==128&&(192&S)==128&&(192&w)==128&&(A=(15&x)<<18|(63&b)<<12|(63&S)<<6|63&w,(A<=65535||A>=1114112)&&(A=null))),A===null?(A=65533,E=1):A>65535&&(A-=65536,m+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),m+=String.fromCharCode(A),_+=E}return m})(r,e,n)}class O_ extends Qu{constructor(e,n,s,c){super(e,s,c),this.offsetBuffer=n}}class q2 extends O_{constructor(e,n,s,c){super(e,n,s,c??n.length-1)}getValueFromBuffer(e){return L_(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class ah extends O_{constructor(e,n,s,c,d){super(e,s,c,d??n.length),this.indexBuffer=n,this.indexBuffer=n}getValueFromBuffer(e){let n=this.indexBuffer[e];return L_(this.dataBuffer,this.offsetBuffer[n],this.offsetBuffer[n+1])}}class G2 extends O_{constructor(e,n,s,c,d,m,_){super(e,s,c,_),this.indexBuffer=n,this.symbolOffsetBuffer=d,this.symbolTableBuffer=m}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=(function(s,c,d){let m=[],_=new Array(c.length).fill(0);for(let x=1;x<c.length;x++)_[x]=_[x-1]+c[x-1];for(let x=0;x<d.length;x++)if(d[x]===255)m.push(d[++x]);else{let b=c[d[x]],S=_[d[x]];for(let w=0;w<b;w++)m.push(s[S+w])}return new Uint8Array(m)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let n=this.indexBuffer[e];return L_(this.decodedDictionary,this.offsetBuffer[n],this.offsetBuffer[n+1])}offsetToLengthBuffer(e){let n=new Uint32Array(e.length-1),s=e[0];for(let c=1;c<e.length;c++){let d=e[c];n[c-1]=d-s,s=d}return n}}function JM(r,e,n,s,c,d){return n.type==="scalarType"?(function(m,_,x,b,S,w){let A=null;if(m===0)return null;if(w.nullable){let R=rr(_,x),I=R.numValues,O=x.get(),F=wp(_,I,R.byteLength,x);x.set(O+R.byteLength),A=new Na(F,R.numValues)}let E=A??b;switch(S.physicalType){case 4:case 3:return(function(R,I,O,F,V){let U=rr(R,I),j=o0(U,V,R,I),H=F.physicalType===3;if(j===li.FLAT){let ue=Tp(V)?V:void 0,he=H?P_(R,I,U,0,ue):Dr(R,I,U,0,ue);return new b_(O.name,he,V)}if(j===li.SEQUENCE){let ue=A2(R,I,U);return new w_(O.name,ue[0],ue[1],U.numRleValues)}let X=H?(function(ue,he,be){let _e=ih(ue,he,be);return _e.length===1?jt(_e[0]):(function(Me){return jt(Me[1])})(_e)})(R,I,U):R_(R,I,U);return new T_(O.name,X,V,H)})(_,x,w,S,E);case 9:return(function(R,I,O,F,V){let U=null,j=null,H=null,X=null,ue=null,he=V??null,be=null,_e=null;for(let Me=0;Me<F;Me++){let Ee=rr(I,O);switch(Ee.physicalStreamType){case Dn.PRESENT:{let we=wp(I,Ee.numValues,Ee.byteLength,O),ye=new Na(we,Ee.numValues);he=V??ye;break}case Dn.OFFSET:j=Dr(I,O,Ee,0,he);break;case Dn.LENGTH:{let we=tl(I,O,Ee);zr.DICTIONARY===Ee.logicalStreamType.lengthType?U=we:zr.SYMBOL===Ee.logicalStreamType.lengthType?X=we:be=we;break}case Dn.DATA:{let we=I.subarray(O.get(),O.get()+Ee.byteLength);O.add(Ee.byteLength);let ye=Ee.logicalStreamType.dictionaryType;Fa.FSST===ye?ue=we:Fa.SINGLE===ye||Fa.SHARED===ye?H=we:Fa.NONE===ye&&(_e=we);break}}}return(function(Me,Ee,we,ye,Le,Ze,Ve){return Ee?new G2(Me,we,ye,Le,Ze,Ee,Ve):null})(R,ue,j,U,H,X,he)??(function(Me,Ee,we,ye,Le){return Ee?Le?new ah(Me,we,ye,Ee,Le):new ah(Me,we,ye,Ee):null})(R,H,j,U,he)??(function(Me,Ee,we,ye,Le){if(!Ee||!we)return null;if(ye)return Le?new ah(Me,ye,Ee,we,Le):new ah(Me,ye,Ee,we);if(Le&&Le.size()!==Ee.length-1){let Ze=new Uint32Array(Le.size()),Ve=0;for(let Oe=0;Oe<Le.size();Oe++)Ze[Oe]=Le.get(Oe)?Ve++:0;return new ah(Me,Ze,Ee,we,Le)}return Le?new q2(Me,Ee,we,Le):new q2(Me,Ee,we)})(R,be,_e,j,he)})(w.name,_,x,w.nullable?m-1:m,A);case 0:return(function(R,I,O,F,V){let U=rr(R,I),j=U.numValues,H=I.get(),X=Tp(V)?V:void 0,ue=wp(R,j,U.byteLength,I,X);I.set(H+U.byteLength);let he=new Na(ue,j);return new WM(O.name,he,V)})(_,x,w,0,E);case 6:case 5:return(function(R,I,O,F,V){let U=rr(R,I),j=o0(U,F,R,I,"int64"),H=V.physicalType===5;if(j===li.FLAT){let ue=Tp(F)?F:void 0,he=H?(function(be,_e,Me,Ee){return(function(we,ye,Le){let Ze;switch(ye.logicalLevelTechnique1){case gt.DELTA:if(ye.logicalLevelTechnique2===gt.RLE){let Ve=ye;if(!Le)return(function(Oe,at,wt){let Ct=new BigInt64Array(wt),Ft=0,Rn=0n;for(let xi=0;xi<at;xi++){let $i=Number(Oe[xi]),an=nr(Oe[xi+at]);for(let ci=0;ci<$i;ci++)Rn+=an,Ct[Ft++]=Rn}return Ct})(we,Ve.runs,Ve.numRleValues);Ze=E2(we=z_(we,Ve.runs,Ve.numRleValues))}else Ze=E2(we);break;case gt.RLE:Ze=(function(Ve,Oe,at){if(at===void 0){at=0;for(let Ft=0;Ft<Oe;Ft++)at+=Number(Ve[Ft])}let wt=new BigInt64Array(at),Ct=0;for(let Ft=0;Ft<Oe;Ft++){let Rn=Number(Ve[Ft]),xi=Ve[Ft+Oe];xi=nr(xi),wt.fill(xi,Ct,Ct+Rn),Ct+=Rn}return wt})(we,ye.runs,ye.numRleValues);break;case gt.NONE:Ze=(function(Ve){let Oe=new BigInt64Array(Ve.length);for(let at=0;at<Ve.length;at++)Oe[at]=nr(Ve[at]);return Oe})(we);break;default:throw new Error(`The specified Logical level technique is not supported: ${ye.logicalLevelTechnique1}`)}return Le?th(Ze,Le,0n):Ze})(Ju(be,_e,Me.numValues),Me,Ee)})(R,I,U,ue):D2(R,I,U,ue);return new R2(O.name,he,F)}if(j===li.SEQUENCE){let ue=z2(R,I,U);return new I2(O.name,ue[0],ue[1],U.numRleValues)}let X=H?(function(ue,he,be){let _e=Ju(ue,he,be.numValues);return _e.length===1?nr(_e[0]):(function(Me){return nr(Me[1])})(_e)})(R,I,U):P2(R,I,U);return new j2(O.name,X,F,H)})(_,x,w,E,S);case 7:return(function(R,I,O,F){let V=rr(R,I),U=Tp(F)?F:void 0,j=(function(H,X,ue,he){let be=X.get(),_e=be+ue*Float32Array.BYTES_PER_ELEMENT,Me=new Uint8Array(H.subarray(be,_e)).buffer,Ee=new Float32Array(Me);return X.set(_e),he?th(Ee,he,0):Ee})(R,I,V.numValues,U);return new KM(O.name,j,F)})(_,x,w,E);case 8:return(function(R,I,O,F){let V=rr(R,I),U=Tp(F)?F:void 0,j=(function(H,X,ue,he){let be=X.get(),_e=be+ue*Float64Array.BYTES_PER_ELEMENT,Me=new Uint8Array(H.subarray(be,_e)).buffer,Ee=new Float64Array(Me);return X.set(_e),he?th(Ee,he,0):Ee})(R,I,V.numValues,U);return new x_(O.name,j,F)})(_,x,w,E);default:throw new Error(`The specified data type for the field is currently not supported: ${S}`)}})(s,r,e,c,n.scalarType,n):s===0?null:(function(m,_,x,b){let S=null,w=null,A=null,E=null,R=!1;for(;!R;){let V=rr(m,_);switch(V.physicalStreamType){case Dn.LENGTH:zr.DICTIONARY===V.logicalStreamType.lengthType?S=tl(m,_,V):A=tl(m,_,V);break;case Dn.DATA:Fa.SINGLE===V.logicalStreamType.dictionaryType||Fa.SHARED===V.logicalStreamType.dictionaryType?(w=m.subarray(_.get(),_.get()+V.byteLength),R=!0):E=m.subarray(_.get(),_.get()+V.byteLength),_.add(V.byteLength)}}let I=x.complexType.children,O=[],F=0;for(let V of I){let U=Gn(m,_,1)[0];if(U===0)continue;let j=V.name?`${x.name}${V.name}`:x.name;if(U!==2||V.type!=="scalarField"||V.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");let H=rr(m,_),X=wp(m,H.numValues,H.byteLength,_),ue=rr(m,_),he=Dr(m,_,ue,0,ue.decompressedCount!==b?new Na(X,H.numValues):void 0);O[F++]=E?new G2(j,he,S,w,A,E,new Na(X,H.numValues)):new ah(j,he,S,w,new Na(X,H.numValues))}return O})(r,e,n,c)}function Tp(r){return r instanceof Na}function Z2(r){switch(r){case 0:case 1:case 2:case 3:{let e={};e.nullable=!!(1&r),e.columnScope=0;let n={type:"logicalType",logicalType:0};return n.longID=!!(2&r),e.scalarType=n,e.type="scalarType",e}case 4:{let e={nullable:!1,columnScope:0},n={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=n,e}case 30:{let e={nullable:!1,columnScope:0},n={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=n,e}default:return(function(e){let n;switch(e){case 10:case 11:n=0;break;case 12:case 13:n=1;break;case 14:case 15:n=2;break;case 16:case 17:n=3;break;case 18:case 19:n=4;break;case 20:case 21:n=5;break;case 22:case 23:n=6;break;case 24:case 25:n=7;break;case 26:case 27:n=8;break;case 28:case 29:n=9;break;default:return null}let s={};s.nullable=!!(1&e),s.columnScope=0;let c={type:"physicalType"};return c.physicalType=n,s.type="scalarType",s.scalarType=c,s})(r)}}function H2(r){return r>=10}function $2(r){return r===30}function eE(r){if(r.type==="scalarType"){let e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(r.type==="complexType"){let e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}function tE(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}let iE=new TextDecoder;function B_(r,e){let n=Gn(r,e,1)[0];if(n===0)return"";let s=e.get(),c=r.subarray(s,s+n);return e.add(n),iE.decode(c)}function X2(r,e){let n=Gn(r,e,1)[0]>>>0;if(n<10||n>30)throw new Error(`Unsupported field type code ${n}. Supported: 10-29(scalars), 30(STRUCT)`);let s=Z2(n);if(H2(n)&&(s.name=B_(r,e)),$2(n)){let c=Gn(r,e,1)[0]>>>0;s.complexType.children=new Array(c);for(let d=0;d<c;d++)s.complexType.children[d]=X2(r,e)}return(function(c){return{name:c.name,nullable:c.nullable,scalarField:c.scalarType,complexField:c.complexType,type:c.type==="scalarType"?"scalarField":"complexField"}})(s)}function nE(r,e){let n=Gn(r,e,1)[0]>>>0,s=Z2(n);if(!s)throw new Error(`Unsupported column type code ${n}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(H2(n)?s.name=B_(r,e):n>=0&&n<=3?s.name="id":n===4&&(s.name="geometry"),$2(n)){let c=Gn(r,e,1)[0]>>>0,d=s.complexType;d.children=new Array(c);for(let m=0;m<c;m++)d.children[m]=X2(r,e)}return s}function rE(r,e){let n={featureTables:[]},s={};s.name=B_(r,e);let c=Gn(r,e,1)[0]>>>0,d=Gn(r,e,1)[0]>>>0;s.columns=new Array(d);for(let m=0;m<d;m++)s.columns[m]=nE(r,e);return n.featureTables.push(s),[n,c]}function aE(r,e,n,s,c,d,m=!1){let _=e.scalarType;if(!_||_.type!=="logicalType"||_.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${s}`);let x=_.longID?6:4,b=typeof d=="number"?void 0:d,S=o0(c,d,r,n,x===6?"int64":"int32");if(x===4)switch(S){case li.FLAT:{let w=Dr(r,n,c,0,b);return new b_(s,w,d)}case li.SEQUENCE:{let w=A2(r,n,c);return new w_(s,w[0],w[1],c.numRleValues)}case li.CONST:{let w=R_(r,n,c);return new T_(s,w,d,!1)}}switch(S){case li.FLAT:{if(m){let A=(function(E,R,I){let O=(function(F,V,U){let j=new Float64Array(U);for(let H=0;H<U;H++)j[H]=HM(F,V);return j})(E,R,I.numValues);return(function(F,V){switch(V.logicalLevelTechnique1){case gt.DELTA:return V.logicalLevelTechnique2===gt.RLE&&(F=S2(F,V.runs,V.numRleValues)),(function(U){U[0]=eh(U[0]);let j=U.length/4*4,H=1;if(j>=4)for(;H<j-4;H+=4){let X=U[H+1],ue=U[H+2],he=U[H+3];U[H]=eh(U[H])+U[H-1],U[H+1]=eh(X)+U[H],U[H+2]=eh(ue)+U[H+1],U[H+3]=eh(he)+U[H+2]}for(;H!==U.length;++H)U[H]=eh(U[H])+U[H-1]})(F),F;case gt.RLE:return(function(U,j){return S2(U,j.runs,j.numRleValues)})(F,V);case gt.NONE:return F;default:throw new Error(`The specified Logical level technique is not supported: ${V.logicalLevelTechnique1}`)}})(O,I)})(r,n,c);return new x_(s,A,d)}let w=D2(r,n,c,b);return new R2(s,w,d)}case li.SEQUENCE:{let w=z2(r,n,c);return new I2(s,w[0],w[1],c.numRleValues)}case li.CONST:{let w=P2(r,n,c);return new j2(s,w,d,!1)}}throw new Error("Vector type not supported for id column.")}class oE{constructor(e,n){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case rn.POINT:case rn.MULTIPOINT:this.type=1;break;case rn.LINESTRING:case rn.MULTILINESTRING:this.type=2;break;case rn.POLYGON:case rn.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=n,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let n of this._featureData.geometry.coordinates){let s=[];for(let c of n)s.push(new D(c.x,c.y));e.push(s)}return e}}class sE{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new oE(this.features[e],this.extent)}}class Y2{constructor(e){this.layers={};let n=(function(s,c,d=!0){let m=new w2(0),_=[];for(;m.get()<s.length;){let b=Gn(s,m,1)[0]>>>0,S=m.get()+b;if(S>s.length)throw new Error(`Block overruns tile: ${S} > ${s.length}`);if(Gn(s,m,1)[0]>>>0!=1){m.set(S);continue}let[w,A]=rE(s,m),E=w.featureTables[0],R=null,I=null,O=[],F=0;for(let U of E.columns){let j=U.name;if((x=U).type==="scalarType"&&x.scalarType?.type==="logicalType"&&x.scalarType.logicalType===0){let H=null;if(U.nullable){let ue=rr(s,m),he=m.get(),be=wp(s,ue.numValues,ue.byteLength,m);m.set(he+ue.byteLength),H=new Na(be,ue.numValues)}let X=rr(s,m);F=H?H.size():X.decompressedCount,R=aE(s,U,m,j,X,H??F,d)}else if(tE(U)){let H=Gn(s,m,1)[0];if(F===0){let X=m.get();F=rr(s,m).decompressedCount,m.set(X)}I=YM(s,H,m,F)}else{let H=eE(U)?Gn(s,m,1)[0]:1;if(H===0)continue;let X=JM(s,m,U,H,F);if(X)if(Array.isArray(X))for(let ue of X)O.push(ue);else O.push(X)}}let V=new BM(E.name,I,R,O,A);_.push(V),m.set(S)}var x;return _})(new Uint8Array(e));this.layers=n.reduce(((s,c)=>Object.assign(Object.assign({},s),{[c.name]:new sE(c)})),{})}}class lE{constructor(e,n){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=n,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[],n=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let s of n){let c=[];for(let d of s)c.push(new D(d[0],d[1]));e.push(c)}return e}}let Sp="_geojsonTileLayer";function cE(r,e,n=""){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);let s={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let m=0;m<r.length;m++)s.feature=r.feature(m),e.writeMessage(2,uE,s);let c=s.keys;for(let m of c)e.writeStringField(3,m);let d=s.values;for(let m of d)e.writeMessage(4,pE,m)}function uE(r,e){if(!r.feature)return;let n=r.feature;n.id!==void 0&&e.writeVarintField(1,n.id),e.writeMessage(2,hE,r),e.writeVarintField(3,n.type),e.writeMessage(4,dE,n)}function hE(r,e){for(let n in r.feature?.properties){let s=r.feature.properties[n],c=r.keycache[n];if(s==null)continue;c===void 0&&(r.keys.push(n),c=r.keys.length-1,r.keycache[n]=c),e.writeVarint(c),typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"&&(s=r.jsonPrefix+JSON.stringify(s));let d=typeof s+":"+s,m=r.valuecache[d];m===void 0&&(r.values.push(s),m=r.values.length-1,r.valuecache[d]=m),e.writeVarint(m)}}function F_(r,e){return(e<<3)+(7&r)}function W2(r){return r<<1^r>>31}function dE(r,e){let n=r.loadGeometry(),s=r.type,c=0,d=0;for(let m of n){let _=1;s===1&&(_=m.length),e.writeVarint(F_(1,_));let x=s===3?m.length-1:m.length;for(let b=0;b<x;b++){b===1&&s!==1&&e.writeVarint(F_(2,x-1));let S=m[b].x-c,w=m[b].y-d;e.writeVarint(W2(S)),e.writeVarint(W2(w)),c+=S,d+=w}r.type===3&&e.writeVarint(F_(7,1))}}function pE(r,e){let n=typeof r;n==="string"?e.writeStringField(1,r):n==="boolean"?e.writeBooleanField(7,r):n==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class K2{constructor(e,n){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ra(Ke,16,0),this.grid3D=new Ra(Ke,16,0),this.featureIndexArray=new G,this.promoteId=n}insert(e,n,s,c,d,m){let _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,c,d);let x=m?this.grid3D:this.grid;for(let b of n){let S=[1/0,1/0,-1/0,-1/0];for(let w of b)S[0]=Math.min(S[0],w.x),S[1]=Math.min(S[1],w.y),S[2]=Math.max(S[2],w.x),S[3]=Math.max(S[3],w.y);S[0]<Ke&&S[1]<Ke&&S[2]>=0&&S[3]>=0&&x.insert(_,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Sx(new e0(this.rawTileData)).layers:new Y2(this.rawTileData).layers,this.sourceLayerCoder=new v2(this.vtLayers?Object.keys(this.vtLayers).sort():[Sp])),this.vtLayers}query(e,n,s,c){this.loadVTLayers();let d=e.params,m=Ke/e.tileSize/e.scale,_=Ql(d.filter,d.globalState),x=e.queryGeometry,b=e.queryPadding*m,S=vc.fromPoints(x),w=this.grid.query(S.minX-b,S.minY-b,S.maxX+b,S.maxY+b),A=vc.fromPoints(e.cameraQueryGeometry).expandBy(b),E=this.grid3D.query(A.minX,A.minY,A.maxX,A.maxY,((O,F,V,U)=>(function(j,H,X,ue,he){for(let _e of j)if(H<=_e.x&&X<=_e.y&&ue>=_e.x&&he>=_e.y)return!0;let be=[new D(H,X),new D(H,he),new D(ue,he),new D(ue,X)];if(j.length>2){for(let _e of be)if(Uu(j,_e))return!0}for(let _e=0;_e<j.length-1;_e++)if(GS(j[_e],j[_e+1],be))return!0;return!1})(e.cameraQueryGeometry,O-b,F-b,V+b,U+b)));for(let O of E)w.push(O);w.sort(fE);let R={},I;for(let O of w){if(O===I)continue;I=O;let F=this.featureIndexArray.get(O),V=null;this.loadMatchingFeature(R,F.bucketIndex,F.sourceLayerIndex,F.featureIndex,_,d.layers,d.availableImages,n,s,c,((U,j,H)=>(V||(V=uo(U)),j.queryIntersectsFeature({queryGeometry:x,feature:U,featureState:H,geometry:V,zoom:this.z,transform:e.transform,pixelsToTileUnits:m,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return R}loadMatchingFeature(e,n,s,c,d,m,_,x,b,S,w){let A=this.bucketLayerIDs[n];if(m&&!A.some((O=>m.has(O))))return;let E=this.sourceLayerCoder.decode(s),R=this.vtLayers[E].feature(c);if(d.needGeometry){let O=ho(R,!0);if(!d.filter(new Yt(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!d.filter(new Yt(this.tileID.overscaledZ),R))return;let I=this.getId(R,E);for(let O of A){if(m&&!m.has(O))continue;let F=x[O];if(!F)continue;let V={};I&&S&&(V=S.getState(F.sourceLayer||Sp,I));let U=hi({},b[O]);U.paint=Q2(U.paint,F.paint,R,V,_),U.layout=Q2(U.layout,F.layout,R,V,_);let j=!w||w(R,F,V);if(!j)continue;let H=new b2(R,this.z,this.x,this.y,I);H.layer=U;let X=e[O];X===void 0&&(X=e[O]=[]),X.push({featureIndex:c,feature:H,intersectionZ:j})}}lookupSymbolFeatures(e,n,s,c,d,m,_,x){let b={};this.loadVTLayers();let S=Ql(d.filterSpec,d.globalState);for(let w of e)this.loadMatchingFeature(b,s,c,w,S,m,_,x,n);return b}hasLayer(e){for(let n of this.bucketLayerIDs)for(let s of n)if(e===s)return!0;return!1}getId(e,n){var s;let c=e.id;return this.promoteId&&(c=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(c=Number(e.properties.cluster_id))),c}}function Q2(r,e,n,s,c){return Sn(r,((d,m)=>{let _=e instanceof uc?e.get(m):null;return _?.evaluate?_.evaluate(n,s,c):_}))}function fE(r,e){return e-r}function J2(r,e,n,s,c){let d=[];for(let m of r){let _;for(let x=0;x<m.length-1;x++){let b=m[x],S=m[x+1];b.x<e&&S.x<e||(b.x<e?b=new D(e,b.y+(e-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x<e&&(S=new D(e,b.y+(e-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y<n&&S.y<n||(b.y<n?b=new D(b.x+(n-b.y)/(S.y-b.y)*(S.x-b.x),n)._round():S.y<n&&(S=new D(b.x+(n-b.y)/(S.y-b.y)*(S.x-b.x),n)._round()),b.x>=s&&S.x>=s||(b.x>=s?b=new D(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x>=s&&(S=new D(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y>=c&&S.y>=c||(b.y>=c?b=new D(b.x+(c-b.y)/(S.y-b.y)*(S.x-b.x),c)._round():S.y>=c&&(S=new D(b.x+(c-b.y)/(S.y-b.y)*(S.x-b.x),c)._round()),_&&b.equals(_[_.length-1])||(_=[b],d.push(_)),_.push(S)))))}}return d}function ew(r,e,n,s,c){switch(e){case 1:return(function(d,m,_,x){let b=[];for(let S of d)for(let w of S){let A=x===0?w.x:w.y;A>=m&&A<=_&&b.push([w])}return b})(r,n,s,c);case 2:return tw(r,n,s,c,!1);case 3:return tw(r,n,s,c,!0)}return[]}function mE(r,e,n,s,c){let d=s===0?gE:_E,m=[],_=[];for(let S=0;S<r.length-1;S++){let w=r[S],A=r[S+1],E=s===0?w.x:w.y,R=s===0?A.x:A.y,I=!1;E<e?R>e&&m.push(d(w,A,e)):E>n?R<n&&m.push(d(w,A,n)):m.push(w),R<e&&E>=e&&(m.push(d(w,A,e)),I=!0),R>n&&E<=n&&(m.push(d(w,A,n)),I=!0),!c&&I&&(_.push(m),m=[])}let x=r.length-1,b=s===0?r[x].x:r[x].y;return b>=e&&b<=n&&m.push(r[x]),c&&m.length>0&&!m[0].equals(m[m.length-1])&&m.push(new D(m[0].x,m[0].y)),m.length>0&&_.push(m),_}function tw(r,e,n,s,c){let d=[];for(let m of r){let _=mE(m,e,n,s,c);_.length>0&&d.push(..._)}return d}function gE(r,e,n){return new D(n,r.y+(n-r.x)/(e.x-r.x)*(e.y-r.y))}function _E(r,e,n){return new D(r.x+(n-r.y)/(e.y-r.y)*(e.x-r.x),n)}Xe("FeatureIndex",K2,{omit:["rawTileData","sourceLayerCoder"]});class il extends D{constructor(e,n,s,c){super(e,n),this.angle=s,c!==void 0&&(this.segment=c)}clone(){return new il(this.x,this.y,this.angle,this.segment)}}function iw(r,e,n,s,c){if(e.segment===void 0||n===0)return!0;let d=e,m=e.segment+1,_=0;for(;_>-n/2;){if(m--,m<0)return!1;_-=r[m].dist(d),d=r[m]}_+=r[m].dist(r[m+1]),m++;let x=[],b=0;for(;_<n/2;){let S=r[m],w=r[m+1];if(!w)return!1;let A=r[m-1].angleTo(S)-S.angleTo(w);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),x.push({distance:_,angleDelta:A}),b+=A;_-x[0].distance>s;)b-=x.shift().angleDelta;if(b>c)return!1;m++,_+=S.dist(w)}return!0}function nw(r){let e=0;for(let n=0;n<r.length-1;n++)e+=r[n].dist(r[n+1]);return e}function rw(r,e,n){return r?.6*e*n:0}function aw(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function yE(r,e,n,s,c,d){let m=rw(n,c,d),_=aw(n,s)*d,x=0,b=nw(r)/2;for(let S=0;S<r.length-1;S++){let w=r[S],A=r[S+1],E=w.dist(A);if(x+E>b){let R=(b-x)/E,I=cr.number(w.x,A.x,R),O=cr.number(w.y,A.y,R),F=new il(I,O,A.angleTo(w),S);return F._round(),!m||iw(r,F,_,m,e)?F:void 0}x+=E}}function vE(r,e,n,s,c,d,m,_,x){let b=rw(s,d,m),S=aw(s,c),w=S*m,A=r[0].x===0||r[0].x===x||r[0].y===0||r[0].y===x;return e-w<e/4&&(e=w+e/4),ow(r,A?e/2*_%e:(S/2+2*d)*m*_%e,e,b,n,w,A,!1,x)}function ow(r,e,n,s,c,d,m,_,x){let b=d/2,S=nw(r),w=0,A=e-n,E=[];for(let R=0;R<r.length-1;R++){let I=r[R],O=r[R+1],F=I.dist(O),V=O.angleTo(I);for(;A+n<w+F;){A+=n;let U=(A-w)/F,j=cr.number(I.x,O.x,U),H=cr.number(I.y,O.y,U);if(j>=0&&j<x&&H>=0&&H<x&&A-b>=0&&A+b<=S){let X=new il(j,H,V,R);X._round(),s&&!iw(r,X,d,s,c)||E.push(X)}}w+=F}return _||E.length||m||(E=ow(r,w/2,n,s,c,d,m,!0,x)),E}function sw(r,e,n,s){let c=[],d=r.image,m=d.pixelRatio,_=d.paddedRect.w-2,x=d.paddedRect.h-2,b={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom},S=d.stretchX||[[0,_]],w=d.stretchY||[[0,x]],A=(ye,Le)=>ye+Le[1]-Le[0],E=S.reduce(A,0),R=w.reduce(A,0),I=_-E,O=x-R,F=0,V=E,U=0,j=R,H=0,X=I,ue=0,he=O;if(d.content&&s){let ye=d.content,Le=ye[2]-ye[0],Ze=ye[3]-ye[1];(d.textFitWidth||d.textFitHeight)&&(b=n2(r)),F=s0(S,0,ye[0]),U=s0(w,0,ye[1]),V=s0(S,ye[0],ye[2]),j=s0(w,ye[1],ye[3]),H=ye[0]-F,ue=ye[1]-U,X=Le-V,he=Ze-j}let be=b.x1,_e=b.y1,Me=b.x2-be,Ee=b.y2-_e,we=(ye,Le,Ze,Ve)=>{let Oe=l0(ye.stretch-F,V,Me,be),at=c0(ye.fixed-H,X,ye.stretch,E),wt=l0(Le.stretch-U,j,Ee,_e),Ct=c0(Le.fixed-ue,he,Le.stretch,R),Ft=l0(Ze.stretch-F,V,Me,be),Rn=c0(Ze.fixed-H,X,Ze.stretch,E),xi=l0(Ve.stretch-U,j,Ee,_e),$i=c0(Ve.fixed-ue,he,Ve.stretch,R),an=new D(Oe,wt),ci=new D(Ft,wt),bn=new D(Ft,xi),Zn=new D(Oe,xi),Hn=new D(at/m,Ct/m),fr=new D(Rn/m,$i/m),In=e*Math.PI/180;if(In){let on=Math.sin(In),_i=Math.cos(In),ji=[_i,-on,on,_i];an._matMult(ji),ci._matMult(ji),Zn._matMult(ji),bn._matMult(ji)}let mr=ye.stretch+ye.fixed,ga=Le.stretch+Le.fixed;return{tl:an,tr:ci,bl:Zn,br:bn,tex:{x:d.paddedRect.x+1+mr,y:d.paddedRect.y+1+ga,w:Ze.stretch+Ze.fixed-mr,h:Ve.stretch+Ve.fixed-ga},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Hn,pixelOffsetBR:fr,minFontScaleX:X/m/Me,minFontScaleY:he/m/Ee,isSDF:n}};if(s&&(d.stretchX||d.stretchY)){let ye=lw(S,I,E),Le=lw(w,O,R);for(let Ze=0;Ze<ye.length-1;Ze++){let Ve=ye[Ze],Oe=ye[Ze+1];for(let at=0;at<Le.length-1;at++)c.push(we(Ve,Le[at],Oe,Le[at+1]))}}else c.push(we({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:x+1}));return c}function s0(r,e,n){let s=0;for(let c of r)s+=Math.max(e,Math.min(n,c[1]))-Math.max(e,Math.min(n,c[0]));return s}function lw(r,e,n){let s=[{fixed:-1,stretch:0}];for(let[c,d]of r){let m=s[s.length-1];s.push({fixed:c-m.stretch,stretch:m.stretch}),s.push({fixed:c-m.stretch,stretch:m.stretch+(d-c)})}return s.push({fixed:e+1,stretch:n}),s}function l0(r,e,n,s){return r/e*n+s}function c0(r,e,n,s){return r-e*n/s}Xe("Anchor",il);class u0{constructor(e,n,s,c,d,m,_,x,b,S){var w;if(this.boxStartIndex=e.length,b){let A=m.top,E=m.bottom,R=m.collisionPadding;R&&(A-=R[1],E+=R[3]);let I=E-A;I>0&&(I=Math.max(10,I),this.circleDiameter=I)}else{let A=!((w=m.image)===null||w===void 0)&&w.content&&(m.image.textFitWidth||m.image.textFitHeight)?n2(m):{x1:m.left,y1:m.top,x2:m.right,y2:m.bottom};A.y1=A.y1*_-x[0],A.y2=A.y2*_+x[2],A.x1=A.x1*_-x[3],A.x2=A.x2*_+x[1];let E=m.collisionPadding;if(E&&(A.x1-=E[0]*_,A.y1-=E[1]*_,A.x2+=E[2]*_,A.y2+=E[3]*_),S){let R=new D(A.x1,A.y1),I=new D(A.x2,A.y1),O=new D(A.x1,A.y2),F=new D(A.x2,A.y2),V=S*Math.PI/180;R._rotate(V),I._rotate(V),O._rotate(V),F._rotate(V),A.x1=Math.min(R.x,I.x,O.x,F.x),A.x2=Math.max(R.x,I.x,O.x,F.x),A.y1=Math.min(R.y,I.y,O.y,F.y),A.y2=Math.max(R.y,I.y,O.y,F.y)}e.emplaceBack(n.x,n.y,A.x1,A.y1,A.x2,A.y2,s,c,d)}this.boxEndIndex=e.length}}class bE{constructor(e=[],n=(s,c)=>s<c?-1:s>c?1:0){if(this.data=e,this.length=this.data.length,this.compare=n,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;let e=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:n,compare:s}=this,c=n[e];for(;e>0;){let d=e-1>>1,m=n[d];if(s(c,m)>=0)break;n[e]=m,e=d}n[e]=c}_down(e){let{data:n,compare:s}=this,c=this.length>>1,d=n[e];for(;e<c;){let m=1+(e<<1),_=m+1;if(_<this.length&&s(n[_],n[m])<0&&(m=_),s(n[m],d)>=0)break;n[e]=n[m],e=m}n[e]=d}}function xE(r,e=1){let n=vc.fromPoints(r[0]),s=Math.min(n.width(),n.height()),c=s/2,d=new bE([],wE),{minX:m,minY:_,maxX:x,maxY:b}=n;if(s===0)return new D(m,_);for(let A=m;A<x;A+=s)for(let E=_;E<b;E+=s)d.push(new oh(A+c,E+c,c,r));let S=(function(A){let E=0,R=0,I=0,O=A[0];for(let F=0,V=O.length,U=V-1;F<V;U=F++){let j=O[F],H=O[U],X=j.x*H.y-H.x*j.y;R+=(j.x+H.x)*X,I+=(j.y+H.y)*X,E+=3*X}return new oh(R/E,I/E,0,A)})(r),w=S;for(;d.length;){let A=d.pop();(A.d>w.d||!w.d)&&(w=A),A.max-w.d<=e||(c=A.h/2,d.push(new oh(A.p.x-c,A.p.y-c,c,r)),d.push(new oh(A.p.x+c,A.p.y-c,c,r)),d.push(new oh(A.p.x-c,A.p.y+c,c,r)),d.push(new oh(A.p.x+c,A.p.y+c,c,r)))}return S.d>0&&w.d-S.d<=e?S.p:w.p}function wE(r,e){return e.max-r.max}class oh{constructor(e,n,s,c){this.p=new D(e,n),this.h=s,this.d=(function(d,m){let _=!1,x=1/0;for(let b of m)for(let S=0,w=b.length,A=w-1;S<w;A=S++){let E=b[S],R=b[A];E.y>d.y!=R.y>d.y&&d.x<(R.x-E.x)*(d.y-E.y)/(R.y-E.y)+E.x&&(_=!_),x=Math.min(x,Jb(d,E,R))}return(_?1:-1)*Math.sqrt(x)})(this.p,c),this.max=this.d+this.h*Math.SQRT2}}var Pn;y.aM=void 0,(Pn=y.aM||(y.aM={}))[Pn.center=1]="center",Pn[Pn.left=2]="left",Pn[Pn.right=3]="right",Pn[Pn.top=4]="top",Pn[Pn.bottom=5]="bottom",Pn[Pn["top-left"]=6]="top-left",Pn[Pn["top-right"]=7]="top-right",Pn[Pn["bottom-left"]=8]="bottom-left",Pn[Pn["bottom-right"]=9]="bottom-right";let N_=Number.POSITIVE_INFINITY;function cw(r,e){return e[1]!==N_?(function(n,s,c){let d=0,m=0;switch(s=Math.abs(s),c=Math.abs(c),n){case"top-right":case"top-left":case"top":m=c-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-c}switch(n){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,m]})(r,e[0],e[1]):(function(n,s){let c=0,d=0;s<0&&(s=0);let m=s/Math.SQRT2;switch(n){case"top-right":case"top-left":d=m-7;break;case"bottom-right":case"bottom-left":d=7-m;break;case"bottom":d=7-s;break;case"top":d=s-7}switch(n){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=s;break;case"right":c=-s}return[c,d]})(r,e[0])}function uw(r,e,n){var s;let c=r.layout,d=(s=c.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},n);if(d){let _=d.values,x=[];for(let b=0;b<_.length;b+=2){let S=x[b]=_[b],w=_[b+1].map((A=>A*nn));S.startsWith("top")?w[1]-=7:S.startsWith("bottom")&&(w[1]+=7),x[b+1]=w}return new Nn(x)}let m=c.get("text-variable-anchor");if(m){let _;_=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(e,{},n)*nn,N_]:c.get("text-offset").evaluate(e,{},n).map((b=>b*nn));let x=[];for(let b of m)x.push(b,cw(b,_));return new Nn(x)}return null}function U_(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 TE(r,e,n,s,c,d,m,_,x,b,S,w){let A=d.textMaxSize.evaluate(e,{});A===void 0&&(A=m);let E=r.layers[0].layout,R=E.get("icon-offset").evaluate(e,{},S),I=dw(n.horizontal),O=m/24,F=r.tilePixelRatio*O,V=r.tilePixelRatio*A/24,U=r.tilePixelRatio*_,j=r.tilePixelRatio*E.get("symbol-spacing"),H=E.get("text-padding")*r.tilePixelRatio,X=(function(Ze,Ve,Oe,at=1){let wt=Ze.get("icon-padding").evaluate(Ve,{},Oe),Ct=wt?.values;return[Ct[0]*at,Ct[1]*at,Ct[2]*at,Ct[3]*at]})(E,e,S,r.tilePixelRatio),ue=E.get("text-max-angle")/180*Math.PI,he=E.get("text-rotation-alignment")!=="viewport"&&E.get("symbol-placement")!=="point",be=E.get("icon-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point",_e=E.get("symbol-placement"),Me=j/2,Ee=E.get("icon-text-fit"),we;s&&Ee!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(we=r2(s,n.vertical,Ee,E.get("icon-text-fit-padding"),R,O)),I&&(s=r2(s,I,Ee,E.get("icon-text-fit-padding"),R,O)));let ye=S?w.line.getGranularityForZoomLevel(S.z):1,Le=(Ze,Ve)=>{Ve.x<0||Ve.x>=Ke||Ve.y<0||Ve.y>=Ke||(function(Oe,at,wt,Ct,Ft,Rn,xi,$i,an,ci,bn,Zn,Hn,fr,In,mr,ga,on,_i,ji,wi,sn,es,Ua,Mp){let nl=Oe.addToLineVertexArray(at,wt),xc,sh,lh,ch,pw=0,fw=0,mw=0,gw=0,V_=-1,j_=-1,ts={},_w=tn("");if(Oe.allowVerticalPlacement&&Ct.vertical){let $n=$i.layout.get("text-rotate").evaluate(wi,{},Ua)+90;lh=new u0(an,at,ci,bn,Zn,Ct.vertical,Hn,fr,In,$n),xi&&(ch=new u0(an,at,ci,bn,Zn,xi,ga,on,In,$n))}if(Ft){let $n=$i.layout.get("icon-rotate").evaluate(wi,{}),Yr=$i.layout.get("icon-text-fit")!=="none",wc=sw(Ft,$n,es,Yr),ja=xi?sw(xi,$n,es,Yr):void 0;sh=new u0(an,at,ci,bn,Zn,Ft,ga,on,!1,$n),pw=4*wc.length;let Tc=Oe.iconSizeData,po=null;Tc.kind==="source"?(po=[Qo*$i.layout.get("icon-size").evaluate(wi,{})],po[0]>Ks&&Wt(`${Oe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Tc.kind==="composite"&&(po=[Qo*sn.compositeIconSizes[0].evaluate(wi,{},Ua),Qo*sn.compositeIconSizes[1].evaluate(wi,{},Ua)],(po[0]>Ks||po[1]>Ks)&&Wt(`${Oe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Oe.addSymbols(Oe.icon,wc,po,ji,_i,wi,y.ax.none,at,nl.lineStartIndex,nl.lineLength,-1,Ua),V_=Oe.icon.placedSymbolArray.length-1,ja&&(fw=4*ja.length,Oe.addSymbols(Oe.icon,ja,po,ji,_i,wi,y.ax.vertical,at,nl.lineStartIndex,nl.lineLength,-1,Ua),j_=Oe.icon.placedSymbolArray.length-1)}let yw=Object.keys(Ct.horizontal);for(let $n of yw){let Yr=Ct.horizontal[$n];if(!xc){_w=tn(Yr.text);let ja=$i.layout.get("text-rotate").evaluate(wi,{},Ua);xc=new u0(an,at,ci,bn,Zn,Yr,Hn,fr,In,ja)}let wc=Yr.positionedLines.length===1;if(mw+=hw(Oe,at,Yr,Rn,$i,In,wi,mr,nl,Ct.vertical?y.ax.horizontal:y.ax.horizontalOnly,wc?yw:[$n],ts,V_,sn,Ua),wc)break}Ct.vertical&&(gw+=hw(Oe,at,Ct.vertical,Rn,$i,In,wi,mr,nl,y.ax.vertical,["vertical"],ts,j_,sn,Ua));let ME=xc?xc.boxStartIndex:Oe.collisionBoxArray.length,EE=xc?xc.boxEndIndex:Oe.collisionBoxArray.length,CE=lh?lh.boxStartIndex:Oe.collisionBoxArray.length,AE=lh?lh.boxEndIndex:Oe.collisionBoxArray.length,zE=sh?sh.boxStartIndex:Oe.collisionBoxArray.length,DE=sh?sh.boxEndIndex:Oe.collisionBoxArray.length,PE=ch?ch.boxStartIndex:Oe.collisionBoxArray.length,RE=ch?ch.boxEndIndex:Oe.collisionBoxArray.length,Va=-1,h0=($n,Yr)=>$n?.circleDiameter?Math.max($n.circleDiameter,Yr):Yr;Va=h0(xc,Va),Va=h0(lh,Va),Va=h0(sh,Va),Va=h0(ch,Va);let vw=Va>-1?1:0;vw&&(Va*=Mp/nn),Oe.glyphOffsetArray.length>=Wu.MAX_GLYPHS&&Wt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wi.sortKey!==void 0&&Oe.addToSortKeyRanges(Oe.symbolInstances.length,wi.sortKey);let IE=uw($i,wi,Ua),[kE,LE]=(function($n,Yr){let wc=$n.length,ja=Yr?.values;if(ja?.length>0)for(let Tc=0;Tc<ja.length;Tc+=2){let po=ja[Tc+1];$n.emplaceBack(y.aM[ja[Tc]],po[0],po[1])}return[wc,$n.length]})(Oe.textAnchorOffsets,IE);Oe.symbolInstances.emplaceBack(at.x,at.y,ts.right>=0?ts.right:-1,ts.center>=0?ts.center:-1,ts.left>=0?ts.left:-1,ts.vertical||-1,V_,j_,_w,ME,EE,CE,AE,zE,DE,PE,RE,ci,mw,gw,pw,fw,vw,0,Hn,Va,kE,LE)})(r,Ve,Ze,n,s,c,we,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,F,[H,H,H,H],he,x,U,X,be,R,e,d,b,S,m)};if(_e==="line")for(let Ze of J2(e.geometry,0,0,Ke,Ke)){let Ve=yc(Ze,ye),Oe=vE(Ve,j,ue,n.vertical||I,s,24,V,r.overscaling,Ke);for(let at of Oe)I&&SE(r,I.text,Me,at)||Le(Ve,at)}else if(_e==="line-center"){for(let Ze of e.geometry)if(Ze.length>1){let Ve=yc(Ze,ye),Oe=yE(Ve,ue,n.vertical||I,s,24,V);Oe&&Le(Ve,Oe)}}else if(e.type==="Polygon")for(let Ze of cu(e.geometry,0)){let Ve=xE(Ze,16);Le(yc(Ze[0],ye,!0),new il(Ve.x,Ve.y,0))}else if(e.type==="LineString")for(let Ze of e.geometry){let Ve=yc(Ze,ye);Le(Ve,new il(Ve[0].x,Ve[0].y,0))}else if(e.type==="Point")for(let Ze of e.geometry)for(let Ve of Ze)Le([Ve],new il(Ve.x,Ve.y,0))}function hw(r,e,n,s,c,d,m,_,x,b,S,w,A,E,R){let I=(function(V,U,j,H,X,ue,he,be){let _e=H.layout.get("text-rotate").evaluate(ue,{})*Math.PI/180,Me=[];for(let Ee of U.positionedLines)for(let we of Ee.positionedGlyphs){if(!we.rect)continue;let ye=we.rect||{},Le=4,Ze=!0,Ve=1,Oe=0,at=(X||be)&&we.vertical,wt=we.metrics.advance*we.scale/2;if(be&&U.verticalizable&&(Oe=Ee.lineOffset/2-(we.imageName?-(nn-we.metrics.width*we.scale)/2:(we.scale-1)*nn)),we.imageName){let on=he[we.imageName];Ze=on.sdf,Ve=on.pixelRatio,Le=1/Ve}let Ct=X?[we.x+wt,we.y]:[0,0],Ft=X?[0,0]:[we.x+wt+j[0],we.y+j[1]-Oe],Rn=[0,0];at&&(Rn=Ft,Ft=[0,0]);let xi=we.metrics.isDoubleResolution?2:1,$i=(we.metrics.left-Le)*we.scale-wt+Ft[0],an=(-we.metrics.top-Le)*we.scale+Ft[1],ci=$i+ye.w/xi*we.scale/Ve,bn=an+ye.h/xi*we.scale/Ve,Zn=new D($i,an),Hn=new D(ci,an),fr=new D($i,bn),In=new D(ci,bn);if(at){let on=new D(-wt,wt- -17),_i=-Math.PI/2,ji=12-wt,wi=new D(22-ji,-(we.imageName?ji:0)),sn=new D(...Rn);Zn._rotateAround(_i,on)._add(wi)._add(sn),Hn._rotateAround(_i,on)._add(wi)._add(sn),fr._rotateAround(_i,on)._add(wi)._add(sn),In._rotateAround(_i,on)._add(wi)._add(sn)}if(_e){let on=Math.sin(_e),_i=Math.cos(_e),ji=[_i,-on,on,_i];Zn._matMult(ji),Hn._matMult(ji),fr._matMult(ji),In._matMult(ji)}let mr=new D(0,0),ga=new D(0,0);Me.push({tl:Zn,tr:Hn,bl:fr,br:In,tex:ye,writingMode:U.writingMode,glyphOffset:Ct,sectionIndex:we.sectionIndex,isSDF:Ze,pixelOffsetTL:mr,pixelOffsetBR:ga,minFontScaleX:0,minFontScaleY:0})}return Me})(0,n,_,c,d,m,s,r.allowVerticalPlacement),O=r.textSizeData,F=null;O.kind==="source"?(F=[Qo*c.layout.get("text-size").evaluate(m,{})],F[0]>Ks&&Wt(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):O.kind==="composite"&&(F=[Qo*E.compositeTextSizes[0].evaluate(m,{},R),Qo*E.compositeTextSizes[1].evaluate(m,{},R)],(F[0]>Ks||F[1]>Ks)&&Wt(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,I,F,_,d,m,b,e,x.lineStartIndex,x.lineLength,A,R);for(let V of S)w[V]=r.text.placedSymbolArray.length-1;return 4*I.length}function dw(r){for(let e in r)return r[e];return null}function SE(r,e,n,s){let c=r.compareText;if(e in c){let d=c[e];for(let m=d.length-1;m>=0;m--)if(s.dist(d[m])<n)return!0}else c[e]=[];return c[e].push(s),!1}y.$=$c,y.A=se,y.B=Cu,y.C=Am,y.D=Je,y.E=Ao,y.F=da,y.G=function([r,e,n]){return e+=90,e*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(n),y:r*Math.sin(e)*Math.sin(n),z:r*Math.cos(n)}},y.H=cr,y.I=h_,y.J=Yt,y.K=oc,y.L=function(r){if(Ri==null){let e=r.navigator?r.navigator.userAgent:null;Ri=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ri},y.M=fn,y.N=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new LM((()=>this.process())),this.subscription=Ya(this.target,"message",(n=>this.receive(n)),!1),this.globalScope=di(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((n,s)=>{let c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=e?Ya(e.signal,"abort",(()=>{d?.unsubscribe(),delete this.resolveRejects[c];let x={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(x)}),OM):null;this.resolveRejects[c]={resolve:x=>{d?.unsubscribe(),n(x)},reject:x=>{d?.unsubscribe(),s(x)}};let m=[],_=Object.assign(Object.assign({},r),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Ia(r.data,m)});this.target.postMessage(_,{transfer:m})}))}receive(r){let e=r.data,n=e.id,s=["file://","resource://android","null"],c=[e.origin,location.origin],d=e.origin===location.origin,m=c.some((_=>s.includes(_)));if((d||m)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[n];let _=this.abortControllers[n];return delete this.abortControllers[n],void(_&&_.abort())}if(di(self)||e.mustQueue)return this.tasks[n]=e,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,e)}}process(){if(this.taskQueue.length===0)return;let r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return l(this,void 0,void 0,(function*(){if(e.type==="<response>"){let c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(e.error?c.reject(st(lc(e.error))):c.resolve(lc(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let n=lc(e.data),s=new AbortController;this.abortControllers[r]=s;try{let c=yield this.messageHandlers[e.type](e.sourceMapId,n,s);this.completeTask(r,null,c)}catch(c){this.completeTask(r,st(c))}}))}completeTask(r,e,n){let s=[];delete this.abortControllers[r];let c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Ia(e):null,data:Ia(n,s)};this.target.postMessage(c,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},y.O=function(){var r=new se(16);return se!=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},y.P=D,y.Q=function(r,e,n){var s,c,d,m,_,x,b,S,w,A,E,R,I=n[0],O=n[1],F=n[2];return e===r?(r[12]=e[0]*I+e[4]*O+e[8]*F+e[12],r[13]=e[1]*I+e[5]*O+e[9]*F+e[13],r[14]=e[2]*I+e[6]*O+e[10]*F+e[14],r[15]=e[3]*I+e[7]*O+e[11]*F+e[15]):(c=e[1],d=e[2],m=e[3],_=e[4],x=e[5],b=e[6],S=e[7],w=e[8],A=e[9],E=e[10],R=e[11],r[0]=s=e[0],r[1]=c,r[2]=d,r[3]=m,r[4]=_,r[5]=x,r[6]=b,r[7]=S,r[8]=w,r[9]=A,r[10]=E,r[11]=R,r[12]=s*I+_*O+w*F+e[12],r[13]=c*I+x*O+A*F+e[13],r[14]=d*I+b*O+E*F+e[14],r[15]=m*I+S*O+R*F+e[15]),r},y.R=pr,y.S=function(r,e,n){var s=n[0],c=n[1],d=n[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]*c,r[5]=e[5]*c,r[6]=e[6]*c,r[7]=e[7]*c,r[8]=e[8]*d,r[9]=e[9]*d,r[10]=e[10]*d,r[11]=e[11]*d,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},y.T=V1,y.U=function(r,e,n){var s=e[0],c=e[1],d=e[2],m=e[3],_=e[4],x=e[5],b=e[6],S=e[7],w=e[8],A=e[9],E=e[10],R=e[11],I=e[12],O=e[13],F=e[14],V=e[15],U=n[0],j=n[1],H=n[2],X=n[3];return r[0]=U*s+j*_+H*w+X*I,r[1]=U*c+j*x+H*A+X*O,r[2]=U*d+j*b+H*E+X*F,r[3]=U*m+j*S+H*R+X*V,r[4]=(U=n[4])*s+(j=n[5])*_+(H=n[6])*w+(X=n[7])*I,r[5]=U*c+j*x+H*A+X*O,r[6]=U*d+j*b+H*E+X*F,r[7]=U*m+j*S+H*R+X*V,r[8]=(U=n[8])*s+(j=n[9])*_+(H=n[10])*w+(X=n[11])*I,r[9]=U*c+j*x+H*A+X*O,r[10]=U*d+j*b+H*E+X*F,r[11]=U*m+j*S+H*R+X*V,r[12]=(U=n[12])*s+(j=n[13])*_+(H=n[14])*w+(X=n[15])*I,r[13]=U*c+j*x+H*A+X*O,r[14]=U*d+j*b+H*E+X*F,r[15]=U*m+j*S+H*R+X*V,r},y.V=function(r,e){let n={};for(let s of e)s in r&&(n[s]=r[s]);return n},y.W=Qs,y.X=dn,y.Y=p2,y.Z=d2,y._=l,y.a=Eo,y.a$=function(r){var e=new se(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},y.a0=ke,y.a1=Ne,y.a2=Ht,y.a3=Ar,y.a4=m2,y.a5=r0,y.a6=Ke,y.a7=xp,y.a8=vc,y.a9=25,y.aA=function(r){var e=r[0],n=r[1];return Math.sqrt(e*e+n*n)},y.aB=function(r){return r[0]=0,r[1]=0,r},y.aC=function(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r},y.aD=f_,y.aE=Ye,y.aF=function(r,e,n,s){let c=e.y-r.y,d=e.x-r.x,m=s.y-n.y,_=s.x-n.x,x=m*d-_*c;if(x===0)return null;let b=(_*(r.y-n.y)-m*(r.x-n.x))/x;return new D(r.x+b*d,r.y+b*c)},y.aG=J2,y.aH=Nu,y.aI=function(r){let e=1/0,n=1/0,s=-1/0,c=-1/0;for(let d of r)e=Math.min(e,d.x),n=Math.min(n,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);return[e,n,s,c]},y.aJ=nn,y.aK=yt,y.aL=function(r,e,n,s,c=!1){if(!n[0]&&!n[1])return[0,0];let d=c?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(d){let m=Math.sin(d),_=Math.cos(d);n=[n[0]*_-n[1]*m,n[0]*m+n[1]*_]}return[c?n[0]:yt(e,n[0],r.zoom),c?n[1]:yt(e,n[1],r.zoom)]},y.aN=p_,y.aO=U_,y.aP=d_,y.aQ=r=>r.type==="symbol",y.aR=Xm,y.aS=Kt,y.aT=$m,y.aU=$,y.aV=$e,y.aW=De,y.aX=Ur,y.aY=g2,y.aZ=Y,y.a_=Z,y.aa=v_,y.ab=r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise((n=>{e.onloadstart=()=>{n(e)};for(let s of r){let c=window.document.createElement("source");Et(s)||(e.crossOrigin="Anonymous"),c.src=s,e.appendChild(c)}}))},y.ac=Ue,y.ad=function(){return Fr++},y.ae=p,y.af=Wu,y.ag=Sp,y.ah=Ql,y.ai=ho,y.aj=b2,y.ak=function(r){let e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((n,s,c,d)=>{let m=c||d;return e[s]=!m||m.toLowerCase(),""})),e["max-age"]){let n=parseInt(e["max-age"],10);isNaN(n)?delete e["max-age"]:e["max-age"]=n}return e},y.al=ri,y.am=85.051129,y.an=Tr,y.ao=function(r){return Math.pow(2,r)},y.ap=pe,y.aq=f2,y.ar=function(r){return Math.log(r)/Math.LN2},y.as=function(r){var e=r[0],n=r[1];return e*e+n*n},y.at=function(r){if(!r.length)return new Set;let e=Math.max(...r.map((x=>x.canonical.z))),n=1/0,s=-1/0,c=1/0,d=-1/0,m=[];for(let x of r){let{x:b,y:S,z:w}=x.canonical,A=Math.pow(2,e-w),E=b*A,R=S*A;m.push({id:x,x:E,y:R}),E<n&&(n=E),E>s&&(s=E),R<c&&(c=R),R>d&&(d=R)}let _=new Set;for(let x of m)x.x!==n&&x.x!==s&&x.y!==c&&x.y!==d||_.add(x.id);return _},y.au=function(r,e){let n=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-n||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},y.av=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(let r in this.data)for(let e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,n){let s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);let c={value:e,timeout:void 0};if(n!==void 0&&(c.timeout=setTimeout((()=>{this.remove(r,c)}),n)),this.data[s].push(c),this.order.push(s),this.order.length>this.max){let d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){let e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){let e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;let n=r.wrapped().key,s=e===void 0?0:this.data[n].indexOf(e),c=this.data[n][s];return this.data[n].splice(s,1),c.timeout&&clearTimeout(c.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(c.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){let e=[];for(let n in this.data)for(let s of this.data[n])r(s.value)||e.push(s);for(let n of e)this.remove(n.value.tileID,n)}},y.aw=function(r,e){let n=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:c,minZoom:d,maxZoom:m}=r,_=c?ri(ki.interpolationFactor(c,e,d,m),0,1):0;r.kind==="camera"?s=cr.number(r.minSize,r.maxSize,_):n=_}return{uSizeT:n,uSize:s}},y.ay=function(r,{uSize:e,uSizeT:n},{lowerSize:s,upperSize:c}){return r.kind==="source"?s/Qo:r.kind==="composite"?cr.number(s/Qo,c/Qo,n):e},y.az=Ge,y.b=pn,y.b$=Ou,y.b0=function(r,e,n){return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],r},y.b1=function(r,e){var n=e[0],s=e[1],c=e[2],d=n*n+s*s+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=e[0]*d,r[1]=e[1]*d,r[2]=e[2]*d,r},y.b2=ne,y.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},y.b4=function(r,e,n){return r[0]=e[0]*n[0],r[1]=e[1]*n[1],r[2]=e[2]*n[2],r[3]=e[3]*n[3],r},y.b5=Be,y.b6=function(r,e,n){let s=e[0]*n[0]+e[1]*n[1]+e[2]*n[2];return s===0?null:(-(r[0]*n[0]+r[1]*n[1]+r[2]*n[2])-n[3])/s},y.b7=Fe,y.b8=function(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r},y.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},y.bA=Ie,y.bB=function(r,e,n){var s=n[0],c=n[1],d=n[2],m=n[3],_=e[0],x=e[1],b=e[2],S=c*b-d*x,w=d*_-s*b,A=s*x-c*_;return r[0]=_+m*(S+=S)+c*(A+=A)-d*(w+=w),r[1]=x+m*w+d*S-s*A,r[2]=b+m*A+s*w-c*S,r},y.bC=function(r,e,n){let s=(c=[r[0],r[1],r[2],e[0],e[1],e[2],n[0],n[1],n[2]])[0]*((S=c[8])*(m=c[4])-(_=c[5])*(b=c[7]))+c[1]*(-S*(d=c[3])+_*(x=c[6]))+c[2]*(b*d-m*x);var c,d,m,_,x,b,S;if(s===0)return null;let w=ne([],[e[0],e[1],e[2]],[n[0],n[1],n[2]]),A=ne([],[n[0],n[1],n[2]],[r[0],r[1],r[2]]),E=ne([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),R=Y([],w,-r[3]);return Z(R,R,Y([],A,-e[3])),Z(R,R,Y([],E,-n[3])),Y(R,R,1/s),R},y.bD=y_,y.bE=function(){return new Float64Array(4)},y.bF=function(r,e,n,s){var c=[],d=[];return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],d[0]=c[0]*Math.cos(s)-c[1]*Math.sin(s),d[1]=c[0]*Math.sin(s)+c[1]*Math.cos(s),d[2]=c[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},y.bG=function(r,e,n,s){var c=[],d=[];return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],d[0]=c[0],d[1]=c[1]*Math.cos(s)-c[2]*Math.sin(s),d[2]=c[1]*Math.sin(s)+c[2]*Math.cos(s),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},y.bH=function(r,e,n,s){var c=[],d=[];return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],d[0]=c[2]*Math.sin(s)+c[0]*Math.cos(s),d[1]=c[1],d[2]=c[2]*Math.cos(s)-c[0]*Math.sin(s),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},y.bI=function(r,e,n){var s=Math.sin(n),c=Math.cos(n),d=e[0],m=e[1],_=e[2],x=e[3],b=e[8],S=e[9],w=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]=d*c-b*s,r[1]=m*c-S*s,r[2]=_*c-w*s,r[3]=x*c-A*s,r[8]=d*s+b*c,r[9]=m*s+S*c,r[10]=_*s+w*c,r[11]=x*s+A*c,r},y.bJ=function(r,e){let n=Nt(r,360),s=Nt(e,360),c=s-n,d=s>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},y.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},y.bL=function(r,e,n,s){let c=Math.sqrt(r*r+e*e),d=Math.sqrt(n*n+s*s);r/=c,e/=c,n/=d,s/=d;let m=Math.acos(r*n+e*s);return-e*n+r*s>0?m:-m},y.bM=function(r,e){let n=Nt(r,2*Math.PI),s=Nt(e,2*Math.PI);return Math.min(Math.abs(n-s),Math.abs(n-s+2*Math.PI),Math.abs(n-s-2*Math.PI))},y.bN=function(){let r={},e=Ce.$version;for(let n in Ce.$root){let s=Ce.$root[n];if(s.required){let c=null;c=n==="version"?e:s.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},y.bO=Ni,y.bP=qd,y.bQ=function r(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],n[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&n!==null){if(typeof n!="object"||Object.keys(e).length!==Object.keys(n).length)return!1;for(let s in e)if(!r(e[s],n[s]))return!1;return!0}return e===n},y.bR=Co,y.bS=function(r){r=r.slice();let e=Object.create(null);for(let n=0;n<r.length;n++)e[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=sd(r[n],e[r[n].ref]));return r},y.bT=function(r,e){if(r.type==="custom")return new kM(r,e);switch(r.type){case"background":return new IM(r,e);case"circle":return new KS(r,e);case"color-relief":return new n6(r,e);case"fill":return new y6(r,e);case"fill-extrusion":return new D6(r,e);case"heatmap":return new JS(r,e);case"hillshade":return new t6(r,e);case"line":return new iM(r,e);case"raster":return new I1(r,e);case"symbol":return new n0(r,e)}},y.bU=r=>r.type==="raster",y.bV=tt,y.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let n=[];try{if(!Ot(r.version,e.version))return[{command:"setStyle",args:[e]}];Ot(r.center,e.center)||n.push({command:"setCenter",args:[e.center]}),Ot(r.state,e.state)||n.push({command:"setGlobalState",args:[e.state]}),Ot(r.centerAltitude,e.centerAltitude)||n.push({command:"setCenterAltitude",args:[e.centerAltitude]}),Ot(r.zoom,e.zoom)||n.push({command:"setZoom",args:[e.zoom]}),Ot(r.bearing,e.bearing)||n.push({command:"setBearing",args:[e.bearing]}),Ot(r.pitch,e.pitch)||n.push({command:"setPitch",args:[e.pitch]}),Ot(r.roll,e.roll)||n.push({command:"setRoll",args:[e.roll]}),Ot(r.sprite,e.sprite)||n.push({command:"setSprite",args:[e.sprite]}),Ot(r.glyphs,e.glyphs)||n.push({command:"setGlyphs",args:[e.glyphs]}),Ot(r.transition,e.transition)||n.push({command:"setTransition",args:[e.transition]}),Ot(r.light,e.light)||n.push({command:"setLight",args:[e.light]}),Ot(r.terrain,e.terrain)||n.push({command:"setTerrain",args:[e.terrain]}),Ot(r.sky,e.sky)||n.push({command:"setSky",args:[e.sky]}),Ot(r.projection,e.projection)||n.push({command:"setProjection",args:[e.projection]});let s={},c=[];(function(m,_,x,b){let S;for(S in _=_||{},m=m||{})Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(_,S)||Bf(S,x,b));for(S in _)Object.prototype.hasOwnProperty.call(_,S)&&(Object.prototype.hasOwnProperty.call(m,S)?Ot(m[S],_[S])||(m[S].type==="geojson"&&_[S].type==="geojson"&&s1(m,_,S)?Jn(x,{command:"setGeoJSONSourceData",args:[S,_[S].data]}):Ff(S,_,x,b)):zo(S,_,x))})(r.sources,e.sources,c,s);let d=[];r.layers&&r.layers.forEach((m=>{"source"in m&&s[m.source]?n.push({command:"removeLayer",args:[m.id]}):d.push(m)})),n=n.concat(c),(function(m,_,x){_=_||[];let b=(m=m||[]).map(ld),S=_.map(ld),w=m.reduce(Nf,{}),A=_.reduce(Nf,{}),E=b.slice(),R=Object.create(null),I,O,F,V,U;for(let j=0,H=0;j<b.length;j++)I=b[j],Object.prototype.hasOwnProperty.call(A,I)?H++:(Jn(x,{command:"removeLayer",args:[I]}),E.splice(E.indexOf(I,H),1));for(let j=0,H=0;j<S.length;j++)I=S[S.length-1-j],E[E.length-1-j]!==I&&(Object.prototype.hasOwnProperty.call(w,I)?(Jn(x,{command:"removeLayer",args:[I]}),E.splice(E.lastIndexOf(I,E.length-H),1)):H++,V=E[E.length-j],Jn(x,{command:"addLayer",args:[A[I],V]}),E.splice(E.length-j,0,I),R[I]=!0);for(let j=0;j<S.length;j++)if(I=S[j],O=w[I],F=A[I],!R[I]&&!Ot(O,F))if(Ot(O.source,F.source)&&Ot(O["source-layer"],F["source-layer"])&&Ot(O.type,F.type)){for(U in Xc(O.layout,F.layout,x,I,null,"setLayoutProperty"),Xc(O.paint,F.paint,x,I,null,"setPaintProperty"),Ot(O.filter,F.filter)||Jn(x,{command:"setFilter",args:[I,F.filter]}),Ot(O.minzoom,F.minzoom)&&Ot(O.maxzoom,F.maxzoom)||Jn(x,{command:"setLayerZoomRange",args:[I,F.minzoom,F.maxzoom]}),O)Object.prototype.hasOwnProperty.call(O,U)&&U!=="layout"&&U!=="paint"&&U!=="filter"&&U!=="metadata"&&U!=="minzoom"&&U!=="maxzoom"&&(U.indexOf("paint.")===0?Xc(O[U],F[U],x,I,U.slice(6),"setPaintProperty"):Ot(O[U],F[U])||Jn(x,{command:"setLayerProperty",args:[I,U,F[U]]}));for(U in F)Object.prototype.hasOwnProperty.call(F,U)&&!Object.prototype.hasOwnProperty.call(O,U)&&U!=="layout"&&U!=="paint"&&U!=="filter"&&U!=="metadata"&&U!=="minzoom"&&U!=="maxzoom"&&(U.indexOf("paint.")===0?Xc(O[U],F[U],x,I,U.slice(6),"setPaintProperty"):Ot(O[U],F[U])||Jn(x,{command:"setLayerProperty",args:[I,U,F[U]]}))}else Jn(x,{command:"removeLayer",args:[I]}),V=E[E.lastIndexOf(I)+1],Jn(x,{command:"addLayer",args:[F,V]})})(d,e.layers,n)}catch(s){console.warn("Unable to compute style diff:",s),n=[{command:"setStyle",args:[e]}]}return n},y.bX=function(r){let e=[],n=r.id;return n===void 0&&e.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),e},y.bY=Sn,y.bZ=Nr,y.b_=class extends zn{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},y.ba=y2,y.bb=Ku,y.bc=function(r,e,n,s,c){var d=1/Math.tan(e/2);if(r[0]=d/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0){var m=1/(s-c);r[10]=(c+s)*m,r[14]=2*c*s*m}else r[10]=-1,r[14]=-2*s;return r},y.bd=function(r){var e=new se(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},y.be=function(r,e,n){var s=Math.sin(n),c=Math.cos(n),d=e[0],m=e[1],_=e[2],x=e[3],b=e[4],S=e[5],w=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]=d*c+b*s,r[1]=m*c+S*s,r[2]=_*c+w*s,r[3]=x*c+A*s,r[4]=b*c-d*s,r[5]=S*c-m*s,r[6]=w*c-_*s,r[7]=A*c-x*s,r},y.bf=function(r,e,n){var s=Math.sin(n),c=Math.cos(n),d=e[4],m=e[5],_=e[6],x=e[7],b=e[8],S=e[9],w=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]=d*c+b*s,r[5]=m*c+S*s,r[6]=_*c+w*s,r[7]=x*c+A*s,r[8]=b*c-d*s,r[9]=S*c-m*s,r[10]=w*c-_*s,r[11]=A*c-x*s,r},y.bg=function(r,e){var n=e[0],s=e[1],c=e[2],d=e[3],m=e[4],_=e[5],x=e[6],b=e[7],S=e[8],w=e[9],A=e[10],E=e[11],R=e[12],I=e[13],O=e[14],F=e[15],V=n*_-s*m,U=n*x-c*m,j=n*b-d*m,H=s*x-c*_,X=s*b-d*_,ue=c*b-d*x,he=S*I-w*R,be=S*O-A*R,_e=S*F-E*R,Me=w*O-A*I,Ee=w*F-E*I,we=A*F-E*O,ye=V*we-U*Ee+j*Me+H*_e-X*be+ue*he;return ye?(r[0]=(_*we-x*Ee+b*Me)*(ye=1/ye),r[1]=(c*Ee-s*we-d*Me)*ye,r[2]=(I*ue-O*X+F*H)*ye,r[3]=(A*X-w*ue-E*H)*ye,r[4]=(x*_e-m*we-b*be)*ye,r[5]=(n*we-c*_e+d*be)*ye,r[6]=(O*j-R*ue-F*U)*ye,r[7]=(S*ue-A*j+E*U)*ye,r[8]=(m*Ee-_*_e+b*he)*ye,r[9]=(s*_e-n*Ee-d*he)*ye,r[10]=(R*X-I*j+F*V)*ye,r[11]=(w*j-S*X-E*V)*ye,r[12]=(_*be-m*Me-x*he)*ye,r[13]=(n*Me-s*be+c*he)*ye,r[14]=(I*U-R*H-O*V)*ye,r[15]=(S*H-w*U+A*V)*ye,r):null},y.bh=function(){let r=new Float32Array(16);return pe(r),r},y.bi=function(){let r=new Float64Array(16);return pe(r),r},y.bj=function(){return new Float64Array(16)},y.bk=function(r,e,n){let s=new Float64Array(4);return Ie(s,r,e-90,n),s},y.bl=function(r,e,n,s){var c,d,m,_,x,b=e[0],S=e[1],w=e[2],A=e[3],E=n[0],R=n[1],I=n[2],O=n[3];return(d=b*E+S*R+w*I+A*O)<0&&(d=-d,E=-E,R=-R,I=-I,O=-O),1-d>ve?(c=Math.acos(d),m=Math.sin(c),_=Math.sin((1-s)*c)/m,x=Math.sin(s*c)/m):(_=1-s,x=s),r[0]=_*b+x*E,r[1]=_*S+x*R,r[2]=_*w+x*I,r[3]=_*A+x*O,r},y.bm=function(r){let e=new Float64Array(9);var n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U;w=(c=(s=r)[0])*(x=c+c),A=(d=s[1])*x,R=(m=s[2])*x,I=m*(b=d+d),F=(_=s[3])*x,V=_*b,U=_*(S=m+m),(n=e)[0]=1-(E=d*b)-(O=m*S),n[3]=A-U,n[6]=R+V,n[1]=A+U,n[4]=1-w-O,n[7]=I-F,n[2]=R-V,n[5]=I+F,n[8]=1-w-E;let j=Ur(-Math.asin(ri(e[2],-1,1))),H,X;return Math.hypot(e[5],e[8])<.001?(H=0,X=-Ur(Math.atan2(e[3],e[4]))):(H=Ur(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),X=Ur(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:H,pitch:j+90,bearing:X}},y.bn=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},y.bo=dt,y.bp=Oa,y.bq=Gu,y.br=pp,y.bs=qu,y.bt=Zt,y.bu=Ut,y.bv=Un,y.bw=function(r,e,n,s,c){return Zt(s,c,ri((r-e)/(n-e),0,1))},y.bx=function(r,e,n,s){return r[0]=e[0]+n[0]*s,r[1]=e[1]+n[1]*s,r[2]=e[2]+n[2]*s,r},y.by=Nt,y.bz=function(){return new Float64Array(3)},y.c=Vr,y.c$=Kl,y.c0=class extends zn{constructor(r,e){super(r,e),this.current=fa}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},y.c1=lo,y.c2=class extends zn{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},y.c3=class extends zn{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},y.c4=le,y.c5=function(r,e){var n=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=n,r[2]=0,r[3]=-n,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},y.c6=function(r,e,n){var s=e[0],c=e[1],d=e[2];return r[0]=s*n[0]+c*n[3]+d*n[6],r[1]=s*n[1]+c*n[4]+d*n[7],r[2]=s*n[2]+c*n[5]+d*n[8],r},y.c7=function(r,e,n,s,c,d,m){var _=1/(e-n),x=1/(s-c),b=1/(d-m);return r[0]=-2*_,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*b,r[11]=0,r[12]=(e+n)*_,r[13]=(c+s)*x,r[14]=(m+d)*b,r[15]=1,r},y.c8=class extends zn{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;let e=new Float32Array(4*r.length);for(let n=0;n<r.length;n++)e[4*n]=r[n].r,e[4*n+1]=r[n].g,e[4*n+2]=r[n].b,e[4*n+3]=r[n].a;this.gl.uniform4fv(this.location,e)}}},y.c9=class extends zn{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;let e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},y.cA=function(r,e){return Il[e]&&"touches"in r},y.cB=function(r){return Il[r]||kl[r]},y.cC=function(r,e,n){var s=e[0],c=e[1];return r[0]=n[0]*s+n[4]*c+n[12],r[1]=n[1]*s+n[5]*c+n[13],r},y.cD=function(r,e){let{x:n,y:s}=xp.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||n<0||n>=1)},y.cE=function(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},y.cF=class extends zu{},y.cG=Lt,y.cH=function(r,e){Vr.REGISTERED_PROTOCOLS[r]=e},y.cI=function(r){delete Vr.REGISTERED_PROTOCOLS[r]},y.cJ=function(r,e){let n={};for(let c=0;c<r.length;c++){let d=e&&e[r[c].id]||E1(r[c]);e&&(e[r[c].id]=d);let m=n[d];m||(m=n[d]=[]),m.push(r[c])}let s=[];for(let c in n)s.push(n[c]);return s},y.cK=Xe,y.cL=v2,y.cM=K2,y.cN=t2,y.cO=function(r){var e,n;r.bucket.createArrays(),r.bucket.tilePixelRatio=Ke/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;let s=r.bucket.layers[0],c=s.layout,d=s._unevaluatedLayout._values,m={layoutIconSize:d["icon-size"].possiblyEvaluate(new Yt(r.bucket.zoom+1),r.canonical),layoutTextSize:d["text-size"].possiblyEvaluate(new Yt(r.bucket.zoom+1),r.canonical),textMaxSize:d["text-size"].possiblyEvaluate(new Yt(18))};if(r.bucket.textSizeData.kind==="composite"){let{minZoom:w,maxZoom:A}=r.bucket.textSizeData;m.compositeTextSizes=[d["text-size"].possiblyEvaluate(new Yt(w),r.canonical),d["text-size"].possiblyEvaluate(new Yt(A),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){let{minZoom:w,maxZoom:A}=r.bucket.iconSizeData;m.compositeIconSizes=[d["icon-size"].possiblyEvaluate(new Yt(w),r.canonical),d["icon-size"].possiblyEvaluate(new Yt(A),r.canonical)]}let _=c.get("text-line-height")*nn,x=c.get("text-rotation-alignment")!=="viewport"&&c.get("symbol-placement")!=="point",b=c.get("text-keep-upright"),S=c.get("text-size");for(let w of r.bucket.features){let A=c.get("text-font").evaluate(w,{},r.canonical).join(","),E=S.evaluate(w,{},r.canonical),R=m.layoutTextSize.evaluate(w,{},r.canonical),I=m.layoutIconSize.evaluate(w,{},r.canonical),O={horizontal:{},vertical:void 0},F=w.text,V,U=[0,0];if(F){let X=F.toString(),ue=c.get("text-letter-spacing").evaluate(w,{},r.canonical)*nn,he=Mu(X)?ue:0,be=c.get("text-anchor").evaluate(w,{},r.canonical),_e=uw(s,w,r.canonical);if(!_e){let ye=c.get("text-radial-offset").evaluate(w,{},r.canonical);U=ye?cw(be,[ye*nn,N_]):c.get("text-offset").evaluate(w,{},r.canonical).map((Le=>Le*nn))}let Me=x?"center":c.get("text-justify").evaluate(w,{},r.canonical),Ee=c.get("symbol-placement")==="point"?c.get("text-max-width").evaluate(w,{},r.canonical)*nn:1/0,we=()=>{r.bucket.allowVerticalPlacement&&Gd(X)&&(O.vertical=t0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,be,"left",he,U,y.ax.vertical,!0,R,E))};if(!x&&_e){let ye=new Set;if(Me==="auto")for(let Ze=0;Ze<_e.values.length;Ze+=2)ye.add(U_(_e.values[Ze]));else ye.add(Me);let Le=!1;for(let Ze of ye)if(!O.horizontal[Ze])if(Le)O.horizontal[Ze]=O.horizontal[0];else{let Ve=t0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,"center",Ze,he,U,y.ax.horizontal,!1,R,E);Ve&&(O.horizontal[Ze]=Ve,Le=Ve.positionedLines.length===1)}we()}else{Me==="auto"&&(Me=U_(be));let ye=t0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,be,Me,he,U,y.ax.horizontal,!1,R,E);ye&&(O.horizontal[Me]=ye),we(),Gd(X)&&x&&b&&(O.vertical=t0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,be,Me,he,U,y.ax.vertical,!1,R,E))}}let j=!1;if(!((e=w.icon)===null||e===void 0)&&e.name){let X=r.imageMap[w.icon.name];X&&(V=zM(r.imagePositions[w.icon.name],c.get("icon-offset").evaluate(w,{},r.canonical),c.get("icon-anchor").evaluate(w,{},r.canonical)),j=!!X.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=j:r.bucket.sdfIcons!==j&&Wt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(X.pixelRatio!==r.bucket.pixelRatio||c.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}let H=dw(O.horizontal)||O.vertical;(n=r.bucket).iconsInText||(n.iconsInText=!!H&&H.iconsInText),(H||V)&&TE(r.bucket,w,O,V,r.imageMap,m,R,I,U,j,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},y.cP=Z1,y.cQ=$1,y.cR=c_,y.cS=function(r,e=""){let n=new e0;return(function(s,c,d=""){for(let m in s.layers)c.writeMessage(3,((_,x)=>cE(_,x,d)),s.layers[m])})(r,n,e),n.finish()},y.cT=function(r,e,n,s,c,d){let m=ew(r,e,n,c,0);return m=ew(m,e,s,d,1),m},y.cU=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){let e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){let n=this.map.keys().next().value;this.map.delete(n)}this.map.set(r,e)}clear(){this.map.clear()}},y.cV=Sx,y.cW=e0,y.cX=Y2,y.cY=function(r,e,n,s,c){return l(this,void 0,void 0,(function*(){if(Ne())try{return yield Ht(r,e,n,s,c)}catch{}return(function(d,m,_,x,b){let S=d.width,w=d.height;Mn&&wr||(Mn=new OffscreenCanvas(S,w),wr=Mn.getContext("2d",{willReadFrequently:!0})),Mn.width=S,Mn.height=w,wr.drawImage(d,0,0,S,w);let A=wr.getImageData(m,_,x,b);return wr.clearRect(0,0,S,w),A.data})(r,e,n,s,c)}))},y.cZ=dx,y.c_=class{constructor(r,e){this.layers={[Sp]:this},this.name=Sp,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new lE(this.features[r],this.extent)}},y.ca=class extends Xo{},y.cb=oM,y.cc=class extends gc{},y.cd=U1,y.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},y.cf=lx,y.cg=function(r,e,n){var s=e[0],c=e[1],d=e[2],m=n[3]*s+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*s+n[4]*c+n[8]*d+n[12])/(m=m||1),r[1]=(n[1]*s+n[5]*c+n[9]*d+n[13])/m,r[2]=(n[2]*s+n[6]*c+n[10]*d+n[14])/m,r},y.ch=class extends Du{},y.ci=class extends t{},y.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&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]},y.ck=function(r,e){var n=r[0],s=r[1],c=r[2],d=r[3],m=r[4],_=r[5],x=r[6],b=r[7],S=r[8],w=r[9],A=r[10],E=r[11],R=r[12],I=r[13],O=r[14],F=r[15],V=e[0],U=e[1],j=e[2],H=e[3],X=e[4],ue=e[5],he=e[6],be=e[7],_e=e[8],Me=e[9],Ee=e[10],we=e[11],ye=e[12],Le=e[13],Ze=e[14],Ve=e[15];return Math.abs(n-V)<=ve*Math.max(1,Math.abs(n),Math.abs(V))&&Math.abs(s-U)<=ve*Math.max(1,Math.abs(s),Math.abs(U))&&Math.abs(c-j)<=ve*Math.max(1,Math.abs(c),Math.abs(j))&&Math.abs(d-H)<=ve*Math.max(1,Math.abs(d),Math.abs(H))&&Math.abs(m-X)<=ve*Math.max(1,Math.abs(m),Math.abs(X))&&Math.abs(_-ue)<=ve*Math.max(1,Math.abs(_),Math.abs(ue))&&Math.abs(x-he)<=ve*Math.max(1,Math.abs(x),Math.abs(he))&&Math.abs(b-be)<=ve*Math.max(1,Math.abs(b),Math.abs(be))&&Math.abs(S-_e)<=ve*Math.max(1,Math.abs(S),Math.abs(_e))&&Math.abs(w-Me)<=ve*Math.max(1,Math.abs(w),Math.abs(Me))&&Math.abs(A-Ee)<=ve*Math.max(1,Math.abs(A),Math.abs(Ee))&&Math.abs(E-we)<=ve*Math.max(1,Math.abs(E),Math.abs(we))&&Math.abs(R-ye)<=ve*Math.max(1,Math.abs(R),Math.abs(ye))&&Math.abs(I-Le)<=ve*Math.max(1,Math.abs(I),Math.abs(Le))&&Math.abs(O-Ze)<=ve*Math.max(1,Math.abs(O),Math.abs(Ze))&&Math.abs(F-Ve)<=ve*Math.max(1,Math.abs(F),Math.abs(Ve))},y.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],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},y.cm=r=>r.type==="circle",y.cn=r=>r.type==="heatmap",y.co=r=>r.type==="line",y.cp=r=>r.type==="fill",y.cq=r=>r.type==="fill-extrusion",y.cr=r=>r.type==="hillshade",y.cs=r=>r.type==="color-relief",y.ct=r=>r.type==="background",y.cu=r=>r.type==="custom",y.cv=Ji,y.cw=function(r,e,n){if(e<=0)return r;let s=1/e;return n===void 0||Math.abs(n)<1e-10?Math.round(r*s)/s:(n>0?Math.ceil(r*s-1e-9):Math.floor(r*s+1e-10))/s},y.cx=function(r,e,n){let s=We(e.x-n.x,e.y-n.y),c=We(r.x-n.x,r.y-n.y);var d,m;return Ur(Math.atan2(s[0]*c[1]-s[1]*c[0],(d=s)[0]*(m=c)[0]+d[1]*m[1]))},y.cy=Bi,y.cz=function(r,e){var n;if(!kl[e])return!1;let s=r?.target,c=((n=s?.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window;return r instanceof c.MouseEvent||r instanceof c.WheelEvent},y.d=st,y.d0=class{constructor(r,e){let n=(e=this.options=Object.assign({},Y6,e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=Q1(r,e);n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),s=i_(s,e),e.updateable&&(this.source=s),this.initializeIndex(s,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new j6(e.clusterOptions):new X6(e),r.length&&this.tileIndex.initialize(r)}getTile(r,e,n){return e=+e,n=+n,(r=+r)<0||r>24?null:this.tileIndex.getTile(r,e,n)}updateData(r,e){let n=this.options;if(!n.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:s,source:c}=(function(d,m,_){let x=(function(S,w){return S?{removeAll:S.removeAll,remove:new Set(S.remove||[]),add:new Map(S.add?.map((A=>[w.promoteId?A.properties[w.promoteId]:A.id,A]))),update:new Map(S.update?.map((A=>[A.id,A])))}:{remove:new Set,add:new Map,update:new Map}})(m,_),b=[];if(x.removeAll&&(b=d,d=[]),x.remove.size||x.add.size){let S=[];for(let w of d)(x.remove.has(w.id)||x.add.has(w.id))&&S.push(w);if(S.length){b.push(...S);let w=new Set(S.map((A=>A.id)));d=d.filter((A=>!w.has(A.id)))}if(x.add.size){let w=Q1({type:"FeatureCollection",features:Array.from(x.add.values())},_);w=i_(w,_),b.push(...w),d.push(...w)}}if(x.update.size){let S=new Map,w=[];for(let A of d)x.update.has(A.id)?S.set(A.id,[...S.get(A.id)||[],A]):w.push(A);for(let[A,E]of x.update){let R=S.get(A);if(!R||R.length===0)continue;let I=V6(R,E,_);b.push(...R,...I),w.push(...I)}d=w}return{affected:b,source:d}})(this.source,r,n);e&&({affected:s,source:c}=this.filterUpdate(c,s,e)),s.length&&(this.source=c,this.tileIndex.updateIndex(c,s,n))}filterUpdate(r,e,n){let s=new Set;for(let c of r)c.id!=null&&(n(Wm(c))||(e.push(c),s.add(c.id)));return{affected:e,source:r=r.filter((c=>!s.has(c.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((r=>Wm(r)))}}updateClusterOptions(r,e){let n=this.options.cluster;this.options.cluster=r,this.options.clusterOptions=e,n!=r?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(r){return this.tileIndex.getClusterExpansionZoom(r)}getClusterChildren(r){return this.tileIndex.getChildren(r)}getClusterLeaves(r,e,n){return this.tileIndex.getLeaves(r,e,n)}},y.d1=ka,y.e=hi,y.f=Et,y.g=jr,y.h=r=>l(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(n){throw new Error(`Could not load image because of ${st(n).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),y.i=di,y.j=r=>new Promise(((e,n)=>{let s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>s.src=la))},s.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let c=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(c):la})),y.k=(r,e)=>mn(hi(r,{type:"json"}),e),y.l=Ka,y.m=mn,y.n=Wa,y.o=(r,e)=>mn(hi(r,{type:"arrayBuffer"}),e),y.p=e2,y.q=function(r){return new e0(r).readFields(xM,[])},y.r=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},y.s=Ya,y.t=lp,y.u=Vn,y.v=ac,y.w=Wt,y.x=Ce,y.y=Wd,y.z=hr})),u("worker",["./shared"],(function(y){"use strict";class l{constructor(Z,Y){this.keyCache={},Z&&this.replace(Z,Y)}replace(Z,Y){this._layerConfigs={},this._layers={},this.update(Z,[],Y)}update(Z,Y,ne){for(let Fe of Z){this._layerConfigs[Fe.id]=Fe;let Ye=this._layers[Fe.id]=y.bT(Fe,ne);Ye._featureFilter=y.ah(Ye.filter,ne),this.keyCache[Fe.id]&&delete this.keyCache[Fe.id]}for(let Fe of Y)delete this.keyCache[Fe],delete this._layerConfigs[Fe],delete this._layers[Fe];this.familiesBySource={};let xe=y.cJ(Object.values(this._layerConfigs),this.keyCache);for(let Fe of xe){let Ye=Fe.map((yt=>this._layers[yt.id])),ze=Ye[0];if(ze.isHidden())continue;let Ie=ze.source||"",Ge=this.familiesBySource[Ie];Ge||(Ge=this.familiesBySource[Ie]={});let We=ze.sourceLayer||y.ag,Ke=Ge[We];Ke||(Ke=Ge[We]=[]),Ke.push(Ye)}}}class D{constructor(Z){let Y={},ne=[];for(let ze in Z){let Ie=Z[ze],Ge=Y[ze]={};for(let We in Ie){let Ke=Ie[+We];if(!Ke||Ke.bitmap.width===0||Ke.bitmap.height===0)continue;let yt={x:0,y:0,w:Ke.bitmap.width+2,h:Ke.bitmap.height+2};ne.push(yt),Ge[We]={rect:yt,metrics:Ke.metrics}}}let{w:xe,h:Fe}=y.p(ne),Ye=new y.t({width:xe||1,height:Fe||1});for(let ze in Z){let Ie=Z[ze];for(let Ge in Ie){let We=Ie[+Ge];if(!We||We.bitmap.width===0||We.bitmap.height===0)continue;let Ke=Y[ze][Ge].rect;y.t.copy(We.bitmap,Ye,{x:0,y:0},{x:Ke.x+1,y:Ke.y+1},We.bitmap)}}this.image=Ye,this.positions=Y}}y.cK("GlyphAtlas",D);class B{constructor(Z){this.tileID=new y.a3(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[]}parse(Z,Y,ne,xe,Fe){return y._(this,void 0,void 0,(function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new y.ae;let Ye=new y.cL(Object.keys(Z.layers).sort()),ze=new y.cM(this.tileID,this.promoteId);ze.bucketLayerIDs=[];let Ie={},Ge={featureIndex:ze,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:ne,subdivisionGranularity:Fe},We=Y.familiesBySource[this.source];for(let tt in We){let kt=Z.layers[tt];if(!kt)continue;kt.version===1&&y.w(`Vector tile source "${this.source}" layer "${tt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Wt=Ye.encode(tt),Fi=[];for(let di=0;di<kt.length;di++){let Ri=kt.feature(di),pn=ze.getId(Ri,tt);Fi.push({feature:Ri,id:pn,index:di,sourceLayerIndex:Wt})}for(let di of We[tt]){let Ri=di[0];Ri.source!==this.source&&y.w(`layer.source = ${Ri.source} does not equal this.source = ${this.source}`),Ri.isHidden(this.zoom,!0)||(q(di,this.zoom,ne),(Ie[Ri.id]=Ri.createBucket({index:ze.bucketLayerIDs.length,layers:di,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Wt,sourceID:this.source})).populate(Fi,Ge,this.tileID.canonical),ze.bucketLayerIDs.push(di.map((pn=>pn.id))))}}let Ke=y.bY(Ge.glyphDependencies,(tt=>Object.keys(tt).map(Number)));for(let tt of this.inFlightDependencies)tt?.abort();this.inFlightDependencies=[];let yt=Promise.resolve({});if(Object.keys(Ke).length){let tt=new AbortController;this.inFlightDependencies.push(tt),yt=xe.sendAsync({type:"GG",data:{stacks:Ke,source:this.source,tileID:this.tileID,type:"glyphs"}},tt)}let st=Object.keys(Ge.iconDependencies),Nt=Promise.resolve({});if(st.length){let tt=new AbortController;this.inFlightDependencies.push(tt),Nt=xe.sendAsync({type:"GI",data:{icons:st,source:this.source,tileID:this.tileID,type:"icons"}},tt)}let Zt=Object.keys(Ge.patternDependencies),Ut=Promise.resolve({});if(Zt.length){let tt=new AbortController;this.inFlightDependencies.push(tt),Ut=xe.sendAsync({type:"GI",data:{icons:Zt,source:this.source,tileID:this.tileID,type:"patterns"}},tt)}let Ji=Ge.dashDependencies,Bi=Promise.resolve({});if(Object.keys(Ji).length){let tt=new AbortController;this.inFlightDependencies.push(tt),Bi=xe.sendAsync({type:"GDA",data:{dashes:Ji}},tt)}let[ri,dn,hi,Fr]=yield Promise.all([yt,Nt,Ut,Bi]),Sn=new D(ri),Nr=new y.cN(dn,hi);for(let tt in Ie){let kt=Ie[tt];kt instanceof y.af?(q(kt.layers,this.zoom,ne),y.cO({bucket:kt,glyphMap:ri,glyphPositions:Sn.positions,imageMap:dn,imagePositions:Nr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ge.subdivisionGranularity})):kt.hasDependencies&&(kt instanceof y.cP||kt instanceof y.cQ||kt instanceof y.cR)&&(q(kt.layers,this.zoom,ne),kt.addFeatures(Ge,this.tileID.canonical,Nr.patternPositions,Fr))}return this.status="done",{buckets:Object.values(Ie).filter((tt=>!tt.isEmpty())),featureIndex:ze,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Sn.image,imageAtlas:Nr,dashPositions:Fr,glyphMap:this.returnDependencies?ri:null,iconMap:this.returnDependencies?dn:null,glyphPositions:this.returnDependencies?Sn.positions:null}}))}}function q(qe,Z,Y){let ne=new y.J(Z);for(let xe of qe)xe.recalculate(ne,Y)}class K{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(Z,Y){this.loading[Z]=Y}finishLoading(Z){delete this.loading[Z]}abort(Z){let Y=this.loading[Z];Y?.abort&&(Y.abort.abort(),delete this.loading[Z])}setParsing(Z,Y){this.parsing[Z]=Y}consumeParsing(Z){let Y=this.parsing[Z];if(Y)return delete this.parsing[Z],Y}clearParsing(Z){delete this.parsing[Z]}markLoaded(Z,Y){this.loaded[Z]=Y}getLoaded(Z){let Y=this.loaded[Z];if(Y)return Y}removeLoaded(Z){delete this.loaded[Z]}clearLoaded(){this.loaded={}}}class fe{constructor(Z){this.start=`${Z}#start`,this.end=`${Z}#end`,this.measure=Z,performance.mark(this.start)}finish(){performance.mark(this.end);let Z=performance.getEntriesByName(this.measure);return Z.length===0&&(performance.measure(this.measure,this.start,this.end),Z=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),Z}}class de{constructor(Z,Y,ne,xe,Fe){this.type=Z,this.properties=ne||{},this.extent=Fe,this.pointsArray=Y,this.id=xe}loadGeometry(){return this.pointsArray.map((Z=>Z.map((Y=>new y.P(Y.x,Y.y)))))}}class oe{constructor(Z,Y,ne){this.version=2,this._myFeatures=Z,this.name=Y,this.length=Z.length,this.extent=ne}feature(Z){return this._myFeatures[Z]}}class ce{constructor(){this.layers={}}addLayer(Z){this.layers[Z.name]=Z}}function ke(qe){let Z=y.cS(qe);return Z.byteOffset===0&&Z.byteLength===Z.buffer.byteLength||(Z=new Uint8Array(Z)),{vectorTile:qe,rawData:Z.buffer}}function Ne(qe,Z,Y){let{extent:ne}=qe,xe=Math.pow(2,Y.z-Z.z),Fe=(Y.x-Z.x*xe)*ne,Ye=(Y.y-Z.y*xe)*ne,ze=[];for(let Ie=0;Ie<qe.length;Ie++){let Ge=qe.feature(Ie),We=Ge.loadGeometry();for(let yt of We)for(let st of yt)st.x=st.x*xe-Fe,st.y=st.y*xe-Ye;let Ke=128;We=y.cT(We,Ge.type,-Ke,-Ke,ne+Ke,ne+Ke),We.length!==0&&ze.push(new de(Ge.type,We,Ge.properties,Ge.id,ne))}return new oe(ze,qe.name,ne)}class ve{constructor(Z,Y,ne){this.actor=Z,this.layerIndex=Y,this.availableImages=ne,this.tileState=new K,this.overzoomedTileResultCache=new y.cU(1e3)}loadVectorTile(Z,Y){try{return{vectorTile:Z.encoding!=="mlt"?new y.cV(new y.cW(Y)):new y.cX(Y),rawData:Y}}catch(ne){let xe=new Uint8Array(Y),Fe=`Unable to parse the tile at ${Z.request.url}, `;throw Fe+=xe[0]===31&&xe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${y.d(ne).message}`,new Error(Fe)}}loadTile(Z){return y._(this,void 0,void 0,(function*(){let{uid:Y,overzoomParameters:ne}=Z;ne&&(Z.request=ne.overzoomRequest);let xe=this._startRequestTiming(Z),Fe=new B(Z);this.tileState.startLoading(Y,Fe);let Ye=new AbortController;Fe.abort=Ye;try{let ze=yield y.o(Z.request,Ye);if(Z.etag&&Z.etag===ze.etag)return this.tileState.finishLoading(Y),this._getEtagUnmodifiedResult(ze,xe);let Ie=this.loadVectorTile(Z,ze.data);if(this.tileState.finishLoading(Y),!Ie)return null;let{vectorTile:Ge,rawData:We}=Ie;ne&&({vectorTile:Ge,rawData:We}=this._getOverzoomTile(Z,Ge));let Ke=this._getExpiryData(ze),yt=this._finishRequestTiming(xe);Fe.vectorTile=Ge,this.tileState.markLoaded(Y,Fe);let st={rawData:We,cacheControl:Ke,resourceTiming:yt};this.tileState.setParsing(Y,st);try{return yield this._parseWorkerTile(Fe,Z,st)}finally{this.tileState.clearParsing(Y)}}catch(ze){throw this.tileState.finishLoading(Y),Fe.status="done",this.tileState.markLoaded(Y,Fe),ze}}))}_getEtagUnmodifiedResult(Z,Y){let ne=this._getExpiryData(Z),xe=this._finishRequestTiming(Y);return y.e({etagUnmodified:!0},ne,xe)}_parseWorkerTile(Z,Y,ne){return y._(this,void 0,void 0,(function*(){let xe=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,Y.subdivisionGranularity);if(ne){let{rawData:Fe,cacheControl:Ye,resourceTiming:ze}=ne;xe=y.e({rawTileData:Fe.slice(0),encoding:Y.encoding},xe,Ye,ze)}return xe}))}_getExpiryData({expires:Z,cacheControl:Y,etag:ne}){let xe={};return Z&&(xe.expires=Z),Y&&(xe.cacheControl=Y),ne&&(xe.etag=ne),xe}_startRequestTiming(Z){var Y;if(!((Y=Z.request)===null||Y===void 0)&&Y.collectResourceTiming)return new fe(Z.request.url)}_finishRequestTiming(Z){let Y=Z?.finish();return Y?{resourceTiming:JSON.parse(JSON.stringify(Y))}:{}}_getOverzoomTile(Z,Y){var ne;let{tileID:xe,source:Fe,overzoomParameters:Ye}=Z,{maxZoomTileID:ze}=Ye,Ie=`${ze.key}_${xe.key}_${(ne=Z.request)===null||ne===void 0?void 0:ne.url}`,Ge=this.overzoomedTileResultCache.get(Ie);if(Ge)return Ge;let We=new ce,Ke=this.layerIndex.familiesBySource[Fe];for(let st in Ke){let Nt=Y.layers[st];if(!Nt)continue;let Zt=Ne(Nt,ze,xe.canonical);Zt.length>0&&We.addLayer(Zt)}let yt=ke(We);return this.overzoomedTileResultCache.set(Ie,yt),yt}reloadTile(Z){return y._(this,void 0,void 0,(function*(){let Y=Z.uid,ne=this.tileState.getLoaded(Y);if(!ne)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ne.showCollisionBoxes=Z.showCollisionBoxes,ne.status==="parsing"){let xe=this.tileState.consumeParsing(Y);return yield this._parseWorkerTile(ne,Z,xe)}if(ne.status==="done"&&ne.vectorTile)return yield this._parseWorkerTile(ne,Z)}))}abortTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.abort(Z.uid)}))}removeTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(Z.uid)}))}}class se{constructor(){this.loaded={}}loadTile(Z){return y._(this,void 0,void 0,(function*(){let{uid:Y,encoding:ne,rawImageData:xe,redFactor:Fe,greenFactor:Ye,blueFactor:ze,baseShift:Ie}=Z,Ge=xe.width+2,We=xe.height+2,Ke=y.b(xe)?new y.R({width:Ge,height:We},yield y.cY(xe,-1,-1,Ge,We)):xe,yt=new y.cZ(Y,Ke,ne,Fe,Ye,ze,Ie);return this.loaded||(this.loaded={}),this.loaded[Y]=yt,yt}))}removeTile(Z){let Y=this.loaded,ne=Z.uid;Y?.[ne]&&delete Y[ne]}}class le{constructor(Z,Y,ne,xe=pe){this.actor=Z,this.layerIndex=Y,this.availableImages=ne,this.tileState=new K,this._createGeoJSONIndex=xe}loadVectorTile(Z){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let{z:Y,x:ne,y:xe}=Z.tileID.canonical,Fe=this._geoJSONIndex.getTile(Y,ne,xe);return Fe?ke(new y.c_(Fe.features,{version:2,extent:y.a6})):null}loadTile(Z){return y._(this,void 0,void 0,(function*(){let{uid:Y}=Z,ne=new B(Z);ne.abort=new AbortController;try{let xe=this.loadVectorTile(Z);if(!xe)return null;let{vectorTile:Fe,rawData:Ye}=xe;ne.vectorTile=Fe,this.tileState.markLoaded(Y,ne);let ze={rawData:Ye};this.tileState.setParsing(Y,ze);try{return yield this._parseWorkerTile(ne,Z,ze)}finally{this.tileState.clearParsing(Y)}}catch(xe){throw ne.status="done",this.tileState.markLoaded(Y,ne),xe}}))}_reloadLoadedTile(Z){return y._(this,void 0,void 0,(function*(){let Y=Z.uid,ne=this.tileState.getLoaded(Y);if(!ne)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ne.showCollisionBoxes=Z.showCollisionBoxes,ne.status==="parsing"){let xe=this.tileState.consumeParsing(Y);return yield this._parseWorkerTile(ne,Z,xe)}if(ne.status==="done"&&ne.vectorTile)return yield this._parseWorkerTile(ne,Z)}))}_parseWorkerTile(Z,Y,ne){return y._(this,void 0,void 0,(function*(){let xe=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,Y.subdivisionGranularity);if(ne){let{rawData:Fe}=ne;xe=y.e({rawTileData:Fe.slice(0),encoding:"mvt"},xe)}return xe}))}abortTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.abort(Z.uid)}))}removeTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(Z.uid)}))}loadData(Z){return y._(this,void 0,void 0,(function*(){var Y;(Y=this._pendingRequest)===null||Y===void 0||Y.abort();let ne=this._startRequestTiming(Z);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(Z,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let xe={};return Z.request&&(xe.data=Z.data),this._finishRequestTiming(ne,Z,xe),xe}catch(xe){if(delete this._pendingRequest,!y.$(xe))throw xe;return{abandoned:!0}}}))}_startRequestTiming(Z){var Y;if(!((Y=Z.request)===null||Y===void 0)&&Y.collectResourceTiming)return new fe(Z.request.url)}_finishRequestTiming(Z,Y,ne){let xe=Z?.finish();xe&&(ne.resourceTiming={[Y.source]:JSON.parse(JSON.stringify(xe))})}reloadTile(Z){return this.tileState.getLoaded(Z.uid)?this._reloadLoadedTile(Z):this.loadTile(Z)}loadAndProcessGeoJSON(Z,Y){return y._(this,void 0,void 0,(function*(){var ne;if(Z.request&&(Z.data=(yield y.k(Z.request,Y)).data),Z.data)return Z.data=this._filterGeoJSON(Z.data,Z.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(Z.data,Z));if(Z.dataDiff)return(ne=this._geoJSONIndex)!==null&&ne!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},Z)),void this._geoJSONIndex.updateData(Z.dataDiff,this._getFilterPredicate(Z.filter));if(Z.updateCluster&&this._geoJSONIndex.updateClusterOptions(Z.geojsonVtOptions.cluster,ge(Z)),this._geoJSONIndex==null)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(Z,Y){if(Z.type!=="FeatureCollection")return Z;let ne=this._getFilterPredicate(Y);return ne?{type:"FeatureCollection",features:Z.features.filter((xe=>ne(xe)))}:Z}_getFilterPredicate(Z){if(typeof Z!="boolean"&&!Z?.length)return;let Y=y.c$(Z,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Y.result==="error")throw new Error(Y.value.map((ne=>`${ne.key}: ${ne.message}`)).join(", "));return ne=>Y.value.evaluate({zoom:0},ne)}removeSource(Z){return y._(this,void 0,void 0,(function*(){var Y;(Y=this._pendingRequest)===null||Y===void 0||Y.abort()}))}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getClusterChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getClusterLeaves(Z.clusterId,Z.limit,Z.offset)}}function pe(qe,Z){let Y=y.e(Z.geojsonVtOptions||{},{updateable:!0,clusterOptions:ge(Z)});return new y.d0(qe,Y)}function ge({geojsonVtOptions:qe,clusterProperties:Z}){if(!Z||!qe.clusterOptions)return qe.clusterOptions;let Y={},ne={},xe={accumulated:null,zoom:0},Fe={properties:null},Ye=Object.keys(Z);for(let ze of Ye){let[Ie,Ge]=Z[ze],We=y.c$(Ge),Ke=y.c$(typeof Ie=="string"?[Ie,["accumulated"],["get",ze]]:Ie);Y[ze]=We.value,ne[ze]=Ke.value}return qe.clusterOptions.map=ze=>{Fe.properties=ze;let Ie={};for(let Ge of Ye)Ie[Ge]=Y[Ge].evaluate(xe,Fe);return Ie},qe.clusterOptions.reduce=(ze,Ie)=>{Fe.properties=Ie;for(let Ge of Ye)xe.accumulated=ze[Ge],ze[Ge]=ne[Ge].evaluate(xe,Fe)},qe.clusterOptions}class Be{constructor(Z){this.self=Z,this.actor=new y.N(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(Y,ne)=>{if(this.externalWorkerSourceTypes[Y])throw new Error(`Worker source with name "${Y}" already registered.`);this.externalWorkerSourceTypes[Y]=ne},this.self.addProtocol=y.cH,this.self.removeProtocol=y.cI,this.self.registerRTLTextPlugin=Y=>{y.d1.setMethods(Y)},this.self.makeRequest=y.m,this.actor.registerMessageHandler("LDT",((Y,ne)=>this._getDEMWorkerSource(Y,ne.source).loadTile(ne))),this.actor.registerMessageHandler("RDT",((Y,ne)=>y._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(Y,ne.source).removeTile(ne)})))),this.actor.registerMessageHandler("GCEZ",((Y,ne)=>y._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,ne.type,ne.source).getClusterExpansionZoom(ne)})))),this.actor.registerMessageHandler("GCC",((Y,ne)=>y._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,ne.type,ne.source).getClusterChildren(ne)})))),this.actor.registerMessageHandler("GCL",((Y,ne)=>y._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,ne.type,ne.source).getClusterLeaves(ne)})))),this.actor.registerMessageHandler("LD",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).loadData(ne))),this.actor.registerMessageHandler("LT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).loadTile(ne))),this.actor.registerMessageHandler("RT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).reloadTile(ne))),this.actor.registerMessageHandler("AT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).abortTile(ne))),this.actor.registerMessageHandler("RMT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).removeTile(ne))),this.actor.registerMessageHandler("RS",((Y,ne)=>y._(this,void 0,void 0,(function*(){var xe,Fe;if(!(!((Fe=(xe=this.workerSources[Y])===null||xe===void 0?void 0:xe[ne.type])===null||Fe===void 0)&&Fe[ne.source]))return;let Ye=this.workerSources[Y][ne.type][ne.source];delete this.workerSources[Y][ne.type][ne.source],Ye.removeSource!==void 0&&Ye.removeSource(ne)})))),this.actor.registerMessageHandler("RM",(Y=>y._(this,void 0,void 0,(function*(){delete this.layerIndexes[Y],delete this.availableImages[Y],delete this.workerSources[Y],delete this.demWorkerSources[Y],this.globalStates.delete(Y)})))),this.actor.registerMessageHandler("SR",((Y,ne)=>y._(this,void 0,void 0,(function*(){this.referrer=ne})))),this.actor.registerMessageHandler("SRPS",((Y,ne)=>this._syncRTLPluginState(Y,ne))),this.actor.registerMessageHandler("IS",((Y,ne)=>y._(this,void 0,void 0,(function*(){this.self.importScripts(ne)})))),this.actor.registerMessageHandler("SI",((Y,ne)=>this._setImages(Y,ne))),this.actor.registerMessageHandler("UL",((Y,ne)=>y._(this,void 0,void 0,(function*(){this._getLayerIndex(Y).update(ne.layers,ne.removedIds,this._getGlobalState(Y))})))),this.actor.registerMessageHandler("UGS",((Y,ne)=>y._(this,void 0,void 0,(function*(){let xe=this._getGlobalState(Y);for(let Fe in ne)xe[Fe]=ne[Fe]})))),this.actor.registerMessageHandler("SL",((Y,ne)=>y._(this,void 0,void 0,(function*(){this._getLayerIndex(Y).replace(ne,this._getGlobalState(Y))}))))}_getGlobalState(Z){let Y=this.globalStates.get(Z);return Y||(Y={},this.globalStates.set(Z,Y)),Y}_setImages(Z,Y){return y._(this,void 0,void 0,(function*(){this.availableImages[Z]=Y;for(let ne in this.workerSources[Z]){let xe=this.workerSources[Z][ne];for(let Fe in xe)xe[Fe].availableImages=Y}}))}_syncRTLPluginState(Z,Y){return y._(this,void 0,void 0,(function*(){return yield y.d1.syncState(Y,this.self.importScripts)}))}_getAvailableImages(Z){let Y=this.availableImages[Z];return Y||(Y=[]),Y}_getLayerIndex(Z){let Y=this.layerIndexes[Z];return Y||(Y=this.layerIndexes[Z]=new l),Y}_getWorkerSource(Z,Y,ne){var xe,Fe;if((xe=this.workerSources)[Z]||(xe[Z]={}),(Fe=this.workerSources[Z])[Y]||(Fe[Y]={}),!this.workerSources[Z][Y][ne]){let Ye={sendAsync:(ze,Ie)=>(ze.targetMapId=Z,this.actor.sendAsync(ze,Ie))};switch(Y){case"vector":this.workerSources[Z][Y][ne]=new ve(Ye,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][Y][ne]=new le(Ye,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][Y][ne]=new this.externalWorkerSourceTypes[Y](Ye,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][Y][ne]}_getDEMWorkerSource(Z,Y){var ne,xe;return(ne=this.demWorkerSources)[Z]||(ne[Z]={}),(xe=this.demWorkerSources[Z])[Y]||(xe[Y]=new se),this.demWorkerSources[Z][Y]}}return y.i(self)&&(self.worker=new Be(self)),Be})),u("index",["exports","./shared"],(function(y,l){"use strict";var D="5.24.0";function B(){var g=new l.A(4);return l.A!=Float32Array&&(g[1]=0,g[2]=0),g[0]=1,g[3]=1,g}let q,K,fe,de={frame(g,t,o,h){let p=h||window,v=p.requestAnimationFrame((M=>{T(),t(M)})),{unsubscribe:T}=l.s(g.signal,"abort",(()=>{T(),p.cancelAnimationFrame(v),o(new l.a(g.signal.reason))}),!1)},frameAsync(g,t){return new Promise(((o,h)=>{this.frame(g,o,h,t)}))},getImageData(g,t=0){return this.getImageCanvasContext(g).getImageData(-t,-t,g.width+2*t,g.height+2*t)},getImageCanvasContext(g){let t=window.document.createElement("canvas"),o=t.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return t.width=g.width,t.height=g.height,o.drawImage(g,0,0,g.width,g.height),o},resolveURL:g=>(q||(q=document.createElement("a")),q.href=g,q.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return fe!==void 0?fe:!!matchMedia&&(K!=null||(K=matchMedia("(prefers-reduced-motion: reduce)")),K.matches)},set prefersReducedMotion(g){fe=g}},oe=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(g){this._frozenAt=g}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function ce(){return oe.getCurrentTime()}var ke,Ne;class ve{static create(t,o,h){let p=window.document.createElement(t);return o!==void 0&&(p.className=o),h&&h.appendChild(p),p}static createNS(t,o){return window.document.createElementNS(t,o)}static disableDrag(){ve.docStyle&&ve.selectProp&&(ve.userSelect=ve.docStyle[ve.selectProp],ve.docStyle[ve.selectProp]="none")}static enableDrag(){ve.docStyle&&ve.selectProp&&(ve.docStyle[ve.selectProp]=ve.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ve.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ve.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",ve.suppressClickInternal,!0)}),0)}static getScale(t){let o=t.getBoundingClientRect();return{x:o.width/t.offsetWidth||1,y:o.height/t.offsetHeight||1,boundingClientRect:o}}static getPoint(t,o,h){let p=o.boundingClientRect;return new l.P((h.clientX-p.left)/o.x-t.clientLeft,(h.clientY-p.top)/o.y-t.clientTop)}static mousePos(t,o){let h=ve.getScale(t);return ve.getPoint(t,h,o)}static touchPos(t,o){let h=[],p=ve.getScale(t);for(let v of o)h.push(ve.getPoint(t,p,v));return h}static sanitize(t){let o=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),h=o.querySelectorAll("script");for(let p of h)p.remove();return ve.clean(o),o.innerHTML}static isPossiblyDangerous(t,o){let h=o.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!h.includes("javascript:")&&!h.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){let o=t.children;for(let h of o)ve.removeAttributes(h),ve.clean(h)}static removeAttributes(t){for(let{name:o,value:h}of t.attributes)ve.isPossiblyDangerous(o,h)&&t.removeAttribute(o)}}ve.docStyle=typeof window<"u"&&((ke=window.document)===null||ke===void 0?void 0:ke.documentElement.style),ve.selectProp=!ve.docStyle||"userSelect"in ve.docStyle?"userSelect":"webkitUserSelect",(function(g){let t,o,h,p;g.resetRequestQueue=()=>{t=[],o=0,h=0,p={}},g.addThrottleControl=C=>{let z=h++;return p[z]=C,z},g.removeThrottleControl=C=>{delete p[C],T()},g.getImage=(C,z,P=!0)=>new Promise(((k,L)=>{C.headers||(C.headers={}),C.headers.accept="image/webp,*/*",l.e(C,{type:"image"}),t.push({abortController:z,requestParameters:C,supportImageRefresh:P,state:"queued",onError:N=>{L(N)},onSuccess:N=>{k(N)}}),T()}));let v=C=>l._(this,void 0,void 0,(function*(){C.state="running";let{requestParameters:z,supportImageRefresh:P,onError:k,onSuccess:L,abortController:N}=C,G=P===!1&&!l.i(self)&&!l.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce(((W,ee)=>W&&ee==="accept"),!0));o++;let $=G?M(z,N):l.m(z,N);try{let W=yield $;delete C.abortController,C.state="completed",W.data instanceof HTMLImageElement||l.b(W.data)?L(W):W.data&&L({data:yield(J=W.data,typeof createImageBitmap=="function"?l.h(J):l.j(J)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete C.abortController,k(l.d(W))}finally{o--,T()}var J})),T=()=>{let C=(()=>{for(let z of Object.keys(p))if(p[z]())return!0;return!1})()?l.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=o;z<C&&t.length>0;z++){let P=t.shift();P.abortController.signal.aborted?z--:v(P)}},M=(C,z)=>new Promise(((P,k)=>{let L=new Image,N=C.url,G=C.credentials;G&&G==="include"?L.crossOrigin="use-credentials":(G&&G==="same-origin"||!l.f(N))&&(L.crossOrigin="anonymous"),z.signal.addEventListener("abort",(()=>{L.src="",k(new l.a(z.signal.reason))})),L.fetchPriority="high",L.onload=()=>{L.onerror=L.onload=null,P({data:L})},L.onerror=()=>{L.onerror=L.onload=null,z.signal.aborted||k(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."))},L.src=N}))})(Ne||(Ne={})),Ne.resetRequestQueue();class se{constructor(t){this._transformRequestFn=t??null}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function le(g){let t=[];if(typeof g=="string")t.push({id:"default",url:g});else if(g&&g.length>0){let o=[];for(let{id:h,url:p}of g){let v=`${h}${p}`;o.includes(v)||(o.push(v),t.push({id:h,url:p}))}}return t}function pe(g,t,o){try{let h=new URL(g);return h.pathname+=`${t}${o}`,h.toString()}catch{throw new Error(`Invalid sprite URL "${g}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function ge(g){let{userImage:t}=g;return!(!t?.render||!t.render()||(g.data.replace(new Uint8Array(t.data.buffer)),0))}class Be extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(let t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:o,promiseResolve:h}of this.requestors)h(this._getImagesForIds(o));this.requestors=[]}}getImage(t){let o=this.images[t];if(o&&!o.data&&o.spriteData){let h=o.spriteData;o.data=new l.R({width:h.width,height:h.height},h.context.getImageData(h.x,h.y,h.width,h.height).data),o.spriteData=null}return o}addImage(t,o){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,o)&&(this.images[t]=o)}_validate(t,o){let h=!0,p=o.data||o.spriteData;return this._validateStretch(o.stretchX,p?.width)||(this.fire(new l.l(new Error(`Image "${t}" has invalid "stretchX" value`))),h=!1),this._validateStretch(o.stretchY,p?.height)||(this.fire(new l.l(new Error(`Image "${t}" has invalid "stretchY" value`))),h=!1),this._validateContent(o.content,o)||(this.fire(new l.l(new Error(`Image "${t}" has invalid "content" value`))),h=!1),h}_validateStretch(t,o){if(!t)return!0;let h=0;for(let p of t){if(p[0]<h||p[1]<p[0]||o<p[1])return!1;h=p[1]}return!0}_validateContent(t,o){if(!t)return!0;if(t.length!==4)return!1;let h=o.spriteData,p=h?.width||o.data.width,v=h?.height||o.data.height;return!(t[0]<0||p<t[0]||t[1]<0||v<t[1]||t[2]<0||p<t[2]||t[3]<0||v<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,o,h=!0){let p=this.getImage(t);if(h&&(p.data.width!==o.data.width||p.data.height!==o.data.height))throw new Error(`size mismatch between old image (${p.data.width}x${p.data.height}) and new image (${o.data.width}x${o.data.height}).`);o.version=p.version+1,this.images[t]=o,this.updatedImages[t]=!0}removeImage(t){var o;let h=this.images[t];delete this.images[t],delete this.patterns[t],!((o=h.userImage)===null||o===void 0)&&o.onRemove&&h.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((o,h)=>{let p=!0;if(!this.isLoaded())for(let v of t)this.images[v]||(p=!1);this.isLoaded()||p?o(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:o})}))}_getImagesForIds(t){var o;let h={};for(let p of t){let v=this.getImage(p);v||(this.fire(new l.n("styleimagemissing",{id:p})),v=this.getImage(p)),v?h[p]={data:v.data.clone(),pixelRatio:v.pixelRatio,sdf:v.sdf,version:v.version,stretchX:v.stretchX,stretchY:v.stretchY,content:v.content,textFitWidth:v.textFitWidth,textFitHeight:v.textFitHeight,hasRenderCallback:!!(!((o=v.userImage)===null||o===void 0)&&o.render)}:l.w(`Image "${p}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return h}getPixelSize(){let{width:t,height:o}=this.atlasImage;return{width:t,height:o}}getPattern(t){let o=this.patterns[t],h=this.getImage(t);if(!h)return null;if(o&&o.position.version===h.version)return o.position;if(o)o.position.version=h.version;else{let p={w:h.data.width+2,h:h.data.height+2,x:0,y:0},v=new l.I(p,h);this.patterns[t]={bin:p,position:v}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){let o=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new l.T(t,this.atlasImage,o.RGBA),this.atlasTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let v in this.patterns)t.push(this.patterns[v].bin);let{w:o,h}=l.p(t),p=this.atlasImage;p.resize({width:o||1,height:h||1});for(let v in this.patterns){let{bin:T}=this.patterns[v],M=T.x+1,C=T.y+1,z=this.getImage(v).data,P=z.width,k=z.height;l.R.copy(z,p,{x:0,y:0},{x:M,y:C},{width:P,height:k}),l.R.copy(z,p,{x:0,y:k-1},{x:M,y:C-1},{width:P,height:1}),l.R.copy(z,p,{x:0,y:0},{x:M,y:C+k},{width:P,height:1}),l.R.copy(z,p,{x:P-1,y:0},{x:M-1,y:C},{width:1,height:k}),l.R.copy(z,p,{x:0,y:0},{x:M+P,y:C},{width:1,height:k})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let o of t){if(this.callbackDispatchedThisFrame[o])continue;this.callbackDispatchedThisFrame[o]=!0;let h=this.getImage(o);h||l.w(`Image with ID: "${o}" was not found`),ge(h)&&this.updateImage(o,h)}}cloneImages(){let t={};for(let o in this.images){let h=this.images[o];t[o]=Object.assign(Object.assign({},h),{data:h.data?h.data.clone():null})}return t}}let qe=1e20,Z=new Float64Array(256);for(let g=0;g<256;g++){let t=.5-Math.pow(g/255,.45454545454545453);Z[g]=t*Math.abs(t)}function Y(g,t,o,h,p,v,T,M,C){for(let z=t;z<t+h;z++)ne(g,o*v+z,v,p,T,M,C);for(let z=o;z<o+p;z++)ne(g,z*v+t,1,h,T,M,C)}function ne(g,t,o,h,p,v,T){v[0]=0,T[0]=-qe,T[1]=qe,p[0]=g[t];for(let M=1,C=0,z=0;M<h;M++){p[M]=g[t+M*o];let P=M*M;do{let k=v[C];z=(p[M]-p[k]+P-k*k)/(M-k)/2}while(z<=T[C]&&--C>-1);C++,v[C]=M,T[C]=z,T[C+1]=qe}for(let M=0,C=0;M<h;M++){for(;T[C+1]<M;)C++;let z=v[C],P=M-z;g[t+M*o]=p[z]+P*P}}Z[255]=-qe;let xe=l.v.layout_symbol["text-font"].default.join(",");class Fe{constructor(t,o,h){this.requestManager=t,this.localIdeographFontFamily=o,this.entries={},this.lang=h}setURL(t){this.url=t}getGlyphs(t){return l._(this,void 0,void 0,(function*(){let o=[];for(let v in t)for(let T of t[v])o.push(this._getAndCacheGlyphsPromise(v,T));let h=yield Promise.all(o),p={};for(let{stack:v,id:T,glyph:M}of h)p[v]||(p[v]={}),p[v][T]=M&&{id:M.id,bitmap:M.bitmap.clone(),metrics:M.metrics};return p}))}_getAndCacheGlyphsPromise(t,o){return l._(this,void 0,void 0,(function*(){var h,p;(h=(p=this.entries)[t])!==null&&h!==void 0||(p[t]={glyphs:{},requests:{},ranges:{}});let v=this.entries[t],T=v.glyphs[o];return T!==void 0?{stack:t,id:o,glyph:T}:!this.url||this._charUsesLocalIdeographFontFamily(o)?(T=v.glyphs[o]=this._drawGlyph(v,t,o),{stack:t,id:o,glyph:T}):yield this._downloadAndCacheRangePromise(t,o)}))}_downloadAndCacheRangePromise(t,o){return l._(this,void 0,void 0,(function*(){var h;let p=this.entries[t],v=Math.floor(o/256);if(p.ranges[v])return{stack:t,id:o,glyph:null};(h=p.requests)[v]||(h[v]=Fe.loadGlyphRange(t,v,this.url,this.requestManager));try{let T=yield p.requests[v];for(let M in T)p.glyphs[+M]=T[+M];return p.ranges[v]=!0,{stack:t,id:o,glyph:T[o]||null}}catch(T){let M=p.glyphs[o]=this._drawGlyph(p,t,o);return this._warnOnMissingGlyphRange(M,v,o,l.d(T)),{stack:t,id:o,glyph:M}}}))}_warnOnMissingGlyphRange(t,o,h,p){let v=256*o,T=v+255,M=h.toString(16).padStart(4,"0").toUpperCase();l.w(`Unable to load glyph range ${o}, ${v}-${T}. Rendering codepoint U+${M} locally instead. ${p}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&l.r(t)}_drawGlyph(t,o,h){let p=o===xe&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(h),v=p?"ideographTinySDF":"tinySDF";t[v]||(t[v]=this._createTinySDF(p?this.localIdeographFontFamily:o));let T=t[v].draw(String.fromCodePoint(h)),M=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(h));return{id:h,bitmap:new l.t({width:T.width||60,height:T.height||60},T.data),metrics:{width:M?0:T.glyphWidth/2||24,height:T.glyphHeight/2||24,left:T.glyphLeft/2+.5||0,top:T.glyphTop/2-27.5||-8,advance:M?0:T.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){let o=t?t.split(","):[];o.push("sans-serif");let h=o.map((p=>/[-\w]+/.test(p)?p:`'${CSS.escape(p)}'`)).join(",");return new Fe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:h,fontWeight:this._fontWeight(o[0]),fontStyle:this._fontStyle(o[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let o={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},h;for(let[p,v]of Object.entries(o))new RegExp(`\\b${p}\\b`,"i").test(t)&&(h=`${v}`);return h}destroy(){for(let t in this.entries){let o=this.entries[t];o.tinySDF=null,o.ideographTinySDF=null,o.glyphs={},o.requests={},o.ranges={}}this.entries={}}}Fe.loadGlyphRange=function(g,t,o,h){return l._(this,void 0,void 0,(function*(){let p=256*t,v=p+255,T=yield h.transformRequest(o.replace("{fontstack}",g).replace("{range}",`${p}-${v}`),"Glyphs"),M=yield l.o(T,new AbortController);if(!M?.data)throw new Error(`Could not load glyph range. range: ${t}, ${p}-${v}`);let C={};for(let z of l.q(M.data))C[z.id]=z;return C}))},Fe.TinySDF=class{constructor({fontSize:g=24,buffer:t=3,radius:o=8,cutoff:h=.25,fontFamily:p="sans-serif",fontWeight:v="normal",fontStyle:T="normal",lang:M=null}={}){this.buffer=t,this.radius=o,this.cutoff=h,this.lang=M;let C=this.size=g+4*t,z=this._createCanvas(C),P=this.ctx=z.getContext("2d",{willReadFrequently:!0});P.font=`${T} ${v} ${g}px ${p}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(g){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(g,g);let t=document.createElement("canvas");return t.width=t.height=g,t}draw(g){let{width:t,actualBoundingBoxAscent:o,actualBoundingBoxDescent:h,actualBoundingBoxLeft:p,actualBoundingBoxRight:v}=this.ctx.measureText(g),T=Math.ceil(o),M=Math.floor(p),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v)-M)),z=Math.max(0,Math.min(this.size-this.buffer,T+Math.ceil(h))),P=C+2*this.buffer,k=z+2*this.buffer,L=Math.max(P*k,0),N=new Uint8ClampedArray(L),G={data:N,width:P,height:k,glyphWidth:C,glyphHeight:z,glyphTop:T,glyphLeft:M,glyphAdvance:t};if(C===0||z===0)return G;let{ctx:$,buffer:J,gridInner:W,gridOuter:ee}=this;this.lang&&($.lang=this.lang),$.clearRect(J,J,C,z),$.fillText(g,J-M,J+T);let ae=$.getImageData(J,J,C,z);ee.fill(qe,0,L),W.fill(0,0,L);let te=3;for(let ie=0;ie<z;ie++){let me=(ie+J)*P+J;for(let Te=0;Te<C;Te++,te+=4,me++){let Se=ae.data[te];if(Se===0)continue;let Pe=Z[Se];ee[me]=Math.max(0,Pe),W[me]=Math.max(0,-Pe)}}Y(ee,0,0,P,k,P,this.f,this.v,this.z),Y(W,J,J,C,z,P,this.f,this.v,this.z);let Q=255/this.radius,re=255*(1-this.cutoff);for(let ie=0;ie<L;ie++){let me=Math.sqrt(ee[ie])-Math.sqrt(W[ie]);N[ie]=Math.round(re-Q*me)}return G}};class Ye{constructor(){this.specification=l.x.light.position}possiblyEvaluate(t,o){return l.G(t.expression.evaluate(o))}interpolate(t,o,h){return{x:l.H.number(t.x,o.x,h),y:l.H.number(t.y,o.y,h),z:l.H.number(t.z,o.z,h)}}}let ze;class Ie extends l.E{constructor(t){super(),ze||(ze=new l.u({anchor:new l.D(l.x.light.anchor),position:new Ye,color:new l.D(l.x.light.color),intensity:new l.D(l.x.light.intensity)})),this._transitionable=new l.y(ze,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o={}){if(!this._validate(l.z,t,o))for(let h in t){let p=t[h];h.endsWith(l.B)?this._transitionable.setTransition(h.slice(0,-l.B.length),p):this._transitionable.setValue(h,p)}}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,o,h){return h?.validate!==!1&&l.C(this,t.call(l.F,{value:o,style:{glyphs:!0,sprite:!0},styleSpec:l.x}))}}let Ge=new l.u({"sky-color":new l.D(l.x.sky["sky-color"]),"horizon-color":new l.D(l.x.sky["horizon-color"]),"fog-color":new l.D(l.x.sky["fog-color"]),"fog-ground-blend":new l.D(l.x.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.x.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.x.sky["atmosphere-blend"])});class We extends l.E{constructor(t){super(),this._transitionable=new l.y(Ge,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.J(0))}setSky(t,o={}){if(!this._validate(l.K,t,o)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let h in t){let p=t[h];h.endsWith(l.B)?this._transitionable.setTransition(h.slice(0,-l.B.length),p):this._transitionable.setValue(h,p)}}}getSky(){return this._transitionable.serialize()}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,o,h={}){return h?.validate!==!1&&l.C(this,t.call(l.F,l.e({value:o,style:{glyphs:!0,sprite:!0},styleSpec:l.x})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Ke{constructor(t,o){this.width=t,this.height=o,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,o){var h;let p=t.join(",")+String(o);return(h=this.dashEntry)[p]||(h[p]=this.addDash(t,o)),this.dashEntry[p]}getDashRanges(t,o,h){let p=[],v=t.length%2==1?-t[t.length-1]*h:0,T=t[0]*h,M=!0;p.push({left:v,right:T,isDash:M,zeroLength:t[0]===0});let C=t[0];for(let z=1;z<t.length;z++){M=!M;let P=t[z];v=C*h,C+=P,T=C*h,p.push({left:v,right:T,isDash:M,zeroLength:P===0})}return p}addRoundDash(t,o,h){let p=o/2;for(let v=-h;v<=h;v++){let T=this.width*(this.nextRow+h+v),M=0,C=t[M];for(let z=0;z<this.width;z++){z/C.right>1&&(C=t[++M]);let P=Math.abs(z-C.left),k=Math.abs(z-C.right),L=Math.min(P,k),N,G=v/h*(p+1);if(C.isDash){let $=p-Math.abs(G);N=Math.sqrt(L*L+$*$)}else N=p-Math.sqrt(L*L+G*G);this.data[T+z]=Math.max(0,Math.min(255,N+128))}}}addRegularDash(t){for(let M=t.length-1;M>=0;--M){let C=t[M],z=t[M+1];C.zeroLength?t.splice(M,1):z&&z.isDash===C.isDash&&(z.left=C.left,t.splice(M,1))}let o=t[0],h=t[t.length-1];o.isDash===h.isDash&&(o.left=h.left-this.width,h.right=o.right+this.width);let p=this.width*this.nextRow,v=0,T=t[v];for(let M=0;M<this.width;M++){M/T.right>1&&(T=t[++v]);let C=Math.abs(M-T.left),z=Math.abs(M-T.right),P=Math.min(C,z);this.data[p+M]=Math.max(0,Math.min(255,(T.isDash?P:-P)+128))}}addDash(t,o){let h=o?7:0,p=2*h+1;if(this.nextRow+p>this.height)return l.w("LineAtlas out of space"),null;let v=0;for(let M of t)v+=M;if(v!==0){let M=this.width/v,C=this.getDashRanges(t,this.width,M);o?this.addRoundDash(C,M,h):this.addRegularDash(C)}let T={y:this.nextRow+h,height:2*h,width:v};return this.nextRow+=p,this.dirty=!0,T}bind(t){let o=t.gl;this.texture?(o.bindTexture(o.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,o.texSubImage2D(o.TEXTURE_2D,0,0,0,this.width,this.height,o.ALPHA,o.UNSIGNED_BYTE,this.data))):(this.texture=o.createTexture(),o.bindTexture(o.TEXTURE_2D,this.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.REPEAT),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.REPEAT),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texImage2D(o.TEXTURE_2D,0,o.ALPHA,this.width,this.height,0,o.ALPHA,o.UNSIGNED_BYTE,this.data))}}let yt="maplibre_preloaded_worker_pool";class st{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<st.workerCount;)this.workers.push(new Worker(l.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(let o of this.workers)o.terminate();this.workers=null}}isPreloaded(){return!!this.active[yt]}numActive(){return Object.keys(this.active).length}}let Nt=Math.floor(de.hardwareConcurrency/2),Zt,Ut;function Ji(){return Zt||(Zt=new st),Zt}st.workerCount=l.L(globalThis)?Math.max(Math.min(Nt,3),1):1;class Bi{constructor(t,o){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=o;let h=this.workerPool.acquire(o);for(let p=0;p<h.length;p++){let v=new l.N(h[p],o);v.name=`Worker ${p}`,this.actors.push(v)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,o){let h=[];for(let p of this.actors)h.push(p.sendAsync({type:t,data:o}));return Promise.all(h)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let o of this.actors)o.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,o){for(let h of this.actors)h.registerMessageHandler(t,o)}unregisterMessageHandler(t){for(let o of this.actors)o.unregisterMessageHandler(t)}}function ri(){return Ut||(Ut=new Bi(Ji(),l.M),Ut.registerMessageHandler("GR",((g,t,o)=>l.m(t,o)))),Ut}function dn(g,t){let o=l.O();return l.Q(o,o,[1,1,0]),l.S(o,o,[.5*g.width,.5*g.height,1]),g.calculatePosMatrix?l.U(o,o,g.calculatePosMatrix(t.toUnwrapped())):o}function hi(g,t,o,h,p,v,T){var M;let C=(function(L,N,G){if(L)for(let $ of L){let J=N[$];if(J?.source===G&&J.type==="fill-extrusion")return!0}else for(let $ in N){let J=N[$];if(J.source===G&&J.type==="fill-extrusion")return!0}return!1})((M=p?.layers)!==null&&M!==void 0?M:null,t,g.id),z=v.maxPitchScaleFactor(),P=g.tilesIn(h,z,C);P.sort(Fr);let k=[];for(let L of P)k.push({wrappedTileID:L.tileID.wrapped().key,queryResults:L.tile.queryRenderedFeatures(t,o,g.getState(),L.queryGeometry,L.cameraQueryGeometry,L.scale,p,v,z,dn(v,L.tileID),T?(N,G)=>T(L.tileID,N,G):void 0)});return(function(L,N){for(let G in L)for(let $ of L[G])Sn($,N);return L})((function(L){let N={},G={};for(let{queryResults:$,wrappedTileID:J}of L){G[J]||(G[J]={});let W=G[J];for(let ee in $){let ae=$[ee];W[ee]||(W[ee]={});let te=W[ee];N[ee]||(N[ee]=[]);for(let Q of ae)te[Q.featureIndex]||(te[Q.featureIndex]=!0,N[ee].push(Q))}}return N})(k),g)}function Fr(g,t){let o=g.tileID,h=t.tileID;return o.overscaledZ-h.overscaledZ||o.canonical.y-h.canonical.y||o.wrap-h.wrap||o.canonical.x-h.canonical.x}function Sn(g,t){let o=g.feature,h=t.getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=h}function Nr(g,t,o,h){return l._(this,void 0,void 0,(function*(){let p=g;if(g.url?p=(yield l.k(yield t.transformRequest(g.url,"Source"),o)).data:yield de.frameAsync(o,h),!p)return null;let v=l.V(l.e(p,g),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(v.vectorLayerIds=p.vector_layers.map((T=>T.id))),v}))}class tt{constructor(t,o){t&&(o?this.setSouthWest(t).setNorthEast(o):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof l.W?new l.W(t.lng,t.lat):l.W.convert(t),this}setSouthWest(t){return this._sw=t instanceof l.W?new l.W(t.lng,t.lat):l.W.convert(t),this}extend(t){let o=this._sw,h=this._ne,p,v;if(t instanceof l.W)p=t,v=t;else{if(!(t instanceof tt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(tt.convert(t)):this.extend(l.W.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(l.W.convert(t)):this;if(p=t._sw,v=t._ne,!p||!v)return this}return o||h?(o.lng=Math.min(p.lng,o.lng),o.lat=Math.min(p.lat,o.lat),h.lng=Math.max(v.lng,h.lng),h.lat=Math.max(v.lat,h.lat)):(this._sw=new l.W(p.lng,p.lat),this._ne=new l.W(v.lng,v.lat)),this}getCenter(){return new l.W((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 l.W(this.getWest(),this.getNorth())}getSouthEast(){return new l.W(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(t){let{lng:o,lat:h}=l.W.convert(t),p=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(p=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&p}intersects(t){if(!((t=tt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let o=Math.abs(this.getEast()-this.getWest()),h=Math.abs(t.getEast()-t.getWest());if(o>=360||h>=360)return!0;let p=l.X(this.getWest(),-180,180),v=l.X(this.getEast(),-180,180),T=l.X(t.getWest(),-180,180),M=l.X(t.getEast(),-180,180),C=p>v,z=T>M;return!(!C||!z)||(C?M>=p||T<=v:z?v>=T||p<=M:T<=v&&M>=p)}static convert(t){return t instanceof tt?t:t&&new tt(t)}static fromLngLat(t,o=0){let h=360*o/40075017,p=h/Math.cos(Math.PI/180*t.lat);return new tt(new l.W(t.lng-p,t.lat-h),new l.W(t.lng+p,t.lat+h))}adjustAntiMeridian(){let t=new l.W(this._sw.lng,this._sw.lat),o=new l.W(this._ne.lng,this._ne.lat);return new tt(t,t.lng>o.lng?new l.W(o.lng+360,o.lat):o)}}class kt{constructor(t,o,h){this.bounds=tt.convert(this.validateBounds(t)),this.minzoom=o||0,this.maxzoom=h||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]}contains(t){let o=Math.pow(2,t.z),h=Math.floor(l.Z(this.bounds.getWest())*o),p=Math.floor(l.Y(this.bounds.getNorth())*o),v=Math.ceil(l.Z(this.bounds.getEast())*o),T=Math.ceil(l.Y(this.bounds.getSouth())*o);return t.x>=h&&t.x<v&&t.y>=p&&t.y<T}}class Wt extends l.E{constructor(t,o,h,p){if(super(),this.id=t,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.V(o,["url","scheme","tileSize","promoteId","encoding"])),this._options=l.e({type:"vector"},o),this._collectResourceTiming=o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p)}load(){return l._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new l.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let o=yield Nr(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new kt(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(o){this._tileJSONRequest=null,this._loaded=!0,l.$(o)||this.fire(new l.l(l.d(o)))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h={request:yield this.map._requestManager.transformRequest(o,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};h.request.collectResourceTiming=this._collectResourceTiming;let p="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((v,T)=>{t.reloadPromise={resolve:v,reject:T}}))}else t.actor=this.dispatcher.getActor(),p="LT";t.abortController=new AbortController;try{let v=yield t.actor.sendAsync({type:p,data:h},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,v);let T={};return v?.etagUnmodified&&(T.unmodified=!0),T}catch(v){if(delete t.abortController,t.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){return l._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let o=t.tileID.scaledTo(this.maxzoom).canonical,h=o.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:o,overzoomRequest:yield this.map._requestManager.transformRequest(h,"Tile")}}))}_afterTileLoadWorkerResponse(t,o){if(o?.resourceTiming&&(t.resourceTiming=o.resourceTiming),o&&this.map._refreshExpiredTiles&&t.setExpiryData(o),t.etag=o?.etag,t.loadVectorData(o,this.map.painter),t.reloadPromise){let h=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(h.resolve).catch(h.reject)}}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Fi extends l.E{constructor(t,o,h,p){super(),this.id=t,this.dispatcher=h,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},o),l.e(this,l.V(o,["url","scheme","tileSize"]))}load(){return l._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new l.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let o=yield Nr(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new kt(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(o){this._tileJSONRequest=null,this._loaded=!0,l.$(o)||this.fire(new l.l(l.d(o)))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return l.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{let h=yield Ne.getImage(yield this.map._requestManager.transformRequest(o,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(h?.data){this.map._refreshExpiredTiles&&(h.cacheControl||h.expires)&&t.setExpiryData({cacheControl:h.cacheControl,expires:h.expires});let p=this.map.painter.context,v=p.gl,T=h.data;t.texture=this.map.painter.getTileTexture(T.width),t.texture?t.texture.update(T,{useMipmap:!0}):(t.texture=new l.T(p,T,v.RGBA,{useMipmap:!0}),t.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(h){if(delete t.abortController,t.aborted)t.state="unloaded";else if(h)throw t.state="errored",h}}))}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class di extends Fi{constructor(t,o,h,p){super(t,o,h,p),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},o),this.encoding=o.encoding||"mapbox",this.redFactor=o.redFactor,this.greenFactor=o.greenFactor,this.blueFactor=o.blueFactor,this.baseShift=o.baseShift}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h=yield this.map._requestManager.transformRequest(o,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let p=yield Ne.getImage(h,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(p?.data){let v=p.data;this.map._refreshExpiredTiles&&(p.cacheControl||p.expires)&&t.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});let T=l.b(v)&&l.a0()?v:yield this.readImageNow(v),M={type:this.type,uid:t.uid,source:this.id,rawImageData:T,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:M}),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(p){if(delete t.abortController,t.aborted)t.state="unloaded";else if(p)throw t.state="errored",p}}))}readImageNow(t){return l._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&l.a1()){let o=t.width+2,h=t.height+2;try{return new l.R({width:o,height:h},yield l.a2(t,-1,-1,o,h))}catch{}}return de.getImageData(t,1)}))}_getNeighboringTiles(t){let o=t.canonical,h=Math.pow(2,o.z),p=(o.x-1+h)%h,v=o.x===0?t.wrap-1:t.wrap,T=(o.x+1+h)%h,M=o.x+1===h?t.wrap+1:t.wrap,C={};return C[new l.a3(t.overscaledZ,v,o.z,p,o.y).key]={backfilled:!1},C[new l.a3(t.overscaledZ,M,o.z,T,o.y).key]={backfilled:!1},o.y>0&&(C[new l.a3(t.overscaledZ,v,o.z,p,o.y-1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,t.wrap,o.z,o.x,o.y-1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,M,o.z,T,o.y-1).key]={backfilled:!1}),o.y+1<h&&(C[new l.a3(t.overscaledZ,v,o.z,p,o.y+1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,t.wrap,o.z,o.x,o.y+1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,M,o.z,T,o.y+1).key]={backfilled:!1}),C}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function Ri(g,t){return t?g.properties[t]:g.id}function pn(g,t){let o={id:g.id};if(t.removeAllProperties&&(delete g.removeProperties,delete g.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let h of t.removeProperties){let p=g.addOrUpdateProperties.findIndex((v=>v.key===h));p>-1&&g.addOrUpdateProperties.splice(p,1)}return(g.removeAllProperties||t.removeAllProperties)&&(o.removeAllProperties=!0),(g.removeProperties||t.removeProperties)&&(o.removeProperties=[...g.removeProperties||[],...t.removeProperties||[]]),(g.addOrUpdateProperties||t.addOrUpdateProperties)&&(o.addOrUpdateProperties=[...g.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(g.newGeometry||t.newGeometry)&&(o.newGeometry=t.newGeometry||g.newGeometry),o}function la(g){var t,o;if(!g)return{};let h={};return h.removeAll=g.removeAll,h.remove=new Set(g.remove||[]),h.add=new Map((t=g.add)===null||t===void 0?void 0:t.map((p=>[p.id,p]))),h.update=new Map((o=g.update)===null||o===void 0?void 0:o.map((p=>[p.id,p]))),h}function Ht(g){return g&&g.length!==0?typeof g[0]=="number"?[g]:g.flatMap((t=>Ht(t))):[]}function Mn(g){return g.type==="GeometryCollection"?g.geometries.flatMap((t=>Mn(t))):Ht(g.coordinates)}function wr(g){let t=new tt,o;switch(g.type){case"FeatureCollection":o=g.features.flatMap((h=>Mn(h.geometry)));break;case"Feature":o=Mn(g.geometry);break;default:o=Mn(g)}if(o.length===0)return t;for(let h of o){let[p,v]=h;t.extend([p,v])}return t}class Ya extends l.E{constructor(t,o,h,p){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:o.data},this.actor=h.getActor(),this.setEventedParent(p),this._data=typeof o.data=="string"?{url:o.data}:{geojson:o.data},this._options=l.e({},o),this._collectResourceTiming=o.collectResourceTiming,o.maxzoom!==void 0&&(this.maxzoom=o.maxzoom),o.type&&(this.type=o.type),o.attribution&&(this.attribution=o.attribution),this.promoteId=o.promoteId,o.clusterMaxZoom!==void 0&&this.maxzoom<=o.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${o.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(o.buffer!==void 0?o.buffer:128),tolerance:this._pixelsToTileUnits(o.tolerance!==void 0?o.tolerance:.375),extent:l.a6,maxZoom:this.maxzoom,lineMetrics:o.lineMetrics||!1,generateId:o.generateId||!1,promoteId:typeof o.promoteId=="string"?o.promoteId:void 0,cluster:o.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(o.clusterMaxZoom),minPoints:Math.max(2,o.clusterMinPoints||2),extent:l.a6,radius:this._pixelsToTileUnits(o.clusterRadius||50),log:!1,generateId:o.generateId||!1}},clusterProperties:o.clusterProperties,filter:o.filter},o.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(l.a6/this.tileSize)}_getClusterMaxZoom(t){let o=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||l.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${o}"`),o}load(){return l._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,o){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};let h=this._updateWorkerData();return o?h:this}updateData(t,o){this._pendingWorkerUpdate.diff=(function(p,v){if(!p)return v||{};if(!v)return p||{};let T=la(p),M=la(v);(function(z,P){P.removeAll&&(z.add.clear(),z.update.clear(),z.remove.clear(),P.remove.clear());for(let k of P.remove)z.add.delete(k),z.update.delete(k);for(let[k,L]of P.update){let N=z.update.get(k);N&&(P.update.set(k,pn(N,L)),z.update.delete(k))}})(T,M);let C={};if((T.removeAll||M.removeAll)&&(C.removeAll=!0),C.remove=new Set([...T.remove,...M.remove]),C.add=new Map([...T.add,...M.add]),C.update=new Map([...T.update,...M.update]),C.remove.size&&C.add.size)for(let z of C.add.keys())C.remove.delete(z);return(function(z){let P={};return z.removeAll&&(P.removeAll=z.removeAll),z.remove&&(P.remove=Array.from(z.remove)),z.add&&(P.add=Array.from(z.add.values())),z.update&&(P.update=Array.from(z.update.values())),P})(C)})(this._pendingWorkerUpdate.diff,t);let h=this._updateWorkerData();return o?h:this}getData(){return l._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return l._(this,void 0,void 0,(function*(){return wr(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,o,h){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:o,offset:h}})}_updateWorkerData(){return l._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void l.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:o,updateCluster:h}=this._pendingWorkerUpdate,p=this._getLoadGeoJSONParameters(t,o,h);t!==void 0?this._pendingWorkerUpdate.data=void 0:o?this._pendingWorkerUpdate.diff=void 0:h&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(p)}))}_getLoadGeoJSONParameters(t,o,h){return l._(this,void 0,void 0,(function*(){let p=l.e({type:this.type},this.workerOptions);return typeof t=="string"?(p.request=yield this.map._requestManager.transformRequest(de.resolveURL(t),"Source"),p.request.collectResourceTiming=this._collectResourceTiming,p):t!==void 0?(p.data=t,p):o?(p.dataDiff=o,p):h?(p.updateCluster=!0,p):void 0}))}_dispatchWorkerUpdate(t){return l._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new l.n("dataloading",{dataType:"source"}));try{let o=yield t,h=yield this.actor.sendAsync({type:"LD",data:o});if(this._isUpdatingWorker=!1,this._removed||h.abandoned)return void this.fire(new l.n("dataabort",{dataType:"source"}));h.data&&(this._data={geojson:h.data});let p=this._applyDiffToSource(o.dataDiff),v=this._getShouldReloadTileOptions(p),T={dataType:"source"};this._applyResourceTiming(T,h),this.fire(new l.n("data",Object.assign(Object.assign({},T),{sourceDataType:"metadata"}))),this.fire(new l.n("data",Object.assign(Object.assign({},T),{sourceDataType:"content",shouldReloadTileOptions:v})))}catch(o){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new l.n("dataabort",{dataType:"source"}));this.fire(new l.l(l.d(o)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,o){var h;if(!this._collectResourceTiming)return;let p=(h=o.resourceTiming)===null||h===void 0?void 0:h[this.id];if(!p)return;let v=p.slice(0);v?.length&&l.e(t,{resourceTiming:v})}_applyDiffToSource(t){if(!t)return;let o=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let p=(function(v,T){let M=new Map;if(v==null||v.type==null)return M;if(v.type==="Feature"){let C=Ri(v,T);return C==null?void 0:(M.set(C,v),M)}if(v.type==="FeatureCollection"){let C=new Set;for(let z of v.features){let P=Ri(z,T);if(P==null||C.has(P))return;C.add(P),M.set(P,z)}return M}})(this._data.geojson,o);if(!p)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:p}}if(!this._data.updateable)return;let h=(function(p,v,T){var M,C;let z=[];if(v.removeAll)p.clear();else if(v.remove)for(let P of v.remove){let k=p.get(P);k&&(z.push(k.geometry),p.delete(P))}if(v.add)for(let P of v.add){let k=Ri(P,T);if(k==null)continue;let L=p.get(k);L&&z.push(L.geometry),z.push(P.geometry),p.set(k,P)}if(v.update)for(let P of v.update){let k=p.get(P.id);if(!k)continue;let L=!!P.newGeometry,N=P.removeAllProperties||((M=P.removeProperties)===null||M===void 0?void 0:M.length)>0||((C=P.addOrUpdateProperties)===null||C===void 0?void 0:C.length)>0;if(!L&&!N)continue;z.push(k.geometry);let G=Object.assign({},k);if(p.set(P.id,G),L&&(z.push(P.newGeometry),G.geometry=P.newGeometry),N){if(G.properties=P.removeAllProperties?{}:Object.assign({},G.properties||{}),P.removeProperties)for(let $ of P.removeProperties)delete G.properties[$];if(P.addOrUpdateProperties)for(let{key:$,value:J}of P.addOrUpdateProperties)G.properties[$]=J}}return z})(this._data.updateable,t,o);return t.removeAll||this._options.cluster?void 0:h}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((o=>wr(o)))}}shouldReloadTile(t,{affectedBounds:o}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;let{buffer:h,extent:p}=this.workerOptions.geojsonVtOptions,v=(function({x:T,y:M,z:C},z=0){let P=l.a4((T-z)/Math.pow(2,C)),k=l.a5((M+1+z)/Math.pow(2,C)),L=l.a4((T+1+z)/Math.pow(2,C)),N=l.a5((M-z)/Math.pow(2,C));return new tt([P,k],[L,N])})(t.tileID.canonical,h/p);for(let T of o)if(v.intersects(T))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.actor?"RT":"LT";t.actor=this.actor;let h={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;let p=yield this.actor.sendAsync({type:o,data:h},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(p,this.map.painter,o==="RT")}))}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Tr extends l.E{constructor(t,o,h,p){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=h,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(p),this.options=o}load(t){return l._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new l.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let o=yield Ne.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,o?.data&&(this.image=o.data,t&&(this.coordinates=t),this._finishLoading())}catch(o){this._request=null,this._loaded=!0,l.$(o)||this.fire(new l.l(l.d(o)))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;let o=t.map(l.a7.fromLngLat);var h;return this.tileID=(function(p){let v=l.a8.fromPoints(p),T=v.width(),M=v.height(),C=Math.max(T,M),z=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),P=Math.pow(2,z);return new l.aa(z,Math.floor((v.minX+v.maxX)/2*P),Math.floor((v.minY+v.maxY)/2*P))})(o),this.terrainTileRanges=this._getOverlappingTileRanges(o),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=o.map((p=>this.tileID.getTilePoint(p)._round())),this.flippedWindingOrder=((h=this.tileCoords)[1].x-h[0].x)*(h[2].y-h[0].y)-(h[1].y-h[0].y)*(h[2].x-h[0].x)<0,this.fire(new l.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,o=t.gl;this.texture||(this.texture=new l.T(t,this.image,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let h=!1;for(let p in this.tiles){let v=this.tiles[p];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,h=!0)}h&&this.fire(new l.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return l._(this,void 0,void 0,(function*(){var o;!((o=this.tileID)===null||o===void 0)&&o.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:o,minY:h,maxX:p,maxY:v}=l.a8.fromPoints(t),T={};for(let M=0;M<=l.a9;M++){let C=Math.pow(2,M),z=Math.floor(o*C),P=Math.floor(h*C),k=Math.floor(p*C),L=Math.floor(v*C),N=(z%C+C)%C,G=k%C,$=Math.floor(z/C),J=Math.floor(k/C);T[M]={minWrap:$,maxWrap:J,minTileXWrapped:N,maxTileXWrapped:G,minTileY:P,maxTileY:L}}return T}}class Ur extends Tr{constructor(t,o,h,p){super(t,o,h,p),this._onPlayingHandler=()=>{var v;(v=this.map)===null||v===void 0||v.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=o}load(){return l._(this,void 0,void 0,(function*(){this._loaded=!1;let t=this.options;this.urls=[];for(let o of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(o,"Source")).url);try{let o=yield l.ab(this.urls);if(this._loaded=!0,!o)return;this.video=o,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(o){this.fire(new l.l(l.d(o)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let o=this.video.seekable;t<o.start(0)||t>o.end(0)?this.fire(new l.l(new l.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${o.start(0)} and ${o.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let t=this.map.painter.context,o=t.gl;this.texture?this.video.paused||(this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,this.video)):(this.texture=new l.T(t,this.video,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let h=!1;for(let p in this.tiles){let v=this.tiles[p];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,h=!0)}h&&this.fire(new l.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Il extends Tr{constructor(t,o,h,p){super(t,o,h,p),o.coordinates?Array.isArray(o.coordinates)&&o.coordinates.length===4&&!o.coordinates.some((v=>!Array.isArray(v)||v.length!==2||v.some((T=>typeof T!="number"))))||this.fire(new l.l(new l.ac(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.l(new l.ac(`sources.${t}`,null,'missing required property "coordinates"'))),o.animate&&typeof o.animate!="boolean"&&this.fire(new l.l(new l.ac(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),o.canvas?typeof o.canvas=="string"||o.canvas instanceof HTMLCanvasElement||this.fire(new l.l(new l.ac(`sources.${t}`,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 l.l(new l.ac(`sources.${t}`,null,'missing required property "canvas"'))),this.options=o,this.animate=o.animate===void 0||o.animate}load(){return l._(this,void 0,void 0,(function*(){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 l.l(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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let o=this.map.painter.context,h=o.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new l.T(o,this.canvas,h.RGBA,{premultiply:!0}),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let p=!1;for(let v in this.tiles){let T=this.tiles[v];T.state!=="loaded"&&(T.state="loaded",T.texture=this.texture,p=!0)}p&&this.fire(new l.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}let kl={},Ms=g=>{switch(g){case"geojson":return Ya;case"image":return Tr;case"raster":return Fi;case"raster-dem":return di;case"vector":return Wt;case"video":return Ur;case"canvas":return Il}return kl[g]},Eo="RTLPluginLoaded";class $c extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ri()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((o=>{throw this.status="error",o}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return l._(this,arguments,void 0,(function*(o,h=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=de.resolveURL(o),!this.url)throw new Error(`requested url ${o} is invalid`);if(this.status==="unavailable"){if(!h)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return l._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.n(Eo))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Co=null;function Vr(){return Co||(Co=new $c),Co}var jr,fn;(function(g){g[g.Base=0]="Base",g[g.Parent=1]="Parent"})(jr||(jr={})),(function(g){g[g.Departing=0]="Departing",g[g.Incoming=1]="Incoming"})(fn||(fn={}));class Lt{constructor(t,o){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=l.ad(),this.uses=0,this.tileSize=o,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:o,fadingParentID:h,fadeEndTime:p}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=o,this.fadingParentID=h,this.fadeEndTime=p}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=ce(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,o,h){if(t?.etagUnmodified!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(p,v){let T={};if(!v)return T;for(let M of p){let C=M.layerIds.map((z=>v.getLayer(z))).filter(Boolean);if(C.length!==0){M.layers=C,M.stateDependentLayerIds&&(M.stateDependentLayers=M.stateDependentLayerIds.map((z=>C.filter((P=>P.id===z))[0])));for(let z of C)T[z.id]=M}}return T})(t.buckets,o?.style),this.hasSymbolBuckets=!1;for(let p in this.buckets){let v=this.buckets[p];if(v instanceof l.af){if(this.hasSymbolBuckets=!0,!h)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let p in this.buckets){let v=this.buckets[p];if(v instanceof l.af&&v.hasRTLText){this.hasRTLText=!0,Vr().lazyLoad();break}}this.queryPadding=0;for(let p in this.buckets){let v=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(p).queryRadius(v))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new l.ae;else this.state="loaded"}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let h in this.buckets){let p=this.buckets[h];p.uploadPending()&&p.upload(t)}let o=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l.T(t,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l.T(t,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,o,h,p,v,T,M,C,z,P,k){var L;return!((L=this.latestFeatureIndex)===null||L===void 0)&&L.rawTileData?this.latestFeatureIndex.query({queryGeometry:p,cameraQueryGeometry:v,scale:T,tileSize:this.tileSize,pixelPosMatrix:P,transform:C,params:M,queryPadding:this.queryPadding*z,getElevation:k},t,o,h):{}}querySourceFeatures(t,o){let h=this.latestFeatureIndex;if(!h?.rawTileData)return;let p=h.loadVTLayers(),v=o?.sourceLayer?o.sourceLayer:"",T=p[l.ag]||p[v];if(!T)return;let M=l.ah(o?.filter,o?.globalState),{z:C,x:z,y:P}=this.tileID.canonical,k={z:C,x:z,y:P};for(let L=0;L<T.length;L++){let N=T.feature(L);if(M.needGeometry){let J=l.ai(N,!0);if(!M.filter(new l.J(this.tileID.overscaledZ),J,this.tileID.canonical))continue}else if(!M.filter(new l.J(this.tileID.overscaledZ),N))continue;let G=h.getId(N,v),$=new l.aj(N,C,z,P,G);$.tile=k,t.push($)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let o=this.expirationTime;if(t.cacheControl){let h=l.ak(t.cacheControl);h["max-age"]&&(this.expirationTime=Date.now()+1e3*h["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let h=Date.now(),p=!1;if(this.expirationTime>h)p=!1;else if(o)if(this.expirationTime<o)p=!0;else{let v=this.expirationTime-o;v?this.expirationTime=h+Math.max(v,3e4):p=!0}else p=!0;p?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,o){var h,p,v;if(!(!((h=this.latestFeatureIndex)===null||h===void 0)&&h.rawTileData)||Object.keys(t).length===0)return;let T=this.latestFeatureIndex.loadVTLayers();for(let M in this.buckets){if(!o.style.hasLayer(M))continue;let C=this.buckets[M],z=C.layers[0].sourceLayer||l.ag,P=T[z],k=t[z];if(!P||!k||Object.keys(k).length===0)continue;C.update(k,P,((p=this.imageAtlas)===null||p===void 0?void 0:p.patternPositions)||{},this.dashPositions||{});let L=(v=o?.style)===null||v===void 0?void 0:v.getLayer(M);L&&(this.queryPadding=Math.max(this.queryPadding,L.queryRadius(C)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ce()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=ce()+t}setDependencies(t,o){let h={};for(let p of o)h[p]=!0;this.dependencies[t]=h}hasDependency(t,o){for(let h of t){let p=this.dependencies[h];if(p){for(let v of o)if(p[v])return!0}}return!1}}class Ni{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,o,h){var p,v,T,M,C;let z=String(o);if((M=this.stateChanges)[t]||(M[t]={}),(C=this.stateChanges[t])[z]||(C[z]={}),l.e(this.stateChanges[t][z],h),this.deletedStates[t]===null){this.deletedStates[t]={};for(let P in this.state[t])P!==z&&(this.deletedStates[t][P]=null)}else if(((p=this.deletedStates[t])===null||p===void 0?void 0:p[z])===null){this.deletedStates[t][z]={};for(let P in this.state[t][z])h[P]||(this.deletedStates[t][z][P]=null)}else for(let P in h)((T=(v=this.deletedStates[t])===null||v===void 0?void 0:v[z])===null||T===void 0?void 0:T[P])===null&&delete this.deletedStates[t][z][P]}removeFeatureState(t,o,h){var p,v,T;if(this.deletedStates[t]===null)return;let M=String(o);if((v=this.deletedStates)[t]||(v[t]={}),h&&o!==void 0)this.deletedStates[t][M]!==null&&((T=this.deletedStates[t])[M]||(T[M]={}),this.deletedStates[t][M][h]=null);else if(o!==void 0)if(!((p=this.stateChanges[t])===null||p===void 0)&&p[M])for(h in this.deletedStates[t][M]={},this.stateChanges[t][M])this.deletedStates[t][M][h]=null;else this.deletedStates[t][M]=null;else this.deletedStates[t]=null}getState(t,o){let h=String(o),p=l.e({},(this.state[t]||{})[h],(this.stateChanges[t]||{})[h]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let v=this.deletedStates[t][o];if(v===null)return{};for(let T in v)delete p[T]}return p}initializeTileState(t,o){t.setFeatureState(this.state,o)}coalesceChanges(t,o){var h,p,v;let T={};for(let M in this.stateChanges){(h=this.state)[M]||(h[M]={});let C={};for(let z in this.stateChanges[M])(p=this.state[M])[z]||(p[z]={}),l.e(this.state[M][z],this.stateChanges[M][z]),C[z]=this.state[M][z];T[M]=C}for(let M in this.deletedStates){(v=this.state)[M]||(v[M]={});let C={};if(this.deletedStates[M]===null)for(let z in this.state[M])C[z]={},this.state[M][z]={};else for(let z in this.deletedStates[M]){if(this.deletedStates[M][z]===null)this.state[M][z]={};else for(let P of Object.keys(this.deletedStates[M][z]))delete this.state[M][z][P];C[z]=this.state[M][z]}T[M]||(T[M]={}),l.e(T[M],C)}this.stateChanges={},this.deletedStates={},Object.keys(T).length!==0&&(this.revision++,t.setFeatureState(T,o))}}let mn=89.25;function Et(g,t){let o=l.al(t.lat,-l.am,l.am);return new l.P(l.Z(t.lng)*g,l.Y(o)*g)}function Ii(g,t){return new l.a7(t.x/g,t.y/g).toLngLat()}function ca(g){return g.cameraToCenterDistance*Math.min(.85*Math.tan(l.an(90-g.pitch)),Math.tan(l.an(mn-g.pitch)))}function Wa(g,t){let o=g.canonical,h=t/l.ao(o.z),p=o.x+Math.pow(2,o.z)*g.wrap,v=l.ap(new Float64Array(16));return l.Q(v,v,[p*h,o.y*h,0]),l.S(v,v,[h/l.a6,h/l.a6,1]),v}function Ka(g,t,o,h,p){let v=l.a7.fromLngLat(g,t),T=p*l.aq(1,g.lat),{x:M,y:C,z}=Ao(o,h);return new l.a7(v.x+T*-M,v.y+T*-C,v.z+T*-z)}function Ao(g,t){let o=l.an(g),h=l.an(t),p=Math.cos(-o),v=Math.sin(o);return{x:v*Math.sin(h),y:-v*Math.cos(h),z:p}}function Ce(g,t,o){let h=t.intersectsFrustum(g);if(!o||h===0)return h;let p=t.intersectsPlane(o);return p===0?0:h===2&&p===2?2:1}function od(g,t,o){let h=0,p=(o-t)/10;for(let v=0;v<10;v++)h+=p*Math.pow(Math.cos(t+(v+.5)/10*(o-t)),g);return h}function sd(g,t){return function(o,h,p,v,T){let M=2*((g-1)/l.ar(Math.cos(l.an(mn-T))/Math.cos(l.an(mn)))-1),C=Math.acos(p/v),z=2*od(M-1,0,l.an(T/2)),P=Math.min(l.an(mn),C+l.an(T/2)),k=od(M-1,Math.min(P,C-l.an(T/2)),P),L=Math.atan(h/p),N=Math.hypot(h,p),G=o;return G+=l.ar(v/N/Math.max(.5,Math.cos(l.an(T/2)))),G+=M*l.ar(Math.cos(L))/2,G-=l.ar(Math.max(1,k/z/t))/2,G}}let Ot=sd(9.314,3);function Jn(g,t){let o=(t.roundZoom?Math.round:Math.floor)(g.zoom+l.ar(g.tileSize/t.tileSize));return Math.max(0,o)}function zo(g,t){let o=g.getCameraFrustum(),h=g.getClippingPlane(),p=g.screenPointToMercatorCoordinate(g.getCameraPoint()),v=l.a7.fromLngLat(g.center,g.elevation);p.z=v.z+Math.cos(g.pitchInRadians)*g.cameraToCenterDistance/g.worldSize;let T=g.getCoveringTilesDetailsProvider(),M=T.allowVariableZoom(g,t),C=Jn(g,t),z=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:g.maxZoom,k=Math.min(Math.max(0,C),P),L=Math.pow(2,k),N=[L*p.x,L*p.y,0],G=[L*v.x,L*v.y,0],$=Math.hypot(v.x-p.x,v.y-p.y),J=Math.abs(v.z-p.z),W=Math.hypot($,J),ee=Q=>({zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),ae=[],te=[];if(g.renderWorldCopies&&T.allowWorldCopies())for(let Q=1;Q<=3;Q++)ae.push(ee(-Q)),ae.push(ee(Q));for(ae.push(ee(0));ae.length>0;){let Q=ae.pop(),re=Q.x,ie=Q.y,me=Q.fullyVisible,Te={x:re,y:ie,z:Q.zoom},Se=T.getTileBoundingVolume(Te,Q.wrap,g.elevation,t);if(!me){let je=Ce(o,Se,h);if(je===0)continue;me=je===2}let Pe=T.distanceToTile2d(p.x,p.y,Te,Se),De=C;M&&(De=(t.calculateTileZoom||Ot)(g.zoom+l.ar(g.tileSize/t.tileSize),Pe,J,W,g.fov)),De=(t.roundZoom?Math.round:Math.floor)(De),De=Math.max(0,De);let Qe=Math.min(De,P);if(Q.wrap=T.getWrap(v,Te,Q.wrap),Q.zoom>=Qe){if(Q.zoom<z)continue;let je=k-Q.zoom,Ae=N[0]-.5-(re<<je),$e=N[1]-.5-(ie<<je),et=t.reparseOverscaled?Math.max(Q.zoom,De):Q.zoom;te.push({tileID:new l.a3(Q.zoom===P?et:Q.zoom,Q.wrap,Q.zoom,re,ie),distanceSq:l.as([G[0]-.5-re,G[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Ae*Ae+$e*$e)})}else for(let je=0;je<4;je++)ae.push({zoom:Q.zoom+1,x:(re<<1)+je%2,y:(ie<<1)+(je>>1),wrap:Q.wrap,fullyVisible:me})}return te.sort(((Q,re)=>Q.distanceSq-re.distanceSq)).map((Q=>Q.tileID))}let Bf=l.a8.fromPoints([new l.P(0,0),new l.P(l.a6,l.a6)]);function Ff(g){return g==="raster"||g==="image"||g==="video"}function s1(g,t,o,h,p,v,T){if(!t.hasData())return!1;let{tileID:M,fadingRole:C,fadingDirection:z,fadingParentID:P}=t;if(C===jr.Base&&z===fn.Incoming&&P)return o[P.key]=P,!0;let k=Math.max(M.overscaledZ-p,v);for(let L=M.overscaledZ-1;L>=k;L--){let N=M.scaledTo(L),G=g.getLoadedTile(N);if(G)return t.setCrossFadeLogic({fadingRole:jr.Base,fadingDirection:fn.Incoming,fadingParentID:G.tileID,fadeEndTime:h+T}),G.setCrossFadeLogic({fadingRole:jr.Parent,fadingDirection:fn.Departing,fadeEndTime:h+T}),o[N.key]=N,!0}return!1}function Xc(g,t,o,h,p,v){if(!t.hasData())return!1;let T=t.tileID.children(p),M=ld(g,t,T,o,h,p,v);if(M)return!0;for(let C of T)ld(g,t,C.children(p),o,h,p,v)&&(M=!0);return M}function ld(g,t,o,h,p,v,T){if(o[0].overscaledZ>=v)return!1;let M=!1;for(let C of o){let z=g.getLoadedTile(C);if(!z)continue;let{fadingRole:P,fadingDirection:k,fadingParentID:L}=z;P===jr.Base&&k===fn.Departing&&L||(z.setCrossFadeLogic({fadingRole:jr.Base,fadingDirection:fn.Departing,fadingParentID:t.tileID,fadeEndTime:p+T}),t.setCrossFadeLogic({fadingRole:jr.Parent,fadingDirection:fn.Incoming,fadeEndTime:p+T})),h[C.key]=C,M=!0}return M}function Nf(g,t,o,h){let p=g.tileID;return!!g.selfFading||!g.hasData()&&!!t.has(p)&&(g.setSelfFadeLogic(o+h),!0)}function Ue(g,t){var o;g.needsHillshadePrepare=!0,g.needsTerrainPrepare=!0;let h=t.tileID.canonical.x-g.tileID.canonical.x,p=t.tileID.canonical.y-g.tileID.canonical.y,v=Math.pow(2,g.tileID.canonical.z),T=t.tileID.key;h===0&&p===0||Math.abs(p)>1||(Math.abs(h)>1&&(Math.abs(h+v)===1?h+=v:Math.abs(h-v)===1&&(h-=v)),t.dem&&g.dem&&(g.dem.backfillBorder(t.dem,h,p),!((o=g.neighboringTiles)===null||o===void 0)&&o[T]&&(g.neighboringTiles[T].backfilled=!0)))}class Do{constructor(){this._tiles={}}handleWrapJump(t){let o={};for(let h in this._tiles){let p=this._tiles[h];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+t),o[p.tileID.key]=p}this._tiles=o}setFeatureState(t,o){for(let h in this._tiles)this._tiles[h].setFeatureState(t,o)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((o=>o.tileID)).sort(l.au).map((o=>o.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,o){this._tiles[t]=o}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let o=this.getTileById(t.key);return o?.hasData()?o:null}isIdRenderable(t,o=!1){var h;return(h=this.getTileById(t))===null||h===void 0?void 0:h.isRenderable(o)}getRenderableIds(t=0,o){let h=[];for(let p of this.getAllIds())this.isIdRenderable(p,o)&&h.push(this.getTileById(p));return o?h.sort(((p,v)=>{let T=p.tileID,M=v.tileID,C=new l.P(T.canonical.x,T.canonical.y)._rotate(-t),z=new l.P(M.canonical.x,M.canonical.y)._rotate(-t);return T.overscaledZ-M.overscaledZ||z.y-C.y||z.x-C.x})).map((p=>p.tileID.key)):h.map((p=>p.tileID)).sort(l.au).map((p=>p.key))}}class gn extends l.E{constructor(t,o,h){super(),this.id=t,this.dispatcher=h,this.on("data",(p=>{this._dataHandler(p)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((p,v,T,M)=>{let C=new(Ms(v.type))(p,v,T,M);if(C.id!==p)throw new Error(`Expected Source id to be ${p} instead of ${C.id}`);return C})(t,o,h,this),this._inViewTiles=new Do,this._outOfViewCache=new l.av(0,(p=>this._unloadTile(p))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Ni,this._didEmitContent=!1,this._updated=!1}onAdd(t){var o;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,!((o=this._source)===null||o===void 0)&&o.onAdd&&this._source.onAdd(t)}onRemove(t){var o;for(let h of this._inViewTiles.getAllTiles())h.unloadVectorData();this.clearTiles(),!((o=this._source)===null||o===void 0)&&o.onRemove&&this._source.onRemove(t),this._inViewTiles=new Do}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,o,h){return l._(this,void 0,void 0,(function*(){try{let p=yield this._source.loadTile(t);this._tileLoaded(t,o,h,p)}catch(p){t.state="errored",p.status!==404?this._source.fire(new l.l(l.d(p),{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new l.n("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let o of this._inViewTiles.getAllTiles())o.upload(t),o.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var o;return this._inViewTiles.getRenderableIds((o=this.transform)===null||o===void 0?void 0:o.bearingInRadians,t)}hasRenderableParent(t){let o=t.overscaledZ-1;if(o>=this._source.minzoom){let h=this.getLoadedTile(t.scaledTo(o));if(h)return this._inViewTiles.isIdRenderable(h.tileID.key)}return!1}reload(t,o=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let h of this._inViewTiles.getAllIds()){let p=this._inViewTiles.getTileById(h);o&&!this._source.shouldReloadTile(p,o)||(t?this._reloadTile(h,"expired"):p.state!=="errored"&&this._reloadTile(h,"reloading"))}}}_reloadTile(t,o){return l._(this,void 0,void 0,(function*(){let h=this._inViewTiles.getTileById(t);h&&(h.state!=="loading"&&(h.state=o),yield this._loadTile(h,t,o))}))}_tileLoaded(t,o,h,p){t.timeAdded=ce(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),h==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),p?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(v,T){var M,C,z;let P=T.getRenderableIds();for(let k of P){if(!(!((M=v.neighboringTiles)===null||M===void 0)&&M[k]))continue;let L=T.getTileById(k);v.neighboringTiles[k].backfilled||Ue(v,L),!((z=(C=L.neighboringTiles)===null||C===void 0?void 0:C[v.tileID.key])===null||z===void 0)&&z.backfilled||Ue(L,v)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.n("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,o){let h=this._getLoadedDescendents(o),p=new Set;for(let v of o){let T=h[v.key];if(!T?.length){p.add(v);continue}let M=v.overscaledZ+gn.maxOverzooming,C=T.filter((k=>k.tileID.overscaledZ<=M));if(!C.length){p.add(v);continue}let z=Math.min(...C.map((k=>k.tileID.overscaledZ))),P=C.filter((k=>k.tileID.overscaledZ===z)).map((k=>k.tileID));for(let k of P)t[k.key]=k;this._areDescendentsComplete(P,z,v.overscaledZ)||p.add(v)}return p}_getLoadedDescendents(t){var o;let h={};for(let p of this._inViewTiles.getAllTiles().filter((v=>v.hasData())))for(let v of t)p.tileID.isChildOf(v)&&(h[o=v.key]||(h[o]=[]),h[v.key].push(p));return h}_areDescendentsComplete(t,o,h){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===o:Math.pow(4,o-h)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let o=Math.ceil(t.width/this._source.tileSize)+1,h=Math.ceil(t.height/this._source.tileSize)+1,p=Math.floor(o*h*(this._maxTileCacheZoomLevels===null?l.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,p):p;this._outOfViewCache.setMaxSize(v)}handleWrapJump(t){let o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,o&&(this._inViewTiles.handleWrapJump(o),this._resetTileReloadTimers())}update(t,o){if(!this._sourceLoaded||this._paused)return;let h;this.transform=t,this.terrain=o,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?h=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((C=>new l.a3(C.canonical.z,C.wrap,C.canonical.z,C.canonical.x,C.canonical.y))):(h=zo(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:o,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(h=h.filter((C=>this._source.hasTile(C))))):h=[],this.usedForTerrain&&(h=this._addTerrainIdealTiles(h));let p=h.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,p&&this.fire(new l.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let v=Jn(t,this._source),T=this._updateRetainedTiles(h,v),M=Ff(this._source.type);M&&this._rasterFadeDuration>0&&!o&&(function(C,z,P,k,L,N,G){let $=ce(),J=l.at(z);for(let W of z){let ee=C.getTileById(W.key);ee.fadingDirection!==fn.Departing&&ee.fadeOpacity!==0||ee.resetFadeLogic(),s1(C,ee,P,$,k,L,G)||Xc(C,ee,P,$,N,G)||Nf(ee,J,$,G)||ee.resetFadeLogic()}})(this._inViewTiles,h,T,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),M?this._cleanUpRasterTiles(T):this._cleanUpVectorTiles(T)}_cleanUpRasterTiles(t){for(let o of this._inViewTiles.getAllIds())t[o]||this._removeTile(o)}_cleanUpVectorTiles(t){for(let o of this._inViewTiles.getAllIds()){let h=this._inViewTiles.getTileById(o);t[o]?h.clearSymbolFadeHold():h.hasSymbolBuckets?h.holdingForSymbolFade()?h.symbolFadeFinished()&&this._removeTile(o):h.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(o)}}_addTerrainIdealTiles(t){let o=[];for(let h of t)if(h.canonical.z>this._source.minzoom){let p=h.scaledTo(h.canonical.z-1);o.push(p);let v=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));o.push(v)}return t.concat(o)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,o){var h;let p=new Set;for(let z of t)this._addTile(z).hasData()||p.add(z);let v=t.reduce(((z,P)=>(z[P.key]=P,z)),{}),T=this._retainLoadedChildren(v,p),M={},C=Math.max(o-gn.maxUnderzooming,this._source.minzoom);for(let z of T){let P=this._inViewTiles.getTileById(z.key),k=P?.wasRequested();for(let L=z.overscaledZ-1;L>=C;--L){let N=z.scaledTo(L);if(M[N.key])break;if(M[N.key]=!0,P=this.getTile(N),!P&&k&&(P=this._addTile(N)),P){let G=P.hasData();if((G||!(!((h=this.map)===null||h===void 0)&&h.cancelPendingTileRequestsWhileZooming)||k)&&(v[N.key]=N),k=P.wasRequested(),G)break}}}return v}_addTile(t){let o=this._inViewTiles.getTileById(t.key);if(o)return o;o=this._outOfViewCache.getAndRemove(t),o&&(o.resetFadeLogic(),this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null));let h=o;return o||(o=new Lt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(o,t.key,o.state)),o.uses++,this._inViewTiles.setTile(t.key,o),h||this._source.fire(new l.n("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){this._clearTileReloadTimer(t);let h=o.getExpiryTimeout();h&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),h))}_clearTileReloadTimer(t){let o=this._timers[t];o&&(clearTimeout(o),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let o=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,o)}}refreshTiles(t){for(let o of this._inViewTiles.getAllIds()){let h=this._inViewTiles.getTileById(o);(this._inViewTiles.isIdRenderable(o)||h.state=="errored")&&t.some((p=>p.equals(h.tileID.canonical)))&&this._reloadTile(o,"expired")}}_removeTile(t){let o=this._inViewTiles.getTileById(t);o&&(o.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._outOfViewCache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,o,h){let p=[],v=this.transform;if(!v)return p;let T=v.getCoveringTilesDetailsProvider().allowWorldCopies(),M=h?v.getCameraQueryGeometry(t):t,C=N=>v.screenPointToMercatorCoordinate(N,this.terrain),z=this.transformBbox(t,C,!T),P=this.transformBbox(M,C,!T),k=this.getIds(),L=l.a8.fromPoints(P);for(let N of k){let G=this._inViewTiles.getTileById(N);if(G.holdingForSymbolFade())continue;let $=T?[G.tileID]:[G.tileID.unwrapTo(-1),G.tileID.unwrapTo(0)],J=Math.pow(2,v.zoom-G.tileID.overscaledZ),W=o*G.queryPadding*l.a6/G.tileSize/J;for(let ee of $){let ae=L.map((te=>ee.getTilePoint(new l.a7(te.x,te.y))));if(ae.expandBy(W),ae.intersects(Bf)){let te=z.map((re=>ee.getTilePoint(re))),Q=P.map((re=>ee.getTilePoint(re)));p.push({tile:G,tileID:T?ee:ee.unwrapTo(0),queryGeometry:te,cameraQueryGeometry:Q,scale:J})}}}return p}transformBbox(t,o,h){let p=t.map(o);if(h){let v=l.a8.fromPoints(t);v.shrinkBy(.001*Math.min(v.width(),v.height()));let T=v.map(o);l.a8.fromPoints(p).covers(T)||(p=p.map((M=>M.x>.5?new l.a7(M.x-1,M.y,M.z):M)))}return p}getVisibleCoordinates(t){let o=this.getRenderableIds(t).map((h=>this._inViewTiles.getTileById(h).tileID));return this.transform&&this.transform.populateCache(o),o}hasTransition(){return!!this._source.hasTransition()||Ff(this._source.type)&&(function(t,o){if(o<=0)return!1;let h=ce();for(let p of t.getAllTiles())if(p.fadeEndTime>=h)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,o,h){t||(t=l.ag),this._state.updateState(t,o,h)}removeFeatureState(t,o,h){t||(t=l.ag),this._state.removeFeatureState(t,o,h)}getFeatureState(t,o){return t||(t=l.ag),this._state.getState(t,o)}setDependencies(t,o,h){let p=this._inViewTiles.getTileById(t);p&&p.setDependencies(o,h)}reloadTilesForDependencies(t,o){for(let h of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(h).hasDependency(t,o)&&this._reloadTile(h,"reloading");this._outOfViewCache.filter((h=>!h.hasDependency(t,o)))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}gn.maxUnderzooming=10,gn.maxOverzooming=3;class cd{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.al(t,0,1);let o=1,h=this._distances[o],p=t*this.paddedLength+this.padding;for(;h<p&&o<this._distances.length;)h=this._distances[++o];let v=o-1,T=this._distances[v],M=h-T,C=M>0?(p-T)/M:0;return this.points[v].mult(1-C).add(this.points[o].mult(C))}}function Qa(g,t){let o=!0;return g==="always"||g!=="never"&&t!=="never"||(o=!1),o}class He{constructor(t,o,h){let p=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(t/h),this.yCellCount=Math.ceil(o/h);for(let T=0;T<this.xCellCount*this.yCellCount;T++)p.push([]),v.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,h,p,v){this._forEachCell(o,h,p,v,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(v)}insertCircle(t,o,h,p){this._forEachCell(o-p,h-p,o+p,h+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(h),this.circles.push(p)}_insertBoxCell(t,o,h,p,v,T){this.boxCells[v].push(T)}_insertCircleCell(t,o,h,p,v,T){this.circleCells[v].push(T)}_query(t,o,h,p,v,T,M){if(h<0||t>this.width||p<0||o>this.height)return[];let C=[];if(t<=0&&o<=0&&this.width<=h&&this.height<=p){if(v)return[{key:null,x1:t,y1:o,x2:h,y2:p}];for(let z=0;z<this.boxKeys.length;z++)C.push({key:this.boxKeys[z],x1:this.bboxes[4*z],y1:this.bboxes[4*z+1],x2:this.bboxes[4*z+2],y2:this.bboxes[4*z+3]});for(let z=0;z<this.circleKeys.length;z++){let P=this.circles[3*z],k=this.circles[3*z+1],L=this.circles[3*z+2];C.push({key:this.circleKeys[z],x1:P-L,y1:k-L,x2:P+L,y2:k+L})}}else this._forEachCell(t,o,h,p,this._queryCell,C,{hitTest:v,overlapMode:T,seenUids:{box:{},circle:{}}},M);return C}query(t,o,h,p){return this._query(t,o,h,p,!1,null)}hitTest(t,o,h,p,v,T){return this._query(t,o,h,p,!0,v,T).length>0}hitTestCircle(t,o,h,p,v){let T=t-h,M=t+h,C=o-h,z=o+h;if(M<0||T>this.width||z<0||C>this.height)return!1;let P=[];return this._forEachCell(T,C,M,z,this._queryCellCircle,P,{hitTest:!0,overlapMode:p,circle:{x:t,y:o,radius:h},seenUids:{box:{},circle:{}}},v),P.length>0}_queryCell(t,o,h,p,v,T,M,C){let{seenUids:z,hitTest:P,overlapMode:k}=M,L=this.boxCells[v],N=1e-6;if(L!==null){let $=this.bboxes;for(let J of L)if(!z.box[J]){z.box[J]=!0;let W=4*J,ee=this.boxKeys[J];if(t<=$[W+2]+N&&o<=$[W+3]+N&&h>=$[W+0]-N&&p>=$[W+1]-N&&(!C||C(ee))&&(!P||!Qa(k,ee.overlapMode))&&(T.push({key:ee,x1:$[W],y1:$[W+1],x2:$[W+2],y2:$[W+3]}),P))return!0}}let G=this.circleCells[v];if(G!==null){let $=this.circles;for(let J of G)if(!z.circle[J]){z.circle[J]=!0;let W=3*J,ee=this.circleKeys[J];if(this._circleAndRectCollide($[W],$[W+1],$[W+2],t,o,h,p)&&(!C||C(ee))&&(!P||!Qa(k,ee.overlapMode))){let ae=$[W],te=$[W+1],Q=$[W+2];if(T.push({key:ee,x1:ae-Q,y1:te-Q,x2:ae+Q,y2:te+Q}),P)return!0}}}return!1}_queryCellCircle(t,o,h,p,v,T,M,C){let{circle:z,seenUids:P,overlapMode:k}=M,L=this.boxCells[v];if(L!==null){let G=this.bboxes;for(let $ of L)if(!P.box[$]){P.box[$]=!0;let J=4*$,W=this.boxKeys[$];if(this._circleAndRectCollide(z.x,z.y,z.radius,G[J+0],G[J+1],G[J+2],G[J+3])&&(!C||C(W))&&!Qa(k,W.overlapMode))return T.push(!0),!0}}let N=this.circleCells[v];if(N!==null){let G=this.circles;for(let $ of N)if(!P.circle[$]){P.circle[$]=!0;let J=3*$,W=this.circleKeys[$];if(this._circlesCollide(G[J],G[J+1],G[J+2],z.x,z.y,z.radius)&&(!C||C(W))&&!Qa(k,W.overlapMode))return T.push(!0),!0}}}_forEachCell(t,o,h,p,v,T,M,C){let z=this._convertToXCellCoord(t),P=this._convertToYCellCoord(o),k=this._convertToXCellCoord(h),L=this._convertToYCellCoord(p);for(let N=z;N<=k;N++)for(let G=P;G<=L;G++)if(v.call(this,t,o,h,p,this.xCellCount*G+N,T,M,C))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,o,h,p,v,T){let M=p-t,C=v-o,z=h+T;return z*z>M*M+C*C}_circleAndRectCollide(t,o,h,p,v,T,M){let C=(T-p)/2,z=Math.abs(t-(p+C));if(z>C+h)return!1;let P=(M-v)/2,k=Math.abs(o-(v+P));if(k>P+h)return!1;if(z<=C||k<=P)return!0;let L=z-C,N=k-P;return L*L+N*N<=h*h}}function lt(g,t){let o=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),h=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),p=t[0]*o,v=t[4]*o,T=t[8]*h,M=t[1]*o,C=t[5]*o,z=t[9]*h,P=t[2]*o,k=t[6]*o,L=t[10]*h;g[0]=p,g[1]=v,g[2]=T,g[4]=M,g[5]=C,g[6]=z,g[8]=P,g[9]=k,g[10]=L;let N=t[12],G=t[13],$=t[14];return g[12]=-p*N-M*G-P*$,g[13]=-v*N-C*G-k*$,g[14]=-T*N-z*G-L*$,g[3]=0,g[7]=0,g[11]=0,g[15]=1,g}let pt=l.O();function sr(g,t,o){let h=l.O();if(!g){let{vecSouth:k,vecEast:L}=za(t),N=B();N[0]=L[0],N[1]=L[1],N[2]=k[0],N[3]=k[1],p=N,(P=(T=(v=N)[0])*(z=v[3])-(C=v[2])*(M=v[1]))&&(p[0]=z*(P=1/P),p[1]=-M*P,p[2]=-C*P,p[3]=T*P),h[0]=N[0],h[1]=N[1],h[4]=N[2],h[5]=N[3]}var p,v,T,M,C,z,P;return l.S(h,h,[1/o,1/o,1]),h}function Yc(g,t,o,h){if(g){let p=l.O();if(!t){let{vecSouth:v,vecEast:T}=za(o);p[0]=T[0],p[1]=T[1],p[4]=v[0],p[5]=v[1]}return l.S(p,p,[h,h,1]),p}return o.pixelsToClipSpaceMatrix}function za(g){let t=Math.cos(g.rollInRadians),o=Math.sin(g.rollInRadians),h=Math.cos(g.pitchInRadians),p=Math.cos(g.bearingInRadians),v=Math.sin(g.bearingInRadians),T=l.az();T[0]=-p*h*o-v*t,T[1]=-v*h*o+p*t;let M=l.aA(T);M<1e-9?l.aB(T):l.aC(T,T,1/M);let C=l.az();C[0]=p*h*t-v*o,C[1]=v*h*t+p*o;let z=l.aA(C);return z<1e-9?l.aB(C):l.aC(C,C,1/z),{vecEast:C,vecSouth:T}}function ut(g,t,o,h){let p;h?(p=[g,t,h(g,t),1],l.aE(p,p,o)):(p=[g,t,0,1],Qc(p,p,o));let v=p[3];return{point:new l.P(p[0]/v,p[1]/v),signedDistanceFromCamera:v,isOccluded:!1}}function Ll(g,t){return .5+g/t*.5}function Ol(g,t){return g.x>=-t[0]&&g.x<=t[0]&&g.y>=-t[1]&&g.y<=t[1]}function Wc(g,t,o,h,p,v,T,M,C,z,P,k,L){let N=o?g.textSizeData:g.iconSizeData,G=l.aw(N,t.transform.zoom),$=[256/t.width*2+1,256/t.height*2+1],J=o?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;J.clear();let W=g.lineVertexArray,ee=o?g.text.placedSymbolArray:g.icon.placedSymbolArray,ae=t.transform.width/t.transform.height,te=!1;for(let Q=0;Q<ee.length;Q++){let re=ee.get(Q);if(re.hidden||re.writingMode===l.ax.vertical&&!te){Ro(re.numGlyphs,J);continue}te=!1;let ie=new l.P(re.anchorX,re.anchorY),me={getElevation:L,pitchedLabelPlaneMatrix:h,lineVertexArray:W,pitchWithMap:v,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:ie,unwrappedTileID:C,width:z,height:P,translation:k},Te=As(re.anchorX,re.anchorY,me);if(!Ol(Te.point,$)){Ro(re.numGlyphs,J);continue}let Se=Ll(t.transform.cameraToCenterDistance,Te.signedDistanceFromCamera),Pe=l.ay(N,G,re),De=v?Pe*t.transform.getPitchedTextCorrection(re.anchorX,re.anchorY,C)/Se:Pe*Se,Qe=Cs({projectionContext:me,pitchedLabelPlaneMatrixInverse:p,symbol:re,fontSize:De,flip:!1,keepUpright:T,glyphOffsetArray:g.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ae,rotateToLine:M});te=Qe.useVertical,(Qe.notEnoughRoom||te||Qe.needsFlipping&&Cs({projectionContext:me,pitchedLabelPlaneMatrixInverse:p,symbol:re,fontSize:De,flip:!0,keepUpright:T,glyphOffsetArray:g.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ae,rotateToLine:M}).notEnoughRoom)&&Ro(re.numGlyphs,J)}o?g.text.dynamicLayoutVertexBuffer.updateData(J):g.icon.dynamicLayoutVertexBuffer.updateData(J)}function Es(g,t,o,h,p,v,T,M){let C=v.glyphStartIndex+v.numGlyphs,z=v.lineStartIndex,P=v.lineStartIndex+v.lineLength,k=t.getoffsetX(v.glyphStartIndex),L=t.getoffsetX(C-1),N=qr(g*k,o,h,p,v.segment,z,P,M,T);if(!N)return null;let G=qr(g*L,o,h,p,v.segment,z,P,M,T);return G?M.projectionCache.anyProjectionOccluded?null:{first:N,last:G}:null}function Bl(g,t,o,h){return g===l.ax.horizontal&&Math.abs(o.y-t.y)>Math.abs(o.x-t.x)*h?{useVertical:!0}:(g===l.ax.vertical?t.y<o.y:t.x>o.x)?{needsFlipping:!0}:null}function Cs(g){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:o,symbol:h,fontSize:p,flip:v,keepUpright:T,glyphOffsetArray:M,dynamicLayoutVertexArray:C,aspectRatio:z,rotateToLine:P}=g,k=p/24,L=h.lineOffsetX*k,N=h.lineOffsetY*k,G;if(h.numGlyphs>1){let $=h.glyphStartIndex+h.numGlyphs,J=h.lineStartIndex,W=h.lineStartIndex+h.lineLength,ee=Es(k,M,L,N,v,h,P,t);if(!ee)return{notEnoughRoom:!0};let ae=Kc(ee.first.point.x,ee.first.point.y,t,o),te=Kc(ee.last.point.x,ee.last.point.y,t,o);if(T&&!v){let Q=Bl(h.writingMode,ae,te,z);if(Q)return Q}G=[ee.first];for(let Q=h.glyphStartIndex+1;Q<$-1;Q++){let re=qr(k*M.getoffsetX(Q),L,N,v,h.segment,J,W,t,P);if(!re)return{notEnoughRoom:!0};G.push(re)}G.push(ee.last)}else{if(T&&!v){let J=Bt(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,W=h.lineStartIndex+h.segment+1,ee=new l.P(t.lineVertexArray.getx(W),t.lineVertexArray.gety(W)),ae=Bt(ee.x,ee.y,t),te=ae.signedDistanceFromCamera>0?ae.point:Fl(t.tileAnchorPoint,ee,J,1,t),Q=Kc(J.x,J.y,t,o),re=Kc(te.x,te.y,t,o),ie=Bl(h.writingMode,Q,re,z);if(ie)return ie}let $=qr(k*M.getoffsetX(h.glyphStartIndex),L,N,v,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,t,P);if(!$||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[$]}for(let $ of G)l.aD(C,$.point,$.angle);return{}}function Fl(g,t,o,h,p){let v=g.add(g.sub(t)._unit()),T=Bt(v.x,v.y,p).point,M=o.sub(T);return o.add(M._mult(h/M.mag()))}function _n(g,t,o){let h=t.projectionCache;if(h.projections[g])return h.projections[g];let p=new l.P(t.lineVertexArray.getx(g),t.lineVertexArray.gety(g)),v=Bt(p.x,p.y,t);if(v.signedDistanceFromCamera>0)return h.projections[g]=v.point,h.anyProjectionOccluded||(h.anyProjectionOccluded=v.isOccluded),v.point;let T=g-o.direction;return Fl(o.distanceFromAnchor===0?t.tileAnchorPoint:new l.P(t.lineVertexArray.getx(T),t.lineVertexArray.gety(T)),p,o.previousVertex,o.absOffsetX-o.distanceFromAnchor+1,t)}function Bt(g,t,o){let h=g+o.translation[0],p=t+o.translation[1],v;return o.pitchWithMap?(v=ut(h,p,o.pitchedLabelPlaneMatrix,o.getElevation),v.isOccluded=!1):(v=o.transform.projectTileCoordinates(h,p,o.unwrappedTileID,o.getElevation),v.point.x=(.5*v.point.x+.5)*o.width,v.point.y=(.5*-v.point.y+.5)*o.height),v}function Kc(g,t,o,h){if(o.pitchWithMap){let p=[g,t,0,1];return l.aE(p,p,h),o.transform.projectTileCoordinates(p[0]/p[3],p[1]/p[3],o.unwrappedTileID,o.getElevation).point}return{x:g/o.width*2-1,y:1-t/o.height*2}}function As(g,t,o){return o.transform.projectTileCoordinates(g,t,o.unwrappedTileID,o.getElevation)}function Nl(g,t,o){return g._unit()._perp()._mult(t*o)}function Po(g,t,o,h,p,v,T,M,C){if(M.projectionCache.offsets[g])return M.projectionCache.offsets[g];let z=o.add(t);if(g+C.direction<h||g+C.direction>=p)return M.projectionCache.offsets[g]=z,z;let P=_n(g+C.direction,M,C),k=Nl(P.sub(o),T,C.direction),L=o.add(k),N=P.add(k);return M.projectionCache.offsets[g]=l.aF(v,z,L,N)||z,M.projectionCache.offsets[g]}function qr(g,t,o,h,p,v,T,M,C){let z=h?g-t:g+t,P=z>0?1:-1,k=0;h&&(P*=-1,k=Math.PI),P<0&&(k+=Math.PI);let L,N=P>0?v+p:v+p+1;M.projectionCache.cachedAnchorPoint?L=M.projectionCache.cachedAnchorPoint:(L=Bt(M.tileAnchorPoint.x,M.tileAnchorPoint.y,M).point,M.projectionCache.cachedAnchorPoint=L);let G,$,J=L,W=L,ee=0,ae=0,te=Math.abs(z),Q=[],re;for(;ee+ae<=te;){if(N+=P,N<v||N>=T)return null;ee+=ae,W=J,$=G;let Te={absOffsetX:te,direction:P,distanceFromAnchor:ee,previousVertex:W};if(J=_n(N,M,Te),o===0)Q.push(W),re=J.sub(W);else{let Se,Pe=J.sub(W);Se=Pe.mag()===0?Nl(_n(N+P,M,Te).sub(J),o,P):Nl(Pe,o,P),$||($=W.add(Se)),G=Po(N,Se,J,v,T,$,o,M,Te),Q.push($),re=G.sub($)}ae=re.mag()}let ie=re._mult((te-ee)/ae)._add($||W),me=k+Math.atan2(J.y-W.y,J.x-W.x);return Q.push(ie),{point:ie,angle:C?me:0,path:Q}}let Uf=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ro(g,t){for(let o=0;o<g;o++){let h=t.length;t.resize(h+4),t.float32.set(Uf,3*h)}}function Qc(g,t,o){let h=t[0],p=t[1];return g[0]=o[0]*h+o[4]*p+o[12],g[1]=o[1]*h+o[5]*p+o[13],g[3]=o[3]*h+o[7]*p+o[15],g}let vi=100;class Vf{constructor(t,o=new He(t.width+200,t.height+200,25),h=new He(t.width+200,t.height+200,25)){this.transform=t,this.grid=o,this.ignoredGrid=h,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+vi,this.screenBottomBoundary=t.height+vi,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,o,h,p,v,T,M,C,z,P,k,L){let N=this.projectAndGetPerspectiveRatio(t.anchorPointX+C[0],t.anchorPointY+C[1],v,P,L),G=h*N.perspectiveRatio,$;if(T||M)$=this._projectCollisionBox(t,G,p,v,T,M,C,N,P,k,L);else{let re=N.x+(k?k.x*G:0),ie=N.y+(k?k.y*G:0);$={allPointsOccluded:!1,box:[re+t.x1*G,ie+t.y1*G,re+t.x2*G,ie+t.y2*G]}}let[J,W,ee,ae]=$.box,te=T?$.allPointsOccluded:N.isOccluded,Q=te;return Q||(Q=N.perspectiveRatio<this.perspectiveRatioCutoff),Q||(Q=!this.isInsideGrid(J,W,ee,ae)),Q||o!=="always"&&this.grid.hitTest(J,W,ee,ae,o,z)?{box:[J,W,ee,ae],placeable:!1,offscreen:!1,occluded:te}:{box:[J,W,ee,ae],placeable:!0,offscreen:this.isOffscreen(J,W,ee,ae),occluded:te}}placeCollisionCircles(t,o,h,p,v,T,M,C,z,P,k,L,N,G){let $=[],J=new l.P(o.anchorX,o.anchorY),W=this.getPerspectiveRatio(J.x,J.y,T,G),ee=(z?v*this.transform.getPitchedTextCorrection(o.anchorX,o.anchorY,T)/W:v*W)/l.aJ,ae={getElevation:G,pitchedLabelPlaneMatrix:M,lineVertexArray:h,pitchWithMap:z,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:J,unwrappedTileID:T,width:this.transform.width,height:this.transform.height,translation:N},te=Es(ee,p,o.lineOffsetX*ee,o.lineOffsetY*ee,!1,o,!1,ae),Q=!1,re=!1,ie=!0;if(te){let me=.5*k*W+L,Te=new l.P(-100,-100),Se=new l.P(this.screenRightBoundary,this.screenBottomBoundary),Pe=new cd,De=te.first,Qe=te.last,je=[];for(let et=De.path.length-1;et>=1;et--)je.push(De.path[et]);for(let et=1;et<Qe.path.length;et++)je.push(Qe.path[et]);let Ae=2.5*me;if(z){let et=this.projectPathToScreenSpace(je,ae);je=et.some((It=>It.signedDistanceFromCamera<=0))?[]:et.map((It=>It.point))}let $e=[];if(je.length>0){let et=je[0].clone(),It=je[0].clone();for(let zi=1;zi<je.length;zi++)et.x=Math.min(et.x,je[zi].x),et.y=Math.min(et.y,je[zi].y),It.x=Math.max(It.x,je[zi].x),It.y=Math.max(It.y,je[zi].y);$e=et.x>=Te.x&&It.x<=Se.x&&et.y>=Te.y&&It.y<=Se.y?[je]:It.x<Te.x||et.x>Se.x||It.y<Te.y||et.y>Se.y?[]:l.aG([je],Te.x,Te.y,Se.x,Se.y)}for(let et of $e){Pe.reset(et,.25*me);let It=0;It=Pe.length<=.5*me?1:Math.ceil(Pe.paddedLength/Ae)+1;for(let zi=0;zi<It;zi++){let Vt=zi/Math.max(It-1,1),Li=Pe.lerp(Vt),Ui=Li.x+vi,Cn=Li.y+vi;$.push(Ui,Cn,me,0);let bi=Ui-me,jn=Cn-me,yn=Ui+me,tn=Cn+me;if(ie&&(ie=this.isOffscreen(bi,jn,yn,tn)),re||(re=this.isInsideGrid(bi,jn,yn,tn)),t!=="always"&&this.grid.hitTestCircle(Ui,Cn,me,t,P)&&(Q=!0,!C))return{circles:[],offscreen:!1,collisionDetected:Q}}}}return{circles:!C&&Q||!re||W<this.perspectiveRatioCutoff?[]:$,offscreen:ie,collisionDetected:Q}}projectPathToScreenSpace(t,o){let h=(function(p,v){let T=pt;return(function(M,C){let z=1/(C[0]*C[5]-C[1]*C[4]);M[0]=C[5]*z,M[1]=-C[1]*z,M[2]=0,M[3]=0,M[4]=-C[4]*z,M[5]=C[0]*z,M[6]=0,M[7]=0,M[8]=0,M[9]=0,M[10]=1/C[10],M[11]=0,M[12]=0,M[13]=0,M[14]=0,M[15]=1/C[15]})(T,v.pitchedLabelPlaneMatrix),p.map((M=>{let C=ut(M.x,M.y,T,v.getElevation),z=v.transform.projectTileCoordinates(C.point.x,C.point.y,v.unwrappedTileID,v.getElevation);return z.point.x=(.5*z.point.x+.5)*v.width,z.point.y=(.5*-z.point.y+.5)*v.height,z}))})(t,o);return(function(p){let v=0,T=0,M=0,C=0;for(let z=0;z<p.length;z++)p[z].isOccluded?(M=z+1,C=0):(C++,C>T&&(T=C,v=M));return p.slice(v,v+T)})(h)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let o=[],h=new l.a8;for(let k of t){let L=new l.P(k.x+vi,k.y+vi);h.extend(L),o.push(L)}let{minX:p,minY:v,maxX:T,maxY:M}=h,C=this.grid.query(p,v,T,M).concat(this.ignoredGrid.query(p,v,T,M)),z={},P={};for(let k of C){let L=k.key;if(z[L.bucketInstanceId]===void 0&&(z[L.bucketInstanceId]={}),z[L.bucketInstanceId][L.featureIndex])continue;let N=[new l.P(k.x1,k.y1),new l.P(k.x2,k.y1),new l.P(k.x2,k.y2),new l.P(k.x1,k.y2)];l.aH(o,N)&&(z[L.bucketInstanceId][L.featureIndex]=!0,P[L.bucketInstanceId]===void 0&&(P[L.bucketInstanceId]=[]),P[L.bucketInstanceId].push(L.featureIndex))}return P}insertCollisionBox(t,o,h,p,v,T){(h?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:v,collisionGroupID:T,overlapMode:o},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,h,p,v,T){let M=h?this.ignoredGrid:this.grid,C={bucketInstanceId:p,featureIndex:v,collisionGroupID:T,overlapMode:o};for(let z=0;z<t.length;z+=4)M.insertCircle(C,t[z],t[z+1],t[z+2])}projectAndGetPerspectiveRatio(t,o,h,p,v){if(v){let T;p?(T=[t,o,p(t,o),1],l.aE(T,T,v)):(T=[t,o,0,1],Qc(T,T,v));let M=T[3];return{x:(T[0]/M+1)/2*this.transform.width+vi,y:(-T[1]/M+1)/2*this.transform.height+vi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/M*.5,isOccluded:!1,signedDistanceFromCamera:M}}{let T=this.transform.projectTileCoordinates(t,o,h,p);return{x:(T.point.x+1)/2*this.transform.width+vi,y:(1-T.point.y)/2*this.transform.height+vi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/T.signedDistanceFromCamera*.5,isOccluded:T.isOccluded,signedDistanceFromCamera:T.signedDistanceFromCamera}}}getPerspectiveRatio(t,o,h,p){let v=this.transform.projectTileCoordinates(t,o,h,p);return .5+this.transform.cameraToCenterDistance/v.signedDistanceFromCamera*.5}isOffscreen(t,o,h,p){return h<vi||t>=this.screenRightBoundary||p<vi||o>this.screenBottomBoundary}isInsideGrid(t,o,h,p){return h>=0&&t<this.gridRightBoundary&&p>=0&&o<this.gridBottomBoundary}getViewportMatrix(){let t=l.ap([]);return l.Q(t,t,[-100,-100,0]),t}_projectCollisionBox(t,o,h,p,v,T,M,C,z,P,k){let L=1,N=0,G=0,$=1,J=t.anchorPointX+M[0],W=t.anchorPointY+M[1];if(T&&!v){let je=this.projectAndGetPerspectiveRatio(J+1,W,p,z,k),Ae=je.x-C.x,$e=Math.atan((je.y-C.y)/Ae)+(Ae<0?Math.PI:0),et=Math.sin($e),It=Math.cos($e);L=It,N=et,G=-et,$=It}else if(!T&&v){let je=za(this.transform);L=je.vecEast[0],N=je.vecEast[1],G=je.vecSouth[0],$=je.vecSouth[1]}let ee=C.x,ae=C.y,te=o;v&&(ee=J,ae=W,te=Math.pow(2,-(this.transform.zoom-h.overscaledZ)),te*=this.transform.getPitchedTextCorrection(J,W,p),P||(te*=l.al(.5+C.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(ee+=L*P.x*te+G*P.y*te,ae+=N*P.x*te+$*P.y*te);let Q=t.x1*te,re=t.x2*te,ie=(Q+re)/2,me=t.y1*te,Te=t.y2*te,Se=(me+Te)/2,Pe=[{offsetX:Q,offsetY:me},{offsetX:ie,offsetY:me},{offsetX:re,offsetY:me},{offsetX:re,offsetY:Se},{offsetX:re,offsetY:Te},{offsetX:ie,offsetY:Te},{offsetX:Q,offsetY:Te},{offsetX:Q,offsetY:Se}],De=[];for(let{offsetX:je,offsetY:Ae}of Pe)De.push(new l.P(ee+L*je+G*Ae,ae+N*je+$*Ae));let Qe=!1;if(v){let je=De.map((Ae=>this.projectAndGetPerspectiveRatio(Ae.x,Ae.y,p,z,k)));Qe=je.some((Ae=>!Ae.isOccluded)),De=je.map((Ae=>new l.P(Ae.x,Ae.y)))}else Qe=!0;return{box:l.aI(De),allPointsOccluded:!Qe}}}class jf{constructor(t,o,h,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):p&&h?1:0,this.placed=h}isHidden(){return this.opacity===0&&!this.placed}}class Ul{constructor(t,o,h,p,v){this.text=new jf(t?t.text:null,o,h,v),this.icon=new jf(t?t.icon:null,o,p,v)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class qf{constructor(t,o,h){this.text=t,this.icon=o,this.skipFade=h}}class Gf{constructor(t,o,h,p,v){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=h,this.bucketIndex=p,this.tileID=v}}class Zf{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:h=>h.collisionGroupID===o}}return this.collisionGroups[t]}}function Jc(g,t,o,h,p){let{horizontalAlign:v,verticalAlign:T}=l.aP(g);return new l.P(-(v-.5)*t+h[0]*p,-(T-.5)*o+h[1]*p)}class ud{constructor(t,o,h,p,v){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new Vf(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new Zf(p),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let o=this.terrain;return o?(h,p)=>o.getElevation(t,h,p):null}getBucketParts(t,o,h,p){let v=h.getBucket(o),T=h.latestFeatureIndex;if(!v||!T||o.id!==v.layerIds[0])return;let M=h.collisionBoxArray,C=v.layers[0].layout,z=v.layers[0].paint,P=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),k=h.tileSize/l.a6,L=h.tileID.toUnwrapped(),N=C.get("text-rotation-alignment")==="map",G=l.aK(h,1,this.transform.zoom),$=l.aL(this.collisionIndex.transform,h,z.get("text-translate"),z.get("text-translate-anchor")),J=l.aL(this.collisionIndex.transform,h,z.get("icon-translate"),z.get("icon-translate-anchor")),W=sr(N,this.transform,G);this.retainedQueryData[v.bucketInstanceId]=new Gf(v.bucketInstanceId,T,v.sourceLayerIndex,v.index,h.tileID);let ee={bucket:v,layout:C,translationText:$,translationIcon:J,unwrappedTileID:L,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:k,holdingForFade:h.holdingForSymbolFade(),collisionBoxArray:M,partiallyEvaluatedTextSize:l.aw(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(p)for(let ae of v.sortKeyRanges){let{sortKey:te,symbolInstanceStart:Q,symbolInstanceEnd:re}=ae;t.push({sortKey:te,symbolInstanceStart:Q,symbolInstanceEnd:re,parameters:ee})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:ee})}attemptAnchorPlacement(t,o,h,p,v,T,M,C,z,P,k,L,N,G,$,J,W,ee,ae,te){var Q,re,ie;let me=l.aM[t.textAnchor],Te=[t.textOffset0,t.textOffset1],Se=Jc(me,h,p,Te,v),Pe=this.collisionIndex.placeCollisionBox(o,L,C,z,P,M,T,J,k.predicate,ae,Se,te);if((!ee||this.collisionIndex.placeCollisionBox(ee,L,C,z,P,M,T,W,k.predicate,ae,Se,te).placeable)&&Pe.placeable){let De;if(!((Q=this.prevPlacement)===null||Q===void 0)&&Q.variableOffsets[N.crossTileID]&&(!((ie=(re=this.prevPlacement)===null||re===void 0?void 0:re.placements[N.crossTileID])===null||ie===void 0)&&ie.text)&&(De=this.prevPlacement.variableOffsets[N.crossTileID].anchor),N.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[N.crossTileID]={textOffset:Te,width:h,height:p,anchor:me,textBoxScale:v,prevAnchor:De},this.markUsedJustification(G,me,N,$),G.allowVerticalPlacement&&(this.markUsedOrientation(G,$,N),this.placedOrientations[N.crossTileID]=$),{shift:Se,placedGlyphBoxes:Pe}}}placeLayerBucketPart(t,o,h){let{bucket:p,layout:v,translationText:T,translationIcon:M,unwrappedTileID:C,pitchedLabelPlaneMatrix:z,textPixelRatio:P,holdingForFade:k,collisionBoxArray:L,partiallyEvaluatedTextSize:N,collisionGroup:G}=t.parameters,$=v.get("text-optional"),J=v.get("icon-optional"),W=l.aN(v,"text-overlap","text-allow-overlap"),ee=W==="always",ae=l.aN(v,"icon-overlap","icon-allow-overlap"),te=ae==="always",Q=v.get("text-rotation-alignment")==="map",re=v.get("text-pitch-alignment")==="map",ie=v.get("icon-text-fit")!=="none",me=v.get("symbol-z-order")==="viewport-y",Te=ee&&(te||!p.hasIconData()||J),Se=te&&(ee||!p.hasTextData()||$);!p.collisionArrays&&L&&p.deserializeCollisionBoxes(L);let Pe=this.retainedQueryData[p.bucketInstanceId].tileID,De=this._getTerrainElevationFunc(Pe),Qe=this.transform.getFastPathSimpleProjectionMatrix(Pe),je=(Ae,$e,et)=>{var It,zi;if(o[Ae.crossTileID])return;if(k)return void(this.placements[Ae.crossTileID]=new qf(!1,!1,!1));let Vt=!1,Li=!1,Ui=!0,Cn=null,bi={box:null,placeable:!1,offscreen:null,occluded:!1},jn={placeable:!1},yn=null,tn=null,An=null,ao=0,oo=0,so=0;$e.textFeatureIndex?ao=$e.textFeatureIndex:Ae.useRuntimeCollisionCircles&&(ao=Ae.featureIndex),$e.verticalTextFeatureIndex&&(oo=$e.verticalTextFeatureIndex);let zn=$e.textBox;if(zn){let fa=mi=>{let ai=l.ax.horizontal;if(p.allowVerticalPlacement&&!mi&&this.prevPlacement){let Vi=this.prevPlacement.placedOrientations[Ae.crossTileID];Vi&&(this.placedOrientations[Ae.crossTileID]=Vi,ai=Vi,this.markUsedOrientation(p,ai,Ae))}return ai},ma=(mi,ai)=>{if(p.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&$e.verticalTextBox){for(let Vi of p.writingModes)if(Vi===l.ax.vertical?(bi=ai(),jn=bi):bi=mi(),bi?.placeable)break}else bi=mi()},dr=Ae.textAnchorOffsetStartIndex,Cr=Ae.textAnchorOffsetEndIndex;if(Cr===dr){let mi=(ai,Vi)=>{let gi=this.collisionIndex.placeCollisionBox(ai,W,P,Pe,C,re,Q,T,G.predicate,De,void 0,Qe);return gi?.placeable&&(this.markUsedOrientation(p,Vi,Ae),this.placedOrientations[Ae.crossTileID]=Vi),gi};ma((()=>mi(zn,l.ax.horizontal)),(()=>{let ai=$e.verticalTextBox;return p.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&ai?mi(ai,l.ax.vertical):{box:null,offscreen:null}})),fa(bi?.placeable)}else{let mi=l.aM[(zi=(It=this.prevPlacement)===null||It===void 0?void 0:It.variableOffsets[Ae.crossTileID])===null||zi===void 0?void 0:zi.anchor],ai=(gi,Wo,Bu)=>{let Ba=gi.x2-gi.x1,rp=gi.y2-gi.y1,Um=Ae.textBoxScale,ap=ie&&ae==="never"?Wo:null,co=null,uo=W==="never"?1:2,ho="never";mi&&uo++;for(let op=0;op<uo;op++){for(let sp=dr;sp<Cr;sp++){let Fu=p.textAnchorOffsets.get(sp);if(mi&&Fu.textAnchor!==mi)continue;let Nu=this.attemptAnchorPlacement(Fu,gi,Ba,rp,Um,Q,re,P,Pe,C,G,ho,Ae,p,Bu,T,M,ap,De);if(Nu&&(co=Nu.placedGlyphBoxes,co?.placeable))return Vt=!0,Cn=Nu.shift,co}mi?mi=null:ho=W}return h&&!co&&(co={box:this.collisionIndex.placeCollisionBox(zn,"always",P,Pe,C,re,Q,T,G.predicate,De,void 0,Qe).box,offscreen:!1,placeable:!1,occluded:!1}),co};ma((()=>ai(zn,$e.iconBox,l.ax.horizontal)),(()=>{let gi=$e.verticalTextBox;return p.allowVerticalPlacement&&!bi?.placeable&&Ae.numVerticalGlyphVertices>0&&gi?ai(gi,$e.verticalIconBox,l.ax.vertical):{box:null,occluded:!0,offscreen:null}})),bi&&(Vt=bi.placeable,Ui=bi.offscreen);let Vi=fa(bi?.placeable);if(!Vt&&this.prevPlacement){let gi=this.prevPlacement.variableOffsets[Ae.crossTileID];gi&&(this.variableOffsets[Ae.crossTileID]=gi,this.markUsedJustification(p,gi.anchor,Ae,Vi))}}}if(yn=bi,Vt=yn?.placeable,Ui=yn?.offscreen,Ae.useRuntimeCollisionCircles&&Ae.centerJustifiedTextSymbolIndex>=0){let fa=p.text.placedSymbolArray.get(Ae.centerJustifiedTextSymbolIndex),ma=l.ay(p.textSizeData,N,fa),dr=v.get("text-padding");tn=this.collisionIndex.placeCollisionCircles(W,fa,p.lineVertexArray,p.glyphOffsetArray,ma,C,z,h,re,G.predicate,Ae.collisionCircleDiameter,dr,T,De),tn.circles.length&&tn.collisionDetected&&!h&&l.w("Collisions detected, but collision boxes are not shown"),Vt=ee||tn.circles.length>0&&!tn.collisionDetected,Ui&&(Ui=tn.offscreen)}if($e.iconFeatureIndex&&(so=$e.iconFeatureIndex),$e.iconBox){let fa=ma=>this.collisionIndex.placeCollisionBox(ma,ae,P,Pe,C,re,Q,M,G.predicate,De,ie&&Cn?Cn:void 0,Qe);jn&&jn.placeable&&$e.verticalIconBox?(An=fa($e.verticalIconBox),Li=An.placeable):(An=fa($e.iconBox),Li=An.placeable),Ui&&(Ui=An.offscreen)}let Oa=$||Ae.numHorizontalGlyphVertices===0&&Ae.numVerticalGlyphVertices===0,lo=J||Ae.numIconVertices===0;Oa||lo?lo?Oa||Li&&(Li=Vt):Vt=Li&&Vt:Li=Vt=Li&&Vt;let Ou=Li&&An.placeable;if(Vt&&yn.placeable&&this.collisionIndex.insertCollisionBox(yn.box,W,v.get("text-ignore-placement"),p.bucketInstanceId,jn&&jn.placeable&&oo?oo:ao,G.ID),Ou&&this.collisionIndex.insertCollisionBox(An.box,ae,v.get("icon-ignore-placement"),p.bucketInstanceId,so,G.ID),tn&&Vt&&this.collisionIndex.insertCollisionCircles(tn.circles,W,v.get("text-ignore-placement"),p.bucketInstanceId,ao,G.ID),h&&this.storeCollisionData(p.bucketInstanceId,et,$e,yn,An,tn),Ae.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(p.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ae.crossTileID]=new qf((Vt||Te)&&!yn?.occluded,(Li||Se)&&!An?.occluded,Ui||p.justReloaded),o[Ae.crossTileID]=!0};if(me){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let Ae=p.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let $e=Ae.length-1;$e>=0;--$e){let et=Ae[$e];je(p.symbolInstances.get(et),p.collisionArrays[et],et)}}else for(let Ae=t.symbolInstanceStart;Ae<t.symbolInstanceEnd;Ae++)je(p.symbolInstances.get(Ae),p.collisionArrays[Ae],Ae);p.justReloaded=!1}storeCollisionData(t,o,h,p,v,T){if(h.textBox||h.iconBox){let M,C;this.collisionBoxArrays.has(t)?M=this.collisionBoxArrays.get(t):(M=new Map,this.collisionBoxArrays.set(t,M)),M.has(o)?C=M.get(o):(C={text:null,icon:null},M.set(o,C)),h.textBox&&(C.text=p.box),h.iconBox&&(C.icon=v.box)}if(T){let M=this.collisionCircleArrays[t];M===void 0&&(M=this.collisionCircleArrays[t]=[]);for(let C=0;C<T.circles.length;C+=4)M.push(T.circles[C+0]-vi),M.push(T.circles[C+1]-vi),M.push(T.circles[C+2]),M.push(T.collisionDetected?1:0)}}markUsedJustification(t,o,h,p){let v;v=p===l.ax.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[l.aO(o)];let T=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];for(let M of T)M>=0&&(t.text.placedSymbolArray.get(M).crossTileID=v>=0&&M!==v?0:h.crossTileID)}markUsedOrientation(t,o,h){let p=o===l.ax.horizontal||o===l.ax.horizontalOnly?o:0,v=o===l.ax.vertical?o:0,T=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];for(let M of T)t.text.placedSymbolArray.get(M).placedOrientation=p;h.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let o=this.prevPlacement,h=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;let p=o?o.symbolFadeChange(t):1,v=o?o.opacities:{},T=o?o.variableOffsets:{},M=o?o.placedOrientations:{};for(let C in this.placements){let z=this.placements[C],P=v[C];P?(this.opacities[C]=new Ul(P,p,z.text,z.icon),h||(h=z.text!==P.text.placed),h||(h=z.icon!==P.icon.placed)):(this.opacities[C]=new Ul(null,p,z.text,z.icon,z.skipFade),h||(h=z.text||z.icon))}for(let C in v){let z=v[C];if(!this.opacities[C]){let P=new Ul(z,p,!1,!1);P.isHidden()||(this.opacities[C]=P,h||(h=z.text.placed),h||(h=z.icon.placed))}}for(let C in T)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=T[C]);for(let C in M)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=M[C]);if(o&&o.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");h?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o){let h={};for(let p of o){let v=p.getBucket(t);v&&p.latestFeatureIndex&&t.id===v.layerIds[0]&&this.updateBucketOpacities(v,p.tileID,h,p.collisionBoxArray)}}updateBucketOpacities(t,o,h,p){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let v=t.layers[0],T=v.layout,M=new Ul(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),z=T.get("icon-allow-overlap"),P=v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"),k=T.get("text-rotation-alignment")==="map",L=T.get("text-pitch-alignment")==="map",N=T.get("icon-text-fit")!=="none",G=new Ul(null,0,C&&(z||!t.hasIconData()||T.get("icon-optional")),z&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);let $=(W,ee,ae)=>{for(let te=0;te<ee/4;te++)W.opacityVertexArray.emplaceBack(ae);W.hasVisibleVertices||(W.hasVisibleVertices=ae!==jl)},J=this.collisionBoxArrays.get(t.bucketInstanceId);for(let W=0;W<t.symbolInstances.length;W++){let ee=t.symbolInstances.get(W),{numHorizontalGlyphVertices:ae,numVerticalGlyphVertices:te,crossTileID:Q}=ee,re=this.opacities[Q];h[Q]?re=M:re||(re=G,this.opacities[Q]=re),h[Q]=!0;let ie=ee.numIconVertices>0,me=this.placedOrientations[ee.crossTileID],Te=me===l.ax.vertical,Se=me===l.ax.horizontal||me===l.ax.horizontalOnly;if(ae>0||te>0){let De=fd(re.text);$(t.text,ae,Te?jl:De),$(t.text,te,Se?jl:De);let Qe=re.text.isHidden(),je=[ee.rightJustifiedTextSymbolIndex,ee.centerJustifiedTextSymbolIndex,ee.leftJustifiedTextSymbolIndex];for(let et of je)et>=0&&(t.text.placedSymbolArray.get(et).hidden=Qe||Te?1:0);ee.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(ee.verticalPlacedTextSymbolIndex).hidden=Qe||Se?1:0);let Ae=this.variableOffsets[ee.crossTileID];Ae&&this.markUsedJustification(t,Ae.anchor,ee,me);let $e=this.placedOrientations[ee.crossTileID];$e&&(this.markUsedJustification(t,"left",ee,$e),this.markUsedOrientation(t,$e,ee))}if(ie){let De=fd(re.icon),Qe=!(N&&ee.verticalPlacedIconSymbolIndex&&Te);ee.placedIconSymbolIndex>=0&&($(t.icon,ee.numIconVertices,Qe?De:jl),t.icon.placedSymbolArray.get(ee.placedIconSymbolIndex).hidden=re.icon.isHidden()),ee.verticalPlacedIconSymbolIndex>=0&&($(t.icon,ee.numVerticalIconVertices,Qe?jl:De),t.icon.placedSymbolArray.get(ee.verticalPlacedIconSymbolIndex).hidden=re.icon.isHidden())}let Pe=J?.has(W)?J.get(W):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let De=t.collisionArrays[W];if(De){let Qe=new l.P(0,0);if(De.textBox||De.verticalTextBox){let je=!0;if(P){let Ae=this.variableOffsets[Q];Ae?(Qe=Jc(Ae.anchor,Ae.width,Ae.height,Ae.textOffset,Ae.textBoxScale),k&&Qe._rotate(L?-this.transform.bearingInRadians:this.transform.bearingInRadians)):je=!1}if(De.textBox||De.verticalTextBox){let Ae;De.textBox&&(Ae=Te),De.verticalTextBox&&(Ae=Se),hd(t.textCollisionBox.collisionVertexArray,re.text.placed,!je||Ae,Pe.text,Qe.x,Qe.y)}}if(De.iconBox||De.verticalIconBox){let je=!!(!Se&&De.verticalIconBox),Ae;De.iconBox&&(Ae=je),De.verticalIconBox&&(Ae=!je),hd(t.iconCollisionBox.collisionVertexArray,re.icon.placed,Ae,Pe.icon,N?Qe.x:0,N?Qe.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),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.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],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,o){let h=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*h>t}setStale(){this.stale=!0}}function hd(g,t,o,h,p,v){h&&h.length!==0||(h=[0,0,0,0]);let T=h[0]-vi,M=h[1]-vi,C=h[2]-vi,z=h[3]-vi;g.emplaceBack(t?1:0,o?1:0,p||0,v||0,T,M),g.emplaceBack(t?1:0,o?1:0,p||0,v||0,C,M),g.emplaceBack(t?1:0,o?1:0,p||0,v||0,C,z),g.emplaceBack(t?1:0,o?1:0,p||0,v||0,T,z)}let dd=Math.pow(2,25),pd=Math.pow(2,24),l1=Math.pow(2,17),Vl=Math.pow(2,16),eu=Math.pow(2,9),Hf=Math.pow(2,8),zs=Math.pow(2,1);function fd(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;let t=g.placed?1:0,o=Math.floor(127*g.opacity);return o*dd+t*pd+o*l1+t*Vl+o*eu+t*Hf+o*zs+t}let jl=0;class Ja{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,o,h,p,v){let T=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(T,p,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,v())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,T.sort(((M,C)=>M.sortKey-C.sortKey)));this._currentPartIndex<T.length;)if(o.placeLayerBucketPart(T[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,v())return!0;return!1}}class Ds{constructor(t,o,h,p,v,T,M,C){this.placement=new ud(t,o,T,M,C),this._currentPlacementIndex=h.length-1,this._forceFullPlacement=p,this._showCollisionBoxes=v,this._done=!1}isDone(){return this._done}continuePlacement(t,o,h){let p=ce(),v=()=>!this._forceFullPlacement&&ce()-p>2;for(;this._currentPlacementIndex>=0;){let T=o[t[this._currentPlacementIndex]],M=this.placement.collisionIndex.transform.zoom;if(l.aQ(T)&&T.layout&&(!T.minzoom||T.minzoom<=M)&&(!T.maxzoom||T.maxzoom>M)){if(this._inProgressLayer||(this._inProgressLayer=new Ja(T)),this._inProgressLayer.continuePlacement(h[T.source],this.placement,this._showCollisionBoxes,T,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}let dt=512/l.a6/2;class md{constructor(t,o,h){this.tileID=t,this.bucketInstanceId=h,this._symbolsByKey={};let p=new Map;for(let v=0;v<o.length;v++){let T=o.get(v),M=T.key,C=p.get(M);C?C.push(T):p.set(M,[T])}for(let[v,T]of p){let M={positions:T.map((C=>({x:Math.floor(C.anchorX*dt),y:Math.floor(C.anchorY*dt)}))),crossTileIDs:T.map((C=>C.crossTileID))};if(M.positions.length>128){let C=new l.aR(M.positions.length,16,Uint16Array);for(let{x:z,y:P}of M.positions)C.add(z,P);C.finish(),delete M.positions,M.index=C}this._symbolsByKey[v]=M}}getScaledCoordinates(t,o){let{x:h,y:p,z:v}=this.tileID.canonical,{x:T,y:M,z:C}=o.canonical,z=dt/Math.pow(2,C-v),P=(M*l.a6+t.anchorY)*z,k=p*l.a6*dt;return{x:Math.floor((T*l.a6+t.anchorX)*z-h*l.a6*dt),y:Math.floor(P-k)}}findMatches(t,o,h){let p=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z);for(let v=0;v<t.length;v++){let T=t.get(v);if(T.crossTileID)continue;let M=this._symbolsByKey[T.key];if(!M)continue;let C=this.getScaledCoordinates(T,o);if(M.index){let z=M.index.range(C.x-p,C.y-p,C.x+p,C.y+p).sort();for(let P of z){let k=M.crossTileIDs[P];if(!h[k]){h[k]=!0,T.crossTileID=k;break}}}else if(M.positions)for(let z=0;z<M.positions.length;z++){let P=M.positions[z],k=M.crossTileIDs[z];if(Math.abs(P.x-C.x)<=p&&Math.abs(P.y-C.y)<=p&&!h[k]){h[k]=!0,T.crossTileID=k;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class c1{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gd{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let o=Math.round((t-this.lng)/360);if(o!==0)for(let h in this.indexes){let p=this.indexes[h],v={};for(let T in p){let M=p[T];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+o),v[M.tileID.key]=M}this.indexes[h]=v}this.lng=t}addBucket(t,o,h){var p,v,T;if(!((p=this.indexes[t.overscaledZ])===null||p===void 0)&&p[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let C=0;C<o.symbolInstances.length;C++)o.symbolInstances.get(C).crossTileID=0;(v=this.usedCrossTileIDs)[T=t.overscaledZ]||(v[T]={});let M=this.usedCrossTileIDs[t.overscaledZ];for(let C in this.indexes){let z=this.indexes[C];if(Number(C)>t.overscaledZ)for(let P in z){let k=z[P];k.tileID.isChildOf(t)&&k.findMatches(o.symbolInstances,t,M)}else{let P=z[t.scaledTo(Number(C)).key];P&&P.findMatches(o.symbolInstances,t,M)}}for(let C=0;C<o.symbolInstances.length;C++){let z=o.symbolInstances.get(C);z.crossTileID||(z.crossTileID=h.generate(),M[z.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new md(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(let h of o.getCrossTileIDsLists())for(let p of h)delete this.usedCrossTileIDs[t][p]}removeStaleBuckets(t){let o=!1;for(let h in this.indexes){let p=this.indexes[h];for(let v in p)t[p[v].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,p[v]),delete p[v],o=!0)}return o}}class er{constructor(){this.layerIndexes={},this.crossTileIDs=new c1,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,h){let p=this.layerIndexes[t.id];p===void 0&&(p=this.layerIndexes[t.id]=new gd);let v=!1,T={};p.handleWrapJump(h);for(let M of o){let C=M.getBucket(t);t.id===C?.layerIds[0]&&(C.bucketInstanceId||(this.maxBucketInstanceId+=1,C.bucketInstanceId=this.maxBucketInstanceId),p.addBucket(M.tileID,C,this.crossTileIDs)&&(v=!0),T[C.bucketInstanceId]=!0)}return p.removeStaleBuckets(T)&&(v=!0),v}pruneUnusedLayers(t){let o={};for(let h of t)o[h]=!0;for(let h in this.layerIndexes)o[h]||delete this.layerIndexes[h]}}var En="void main() {fragColor=vec4(1.0);}";let pi={prelude:ot(`#ifdef GL_ES
3
+ precision mediump float;
4
+ #else
5
+ #if !defined(lowp)
6
+ #define lowp
7
+ #endif
8
+ #if !defined(mediump)
9
+ #define mediump
10
+ #endif
11
+ #if !defined(highp)
12
+ #define highp
13
+ #endif
14
+ #endif
15
+ out highp vec4 fragColor;`,`#ifdef GL_ES
16
+ precision highp float;
17
+ #else
18
+ #if !defined(lowp)
19
+ #define lowp
20
+ #endif
21
+ #if !defined(mediump)
22
+ #define mediump
23
+ #endif
24
+ #if !defined(highp)
25
+ #define highp
26
+ #endif
27
+ #endif
28
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
29
+ );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
30
+ );}
31
+ #ifdef TERRAIN3D
32
+ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
33
+ #endif
34
+ const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
35
+ #ifdef TERRAIN3D
36
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
37
+ #else
38
+ return 1.0;
39
+ #endif
40
+ }float calculate_visibility(vec4 pos) {
41
+ #ifdef TERRAIN3D
42
+ vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
43
+ #else
44
+ return 1.0;
45
+ #endif
46
+ }float ele(vec2 pos) {
47
+ #ifdef TERRAIN3D
48
+ vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
49
+ #else
50
+ return 0.0;
51
+ #endif
52
+ }float get_elevation(vec2 pos) {
53
+ #ifdef TERRAIN3D
54
+ #ifdef GLOBE
55
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
56
+ #endif
57
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
58
+ #else
59
+ return 0.0;
60
+ #endif
61
+ }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:ot("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:ot("",`#define GLOBE_RADIUS 6371008.8
62
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
63
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
64
+ if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
65
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:ot(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
66
+ #ifdef OVERDRAW_INSPECTOR
67
+ fragColor=vec4(1.0);
68
+ #endif
69
+ }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:ot(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
70
+ #ifdef OVERDRAW_INSPECTOR
71
+ fragColor=vec4(1.0);
72
+ #endif
73
+ }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ot(`in vec3 v_data;in float v_visibility;
74
+ #pragma mapbox: define highp vec4 color
75
+ #pragma mapbox: define mediump float radius
76
+ #pragma mapbox: define lowp float blur
77
+ #pragma mapbox: define lowp float opacity
78
+ #pragma mapbox: define highp vec4 stroke_color
79
+ #pragma mapbox: define mediump float stroke_width
80
+ #pragma mapbox: define lowp float stroke_opacity
81
+ void main() {
82
+ #pragma mapbox: initialize highp vec4 color
83
+ #pragma mapbox: initialize mediump float radius
84
+ #pragma mapbox: initialize lowp float blur
85
+ #pragma mapbox: initialize lowp float opacity
86
+ #pragma mapbox: initialize highp vec4 stroke_color
87
+ #pragma mapbox: initialize mediump float stroke_width
88
+ #pragma mapbox: initialize lowp float stroke_opacity
89
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
90
+ #ifdef OVERDRAW_INSPECTOR
91
+ fragColor=vec4(1.0);
92
+ #endif
93
+ }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
94
+ #pragma mapbox: define highp vec4 color
95
+ #pragma mapbox: define mediump float radius
96
+ #pragma mapbox: define lowp float blur
97
+ #pragma mapbox: define lowp float opacity
98
+ #pragma mapbox: define highp vec4 stroke_color
99
+ #pragma mapbox: define mediump float stroke_width
100
+ #pragma mapbox: define lowp float stroke_opacity
101
+ void main(void) {
102
+ #pragma mapbox: initialize highp vec4 color
103
+ #pragma mapbox: initialize mediump float radius
104
+ #pragma mapbox: initialize lowp float blur
105
+ #pragma mapbox: initialize lowp float opacity
106
+ #pragma mapbox: initialize highp vec4 stroke_color
107
+ #pragma mapbox: initialize mediump float stroke_width
108
+ #pragma mapbox: initialize lowp float stroke_opacity
109
+ vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
110
+ #ifdef GLOBE
111
+ vec3 center_vector=projectToSphere(circle_center);
112
+ #endif
113
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
114
+ #ifdef GLOBE
115
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
116
+ #else
117
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
118
+ #endif
119
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
120
+ #ifdef GLOBE
121
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
122
+ #else
123
+ gl_Position=projectTileWithElevation(corner_position,ele);
124
+ #endif
125
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:ot(En,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ot(`uniform highp float u_intensity;in vec2 v_extrude;
126
+ #pragma mapbox: define highp float weight
127
+ #define GAUSS_COEF 0.3989422804014327
128
+ void main() {
129
+ #pragma mapbox: initialize highp float weight
130
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
131
+ #ifdef OVERDRAW_INSPECTOR
132
+ fragColor=vec4(1.0);
133
+ #endif
134
+ }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
135
+ #pragma mapbox: define highp float weight
136
+ #pragma mapbox: define mediump float radius
137
+ const highp float ZERO=1.0/255.0/16.0;
138
+ #define GAUSS_COEF 0.3989422804014327
139
+ void main(void) {
140
+ #pragma mapbox: initialize highp float weight
141
+ #pragma mapbox: initialize mediump float radius
142
+ vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
143
+ #ifdef GLOBE
144
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
145
+ #else
146
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
147
+ #endif
148
+ }`),heatmapTexture:ot(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
149
+ #ifdef OVERDRAW_INSPECTOR
150
+ fragColor=vec4(0.0);
151
+ #endif
152
+ }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ot("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ot("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:ot(`#ifdef GL_ES
153
+ precision highp float;
154
+ #endif
155
+ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
156
+ {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
157
+ #ifdef OVERDRAW_INSPECTOR
158
+ fragColor=vec4(1.0);
159
+ #endif
160
+ }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:ot("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:ot(En,`in vec2 a_pos;void main() {
161
+ #ifdef GLOBE
162
+ gl_Position=projectTileFor3D(a_pos,0.0);
163
+ #else
164
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
165
+ #endif
166
+ }`),fill:ot(`#pragma mapbox: define highp vec4 color
167
+ #pragma mapbox: define lowp float opacity
168
+ void main() {
169
+ #pragma mapbox: initialize highp vec4 color
170
+ #pragma mapbox: initialize lowp float opacity
171
+ fragColor=color*opacity;
172
+ #ifdef OVERDRAW_INSPECTOR
173
+ fragColor=vec4(1.0);
174
+ #endif
175
+ }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
176
+ #pragma mapbox: define highp vec4 color
177
+ #pragma mapbox: define lowp float opacity
178
+ void main() {
179
+ #pragma mapbox: initialize highp vec4 color
180
+ #pragma mapbox: initialize lowp float opacity
181
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:ot(`in vec2 v_pos;
182
+ #ifdef GLOBE
183
+ in float v_depth;
184
+ #endif
185
+ #pragma mapbox: define highp vec4 outline_color
186
+ #pragma mapbox: define lowp float opacity
187
+ void main() {
188
+ #pragma mapbox: initialize highp vec4 outline_color
189
+ #pragma mapbox: initialize lowp float opacity
190
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
191
+ #ifdef GLOBE
192
+ if (v_depth > 1.0) {discard;}
193
+ #endif
194
+ #ifdef OVERDRAW_INSPECTOR
195
+ fragColor=vec4(1.0);
196
+ #endif
197
+ }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
198
+ #ifdef GLOBE
199
+ out float v_depth;
200
+ #endif
201
+ #pragma mapbox: define highp vec4 outline_color
202
+ #pragma mapbox: define lowp float opacity
203
+ void main() {
204
+ #pragma mapbox: initialize highp vec4 outline_color
205
+ #pragma mapbox: initialize lowp float opacity
206
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
207
+ #ifdef GLOBE
208
+ v_depth=gl_Position.z/gl_Position.w;
209
+ #endif
210
+ }`),fillOutlinePattern:ot(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
211
+ #ifdef GLOBE
212
+ in float v_depth;
213
+ #endif
214
+ #pragma mapbox: define lowp float opacity
215
+ #pragma mapbox: define lowp vec4 pattern_from
216
+ #pragma mapbox: define lowp vec4 pattern_to
217
+ void main() {
218
+ #pragma mapbox: initialize lowp float opacity
219
+ #pragma mapbox: initialize mediump vec4 pattern_from
220
+ #pragma mapbox: initialize mediump vec4 pattern_to
221
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
222
+ #ifdef GLOBE
223
+ if (v_depth > 1.0) {discard;}
224
+ #endif
225
+ #ifdef OVERDRAW_INSPECTOR
226
+ fragColor=vec4(1.0);
227
+ #endif
228
+ }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
229
+ #ifdef GLOBE
230
+ out float v_depth;
231
+ #endif
232
+ #pragma mapbox: define lowp float opacity
233
+ #pragma mapbox: define lowp vec4 pattern_from
234
+ #pragma mapbox: define lowp vec4 pattern_to
235
+ #pragma mapbox: define lowp float pixel_ratio_from
236
+ #pragma mapbox: define lowp float pixel_ratio_to
237
+ void main() {
238
+ #pragma mapbox: initialize lowp float opacity
239
+ #pragma mapbox: initialize mediump vec4 pattern_from
240
+ #pragma mapbox: initialize mediump vec4 pattern_to
241
+ #pragma mapbox: initialize lowp float pixel_ratio_from
242
+ #pragma mapbox: initialize lowp float pixel_ratio_to
243
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
244
+ #ifdef GLOBE
245
+ v_depth=gl_Position.z/gl_Position.w;
246
+ #endif
247
+ }`),fillPattern:ot(`#ifdef GL_ES
248
+ precision highp float;
249
+ #endif
250
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
251
+ #pragma mapbox: define lowp float opacity
252
+ #pragma mapbox: define lowp vec4 pattern_from
253
+ #pragma mapbox: define lowp vec4 pattern_to
254
+ void main() {
255
+ #pragma mapbox: initialize lowp float opacity
256
+ #pragma mapbox: initialize mediump vec4 pattern_from
257
+ #pragma mapbox: initialize mediump vec4 pattern_to
258
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
259
+ #ifdef OVERDRAW_INSPECTOR
260
+ fragColor=vec4(1.0);
261
+ #endif
262
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
263
+ #pragma mapbox: define lowp float opacity
264
+ #pragma mapbox: define lowp vec4 pattern_from
265
+ #pragma mapbox: define lowp vec4 pattern_to
266
+ #pragma mapbox: define lowp float pixel_ratio_from
267
+ #pragma mapbox: define lowp float pixel_ratio_to
268
+ void main() {
269
+ #pragma mapbox: initialize lowp float opacity
270
+ #pragma mapbox: initialize mediump vec4 pattern_from
271
+ #pragma mapbox: initialize mediump vec4 pattern_to
272
+ #pragma mapbox: initialize lowp float pixel_ratio_from
273
+ #pragma mapbox: initialize lowp float pixel_ratio_to
274
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:ot(`in vec4 v_color;void main() {fragColor=v_color;
275
+ #ifdef OVERDRAW_INSPECTOR
276
+ fragColor=vec4(1.0);
277
+ #endif
278
+ }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
279
+ #ifdef TERRAIN3D
280
+ in vec2 a_centroid;
281
+ #endif
282
+ out vec4 v_color;
283
+ #pragma mapbox: define highp float base
284
+ #pragma mapbox: define highp float height
285
+ #pragma mapbox: define highp vec4 color
286
+ void main() {
287
+ #pragma mapbox: initialize highp float base
288
+ #pragma mapbox: initialize highp float height
289
+ #pragma mapbox: initialize highp vec4 color
290
+ vec3 normal=a_normal_ed.xyz;
291
+ #ifdef TERRAIN3D
292
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
293
+ #else
294
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
295
+ #endif
296
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
297
+ #ifdef GLOBE
298
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
299
+ #else
300
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
301
+ #endif
302
+ float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
303
+ #ifdef GLOBE
304
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
305
+ #endif
306
+ directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:ot(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
307
+ #pragma mapbox: define lowp float base
308
+ #pragma mapbox: define lowp float height
309
+ #pragma mapbox: define lowp vec4 pattern_from
310
+ #pragma mapbox: define lowp vec4 pattern_to
311
+ #pragma mapbox: define lowp float pixel_ratio_from
312
+ #pragma mapbox: define lowp float pixel_ratio_to
313
+ void main() {
314
+ #pragma mapbox: initialize lowp float base
315
+ #pragma mapbox: initialize lowp float height
316
+ #pragma mapbox: initialize mediump vec4 pattern_from
317
+ #pragma mapbox: initialize mediump vec4 pattern_to
318
+ #pragma mapbox: initialize lowp float pixel_ratio_from
319
+ #pragma mapbox: initialize lowp float pixel_ratio_to
320
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
321
+ #ifdef OVERDRAW_INSPECTOR
322
+ fragColor=vec4(1.0);
323
+ #endif
324
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
325
+ #ifdef TERRAIN3D
326
+ in vec2 a_centroid;
327
+ #endif
328
+ #ifdef GLOBE
329
+ out vec3 v_sphere_pos;
330
+ #endif
331
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
332
+ #pragma mapbox: define lowp float base
333
+ #pragma mapbox: define lowp float height
334
+ #pragma mapbox: define lowp vec4 pattern_from
335
+ #pragma mapbox: define lowp vec4 pattern_to
336
+ #pragma mapbox: define lowp float pixel_ratio_from
337
+ #pragma mapbox: define lowp float pixel_ratio_to
338
+ void main() {
339
+ #pragma mapbox: initialize lowp float base
340
+ #pragma mapbox: initialize lowp float height
341
+ #pragma mapbox: initialize mediump vec4 pattern_from
342
+ #pragma mapbox: initialize mediump vec4 pattern_to
343
+ #pragma mapbox: initialize lowp float pixel_ratio_from
344
+ #pragma mapbox: initialize lowp float pixel_ratio_to
345
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
346
+ #ifdef TERRAIN3D
347
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
348
+ #else
349
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
350
+ #endif
351
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
352
+ #ifdef GLOBE
353
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
354
+ #else
355
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
356
+ #endif
357
+ vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
358
+ ? a_pos
359
+ : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:ot(`#ifdef GL_ES
360
+ precision highp float;
361
+ #endif
362
+ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
363
+ #ifdef OVERDRAW_INSPECTOR
364
+ fragColor=vec4(1.0);
365
+ #endif
366
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ot(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
367
+ #define PI 3.141592653589793
368
+ #define STANDARD 0
369
+ #define COMBINED 1
370
+ #define IGOR 2
371
+ #define MULTIDIRECTIONAL 3
372
+ #define BASIC 4
373
+ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
374
+ {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
375
+ {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
376
+ #ifdef OVERDRAW_INSPECTOR
377
+ fragColor=vec4(1.0);
378
+ #endif
379
+ }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:ot(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
380
+ #ifdef GLOBE
381
+ in float v_depth;
382
+ #endif
383
+ #pragma mapbox: define highp vec4 color
384
+ #pragma mapbox: define lowp float blur
385
+ #pragma mapbox: define lowp float opacity
386
+ void main() {
387
+ #pragma mapbox: initialize highp vec4 color
388
+ #pragma mapbox: initialize lowp float blur
389
+ #pragma mapbox: initialize lowp float opacity
390
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
391
+ #ifdef GLOBE
392
+ if (v_depth > 1.0) {discard;}
393
+ #endif
394
+ #ifdef OVERDRAW_INSPECTOR
395
+ fragColor=vec4(1.0);
396
+ #endif
397
+ }`,`
398
+ #define scale 0.015873016
399
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
400
+ #ifdef GLOBE
401
+ out float v_depth;
402
+ #endif
403
+ #pragma mapbox: define highp vec4 color
404
+ #pragma mapbox: define lowp float blur
405
+ #pragma mapbox: define lowp float opacity
406
+ #pragma mapbox: define mediump float gapwidth
407
+ #pragma mapbox: define lowp float offset
408
+ #pragma mapbox: define mediump float width
409
+ void main() {
410
+ #pragma mapbox: initialize highp vec4 color
411
+ #pragma mapbox: initialize lowp float blur
412
+ #pragma mapbox: initialize lowp float opacity
413
+ #pragma mapbox: initialize mediump float gapwidth
414
+ #pragma mapbox: initialize lowp float offset
415
+ #pragma mapbox: initialize mediump float width
416
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
417
+ #ifdef GLOBE
418
+ v_depth=gl_Position.z/gl_Position.w;
419
+ #endif
420
+ #ifdef TERRAIN3D
421
+ v_gamma_scale=1.0;
422
+ #else
423
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
424
+ #endif
425
+ v_width2=vec2(outset,inset);}`),lineGradient:ot(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
426
+ #ifdef GLOBE
427
+ in float v_depth;
428
+ #endif
429
+ #pragma mapbox: define lowp float blur
430
+ #pragma mapbox: define lowp float opacity
431
+ void main() {
432
+ #pragma mapbox: initialize lowp float blur
433
+ #pragma mapbox: initialize lowp float opacity
434
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
435
+ #ifdef GLOBE
436
+ if (v_depth > 1.0) {discard;}
437
+ #endif
438
+ #ifdef OVERDRAW_INSPECTOR
439
+ fragColor=vec4(1.0);
440
+ #endif
441
+ }`,`
442
+ #define scale 0.015873016
443
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
444
+ #ifdef GLOBE
445
+ out float v_depth;
446
+ #endif
447
+ #pragma mapbox: define lowp float blur
448
+ #pragma mapbox: define lowp float opacity
449
+ #pragma mapbox: define mediump float gapwidth
450
+ #pragma mapbox: define lowp float offset
451
+ #pragma mapbox: define mediump float width
452
+ void main() {
453
+ #pragma mapbox: initialize lowp float blur
454
+ #pragma mapbox: initialize lowp float opacity
455
+ #pragma mapbox: initialize mediump float gapwidth
456
+ #pragma mapbox: initialize lowp float offset
457
+ #pragma mapbox: initialize mediump float width
458
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
459
+ #ifdef GLOBE
460
+ v_depth=gl_Position.z/gl_Position.w;
461
+ #endif
462
+ #ifdef TERRAIN3D
463
+ v_gamma_scale=1.0;
464
+ #else
465
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
466
+ #endif
467
+ v_width2=vec2(outset,inset);}`),linePattern:ot(`#ifdef GL_ES
468
+ precision highp float;
469
+ #endif
470
+ uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
471
+ #ifdef GLOBE
472
+ in float v_depth;
473
+ #endif
474
+ #pragma mapbox: define lowp vec4 pattern_from
475
+ #pragma mapbox: define lowp vec4 pattern_to
476
+ #pragma mapbox: define lowp float pixel_ratio_from
477
+ #pragma mapbox: define lowp float pixel_ratio_to
478
+ #pragma mapbox: define lowp float blur
479
+ #pragma mapbox: define lowp float opacity
480
+ void main() {
481
+ #pragma mapbox: initialize mediump vec4 pattern_from
482
+ #pragma mapbox: initialize mediump vec4 pattern_to
483
+ #pragma mapbox: initialize lowp float pixel_ratio_from
484
+ #pragma mapbox: initialize lowp float pixel_ratio_to
485
+ #pragma mapbox: initialize lowp float blur
486
+ #pragma mapbox: initialize lowp float opacity
487
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
488
+ #ifdef GLOBE
489
+ if (v_depth > 1.0) {discard;}
490
+ #endif
491
+ #ifdef OVERDRAW_INSPECTOR
492
+ fragColor=vec4(1.0);
493
+ #endif
494
+ }`,`
495
+ #define scale 0.015873016
496
+ #define LINE_DISTANCE_SCALE 2.0
497
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
498
+ #ifdef GLOBE
499
+ out float v_depth;
500
+ #endif
501
+ #pragma mapbox: define lowp float blur
502
+ #pragma mapbox: define lowp float opacity
503
+ #pragma mapbox: define lowp float offset
504
+ #pragma mapbox: define mediump float gapwidth
505
+ #pragma mapbox: define mediump float width
506
+ #pragma mapbox: define lowp float floorwidth
507
+ #pragma mapbox: define lowp vec4 pattern_from
508
+ #pragma mapbox: define lowp vec4 pattern_to
509
+ #pragma mapbox: define lowp float pixel_ratio_from
510
+ #pragma mapbox: define lowp float pixel_ratio_to
511
+ void main() {
512
+ #pragma mapbox: initialize lowp float blur
513
+ #pragma mapbox: initialize lowp float opacity
514
+ #pragma mapbox: initialize lowp float offset
515
+ #pragma mapbox: initialize mediump float gapwidth
516
+ #pragma mapbox: initialize mediump float width
517
+ #pragma mapbox: initialize lowp float floorwidth
518
+ #pragma mapbox: initialize mediump vec4 pattern_from
519
+ #pragma mapbox: initialize mediump vec4 pattern_to
520
+ #pragma mapbox: initialize lowp float pixel_ratio_from
521
+ #pragma mapbox: initialize lowp float pixel_ratio_to
522
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
523
+ #ifdef GLOBE
524
+ v_depth=gl_Position.z/gl_Position.w;
525
+ #endif
526
+ #ifdef TERRAIN3D
527
+ v_gamma_scale=1.0;
528
+ #else
529
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
530
+ #endif
531
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:ot(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
532
+ #ifdef GLOBE
533
+ in float v_depth;
534
+ #endif
535
+ #pragma mapbox: define highp vec4 color
536
+ #pragma mapbox: define lowp float blur
537
+ #pragma mapbox: define lowp float opacity
538
+ #pragma mapbox: define mediump float width
539
+ #pragma mapbox: define lowp float floorwidth
540
+ #pragma mapbox: define mediump vec4 dasharray_from
541
+ #pragma mapbox: define mediump vec4 dasharray_to
542
+ void main() {
543
+ #pragma mapbox: initialize highp vec4 color
544
+ #pragma mapbox: initialize lowp float blur
545
+ #pragma mapbox: initialize lowp float opacity
546
+ #pragma mapbox: initialize mediump float width
547
+ #pragma mapbox: initialize lowp float floorwidth
548
+ #pragma mapbox: initialize mediump vec4 dasharray_from
549
+ #pragma mapbox: initialize mediump vec4 dasharray_to
550
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
551
+ #ifdef GLOBE
552
+ if (v_depth > 1.0) {discard;}
553
+ #endif
554
+ #ifdef OVERDRAW_INSPECTOR
555
+ fragColor=vec4(1.0);
556
+ #endif
557
+ }`,`
558
+ #define scale 0.015873016
559
+ #define LINE_DISTANCE_SCALE 2.0
560
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
561
+ #ifdef GLOBE
562
+ out float v_depth;
563
+ #endif
564
+ #pragma mapbox: define highp vec4 color
565
+ #pragma mapbox: define lowp float blur
566
+ #pragma mapbox: define lowp float opacity
567
+ #pragma mapbox: define mediump float gapwidth
568
+ #pragma mapbox: define lowp float offset
569
+ #pragma mapbox: define mediump float width
570
+ #pragma mapbox: define lowp float floorwidth
571
+ #pragma mapbox: define mediump vec4 dasharray_from
572
+ #pragma mapbox: define mediump vec4 dasharray_to
573
+ void main() {
574
+ #pragma mapbox: initialize highp vec4 color
575
+ #pragma mapbox: initialize lowp float blur
576
+ #pragma mapbox: initialize lowp float opacity
577
+ #pragma mapbox: initialize mediump float gapwidth
578
+ #pragma mapbox: initialize lowp float offset
579
+ #pragma mapbox: initialize mediump float width
580
+ #pragma mapbox: initialize lowp float floorwidth
581
+ #pragma mapbox: initialize mediump vec4 dasharray_from
582
+ #pragma mapbox: initialize mediump vec4 dasharray_to
583
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
584
+ #ifdef GLOBE
585
+ v_depth=gl_Position.z/gl_Position.w;
586
+ #endif
587
+ #ifdef TERRAIN3D
588
+ v_gamma_scale=1.0;
589
+ #else
590
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
591
+ #endif
592
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:ot(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
593
+ #ifdef GLOBE
594
+ in float v_depth;
595
+ #endif
596
+ #pragma mapbox: define lowp float blur
597
+ #pragma mapbox: define lowp float opacity
598
+ #pragma mapbox: define mediump float width
599
+ #pragma mapbox: define lowp float floorwidth
600
+ #pragma mapbox: define mediump vec4 dasharray_from
601
+ #pragma mapbox: define mediump vec4 dasharray_to
602
+ void main() {
603
+ #pragma mapbox: initialize lowp float blur
604
+ #pragma mapbox: initialize lowp float opacity
605
+ #pragma mapbox: initialize mediump float width
606
+ #pragma mapbox: initialize lowp float floorwidth
607
+ #pragma mapbox: initialize mediump vec4 dasharray_from
608
+ #pragma mapbox: initialize mediump vec4 dasharray_to
609
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
610
+ #ifdef GLOBE
611
+ if (v_depth > 1.0) {discard;}
612
+ #endif
613
+ #ifdef OVERDRAW_INSPECTOR
614
+ fragColor=vec4(1.0);
615
+ #endif
616
+ }`,`
617
+ #define scale 0.015873016
618
+ #define LINE_DISTANCE_SCALE 2.0
619
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
620
+ #ifdef GLOBE
621
+ out float v_depth;
622
+ #endif
623
+ #pragma mapbox: define lowp float blur
624
+ #pragma mapbox: define lowp float opacity
625
+ #pragma mapbox: define mediump float gapwidth
626
+ #pragma mapbox: define lowp float offset
627
+ #pragma mapbox: define mediump float width
628
+ #pragma mapbox: define lowp float floorwidth
629
+ #pragma mapbox: define mediump vec4 dasharray_from
630
+ #pragma mapbox: define mediump vec4 dasharray_to
631
+ void main() {
632
+ #pragma mapbox: initialize lowp float blur
633
+ #pragma mapbox: initialize lowp float opacity
634
+ #pragma mapbox: initialize mediump float gapwidth
635
+ #pragma mapbox: initialize lowp float offset
636
+ #pragma mapbox: initialize mediump float width
637
+ #pragma mapbox: initialize lowp float floorwidth
638
+ #pragma mapbox: initialize mediump vec4 dasharray_from
639
+ #pragma mapbox: initialize mediump vec4 dasharray_to
640
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
641
+ #ifdef GLOBE
642
+ v_depth=gl_Position.z/gl_Position.w;
643
+ #endif
644
+ #ifdef TERRAIN3D
645
+ v_gamma_scale=1.0;
646
+ #else
647
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
648
+ #endif
649
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:ot(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
650
+ #ifdef OVERDRAW_INSPECTOR
651
+ fragColor=vec4(1.0);
652
+ #endif
653
+ }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
654
+ #ifdef GLOBE
655
+ if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
656
+ #endif
657
+ v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:ot(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
658
+ #ifdef OVERDRAW_INSPECTOR
659
+ fragColor=vec4(1.0);
660
+ #endif
661
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;
662
+ #pragma mapbox: define lowp float opacity
663
+ void main() {
664
+ #pragma mapbox: initialize lowp float opacity
665
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
666
+ camera_to_anchor_distance/u_camera_to_center_distance :
667
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
668
+ #ifdef GLOBE
669
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
670
+ #endif
671
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:ot(`#define SDF_PX 8.0
672
+ uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
673
+ #pragma mapbox: define highp vec4 fill_color
674
+ #pragma mapbox: define highp vec4 halo_color
675
+ #pragma mapbox: define lowp float halo_width
676
+ #pragma mapbox: define lowp float halo_blur
677
+ void main() {
678
+ #pragma mapbox: initialize highp vec4 fill_color
679
+ #pragma mapbox: initialize highp vec4 halo_color
680
+ #pragma mapbox: initialize lowp float halo_width
681
+ #pragma mapbox: initialize lowp float halo_blur
682
+ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
683
+ #ifdef OVERDRAW_INSPECTOR
684
+ fragColor=vec4(1.0);
685
+ #endif
686
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
687
+ #pragma mapbox: define highp vec4 fill_color
688
+ #pragma mapbox: define highp vec4 halo_color
689
+ #pragma mapbox: define lowp float opacity
690
+ #pragma mapbox: define lowp float halo_width
691
+ #pragma mapbox: define lowp float halo_blur
692
+ void main() {
693
+ #pragma mapbox: initialize highp vec4 fill_color
694
+ #pragma mapbox: initialize highp vec4 halo_color
695
+ #pragma mapbox: initialize lowp float opacity
696
+ #pragma mapbox: initialize lowp float halo_width
697
+ #pragma mapbox: initialize lowp float halo_blur
698
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
699
+ camera_to_anchor_distance/u_camera_to_center_distance :
700
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
701
+ #ifdef GLOBE
702
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
703
+ #endif
704
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:ot(`#define SDF_PX 8.0
705
+ #define SDF 1.0
706
+ #define ICON 0.0
707
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
708
+ #pragma mapbox: define highp vec4 fill_color
709
+ #pragma mapbox: define highp vec4 halo_color
710
+ #pragma mapbox: define lowp float halo_width
711
+ #pragma mapbox: define lowp float halo_blur
712
+ void main() {
713
+ #pragma mapbox: initialize highp vec4 fill_color
714
+ #pragma mapbox: initialize highp vec4 halo_color
715
+ #pragma mapbox: initialize lowp float halo_width
716
+ #pragma mapbox: initialize lowp float halo_blur
717
+ float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
718
+ #ifdef OVERDRAW_INSPECTOR
719
+ fragColor=vec4(1.0);
720
+ #endif
721
+ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
722
+ #ifdef OVERDRAW_INSPECTOR
723
+ fragColor=vec4(1.0);
724
+ #endif
725
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
726
+ #pragma mapbox: define highp vec4 fill_color
727
+ #pragma mapbox: define highp vec4 halo_color
728
+ #pragma mapbox: define lowp float opacity
729
+ #pragma mapbox: define lowp float halo_width
730
+ #pragma mapbox: define lowp float halo_blur
731
+ void main() {
732
+ #pragma mapbox: initialize highp vec4 fill_color
733
+ #pragma mapbox: initialize highp vec4 halo_color
734
+ #pragma mapbox: initialize lowp float opacity
735
+ #pragma mapbox: initialize lowp float halo_width
736
+ #pragma mapbox: initialize lowp float halo_blur
737
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
738
+ camera_to_anchor_distance/u_camera_to_center_distance :
739
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
740
+ #ifdef GLOBE
741
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
742
+ #endif
743
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:ot("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:ot("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:ot("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:ot("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:ot(`#ifdef GL_ES
744
+ precision highp float;
745
+ #endif
746
+ in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
747
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:ot("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function ot(g,t){let o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,h=t.match(/in ([\w]+) ([\w]+)/g),p=g.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),T=v?v.concat(p):p,M={};return{fragmentSource:g=g.replace(o,((C,z,P,k,L)=>(M[L]=!0,z==="define"?`
748
+ #ifndef HAS_UNIFORM_u_${L}
749
+ in ${P} ${k} ${L};
750
+ #else
751
+ uniform ${P} ${k} u_${L};
752
+ #endif
753
+ `:`
754
+ #ifdef HAS_UNIFORM_u_${L}
755
+ ${P} ${k} ${L} = u_${L};
756
+ #endif
757
+ `))),vertexSource:t=t.replace(o,((C,z,P,k,L)=>{let N=k==="float"?"vec2":"vec4",G=L.match(/color/)?"color":N;return M[L]?z==="define"?`
758
+ #ifndef HAS_UNIFORM_u_${L}
759
+ uniform lowp float u_${L}_t;
760
+ in ${P} ${N} a_${L};
761
+ out ${P} ${k} ${L};
762
+ #else
763
+ uniform ${P} ${k} u_${L};
764
+ #endif
765
+ `:G==="vec4"?`
766
+ #ifndef HAS_UNIFORM_u_${L}
767
+ ${L} = a_${L};
768
+ #else
769
+ ${P} ${k} ${L} = u_${L};
770
+ #endif
771
+ `:`
772
+ #ifndef HAS_UNIFORM_u_${L}
773
+ ${L} = unpack_mix_${G}(a_${L}, u_${L}_t);
774
+ #else
775
+ ${P} ${k} ${L} = u_${L};
776
+ #endif
777
+ `:z==="define"?`
778
+ #ifndef HAS_UNIFORM_u_${L}
779
+ uniform lowp float u_${L}_t;
780
+ in ${P} ${N} a_${L};
781
+ #else
782
+ uniform ${P} ${k} u_${L};
783
+ #endif
784
+ `:G==="vec4"?`
785
+ #ifndef HAS_UNIFORM_u_${L}
786
+ ${P} ${k} ${L} = a_${L};
787
+ #else
788
+ ${P} ${k} ${L} = u_${L};
789
+ #endif
790
+ `:`
791
+ #ifndef HAS_UNIFORM_u_${L}
792
+ ${P} ${k} ${L} = unpack_mix_${G}(a_${L}, u_${L}_t);
793
+ #else
794
+ ${P} ${k} ${L} = u_${L};
795
+ #endif
796
+ `})),staticAttributes:h,staticUniforms:T}}class $t{constructor(t,o,h){this.vertexBuffer=t,this.indexBuffer=o,this.segments=h}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var eo=l.aS([{name:"a_pos",type:"Int16",components:2}]);let Nn="#define PROJECTION_MERCATOR",lr="mercator";class Un{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return lr}get shaderDefine(){return Nn}get shaderPreludeCode(){return pi.projectionMercator}get vertexShaderPreludeCode(){return pi.projectionMercator.vertexSource}get subdivisionGranularity(){return l.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,o,h,p,v){if(this._cachedMesh)return this._cachedMesh;let T=new l.aU;T.emplaceBack(0,0),T.emplaceBack(l.a6,0),T.emplaceBack(0,l.a6),T.emplaceBack(l.a6,l.a6);let M=t.createVertexBuffer(T,eo.members),C=l.aV.simpleSegment(0,0,4,2),z=new l.aW;z.emplaceBack(1,0,2),z.emplaceBack(1,2,3);let P=t.createIndexBuffer(z);return this._cachedMesh=new $t(M,P,C),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Ps{constructor(t=0,o=0,h=0,p=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(h)||h<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=h,this.right=p}interpolate(t,o,h){return o.top!=null&&t.top!=null&&(this.top=l.H.number(t.top,o.top,h)),o.bottom!=null&&t.bottom!=null&&(this.bottom=l.H.number(t.bottom,o.bottom,h)),o.left!=null&&t.left!=null&&(this.left=l.H.number(t.left,o.left,h)),o.right!=null&&t.right!=null&&(this.right=l.H.number(t.right,o.right,h)),this}getCenter(t,o){let h=l.al((this.left+t-this.right)/2,0,t),p=l.al((this.top+o-this.bottom)/2,0,o);return new l.P(h,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ps(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function to(g,t){if(!g.renderWorldCopies||g.lngRange)return;let o=t.lng-g.center.lng;t.lng+=o>180?-360:o<-180?360:0}function Ci(g){return Math.max(0,Math.floor(g))}class Io{constructor(t,o){var h;this.applyConstrain=(p,v)=>this._constrainOverride!==null?this._constrainOverride(p,v):this._callbacks.defaultConstrain(p,v),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=o?.renderWorldCopies===void 0||!!o?.renderWorldCopies,this._minZoom=o?.minZoom||0,this._maxZoom=o?.maxZoom||22,this._minPitch=o?.minPitch==null?0:o?.minPitch,this._maxPitch=o?.maxPitch==null?60:o?.maxPitch,this._constrainOverride=(h=o?.constrainOverride)!==null&&h!==void 0?h:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new l.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ci(this._zoom),this._scale=l.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ps,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,o,h){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Ci(this._zoom),this._scale=l.ao(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Ps(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!h&&t.autoCalculateNearFarZ,o&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){let o=l.X(t,-180,180)*Math.PI/180;var h,p,v,T,M,C,z,P,k;this._bearingInRadians!==o&&(this._unmodified=!1,this._bearingInRadians=o,this._calcMatrices(),this._rotationMatrix=B(),h=this._rotationMatrix,v=-this._bearingInRadians,T=(p=this._rotationMatrix)[0],M=p[1],C=p[2],z=p[3],P=Math.sin(v),k=Math.cos(v),h[0]=T*k+C*P,h[1]=M*k+z*P,h[2]=T*-P+C*k,h[3]=M*-P+z*k)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let o=l.al(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==o&&(this._unmodified=!1,this._pitchInRadians=o,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let o=t/180*Math.PI;this._rollInRadians!==o&&(this._unmodified=!1,this._rollInRadians=o,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return l.aX(this._fovInRadians)}setFov(t){t=l.al(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=l.an(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let o=this.applyConstrain(this._center,t).zoom;this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this._tileZoom=Math.max(0,Math.floor(o)),this._scale=l.ao(o),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,o){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=o,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,h){this._unmodified=!1,this._edgeInsets.interpolate(t,o,h),this.constrainInternal(),this._calcMatrices()}resize(t,o,h=!0){this._width=t,this._height=o,h&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,o;return((t=this._latRange)===null||t===void 0?void 0:t.length)!==2||((o=this._lngRange)===null||o===void 0?void 0:o.length)!==2?null:new tt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-l.am,l.am])}getCameraQueryGeometry(t,o){if(o.length===1)return[o[0],t];{let{minX:h,minY:p,maxX:v,maxY:T}=l.a8.fromPoints(o).extend(t);return[new l.P(h,p),new l.P(v,p),new l.P(v,T),new l.P(h,T),new l.P(h,p)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:o,zoom:h}=this.applyConstrain(this.center,this.zoom);this.setCenter(o),this.setZoom(h),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=l.ap(new Float64Array(16));l.S(t,t,[this._width/2,-this._height/2,1]),l.Q(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=l.ap(new Float64Array(16)),l.S(t,t,[1,-1,1]),l.Q(t,t,[-1,-1,0]),l.S(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,o,h,p){let v=h!==void 0?h:this.bearing,T=p=p!==void 0?p:this.pitch,{distanceToCenter:M,clampedElevation:C}=this._distanceToCenterFromAltElevationPitch(o,this.elevation,T),{x:z,y:P}=Ao(T,v),k=l.a7.fromLngLat(t,o),L,N,G=l.aY(1,k.y),$=0;do{if($+=1,$>10)break;N=M/G,L=new l.a7(k.x+z*N,k.y+P*N),G=1/L.meterInMercatorCoordinateUnits()}while(Math.abs(M-N*G)>1e-12);return{center:L.toLngLat(),elevation:C,zoom:l.ar(this.height/2/Math.tan(this.fovInRadians/2)/N/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let o=1/this.worldSize,h=l.aq(1,this.center.lat)*this.worldSize,p=l.a7.fromLngLat(this.center,this.elevation),v=p.x/o,T=p.y/o,M=p.z/o,C=this.pitch,z=this.bearing,{x:P,y:k,z:L}=Ao(C,z),N=this.cameraToCenterDistance,G=v+N*-P,$=T+N*-k,J=M+N*L,{distanceToCenter:W,clampedElevation:ee}=this._distanceToCenterFromAltElevationPitch(J/h,t,C),ae=W*h,te=new l.a7((G+P*ae)*o,($+k*ae)*o,0).toLngLat(),Q=l.aq(1,te.lat),re=l.ar(this.height/2/Math.tan(this.fovInRadians/2)/W/Q/this.tileSize);this._elevation=ee,this._center=te,this.setZoom(re)}_distanceToCenterFromAltElevationPitch(t,o,h){let p=-Math.cos(l.an(h)),v=t-o,T,M=o;return p*v>=0||Math.abs(p)<.1?(T=1e4,M=t+T*p):T=-v/p,{distanceToCenter:T,clampedElevation:M}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let t=l.aq(1,this.center.lat)*this.worldSize;return Ka(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let o=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/o,t.canonical.y/o,1/o/l.a6,1/o/l.a6]}}class ua{constructor(t,o){this.min=t,this.max=o,this.center=l.aZ([],l.a_([],this.min,this.max),.5)}quadrant(t){let o=[t%2==0,t<2],h=l.a$(this.min),p=l.a$(this.max);for(let v=0;v<o.length;v++)h[v]=o[v]?this.min[v]:this.center[v],p[v]=o[v]?this.center[v]:this.max[v];return p[2]=this.max[2],new ua(h,p)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let o=!0;for(let h of t.planes){let p=this.intersectsPlane(h);if(p===0)return 0;p===1&&(o=!1)}return o?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let o=t[3],h=t[3];for(let p=0;p<3;p++)t[p]>0?(o+=t[p]*this.min[p],h+=t[p]*this.max[p]):(h+=t[p]*this.min[p],o+=t[p]*this.max[p]);return o>=0?2:h<0?0:1}}class tu{distanceToTile2d(t,o,h,p){let v=p,T=v.distanceX([t,o]),M=v.distanceY([t,o]);return Math.hypot(T,M)}getWrap(t,o,h){return h}getTileBoundingVolume(t,o,h,p){var v,T;let M=0,C=0;if(p?.terrain){let P=new l.a3(t.z,o,t.z,t.x,t.y),k=p.terrain.getMinMaxElevation(P);M=(v=k.minElevation)!==null&&v!==void 0?v:Math.min(0,h),C=(T=k.maxElevation)!==null&&T!==void 0?T:Math.max(0,h)}let z=1<<t.z;return new ua([o+t.x/z,t.y/z,M],[o+(t.x+1)/z,(t.y+1)/z,C])}allowVariableZoom(t,o){let h=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,p=l.al(78.5-h/2,0,60);return!!o.terrain||t.pitch>p}allowWorldCopies(){return!0}prepareNextFrame(){}}class tr{constructor(t,o,h){this.points=t,this.planes=o,this.aabb=h}static fromInvProjectionMatrix(t,o=1,h=0,p,v){let T=v?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],M=Math.pow(2,h),C=[[-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((L=>(function(N,G,$,J){let W=l.aE([],N,G),ee=1/W[3]/$*J;return l.b4(W,W,[ee,ee,1/W[3],ee])})(L,t,o,M)));p&&(function(L,N,G,$){let J=$?4:0,W=$?0:4,ee=0,ae=[],te=[];for(let ie=0;ie<4;ie++){let me=l.b0([],L[ie+W],L[ie+J]),Te=l.b5(me);l.aZ(me,me,1/Te),ae.push(Te),te.push(me)}for(let ie=0;ie<4;ie++){let me=l.b6(L[ie+J],te[ie],G);ee=me!==null&&me>=0?Math.max(ee,me):Math.max(ee,ae[ie])}let Q=(function(ie,me){let Te=l.b0([],ie[me[0]],ie[me[1]]),Se=l.b0([],ie[me[2]],ie[me[1]]),Pe=[0,0,0,0];return l.b1(Pe,l.b2([],Te,Se)),Pe[3]=-l.b3(Pe,ie[me[0]]),Pe})(L,N),re=(function(ie,me){let Te=l.b7(ie),Se=l.b8([],ie,1/Te),Pe=l.b0([],me,l.aZ([],Se,l.b3(me,Se))),De=l.b7(Pe);if(De>0){let Qe=Math.sqrt(1-Se[3]*Se[3]),je=l.aZ([],Se,-Se[3]),Ae=l.a_([],je,l.aZ([],Pe,Qe/De));return l.b9(me,Ae)}return null})(G,Q);if(re!==null){let ie=re/l.b3(te[0],Q);ee=Math.min(ee,ie)}for(let ie=0;ie<4;ie++){let me=Math.min(ee,ae[ie]);L[ie+W]=[L[ie+J][0]+te[ie][0]*me,L[ie+J][1]+te[ie][1]*me,L[ie+J][2]+te[ie][2]*me,1]}})(C,T[0],p,v);let z=T.map((L=>{let N=l.b0([],C[L[0]],C[L[1]]),G=l.b0([],C[L[2]],C[L[1]]),$=l.b1([],l.b2([],N,G)),J=-l.b3($,C[L[1]]);return $.concat(J)})),P=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],k=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let L of C)for(let N=0;N<3;N++)P[N]=Math.min(P[N],L[N]),k[N]=Math.max(k[N],L[N]);return new tr(C,z,new ua(P,k))}}class ko{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,o,h){this._helper.interpolatePadding(t,o,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,o,h=!0){this._helper.resize(t,o,h)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,o){this._helper.overrideNearFarZ(t,o)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,o){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(o,h)=>{h=l.al(+h,this.minZoom,this.maxZoom);let p={center:new l.W(o.lng,o.lat),zoom:h},v=this._helper._lngRange;if(!this._helper._renderWorldCopies&&v===null){let te=179.9999999999;v=[-te,te]}let T=this.tileSize*l.ao(p.zoom),M=0,C=T,z=0,P=T,k=0,L=0,{x:N,y:G}=this.size;if(this._helper._latRange){let te=this._helper._latRange;M=l.Y(te[1])*T,C=l.Y(te[0])*T,C-M<G&&(k=G/(C-M))}v&&(z=l.X(l.Z(v[0])*T,0,T),P=l.X(l.Z(v[1])*T,0,T),P<z&&(P+=T),P-z<N&&(L=N/(P-z)));let{x:$,y:J}=Et(T,o),W,ee,ae=Math.max(L||0,k||0);if(ae){let te=new l.P(L?(P+z)/2:$,k?(C+M)/2:J);return p.center=Ii(T,te).wrap(),p.zoom+=l.ar(ae),p}if(this._helper._latRange){let te=G/2;J-te<M&&(ee=M+te),J+te>C&&(ee=C-te)}if(v){let te=(z+P)/2,Q=$;this._helper._renderWorldCopies&&(Q=l.X($,te-T/2,te+T/2));let re=N/2;Q-re<z&&(W=z+re),Q+re>P&&(W=P-re)}if(W!==void 0||ee!==void 0){let te=new l.P(W??$,ee??J);p.center=Ii(T,te).wrap()}return p},this.applyConstrain=(o,h)=>this._helper.applyConstrain(o,h),this._helper=new Io({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(o,h)=>this.defaultConstrain(o,h)},t),this._coveringTilesDetailsProvider=new tu}clone(){let t=new ko;return t.apply(this,!1),t}apply(t,o,h){this._helper.apply(t,o,h)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let o=[new l.ba(0,t)];if(this._helper._renderWorldCopies){let h=this.screenPointToMercatorCoordinate(new l.P(0,0)),p=this.screenPointToMercatorCoordinate(new l.P(this._helper._width,0)),v=this.screenPointToMercatorCoordinate(new l.P(this._helper._width,this._helper._height)),T=this.screenPointToMercatorCoordinate(new l.P(0,this._helper._height)),M=Math.floor(Math.min(h.x,p.x,v.x,T.x)),C=Math.floor(Math.max(h.x,p.x,v.x,T.x)),z=1;for(let P=M-z;P<=C+z;P++)P!==0&&o.push(new l.ba(P,t))}return o}getCameraFrustum(){return tr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let o=this.screenPointToLocation(this.centerPoint,t),h=t?t.getElevationForLngLatZoom(o,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(h)}setLocationAtPoint(t,o){let h=l.aq(this.elevation,this.center.lat),p=this.screenPointToMercatorCoordinateAtZ(o,h),v=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,h),T=l.a7.fromLngLat(t),M=new l.a7(T.x-(p.x-v.x),T.y-(p.y-v.y));this.setCenter(M?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,o){return o?this.coordinatePoint(l.a7.fromLngLat(t),o.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(l.a7.fromLngLat(t))}screenPointToLocation(t,o){var h;return(h=this.screenPointToMercatorCoordinate(t,o))===null||h===void 0?void 0:h.toLngLat()}screenPointToMercatorCoordinate(t,o){if(o){let h=o.pointCoordinate(t);if(h!=null)return h}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,o){let h=o||0,p=[t.x,t.y,0,1],v=[t.x,t.y,1,1];l.aE(p,p,this._pixelMatrixInverse),l.aE(v,v,this._pixelMatrixInverse);let T=p[3],M=v[3],C=p[1]/T,z=v[1]/M,P=p[2]/T,k=v[2]/M,L=P===k?0:(h-P)/(k-P);return new l.a7(l.H.number(p[0]/T,v[0]/M,L)/this.worldSize,l.H.number(C,z,L)/this.worldSize,h)}coordinatePoint(t,o=0,h=this._pixelMatrix){let p=[t.x*this.worldSize,t.y*this.worldSize,o,1];return l.aE(p,p,h),new l.P(p[0]/p[3],p[1]/p[3])}getBounds(){let t=Math.max(0,this._helper._height/2-ca(this));return new tt().extend(this.screenPointToLocation(new l.P(0,t))).extend(this.screenPointToLocation(new l.P(this._helper._width,t))).extend(this.screenPointToLocation(new l.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new l.P(0,this._helper._height)))}isPointOnMapSurface(t,o){return o?o.pointCoordinate(t)!=null:t.y>this.height/2-ca(this)}calculatePosMatrix(t,o=!1,h){var p;let v=(p=t.key)!==null&&p!==void 0?p:l.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),T=o?this._alignedPosMatrixCache:this._posMatrixCache;if(T.has(v)){let z=T.get(v);return h?z.f32:z.f64}let M=Wa(t,this.worldSize);l.U(M,o?this._alignedProjMatrix:this._viewProjMatrix,M);let C={f64:M,f32:new Float32Array(M)};return T.set(v,C),h?C.f32:C.f64}calculateFogMatrix(t){let o=t.key,h=this._fogMatrixCacheF32;if(h.has(o))return h.get(o);let p=Wa(t,this.worldSize);return l.U(p,this._fogMatrix,p),h.set(o,new Float32Array(p)),h.get(o)}calculateCenterFromCameraLngLatAlt(t,o,h,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,o,h,p)}_calculateNearFarZIfNeeded(t,o,h){if(!this._helper.autoCalculateNearFarZ)return;let p=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),v=t-p*this._helper._pixelPerMeter/Math.cos(o),T=p<0?v:t,M=Math.PI/2+this.pitchInRadians,C=l.an(this.fov)*(Math.abs(Math.cos(l.an(this.roll)))*this.height+Math.abs(Math.sin(l.an(this.roll)))*this.width)/this.height*(.5+h.y/this.height),z=Math.sin(C)*T/Math.sin(l.al(Math.PI-M-C,.01,Math.PI-.01)),P=ca(this),k=Math.atan(P/this._helper.cameraToCenterDistance),L=l.an(.75),N=k>L?2*k*(.5+h.y/(2*P)):L,G=Math.sin(N)*T/Math.sin(l.al(Math.PI-M-N,.01,Math.PI-.01)),$=Math.min(z,G);this._helper._farZ=1.01*(Math.cos(Math.PI/2-o)*$+T),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,o=Et(this.worldSize,this.center),h=o.x,p=o.y;this._helper._pixelPerMeter=l.aq(1,this.center.lat)*this.worldSize;let v=l.an(Math.min(this.pitch,mn)),T=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(v)),M;var C,z;this._calculateNearFarZIfNeeded(T,v,t),M=new Float64Array(16),l.bc(M,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(C=this._invProjMatrix)[0]=1/(z=M)[0],C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=1/z[5],C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=0,C[11]=1/z[14],C[12]=0,C[13]=0,C[14]=-1,C[15]=z[10]/z[14],M[8]=2*-t.x/this._helper._width,M[9]=2*t.y/this._helper._height,this._projectionMatrix=l.bd(M),l.S(M,M,[1,-1,1]),l.Q(M,M,[0,0,-this._helper.cameraToCenterDistance]),l.be(M,M,-this.rollInRadians),l.bf(M,M,this.pitchInRadians),l.be(M,M,-this.bearingInRadians),l.Q(M,M,[-h,-p,0]),this._mercatorMatrix=l.S([],M,[this.worldSize,this.worldSize,this.worldSize]),l.S(M,M,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=l.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,M),l.Q(M,M,[0,0,-this.elevation]),this._viewProjMatrix=M,this._invViewProjMatrix=l.bg([],M);let P=[0,0,-1,1];l.aE(P,P,this._invViewProjMatrix),this._cameraPosition=[P[0]/P[3],P[1]/P[3],P[2]/P[3]],this._fogMatrix=new Float64Array(16),l.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,T,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,l.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),l.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),l.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),l.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),l.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),l.Q(this._fogMatrix,this._fogMatrix,[-h,-p,0]),l.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),l.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=l.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,M);let k=this._helper._width%2/2,L=this._helper._height%2/2,N=Math.cos(this.bearingInRadians),G=Math.sin(-this.bearingInRadians),$=h-Math.round(h)+N*k+G*L,J=p-Math.round(p)+N*L+G*k,W=new Float64Array(M);if(l.Q(W,W,[$>.5?$-1:$,J>.5?J-1:J,0]),this._alignedProjMatrix=W,M=l.bg(new Float64Array(16),this._pixelMatrix),!M)throw new Error("failed to invert matrix");this._pixelMatrixInverse=M,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new l.P(0,0)),o=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.aE(o,o,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=l.aq(1,this.center.lat)*this.worldSize;return Ka(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,o){let h=l.a7.fromLngLat(t),p=[h.x*this.worldSize,h.y*this.worldSize,o,1];return l.aE(p,p,this._viewProjMatrix),p[2]/p[3]}getProjectionData(t){let{overscaledTileID:o,aligned:h,applyTerrainMatrix:p}=t,v=this._helper.getMercatorTileCoordinates(o),T=o?this.calculatePosMatrix(o,h,!0):null,M;return M=o?.terrainRttPosMatrix32f&&p?o.terrainRttPosMatrix32f:T||l.bh(),{mainMatrix:M,tileMercatorCoords:v,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:M}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,o,h){return 1}transformLightDirection(t){return l.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,o,h,p){let v=this.calculatePosMatrix(h),T;p?(T=[t,o,p(t,o),1],l.aE(T,T,v)):(T=[t,o,0,1],Qc(T,T,v));let M=T[3];return{point:new l.P(T[0]/M,T[1]/M),signedDistanceFromCamera:M,isOccluded:!1}}populateCache(t){for(let o of t)this.calculatePosMatrix(o)}getMatrixForModel(t,o){let h=l.a7.fromLngLat(t,o),p=h.meterInMercatorCoordinateUnits(),v=l.bi();return l.Q(v,v,[h.x,h.y,h.z]),l.be(v,v,Math.PI),l.bf(v,v,Math.PI/2),l.S(v,v,[-p,p,p]),v}getProjectionDataForCustomLayer(t=!0){let o=new l.a3(0,0,0,0,0),h=this.getProjectionData({overscaledTileID:o,applyGlobeMatrix:t}),p=Wa(o,this.worldSize);l.U(p,this._viewProjMatrix,p),h.tileMercatorCoords=[0,0,1,1];let v=[l.a6,l.a6,this.worldSize/this._helper.pixelsPerMeter],T=l.bj();return l.S(T,p,v),h.fallbackMatrix=T,h.mainMatrix=T,h}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Da(){l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function $f(g){if(g.useSlerp)if(g.k<1){let t=l.bk(g.startEulerAngles.roll,g.startEulerAngles.pitch,g.startEulerAngles.bearing),o=l.bk(g.endEulerAngles.roll,g.endEulerAngles.pitch,g.endEulerAngles.bearing),h=new Float64Array(4);l.bl(h,t,o,g.k);let p=l.bm(h);g.tr.setRoll(p.roll),g.tr.setPitch(p.pitch),g.tr.setBearing(p.bearing)}else g.tr.setRoll(g.endEulerAngles.roll),g.tr.setPitch(g.endEulerAngles.pitch),g.tr.setBearing(g.endEulerAngles.bearing);else g.tr.setRoll(l.H.number(g.startEulerAngles.roll,g.endEulerAngles.roll,g.k)),g.tr.setPitch(l.H.number(g.startEulerAngles.pitch,g.endEulerAngles.pitch,g.k)),g.tr.setBearing(l.H.number(g.startEulerAngles.bearing,g.endEulerAngles.bearing,g.k))}function _d(g,t,o,h,p){let v=p.padding,T=Et(p.worldSize,o.getNorthWest()),M=Et(p.worldSize,o.getNorthEast()),C=Et(p.worldSize,o.getSouthEast()),z=Et(p.worldSize,o.getSouthWest()),P=l.an(-h),k=T.rotate(P),L=M.rotate(P),N=C.rotate(P),G=z.rotate(P),$=new l.P(Math.max(k.x,L.x,G.x,N.x),Math.max(k.y,L.y,G.y,N.y)),J=new l.P(Math.min(k.x,L.x,G.x,N.x),Math.min(k.y,L.y,G.y,N.y)),W=$.sub(J),ee=(p.width-(v.left+v.right+t.left+t.right))/W.x,ae=(p.height-(v.top+v.bottom+t.top+t.bottom))/W.y;if(ae<0||ee<0)return void Da();let te=Math.min(l.ar(p.scale*Math.min(ee,ae)),g.maxZoom),Q=l.P.convert(g.offset),re=new l.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(l.an(h)),ie=Q.add(re).mult(p.scale/l.ao(te));return{center:Ii(p.worldSize,T.add(C).div(2).sub(ie)),zoom:te,bearing:h}}class Lo{get useGlobeControls(){return!1}handlePanInertia(t,o){let h=t.mag(),p=Math.abs(ca(o));return{easingOffset:t.mult(Math.min(.75*p/h,1)),easingCenter:o.center}}handleMapControlsRollPitchBearingZoom(t,o){t.bearingDelta&&o.setBearing(o.bearing+t.bearingDelta),t.pitchDelta&&o.setPitch(o.pitch+t.pitchDelta),t.rollDelta&&o.setRoll(o.roll+t.rollDelta),t.zoomDelta&&o.setZoom(o.zoom+t.zoomDelta)}handleMapControlsPan(t,o,h){t.around.distSqr(o.centerPoint)<.01||o.setLocationAtPoint(h,t.around)}cameraForBoxAndBearing(t,o,h,p,v){return _d(t,o,h,p,v)}handleJumpToCenterZoom(t,o){t.zoom!==(o.zoom!==void 0?+o.zoom:t.zoom)&&t.setZoom(+o.zoom),o.center!==void 0&&t.setCenter(l.W.convert(o.center))}handleEaseTo(t,o){let h=t.zoom,p=t.padding,v={roll:t.roll,pitch:t.pitch,bearing:t.bearing},T={roll:o.roll===void 0?t.roll:o.roll,pitch:o.pitch===void 0?t.pitch:o.pitch,bearing:o.bearing===void 0?t.bearing:o.bearing},M=o.zoom!==void 0,C=!t.isPaddingEqual(o.padding),z=!1,P=M?+o.zoom:t.zoom,k=t.centerPoint.add(o.offsetAsPoint),L=t.screenPointToLocation(k),{center:N,zoom:G}=t.applyConstrain(l.W.convert(o.center||L),P??h);to(t,N);let $=Et(t.worldSize,L),J=Et(t.worldSize,N).sub($),W=l.ao(G-h);return z=G!==h,{easeFunc:ee=>{if(z&&t.setZoom(l.H.number(h,G,ee)),l.bn(v,T)||$f({startEulerAngles:v,endEulerAngles:T,tr:t,k:ee,useSlerp:v.roll!=T.roll}),C&&(t.interpolatePadding(p,o.padding,ee),k=t.centerPoint.add(o.offsetAsPoint)),o.around)t.setLocationAtPoint(o.around,o.aroundPoint);else{let ae=l.ao(t.zoom-h),te=G>h?Math.min(2,W):Math.max(.5,W),Q=Math.pow(te,1-ee),re=Ii(t.worldSize,$.add(J.mult(ee*Q)).mult(ae));t.setLocationAtPoint(t.renderWorldCopies?re.wrap():re,k)}},isZooming:z,elevationCenter:N}}handleFlyTo(t,o){let h=o.zoom!==void 0,p=t.zoom,v=t.applyConstrain(l.W.convert(o.center||o.locationAtOffset),h?+o.zoom:p),T=v.center,M=v.zoom;to(t,T);let C=Et(t.worldSize,o.locationAtOffset),z=Et(t.worldSize,T).sub(C),P=z.mag(),k=l.ao(M-p),L;if(o.minZoom!==void 0){let N=Math.min(+o.minZoom,p,M),G=t.applyConstrain(T,N).zoom;L=l.ao(G-p)}return{easeFunc:(N,G,$,J)=>{t.setZoom(N===1?M:p+l.ar(G));let W=N===1?T:Ii(t.worldSize,C.add(z.mult($)).mult(G));t.setLocationAtPoint(t.renderWorldCopies?W.wrap():W,J)},scaleOfZoom:k,targetCenter:T,scaleOfMinZoom:L,pixelPathLength:P}}}class Xt{constructor(t,o,h){this.blendFunction=t,this.blendColor=o,this.mask=h}}Xt.Replace=[1,0],Xt.disabled=new Xt(Xt.Replace,l.bo.transparent,[!1,!1,!1,!1]),Xt.unblended=new Xt(Xt.Replace,l.bo.transparent,[!0,!0,!0,!0]),Xt.alphaBlended=new Xt([1,771],l.bo.transparent,[!0,!0,!0,!0]);let Rs=2305;class vt{constructor(t,o,h){this.enable=t,this.mode=o,this.frontFace=h}}vt.disabled=new vt(!1,1029,Rs),vt.backCCW=new vt(!0,1029,Rs),vt.frontCCW=new vt(!0,1028,Rs);class ht{constructor(t,o,h){this.func=t,this.mask=o,this.range=h}}ht.ReadOnly=!1,ht.ReadWrite=!0,ht.disabled=new ht(519,ht.ReadOnly,[0,1]);let Is=7680;class bt{constructor(t,o,h,p,v,T){this.test=t,this.ref=o,this.mask=h,this.fail=p,this.depthFail=v,this.pass=T}}function Gr(g){return typeof WebGL2RenderingContext<"u"&&g instanceof WebGL2RenderingContext}bt.disabled=new bt({func:519,mask:0},0,0,Is,Is,Is);class ks{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;let o=t.context,h=o.gl;this._texFormat=h.RGBA,this._texType=h.UNSIGNED_BYTE;let p=new l.aU;p.emplaceBack(-1,-1),p.emplaceBack(2,-1),p.emplaceBack(-1,2);let v=new l.aW;v.emplaceBack(0,1,2),this._fullscreenTriangle=new $t(o.createVertexBuffer(p,eo.members),o.createIndexBuffer(v),l.aV.simpleSegment(0,0,p.length,v.length)),this._resultBuffer=new Uint8Array(4),o.activeTexture.set(h.TEXTURE1);let T=h.createTexture();h.bindTexture(h.TEXTURE_2D,T),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texImage2D(h.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=o.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(T),Gr(h)&&(this._pbo=h.createBuffer(),h.bindBuffer(h.PIXEL_PACK_BUFFER,this._pbo),h.bufferData(h.PIXEL_PACK_BUFFER,4,h.STREAM_READ),h.bindBuffer(h.PIXEL_PACK_BUFFER,null))}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,o){let h=this._updateCount;return this._readbackQueue?h>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():h>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,o),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,o=t.gl;t.activeTexture.set(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,o){let h=this._cachedRenderContext.context,p=h.gl;if(this._bindFramebuffer(),h.viewport.set([0,0,this._texWidth,this._texHeight]),h.clear({color:l.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(h,p.TRIANGLES,ht.disabled,bt.disabled,Xt.unblended,vt.disabled,((v,T)=>({u_input:v,u_output_expected:T}))(t,o),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Gr(p)){p.bindBuffer(p.PIXEL_PACK_BUFFER,this._pbo),p.readBuffer(p.COLOR_ATTACHMENT0),p.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),p.bindBuffer(p.PIXEL_PACK_BUFFER,null);let v=p.fenceSync(p.SYNC_GPU_COMMANDS_COMPLETE,0);p.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:v}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Gr(t)){let o=t.clientWaitSync(this._readbackQueue.sync,0,0);if(o===t.WAIT_FAILED)return l.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(o===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ks._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let o=0;return o+=t[0]/256,o+=t[1]/65536,o+=t[2]/16777216,t[3]<127&&(o=-o),o/128}}let Oo=l.a6/128;function Ls(g,t){let o=g.granularity!==void 0?Math.max(g.granularity,1):1,h=o+(g.generateBorders?2:0),p=o+(g.extendToNorthPole||g.generateBorders?1:0)+(g.extendToSouthPole||g.generateBorders?1:0),v=h+1,T=p+1,M=g.generateBorders?-1:0,C=g.generateBorders||g.extendToNorthPole?-1:0,z=o+(g.generateBorders?1:0),P=o+(g.generateBorders||g.extendToSouthPole?1:0),k=v*T,L=h*p*6,N=v*T>65536;if(N&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let G=N||t==="32bit",$=new Int16Array(2*k),J=0;for(let ae=C;ae<=P;ae++)for(let te=M;te<=z;te++){let Q=te/o*l.a6;te===-1&&(Q=-Oo),te===o+1&&(Q=l.a6+Oo);let re=ae/o*l.a6;ae===-1&&(re=g.extendToNorthPole?l.bq:-Oo),ae===o+1&&(re=g.extendToSouthPole?l.br:l.a6+Oo),$[J++]=Q,$[J++]=re}let W=G?new Uint32Array(L):new Uint16Array(L),ee=0;for(let ae=0;ae<p;ae++)for(let te=0;te<h;te++){let Q=te+1+ae*v,re=te+(ae+1)*v,ie=te+1+(ae+1)*v;W[ee++]=te+ae*v,W[ee++]=re,W[ee++]=Q,W[ee++]=Q,W[ee++]=re,W[ee++]=ie}return{vertices:$.buffer.slice(0),indices:W.buffer.slice(0),uses32bitIndices:G}}let yd=new l.aT({fill:new l.bs(128,2),line:new l.bs(512,0),tile:new l.bs(128,32),stencil:new l.bs(128,1),circle:3});class iu{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return pi.projectionGlobe}get vertexShaderPreludeCode(){return pi.projectionMercator.vertexSource}get subdivisionGranularity(){return yd}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new ks(t));let o=l.Y(this._errorQueryLatitudeDegrees),h=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI,p=this._errorMeasurement.updateErrorLoop(o,h),v=ce();p!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=p,this._errorMeasurementLastChangeTime=v);let T=Math.min(Math.max((v-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=l.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,l.bu(T))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,o,h,p,v){let T=(v==="stencil"?yd.stencil:yd.tile).getGranularityForZoomLevel(o.z);return this._getMesh(t,{granularity:T,generateBorders:h,extendToNorthPole:o.y===0&&p,extendToSouthPole:o.y===(1<<o.z)-1&&p})}_getMesh(t,o){let h=this._getMeshKey(o);if(h in this._tileMeshCache)return this._tileMeshCache[h];let p=(function(v,T){let M=Ls(T,"16bit"),C=l.aU.deserialize({arrayBuffer:M.vertices,length:M.vertices.byteLength/2/2}),z=l.aW.deserialize({arrayBuffer:M.indices,length:M.indices.byteLength/2/3});return new $t(v.createVertexBuffer(C,eo.members),v.createIndexBuffer(z),l.aV.simpleSegment(0,0,C.length,z.length))})(t,o);return this._tileMeshCache[h]=p,p}recalculate(t){}hasTransition(){var t;let o=ce(),h=!1;return h||(h=(o-this._errorMeasurementLastChangeTime)/1e3<.7),h||(h=(t=this._errorMeasurement)===null||t===void 0?void 0:t.awaitingQuery),h}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}let Xf=new l.u({type:new l.D(l.x.projection.type)});class Yf extends l.E{constructor(t){super(),this._transitionable=new l.y(Xf,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.J(0)),this._mercatorProjection=new Un,this._verticalPerspectiveProjection=new iu}get transitionState(){let t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof l.bv){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,o,h,p,v){return this.currentProjection.getMeshFromTileID(t,o,h,p,v)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function Wf(g){let t=cr(g.worldSize,g.center.lat);return 2*Math.PI*t}function ki(g,t,o,h,p){let v=1/(1<<p),T=t/l.a6*v+h*v,M=l.by((g/l.a6*v+o*v)*Math.PI*2+Math.PI,2*Math.PI),C=2*Math.atan(Math.exp(Math.PI-T*Math.PI*2))-.5*Math.PI,z=Math.cos(C),P=new Float64Array(3);return P[0]=Math.sin(M)*z,P[1]=Math.sin(C),P[2]=Math.cos(M)*z,P}function en(g){return(function(t,o){let h=Math.cos(o),p=new Float64Array(3);return p[0]=Math.sin(t)*h,p[1]=Math.sin(o),p[2]=Math.cos(t)*h,p})(g.lng*Math.PI/180,g.lat*Math.PI/180)}function cr(g,t){return g/(2*Math.PI)/Math.cos(t*Math.PI/180)}function ql(g){let t=Math.asin(g[1])/Math.PI*180,o=Math.sqrt(g[0]*g[0]+g[2]*g[2]);if(o>1e-6){let h=g[0]/o,p=Math.acos(g[2]/o),v=(h>0?p:-p)/Math.PI*180;return new l.W(l.X(v,-180,180),t)}return new l.W(0,t)}function Gl(g){return Math.cos(g*Math.PI/180)}function Hi(g,t){let o=Gl(g),h=Gl(t);return l.ar(h/o)}function Bo(g,t){let o=g.rotate(t.bearingInRadians),h=t.zoom+Hi(t.center.lat,0),p=l.bt(1/Gl(t.center.lat),1/Gl(Math.min(Math.abs(t.center.lat),60)),l.bw(h,7,3,0,1)),v=360/Wf({worldSize:t.worldSize,center:{lat:t.center.lat}});return new l.W(t.center.lng-o.x*v*p,l.al(t.center.lat+o.y*v,-l.am,l.am))}function vd(g){let t=.5*g,o=Math.sin(t),h=Math.cos(t);return Math.log(o+h)-Math.log(h-o)}function Kf(g,t,o,h){let p=g.lat+o*h;if(Math.abs(o)>1){let v=(Math.sign(g.lat+o)!==Math.sign(g.lat)?-Math.abs(g.lat):Math.abs(g.lat))*Math.PI/180,T=Math.abs(g.lat+o)*Math.PI/180,M=vd(v+h*(T-v)),C=vd(v),z=vd(T);return new l.W(g.lng+t*((M-C)/(z-C)),p)}return new l.W(g.lng+t*h,p)}class u1{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,o,h,p){let v=`${t.z}_${t.x}_${t.y}_${p?.terrain?"t":""}`,T=this._cache.get(v);if(T)return T;let M=this._cachePrevious.get(v);if(M)return this._cache.set(v,M),M;let C=this._boundingVolumeFactory(t,o,h,p);return this._cache.set(v,C),this._hadAnyChanges=!0,C}}class Os{constructor(t,o,h,p){this.min=h,this.max=p,this.points=t,this.planes=o}static fromAabb(t,o){let h=[];for(let p=0;p<8;p++)h.push([1&~p?t[0]:o[0],(p>>1&1)==1?o[1]:t[1],(p>>2&1)==1?o[2]:t[2]]);return new Os(h,[[-1,0,0,o[0]],[1,0,0,-t[0]],[0,-1,0,o[1]],[0,1,0,-t[1]],[0,0,-1,o[2]],[0,0,1,-t[2]]],t,o)}static fromCenterSizeAngles(t,o,h){let p=l.bA([],h[0],h[1],h[2]),v=l.bB([],[o[0],0,0],p),T=l.bB([],[0,o[1],0],p),M=l.bB([],[0,0,o[2]],p),C=[...t],z=[...t];for(let k=0;k<8;k++)for(let L=0;L<3;L++){let N=t[L]+v[L]*(1&~k?-1:1)+T[L]*((k>>1&1)==1?1:-1)+M[L]*((k>>2&1)==1?1:-1);C[L]=Math.min(C[L],N),z[L]=Math.max(z[L],N)}let P=[];for(let k=0;k<8;k++){let L=[...t];l.a_(L,L,l.aZ([],v,1&~k?-1:1)),l.a_(L,L,l.aZ([],T,(k>>1&1)==1?1:-1)),l.a_(L,L,l.aZ([],M,(k>>2&1)==1?1:-1)),P.push(L)}return new Os(P,[[...v,-l.b3(v,P[0])],[...T,-l.b3(T,P[0])],[...M,-l.b3(M,P[0])],[-v[0],-v[1],-v[2],-l.b3(v,P[7])],[-T[0],-T[1],-T[2],-l.b3(T,P[7])],[-M[0],-M[1],-M[2],-l.b3(M,P[7])]],C,z)}intersectsFrustum(t){let o=!0,h=this.points.length,p=this.planes.length,v=t.planes.length,T=t.points.length;for(let M=0;M<v;M++){let C=t.planes[M],z=0;for(let P=0;P<h;P++){let k=this.points[P];C[0]*k[0]+C[1]*k[1]+C[2]*k[2]+C[3]>=0&&z++}if(z===0)return 0;z<h&&(o=!1)}if(o)return 2;for(let M=0;M<p;M++){let C=this.planes[M],z=0;for(let P=0;P<T;P++){let k=t.points[P];C[0]*k[0]+C[1]*k[1]+C[2]*k[2]+C[3]>=0&&z++}if(z===0)return 0}return 1}intersectsPlane(t){let o=this.points.length,h=0;for(let p=0;p<o;p++){let v=this.points[p];t[0]*v[0]+t[1]*v[1]+t[2]*v[2]+t[3]>=0&&h++}return h===o?2:h===0?0:1}}function nu(g,t,o){let h=g-t;return h<0?-h:Math.max(0,h-o)}function bd(g,t,o,h,p){let v=g-o,T;return T=v<0?Math.min(-v,1+v-p):v>p?Math.min(Math.max(v-p,0),1-v):0,Math.max(T,nu(t,h,p))}class ru{constructor(){this._boundingVolumeCache=new u1(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,o,h,p){let v=1<<h.z,T=1/v,M=h.x/v,C=h.y/v,z=2;return z=Math.min(z,bd(t,o,M,C,T)),z=Math.min(z,bd(t,o,M+.5,-C-T,T)),z=Math.min(z,bd(t,o,M+.5,2-C-T,T)),z}getWrap(t,o,h){let p=1<<o.z,v=1/p,T=o.x/p,M=nu(t.x,T,v),C=nu(t.x,T-1,v),z=nu(t.x,T+1,v),P=Math.min(M,C,z);return P===z?1:P===C?-1:0}allowVariableZoom(t,o){return Jn(t,o)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,o,h,p){return this._boundingVolumeCache.getTileBoundingVolume(t,o,h,p)}_computeTileBoundingVolume(t,o,h,p){var v,T;let M=0,C=0;if(p?.terrain){let z=new l.a3(t.z,o,t.z,t.x,t.y),P=p.terrain.getMinMaxElevation(z);M=(v=P.minElevation)!==null&&v!==void 0?v:Math.min(0,h),C=(T=P.maxElevation)!==null&&T!==void 0?T:Math.max(0,h)}if(M/=l.bD,C/=l.bD,M+=1,C+=1,t.z<=0)return Os.fromAabb([-C,-C,-C],[C,C,C]);if(t.z===1)return Os.fromAabb([t.x===0?-C:0,t.y===0?0:-C,-C],[t.x===0?0:C,t.y===0?C:0,C]);{let z=[ki(0,0,t.x,t.y,t.z),ki(l.a6,0,t.x,t.y,t.z),ki(l.a6,l.a6,t.x,t.y,t.z),ki(0,l.a6,t.x,t.y,t.z)],P=[];for(let Pe of z)P.push(l.aZ([],Pe,C));if(C!==M)for(let Pe of z)P.push(l.aZ([],Pe,M));t.y===0&&P.push([0,1,0]),t.y===(1<<t.z)-1&&P.push([0,-1,0]);let k=[1,1,1],L=[-1,-1,-1];for(let Pe of P)for(let De=0;De<3;De++)k[De]=Math.min(k[De],Pe[De]),L[De]=Math.max(L[De],Pe[De]);let N=ki(l.a6/2,l.a6/2,t.x,t.y,t.z),G=l.b2([],[0,1,0],N);l.b1(G,G);let $=l.b2([],N,G);l.b1($,$);let J=l.b2([],z[2],z[1]);l.b1(J,J);let W=l.b2([],z[0],z[3]);l.b1(W,W),P.push(l.aZ([],N,C)),t.y>=(1<<t.z)/2&&P.push(l.aZ([],ki(l.a6/2,0,t.x,t.y,t.z),C)),t.y<(1<<t.z)/2&&P.push(l.aZ([],ki(l.a6/2,l.a6,t.x,t.y,t.z),C));let ee=au(N,P),ae=au($,P),te=[-N[0],-N[1],-N[2],ee.max],Q=[N[0],N[1],N[2],-ee.min],re=[-$[0],-$[1],-$[2],ae.max],ie=[$[0],$[1],$[2],-ae.min],me=[...J,0],Te=[...W,0],Se=[];return t.y===0?Se.push(l.bC(Te,me,te),l.bC(Te,me,Q)):Se.push(l.bC(re,me,te),l.bC(re,me,Q),l.bC(re,Te,te),l.bC(re,Te,Q)),t.y===(1<<t.z)-1?Se.push(l.bC(Te,me,te),l.bC(Te,me,Q)):Se.push(l.bC(ie,me,te),l.bC(ie,me,Q),l.bC(ie,Te,te),l.bC(ie,Te,Q)),new Os(Se,[te,Q,re,ie,me,Te],k,L)}}}function au(g,t){let o=1/0,h=-1/0;for(let p of t){let v=l.b3(g,p);o=Math.min(o,v),h=Math.max(h,v)}return{min:o,max:h}}class Fo{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,o,h){this._helper.interpolatePadding(t,o,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,o){this._helper.resize(t,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,o){this._helper.overrideNearFarZ(t,o)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=l.bE(),this._projectionMatrix=l.bi(),this._globeViewProjMatrix32f=l.bh(),this._globeViewProjMatrixNoCorrection=l.bi(),this._globeViewProjMatrixNoCorrectionInverted=l.bi(),this._globeProjMatrixInverted=l.bi(),this._cameraPosition=l.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(o,h)=>{let p=l.al(o.lat,-l.am,l.am),v=l.al(+h,this.minZoom+Hi(0,p),this.maxZoom);return{center:new l.W(o.lng,p),zoom:v}},this.applyConstrain=(o,h)=>this._helper.applyConstrain(o,h),this._helper=new Io({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(o,h)=>this.defaultConstrain(o,h)},t),this._coveringTilesDetailsProvider=new ru}clone(){let t=new Fo;return t.apply(this,!1),t}apply(t,o,h){this._globeLatitudeErrorCorrectionRadians=h||0,this._helper.apply(t,o)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=l.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:o,applyGlobeMatrix:h}=t,p=this._helper.getMercatorTileCoordinates(o);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:p,clippingPlane:this._cachedClippingPlane,projectionTransition:h?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let o=this.pitchInRadians,h=this.cameraToCenterDistance/t,p=Math.sin(o)*h,v=Math.cos(o)*h+1,T=1/Math.sqrt(p*p+v*v)*1,M=-p,C=v,z=Math.sqrt(M*M+C*C);M/=z,C/=z;let P=[0,M,C];l.bF(P,P,[0,0,0],-this.bearingInRadians),l.bG(P,P,[0,0,0],-1*this.center.lat*Math.PI/180),l.bH(P,P,[0,0,0],this.center.lng*Math.PI/180);let k=1/l.b5(P);return l.aZ(P,P,k),[...P,-T*k]}isLocationOccluded(t){return!this.isSurfacePointVisible(en(t))}transformLightDirection(t){let o=this._helper._center.lng*Math.PI/180,h=this._helper._center.lat*Math.PI/180,p=Math.cos(h),v=[Math.sin(o)*p,Math.sin(h),Math.cos(o)*p],T=[v[2],0,-v[0]],M=[0,0,0];l.b2(M,T,v),l.b1(T,T),l.b1(M,M);let C=[0,0,0];return l.b1(C,[T[0]*t[0]+M[0]*t[1]+v[0]*t[2],T[1]*t[0]+M[1]*t[1]+v[1]*t[2],T[2]*t[0]+M[2]*t[1]+v[2]*t[2]]),C}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,o,h){let p=(function(M,C,z){let P=1/(1<<z.z);return new l.a7(M/l.a6*P+z.x*P,C/l.a6*P+z.y*P)})(t,o,h.canonical),v=(T=p.y,[l.by(p.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-T*Math.PI*2))-.5*Math.PI]);var T;return this.getCircleRadiusCorrection()/Math.cos(v[1])}projectTileCoordinates(t,o,h,p){let v=h.canonical,T=ki(t,o,v.x,v.y,v.z),M=1+(p?p(t,o):0)/l.bD,C=[T[0]*M,T[1]*M,T[2]*M,1];l.aE(C,C,this._globeViewProjMatrixNoCorrection);let z=this._cachedClippingPlane,P=z[0]*T[0]+z[1]*T[1]+z[2]*T[2]+z[3]<0;return{point:new l.P(C[0]/C[3],C[1]/C[3]),signedDistanceFromCamera:C[3],isOccluded:P}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=cr(this.worldSize,this.center.lat),o=l.bj(),h=l.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),l.bc(o,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let p=this.centerOffset;o[8]=2*-p.x/this._helper._width,o[9]=2*p.y/this._helper._height,this._projectionMatrix=l.bd(o),this._globeProjMatrixInverted=l.bj(),l.bg(this._globeProjMatrixInverted,o),l.Q(o,o,[0,0,-this.cameraToCenterDistance]),l.be(o,o,this.rollInRadians),l.bf(o,o,-this.pitchInRadians),l.be(o,o,this.bearingInRadians),l.Q(o,o,[0,0,-t]);let v=l.bz();v[0]=t,v[1]=t,v[2]=t,l.bf(h,o,this.center.lat*Math.PI/180),l.bI(h,h,-this.center.lng*Math.PI/180),l.S(h,h,v),this._globeViewProjMatrixNoCorrection=h,l.bf(o,o,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),l.bI(o,o,-this.center.lng*Math.PI/180),l.S(o,o,v),this._globeViewProjMatrix32f=new Float32Array(o),this._globeViewProjMatrixNoCorrectionInverted=l.bj(),l.bg(this._globeViewProjMatrixNoCorrectionInverted,h);let T=l.bz();this._cameraPosition=l.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,l.bF(this._cameraPosition,this._cameraPosition,T,-this.rollInRadians),l.bG(this._cameraPosition,this._cameraPosition,T,this.pitchInRadians),l.bF(this._cameraPosition,this._cameraPosition,T,-this.bearingInRadians),l.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),l.bG(this._cameraPosition,this._cameraPosition,T,-this.center.lat*Math.PI/180),l.bH(this._cameraPosition,this._cameraPosition,T,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let M=l.bd(this._globeViewProjMatrixNoCorrectionInverted);l.S(M,M,[1,1,-1]),this._cachedFrustum=tr.fromInvProjectionMatrix(M,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){l.w("calculateFogMatrix is not supported on globe projection.");let o=l.bj();return l.ap(o),o}getVisibleUnwrappedCoordinates(t){return[new l.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&l.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,o){if(!this._globeViewProjMatrixNoCorrection)return 1;let h=en(t);l.aZ(h,h,1+o/l.bD);let p=l.bE();return l.aE(p,[h[0],h[1],h[2],1],this._globeViewProjMatrixNoCorrection),p[2]/p[3]}populateCache(t){}getBounds(){let t=.5*this.width,o=.5*this.height,h=[new l.P(0,0),new l.P(t,0),new l.P(this.width,0),new l.P(this.width,o),new l.P(this.width,this.height),new l.P(t,this.height),new l.P(0,this.height),new l.P(0,o)],p=[];for(let k of h)p.push(this.unprojectScreenPoint(k));let v=0,T=0,M=0,C=0,z=this.center;for(let k of p){let L=l.bJ(z.lng,k.lng),N=l.bJ(z.lat,k.lat);L<T&&(T=L),L>v&&(v=L),N<C&&(C=N),N>M&&(M=N)}let P=[z.lng+T,z.lat+C,z.lng+v,z.lat+M];return this.isSurfacePointOnScreen([0,1,0])&&(P[3]=90,P[0]=-180,P[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(P[1]=-90,P[0]=-180,P[2]=180),new tt(P)}calculateCenterFromCameraLngLatAlt(t,o,h,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,o,h,p)}setLocationAtPoint(t,o){let h=en(this.unprojectScreenPoint(o)),p=en(t),v=l.bz();l.bK(v);let T=l.bz();l.bH(T,h,v,-this.center.lng*Math.PI/180),l.bG(T,T,v,this.center.lat*Math.PI/180);let M=p[0]*p[0]+p[2]*p[2],C=T[0]*T[0];if(M<C)return;let z=Math.sqrt(M-C),P=-z,k=l.bL(p[0],p[2],T[0],z),L=l.bL(p[0],p[2],T[0],P),N=l.bz();l.bH(N,p,v,-k);let G=l.bL(N[1],N[2],T[1],T[2]),$=l.bz();l.bH($,p,v,-L);let J=l.bL($[1],$[2],T[1],T[2]),W=.5*Math.PI,ee=G>=-W&&G<=W,ae=J>=-W&&J<=W,te,Q;if(ee&&ae){let Te=this.center.lng*Math.PI/180,Se=this.center.lat*Math.PI/180;l.bM(k,Te)+l.bM(G,Se)<l.bM(L,Te)+l.bM(J,Se)?(te=k,Q=G):(te=L,Q=J)}else if(ee)te=k,Q=G;else{if(!ae)return;te=L,Q=J}let re=te/Math.PI*180,ie=Q/Math.PI*180,me=this.center.lat;this.setCenter(new l.W(re,l.al(ie,-90,90))),this.setZoom(this.zoom+Hi(me,this.center.lat))}locationToScreenPoint(t,o){let h=en(t);if(o){let p=o.getElevationForLngLatZoom(t,this._helper._tileZoom);l.aZ(h,h,1+p/l.bD)}return this._projectSurfacePointToScreen(h)}_projectSurfacePointToScreen(t){let o=l.bE();return l.aE(o,[...t,1],this._globeViewProjMatrixNoCorrection),o[0]/=o[3],o[1]/=o[3],new l.P((.5*o[0]+.5)*this.width,(.5*-o[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,o){if(o){let h=o.pointCoordinate(t);if(h)return h}return l.a7.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,o){var h;return(h=this.screenPointToMercatorCoordinate(t,o))===null||h===void 0?void 0:h.toLngLat()}isPointOnMapSurface(t,o){let h=this._cameraPosition,p=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(h,p)}getRayDirectionFromPixel(t){let o=l.bE();o[0]=t.x/this.width*2-1,o[1]=-1*(t.y/this.height*2-1),o[2]=1,o[3]=1,l.aE(o,o,this._globeViewProjMatrixNoCorrectionInverted),o[0]/=o[3],o[1]/=o[3],o[2]/=o[3];let h=l.bz();h[0]=o[0]-this._cameraPosition[0],h[1]=o[1]-this._cameraPosition[1],h[2]=o[2]-this._cameraPosition[2];let p=l.bz();return l.b1(p,h),p}isSurfacePointVisible(t){let o=this._cachedClippingPlane;return o[0]*t[0]+o[1]*t[1]+o[2]*t[2]+o[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let o=l.bE();return l.aE(o,[...t,1],this._globeViewProjMatrixNoCorrection),o[0]/=o[3],o[1]/=o[3],o[2]/=o[3],o[0]>-1&&o[0]<1&&o[1]>-1&&o[1]<1&&o[2]>-1&&o[2]<1}rayPlanetIntersection(t,o){let h=l.b3(t,o),p=l.bz(),v=l.bz();l.aZ(v,o,h),l.b0(p,t,v);let T=1-l.b3(p,p);if(T<0)return null;let M=l.b3(t,t)-1,C=-h+(h<0?1:-1)*Math.sqrt(T),z=M/C,P=C;return{tMin:Math.min(z,P),tMax:Math.max(z,P)}}unprojectScreenPoint(t){let o=this._cameraPosition,h=this.getRayDirectionFromPixel(t),p=this.rayPlanetIntersection(o,h);if(p){let P=l.bz();l.a_(P,o,[h[0]*p.tMin,h[1]*p.tMin,h[2]*p.tMin]);let k=l.bz();return l.b1(k,P),ql(k)}let v=this._cachedClippingPlane,T=v[0]*h[0]+v[1]*h[1]+v[2]*h[2],M=-l.b9(v,o)/T,C=l.bz();if(M>0)l.a_(C,o,[h[0]*M,h[1]*M,h[2]*M]);else{let P=l.bz();l.a_(P,o,[2*h[0],2*h[1],2*h[2]]);let k=l.b9(this._cachedClippingPlane,P);l.b0(C,P,[this._cachedClippingPlane[0]*k,this._cachedClippingPlane[1]*k,this._cachedClippingPlane[2]*k])}let z=(function(P){let k=l.bz();return k[0]=P[0]*-P[3],k[1]=P[1]*-P[3],k[2]=P[2]*-P[3],{center:k,radius:Math.sqrt(1-P[3]*P[3])}})(v);return ql((function(P,k,L){let N=l.bz();l.b0(N,L,P);let G=l.bz();return l.bx(G,P,N,k/l.b7(N)),G})(z.center,z.radius,C))}getMatrixForModel(t,o){let h=l.W.convert(t),p=1/l.bD,v=l.bi();return l.bI(v,v,h.lng/180*Math.PI),l.bf(v,v,-h.lat/180*Math.PI),l.Q(v,v,[0,0,1+o/l.bD]),l.bf(v,v,.5*Math.PI),l.S(v,v,[p,p,p]),v}getProjectionDataForCustomLayer(t=!0){let o=this.getProjectionData({overscaledTileID:new l.a3(0,0,0,0,0),applyGlobeMatrix:t});return o.tileMercatorCoords=[0,0,1,1],o}getFastPathSimpleProjectionMatrix(t){}}class Bs{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,o,h){this._helper.interpolatePadding(t,o,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,o,h=!0){this._helper.resize(t,o,h)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,o){this._helper.overrideNearFarZ(t,o)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,o){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=o,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(o,h)=>this.currentTransform.defaultConstrain(o,h),this.applyConstrain=(o,h)=>this._helper.applyConstrain(o,h),this._helper=new Io({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(o,h)=>this.defaultConstrain(o,h)},t),this._globeness=1,this._mercatorTransform=new ko,this._verticalPerspectiveTransform=new Fo}clone(){let t=new Bs;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,o){this._helper.apply(t,o),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let o=this._mercatorTransform.getProjectionData(t),h=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?h.mainMatrix:o.mainMatrix,clippingPlane:h.clippingPlane,tileMercatorCoords:h.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:o.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return l.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return l.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,o,h){let p=this._mercatorTransform.getPitchedTextCorrection(t,o,h),v=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,o,h);return l.bt(p,v,this._globeness)}projectTileCoordinates(t,o,h,p){return this.currentTransform.projectTileCoordinates(t,o,h,p)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,o){return this.currentTransform.lngLatToCameraDepth(t,o)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,o,h,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,o,h,p)}setLocationAtPoint(t,o){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,o),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,o),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,o){return this.currentTransform.locationToScreenPoint(t,o)}screenPointToMercatorCoordinate(t,o){return this.currentTransform.screenPointToMercatorCoordinate(t,o)}screenPointToLocation(t,o){return this.currentTransform.screenPointToLocation(t,o)}isPointOnMapSurface(t,o){return this.currentTransform.isPointOnMapSurface(t,o)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,o){return this.currentTransform.getMatrixForModel(t,o)}getProjectionDataForCustomLayer(t=!0){let o=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return o;let h=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return h.fallbackMatrix=o.mainMatrix,h}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class ur{get useGlobeControls(){return!0}handlePanInertia(t,o){let h=Bo(t,o);return Math.abs(h.lng-o.center.lng)>180&&(h.lng=o.center.lng+179.5*Math.sign(h.lng-o.center.lng)),{easingCenter:h,easingOffset:new l.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,o){let h=t.around,p=o.screenPointToLocation(h);t.bearingDelta&&o.setBearing(o.bearing+t.bearingDelta),t.pitchDelta&&o.setPitch(o.pitch+t.pitchDelta),t.rollDelta&&o.setRoll(o.roll+t.rollDelta);let v=o.zoom;t.zoomDelta&&o.setZoom(o.zoom+t.zoomDelta);let T=o.zoom-v;if(T===0)return;let M=l.bJ(o.center.lng,p.lng),C=M/(Math.abs(M/180)+1),z=l.bJ(o.center.lat,p.lat),P=o.getRayDirectionFromPixel(h),k=o.cameraPosition,L=-1*l.b3(k,P),N=l.bz();l.a_(N,k,[P[0]*L,P[1]*L,P[2]*L]);let G=l.b5(N)-1,$=Math.exp(.5*-Math.max(G-.3,0)),J=cr(o.worldSize,o.center.lat)/Math.min(o.width,o.height),W=l.bw(J,.9,.5,1,.25),ee=(1-l.ao(-T))*Math.min($,W),ae=o.center.lat,te=o.zoom,Q=new l.W(o.center.lng+C*ee,l.al(o.center.lat+z*ee,-l.am,l.am));o.setLocationAtPoint(p,h);let re=o.center,ie=l.bw(Math.abs(M),45,85,0,1),me=l.bw(J,.75,.35,0,1),Te=Math.pow(Math.max(ie,me),.25),Se=l.bJ(re.lng,Q.lng),Pe=l.bJ(re.lat,Q.lat);o.setCenter(new l.W(re.lng+Se*Te,re.lat+Pe*Te).wrap()),o.setZoom(te+Hi(ae,o.center.lat))}handleMapControlsPan(t,o,h){if(!t.panDelta)return;let p=o.center.lat,v=o.zoom;o.setCenter(Bo(t.panDelta,o).wrap()),o.setZoom(v+Hi(p,o.center.lat))}cameraForBoxAndBearing(t,o,h,p,v){let T=_d(t,o,h,p,v),M=o.left/v.width*2-1,C=(v.width-o.right)/v.width*2-1,z=o.top/v.height*-2+1,P=(v.height-o.bottom)/v.height*-2+1,k=l.bJ(h.getWest(),h.getEast())<0,L=k?h.getEast():h.getWest(),N=k?h.getWest():h.getEast(),G=Math.max(h.getNorth(),h.getSouth()),$=Math.min(h.getNorth(),h.getSouth()),J=L+.5*l.bJ(L,N),W=G+.5*l.bJ(G,$),ee=v.clone();ee.setCenter(T.center),ee.setBearing(T.bearing),ee.setPitch(0),ee.setRoll(0),ee.setZoom(T.zoom);let ae=ee.modelViewProjectionMatrix,te=[en(h.getNorthWest()),en(h.getNorthEast()),en(h.getSouthWest()),en(h.getSouthEast()),en(new l.W(N,W)),en(new l.W(L,W)),en(new l.W(J,G)),en(new l.W(J,$))],Q=en(T.center),re=Number.POSITIVE_INFINITY;for(let ie of te)M<0&&(re=ur.getLesserNonNegativeNonNull(re,ur.solveVectorScale(ie,Q,ae,"x",M))),C>0&&(re=ur.getLesserNonNegativeNonNull(re,ur.solveVectorScale(ie,Q,ae,"x",C))),z>0&&(re=ur.getLesserNonNegativeNonNull(re,ur.solveVectorScale(ie,Q,ae,"y",z))),P<0&&(re=ur.getLesserNonNegativeNonNull(re,ur.solveVectorScale(ie,Q,ae,"y",P)));if(Number.isFinite(re)&&re!==0)return T.zoom=Math.min(ee.zoom+l.ar(re),t.maxZoom),T;Da()}handleJumpToCenterZoom(t,o){let h=t.center.lat,p=t.applyConstrain(o.center?l.W.convert(o.center):t.center,t.zoom).center;t.setCenter(p.wrap());let v=o.zoom!==void 0?+o.zoom:t.zoom+Hi(h,p.lat);t.zoom!==v&&t.setZoom(v)}handleEaseTo(t,o){let h=t.zoom,p=t.center,v=t.padding,T={roll:t.roll,pitch:t.pitch,bearing:t.bearing},M={roll:o.roll===void 0?t.roll:o.roll,pitch:o.pitch===void 0?t.pitch:o.pitch,bearing:o.bearing===void 0?t.bearing:o.bearing},C=o.zoom!==void 0,z=!t.isPaddingEqual(o.padding),P=!1,k=o.center?l.W.convert(o.center):p,L=t.applyConstrain(k,h).center;to(t,L);let N=t.clone();N.setCenter(L),N.setZoom(C?+o.zoom:h+Hi(p.lat,k.lat)),N.setBearing(o.bearing);let G=new l.P(l.al(t.centerPoint.x+o.offsetAsPoint.x,0,t.width),l.al(t.centerPoint.y+o.offsetAsPoint.y,0,t.height));N.setLocationAtPoint(L,G);let $=(o.offset&&o.offsetAsPoint.mag())>0?N.center:L,J=C?+o.zoom:h+Hi(p.lat,$.lat),W=h+Hi(p.lat,0),ee=J+Hi($.lat,0),ae=l.bJ(p.lng,$.lng),te=l.bJ(p.lat,$.lat),Q=l.ao(ee-W);return P=J!==h,{easeFunc:re=>{if(l.bn(T,M)||$f({startEulerAngles:T,endEulerAngles:M,tr:t,k:re,useSlerp:T.roll!=M.roll}),z&&t.interpolatePadding(v,o.padding,re),o.around)l.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(o.around,o.aroundPoint);else{let ie=ee>W?Math.min(2,Q):Math.max(.5,Q),me=Math.pow(ie,1-re),Te=Kf(p,ae,te,re*me);t.setCenter(Te.wrap())}if(P){let ie=l.H.number(W,ee,re)+Hi(0,t.center.lat);t.setZoom(ie)}},isZooming:P,elevationCenter:$}}handleFlyTo(t,o){let h=o.zoom!==void 0,p=t.center,v=t.zoom,T=t.padding,M=!t.isPaddingEqual(o.padding),C=t.applyConstrain(l.W.convert(o.center||o.locationAtOffset),v).center,z=h?+o.zoom:t.zoom+Hi(t.center.lat,C.lat),P=t.clone();P.setCenter(C),P.setZoom(z),P.setBearing(o.bearing);let k=new l.P(l.al(t.centerPoint.x+o.offsetAsPoint.x,0,t.width),l.al(t.centerPoint.y+o.offsetAsPoint.y,0,t.height));P.setLocationAtPoint(C,k);let L=P.center;to(t,L);let N=(function(te,Q,re){let ie=en(Q),me=en(re),Te=l.b3(ie,me),Se=Math.acos(Te),Pe=Wf(te);return Se/(2*Math.PI)*Pe})(t,p,L),G=v+Hi(p.lat,0),$=z+Hi(L.lat,0),J=l.ao($-G),W;if(typeof o.minZoom=="number"){let te=+o.minZoom+Hi(L.lat,0),Q=Math.min(te,G,$)+Hi(0,L.lat),re=t.applyConstrain(L,Q).zoom+Hi(L.lat,0);W=l.ao(re-G)}let ee=l.bJ(p.lng,L.lng),ae=l.bJ(p.lat,L.lat);return{easeFunc:(te,Q,re,ie)=>{let me=Kf(p,ee,ae,re);M&&t.interpolatePadding(T,o.padding,te);let Te=te===1?L:me;t.setCenter(Te.wrap());let Se=G+l.ar(Q);t.setZoom(te===1?z:Se+Hi(0,Te.lat))},scaleOfZoom:J,targetCenter:L,scaleOfMinZoom:W,pixelPathLength:N}}static solveVectorScale(t,o,h,p,v){let T=p==="x"?[h[0],h[4],h[8],h[12]]:[h[1],h[5],h[9],h[13]],M=[h[3],h[7],h[11],h[15]],C=t[0]*T[0]+t[1]*T[1]+t[2]*T[2],z=t[0]*M[0]+t[1]*M[1]+t[2]*M[2],P=o[0]*T[0]+o[1]*T[1]+o[2]*T[2],k=o[0]*M[0]+o[1]*M[1]+o[2]*M[2];return P+v*z===C+v*k||M[3]*(C-P)+T[3]*(k-z)+C*k==P*z?null:(P+T[3]-v*k-v*M[3])/(P-C-v*k+v*z)}static getLesserNonNegativeNonNull(t,o){return o!==null&&o>=0&&o<t?o:t}}class Zr{constructor(t){this._globe=t,this._mercatorCameraHelper=new Lo,this._verticalPerspectiveCameraHelper=new ur}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,o){return this.currentHelper.handlePanInertia(t,o)}handleMapControlsRollPitchBearingZoom(t,o){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,o)}handleMapControlsPan(t,o,h){this.currentHelper.handleMapControlsPan(t,o,h)}cameraForBoxAndBearing(t,o,h,p,v){return this.currentHelper.cameraForBoxAndBearing(t,o,h,p,v)}handleJumpToCenterZoom(t,o){this.currentHelper.handleJumpToCenterZoom(t,o)}handleEaseTo(t,o){return this.currentHelper.handleEaseTo(t,o)}handleFlyTo(t,o){return this.currentHelper.handleFlyTo(t,o)}}let ou=(g,t)=>l.C(g,t?.filter((o=>o.identifier!=="source.canvas"))),xd=l.bN();class No extends l.E{constructor(t,o={}){var h,p;super(),this._rtlPluginLoaded=()=>{for(let T in this.tileManagers){let M=this.tileManagers[T].getSource().type;M!=="vector"&&M!=="geojson"||this.tileManagers[T].reload()}},this.map=t,this.dispatcher=new Bi(Ji(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((T,M)=>this.getGlyphs(T,M))),this.dispatcher.registerMessageHandler("GI",((T,M)=>this.getImages(T,M))),this.dispatcher.registerMessageHandler("GDA",((T,M)=>this.getDashes(T,M))),this.imageManager=new Be,this.imageManager.setEventedParent(this);let v=((h=t._container)===null||h===void 0?void 0:h.lang)||typeof document<"u"&&((p=document.documentElement)===null||p===void 0?void 0:p.lang)||void 0;this.glyphManager=new Fe(t._requestManager,o.localIdeographFontFamily,v),this.lineAtlas=new Ke(256,512),this.crossTileSymbolIndex=new er,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",l.bO()),Vr().on(Eo,this._rtlPluginLoaded),this.on("data",(T=>{if(T.dataType!=="source"||T.sourceDataType!=="metadata")return;let M=this.tileManagers[T.sourceId];if(!M)return;let C=M.getSource();if(C?.vectorLayerIds)for(let z in this._layers){let P=this._layers[z];P.source===C.id&&this._validateLayer(P)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new l.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,o){var h,p,v;this._checkLoaded();let T=o===null?(v=(p=(h=this.stylesheet.state)===null||h===void 0?void 0:h[t])===null||p===void 0?void 0:p.default)!==null&&v!==void 0?v:null:o;if(l.bQ(T,this._globalState[t]))return this;this._globalState[t]=T,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let o=[];for(let h in t)!l.bQ(this._globalState[h],t[h].default)&&(o.push(h),this._globalState[h]=t[h].default);this._applyGlobalStateChanges(o)}_applyGlobalStateChanges(t){if(t.length===0)return;let o=new Set,h={};for(let p of t){h[p]=this._globalState[p];for(let v in this._layers){let T=this._layers[v],M=T.getLayoutAffectingGlobalStateRefs(),C=T.getPaintAffectingGlobalStateRefs(),z=T.getVisibilityAffectingGlobalStateRefs();if(M.has(p)&&o.add(T.source),C.has(p))for(let{name:P,value:k}of C.get(p))this._updatePaintProperty(T,P,k);z?.has(p)&&(T.recalculateVisibility(),this._updateLayer(T))}}this.dispatcher.broadcast("UGS",h);for(let p in this.tileManagers)o.has(p)&&(this._reloadSource(p),this._changed=!0)}loadURL(t){return l._(this,arguments,void 0,(function*(o,h={},p){this.fire(new l.n("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate,this._loadStyleRequest=new AbortController;let v=this._loadStyleRequest;try{let T=yield this.map._requestManager.transformRequest(o,"Style");l.bR(v.signal);let M=yield l.k(T,v);this._loadStyleRequest===v&&(this._loadStyleRequest=null),this._load(M.data,h,p)}catch(T){this._loadStyleRequest===v&&(this._loadStyleRequest=null),T&&!v.signal.aborted&&this.fire(new l.l(l.d(T)))}}))}loadJSON(t,o={},h){this.fire(new l.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,de.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,o.validate=o.validate!==!1,this._load(t,o,h)})).catch((()=>{}))}loadEmpty(){this.fire(new l.n("dataloading",{dataType:"style"})),this._load(xd,{validate:!1})}_load(t,o,h){var p,v;let T=o.transformStyle?o.transformStyle(h,t):t;if(!o.validate||!ou(this,l.F(T))){T=Object.assign({},T),this._loaded=!0,this.stylesheet=T;for(let M in T.sources)this.addSource(M,T.sources[M],{validate:!1});T.sprite?this._loadSprite(T.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(T.glyphs),this._createLayers(),this.light=new Ie(this.stylesheet.light),this._setProjectionInternal(((p=this.stylesheet.projection)===null||p===void 0?void 0:p.type)||"mercator"),this.sky=new We(this.stylesheet.sky),this.map.setTerrain((v=this.stylesheet.terrain)!==null&&v!==void 0?v:null),this.fire(new l.n("data",{dataType:"style"})),this.fire(new l.n("style.load"))}}_createLayers(){var t,o,h;let p=l.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",p),this._order=p.map((v=>v.id)),this._layers={},this._serializedLayers=null;for(let v of p){let T=l.bT(v,this._globalState);if(T.setEventedParent(this,{layer:{id:v.id}}),this._layers[v.id]=T,l.bU(T)&&this.tileManagers[T.source]){let M=(h=(o=v.paint)===null||o===void 0?void 0:o["raster-fade-duration"])!==null&&h!==void 0?h:T.paint.get("raster-fade-duration");this.tileManagers[T.source].setRasterFadeDuration(M)}}}_loadSprite(t,o=!1,h=void 0){this.imageManager.setLoaded(!1);let p=new AbortController,v;this._spriteRequest=p,(function(T,M,C,z){return l._(this,void 0,void 0,(function*(){let P=le(T),k=C>1?"@2x":"",L={},N={};for(let{id:G,url:$}of P){let J=yield M.transformRequest(pe($,k,".json"),"SpriteJSON");L[G]=l.k(J,z);let W=yield M.transformRequest(pe($,k,".png"),"SpriteImage");N[G]=Ne.getImage(W,z)}return yield Promise.all([...Object.values(L),...Object.values(N)]),(function(G,$){return l._(this,void 0,void 0,(function*(){let J={};for(let W in G){J[W]={};let ee=de.getImageCanvasContext((yield $[W]).data),ae=(yield G[W]).data;for(let te in ae){let{width:Q,height:re,x:ie,y:me,sdf:Te,pixelRatio:Se,stretchX:Pe,stretchY:De,content:Qe,textFitWidth:je,textFitHeight:Ae}=ae[te];J[W][te]={data:null,pixelRatio:Se,sdf:Te,stretchX:Pe,stretchY:De,content:Qe,textFitWidth:je,textFitHeight:Ae,spriteData:{width:Q,height:re,x:ie,y:me,context:ee}}}}return J}))})(L,N)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((T=>{if(this._spriteRequest=null,T)for(let M in T){this._spritesImagesIds[M]=[];let C=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter((z=>!(z in T))):[];for(let z of C)this.imageManager.removeImage(z),this._changedImages[z]=!0;for(let z in T[M]){let P=M==="default"?z:`${M}:${z}`;this._spritesImagesIds[M].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,T[M][z],!1):this.imageManager.addImage(P,T[M][z]),o&&(this._changedImages[P]=!0)}}})).catch((T=>{this._spriteRequest=null,v=T,p.signal.aborted||this.fire(new l.l(v))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),o&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"})),h&&h(v)}))}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"}))}_validateLayer(t){let o=this.tileManagers[t.source];if(!o)return;let h=t.sourceLayer;if(!h)return;let p=o.getSource();(p.type==="geojson"||p.vectorLayerIds&&!p.vectorLayerIds.includes(h))&&this.fire(new l.l(new Error(`Source layer "${h}" does not exist on source "${p.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,o=!1){let h=this._serializedAllLayers();if(!t||t.length===0)return Object.values(o?l.bV(h):h);let p=[];for(let v of t)if(h[v]){let T=o?l.bV(h[v]):h[v];p.push(T)}return p}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let o=Object.keys(this._layers);for(let h of o){let p=this._layers[h];p.type!=="custom"&&(t[h]=p.serialize())}return t}hasTransitions(){var t,o,h;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((o=this.sky)===null||o===void 0)&&o.hasTransition()||!((h=this.projection)===null||h===void 0)&&h.hasTransition())return!0;for(let p in this.tileManagers)if(this.tileManagers[p].hasTransition())return!0;for(let p in this._layers)if(this._layers[p].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let o=this._changed;if(o){let p=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(p.length||v.length)&&this._updateWorkerLayers(p,v);for(let T in this._updatedSources){let M=this._updatedSources[T];if(M==="reload")this._reloadSource(T);else{if(M!=="clear")throw new Error(`Invalid action ${M}`);this._clearSource(T)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let T in this._updatedPaintProps)this._layers[T].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let h={};for(let p in this.tileManagers){let v=this.tileManagers[p];h[p]=v.used,v.used=!1}for(let p of this._order){let v=this._layers[p];v.recalculate(t,this._availableImages),!v.isHidden(t.zoom)&&v.source&&(this.tileManagers[v.source].used=!0)}for(let p in h){let v=this.tileManagers[p];!!h[p]!=!!v.used&&v.fire(new l.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:p}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,o&&this.fire(new l.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let o in this.tileManagers)this.tileManagers[o].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,o){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,o={}){var h;this._checkLoaded();let p=this.serialize();if(t=o.transformStyle?o.transformStyle(p,t):t,((h=o.validate)===null||h===void 0||h)&&ou(this,l.F(t)))return!1;(t=l.bV(t)).layers=l.bS(t.layers);let v=l.bW(p,t),T=this._getOperationsToPerform(v);if(T.unimplemented.length>0)throw new Error(`Unimplemented: ${T.unimplemented.join(", ")}.`);if(T.operations.length===0)return!1;for(let M of T.operations)M();return this.stylesheet=t,this._serializedLayers=null,this.fire(new l.n("style.load",{style:this})),!0}_getOperationsToPerform(t){let o=[],h=[];for(let p of t)switch(p.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":o.push((()=>this.addLayer.apply(this,p.args)));break;case"removeLayer":o.push((()=>this.removeLayer.apply(this,p.args)));break;case"setPaintProperty":o.push((()=>this.setPaintProperty.apply(this,p.args)));break;case"setLayoutProperty":o.push((()=>this.setLayoutProperty.apply(this,p.args)));break;case"setFilter":o.push((()=>this.setFilter.apply(this,p.args)));break;case"addSource":o.push((()=>this.addSource.apply(this,p.args)));break;case"removeSource":o.push((()=>this.removeSource.apply(this,p.args)));break;case"setLayerZoomRange":o.push((()=>this.setLayerZoomRange.apply(this,p.args)));break;case"setLight":o.push((()=>this.setLight.apply(this,p.args)));break;case"setGeoJSONSourceData":o.push((()=>this.setGeoJSONSourceData.apply(this,p.args)));break;case"setGlyphs":o.push((()=>this.setGlyphs.apply(this,p.args)));break;case"setSprite":o.push((()=>this.setSprite.apply(this,p.args)));break;case"setTerrain":o.push((()=>this.map.setTerrain.apply(this,p.args)));break;case"setSky":o.push((()=>this.setSky.apply(this,p.args)));break;case"setProjection":this.setProjection.apply(this,p.args);break;case"setGlobalState":o.push((()=>this.setGlobalState.apply(this,p.args)));break;case"setTransition":o.push((()=>{}));break;default:h.push(p.command)}return{operations:o,unimplemented:h}}addImage(t,o){if(this.getImage(t))return this.fire(new l.l(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,o),this._afterImageUpdated(t)}updateImage(t,o){this.imageManager.updateImage(t,o)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.l(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,o,h={}){var p;if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(o.type)&&this._validate(l.F.source,`sources.${t}`,o,null,h))return;!((p=this.map)===null||p===void 0)&&p._collectResourceTiming&&(o.collectResourceTiming=!0);let v=this.tileManagers[t]=new gn(t,o,this.dispatcher);v.style=this,v.setEventedParent(this,(()=>({isSourceLoaded:v.loaded(),source:v.serialize(),sourceId:t}))),v.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);for(let h in this._layers)if(this._layers[h].source===t)return this.fire(new l.l(new Error(`Source "${t}" cannot be removed while layer "${h}" is using it.`)));let o=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],o.fire(new l.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),o.setEventedParent(null),o.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,o){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);let h=this.tileManagers[t].getSource();if(h.type!=="geojson")throw new Error(`geojsonSource.type is ${h.type}, which is !== 'geojson`);h.setData(o),this._changed=!0}getSource(t){var o;return(o=this.tileManagers[t])===null||o===void 0?void 0:o.getSource()}addLayer(t,o,h={}){this._checkLoaded();let p=t.id;if(this.getLayer(p))return void this.fire(new l.l(new Error(`Layer "${p}" already exists on this map.`)));let v;if(t.type==="custom"){if(ou(this,l.bX(t)))return;v=l.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(p,t.source),t=l.bV(t),t=l.e(t,{source:p})),this._validate(l.F.layer,`layers.${p}`,t,{arrayIndex:-1},h))return;v=l.bT(t,this._globalState),this._validateLayer(v),v.setEventedParent(this,{layer:{id:p}})}let T=o?this._order.indexOf(o):this._order.length;if(o&&T===-1)this.fire(new l.l(new Error(`Cannot add layer "${p}" before non-existing layer "${o}".`)));else{if(this._order.splice(T,0,p),this._layerOrderChanged=!0,this._layers[p]=v,this._removedLayers[p]&&v.source&&v.type!=="custom"){let M=this._removedLayers[p];delete this._removedLayers[p],M.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.tileManagers[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(t,o){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.l(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===o)return;let h=this._order.indexOf(t);this._order.splice(h,1);let p=o?this._order.indexOf(o):this._order.length;o&&p===-1?this.fire(new l.l(new Error(`Cannot move layer "${t}" before non-existing layer "${o}".`))):(this._order.splice(p,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();let o=this._layers[t];if(!o)return void this.fire(new l.l(new Error(`Cannot remove non-existing layer "${t}".`)));o.setEventedParent(null);let h=this._order.indexOf(t);this._order.splice(h,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=o,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],o.onRemove&&o.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,o,h){this._checkLoaded();let p=this.getLayer(t);p?p.minzoom===o&&p.maxzoom===h||(o!=null&&(p.minzoom=o),h!=null&&(p.maxzoom=h),this._updateLayer(p)):this.fire(new l.l(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,o,h={}){this._checkLoaded();let p=this.getLayer(t);if(p){if(!l.bQ(p.filter,o))return o==null?(p.setFilter(void 0),void this._updateLayer(p)):void(this._validate(l.F.filter,`layers.${p.id}.filter`,o,null,h)||(p.setFilter(l.bV(o)),this._updateLayer(p)))}else this.fire(new l.l(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.bV(this.getLayer(t).filter)}setLayoutProperty(t,o,h,p={}){this._checkLoaded();let v=this.getLayer(t);v?l.bQ(v.getLayoutProperty(o),h)||(v.setLayoutProperty(o,h,p),this._updateLayer(v)):this.fire(new l.l(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,o){let h=this.getLayer(t);if(h)return h.getLayoutProperty(o);this.fire(new l.l(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,o,h,p={}){this._checkLoaded();let v=this.getLayer(t);v?l.bQ(v.getPaintProperty(o),h)||this._updatePaintProperty(v,o,h,p):this.fire(new l.l(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,o,h,p={}){t.setPaintProperty(o,h,p)&&this._updateLayer(t),l.bU(t)&&o==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(h),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,o){return this.getLayer(t).getPaintProperty(o)}setFeatureState(t,o){this._checkLoaded();let h=t.source,p=t.sourceLayer,v=this.tileManagers[h];if(v===void 0)return void this.fire(new l.l(new Error(`The source '${h}' does not exist in the map's style.`)));let T=v.getSource().type;T==="geojson"&&p?this.fire(new l.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):T!=="vector"||p?(t.id===void 0&&this.fire(new l.l(new Error("The feature id parameter must be provided."))),v.setFeatureState(p,t.id,o)):this.fire(new l.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,o){this._checkLoaded();let h=t.source,p=this.tileManagers[h];if(p===void 0)return void this.fire(new l.l(new Error(`The source '${h}' does not exist in the map's style.`)));let v=p.getSource().type,T=v==="vector"?t.sourceLayer:void 0;v!=="vector"||T?o&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.l(new Error("A feature id is required to remove its specific state property."))):p.removeFeatureState(T,t.id,o):this.fire(new l.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let o=t.source,h=t.sourceLayer,p=this.tileManagers[o];if(p!==void 0)return p.getSource().type!=="vector"||h?(t.id===void 0&&this.fire(new l.l(new Error("The feature id parameter must be provided."))),p.getFeatureState(h,t.id)):void this.fire(new l.l(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.l(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){var t;return l.e({duration:300,delay:0},(t=this.stylesheet)===null||t===void 0?void 0:t.transition)}serialize(){if(!this._loaded)return;let t=l.bY(this.tileManagers,(v=>v.serialize())),o=this._serializeByIds(this._order,!0),h=this.map.getTerrain()||void 0,p=this.stylesheet;return l.bZ({version:p.version,name:p.name,metadata:p.metadata,light:p.light,sky:p.sky,center:p.center,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch,sprite:p.sprite,glyphs:p.glyphs,transition:p.transition,projection:p.projection,sources:t,layers:o,terrain:h},(v=>v!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let o=T=>this._layers[T].type==="fill-extrusion",h={},p=[];for(let T=this._order.length-1;T>=0;T--){let M=this._order[T];if(o(M)){h[M]=T;for(let C of t){let z=C[M];if(z)for(let P of z)p.push(P)}}}p.sort(((T,M)=>M.intersectionZ-T.intersectionZ));let v=[];for(let T=this._order.length-1;T>=0;T--){let M=this._order[T];if(o(M))for(let C=p.length-1;C>=0;C--){let z=p[C].feature;if(h[z.layer.id]<T)break;v.push(z),p.pop()}else for(let C of t){let z=C[M];if(z)for(let P of z)v.push(P.feature)}}return v}queryRenderedFeatures(t,o,h){o?.filter&&this._validate(l.F.filter,"queryRenderedFeatures.filter",o.filter,null,o);let p={};if(o?.layers){if(!(Array.isArray(o.layers)||o.layers instanceof Set))return this.fire(new l.l(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let z of o.layers){let P=this._layers[z];if(!P)return this.fire(new l.l(new Error(`The layer '${z}' does not exist in the map's style and cannot be queried for features.`))),[];p[P.source]=!0}}let v=[];o.availableImages=this._availableImages;let T=this._serializedAllLayers(),M=o.layers instanceof Set?o.layers:Array.isArray(o.layers)?new Set(o.layers):null,C=Object.assign(Object.assign({},o),{layers:M,globalState:this._globalState});for(let z in this.tileManagers)o.layers&&!p[z]||v.push(hi(this.tileManagers[z],this._layers,T,t,C,h,this.map.terrain?(P,k,L)=>this.map.terrain.getElevation(P,k,L):void 0));return this.placement&&v.push((function(z,P,k,L,N,G,$){let J={},W=G.queryRenderedSymbols(L),ee=[];for(let ae of Object.keys(W).map(Number))ee.push($[ae]);ee.sort(Fr);for(let ae of ee){let te=ae.featureIndex.lookupSymbolFeatures(W[ae.bucketInstanceId],P,ae.bucketIndex,ae.sourceLayerIndex,{filterSpec:N.filter,globalState:N.globalState},N.layers,N.availableImages,z);for(let Q in te){J[Q]||(J[Q]=[]);let re=te[Q];re.sort(((ie,me)=>{let Te=ae.featureSortOrder;if(Te){let Se=Te.indexOf(ie.featureIndex);return Te.indexOf(me.featureIndex)-Se}return me.featureIndex-ie.featureIndex}));for(let ie of re)J[Q].push(ie)}}return(function(ae,te,Q){for(let re in ae)for(let ie of ae[re])Sn(ie,Q[te[re].source]);return ae})(J,z,k)})(this._layers,T,this.tileManagers,t,C,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(t,o){o?.filter&&this._validate(l.F.filter,"querySourceFeatures.filter",o.filter,null,o);let h=this.tileManagers[t];return h?(function(p,v){let T=p.getRenderableIds().map((z=>p.getTileByID(z))),M=[],C={};for(let z of T){let P=z.tileID.canonical.key;C[P]||(C[P]=!0,z.querySourceFeatures(M,v))}return M})(h,o?Object.assign(Object.assign({},o),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,o={}){this._checkLoaded();let h=this.light.getLight(),p=!1;for(let T in t)if(!l.bQ(t[T],h[T])){p=!0;break}if(!p)return;let v={now:ce(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,o),this.light.updateTransitions(v)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){this._checkLoaded();let o=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===o.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(o.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,o={}){this._checkLoaded();let h=this.getSky(),p=!1;if(!t&&!h)return;if(t&&!h)p=!0;else if(!t&&h)p=!0;else for(let T in t)if(!l.bQ(t[T],h[T])){p=!0;break}if(!p)return;let v={now:ce(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,o),this.sky.updateTransitions(v)}_setProjectionInternal(t){let o=(function(h,p){let v={constrainOverride:p};if(Array.isArray(h)){let T=new Yf({type:h});return{projection:T,transform:new Bs(v),cameraHelper:new Zr(T)}}switch(h){case"mercator":return{projection:new Un,transform:new ko(v),cameraHelper:new Lo};case"globe":{let T=new Yf({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:T,transform:new Bs(v),cameraHelper:new Zr(T)}}case"vertical-perspective":return{projection:new iu,transform:new Fo(v),cameraHelper:new ur};default:return l.w(`Unknown projection name: ${h}. Falling back to mercator projection.`),{projection:new Un,transform:new ko(v),cameraHelper:new Lo}}})(t,this.map.transformConstrain);this.projection=o.projection,this.map.migrateProjection(o.transform,o.cameraHelper);for(let h in this.tileManagers)this.tileManagers[h].reload()}_validate(t,o,h,p,v={}){return v?.validate!==!1&&ou(this,t.call(l.F,l.e({key:o,style:this.serialize(),value:h,styleSpec:l.x},p)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Vr().off(Eo,this._rtlPluginLoaded);for(let o in this._layers)this._layers[o].setEventedParent(null);for(let o in this.tileManagers){let h=this.tileManagers[o];h.setEventedParent(null),h.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let o in this.tileManagers)this.tileManagers[o].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,o,h,p,v=!1){let T=!1,M=!1,C={};for(let z of this._order){let P=this._layers[z];if(P.type!=="symbol")continue;if(!C[P.source]){let L=this.tileManagers[P.source];C[P.source]=L.getRenderableIds(!0).map((N=>L.getTileByID(N))).sort(((N,G)=>G.tileID.overscaledZ-N.tileID.overscaledZ||(N.tileID.isLessThan(G.tileID)?-1:1)))}let k=this.crossTileSymbolIndex.addLayer(P,C[P.source],t.center.lng);T||(T=k)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),v||(v=this._layerOrderChanged||h===0),(v||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ce(),t.zoom))&&(this.pauseablePlacement=new Ds(t,this.map.terrain,this._order,v,o,h,p,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ce()),M=!0),T&&this.pauseablePlacement.placement.setStale()),M||T)for(let z of this._order){let P=this._layers[z];P.type==="symbol"&&this.placement.updateLayerOpacities(P,C[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ce())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,o){return l._(this,void 0,void 0,(function*(){let h=yield this.imageManager.getImages(o.icons);this._updateTilesForChangedImages();let p=this.tileManagers[o.source];return p&&p.setDependencies(o.tileID.key,o.type,o.icons),h}))}getGlyphs(t,o){return l._(this,void 0,void 0,(function*(){let h=yield this.glyphManager.getGlyphs(o.stacks),p=this.tileManagers[o.source];return p&&p.setDependencies(o.tileID.key,o.type,[""]),h}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,o={}){this._checkLoaded(),t&&this._validate(l.F.glyphs,"glyphs",t,null,o)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,o){return l._(this,void 0,void 0,(function*(){let h={};for(let[p,v]of Object.entries(o.dashes))h[p]=this.lineAtlas.getDash(v.dasharray,v.round);return h}))}addSprite(t,o,h={},p){this._checkLoaded();let v=[{id:t,url:o}],T=[...le(this.stylesheet.sprite),...v];this._validate(l.F.sprite,"sprite",T,null,h)||(this.stylesheet.sprite=T,this._loadSprite(v,!0,p))}removeSprite(t){this._checkLoaded();let o=le(this.stylesheet.sprite);if(o.find((h=>h.id===t))){if(this._spritesImagesIds[t])for(let h of this._spritesImagesIds[t])this.imageManager.removeImage(h),this._changedImages[h]=!0;o.splice(o.findIndex((h=>h.id===t)),1),this.stylesheet.sprite=o.length>0?o:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"}))}else this.fire(new l.l(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return le(this.stylesheet.sprite)}setSprite(t,o={},h){this._checkLoaded(),t&&this._validate(l.F.sprite,"sprite",t,null,o)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,h):(this._unloadSprite(),h&&h(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(let t in this.tileManagers){let o=this.tileManagers[t];o.setEventedParent(null),o.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(let t in this._layers){let o=this._layers[t];o.setEventedParent(null),o.onRemove&&o.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Zl=l.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class h1{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,o,h,p,v,T,M,C,z){this.context=t;let P=this.boundPaintVertexBuffers.length!==p.length;for(let k=0;!P&&k<p.length;k++)this.boundPaintVertexBuffers[k]!==p[k]&&(P=!0);!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==h||P||this.boundIndexBuffer!==v||this.boundVertexOffset!==T||this.boundDynamicVertexBuffer!==M||this.boundDynamicVertexBuffer2!==C||this.boundDynamicVertexBuffer3!==z?this.freshBind(o,h,p,v,T,M,C,z):(t.bindVertexArray.set(this.vao),M&&M.bind(),v?.dynamicDraw&&v.bind(),C&&C.bind(),z&&z.bind())}freshBind(t,o,h,p,v,T,M,C){let z=t.numAttributes,P=this.context,k=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=p,this.boundVertexOffset=v,this.boundDynamicVertexBuffer=T,this.boundDynamicVertexBuffer2=M,this.boundDynamicVertexBuffer3=C,o.enableAttributes(k,t);for(let L of h)L.enableAttributes(k,t);T&&T.enableAttributes(k,t),M&&M.enableAttributes(k,t),C&&C.enableAttributes(k,t),o.bind(),o.setVertexAttribPointers(k,t,v);for(let L of h)L.bind(),L.setVertexAttribPointers(k,t,v);T&&(T.bind(),T.setVertexAttribPointers(k,t,v)),p&&p.bind(),M&&(M.bind(),M.setVertexAttribPointers(k,t,v)),C&&(C.bind(),C.setVertexAttribPointers(k,t,v)),P.currentNumAttributes=z}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let su=(g,t,o,h,p)=>({u_texture:0,u_ele_delta:g,u_fog_matrix:t,u_fog_color:o?o.properties.get("fog-color"):l.bo.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?0:o?o.calculateFogBlendOpacity(h):0,u_horizon_color:o?o.properties.get("horizon-color"):l.bo.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1,u_is_globe_mode:p?1:0}),d1={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Pa(g){let t=[];for(let o of g){if(o===null)continue;let h=o.split(" ");t.push(h.pop())}return t}class p1{constructor(t,o,h,p,v,T,M,C,z=[]){let P=t.gl;this.program=P.createProgram();let k=Pa(o.staticAttributes),L=h?h.getBinderAttributes():[],N=k.concat(L),G=pi.prelude.staticUniforms?Pa(pi.prelude.staticUniforms):[],$=M.staticUniforms?Pa(M.staticUniforms):[],J=o.staticUniforms?Pa(o.staticUniforms):[],W=h?h.getBinderUniforms():[],ee=G.concat($).concat(J).concat(W),ae=[];for(let Se of ee)ae.includes(Se)||ae.push(Se);let te=h?h.defines():[];Gr(P)&&te.unshift("#version 300 es"),v&&te.push("#define OVERDRAW_INSPECTOR;"),T&&te.push("#define TERRAIN3D;"),C&&te.push(C),z&&te.push(...z);let Q=te.concat(pi.prelude.fragmentSource,M.fragmentSource,o.fragmentSource).join(`
797
+ `),re=te.concat(pi.prelude.vertexSource,M.vertexSource,o.vertexSource).join(`
798
+ `);Gr(P)||(Q=(function(Se){return Se.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(Q),re=(function(Se){return Se.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(re));let ie=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ie,Q),P.compileShader(ie),!P.getShaderParameter(ie,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(ie)}`);P.attachShader(this.program,ie);let me=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(me,re),P.compileShader(me),!P.getShaderParameter(me,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(me)}`);P.attachShader(this.program,me),this.attributes={};let Te={};this.numAttributes=N.length;for(let Se=0;Se<this.numAttributes;Se++)N[Se]&&(P.bindAttribLocation(this.program,Se,N[Se]),this.attributes[N[Se]]=Se);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(me),P.deleteShader(ie);for(let Se of ae)if(Se&&!Te[Se]){let Pe=P.getUniformLocation(this.program,Se);Pe&&(Te[Se]=Pe)}this.fixedUniforms=p(t,Te),this.terrainUniforms=((Se,Pe)=>({u_depth:new l.b_(Se,Pe.u_depth),u_terrain:new l.b_(Se,Pe.u_terrain),u_terrain_dim:new l.bp(Se,Pe.u_terrain_dim),u_terrain_matrix:new l.c0(Se,Pe.u_terrain_matrix),u_terrain_unpack:new l.c1(Se,Pe.u_terrain_unpack),u_terrain_exaggeration:new l.bp(Se,Pe.u_terrain_exaggeration)}))(t,Te),this.projectionUniforms=((Se,Pe)=>({u_projection_matrix:new l.c0(Se,Pe.u_projection_matrix),u_projection_tile_mercator_coords:new l.c1(Se,Pe.u_projection_tile_mercator_coords),u_projection_clipping_plane:new l.c1(Se,Pe.u_projection_clipping_plane),u_projection_transition:new l.bp(Se,Pe.u_projection_transition),u_projection_fallback_matrix:new l.c0(Se,Pe.u_projection_fallback_matrix)}))(t,Te),this.binderUniforms=h?h.getUniforms(t,Te):[]}draw(t,o,h,p,v,T,M,C,z,P,k,L,N,G,$,J,W,ee,ae){var te;let Q=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(h),t.setStencilMode(p),t.setColorMode(v),t.setCullFace(T),C){t.activeTexture.set(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,C.depthTexture),t.activeTexture.set(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,C.texture);for(let ie in this.terrainUniforms)this.terrainUniforms[ie].set(C[ie])}if(z)for(let ie in z)this.projectionUniforms[d1[ie]].set(z[ie]);if(M)for(let ie in this.fixedUniforms)this.fixedUniforms[ie].set(M[ie]);J&&J.setUniforms(t,this.binderUniforms,G,{zoom:$});let re=0;switch(o){case Q.LINES:re=2;break;case Q.TRIANGLES:re=3;break;case Q.LINE_STRIP:re=1}for(let ie of N.get())ie.vaos||(ie.vaos={}),(te=ie.vaos)[P]||(te[P]=new h1),ie.vaos[P].bind(t,this,k,J?J.getPaintVertexBuffers():[],L,ie.vertexOffset,W,ee,ae),Q.drawElements(o,ie.primitiveLength*re,Q.UNSIGNED_SHORT,ie.primitiveOffset*re*2)}}function wd(g,t,o){let h=1/l.aK(o,1,t.transform.tileZoom),p=Math.pow(2,o.tileID.overscaledZ),v=o.tileSize*Math.pow(2,t.transform.tileZoom)/p,T=v*(o.tileID.canonical.x+o.tileID.wrap*p),M=v*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[h,g.fromScale,g.toScale],u_fade:g.t,u_pixel_coord_upper:[T>>16,M>>16],u_pixel_coord_lower:[65535&T,65535&M]}}let Qf=(g,t,o,h)=>{let p=g.style.light,v=p.properties.get("position"),T=[v.x,v.y,v.z],M=l.c4();p.properties.get("anchor")==="viewport"&&l.c5(M,g.transform.bearingInRadians),l.c6(T,T,M);let C=g.transform.transformLightDirection(T),z=p.properties.get("color");return{u_lightpos:T,u_lightpos_globe:C,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[z.r,z.g,z.b],u_vertical_gradient:+t,u_opacity:o,u_fill_translate:h}},Jf=(g,t,o,h,p,v,T)=>l.e(Qf(g,t,o,h),wd(v,g,T),{u_height_factor:-Math.pow(2,p.overscaledZ)/T.tileSize/8}),lu=(g,t,o,h)=>l.e(wd(t,g,o),{u_fill_translate:h}),em=(g,t)=>({u_world:g,u_fill_translate:t}),tm=(g,t,o,h,p)=>l.e(lu(g,t,o,p),{u_world:h}),im=(g,t,o,h,p)=>{let v=g.transform,T,M,C=0;if(o.paint.get("circle-pitch-alignment")==="map"){let z=l.aK(t,1,v.zoom);T=!0,M=[z,z],C=z/(l.a6*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*p}else T=!1,M=v.pixelsToGLUnits;return{u_camera_to_center_distance:v.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+T,u_device_pixel_ratio:g.pixelRatio,u_extrude_scale:M,u_globe_extrude_scale:C,u_translate:h}},nm=g=>({u_pixel_extrude_scale:[1/g.width,1/g.height]}),Uo=g=>({u_viewport_size:[g.width,g.height]}),Td=(g,t=1)=>({u_color:g,u_overlay:0,u_overlay_scale:t}),Sd=(g,t,o,h)=>{let p=l.aK(g,1,t)/(l.a6*Math.pow(2,g.tileID.overscaledZ))*2*Math.PI*h;return{u_extrude_scale:l.aK(g,1,t),u_intensity:o,u_globe_extrude_scale:p}},Fs=(g,t,o,h)=>{let p=l.O();l.c7(p,0,g.width,g.height,0,0,1);let v=g.context.gl;return{u_matrix:p,u_world:[v.drawingBufferWidth,v.drawingBufferHeight],u_image:o,u_color_ramp:h,u_opacity:t.paint.get("heatmap-opacity")}},f1=(g,t,o)=>{let h=o.paint.get("hillshade-accent-color"),p;switch(o.paint.get("hillshade-method")){case"basic":p=4;break;case"combined":p=1;break;case"igor":p=2;break;case"multidirectional":p=3;break;default:p=0}let v=o.getIlluminationProperties();for(let T=0;T<v.directionRadians.length;T++)o.paint.get("hillshade-illumination-anchor")==="viewport"&&(v.directionRadians[T]+=g.transform.bearingInRadians);return{u_image:0,u_latrange:m1(0,t.tileID),u_exaggeration:o.paint.get("hillshade-exaggeration"),u_altitudes:v.altitudeRadians,u_azimuths:v.directionRadians,u_accent:h,u_method:p,u_highlights:v.highlightColor,u_shadows:v.shadowColor}},cu=(g,t)=>{let o=t.stride,h=l.O();return l.c7(h,0,l.a6,-l.a6,0,0,1),l.Q(h,h,[0,-l.a6,0]),{u_matrix:h,u_image:1,u_dimension:[o,o],u_zoom:g.overscaledZ,u_unpack:t.getUnpackVector()}};function m1(g,t){let o=Math.pow(2,t.canonical.z),h=t.canonical.y;return[new l.a7(0,h/o).toLngLat().lat,new l.a7(0,(h+1)/o).toLngLat().lat]}let g1=(g,t,o=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:o,u_opacity:g.paint.get("color-relief-opacity")}),Hl=(g,t,o,h)=>{let p=g.transform;return{u_translation:ha(g,t,o),u_ratio:h/l.aK(t,1,p.zoom),u_device_pixel_ratio:g.pixelRatio,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},rm=(g,t,o,h,p)=>l.e(Hl(g,t,o,h),{u_image:0,u_image_height:p}),am=(g,t,o,h,p)=>{let v=g.transform,T=Ns(t,v);return{u_translation:ha(g,t,o),u_texsize:t.imageAtlasTexture.size,u_ratio:h/l.aK(t,1,v.zoom),u_device_pixel_ratio:g.pixelRatio,u_image:0,u_scale:[T,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},Md=(g,t,o,h,p)=>{let v=Ns(t,g.transform);return l.e(Hl(g,t,o,h),{u_tileratio:v,u_crossfade_from:p.fromScale,u_crossfade_to:p.toScale,u_image:0,u_mix:p.t,u_lineatlas_width:g.lineAtlas.width,u_lineatlas_height:g.lineAtlas.height})},om=(g,t,o,h,p,v)=>{let T=Ns(t,g.transform);return l.e(Hl(g,t,o,h),{u_image:0,u_image_height:v,u_tileratio:T,u_crossfade_from:p.fromScale,u_crossfade_to:p.toScale,u_image_dash:1,u_mix:p.t,u_lineatlas_width:g.lineAtlas.width,u_lineatlas_height:g.lineAtlas.height})};function Ns(g,t){return 1/l.aK(g,1,t.tileZoom)}function ha(g,t,o){return l.aL(g.transform,t,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}let Ed=(g,t,o,h,p)=>{return{u_tl_parent:g,u_scale_parent:t,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*h.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:h.paint.get("raster-brightness-min"),u_brightness_high:h.paint.get("raster-brightness-max"),u_saturation_factor:(T=h.paint.get("raster-saturation"),T>0?1-1/(1.001-T):-T),u_contrast_factor:(v=h.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Cd(h.paint.get("raster-hue-rotate")),u_coords_top:[p[0].x,p[0].y,p[1].x,p[1].y],u_coords_bottom:[p[3].x,p[3].y,p[2].x,p[2].y]};var v,T};function Cd(g){g*=Math.PI/180;let t=Math.sin(g),o=Math.cos(g);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}let uu=(g,t,o,h,p,v,T,M,C,z,P,k,L)=>{let N=T.transform;return{u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:N.cameraToCenterDistance,u_pitch:N.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:N.width/N.height,u_fade_change:T.options.fadeDuration?T.symbolFadeChange:1,u_label_plane_matrix:M,u_coord_matrix:C,u_is_text:+P,u_pitch_with_map:+h,u_is_along_line:p,u_is_variable_anchor:v,u_texsize:k,u_texture:0,u_translation:z,u_pitched_scale:L}},Ad=(g,t,o,h,p,v,T,M,C,z,P,k,L,N)=>{let G=T.transform;return l.e(uu(g,t,o,h,p,v,T,M,C,z,P,k,N),{u_gamma_scale:h?Math.cos(G.pitch*Math.PI/180)*G.cameraToCenterDistance:1,u_device_pixel_ratio:T.pixelRatio,u_is_halo:L?1:0,u_is_plain:1})},zd=(g,t,o,h,p,v,T,M,C,z,P,k,L)=>l.e(Ad(g,t,o,h,p,v,T,M,C,z,!0,P,!0,L),{u_texsize_icon:k,u_texture_icon:1}),Vo=(g,t)=>({u_opacity:g,u_color:t}),Dd=(g,t,o,h,p)=>l.e((function(v,T,M,C){let z=M.imageManager.getPattern(v.from.toString()),P=M.imageManager.getPattern(v.to.toString()),{width:k,height:L}=M.imageManager.getPixelSize(),N=Math.pow(2,C.tileID.overscaledZ),G=C.tileSize*Math.pow(2,M.transform.tileZoom)/N,$=G*(C.tileID.canonical.x+C.tileID.wrap*N),J=G*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[k,L],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/l.aK(C,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,J>>16],u_pixel_coord_lower:[65535&$,65535&J]}})(o,p,t,h),{u_opacity:g}),sm=(g,t)=>{},_1={fillExtrusion:(g,t)=>({u_lightpos:new l.c2(g,t.u_lightpos),u_lightpos_globe:new l.c2(g,t.u_lightpos_globe),u_lightintensity:new l.bp(g,t.u_lightintensity),u_lightcolor:new l.c2(g,t.u_lightcolor),u_vertical_gradient:new l.bp(g,t.u_vertical_gradient),u_opacity:new l.bp(g,t.u_opacity),u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillExtrusionPattern:(g,t)=>({u_lightpos:new l.c2(g,t.u_lightpos),u_lightpos_globe:new l.c2(g,t.u_lightpos_globe),u_lightintensity:new l.bp(g,t.u_lightintensity),u_lightcolor:new l.c2(g,t.u_lightcolor),u_vertical_gradient:new l.bp(g,t.u_vertical_gradient),u_height_factor:new l.bp(g,t.u_height_factor),u_opacity:new l.bp(g,t.u_opacity),u_fill_translate:new l.c3(g,t.u_fill_translate),u_image:new l.b_(g,t.u_image),u_texsize:new l.c3(g,t.u_texsize),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade)}),fill:(g,t)=>({u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillPattern:(g,t)=>({u_image:new l.b_(g,t.u_image),u_texsize:new l.c3(g,t.u_texsize),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade),u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillOutline:(g,t)=>({u_world:new l.c3(g,t.u_world),u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillOutlinePattern:(g,t)=>({u_world:new l.c3(g,t.u_world),u_image:new l.b_(g,t.u_image),u_texsize:new l.c3(g,t.u_texsize),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade),u_fill_translate:new l.c3(g,t.u_fill_translate)}),circle:(g,t)=>({u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_scale_with_map:new l.b_(g,t.u_scale_with_map),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_extrude_scale:new l.c3(g,t.u_extrude_scale),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_globe_extrude_scale:new l.bp(g,t.u_globe_extrude_scale),u_translate:new l.c3(g,t.u_translate)}),collisionBox:(g,t)=>({u_pixel_extrude_scale:new l.c3(g,t.u_pixel_extrude_scale)}),collisionCircle:(g,t)=>({u_viewport_size:new l.c3(g,t.u_viewport_size)}),debug:(g,t)=>({u_color:new l.b$(g,t.u_color),u_overlay:new l.b_(g,t.u_overlay),u_overlay_scale:new l.bp(g,t.u_overlay_scale)}),depth:sm,clippingMask:sm,heatmap:(g,t)=>({u_extrude_scale:new l.bp(g,t.u_extrude_scale),u_intensity:new l.bp(g,t.u_intensity),u_globe_extrude_scale:new l.bp(g,t.u_globe_extrude_scale)}),heatmapTexture:(g,t)=>({u_matrix:new l.c0(g,t.u_matrix),u_world:new l.c3(g,t.u_world),u_image:new l.b_(g,t.u_image),u_color_ramp:new l.b_(g,t.u_color_ramp),u_opacity:new l.bp(g,t.u_opacity)}),hillshade:(g,t)=>({u_image:new l.b_(g,t.u_image),u_latrange:new l.c3(g,t.u_latrange),u_exaggeration:new l.bp(g,t.u_exaggeration),u_altitudes:new l.c9(g,t.u_altitudes),u_azimuths:new l.c9(g,t.u_azimuths),u_accent:new l.b$(g,t.u_accent),u_method:new l.b_(g,t.u_method),u_shadows:new l.c8(g,t.u_shadows),u_highlights:new l.c8(g,t.u_highlights)}),hillshadePrepare:(g,t)=>({u_matrix:new l.c0(g,t.u_matrix),u_image:new l.b_(g,t.u_image),u_dimension:new l.c3(g,t.u_dimension),u_zoom:new l.bp(g,t.u_zoom),u_unpack:new l.c1(g,t.u_unpack)}),colorRelief:(g,t)=>({u_image:new l.b_(g,t.u_image),u_unpack:new l.c1(g,t.u_unpack),u_dimension:new l.c3(g,t.u_dimension),u_elevation_stops:new l.b_(g,t.u_elevation_stops),u_color_stops:new l.b_(g,t.u_color_stops),u_color_ramp_size:new l.b_(g,t.u_color_ramp_size),u_opacity:new l.bp(g,t.u_opacity)}),line:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels)}),lineGradient:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_image:new l.b_(g,t.u_image),u_image_height:new l.bp(g,t.u_image_height)}),linePattern:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_texsize:new l.c3(g,t.u_texsize),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_image:new l.b_(g,t.u_image),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade)}),lineSDF:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_image:new l.b_(g,t.u_image),u_mix:new l.bp(g,t.u_mix),u_tileratio:new l.bp(g,t.u_tileratio),u_crossfade_from:new l.bp(g,t.u_crossfade_from),u_crossfade_to:new l.bp(g,t.u_crossfade_to),u_lineatlas_width:new l.bp(g,t.u_lineatlas_width),u_lineatlas_height:new l.bp(g,t.u_lineatlas_height)}),lineGradientSDF:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_image:new l.b_(g,t.u_image),u_image_height:new l.bp(g,t.u_image_height),u_tileratio:new l.bp(g,t.u_tileratio),u_crossfade_from:new l.bp(g,t.u_crossfade_from),u_crossfade_to:new l.bp(g,t.u_crossfade_to),u_image_dash:new l.b_(g,t.u_image_dash),u_mix:new l.bp(g,t.u_mix),u_lineatlas_width:new l.bp(g,t.u_lineatlas_width),u_lineatlas_height:new l.bp(g,t.u_lineatlas_height)}),raster:(g,t)=>({u_tl_parent:new l.c3(g,t.u_tl_parent),u_scale_parent:new l.bp(g,t.u_scale_parent),u_buffer_scale:new l.bp(g,t.u_buffer_scale),u_fade_t:new l.bp(g,t.u_fade_t),u_opacity:new l.bp(g,t.u_opacity),u_image0:new l.b_(g,t.u_image0),u_image1:new l.b_(g,t.u_image1),u_brightness_low:new l.bp(g,t.u_brightness_low),u_brightness_high:new l.bp(g,t.u_brightness_high),u_saturation_factor:new l.bp(g,t.u_saturation_factor),u_contrast_factor:new l.bp(g,t.u_contrast_factor),u_spin_weights:new l.c2(g,t.u_spin_weights),u_coords_top:new l.c1(g,t.u_coords_top),u_coords_bottom:new l.c1(g,t.u_coords_bottom)}),symbolIcon:(g,t)=>({u_is_size_zoom_constant:new l.b_(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(g,t.u_is_size_feature_constant),u_size_t:new l.bp(g,t.u_size_t),u_size:new l.bp(g,t.u_size),u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_pitch:new l.bp(g,t.u_pitch),u_rotate_symbol:new l.b_(g,t.u_rotate_symbol),u_aspect_ratio:new l.bp(g,t.u_aspect_ratio),u_fade_change:new l.bp(g,t.u_fade_change),u_label_plane_matrix:new l.c0(g,t.u_label_plane_matrix),u_coord_matrix:new l.c0(g,t.u_coord_matrix),u_is_text:new l.b_(g,t.u_is_text),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_is_along_line:new l.b_(g,t.u_is_along_line),u_is_variable_anchor:new l.b_(g,t.u_is_variable_anchor),u_texsize:new l.c3(g,t.u_texsize),u_texture:new l.b_(g,t.u_texture),u_translation:new l.c3(g,t.u_translation),u_pitched_scale:new l.bp(g,t.u_pitched_scale)}),symbolSDF:(g,t)=>({u_is_size_zoom_constant:new l.b_(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(g,t.u_is_size_feature_constant),u_size_t:new l.bp(g,t.u_size_t),u_size:new l.bp(g,t.u_size),u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_pitch:new l.bp(g,t.u_pitch),u_rotate_symbol:new l.b_(g,t.u_rotate_symbol),u_aspect_ratio:new l.bp(g,t.u_aspect_ratio),u_fade_change:new l.bp(g,t.u_fade_change),u_label_plane_matrix:new l.c0(g,t.u_label_plane_matrix),u_coord_matrix:new l.c0(g,t.u_coord_matrix),u_is_text:new l.b_(g,t.u_is_text),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_is_along_line:new l.b_(g,t.u_is_along_line),u_is_variable_anchor:new l.b_(g,t.u_is_variable_anchor),u_texsize:new l.c3(g,t.u_texsize),u_texture:new l.b_(g,t.u_texture),u_gamma_scale:new l.bp(g,t.u_gamma_scale),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_is_halo:new l.b_(g,t.u_is_halo),u_is_plain:new l.b_(g,t.u_is_plain),u_translation:new l.c3(g,t.u_translation),u_pitched_scale:new l.bp(g,t.u_pitched_scale)}),symbolTextAndIcon:(g,t)=>({u_is_size_zoom_constant:new l.b_(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(g,t.u_is_size_feature_constant),u_size_t:new l.bp(g,t.u_size_t),u_size:new l.bp(g,t.u_size),u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_pitch:new l.bp(g,t.u_pitch),u_rotate_symbol:new l.b_(g,t.u_rotate_symbol),u_aspect_ratio:new l.bp(g,t.u_aspect_ratio),u_fade_change:new l.bp(g,t.u_fade_change),u_label_plane_matrix:new l.c0(g,t.u_label_plane_matrix),u_coord_matrix:new l.c0(g,t.u_coord_matrix),u_is_text:new l.b_(g,t.u_is_text),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_is_along_line:new l.b_(g,t.u_is_along_line),u_is_variable_anchor:new l.b_(g,t.u_is_variable_anchor),u_texsize:new l.c3(g,t.u_texsize),u_texsize_icon:new l.c3(g,t.u_texsize_icon),u_texture:new l.b_(g,t.u_texture),u_texture_icon:new l.b_(g,t.u_texture_icon),u_gamma_scale:new l.bp(g,t.u_gamma_scale),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_is_halo:new l.b_(g,t.u_is_halo),u_translation:new l.c3(g,t.u_translation),u_pitched_scale:new l.bp(g,t.u_pitched_scale)}),background:(g,t)=>({u_opacity:new l.bp(g,t.u_opacity),u_color:new l.b$(g,t.u_color)}),backgroundPattern:(g,t)=>({u_opacity:new l.bp(g,t.u_opacity),u_image:new l.b_(g,t.u_image),u_pattern_tl_a:new l.c3(g,t.u_pattern_tl_a),u_pattern_br_a:new l.c3(g,t.u_pattern_br_a),u_pattern_tl_b:new l.c3(g,t.u_pattern_tl_b),u_pattern_br_b:new l.c3(g,t.u_pattern_br_b),u_texsize:new l.c3(g,t.u_texsize),u_mix:new l.bp(g,t.u_mix),u_pattern_size_a:new l.c3(g,t.u_pattern_size_a),u_pattern_size_b:new l.c3(g,t.u_pattern_size_b),u_scale_a:new l.bp(g,t.u_scale_a),u_scale_b:new l.bp(g,t.u_scale_b),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.bp(g,t.u_tile_units_to_pixels)}),terrain:(g,t)=>({u_texture:new l.b_(g,t.u_texture),u_ele_delta:new l.bp(g,t.u_ele_delta),u_fog_matrix:new l.c0(g,t.u_fog_matrix),u_fog_color:new l.b$(g,t.u_fog_color),u_fog_ground_blend:new l.bp(g,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.bp(g,t.u_fog_ground_blend_opacity),u_horizon_color:new l.b$(g,t.u_horizon_color),u_horizon_fog_blend:new l.bp(g,t.u_horizon_fog_blend),u_is_globe_mode:new l.bp(g,t.u_is_globe_mode)}),terrainDepth:(g,t)=>({u_ele_delta:new l.bp(g,t.u_ele_delta)}),terrainCoords:(g,t)=>({u_texture:new l.b_(g,t.u_texture),u_terrain_coords_id:new l.bp(g,t.u_terrain_coords_id),u_ele_delta:new l.bp(g,t.u_ele_delta)}),projectionErrorMeasurement:(g,t)=>({u_input:new l.bp(g,t.u_input),u_output_expected:new l.bp(g,t.u_output_expected)}),atmosphere:(g,t)=>({u_sun_pos:new l.c2(g,t.u_sun_pos),u_atmosphere_blend:new l.bp(g,t.u_atmosphere_blend),u_globe_position:new l.c2(g,t.u_globe_position),u_globe_radius:new l.bp(g,t.u_globe_radius),u_inv_proj_matrix:new l.c0(g,t.u_inv_proj_matrix)}),sky:(g,t)=>({u_sky_color:new l.b$(g,t.u_sky_color),u_horizon_color:new l.b$(g,t.u_horizon_color),u_horizon:new l.c3(g,t.u_horizon),u_horizon_normal:new l.c3(g,t.u_horizon_normal),u_sky_horizon_blend:new l.bp(g,t.u_sky_horizon_blend),u_sky_blend:new l.bp(g,t.u_sky_blend)})};class y1{constructor(t,o,h){this.context=t;let p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!h,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||o.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let o=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let v1={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class lm{constructor(t,o,h,p){this.length=o.length,this.attributes=h,this.itemSize=o.bytesPerElement,this.dynamicDraw=p,this.context=t;let v=t.gl;this.buffer=v.createBuffer(),t.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||o.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let h of this.attributes){let p=o.attributes[h.name];p!==void 0&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,o,h){for(let p of this.attributes){let v=o.attributes[p.name];v!==void 0&&t.vertexAttribPointer(v,p.components,t[v1[p.type]],!1,this.itemSize,p.offset+this.itemSize*(h||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Rt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cm extends Rt{getDefault(){return l.bo.transparent}set(t){let o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class hu extends Rt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class du extends Rt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class pu extends Rt{getDefault(){return[!0,!0,!0,!0]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Pd extends Rt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class jo extends Rt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class $l extends Rt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Us extends Rt{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Sr extends Rt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class um extends Rt{getDefault(){return[0,1]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class hm extends Rt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class Rd extends Rt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class qo extends Rt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class fu extends Rt{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class mu extends Rt{getDefault(){return l.bo.transparent}set(t){let o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Xl extends Rt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class gu extends Rt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class dm extends Rt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Vs extends Rt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class js extends Rt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class pm extends Rt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Id extends Rt{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ft extends Rt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class _u extends Rt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class b1 extends Rt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class fm extends Rt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Yl extends Rt{getDefault(){return null}set(t){let o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class x1 extends Rt{getDefault(){return null}set(t){var o;if(t===this.current&&!this.dirty)return;let h=this.gl;Gr(h)?h.bindVertexArray(t):(o=h.getExtension("OES_vertex_array_object"))===null||o===void 0||o.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class w1 extends Rt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class mm extends Rt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class T1 extends Rt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Wl extends Rt{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class yu extends Wl{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Kl extends Wl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class vu extends Wl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}let bu="Framebuffer is not complete";class gm{constructor(t,o,h,p,v){this.context=t,this.width=o,this.height=h;let T=t.gl,M=this.framebuffer=T.createFramebuffer();if(this.colorAttachment=new yu(t,M),p)this.depthAttachment=v?new vu(t,M):new Kl(t,M);else if(v)throw new Error("Stencil cannot be set without depth");if(T.checkFramebufferStatus(T.FRAMEBUFFER)!==T.FRAMEBUFFER_COMPLETE)throw new Error(bu)}destroy(){let t=this.context.gl,o=this.colorAttachment.get();if(o&&t.deleteTexture(o),this.depthAttachment){let h=this.depthAttachment.get();h&&t.deleteRenderbuffer(h)}t.deleteFramebuffer(this.framebuffer)}}class xu{constructor(t){var o,h;if(this.gl=t,this.clearColor=new cm(this),this.clearDepth=new hu(this),this.clearStencil=new du(this),this.colorMask=new pu(this),this.depthMask=new Pd(this),this.stencilMask=new jo(this),this.stencilFunc=new $l(this),this.stencilOp=new Us(this),this.stencilTest=new Sr(this),this.depthRange=new um(this),this.depthTest=new hm(this),this.depthFunc=new Rd(this),this.blend=new qo(this),this.blendFunc=new fu(this),this.blendColor=new mu(this),this.blendEquation=new Xl(this),this.cullFace=new gu(this),this.cullFaceSide=new dm(this),this.frontFace=new Vs(this),this.program=new js(this),this.activeTexture=new pm(this),this.viewport=new Id(this),this.bindFramebuffer=new ft(this),this.bindRenderbuffer=new _u(this),this.bindTexture=new b1(this),this.bindVertexBuffer=new fm(this),this.bindElementBuffer=new Yl(this),this.bindVertexArray=new x1(this),this.pixelStoreUnpack=new w1(this),this.pixelStoreUnpackPremultiplyAlpha=new mm(this),this.pixelStoreUnpackFlipY=new T1(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Gr(t)){this.HALF_FLOAT=t.HALF_FLOAT;let p=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(o=t.RGBA16F)!==null&&o!==void 0?o:p?.RGBA16F_EXT,this.RGB16F=(h=t.RGB16F)!==null&&h!==void 0?h:p?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");let p=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=p?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o){return new y1(this,t,o)}createVertexBuffer(t,o,h){return new lm(this,t,o,h)}createRenderbuffer(t,o,h){let p=this.gl,v=p.createRenderbuffer();return this.bindRenderbuffer.set(v),p.renderbufferStorage(p.RENDERBUFFER,t,o,h),this.bindRenderbuffer.set(null),v}createFramebuffer(t,o,h,p){return new gm(this,t,o,h,p)}clear({color:t,depth:o,stencil:h}){let p=this.gl,v=0;t&&(v|=p.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),o!==void 0&&(v|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),h!==void 0&&(v|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(h),this.stencilMask.set(255)),p.clear(v)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){l.bQ(t.blendFunction,Xt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Gr(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var o;Gr(this.gl)?this.gl.deleteVertexArray(t):(o=this.gl.getExtension("OES_vertex_array_object"))===null||o===void 0||o.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Go;function qs(g,t,o,h,p){var v,T;let M=g.context,C=g.transform,z=M.gl,P=g.useProgram("collisionBox"),k=[],L=0,N=0;for(let ae of h){let te=t.getTile(ae).getBucket(o);if(!te)continue;let Q=p?te.textCollisionBox:te.iconCollisionBox,re=te.collisionCircleArray;re.length>0&&(k.push({circleArray:re,circleOffset:N,coord:ae}),L+=re.length/4,N=L),Q&&P.draw(M,z.LINES,ht.disabled,bt.disabled,g.colorModeForRenderPass(),vt.disabled,nm(g.transform),(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(ae),C.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),o.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,null,g.transform.zoom,null,null,Q.collisionVertexBuffer)}if(!p||!k.length)return;let G=g.useProgram("collisionCircle"),$=new l.ca;$.resize(4*L),$._trim();let J=0;for(let ae of k)for(let te=0;te<ae.circleArray.length/4;te++){let Q=4*te,re=ae.circleArray[Q+0],ie=ae.circleArray[Q+1],me=ae.circleArray[Q+2],Te=ae.circleArray[Q+3];$.emplace(J++,re,ie,me,Te,0),$.emplace(J++,re,ie,me,Te,1),$.emplace(J++,re,ie,me,Te,2),$.emplace(J++,re,ie,me,Te,3)}(!Go||Go.length<2*L)&&(Go=(function(ae){let te=2*ae,Q=new l.cc;Q.resize(te),Q._trim();for(let re=0;re<te;re++){let ie=6*re;Q.uint16[ie+0]=4*re+0,Q.uint16[ie+1]=4*re+1,Q.uint16[ie+2]=4*re+2,Q.uint16[ie+3]=4*re+2,Q.uint16[ie+4]=4*re+3,Q.uint16[ie+5]=4*re+0}return Q})(L));let W=M.createIndexBuffer(Go,!0),ee=M.createVertexBuffer($,l.cb.members,!0);for(let ae of k){let te=Uo(g.transform);G.draw(M,z.TRIANGLES,ht.disabled,bt.disabled,g.colorModeForRenderPass(),vt.disabled,te,(T=g.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(ae.coord),null,o.id,ee,W,l.aV.simpleSegment(0,2*ae.circleOffset,ae.circleArray.length,ae.circleArray.length/2),null,g.transform.zoom,null,null,null)}ee.destroy(),W.destroy()}let Gs=l.ap(new Float32Array(16));function kd(g,t,o,h,p,v){let{horizontalAlign:T,verticalAlign:M}=l.aP(g);return new l.P((-(T-.5)*t/p+h[0])*v,(-(M-.5)*o/p+h[1])*v)}function S1(g,t,o,h,p,v){let T=t.tileAnchorPoint.add(new l.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let M=h.mult(v);o||(M=M.rotate(-p));let C=T.add(M);return ut(C.x,C.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(o){let M=Bt(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(g),C=Math.atan(M.y/M.x)+(M.x<0?Math.PI:0);return g.add(h.rotate(C))}return g.add(h)}function Ql(g,t,o,h,p,v,T,M,C,z,P,k){let L=g.text.placedSymbolArray,N=g.text.dynamicLayoutVertexArray,G=g.icon.dynamicLayoutVertexArray,$={};N.clear();for(let J=0;J<L.length;J++){let W=L.get(J),ee=W.hidden||!W.crossTileID||g.allowVerticalPlacement&&!W.placedOrientation?null:h[W.crossTileID];if(ee){let ae=new l.P(W.anchorX,W.anchorY),te={getElevation:k,width:p.width,height:p.height,pitchedLabelPlaneMatrix:v,pitchWithMap:o,transform:p,tileAnchorPoint:ae,translation:z,unwrappedTileID:P},Q=o?As(ae.x,ae.y,te):Bt(ae.x,ae.y,te),re=Ll(p.cameraToCenterDistance,Q.signedDistanceFromCamera),ie=l.ay(g.textSizeData,M,W)*re/l.aJ;o&&(ie*=g.tilePixelRatio/T);let{width:me,height:Te,anchor:Se,textOffset:Pe,textBoxScale:De}=ee,Qe=kd(Se,me,Te,Pe,De,ie),je=p.getPitchedTextCorrection(ae.x+z[0],ae.y+z[1],P),Ae=S1(Q.point,te,t,Qe,-p.bearingInRadians,je),$e=g.allowVerticalPlacement&&W.placedOrientation===l.ax.vertical?Math.PI/2:0;for(let et=0;et<W.numGlyphs;et++)l.aD(N,Ae,$e);C&&W.associatedIconIndex>=0&&($[W.associatedIconIndex]={shiftedAnchor:Ae,angle:$e})}else Ro(W.numGlyphs,N)}if(C){G.clear();let J=g.icon.placedSymbolArray;for(let W=0;W<J.length;W++){let ee=J.get(W);if(ee.hidden)Ro(ee.numGlyphs,G);else{let ae=$[W];if(ae)for(let te=0;te<ee.numGlyphs;te++)l.aD(G,ae.shiftedAnchor,ae.angle);else Ro(ee.numGlyphs,G)}}g.icon.dynamicLayoutVertexBuffer.updateData(G)}g.text.dynamicLayoutVertexBuffer.updateData(N)}function M1(g,t,o){return o.iconsInText&&t?"symbolTextAndIcon":g?"symbolSDF":"symbolIcon"}function Ld(g,t,o,h,p,v,T,M,C,z,P,k,L){var N,G;let $=g.context,J=$.gl,W=g.transform,ee=M==="map",ae=C==="map",te=M!=="viewport"&&o.layout.get("symbol-placement")!=="point",Q=ee&&!ae&&!te,re=!o.layout.get("symbol-sort-key").isConstant(),ie=!1,me=g.getDepthModeForSublayer(0,ht.ReadOnly),Te=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Se=[],Pe=W.getCircleRadiusCorrection();for(let je of h){let Ae=t.getTile(je),$e=Ae.getBucket(o);if(!$e)continue;let et=p?$e.text:$e.icon;if(!et?.segments.get().length||!et.hasVisibleVertices)continue;let It=et.programConfigurations.get(o.id),zi=p||$e.sdfIcons,Vt=p?$e.textSizeData:$e.iconSizeData,Li=ae||W.pitch!==0,Ui=g.useProgram(M1(zi,p,$e),It),Cn=l.aw(Vt,W.zoom),bi=(N=g.style.map.terrain)===null||N===void 0?void 0:N.getTerrainData(je),jn,yn,tn,An,ao=[0,0],oo=null;if(p)yn=Ae.glyphAtlasTexture,tn=J.LINEAR,jn=Ae.glyphAtlasTexture.size,$e.iconsInText&&(ao=Ae.imageAtlasTexture.size,oo=Ae.imageAtlasTexture,An=Li||g.options.rotating||g.options.zooming||Vt.kind==="composite"||Vt.kind==="camera"?J.LINEAR:J.NEAREST);else{let gi=o.layout.get("icon-size").constantOr(0)!==1||$e.iconsNeedLinear;yn=Ae.imageAtlasTexture,tn=zi||g.options.rotating||g.options.zooming||gi||Li?J.LINEAR:J.NEAREST,jn=Ae.imageAtlasTexture.size}let so=l.aK(Ae,1,g.transform.zoom),zn=sr(ee,g.transform,so),Oa=Yc(ae,ee,g.transform,so),lo=l.aL(W,Ae,v,T),Ou=W.getProjectionData({overscaledTileID:je,applyGlobeMatrix:!L,applyTerrainMatrix:!0}),fa=Te&&$e.hasTextData(),ma=o.layout.get("icon-text-fit")!=="none"&&fa&&$e.hasIconData();if(te){let gi=l.O();lt(gi,zn);let Wo=g.style.map.terrain?(Ba,rp)=>g.style.map.terrain.getElevation(je,Ba,rp):null,Bu=o.layout.get("text-rotation-alignment")==="map";Wc($e,g,p,zn,gi,ae,z,Bu,je.toUnwrapped(),W.width,W.height,lo,Wo)}let dr=p&&Te||ma,Cr=te||dr?Gs:ae?zn:g.transform.clipSpaceToPixelsMatrix,mi=zi&&o.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ai;ai=zi?$e.iconsInText?zd(Vt.kind,Cn,Q,ae,te,dr,g,Cr,Oa,lo,jn,ao,Pe):Ad(Vt.kind,Cn,Q,ae,te,dr,g,Cr,Oa,lo,p,jn,mi,Pe):uu(Vt.kind,Cn,Q,ae,te,dr,g,Cr,Oa,lo,p,jn,Pe);let Vi={program:Ui,buffers:et,uniformValues:ai,projectionData:Ou,atlasTexture:yn,atlasTextureIcon:oo,atlasInterpolation:tn,atlasInterpolationIcon:An,isSDF:zi,hasHalo:mi};if(re&&$e.canOverlap){ie=!0;let gi=et.segments.get();for(let Wo of gi)Se.push({segments:new l.aV([Wo]),sortKey:Wo.sortKey,state:Vi,terrainData:bi})}else Se.push({segments:et.segments,sortKey:0,state:Vi,terrainData:bi})}ie&&Se.sort(((je,Ae)=>je.sortKey-Ae.sortKey));let De=(G=o.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(null))!==null&&G!==void 0?G:1/0,Qe=o.layout.get("text-letter-spacing").constantOr(0)*l.aJ<0||De>1;for(let je of Se){let Ae=je.state;$.activeTexture.set(J.TEXTURE0),Ae.atlasTexture.bind(Ae.atlasInterpolation,J.CLAMP_TO_EDGE),Ae.atlasTextureIcon&&($.activeTexture.set(J.TEXTURE1),Ae.atlasTextureIcon&&Ae.atlasTextureIcon.bind(Ae.atlasInterpolationIcon,J.CLAMP_TO_EDGE));let $e=Ae.isSDF&&Ae.hasHalo;if($e){let et=Ae.uniformValues;et.u_is_halo=1,Qe&&(et.u_is_plain=0,Jl(Ae.buffers,je.segments,o,g,Ae.program,me,P,k,et,Ae.projectionData,je.terrainData),et.u_is_halo=0,et.u_is_plain=1)}Jl(Ae.buffers,je.segments,o,g,Ae.program,me,P,k,Ae.uniformValues,Ae.projectionData,je.terrainData),$e&&!Qe&&(Ae.uniformValues.u_is_halo=0)}}function Jl(g,t,o,h,p,v,T,M,C,z,P){let k=h.context;p.draw(k,k.gl.TRIANGLES,v,T,M,vt.backCCW,C,P,z,o.id,g.layoutVertexBuffer,g.indexBuffer,t,o.paint,h.transform.zoom,g.programConfigurations.get(o.id),g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer)}function Od(g,t,o,h,p){let v=g.context,T=v.gl,M=bt.disabled,C=new Xt([T.ONE,T.ONE],l.bo.transparent,[!0,!0,!0,!0]),z=t.getBucket(o);if(!z)return;let P=h.key,k=o.heatmapFbos.get(P);k||(k=Bd(v,t.tileSize,t.tileSize),o.heatmapFbos.set(P,k)),v.bindFramebuffer.set(k.framebuffer),v.viewport.set([0,0,t.tileSize,t.tileSize]),v.clear({color:l.bo.transparent});let L=z.programConfigurations.get(o.id),N=g.useProgram("heatmap",L,!p),G=g.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),$=g.style.map.terrain.getTerrainData(h);N.draw(v,T.TRIANGLES,ht.disabled,M,C,vt.disabled,Sd(t,g.transform.zoom,o.paint.get("heatmap-intensity"),1),$,G,o.id,z.layoutVertexBuffer,z.indexBuffer,z.segments,o.paint,g.transform.zoom,L)}function _m(g,t,o,h,p){let v=g.context,T=v.gl,M=g.transform;v.setColorMode(g.colorModeForRenderPass());let C=ec(v,t),z=o.key,P=t.heatmapFbos.get(z);if(!P)return;v.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,P.colorAttachment.get()),v.activeTexture.set(T.TEXTURE1),C.bind(T.LINEAR,T.CLAMP_TO_EDGE);let k=M.getProjectionData({overscaledTileID:o,applyTerrainMatrix:p,applyGlobeMatrix:!h});g.useProgram("heatmapTexture").draw(v,T.TRIANGLES,ht.disabled,bt.disabled,g.colorModeForRenderPass(),vt.disabled,Fs(g,t,0,1),null,k,t.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments,t.paint,M.zoom),P.destroy(),t.heatmapFbos.delete(z)}function Bd(g,t,o){var h,p;let v=g.gl,T=v.createTexture();v.bindTexture(v.TEXTURE_2D,T),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.LINEAR);let M=(h=g.HALF_FLOAT)!==null&&h!==void 0?h:v.UNSIGNED_BYTE,C=(p=g.RGBA16F)!==null&&p!==void 0?p:v.RGBA;v.texImage2D(v.TEXTURE_2D,0,C,t,o,0,v.RGBA,M,null);let z=g.createFramebuffer(t,o,!1,!1);return z.colorAttachment.set(T),z}function ec(g,t){return t.colorRampTexture||(t.colorRampTexture=new l.T(g,t.colorRamp,g.gl.RGBA)),t.colorRampTexture}function wu(g,t,o,h,p,v,T,M){let C=256;if(p.stepInterpolant){let z=t.getSource().maxzoom,P=T.canonical.z===z?Math.ceil(1<<g.transform.maxZoom-T.canonical.z):1;C=l.al(l.ce(v.maxLineLength/l.a6*1024*P),256,o.maxTextureSize)}return M.gradient=l.cf({expression:p.gradientExpression(),evaluationKey:"lineProgress",resolution:C,image:M.gradient||void 0,clips:v.lineClipsArray}),M.texture?M.texture.update(M.gradient):M.texture=new l.T(o,M.gradient,h.RGBA),M.version=p.gradientVersion,M.texture}function E1(g,t,o,h,p){g.activeTexture.set(t.TEXTURE0),o.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),h.updatePaintBuffers(p)}function ym(g,t,o,h,p,v){(p||g.lineAtlas.dirty)&&(t.activeTexture.set(o.TEXTURE0),g.lineAtlas.bind(t)),h.updatePaintBuffers(v)}function Ai(g,t,o,h,p,v,T){let M=v.gradients[p.id],C=M.texture;p.gradientVersion!==M.version&&(C=wu(g,t,o,h,p,v,T,M)),o.activeTexture.set(h.TEXTURE0),C.bind(p.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE)}function Zo(g,t,o,h,p,v,T,M,C){let z=v.gradients[p.id],P=z.texture;p.gradientVersion!==z.version&&(P=wu(g,t,o,h,p,v,T,z)),o.activeTexture.set(h.TEXTURE0),P.bind(p.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE),o.activeTexture.set(h.TEXTURE1),g.lineAtlas.bind(o),M.updatePaintBuffers(C)}function ir(g,t,o,h,p){if(!o||!h?.imageAtlas)return;let v=h.imageAtlas.patternPositions,T=v[o.to.toString()],M=v[o.from.toString()];if(!T&&M&&(T=M),!M&&T&&(M=T),!T||!M){let C=p.getPaintProperty(t);T=v[C],M=v[C]}T&&M&&g.setConstantPatternPositions(T,M)}function Tu(g,t,o,h,p,v,T,M){var C;let z=g.context.gl,P="fill-pattern",k=o.paint.get(P),L=k?.constantOr(1),N=o.getCrossfadeParameters(),G,$,J,W,ee,ae=g.transform,te=o.paint.get("fill-translate"),Q=o.paint.get("fill-translate-anchor");T?($=L&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=z.LINES):($=L?"fillPattern":"fill",G=z.TRIANGLES);let re=k.constantOr(null);for(let ie of h){let me=t.getTile(ie);if(L&&!me.patternsLoaded())continue;let Te=me.getBucket(o);if(!Te)continue;let Se=Te.programConfigurations.get(o.id),Pe=g.useProgram($,Se),De=(C=g.style.map.terrain)===null||C===void 0?void 0:C.getTerrainData(ie);L&&(g.context.activeTexture.set(z.TEXTURE0),me.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),Se.updatePaintBuffers(N)),ir(Se,P,re,me,o);let Qe=ae.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!M,applyTerrainMatrix:!0}),je=l.aL(ae,me,te,Q);if(T){W=Te.indexBuffer2,ee=Te.segments2;let $e=[z.drawingBufferWidth,z.drawingBufferHeight];J=$==="fillOutlinePattern"&&L?tm(g,N,me,$e,je):em($e,je)}else W=Te.indexBuffer,ee=Te.segments,J=L?lu(g,N,me,je):{u_fill_translate:je};let Ae=g.stencilModeForClipping(ie);Pe.draw(g.context,G,p,Ae,v,vt.backCCW,J,De,Qe,o.id,Te.layoutVertexBuffer,W,ee,o.paint,g.transform.zoom,Se)}}function Zs(g,t,o,h,p,v,T,M){var C;let z=g.context,P=z.gl,k="fill-extrusion-pattern",L=o.paint.get(k),N=L.constantOr(1),G=o.getCrossfadeParameters(),$=o.paint.get("fill-extrusion-opacity"),J=L.constantOr(null),W=g.transform;for(let ee of h){let ae=t.getTile(ee),te=ae.getBucket(o);if(!te)continue;let Q=(C=g.style.map.terrain)===null||C===void 0?void 0:C.getTerrainData(ee),re=te.programConfigurations.get(o.id),ie=g.useProgram(N?"fillExtrusionPattern":"fillExtrusion",re);N&&(g.context.activeTexture.set(P.TEXTURE0),ae.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),re.updatePaintBuffers(G));let me=W.getProjectionData({overscaledTileID:ee,applyGlobeMatrix:!M,applyTerrainMatrix:!0});ir(re,k,J,ae,o);let Te=l.aL(W,ae,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Se=o.paint.get("fill-extrusion-vertical-gradient"),Pe=N?Jf(g,Se,$,Te,ee,G,ae):Qf(g,Se,$,Te);ie.draw(z,z.gl.TRIANGLES,p,v,T,vt.backCCW,Pe,Q,me,o.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,o.paint,g.transform.zoom,re,g.style.map.terrain&&te.centroidVertexBuffer)}}function Su(g,t,o,h,p,v,T,M,C){var z;let P=g.style.projection,k=g.context,L=g.transform,N=k.gl,G=[`#define NUM_ILLUMINATION_SOURCES ${o.paint.get("hillshade-highlight-color").values.length}`],$=g.useProgram("hillshade",null,!1,G),J=!g.options.moving;for(let W of h){let ee=t.getTile(W),ae=ee.fbo;if(!ae)continue;let te=P.getMeshFromTileID(k,W.canonical,M,!0,"raster"),Q=(z=g.style.map.terrain)===null||z===void 0?void 0:z.getTerrainData(W);k.activeTexture.set(N.TEXTURE0),N.bindTexture(N.TEXTURE_2D,ae.colorAttachment.get());let re=L.getProjectionData({overscaledTileID:W,aligned:J,applyGlobeMatrix:!C,applyTerrainMatrix:!0});$.draw(k,N.TRIANGLES,v,p[W.overscaledZ],T,vt.backCCW,f1(g,ee,o),Q,re,o.id,te.vertexBuffer,te.indexBuffer,te.segments)}}let io=0;function tc(g,t,o,h,p,v,T,M,C){var z;let P=g.style.projection,k=g.context,L=g.transform,N=k.gl,G=g.useProgram("colorRelief"),$=!g.options.moving,J=o.paint.get("resampling")==="nearest"?N.NEAREST:N.LINEAR,W=!0,ee=0;for(let ae of h){let te=t.getTile(ae),Q=te.dem;if(W){io||(io=N.getParameter(N.MAX_TEXTURE_SIZE));let Pe=io,{elevationTexture:De,colorTexture:Qe}=o.getColorRampTextures(k,Pe,Q.getUnpackVector());k.activeTexture.set(N.TEXTURE1),De.bind(N.NEAREST,N.CLAMP_TO_EDGE),k.activeTexture.set(N.TEXTURE4),Qe.bind(N.LINEAR,N.CLAMP_TO_EDGE),W=!1,ee=De.size[0]}if(!Q?.data)continue;let re=Q.stride,ie=Q.getPixels();if(k.activeTexture.set(N.TEXTURE0),k.pixelStoreUnpackPremultiplyAlpha.set(!1),te.demTexture||(te.demTexture=g.getTileTexture(re)),te.demTexture){let Pe=te.demTexture;Pe.update(ie,{premultiply:!1}),Pe.bind(J,N.CLAMP_TO_EDGE)}else te.demTexture=new l.T(k,ie,N.RGBA,{premultiply:!1}),te.demTexture.bind(J,N.CLAMP_TO_EDGE);let me=P.getMeshFromTileID(k,ae.canonical,M,!0,"raster"),Te=(z=g.style.map.terrain)===null||z===void 0?void 0:z.getTerrainData(ae),Se=L.getProjectionData({overscaledTileID:ae,aligned:$,applyGlobeMatrix:!C,applyTerrainMatrix:!0});G.draw(k,N.TRIANGLES,v,p[ae.overscaledZ],T,vt.backCCW,g1(o,te.dem,ee),Te,Se,o.id,me.vertexBuffer,me.indexBuffer,me.segments)}}let Ho=[new l.P(0,0),new l.P(l.a6,0),new l.P(l.a6,l.a6),new l.P(0,l.a6)];function Hs(g,t,o,h,p,v,T,M,C=!1,z=!1){var P;let k=h[h.length-1].overscaledZ,L=g.context,N=L.gl,G=g.useProgram("raster"),$=g.transform,J=g.style.projection,W=g.colorModeForRenderPass(),ee=!g.options.moving,ae=o.paint.get("raster-opacity"),te=o.paint.get("resampling")==="nearest"||o.paint.get("raster-resampling")==="nearest"?N.NEAREST:N.LINEAR,Q=o.paint.get("raster-fade-duration"),re=!!g.style.map.terrain;for(let ie of h){let me=g.getDepthModeForSublayer(ie.overscaledZ-k,ae===1?ht.ReadWrite:ht.ReadOnly,N.LESS),Te=t.getTile(ie);L.activeTexture.set(N.TEXTURE0),Te.texture.bind(te,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),L.activeTexture.set(N.TEXTURE1);let{parentTile:Se,parentScaleBy:Pe,parentTopLeft:De,fadeValues:Qe}=vm(Te,t,Q,re);Te.fadeOpacity=Qe.tileOpacity,Se?(Se.fadeOpacity=Qe.parentTileOpacity,Se.texture.bind(te,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST)):Te.texture.bind(te,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),Te.texture.useMipmap&&L.extTextureFilterAnisotropic&&g.transform.pitch>g.options.anisotropicFilterPitch&&N.texParameterf(N.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);let je=(P=g.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(ie),Ae=$.getProjectionData({overscaledTileID:ie,aligned:ee,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),$e=Ed(De,Pe,Qe.fadeMix,o,M),et=J.getMeshFromTileID(L,ie.canonical,v,T,"raster");G.draw(L,N.TRIANGLES,me,p?p[ie.overscaledZ]:bt.disabled,W,C?vt.frontCCW:vt.backCCW,$e,je,Ae,o.id,et.vertexBuffer,et.indexBuffer,et.segments)}}function vm(g,t,o,h){let p={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(o===0||h)return p;if(g.fadingParentID){let v=t.getLoadedTile(g.fadingParentID);if(!v)return p;let T=Math.pow(2,v.tileID.overscaledZ-g.tileID.overscaledZ),M=[g.tileID.canonical.x*T%1,g.tileID.canonical.y*T%1],C=(function(z,P,k){let L=ce(),N=(L-P.timeAdded)/k,G=z.fadingDirection===fn.Incoming,$=l.al((L-z.timeAdded)/k,0,1),J=l.al(1-N,0,1),W=G?$:J;return{tileOpacity:W,parentTileOpacity:G?J:$,fadeMix:{opacity:1,mix:1-W}}})(g,v,o);return{parentTile:v,parentScaleBy:T,parentTopLeft:M,fadeValues:C}}if(g.selfFading){let v=(function(T,M){let C=(ce()-T.timeAdded)/M,z=l.al(C,0,1);return{tileOpacity:z,fadeMix:{opacity:z,mix:0}}})(g,o);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:v}}return p}let bm=new l.bo(1,0,0,1),xm=new l.bo(0,1,0,1),wm=new l.bo(0,0,1,1),Tm=new l.bo(1,0,1,1),no=new l.bo(0,1,1,1);function Fd(g,t,o,h){ic(g,0,t+o/2,g.transform.width,o,h)}function Nd(g,t,o,h){ic(g,t-o/2,0,o,g.transform.height,h)}function ic(g,t,o,h,p,v){let T=g.context,M=T.gl;M.enable(M.SCISSOR_TEST),M.scissor(t*g.pixelRatio,o*g.pixelRatio,h*g.pixelRatio,p*g.pixelRatio),T.clear({color:v}),M.disable(M.SCISSOR_TEST)}function Sm(g,t,o){var h;let p=g.context,v=p.gl,T=g.useProgram("debug"),M=ht.disabled,C=bt.disabled,z=g.colorModeForRenderPass(),P="$debug",k=(h=g.style.map.terrain)===null||h===void 0?void 0:h.getTerrainData(o);p.activeTexture.set(v.TEXTURE0);let L=t.getTileByID(o.key).latestRawTileData,N=Math.floor((L?.byteLength||0)/1024),G=t.getTile(o).tileSize,$=512/Math.min(G,512)*(o.overscaledZ/g.transform.zoom)*.5,J=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(J+=` => ${o.overscaledZ}`),(function(ee,ae){ee.initDebugOverlayCanvas();let te=ee.debugOverlayCanvas,Q=ee.context.gl,re=ee.debugOverlayCanvas.getContext("2d");re.clearRect(0,0,te.width,te.height),re.shadowColor="white",re.shadowBlur=2,re.lineWidth=1.5,re.strokeStyle="white",re.textBaseline="top",re.font="bold 36px Open Sans, sans-serif",re.fillText(ae,5,5),re.strokeText(ae,5,5),ee.debugOverlayTexture.update(te),ee.debugOverlayTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)})(g,`${J} ${N}kB`);let W=g.transform.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(p,v.TRIANGLES,M,C,Xt.alphaBlended,vt.disabled,Td(l.bo.transparent,$),null,W,P,g.debugBuffer,g.quadTriangleIndexBuffer,g.debugSegments),T.draw(p,v.LINE_STRIP,M,C,z,vt.disabled,Td(l.bo.red),k,W,P,g.debugBuffer,g.tileBorderIndexBuffer,g.debugSegments)}function Ud(g,t,o,h){let{isRenderingGlobe:p}=h,v=g.context,T=v.gl,M=g.transform,C=g.colorModeForRenderPass(),z=g.getDepthModeFor3D(),P=g.useProgram("terrain");v.bindFramebuffer.set(null),v.viewport.set([0,0,g.width,g.height]);for(let k of o){let L=t.getTerrainMesh(k.tileID),N=g.renderToTexture.getTexture(k),G=t.getTerrainData(k.tileID);v.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,N.texture);let $=t.getMeshFrameDelta(M.zoom),J=M.calculateFogMatrix(k.tileID.toUnwrapped()),W=su($,J,g.style.sky,M.pitch,p),ee=M.getProjectionData({overscaledTileID:k.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(v,T.TRIANGLES,z,bt.disabled,C,vt.backCCW,W,G,ee,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}function Vd(g,t){if(!t.mesh){let o=new l.aU;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(1,1),o.emplaceBack(-1,1);let h=new l.aW;h.emplaceBack(0,1,2),h.emplaceBack(0,2,3),t.mesh=new $t(g.createVertexBuffer(o,eo.members),g.createIndexBuffer(h),l.aV.simpleSegment(0,0,o.length,h.length))}return t.mesh}let Mm={symbol:function(g,t,o,h,p,v){if(g.renderPass!=="translucent")return;let{isRenderingToTexture:T}=v,M=bt.disabled,C=g.colorModeForRenderPass();(o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(z,P,k,L,N,G,$,J,W){var ee;let ae=P.transform,te=P.style.map.terrain,Q=N==="map",re=G==="map";for(let ie of z){let me=L.getTile(ie),Te=me.getBucket(k);if(!(!((ee=Te?.text)===null||ee===void 0)&&ee.segments.get().length))continue;let Se=l.aw(Te.textSizeData,ae.zoom),Pe=l.aK(me,1,P.transform.zoom),De=sr(Q,P.transform,Pe),Qe=k.layout.get("icon-text-fit")!=="none"&&Te.hasIconData();if(Se){let je=Math.pow(2,ae.zoom-me.tileID.overscaledZ),Ae=te?($e,et)=>te.getElevation(ie,$e,et):null;Ql(Te,Q,re,W,ae,De,je,Se,Qe,l.aL(ae,me,$,J),ie.toUnwrapped(),Ae)}}})(h,g,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),p),o.paint.get("icon-opacity").constantOr(1)!==0&&Ld(g,t,o,h,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),M,C,T),o.paint.get("text-opacity").constantOr(1)!==0&&Ld(g,t,o,h,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),M,C,T),t.map.showCollisionBoxes&&(qs(g,t,o,h,!0),qs(g,t,o,h,!1))},circle:function(g,t,o,h,p){var v;if(g.renderPass!=="translucent")return;let{isRenderingToTexture:T}=p,M=o.paint.get("circle-opacity"),C=o.paint.get("circle-stroke-width"),z=o.paint.get("circle-stroke-opacity"),P=!o.layout.get("circle-sort-key").isConstant();if(M.constantOr(1)===0&&(C.constantOr(1)===0||z.constantOr(1)===0))return;let k=g.context,L=k.gl,N=g.transform,G=g.getDepthModeForSublayer(0,ht.ReadOnly),$=bt.disabled,J=g.colorModeForRenderPass(),W=[],ee=N.getCircleRadiusCorrection();for(let ae of h){let te=t.getTile(ae),Q=te.getBucket(o);if(!Q)continue;let re=o.paint.get("circle-translate"),ie=o.paint.get("circle-translate-anchor"),me=l.aL(N,te,re,ie),Te=Q.programConfigurations.get(o.id),Se=g.useProgram("circle",Te),Pe=Q.layoutVertexBuffer,De=Q.indexBuffer,Qe=(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(ae),je={programConfiguration:Te,program:Se,layoutVertexBuffer:Pe,indexBuffer:De,uniformValues:im(g,te,o,me,ee),terrainData:Qe,projectionData:N.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!T,applyTerrainMatrix:!0})};if(P){let Ae=Q.segments.get();for(let $e of Ae)W.push({segments:new l.aV([$e]),sortKey:$e.sortKey,state:je})}else W.push({segments:Q.segments,sortKey:0,state:je})}P&&W.sort(((ae,te)=>ae.sortKey-te.sortKey));for(let ae of W){let{programConfiguration:te,program:Q,layoutVertexBuffer:re,indexBuffer:ie,uniformValues:me,terrainData:Te,projectionData:Se}=ae.state;Q.draw(k,L.TRIANGLES,G,$,J,vt.backCCW,me,Te,Se,o.id,re,ie,ae.segments,o.paint,g.transform.zoom,te)}},heatmap:function(g,t,o,h,p){if(o.paint.get("heatmap-opacity")===0)return;let v=g.context,{isRenderingToTexture:T,isRenderingGlobe:M}=p;if(g.style.map.terrain){for(let C of h){let z=t.getTile(C);t.hasRenderableParent(C)||(g.renderPass==="offscreen"?Od(g,z,o,C,M):g.renderPass==="translucent"&&_m(g,o,C,T,M))}v.viewport.set([0,0,g.width,g.height])}else g.renderPass==="offscreen"?(function(C,z,P,k){let L=C.context,N=L.gl,G=C.transform,$=bt.disabled,J=new Xt([N.ONE,N.ONE],l.bo.transparent,[!0,!0,!0,!0]);(function(W,ee,ae){let te=W.gl;W.activeTexture.set(te.TEXTURE1),W.viewport.set([0,0,ee.width/4,ee.height/4]);let Q=ae.heatmapFbos.get(l.cd);Q?(te.bindTexture(te.TEXTURE_2D,Q.colorAttachment.get()),W.bindFramebuffer.set(Q.framebuffer)):(Q=Bd(W,ee.width/4,ee.height/4),ae.heatmapFbos.set(l.cd,Q))})(L,C,P),L.clear({color:l.bo.transparent});for(let W of k){if(z.hasRenderableParent(W))continue;let ee=z.getTile(W),ae=ee.getBucket(P);if(!ae)continue;let te=ae.programConfigurations.get(P.id),Q=C.useProgram("heatmap",te),re=G.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),ie=G.getCircleRadiusCorrection();Q.draw(L,N.TRIANGLES,ht.disabled,$,J,vt.backCCW,Sd(ee,G.zoom,P.paint.get("heatmap-intensity"),ie),null,re,P.id,ae.layoutVertexBuffer,ae.indexBuffer,ae.segments,P.paint,G.zoom,te)}L.viewport.set([0,0,C.width,C.height])})(g,t,o,h):g.renderPass==="translucent"&&(function(C,z){let P=C.context,k=P.gl;P.setColorMode(C.colorModeForRenderPass());let L=z.heatmapFbos.get(l.cd);L&&(P.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,L.colorAttachment.get()),P.activeTexture.set(k.TEXTURE1),ec(P,z).bind(k.LINEAR,k.CLAMP_TO_EDGE),C.useProgram("heatmapTexture").draw(P,k.TRIANGLES,ht.disabled,bt.disabled,C.colorModeForRenderPass(),vt.disabled,Fs(C,z,0,1),null,null,z.id,C.viewportBuffer,C.quadTriangleIndexBuffer,C.viewportSegments,z.paint,C.transform.zoom))})(g,o)},line:function(g,t,o,h,p){var v;if(g.renderPass!=="translucent")return;let{isRenderingToTexture:T}=p,M=o.paint.get("line-opacity"),C=o.paint.get("line-width");if(M.constantOr(1)===0||C.constantOr(1)===0)return;let z=g.getDepthModeForSublayer(0,ht.ReadOnly),P=g.colorModeForRenderPass(),k=o.paint.get("line-dasharray"),L=k.constantOr(1),N=o.paint.get("line-pattern"),G=N.constantOr(1),$=o.paint.get("line-gradient"),J=o.getCrossfadeParameters(),W;W=G?"linePattern":L&&$?"lineGradientSDF":L?"lineSDF":$?"lineGradient":"line";let ee=g.context,ae=ee.gl,te=g.transform,Q=!0;for(let re of h){let ie=t.getTile(re);if(G&&!ie.patternsLoaded())continue;let me=ie.getBucket(o);if(!me)continue;let Te=me.programConfigurations.get(o.id),Se=g.context.program.get(),Pe=g.useProgram(W,Te),De=Q||Pe.program!==Se,Qe=(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(re),je=N.constantOr(null),Ae=k?.constantOr(null);if(je&&ie.imageAtlas){let Vt=ie.imageAtlas,Li=Vt.patternPositions[je.to.toString()],Ui=Vt.patternPositions[je.from.toString()];Li&&Ui&&Te.setConstantPatternPositions(Li,Ui)}else if(Ae){let Vt=o.layout.get("line-cap").constantOr(null)==="round",Li=g.lineAtlas.getDash(Ae.to,Vt),Ui=g.lineAtlas.getDash(Ae.from,Vt);Te.setConstantDashPositions(Li,Ui)}let $e=te.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),et=te.getPixelScale(),It;G?(It=am(g,ie,o,et,J),E1(ee,ae,ie,Te,J)):L&&$?(It=om(g,ie,o,et,J,me.lineClipsArray.length),Zo(g,t,ee,ae,o,me,re,Te,J)):L?(It=Md(g,ie,o,et,J),ym(g,ee,ae,Te,De,J)):$?(It=rm(g,ie,o,et,me.lineClipsArray.length),Ai(g,t,ee,ae,o,me,re)):It=Hl(g,ie,o,et);let zi=g.stencilModeForClipping(re);Pe.draw(ee,ae.TRIANGLES,z,zi,P,vt.disabled,It,Qe,$e,o.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,o.paint,g.transform.zoom,Te,me.layoutVertexBuffer2),Q=!1}},fill:function(g,t,o,h,p){let v=o.paint.get("fill-color"),T=o.paint.get("fill-opacity");if(T.constantOr(1)===0)return;let{isRenderingToTexture:M}=p,C=g.colorModeForRenderPass(),z=o.paint.get("fill-pattern"),P=g.opaquePassEnabledForLayer()&&!z.constantOr(1)&&v.constantOr(l.bo.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";if(g.renderPass===P){let k=g.getDepthModeForSublayer(1,g.renderPass==="opaque"?ht.ReadWrite:ht.ReadOnly);Tu(g,t,o,h,k,C,!1,M)}if(g.renderPass==="translucent"&&o.paint.get("fill-antialias")){let k=g.getDepthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,ht.ReadOnly);Tu(g,t,o,h,k,C,!0,M)}},fillExtrusion:function(g,t,o,h,p){let v=o.paint.get("fill-extrusion-opacity");if(v===0)return;let{isRenderingToTexture:T}=p;if(g.renderPass==="translucent"){let M=new ht(g.context.gl.LEQUAL,ht.ReadWrite,g.depthRangeFor3D);if(v!==1||o.paint.get("fill-extrusion-pattern").constantOr(1))Zs(g,t,o,h,M,bt.disabled,Xt.disabled,T),Zs(g,t,o,h,M,g.stencilModeFor3D(),g.colorModeForRenderPass(),T);else{let C=g.colorModeForRenderPass();Zs(g,t,o,h,M,bt.disabled,C,T)}}},hillshade:function(g,t,o,h,p){if(g.renderPass!=="offscreen"&&g.renderPass!=="translucent")return;let{isRenderingToTexture:v}=p,T=g.context,M=g.style.projection.useSubdivision,C=g.getDepthModeForSublayer(0,ht.ReadOnly),z=g.colorModeForRenderPass();if(g.renderPass==="offscreen")(function(P,k,L,N,G,$,J){let W=P.context,ee=W.gl,ae=N.paint.get("resampling")==="nearest"?ee.NEAREST:ee.LINEAR;for(let te of L){let Q=k.getTile(te),re=Q.dem;if(!re?.data||!Q.needsHillshadePrepare)continue;let ie=re.dim,me=re.stride,Te=re.getPixels();if(W.activeTexture.set(ee.TEXTURE1),W.pixelStoreUnpackPremultiplyAlpha.set(!1),Q.demTexture||(Q.demTexture=P.getTileTexture(me)),Q.demTexture){let Pe=Q.demTexture;Pe.update(Te,{premultiply:!1}),Pe.bind(ee.NEAREST,ee.CLAMP_TO_EDGE)}else Q.demTexture=new l.T(W,Te,ee.RGBA,{premultiply:!1}),Q.demTexture.bind(ee.NEAREST,ee.CLAMP_TO_EDGE);W.activeTexture.set(ee.TEXTURE0);let Se=Q.fbo;if(!Se){let Pe=new l.T(W,{width:ie,height:ie,data:null},ee.RGBA);Pe.bind(ae,ee.CLAMP_TO_EDGE),Se=Q.fbo=W.createFramebuffer(ie,ie,!0,!1),Se.colorAttachment.set(Pe.texture)}W.bindFramebuffer.set(Se.framebuffer),W.viewport.set([0,0,ie,ie]),P.useProgram("hillshadePrepare").draw(W,ee.TRIANGLES,G,$,J,vt.disabled,cu(Q.tileID,re),null,null,N.id,P.rasterBoundsBuffer,P.quadTriangleIndexBuffer,P.rasterBoundsSegments),Q.needsHillshadePrepare=!1}})(g,t,h,o,C,bt.disabled,z),T.viewport.set([0,0,g.width,g.height]);else if(g.renderPass==="translucent")if(M){let[P,k,L]=g.stencilConfigForOverlapTwoPass(h);Su(g,t,o,L,P,C,z,!1,v),Su(g,t,o,L,k,C,z,!0,v)}else{let[P,k]=g.getStencilConfigForOverlapAndUpdateStencilID(h);Su(g,t,o,k,P,C,z,!1,v)}},colorRelief:function(g,t,o,h,p){if(g.renderPass!=="translucent"||!h.length)return;let{isRenderingToTexture:v}=p,T=g.style.projection.useSubdivision,M=g.getDepthModeForSublayer(0,ht.ReadOnly),C=g.colorModeForRenderPass();if(T){let[z,P,k]=g.stencilConfigForOverlapTwoPass(h);tc(g,t,o,k,z,M,C,!1,v),tc(g,t,o,k,P,M,C,!0,v)}else{let[z,P]=g.getStencilConfigForOverlapAndUpdateStencilID(h);tc(g,t,o,P,z,M,C,!1,v)}},raster:function(g,t,o,h,p){if(g.renderPass!=="translucent"||o.paint.get("raster-opacity")===0||!h.length)return;let{isRenderingToTexture:v}=p,T=t.getSource(),M=g.style.projection.useSubdivision;if(T instanceof Tr)Hs(g,t,o,h,null,!1,!1,T.tileCoords,T.flippedWindingOrder,v);else if(M){let[C,z,P]=g.stencilConfigForOverlapTwoPass(h);Hs(g,t,o,P,C,!1,!0,Ho,!1,v),Hs(g,t,o,P,z,!0,!0,Ho,!1,v)}else{let[C,z]=g.getStencilConfigForOverlapAndUpdateStencilID(h);Hs(g,t,o,z,C,!1,!0,Ho,!1,v)}},background:function(g,t,o,h,p){var v;let T=o.paint.get("background-color"),M=o.paint.get("background-opacity");if(M===0)return;let{isRenderingToTexture:C}=p,z=g.context,P=z.gl,k=g.style.projection,L=g.transform,N=L.tileSize,G=o.paint.get("background-pattern");if(g.isPatternMissing(G))return;let $=!G&&T.a===1&&M===1&&g.opaquePassEnabledForLayer()?"opaque":"translucent";if(g.renderPass!==$)return;let J=bt.disabled,W=g.getDepthModeForSublayer(0,$==="opaque"?ht.ReadWrite:ht.ReadOnly),ee=g.colorModeForRenderPass(),ae=g.useProgram(G?"backgroundPattern":"background"),te=h||zo(L,{tileSize:N,terrain:g.style.map.terrain});G&&(z.activeTexture.set(P.TEXTURE0),g.imageManager.bind(g.context));let Q=o.getCrossfadeParameters();for(let re of te){let ie=L.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),me=G?Dd(M,g,G,{tileID:re,tileSize:N},Q):Vo(M,T),Te=(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(re),Se=k.getMeshFromTileID(z,re.canonical,!1,!0,"raster");ae.draw(z,P.TRIANGLES,W,J,ee,vt.backCCW,me,Te,ie,o.id,Se.vertexBuffer,Se.indexBuffer,Se.segments)}},sky:function(g,t){let o=g.context,h=o.gl,p=((P,k,L)=>{let N=Math.cos(k.rollInRadians),G=Math.sin(k.rollInRadians),$=ca(k),J=k.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:P.properties.get("sky-color"),u_horizon_color:P.properties.get("horizon-color"),u_horizon:[(k.width/2-$*G)*L,(k.height/2+$*N)*L],u_horizon_normal:[-G,N],u_sky_horizon_blend:P.properties.get("sky-horizon-blend")*k.height/2*L,u_sky_blend:J}})(t,g.style.map.transform,g.pixelRatio),v=new ht(h.LEQUAL,ht.ReadWrite,[0,1]),T=bt.disabled,M=g.colorModeForRenderPass(),C=g.useProgram("sky"),z=Vd(o,t);C.draw(o,h.TRIANGLES,v,T,M,vt.disabled,p,null,void 0,"sky",z.vertexBuffer,z.indexBuffer,z.segments)},atmosphere:function(g,t,o){let h=g.context,p=h.gl,v=g.useProgram("atmosphere"),T=new ht(p.LEQUAL,ht.ReadOnly,[0,1]),M=g.transform,C=(function(J,W){let ee=J.properties.get("position"),ae=[-ee.x,-ee.y,-ee.z],te=l.ap(new Float64Array(16));return J.properties.get("anchor")==="map"&&(l.be(te,te,W.rollInRadians),l.bf(te,te,-W.pitchInRadians),l.be(te,te,W.bearingInRadians),l.bf(te,te,W.center.lat*Math.PI/180),l.bI(te,te,-W.center.lng*Math.PI/180)),l.cg(ae,ae,te),ae})(o,g.transform),z=M.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),P=t.properties.get("atmosphere-blend")*z.projectionTransition;if(P===0)return;let k=cr(M.worldSize,M.center.lat),L=M.inverseProjectionMatrix,N=new Float64Array(4);N[3]=1,l.aE(N,N,M.modelViewProjectionMatrix),N[0]/=N[3],N[1]/=N[3],N[2]/=N[3],N[3]=1,l.aE(N,N,L),N[0]/=N[3],N[1]/=N[3],N[2]/=N[3],N[3]=1;let G=((J,W,ee,ae,te)=>({u_sun_pos:J,u_atmosphere_blend:W,u_globe_position:ee,u_globe_radius:ae,u_inv_proj_matrix:te}))(C,P,[N[0],N[1],N[2]],k,L),$=Vd(h,t);v.draw(h,p.TRIANGLES,T,bt.disabled,Xt.alphaBlended,vt.disabled,G,null,null,"atmosphere",$.vertexBuffer,$.indexBuffer,$.segments)},custom:function(g,t,o,h){let{isRenderingGlobe:p}=h,v=g.context,T=o.implementation,M=g.style.projection,C=g.transform,z=C.getProjectionDataForCustomLayer(p),P={farZ:C.farZ,nearZ:C.nearZ,fov:C.fov*Math.PI/180,modelViewProjectionMatrix:C.modelViewProjectionMatrix,projectionMatrix:C.projectionMatrix,shaderData:{variantName:M.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
799
+ uniform mat4 u_projection_matrix;
800
+ ${M.shaderPreludeCode.vertexSource}`,define:M.shaderDefine},defaultProjectionData:z},k=T.renderingMode?T.renderingMode:"2d";if(g.renderPass==="offscreen"){let L=T.prerender;L&&(g.setCustomLayerDefaults(),v.setColorMode(g.colorModeForRenderPass()),L.call(T,v.gl,P),v.setDirty(),g.setBaseState())}else if(g.renderPass==="translucent"){g.setCustomLayerDefaults(),v.setColorMode(g.colorModeForRenderPass()),v.setStencilMode(bt.disabled);let L=k==="3d"?g.getDepthModeFor3D():g.getDepthModeForSublayer(0,ht.ReadOnly);v.setDepthMode(L),T.render(v.gl,P),v.setDirty(),g.setBaseState(),v.bindFramebuffer.set(null)}},debug:function(g,t,o){for(let h of o)Sm(g,t,h)},debugPadding:function(g){let t=g.transform.padding;Fd(g,g.transform.height-(t.top||0),3,bm),Fd(g,t.bottom||0,3,xm),Nd(g,t.left||0,3,wm),Nd(g,g.transform.width-(t.right||0),3,Tm);let o=g.transform.centerPoint;(function(h,p,v,T){ic(h,p-1,v-10,2,20,T),ic(h,p-10,v-1,20,2,T)})(g,o.x,g.transform.height-o.y,no)},terrainDepth:function(g,t){let o=g.context,h=o.gl,p=g.transform,v=Xt.unblended,T=new ht(h.LEQUAL,ht.ReadWrite,[0,1]),M=t.tileManager.getRenderableTiles(),C=g.useProgram("terrainDepth");o.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),o.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),o.clear({color:l.bo.transparent,depth:1});for(let z of M){let P=t.getTerrainMesh(z.tileID),k=t.getTerrainData(z.tileID),L=p.getProjectionData({overscaledTileID:z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),N={u_ele_delta:t.getMeshFrameDelta(p.zoom)};C.draw(o,h.TRIANGLES,T,bt.disabled,v,vt.backCCW,N,k,L,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}o.bindFramebuffer.set(null),o.viewport.set([0,0,g.width,g.height])},terrainCoords:function(g,t){let o=g.context,h=o.gl,p=g.transform,v=Xt.unblended,T=new ht(h.LEQUAL,ht.ReadWrite,[0,1]),M=t.getCoordsTexture(),C=t.tileManager.getRenderableTiles(),z=g.useProgram("terrainCoords");o.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),o.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),o.clear({color:l.bo.transparent,depth:1}),t.coordsIndex=[];for(let P of C){let k=t.getTerrainMesh(P.tileID),L=t.getTerrainData(P.tileID);o.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,M.texture);let N={u_terrain_coords_id:(255-t.coordsIndex.length)/255,u_texture:0,u_ele_delta:t.getMeshFrameDelta(p.zoom)},G=p.getProjectionData({overscaledTileID:P.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});z.draw(o,h.TRIANGLES,T,bt.disabled,v,vt.backCCW,N,L,G,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),t.coordsIndex.push(P.tileID.key)}o.bindFramebuffer.set(null),o.viewport.set([0,0,g.width,g.height])}};class nc{constructor(t,o){this.drawFunctions=Mm,this.context=new xu(t),this.transform=o,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:l.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=gn.maxOverzooming+gn.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new er}resize(t,o,h){if(this.width=Math.floor(t*h),this.height=Math.floor(o*h),this.pixelRatio=h,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let p of this.style._order)this.style._layers[p].resize()}setup(){let t=this.context,o=new l.aU;o.emplaceBack(0,0),o.emplaceBack(l.a6,0),o.emplaceBack(0,l.a6),o.emplaceBack(l.a6,l.a6),this.tileExtentBuffer=t.createVertexBuffer(o,eo.members),this.tileExtentSegments=l.aV.simpleSegment(0,0,4,2);let h=new l.aU;h.emplaceBack(0,0),h.emplaceBack(l.a6,0),h.emplaceBack(0,l.a6),h.emplaceBack(l.a6,l.a6),this.debugBuffer=t.createVertexBuffer(h,eo.members),this.debugSegments=l.aV.simpleSegment(0,0,4,5);let p=new l.ch;p.emplaceBack(0,0,0,0),p.emplaceBack(l.a6,0,l.a6,0),p.emplaceBack(0,l.a6,0,l.a6),p.emplaceBack(l.a6,l.a6,l.a6,l.a6),this.rasterBoundsBuffer=t.createVertexBuffer(p,Zl.members),this.rasterBoundsSegments=l.aV.simpleSegment(0,0,4,2);let v=new l.aU;v.emplaceBack(0,0),v.emplaceBack(l.a6,0),v.emplaceBack(0,l.a6),v.emplaceBack(l.a6,l.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(v,eo.members),this.rasterBoundsSegmentsPosOnly=l.aV.simpleSegment(0,0,4,5);let T=new l.aU;T.emplaceBack(0,0),T.emplaceBack(1,0),T.emplaceBack(0,1),T.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(T,eo.members),this.viewportSegments=l.aV.simpleSegment(0,0,4,2);let M=new l.ci;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(M);let C=new l.aW;C.emplaceBack(1,0,2),C.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(C);let z=this.context.gl;this.stencilClearMode=new bt({func:z.ALWAYS,mask:0},0,255,z.ZERO,z.ZERO,z.ZERO),this.tileExtentMesh=new $t(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,o=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let h=l.O();l.c7(h,0,this.width,this.height,0,0,1),l.S(h,h,[o.drawingBufferWidth,o.drawingBufferHeight,0]);let p={mainMatrix:h,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:h};this.useProgram("clippingMask",null,!0).draw(t,o.TRIANGLES,ht.disabled,this.stencilClearMode,Xt.disabled,vt.disabled,null,null,p,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,o,h){if(this.currentStencilSource===t.source||!t.isTileClipped()||!o?.length)return;this.currentStencilSource=t.source,this.nextStencilID+o.length>256&&this.clearStencil();let p=this.context;p.setColorMode(Xt.disabled),p.setDepthMode(ht.disabled);let v={};for(let T of o)v[T.key]=this.nextStencilID++;this._renderTileMasks(v,o,h,!0),this._renderTileMasks(v,o,h,!1),this._tileClippingMaskIDs=v}_renderTileMasks(t,o,h,p){var v;let T=this.context,M=T.gl,C=this.style.projection,z=this.transform,P=this.useProgram("clippingMask");for(let k of o){let L=t[k.key],N=(v=this.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(k),G=C.getMeshFromTileID(this.context,k.canonical,p,!0,"stencil"),$=z.getProjectionData({overscaledTileID:k,applyGlobeMatrix:!h,applyTerrainMatrix:!0});P.draw(T,M.TRIANGLES,ht.disabled,new bt({func:M.ALWAYS,mask:0},L,255,M.KEEP,M.KEEP,M.REPLACE),Xt.disabled,h?vt.disabled:vt.backCCW,null,N,$,"$clipping",G.vertexBuffer,G.indexBuffer,G.segments)}}_renderTilesDepthBuffer(){var t;let o=this.context,h=o.gl,p=this.style.projection,v=this.transform,T=this.useProgram("depth"),M=this.getDepthModeFor3D(),C=zo(v,{tileSize:v.tileSize});for(let z of C){let P=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(z),k=p.getMeshFromTileID(this.context,z.canonical,!0,!0,"raster"),L=v.getProjectionData({overscaledTileID:z,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(o,h.TRIANGLES,M,bt.disabled,Xt.disabled,vt.backCCW,null,P,L,"$clipping",k.vertexBuffer,k.indexBuffer,k.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,o=this.context.gl;return new bt({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){let o=this.context.gl;return new bt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let o=this.context.gl,h=t.sort(((T,M)=>M.overscaledZ-T.overscaledZ)),p=h[h.length-1].overscaledZ,v=h[0].overscaledZ-p+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();let T={};for(let M=0;M<v;M++)T[M+p]=new bt({func:o.GEQUAL,mask:255},M+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=v,[T,h]}return[{[p]:bt.disabled},h]}stencilConfigForOverlapTwoPass(t){let o=this.context.gl,h=t.sort(((T,M)=>M.overscaledZ-T.overscaledZ)),p=h[h.length-1].overscaledZ,v=h[0].overscaledZ-p+1;if(this.clearStencil(),v>1){let T={},M={};for(let C=0;C<v;C++)T[C+p]=new bt({func:o.GREATER,mask:255},v+1+C,255,o.KEEP,o.KEEP,o.REPLACE),M[C+p]=new bt({func:o.GREATER,mask:255},1+C,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID=2*v+1,[T,M,h]}return this.nextStencilID=3,[{[p]:new bt({func:o.GREATER,mask:255},2,255,o.KEEP,o.KEEP,o.REPLACE)},{[p]:new bt({func:o.GREATER,mask:255},1,255,o.KEEP,o.KEEP,o.REPLACE)},h]}colorModeForRenderPass(){let t=this.context.gl;return this._showOverdrawInspector?new Xt([t.CONSTANT_COLOR,t.ONE],new l.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Xt.unblended:Xt.alphaBlended}getDepthModeForSublayer(t,o,h){if(!this.opaquePassEnabledForLayer())return ht.disabled;let p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ht(h||this.context.gl.LEQUAL,o,[p,p])}getDepthModeFor3D(){return new ht(this.context.gl.LEQUAL,ht.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,o){var h,p,v;this.style=t,this.options=o,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ce()),this.imageManager.beginFrame();let T=this.style._order,M=this.style.tileManagers,C={},z={},P={},k={isRenderingToTexture:!1,isRenderingGlobe:((h=t.projection)===null||h===void 0?void 0:h.transitionState)>0};for(let N in M){let G=M[N];G.used&&G.prepare(this.context),C[N]=G.getVisibleCoordinates(!1),z[N]=C[N].slice().reverse(),P[N]=G.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let N=0;N<T.length;N++)if(this.style._layers[T[N]].is3D()){this.opaquePassCutoff=N;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let N of T){let G=this.style._layers[N];if(!G.hasOffscreenPass()||G.isHidden(this.transform.zoom))continue;let $=z[G.source];(G.type==="custom"||$.length)&&this.renderLayer(this,M[G.source],G,$,k)}if((p=this.style.projection)===null||p===void 0||p.updateGPUdependent({context:this.context,useProgram:N=>this.useProgram(N)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:o.showOverdrawInspector?l.bo.black:l.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=o.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=T.length-1;this.currentLayer>=0;this.currentLayer--){let N=this.style._layers[T[this.currentLayer]],G=M[N.source],$=C[N.source];this._renderTileClippingMasks(N,$,!1),this.renderLayer(this,G,N,$,k)}this.renderPass="translucent";let L=!1;for(this.currentLayer=0;this.currentLayer<T.length;this.currentLayer++){let N=this.style._layers[T[this.currentLayer]],G=M[N.source];if(!((v=this.renderToTexture)===null||v===void 0)&&v.renderLayer(N,k))continue;this.opaquePassEnabledForLayer()||L||(L=!0,k.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let $=(N.type==="symbol"?P:z)[N.source];this._renderTileClippingMasks(N,C[N.source],!!this.renderToTexture),this.renderLayer(this,G,N,$,k)}if(k.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let N=(function(G,$){let J=null,W=Object.values(G._layers).flatMap((Q=>Q.source&&!Q.isHidden($)?[G.tileManagers[Q.source]]:[])),ee=W.filter((Q=>Q.getSource().type==="vector")),ae=W.filter((Q=>Q.getSource().type!=="vector")),te=Q=>{(!J||J.getSource().maxzoom<Q.getSource().maxzoom)&&(J=Q)};for(let Q of ee)te(Q);if(!J)for(let Q of ae)te(Q);return J})(this.style,this.transform.zoom);N&&this.drawFunctions.debug(this,N,N.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var o,h;if(!(!((h=(o=this.style)===null||o===void 0?void 0:o.map)===null||h===void 0)&&h.terrain))return;let p=this.terrainFacilitator.matrix,v=this.transform.modelViewProjectionMatrix,T=this.terrainFacilitator.depthDirty;T||(T=t?!l.cj(p,v):!l.ck(p,v)),T||(T=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),T&&(l.cl(p,v),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,o;!((o=(t=this.style)===null||t===void 0?void 0:t.map)===null||o===void 0)&&o.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,o,h,p,v){if(h.isHidden(this.transform.zoom)||h.type!=="background"&&h.type!=="custom"&&!(p||[]).length)return;this.id=h.id;let T=this.drawFunctions;l.aQ(h)?T.symbol(t,o,h,p,this.style.placement.variableOffsets,v):l.cm(h)?T.circle(t,o,h,p,v):l.cn(h)?T.heatmap(t,o,h,p,v):l.co(h)?T.line(t,o,h,p,v):l.cp(h)?T.fill(t,o,h,p,v):l.cq(h)?T.fillExtrusion(t,o,h,p,v):l.cr(h)?T.hillshade(t,o,h,p,v):l.cs(h)?T.colorRelief(t,o,h,p,v):l.bU(h)?T.raster(t,o,h,p,v):l.ct(h)?T.background(t,o,h,p,v):l.cu(h)&&T.custom(t,o,h,v)}saveTileTexture(t){let o=this._tileTextures[t.size[0]];o?o.length<nc.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?o.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let o=this._tileTextures[t];return o&&o.length>0?o.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let o=this.imageManager.getPattern(t.from.toString()),h=this.imageManager.getPattern(t.to.toString());return!o||!h}useProgram(t,o,h=!1,p=[]){var v;this.cache||(this.cache={});let T=!!this.style.map.terrain,M=this.style.projection,C=h?pi.projectionMercator:M.shaderPreludeCode,z=h?Nn:M.shaderDefine,P=t+(o?o.cacheKey:"")+`/${h?lr:M.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(T?"/terrain":"")+(p?`/${p.join("/")}`:"");return(v=this.cache)[P]||(v[P]=new p1(this.context,pi[t],o,_1[t],this._showOverdrawInspector,T,C,z,p)),this.cache[P]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,o;if(this._tileTextures){for(let h in this._tileTextures){let p=this._tileTextures[h];if(p)for(let v of p)v.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((o=this.tileExtentMesh.indexBuffer)===null||o===void 0||o.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let h in this.cache){let p=this.cache[h];p?.program&&this.context.gl.deleteProgram(p.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:o}=this.context.gl;return this.width!==t||this.height!==o}}function jd(g,t){let o,h=!1,p=null,v=()=>{p=null,h&&(g(...o),p=setTimeout(v,t),h=!1)};return(...T)=>(h=!0,o=T,p||v(),p)}nc.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class rc{constructor(t){this._getCurrentHash=()=>{let o=window.location.hash.replace("#","");if(this._hashName){let h,p=o.split("&").map((v=>v.split("=")));for(let v of p)v[0]===this._hashName&&(h=v);return(h&&h[1]||"").split("/")}return o.split("/")},this._onHashChange=()=>{let o=this._getCurrentHash();if(!this._isValidHash(o))return!1;let h=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(o[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:h,pitch:+(o[4]||0)}),!0},this._updateHashUnthrottled=()=>{let o=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,o)},this._removeHash=()=>{let o=this._getCurrentHash();if(o.length===0)return;let h=o.join("/"),p=h;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${h}`);let v=window.location.hash.replace(p,"");v.startsWith("#&")?v=v.slice(0,1)+v.slice(2):v==="#"&&(v="");let T=window.location.href.replace(/(#.+)?$/,v);T=T.replace("&&","&"),window.history.replaceState(window.history.state,null,T)},this._updateHash=jd(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let o=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,p=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,p),T=Math.round(o.lng*v)/v,M=Math.round(o.lat*v)/v,C=this._map.getBearing(),z=this._map.getPitch(),P="";if(P+=t?`/${T}/${M}/${h}`:`${h}/${M}/${T}`,(C||z)&&(P+="/"+Math.round(10*C)/10),z&&(P+=`/${Math.round(z)}`),this._hashName){let k=this._hashName,L=!1,N=window.location.hash.slice(1).split("&").map((G=>{let $=G.split("=")[0];return $===k?(L=!0,`${$}=${P}`):G})).filter((G=>G));return L||N.push(`${k}=${P}`),`#${N.join("&")}`}return`#${P}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new l.W(+t[2],+t[1])}catch{return!1}let o=+t[0],h=+(t[3]||0),p=+(t[4]||0);return o>=this._map.getMinZoom()&&o<=this._map.getMaxZoom()&&h>=-180&&h<=180&&p>=this._map.getMinPitch()&&p<=this._map.getMaxPitch()}}let $s={linearity:.3,easing:l.cv(0,0,.3,1)},Mr=l.e({deceleration:2500,maxSpeed:1400},$s),Hr=l.e({deceleration:20,maxSpeed:1400},$s),Em=l.e({deceleration:1e3,maxSpeed:360},$s),$r=l.e({deceleration:1e3,maxSpeed:90},$s),C1=l.e({deceleration:1e3,maxSpeed:360},$s);class A1{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ce(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,o=ce();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let o={zoom:0,bearing:0,pitch:0,roll:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:v}of this._inertiaBuffer)o.zoom+=v.zoomDelta||0,o.bearing+=v.bearingDelta||0,o.pitch+=v.pitchDelta||0,o.roll+=v.rollDelta||0,v.panDelta&&o.pan._add(v.panDelta),v.around&&(o.around=v.around),v.pinchAround&&(o.pinchAround=v.pinchAround);let h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(o.pan.mag()){let v=da(o.pan.mag(),h,l.e({},Mr,t||{})),T=o.pan.mult(v.amount/o.pan.mag()),M=this._map.cameraHelper.handlePanInertia(T,this._map.transform);p.center=M.easingCenter,p.offset=M.easingOffset,ac(p,v)}if(o.zoom){let v=da(o.zoom,h,Hr);p.zoom=l.cw(this._map.transform.zoom+v.amount,this._map.getZoomSnap(),v.amount),ac(p,v)}if(o.bearing){let v=da(o.bearing,h,Em);p.bearing=this._map.transform.bearing+l.al(v.amount,-179,179),ac(p,v)}if(o.pitch){let v=da(o.pitch,h,$r);p.pitch=this._map.transform.pitch+v.amount,ac(p,v)}if(o.roll){let v=da(o.roll,h,C1);p.roll=this._map.transform.roll+l.al(v.amount,-179,179),ac(p,v)}if(p.zoom||p.bearing){let v=o.pinchAround===void 0?o.around:o.pinchAround;p.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),l.e(p,{noMoveStart:!0})}}function ac(g,t){(!g.duration||g.duration<t.duration)&&(g.duration=t.duration,g.easing=t.easing)}function da(g,t,o){let{maxSpeed:h,linearity:p,deceleration:v}=o,T=l.al(g*p/(t/1e3),-h,h),M=Math.abs(T)/(v*p);return{easing:o.easing,duration:1e3*M,amount:T*(M/2)}}class hr extends l.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,h,p={}){h=h instanceof MouseEvent?h:new MouseEvent(t,h);let v=ve.mousePos(o.getCanvas(),h),T=o.unproject(v);super(t,l.e({point:v,lngLat:T,originalEvent:h},p)),this._defaultPrevented=!1,this.target=o}}class oc extends l.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,h){let p=t==="touchend"?h.changedTouches:h.touches,v=ve.touchPos(o.getCanvasContainer(),p),T=v.map((C=>o.unproject(C))),M=v.reduce(((C,z,P,k)=>C.add(z.div(k.length))),new l.P(0,0));super(t,{points:v,point:M,lngLats:T,lngLat:o.unproject(M),originalEvent:h}),this._defaultPrevented=!1}}class Cm extends l.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,h){super(t,{originalEvent:h}),this._defaultPrevented=!1}}class z1{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Cm(t.type,this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new hr(t.type,this._map,t))}mouseup(t){this._map.fire(new hr(t.type,this._map,t))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new hr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new hr(t.type,this._map,t))}mouseover(t){this._map.fire(new hr(t.type,this._map,t))}mouseout(t){this._map.fire(new hr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new oc(t.type,this._map,t))}touchmove(t){this._map.fire(new oc(t.type,this._map,t))}touchend(t){this._map.fire(new oc(t.type,this._map,t))}touchcancel(t){this._map.fire(new oc(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Am{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new hr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new hr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new hr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ra{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(l.P.convert(t),this._map.terrain)}}class pa{constructor(t,o){this._map=t,this._tr=new Ra(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1,o.boxZoom&&typeof o.boxZoom=="object"&&(this._boxZoomEnd=o.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(ve.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;let h=o;if(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)<this._clickTolerance)return;let p=this._startPos;this._lastPos=h,this._box||(this._box=ve.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let v=Math.min(p.x,h.x),T=Math.max(p.x,h.x),M=Math.min(p.y,h.y),C=Math.max(p.y,h.y);this._box.style.transform=`translate(${v}px,${M}px)`,this._box.style.width=T-v+"px",this._box.style.height=C-M+"px"}mouseupWindow(t,o){if(!this._active||t.button!==0)return;let h=this._startPos,p=o;if(this.reset(),ve.suppressClick(),h.x!==p.x||h.y!==p.y)return this._map.fire(new l.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,h,p,t):{cameraAnimation:v=>v.fitScreenCoordinates(h,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),ve.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new l.n(t,{originalEvent:o}))}}function Xe(g,t){if(g.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${g.length}, points ${t.length}`);let o={};for(let h=0;h<g.length;h++)o[g[h].identifier]=t[h];return o}class zm{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,o,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),h.length===this.numTouches&&(this.centroid=(function(p){let v=new l.P(0,0);for(let T of p)v._add(T);return v.div(p.length)})(o),this.touches=Xe(h,o)))}touchmove(t,o,h){if(this.aborted||!this.centroid)return;let p=Xe(h,o);for(let v in this.touches){let T=p[v];(!T||T.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(t,o,h){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){let p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class sc{constructor(t){this.singleTap=new zm(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,o,h){this.singleTap.touchstart(t,o,h)}touchmove(t,o,h){this.singleTap.touchmove(t,o,h)}touchend(t,o,h){let p=this.singleTap.touchend(t,o,h);if(p){let v=t.timeStamp-this.lastTime<500,T=!this.lastTap||this.lastTap.dist(p)<30;if(v&&T||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class Dm{constructor(t){this._tr=new Ra(t),this._zoomIn=new sc({numTouches:1,numTaps:2}),this._zoomOut=new sc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,h){this._zoomIn.touchstart(t,o,h),this._zoomOut.touchstart(t,o,h)}touchmove(t,o,h){this._zoomIn.touchmove(t,o,h),this._zoomOut.touchmove(t,o,h)}touchend(t,o,h){let p=this._zoomIn.touchend(t,o,h),v=this._zoomOut.touchend(t,o,h),T=this._tr;return p?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:l.cw(T.zoom+1,M.getZoomSnap()),around:T.unproject(p)},{originalEvent:t})}):v?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:l.cw(T.zoom-1,M.getZoomSnap()),around:T.unproject(v)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ia{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let o=this._moveFunction(...t);if(o.bearingDelta||o.pitchDelta||o.rollDelta||o.around||o.panDelta)return this._active=!0,o}dragStart(t,o){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(o)?o[0]:o,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,o){if(!this.isEnabled())return;let h=this._lastPoint;if(!h)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let p=Array.isArray(o)?o[0]:o;return!this._moved&&p.dist(h)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(h,p))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ve.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let lc=0,qd=2,D1={[lc]:1,[qd]:2};class $o{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(o,h){let p=D1[h];return o.buttons===void 0||(o.buttons&p)!==p})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class Pm{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Gd{constructor(t=new $o({checkCorrectEvent:()=>!0}),o=new Pm){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=o}_executeRelevantHandler(t,o,h){return t instanceof MouseEvent?o(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?h(t):void 0}startMove(t){this._executeRelevantHandler(t,(o=>{this.mouseMoveStateManager.startMove(o)}),(o=>{this.oneFingerTouchMoveStateManager.startMove(o)}))}endMove(t){this._executeRelevantHandler(t,(o=>{this.mouseMoveStateManager.endMove(o)}),(o=>{this.oneFingerTouchMoveStateManager.endMove(o)}))}isValidStartEvent(t){return this._executeRelevantHandler(t,(o=>this.mouseMoveStateManager.isValidStartEvent(o)),(o=>this.oneFingerTouchMoveStateManager.isValidStartEvent(o)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(o=>this.mouseMoveStateManager.isValidMoveEvent(o)),(o=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(o)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(o=>this.mouseMoveStateManager.isValidEndEvent(o)),(o=>this.oneFingerTouchMoveStateManager.isValidEndEvent(o)))}}let Mu=g=>{g.mousedown=g.dragStart,g.mousemoveWindow=g.dragMove,g.mouseup=g.dragEnd,g.contextmenu=t=>{t.preventDefault()}};class Rm{constructor(t,o){this._clickTolerance=t.clickTolerance||1,this._map=o,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,o,h){return this._calculateTransform(t,o,h)}touchmove(t,o,h){if(this._active){if(!this._shouldBePrevented(h.length))return t.preventDefault(),this._calculateTransform(t,o,h);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,o,h){this._calculateTransform(t,o,h),this._active&&this._shouldBePrevented(h.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,h){h.length>0&&(this._active=!0);let p=Xe(h,o),v=new l.P(0,0),T=new l.P(0,0),M=0;for(let z in p){let P=p[z],k=this._touches[z];k&&(v._add(P),T._add(P.sub(k)),M++,p[z]=P)}if(this._touches=p,this._shouldBePrevented(M)||!T.mag())return;let C=T.div(M);return this._sum._add(C),this._sum.mag()<this._clickTolerance?void 0:{around:v.div(M),panDelta:C}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zd{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,o,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,h){if(!this._firstTwoTouches)return;t.preventDefault();let[p,v]=this._firstTwoTouches,T=Eu(h,o,p),M=Eu(h,o,v);if(!T||!M)return;let C=this._aroundCenter?null:T.add(M).div(2);return this._move([T,M],C,t)}touchend(t,o,h){if(!this._firstTwoTouches)return;let[p,v]=this._firstTwoTouches,T=Eu(h,o,p),M=Eu(h,o,v);T&&M||(this._active&&ve.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Eu(g,t,o){for(let h=0;h<g.length;h++)if(g[h].identifier===o)return t[h]}function Hd(g,t){return Math.log(g/t)/Math.LN2}class Im extends Zd{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){let h=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Hd(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Hd(this._distance,h)*this._zoomRate,pinchAround:o}}}function $d(g,t){return 180*g.angleWith(t)/Math.PI}class km extends Zd{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o,h){let p=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$d(this._vector,p),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let o=25/(Math.PI*this._minDiameter)*360,h=$d(t,this._startVector);return Math.abs(h)<o}}function Xd(g){return Math.abs(g.y)>Math.abs(g.x)}class ka extends Zd{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,o,h){super.touchstart(t,o,h),this._currentTouchCount=h.length}_start(t){this._lastPoints=t,Xd(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,h){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let p=t[0].sub(this._lastPoints[0]),v=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,v,h.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(t,o,h){if(this._valid!==void 0)return this._valid;let p=t.mag()>=2,v=o.mag()>=2;if(!p&&!v)return;if(!p||!v)return this._firstMove===void 0&&(this._firstMove=h),h-this._firstMove<100&&void 0;let T=t.y>0==o.y>0;return Xd(t)&&Xd(o)&&T}}let Yt={panStep:100,bearingStep:15,pitchStep:10};class Lm{constructor(t){this._tr=new Ra(t);let o=Yt;this._panStep=o.panStep,this._bearingStep=o.bearingStep,this._pitchStep=o.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,h=0,p=0,v=0,T=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?h=-1:(t.preventDefault(),v=-1);break;case 39:t.shiftKey?h=1:(t.preventDefault(),v=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),T=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),T=1);break;default:return}return this._rotationDisabled&&(h=0,p=0),{cameraAnimation:M=>{let C=this._tr;M.easeTo({duration:300,easeId:"keyboardHandler",easing:Cu,zoom:o?l.cw(C.zoom+o*(t.shiftKey?2:1),M.getZoomSnap()):C.zoom,bearing:C.bearing+h*this._bearingStep,pitch:C.pitch+p*this._pitchStep,offset:[-v*this._panStep,-T*this._panStep],center:C.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Cu(g){return g*(2-g)}let cc=4.000244140625,Yd=1/450;class Wd{constructor(t,o){this._onTimeout=h=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(h)},this._map=t,this._tr=new Ra(t),this._triggerRenderFrame=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Yd}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,h=ce(),p=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,o!==0&&o%cc==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let o=ve.mousePos(this._map.getCanvas(),t),h=this._tr;this._aroundPoint=this._aroundCenter?h.transform.locationToScreenPoint(l.W.convert(h.center)):o,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let M=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=M),typeof this._targetZoom=="number"&&(this._targetZoom+=M)}if(this._delta!==0){let M=this._type==="wheel"&&Math.abs(this._delta)>cc?this._wheelZoomRate:this._defaultZoomRate,C=2/(1+Math.exp(-Math.abs(this._delta*M)));this._delta<0&&C!==0&&(C=1/C);let z=typeof this._targetZoom!="number"?t.scale:l.ao(this._targetZoom),P=t.applyConstrain(t.getCameraLngLat(),l.ar(z*C)).zoom,k=this._map.getZoomSnap();if(this._type==="wheel"&&k>0){let L=l.cw(t.zoom,k);this._targetZoom=l.cw(P,k,P-L)}else this._targetZoom=P;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let o=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,h=this._startZoom,p=this._easing,v,T=!1;if(this._type==="wheel"&&h&&p){let M=ce()-this._lastWheelEventTime,C=Math.min((M+5)/200,1),z=p(C);v=l.H.number(h,o,z),C<1?this._needsRerender=!0:T=!0}else v=o,T=!0;return this._active=!0,T&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=v,{noInertia:!0,needsRenderFrame:!T,zoomDelta:v-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=l.cy;if(this._prevEase){let h=this._prevEase,p=(ce()-h.start)/h.duration,v=h.easing(p+.01)-h.easing(p),T=.27/Math.sqrt(v*v+1e-4)*.01,M=Math.sqrt(.0729-T*T);o=l.cv(T,M,.25,1)}return this._prevEase={start:ce(),duration:t,easing:o},o}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Kd{constructor(t,o){this._clickZoom=t,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Om{constructor(t){this._tr=new Ra(t),this.reset()}reset(){this._active=!1}dblclick(t,o){return t.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:l.cw(this._tr.zoom+(t.shiftKey?-1:1),h.getZoomSnap()),around:this._tr.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class P1{constructor(){this._tap=new sc({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,o,h){if(!this._swipePoint)if(this._tapTime){let p=o[0],v=t.timeStamp-this._tapTime<500,T=this._tapPoint.dist(p)<30;v&&T?h.length>0&&(this._swipePoint=p,this._swipeTouch=h[0].identifier):this.reset()}else this._tap.touchstart(t,o,h)}touchmove(t,o,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;let p=o[0],v=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:v/128*this._zoomRate}}}else this._tap.touchmove(t,o,h)}touchend(t,o,h){if(this._tapTime)this._swipePoint&&h.length===0&&this.reset();else{let p=this._tap.touchend(t,o,h);p&&(this._tapTime=t.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xr{constructor(t,o,h){this._el=t,this._mousePan=o,this._touchPan=h}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class uc{constructor(t,o,h,p){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=o,this._mousePitch=h,this._mouseRoll=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Je{constructor(t,o,h,p){this._el=t,this._touchZoom=o,this._touchRotate=h,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class nt{constructor(t,o){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=o,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ve.create("div","maplibregl-cooperative-gesture-screen",t);let o=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(o=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let h=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=o,this._container.appendChild(p);let v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=h,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,o){this._enabled&&(this._map.fire(new l.n("cooperativegestureprevented",{gestureType:t,originalEvent:o})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}let ro=g=>g.zoom||g.drag||g.roll||g.pitch||g.rotate;class Bm extends l.n{}function Xs(g){var t;return((t=g.panDelta)===null||t===void 0?void 0:t.mag())||g.zoomDelta||g.bearingDelta||g.pitchDelta||g.rollDelta}class Vn{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,o;return((o=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||o===void 0?void 0:o.defaultView)||window}constructor(t,o){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,v)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let T=p.type==="renderFrame"?void 0:p,M={needsRenderFrame:!1},C={},z={};for(let{handlerName:L,handler:N,allowed:G}of this._handlers){if(!N.isEnabled())continue;let $;if(this._blockedByActive(z,G,L))N.reset();else if(N[v||p.type]){if(l.cz(p,v||p.type)){let J=ve.mousePos(this._map.getCanvas(),p);$=N[v||p.type](p,J)}else if(l.cA(p,v||p.type)){let J=this._getMapTouches(p.touches),W=ve.touchPos(this._map.getCanvas(),J);$=N[v||p.type](p,W,J)}else l.cB(v||p.type)||($=N[v||p.type](p));this.mergeHandlerResult(M,C,$,L,T),$?.needsRenderFrame&&this._triggerRenderFrame()}($||N.isActive())&&(z[L]=N)}let P={};for(let L in this._previousActiveHandlers)z[L]||(P[L]=T);this._previousActiveHandlers=z,(Object.keys(P).length||Xs(M))&&(this._changes.push([M,C,P]),this._triggerRenderFrame()),(Object.keys(z).length||Xs(M))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:k}=M;k&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],k(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new A1(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o);let h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[p,v,T]of this._listeners)p.addEventListener(v,p===this._ownerDocument?this.handleWindowEvent:this.handleEvent,T)}destroy(){for(let[t,o,h]of this._listeners)t.removeEventListener(o,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,h)}_addDefaultHandlers(t){let o=this._map,h=o.getCanvasContainer();this._add("mapEvent",new z1(o,t));let p=o.boxZoom=new pa(o,t);this._add("boxZoom",p),t.interactive&&t.boxZoom&&p.enable();let v=o.cooperativeGestures=new nt(o,t.cooperativeGestures);this._add("cooperativeGestures",v),t.cooperativeGestures&&v.enable();let T=new Dm(o),M=new Om(o);o.doubleClickZoom=new Kd(M,T),this._add("tapZoom",T),this._add("clickZoom",M),t.interactive&&t.doubleClickZoom&&o.doubleClickZoom.enable();let C=new P1;this._add("tapDragZoom",C);let z=o.touchPitch=new ka(o);this._add("touchPitch",z),t.interactive&&t.touchPitch&&o.touchPitch.enable(t.touchPitch);let P=()=>o.project(o.getCenter()),k=(function({enable:te,clickTolerance:Q,aroundCenter:re=!0,minPixelCenterThreshold:ie=100,rotateDegreesPerPixelMoved:me=.8},Te){let Se=new $o({checkCorrectEvent:Pe=>Pe.button===0&&Pe.ctrlKey||Pe.button===2&&!Pe.ctrlKey});return new Ia({clickTolerance:Q,move:(Pe,De)=>{let Qe=Te();if(re&&Math.abs(Qe.y-Pe.y)>ie)return{bearingDelta:l.cx(new l.P(Pe.x,De.y),De,Qe)};let je=(De.x-Pe.x)*me;return re&&De.y<Qe.y&&(je=-je),{bearingDelta:je}},moveStateManager:Se,enable:te,assignEvents:Mu})})(t,P),L=(function({enable:te,clickTolerance:Q,pitchDegreesPerPixelMoved:re=-.5}){let ie=new $o({checkCorrectEvent:me=>me.button===0&&me.ctrlKey||me.button===2});return new Ia({clickTolerance:Q,move:(me,Te)=>({pitchDelta:(Te.y-me.y)*re}),moveStateManager:ie,enable:te,assignEvents:Mu})})(t),N=(function({enable:te,clickTolerance:Q,rollDegreesPerPixelMoved:re=.3},ie){let me=new $o({checkCorrectEvent:Te=>Te.button===2&&Te.ctrlKey});return new Ia({clickTolerance:Q,move:(Te,Se)=>{let Pe=ie(),De=(Se.x-Te.x)*re;return Se.y<Pe.y&&(De=-De),{rollDelta:De}},moveStateManager:me,enable:te,assignEvents:Mu})})(t,P);o.dragRotate=new uc(t,k,L,N),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",L,["mouseRotate","mouseRoll"]),this._add("mouseRoll",N,["mousePitch"]),t.interactive&&t.dragRotate&&o.dragRotate.enable();let G=(function({enable:te,clickTolerance:Q}){let re=new $o({checkCorrectEvent:ie=>ie.button===0&&!ie.ctrlKey});return new Ia({clickTolerance:Q,move:(ie,me)=>({around:me,panDelta:me.sub(ie)}),activateOnStart:!0,moveStateManager:re,enable:te,assignEvents:Mu})})(t),$=new Rm(t,o);o.dragPan=new Xr(h,G,$),this._add("mousePan",G),this._add("touchPan",$,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&o.dragPan.enable(t.dragPan);let J=new km,W=new Im;o.touchZoomRotate=new Je(h,W,J,C),this._add("touchRotate",J,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&o.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new Am(o));let ee=o.scrollZoom=new Wd(o,(()=>this._triggerRenderFrame()));this._add("scrollZoom",ee,["mousePan"]),t.interactive&&t.scrollZoom&&o.scrollZoom.enable(t.scrollZoom);let ae=o.keyboard=new Lm(o);this._add("keyboard",ae),t.interactive&&t.keyboard&&o.keyboard.enable()}_add(t,o,h){this._handlers.push({handlerName:t,handler:o,allowed:h}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(let{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ro(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,o,h){for(let p in t)if(p!==h&&!o?.includes(p))return!0;return!1}_getMapTouches(t){let o=[];for(let h of t)this._el.contains(h.target)&&o.push(h);return o}mergeHandlerResult(t,o,h,p,v){if(!h)return;l.e(t,h);let T={handlerName:p,originalEvent:h.originalEvent||v};h.zoomDelta!==void 0&&(o.zoom=T),h.panDelta!==void 0&&(o.drag=T),h.rollDelta!==void 0&&(o.roll=T),h.pitchDelta!==void 0&&(o.pitch=T),h.bearingDelta!==void 0&&(o.rotate=T)}_applyChanges(){let t={},o={},h={};for(let[p,v,T]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new l.P(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.rollDelta&&(t.rollDelta=(t.rollDelta||0)+p.rollDelta),p.around!==void 0&&(t.around=p.around),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),l.e(o,v),l.e(h,T);this._updateMapTransform(t,o,h),this._changes=[]}_updateMapTransform(t,o,h){let p=this._map,v=p._getTransformForUpdate(),T=p.terrain;if(!(Xs(t)||T&&this._terrainMovement))return void this._fireEvents(o,h,!0);p._stop(!0);let{panDelta:M,zoomDelta:C,bearingDelta:z,pitchDelta:P,rollDelta:k,around:L,pinchAround:N}=t;N!==void 0&&(L=N),L||(L=p.transform.centerPoint),T&&!v.isPointOnMapSurface(L)&&(L=v.centerPoint);let G={panDelta:M,zoomDelta:C,rollDelta:k,pitchDelta:P,bearingDelta:z,around:L};this._map.cameraHelper.useGlobeControls&&!v.isPointOnMapSurface(L)&&(L=v.centerPoint);let $=L.distSqr(v.centerPoint)<.01?v.center:v.screenPointToLocation(M?L.sub(M):L);this._handleMapControls({terrain:T,tr:v,deltasForHelper:G,preZoomAroundLoc:$,combinedEventsInProgress:o,panDelta:M}),p._applyUpdatedTransform(v),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,h,!0)}_handleMapControls({terrain:t,tr:o,deltasForHelper:h,preZoomAroundLoc:p,combinedEventsInProgress:v,panDelta:T}){let M=this._map.cameraHelper;if(M.handleMapControlsRollPitchBearingZoom(h,o),t)return M.useGlobeControls?(this._terrainMovement||!v.drag&&!v.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void M.handleMapControlsPan(h,o,p)):this._terrainMovement||!v.drag&&!v.zoom?void(v.drag&&this._terrainMovement&&T?o.setCenter(o.screenPointToLocation(o.centerPoint.sub(T))):M.handleMapControlsPan(h,o,p)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void M.handleMapControlsPan(h,o,p));M.handleMapControlsPan(h,o,p)}_fireEvents(t,o,h){let p=ro(this._eventsInProgress),v=ro(t),T={};for(let k in t){let{originalEvent:L}=t[k];this._eventsInProgress[k]||(T[`${k}start`]=L),this._eventsInProgress[k]=t[k]}!p&&v&&this._fireEvent("movestart",v.originalEvent);for(let k in T)this._fireEvent(k,T[k]);v&&this._fireEvent("move",v.originalEvent);for(let k in t){let{originalEvent:L}=t[k];this._fireEvent(k,L)}let M={},C;for(let k in this._eventsInProgress){let{handlerName:L,originalEvent:N}=this._eventsInProgress[k];this._handlersById[L].isActive()||(delete this._eventsInProgress[k],C=o[L]||N,M[`${k}end`]=C)}for(let k in M)this._fireEvent(k,M[k]);let z=ro(this._eventsInProgress),P=(p||v)&&!z;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let k=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&k.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(k)}if(h&&P){this._updatingCamera=!0;let k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=N=>N!==0&&-this._bearingSnap<N&&N<this._bearingSnap;!k||!k.essential&&de.prefersReducedMotion?(this._map.fire(new l.n("moveend",{originalEvent:C})),L(this._map.getBearing())&&this._map.resetNorth()):(L(k.bearing||this._map.getBearing())&&(k.bearing=0),k.freezeElevation=!0,this._map.easeTo(k,{originalEvent:C})),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new l.n(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Bm("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Fm extends l.E{constructor(t,o,h){super(),this._renderFrameCallback=()=>{let p=Math.min((ce()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=h.bearingSnap,this._zoomSnap=h.zoomSnap,this.cameraHelper=o,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,o){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=o}getCenter(){return new l.W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,o){return this.jumpTo({elevation:t},o),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,o,h){return t=l.P.convert(t).mult(-1),this.panTo(this.transform.center,l.e({offset:t},o),h)}panTo(t,o,h){return this.easeTo(l.e({center:t},o),h)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,h){return this.easeTo(l.e({zoom:t},o),h)}zoomIn(t,o){return this.zoomTo(l.cw(this.getZoom()+1,this._zoomSnap),t,o),this}zoomOut(t,o){return this.zoomTo(l.cw(this.getZoom()-1,this._zoomSnap),t,o),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,o){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new l.n("movestart",o)).fire(new l.n("move",o)).fire(new l.n("moveend",o))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,h){return this.easeTo(l.e({bearing:t},o),h)}resetNorth(t,o){return this.rotateTo(0,l.e({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(l.e({bearing:0,pitch:0,roll:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}getRoll(){return this.transform.roll}setRoll(t,o){return this.jumpTo({roll:t},o),this}cameraForBounds(t,o){t=tt.convert(t).adjustAntiMeridian();let h=o?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),h,o)}_cameraForBoxAndBearing(t,o,h,p){let v={top:0,bottom:0,right:0,left:0};if(typeof(p=l.e({padding:v,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){let P=p.padding;p.padding={top:P,bottom:P,right:P,left:P}}let T=l.e(v,p.padding);p.padding=T;let M=this.transform,C=new tt(t,o),z=this.cameraHelper.cameraForBoxAndBearing(p,T,C,h,M);return z&&this._zoomSnap&&(z.zoom=l.cw(z.zoom,this._zoomSnap,-1)),z}fitBounds(t,o,h){return this._fitInternal(this.cameraForBounds(t,o),o,h)}fitScreenCoordinates(t,o,h,p,v){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(l.P.convert(t)),this.transform.screenPointToLocation(l.P.convert(o)),h,p),p,v)}_fitInternal(t,o,h){return t?(delete(o=l.e(t,o)).padding,o.linear?this.easeTo(o,h):this.flyTo(o,h)):this}jumpTo(t,o){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=l.cw(t.zoom,this._zoomSnap));let h=this._getTransformForUpdate(),p=!1,v=!1,T=!1,M=h.zoom;this.terrain&&h.setElevation(this.terrain.getElevationForLngLatZoom(t.center?l.W.convert(t.center):h.center,t.zoom||h.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(h,t);let C=h.zoom!==M;return"elevation"in t&&h.elevation!==+t.elevation&&h.setElevation(+t.elevation),"bearing"in t&&h.bearing!==+t.bearing&&(p=!0,h.setBearing(+t.bearing)),"pitch"in t&&h.pitch!==+t.pitch&&(v=!0,h.setPitch(+t.pitch)),"roll"in t&&h.roll!==+t.roll&&(T=!0,h.setRoll(+t.roll)),t.padding==null||h.isPaddingEqual(t.padding)||h.setPadding(t.padding),this._applyUpdatedTransform(h),this.fire(new l.n("movestart",o)).fire(new l.n("move",o)),C&&this.fire(new l.n("zoomstart",o)).fire(new l.n("zoom",o)).fire(new l.n("zoomend",o)),p&&this.fire(new l.n("rotatestart",o)).fire(new l.n("rotate",o)).fire(new l.n("rotateend",o)),v&&this.fire(new l.n("pitchstart",o)).fire(new l.n("pitch",o)).fire(new l.n("pitchend",o)),T&&this.fire(new l.n("rollstart",o)).fire(new l.n("roll",o)).fire(new l.n("rollend",o)),this.fire(new l.n("moveend",o))}calculateCameraOptionsFromTo(t,o,h,p=0){let v=l.a7.fromLngLat(t,o),T=l.a7.fromLngLat(h,p),M=T.x-v.x,C=T.y-v.y,z=T.z-v.z,P=Math.hypot(M,C,z);if(P===0)throw new Error("Can't calculate camera options with same From and To");let k=Math.hypot(M,C),L=l.ar(this.transform.cameraToCenterDistance/P/this.transform.tileSize),N=180*Math.atan2(M,-C)/Math.PI,G=180*Math.acos(k/P)/Math.PI;return G=z<0?90-G:90+G,{center:T.toLngLat(),elevation:p,zoom:L,pitch:G,bearing:N}}calculateCameraOptionsFromCameraLngLatAltRotation(t,o,h,p,v){let T=this.transform.calculateCenterFromCameraLngLatAlt(t,o,h,p);return{center:T.center,elevation:T.elevation,zoom:T.zoom,bearing:h,pitch:p,roll:v}}easeTo(t,o){this._stop(!1,t.easeId),"zoom"in(t=l.e({offset:[0,0],duration:500,easing:l.cy},t))&&this._zoomSnap&&(t.zoom=l.cw(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&de.prefersReducedMotion)&&(t.duration=0);let h=this._getTransformForUpdate(),p=this.getBearing(),v=h.pitch,T=h.roll,M="bearing"in t?this._normalizeBearing(t.bearing,p):p,C="pitch"in t?+t.pitch:v,z="roll"in t?this._normalizeBearing(t.roll,T):T,P="padding"in t?t.padding:h.padding,k=l.P.convert(t.offset),L,N;t.around&&(L=l.W.convert(t.around),N=h.locationToScreenPoint(L));let G={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},$=this.cameraHelper.handleEaseTo(h,{bearing:M,pitch:C,roll:z,padding:P,around:L,aroundPoint:N,offsetAsPoint:k,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=p!==M),this._pitching||(this._pitching=C!==v),this._rolling||(this._rolling=z!==T),this._padding=!h.isPaddingEqual(P),this._zooming||(this._zooming=$.isZooming),this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,G),this.terrain&&this._prepareElevation($.elevationCenter),this._ease((J=>{$.easeFunc(J),this.terrain&&!t.freezeElevation&&this._updateElevation(J),this._applyUpdatedTransform(h),this._fireMoveEvents(o)}),(J=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(o,J)}),t),this}_prepareEase(t,o,h={}){this._moving=!0,o||h.moving||this.fire(new l.n("movestart",t)),this._zooming&&!h.zooming&&this.fire(new l.n("zoomstart",t)),this._rotating&&!h.rotating&&this.fire(new l.n("rotatestart",t)),this._pitching&&!h.pitching&&this.fire(new l.n("pitchstart",t)),this._rolling&&!h.rolling&&this.fire(new l.n("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let o=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&o!==this._elevationTarget){let h=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(h-(o-(h*t+this._elevationStart))/(1-t)),this._elevationTarget=o}this.transform.setElevation(l.H.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let o=t.getCameraLngLat(),h=t.getCameraAltitude(),p=this.terrain?this.terrain.getElevationForLngLatZoom(o,t.zoom):0;if(h<p){let v=this.calculateCameraOptionsFromTo(o,p,t.center,t.elevation);return{pitch:v.pitch,zoom:v.zoom}}return{}}_applyUpdatedTransform(t){let o=[];if(o.push((p=>this._elevateCameraIfInsideTerrain(p))),this.transformCameraUpdate&&o.push((p=>this.transformCameraUpdate(p))),!o.length)return;let h=t.clone();for(let p of o){let v=h.clone(),{center:T,zoom:M,roll:C,pitch:z,bearing:P,elevation:k}=p(v);T&&v.setCenter(T),k!==void 0&&v.setElevation(k),M!==void 0&&v.setZoom(M),C!==void 0&&v.setRoll(C),z!==void 0&&v.setPitch(z),P!==void 0&&v.setBearing(P),h.apply(v,!1)}this.transform.apply(h,!1)}_fireMoveEvents(t){this.fire(new l.n("move",t)),this._zooming&&this.fire(new l.n("zoom",t)),this._rotating&&this.fire(new l.n("rotate",t)),this._pitching&&this.fire(new l.n("pitch",t)),this._rolling&&this.fire(new l.n("roll",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;let h=this._zooming,p=this._rotating,v=this._pitching,T=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,h&&this.fire(new l.n("zoomend",t)),p&&this.fire(new l.n("rotateend",t)),v&&this.fire(new l.n("pitchend",t)),T&&this.fire(new l.n("rollend",t)),this.fire(new l.n("moveend",t))}flyTo(t,o){if(!t.essential&&de.prefersReducedMotion){let De=l.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(De,o)}this.stop(),"zoom"in(t=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.cy},t))&&this._zoomSnap&&(t.zoom=l.cw(t.zoom,this._zoomSnap));let h=this._getTransformForUpdate(),p=h.bearing,v=h.pitch,T=h.roll,M=h.padding,C="bearing"in t?this._normalizeBearing(t.bearing,p):p,z="pitch"in t?+t.pitch:v,P="roll"in t?this._normalizeBearing(t.roll,T):T,k="padding"in t?t.padding:h.padding,L=l.P.convert(t.offset),N=h.centerPoint.add(L),G=h.screenPointToLocation(N),$=this.cameraHelper.handleFlyTo(h,{bearing:C,pitch:z,roll:P,padding:k,locationAtOffset:G,offsetAsPoint:L,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),J=t.curve,W=Math.max(h.width,h.height),ee=W/$.scaleOfZoom,ae=$.pixelPathLength;typeof $.scaleOfMinZoom=="number"&&(J=Math.sqrt(W/$.scaleOfMinZoom/ae*2));let te=J*J;function Q(De){let Qe=(ee*ee-W*W+(De?-1:1)*te*te*ae*ae)/(2*(De?ee:W)*te*ae);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function re(De){return(Math.exp(De)-Math.exp(-De))/2}function ie(De){return(Math.exp(De)+Math.exp(-De))/2}let me=Q(!1),Te=function(De){return ie(me)/ie(me+J*De)},Se=function(De){return W*((ie(me)*(re(Qe=me+J*De)/ie(Qe))-re(me))/te)/ae;var Qe},Pe=(Q(!0)-me)/J;if(Math.abs(ae)<2e-6||!isFinite(Pe)){if(Math.abs(W-ee)<1e-6)return this.easeTo(t,o);let De=ee<W?-1:1;Pe=Math.abs(Math.log(ee/W))/J,Se=()=>0,Te=Qe=>Math.exp(De*J*Qe)}return t.duration="duration"in t?+t.duration:1e3*Pe/("screenSpeed"in t?+t.screenSpeed/J:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==C,this._pitching=z!==v,this._rolling=P!==T,this._padding=!h.isPaddingEqual(k),this._prepareEase(o,!1),this.terrain&&this._prepareElevation($.targetCenter),this._ease((De=>{let Qe=De*Pe,je=1/Te(Qe),Ae=Se(Qe);this._rotating&&h.setBearing(l.H.number(p,C,De)),this._pitching&&h.setPitch(l.H.number(v,z,De)),this._rolling&&h.setRoll(l.H.number(T,P,De)),this._padding&&(h.interpolatePadding(M,k,De),N=h.centerPoint.add(L)),$.easeFunc(De,je,Ae,N),this.terrain&&!t.freezeElevation&&this._updateElevation(De),this._applyUpdatedTransform(h),this._fireMoveEvents(o)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(o)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,o){var h;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,o)}return t||(h=this.handlers)===null||h===void 0||h.stop(!1),this}_ease(t,o,h){h.animate===!1||h.duration===0?(t(1),o()):(this._easeStart=ce(),this._easeOptions=h,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,o){t=l.X(t,-180,180);let h=Math.abs(t-o);return Math.abs(t-360-o)<h&&(t-=360),Math.abs(t+360-o)<h&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(l.W.convert(t),this.transform):null}}let Au={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Er{constructor(t=Au){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=o=>{!o||o.sourceDataType!=="metadata"&&o.sourceDataType!=="visibility"&&o.dataType!=="style"&&o.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=ve.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ve.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ve.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,o){let h=this._map._getUIString(`AttributionControl.${o}`);t.title=h,t.setAttribute("aria-label",h)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((p=>typeof p!="string"?"":p))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}let o=this._map.style.tileManagers;for(let p in o){let v=o[p];if(v.used||v.usedForTerrain){let T=v.getSource();T.attribution&&!t.includes(T.attribution)&&t.push(T.attribution)}}t=t.filter((p=>String(p).trim())),t.sort(((p,v)=>p.length-v.length)),t=t.filter(((p,v)=>{for(let T=v+1;T<t.length;T++)if(t[T].includes(p))return!1;return!0}));let h=t.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,t.length?(this._innerContainer.innerHTML=ve.sanitize(h),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qd{constructor(t={}){this._updateCompact=()=>{let o=this._container.children;if(o.length){let h=o[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&h.classList.add("maplibregl-compact"):h.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var o;this._map=t,this._compact=(o=this.options)===null||o===void 0?void 0:o.compact,this._container=ve.create("div","maplibregl-ctrl");let h=ve.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class R1{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){let o=this._currentlyRunning,h=o?this._queue.concat(o):this._queue;for(let p of h)if(p.id===t)return void(p.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let o=this._currentlyRunning=this._queue;this._queue=[];for(let h of o)if(!h.cancelled&&(h.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var I1=l.aS([{name:"a_pos3d",type:"Int16",components:3}]);class k1 extends l.E{constructor(t){super(),this._lastTilesetChange=ce(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,o){this.tileManager.update(t,o),this._renderableTilesKeys=[];let h={};for(let p of zo(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:o,calculateTileZoom:this.tileManager._source.calculateTileZoom}))h[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.terrainRttPosMatrix32f=new Float64Array(16),l.c7(p.terrainRttPosMatrix32f,0,l.a6,l.a6,0,0,1),this._tiles[p.key]=new Lt(p,this.tileSize),this._lastTilesetChange=ce());for(let p in this._tiles)h[p]||delete this._tiles[p]}freeRtt(t){for(let o in this._tiles){let h=this._tiles[o];(!t||h.tileID.equals(t)||h.tileID.isChildOf(t)||t.isChildOf(h.tileID))&&(h.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,o){return o?this._getTerrainCoordsForTileRanges(t,o):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let o={};for(let h of this._renderableTilesKeys){let p=this._tiles[h].tileID,v=t.clone(),T=l.bj();if(p.canonical.equals(t.canonical))l.c7(T,0,l.a6,l.a6,0,0,1);else if(p.canonical.isChildOf(t.canonical)){let M=p.canonical.z-t.canonical.z,C=p.canonical.x-(p.canonical.x>>M<<M),z=p.canonical.y-(p.canonical.y>>M<<M),P=l.a6>>M;l.c7(T,0,P,P,0,0,1),l.Q(T,T,[-C*P,-z*P,0])}else{if(!t.canonical.isChildOf(p.canonical))continue;{let M=t.canonical.z-p.canonical.z,C=t.canonical.x-(t.canonical.x>>M<<M),z=t.canonical.y-(t.canonical.y>>M<<M),P=l.a6>>M;l.c7(T,0,l.a6,l.a6,0,0,1),l.Q(T,T,[C*P,z*P,0]),l.S(T,T,[1/2**M,1/2**M,0])}}v.terrainRttPosMatrix32f=new Float32Array(T),o[h]=v}return o}_getTerrainCoordsForTileRanges(t,o){let h={};for(let p of this._renderableTilesKeys){let v=this._tiles[p].tileID;if(!this._isWithinTileRanges(v,o))continue;let T=t.clone(),M=l.bj();if(v.canonical.z===t.canonical.z){let C=t.canonical.x-v.canonical.x+t.wrap*(1<<t.canonical.z),z=t.canonical.y-v.canonical.y;l.c7(M,0,l.a6,l.a6,0,0,1),l.Q(M,M,[C*l.a6,z*l.a6,0])}else if(v.canonical.z>t.canonical.z){let C=v.canonical.z-t.canonical.z,z=v.canonical.x-(v.canonical.x>>C<<C)+t.wrap*(1<<v.canonical.z),P=v.canonical.y-(v.canonical.y>>C<<C),k=t.canonical.x-(v.canonical.x>>C),L=t.canonical.y-(v.canonical.y>>C),N=l.a6>>C;l.c7(M,0,N,N,0,0,1),l.Q(M,M,[-z*N+k*l.a6,-P*N+L*l.a6,0])}else{let C=t.canonical.z-v.canonical.z,z=t.canonical.x-(t.canonical.x>>C<<C)+t.wrap*(1<<t.canonical.z),P=t.canonical.y-(t.canonical.y>>C<<C),k=(t.canonical.x>>C)-v.canonical.x,L=(t.canonical.y>>C)-v.canonical.y,N=l.a6<<C;l.c7(M,0,N,N,0,0,1),l.Q(M,M,[z*l.a6+k*N,P*l.a6+L*N,0])}T.terrainRttPosMatrix32f=new Float32Array(M),h[p]=T}return h}getSourceTile(t,o){var h,p;let v=this.tileManager._source,T=t.overscaledZ-this.deltaZoom;if(T>v.maxzoom&&(T=v.maxzoom),T<v.minzoom)return;(h=this._sourceTileCache)[p=t.key]||(h[p]=t.scaledTo(T).key);let M=this.findTileInCaches(this._sourceTileCache[t.key]);if(!M?.dem&&o)for(;T>=v.minzoom&&!M?.dem;)M=this.findTileInCaches(t.scaledTo(T--).key);return M}findTileInCaches(t){let o=this.tileManager.getTileByID(t);return o||(o=this.tileManager._outOfViewCache.getByKey(t),o)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,o){let h=o[t.canonical.z];return!!h&&(t.wrap>h.minWrap||t.wrap<h.maxWrap||t.canonical.x>=h.minTileXWrapped&&t.canonical.x<=h.maxTileXWrapped&&t.canonical.y>=h.minTileY&&t.canonical.y<=h.maxTileY)}}class hc{constructor(t,o,h){this._meshCache={},this.painter=t,this.tileManager=new k1(o),this.options=h,this.exaggeration=typeof h.exaggeration=="number"?h.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(let t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,o,h,p=l.a6){var v;let T=t.normalizeCoordinates(o,h,p);if(!T)return 0;let M=this.getTerrainData(T.tileID),C=(v=M.tile)===null||v===void 0?void 0:v.dem;if(!C)return 0;let z=l.cC([],[T.x/p*l.a6,T.y/p*l.a6],M.u_terrain_matrix),P=[z[0]*C.dim,z[1]*C.dim],k=Math.floor(P[0]),L=Math.floor(P[1]),N=P[0]-k,G=P[1]-L;return C.get(k,L)*(1-N)*(1-G)+C.get(k+1,L)*N*(1-G)+C.get(k,L+1)*(1-N)*G+C.get(k+1,L+1)*N*G}getElevationForLngLatZoom(t,o){if(!l.cD(o,t.wrap()))return 0;let{tileID:h,mercatorX:p,mercatorY:v}=this._getOverscaledTileIDFromLngLatZoom(t,o);return this.getElevation(h,p%l.a6,v%l.a6,l.a6)}getElevationForLngLat(t,o){let h=zo(o,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),p=0;for(let v of h)v.canonical.z>p&&(p=Math.min(v.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,p)}getElevation(t,o,h,p=l.a6){return this.getDEMElevation(t,o,h,p)*this.exaggeration}getTerrainData(t){var o,h;if(!this._emptyDemTexture){let T=this.painter.context,M=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new l.T(T,M,T.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new l.T(T,new l.R({width:1,height:1}),T.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(T.gl.NEAREST,T.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.ap([])}let p=this.tileManager.getSourceTile(t,!0);if(p?.dem&&(!p.demTexture||p.needsTerrainPrepare)){let T=this.painter.context;p.demTexture=this.painter.getTileTexture(p.dem.stride),p.demTexture?p.demTexture.update(p.dem.getPixels(),{premultiply:!1}):p.demTexture=new l.T(T,p.dem.getPixels(),T.gl.RGBA,{premultiply:!1}),p.demTexture.bind(T.gl.NEAREST,T.gl.CLAMP_TO_EDGE),p.needsTerrainPrepare=!1}let v=p&&p.toString()+p.tileID.key+t.key;if(v&&!this._demMatrixCache[v]){let T=this.tileManager.getSource().maxzoom,M=t.canonical.z-p.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=T?M=t.canonical.z-T:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let C=t.canonical.x-(t.canonical.x>>M<<M),z=t.canonical.y-(t.canonical.y>>M<<M),P=l.cE(new Float64Array(16),[1/(l.a6<<M),1/(l.a6<<M),0]);l.Q(P,P,[C*l.a6,z*l.a6,0]),this._demMatrixCache[v]={matrix:P,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:((o=p?.dem)===null||o===void 0?void 0:o.dim)||1,u_terrain_matrix:v?this._demMatrixCache[v].matrix:this._emptyDemMatrix,u_terrain_unpack:((h=p?.dem)===null||h===void 0?void 0:h.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(p?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:p}}getFramebuffer(t){let o=this.painter,h=o.width/devicePixelRatio,p=o.height/devicePixelRatio;return!this._fbo||this._fbo.width===h&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new l.T(o.context,{width:h,height:p,data:null},o.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(o.context.gl.NEAREST,o.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new l.T(o.context,{width:h,height:p,data:null},o.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(o.context.gl.NEAREST,o.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=o.context.createFramebuffer(h,p,!0,!1),this._fbo.depthAttachment.set(o.context.createRenderbuffer(o.context.gl.DEPTH_COMPONENT16,h,p))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let o=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let v=0,T=0;v<this._coordsTextureSize;v++)for(let M=0;M<this._coordsTextureSize;M++,T+=4)o[T+0]=255&M,o[T+1]=255&v,o[T+2]=M>>8<<4|v>>8,o[T+3]=0;let h=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(o.buffer)),p=new l.T(t,h,t.gl.RGBA,{premultiply:!1});return p.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let o=new Uint8Array(4),h=this.painter.context,p=h.gl,v=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),T=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),M=Math.round(this.painter.height/devicePixelRatio);h.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(v,M-T-1,1,1,p.RGBA,p.UNSIGNED_BYTE,o),h.bindFramebuffer.set(null);let C=o[0]+(o[2]>>4<<8),z=o[1]+((15&o[2])<<8),P=this.coordsIndex[255-o[3]],k=P&&this.tileManager.getTileByID(P);if(!k)return null;let L=this._coordsTextureSize,N=(1<<k.tileID.canonical.z)*L;return new l.a7((k.tileID.canonical.x*L+C)/N+k.tileID.wrap,(k.tileID.canonical.y*L+z)/N,this.getElevation(k.tileID,C,z,L))}depthAtPoint(t){let o=new Uint8Array(4),h=this.painter.context,p=h.gl;return h.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,o),h.bindFramebuffer.set(null),(o[0]/16777216+o[1]/65536+o[2]/256+o[3])/256}getTerrainMesh(t){var o;let h=((o=this.painter.style.projection)===null||o===void 0?void 0:o.transitionState)>0,p=h&&t.canonical.y===0,v=h&&t.canonical.y===(1<<t.canonical.z)-1,T=`m_${p?"n":""}_${v?"s":""}`;if(this._meshCache[T])return this._meshCache[T];let M=this.painter.context,C=new l.cF,z=new l.aW,P=this.meshSize,k=l.a6/P,L=P*P;for(let ie=0;ie<=P;ie++)for(let me=0;me<=P;me++)C.emplaceBack(me*k,ie*k,0);for(let ie=0;ie<L;ie+=P+1)for(let me=0;me<P;me++)z.emplaceBack(me+ie,P+me+ie+1,P+me+ie+2),z.emplaceBack(me+ie,P+me+ie+2,me+ie+1);let N=C.length,G=N+(P+1),$=(P+1)*P,J=p?l.bq:0,W=p?0:1,ee=v?l.br:l.a6,ae=v?0:1;for(let ie=0;ie<=P;ie++)C.emplaceBack(ie*k,J,W);for(let ie=0;ie<=P;ie++)C.emplaceBack(ie*k,ee,ae);for(let ie=0;ie<P;ie++)z.emplaceBack($+ie,G+ie,G+ie+1),z.emplaceBack($+ie,G+ie+1,$+ie+1),z.emplaceBack(0+ie,N+ie+1,N+ie),z.emplaceBack(0+ie,0+ie+1,N+ie+1);let te=C.length,Q=te+2*(P+1);for(let ie of[0,1])for(let me=0;me<=P;me++)for(let Te of[0,1])C.emplaceBack(ie*l.a6,me*k,Te);for(let ie=0;ie<2*P;ie+=2)z.emplaceBack(te+ie,te+ie+1,te+ie+3),z.emplaceBack(te+ie,te+ie+3,te+ie+2),z.emplaceBack(Q+ie,Q+ie+3,Q+ie+1),z.emplaceBack(Q+ie,Q+ie+2,Q+ie+3);let re=new $t(M.createVertexBuffer(C,I1.members),M.createIndexBuffer(z),l.aV.simpleSegment(0,0,C.length,z.length));return this._meshCache[T]=re,re}getMeshFrameDelta(t){return 2*Math.PI*l.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,o){var h;if(!l.cD(o,t.wrap()))return 0;let{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(t,o);return(h=this.getMinMaxElevation(p).minElevation)!==null&&h!==void 0?h:0}getMinMaxElevation(t){let o=this.getTerrainData(t).tile,h={minElevation:null,maxElevation:null};return o?.dem&&(h.minElevation=o.dem.min*this.exaggeration,h.maxElevation=o.dem.max*this.exaggeration),h}_getOverscaledTileIDFromLngLatZoom(t,o){let h=l.a7.fromLngLat(t.wrap()),p=(1<<o)*l.a6,v=h.x*p,T=h.y*p,M=Math.floor(v/l.a6),C=Math.floor(T/l.a6);return{tileID:new l.a3(o,0,o,M,C),mercatorX:v,mercatorY:T}}}class fi{constructor(t,o,h){this._context=t,this._size=o,this._tileSize=h,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let o=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),h=new l.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return h.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),o.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),o.colorAttachment.set(h.texture),{id:t,fbo:o,texture:h,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((o=>t.id!==o)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let o of this._recentlyUsed)if(!this._objects[o].inUse)return this._objects[o];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}let Kt={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Nm{constructor(t,o){this.painter=t,this.terrain=o,this.pool=new fi(t.context,30,o.tileManager.tileSize*o.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,o){var h,p,v;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((T=>!t._layers[T].isHidden(o))),this._coordsAscending={};for(let T in t.tileManagers){this._coordsAscending[T]={};let M=t.tileManagers[T].getVisibleCoordinates(),C=t.tileManagers[T].getSource(),z=C instanceof Tr?C.terrainTileRanges:null;for(let P of M){let k=this.terrain.tileManager.getTerrainCoords(P,z);for(let L in k)(v=this._coordsAscending[T])[L]||(v[L]=[]),this._coordsAscending[T][L].push(k[L])}}this._rttFingerprints={};for(let T of t._order){let M=t._layers[T],C=M.source;if(Kt[M.type]&&!this._rttFingerprints[C]){this._rttFingerprints[C]={};let z=(p=(h=t.tileManagers[C])===null||h===void 0?void 0:h.getState().revision)!==null&&p!==void 0?p:0;for(let P in this._coordsAscending[C])this._rttFingerprints[C][P]=`${this._coordsAscending[C][P].map((k=>k.key)).sort().join()}#${z}`}}for(let T of this._renderableTiles)for(let M in this._rttFingerprints){let C=this._rttFingerprints[M][T.tileID.key];C&&C!==T.rttFingerprint[M]&&(T.rtt=[])}}renderLayer(t,o){if(t.isHidden(this.painter.transform.zoom))return!1;let h=Object.assign(Object.assign({},o),{isRenderingToTexture:!0}),p=t.type,v=this.painter,T=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Kt[p]&&(this._prevType&&Kt[this._prevType]||this._stacks.push([]),this._prevType=p,this._stacks[this._stacks.length-1].push(t.id),!T))return!0;if(Kt[this._prevType]||Kt[p]&&T){this._prevType=p;let M=this._stacks.length-1,C=this._stacks[M]||[];for(let z of this._renderableTiles){if(this.pool.isFull()&&(Ud(this.painter,this.terrain,this._rttTiles,h),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(z),z.rtt[M]){let k=this.pool.getObjectForId(z.rtt[M].id);if(k.stamp===z.rtt[M].stamp){this.pool.useObject(k);continue}}let P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),z.rtt[M]={id:P.id,stamp:P.stamp},v.context.bindFramebuffer.set(P.fbo.framebuffer),v.context.clear({color:l.bo.transparent,stencil:0}),v.currentStencilSource=void 0;for(let k of C){let L=v.style._layers[k],N=L.source?this._coordsAscending[L.source][z.tileID.key]:[z.tileID];v.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),v._renderTileClippingMasks(L,N,!0),v.renderLayer(v,v.style.tileManagers[L.source],L,N,h),L.source&&(z.rttFingerprint[L.source]=this._rttFingerprints[L.source][z.tileID.key])}}return Ud(this.painter,this.terrain,this._rttTiles,h),this._rttTiles=[],this.pool.freeAllObjects(),Kt[p]}return!1}}let dc={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},zu=D,Du={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Au,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},Pu=class extends Fm{get _ownerWindow(){var g,t;return((t=(g=this._container)===null||g===void 0?void 0:g.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(g){var t,o,h;let p=Object.assign(Object.assign(Object.assign({},Du),g),{canvasContextAttributes:Object.assign(Object.assign({},Du.canvasContextAttributes),g.canvasContextAttributes)});if(p.minZoom!=null&&p.maxZoom!=null&&p.minZoom>p.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(p.minPitch!=null&&p.maxPitch!=null&&p.minPitch>p.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(p.minPitch!=null&&p.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(p.maxPitch!=null&&p.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");let v=new ko,T=new Lo;p.minZoom!==void 0&&v.setMinZoom(p.minZoom),p.maxZoom!==void 0&&v.setMaxZoom(p.maxZoom),p.minPitch!==void 0&&v.setMinPitch(p.minPitch),p.maxPitch!==void 0&&v.setMaxPitch(p.maxPitch),p.renderWorldCopies!==void 0&&v.setRenderWorldCopies(p.renderWorldCopies),p.transformConstrain!==null&&v.setConstrainOverride(p.transformConstrain),super(v,T,{bearingSnap:p.bearingSnap,zoomSnap:p.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new R1,this._controls=[],this._mapId=l.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=C=>{if(C.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let z of Object.values(this.style._layers))if(z.type==="custom"&&console.warn(`Custom layer with id '${z.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),z._listeners)for(let[P]of Object.entries(z._listeners))console.warn(`Custom layer with id '${z.id}' had event listeners for event '${P}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new l.n("webglcontextlost",{originalEvent:C}))}else this.fire(new l.n("webglcontextlost",{originalEvent:C}))},this._contextRestored=C=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new l.n("webglcontextrestored",{originalEvent:C}))},this._onMapScroll=C=>{if(C.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=p.interactive,this._maxTileCacheSize=p.maxTileCacheSize,this._maxTileCacheZoomLevels=p.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},p.canvasContextAttributes),this._trackResize=p.trackResize===!0,this._bearingSnap=p.bearingSnap,this._zoomSnap=p.zoomSnap,this._centerClampedToGround=p.centerClampedToGround,this._refreshExpiredTiles=p.refreshExpiredTiles===!0,this._fadeDuration=p.fadeDuration,this._crossSourceCollisions=p.crossSourceCollisions===!0,this._collectResourceTiming=p.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},dc),p.locale),this._clickTolerance=p.clickTolerance,this._overridePixelRatio=p.pixelRatio,this._maxCanvasSize=p.maxCanvasSize,this._zoomLevelsToOverscale=p.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=p.transformCameraUpdate,this.transformConstrain=p.transformConstrain,this.cancelPendingTileRequestsWhileZooming=p.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(p.anisotropicFilterPitch),p.reduceMotion!==void 0&&(de.prefersReducedMotion=p.reduceMotion),this._imageQueueHandle=Ne.addThrottleControl((()=>this.isMoving())),this._requestManager=new se(p.transformRequest),this._container=this._resolveContainer(p.container),p.maxBounds&&this.setMaxBounds(p.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Vn(this,p),this._hash=p.hash?new rc(typeof p.hash=="string"&&p.hash||void 0).addTo(this):void 0,!((t=this._hash)===null||t===void 0)&&t._onHashChange()||(this.jumpTo({center:p.center,elevation:p.elevation,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch,roll:p.roll}),p.bounds&&(this.resize(),this.fitBounds(p.bounds,l.e({},p.fitBoundsOptions,{duration:0}))));let M=typeof p.style=="string"||((h=(o=p.style)===null||o===void 0?void 0:o.projection)===null||h===void 0?void 0:h.type)!=="globe";this.resize(null,M),this._localIdeographFontFamily=p.localIdeographFontFamily,this._validateStyle=p.validateStyle,p.style&&this.setStyle(p.style,{localIdeographFontFamily:p.localIdeographFontFamily}),p.attributionControl&&this.addControl(new Er(typeof p.attributionControl=="boolean"?void 0:p.attributionControl)),p.maplibreLogo&&this.addControl(new Qd,p.logoPosition),this.on("style.load",(()=>{if(M||this._resizeTransform(),this.transform.unmodified){let C=l.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(C)}})),this.on("data",(C=>{this._update(C.dataType==="style"),this.fire(new l.n(`${C.dataType}data`,C))})),this.on("dataloading",(C=>{this.fire(new l.n(`${C.dataType}dataloading`,C))})),this.on("dataabort",(C=>{this.fire(new l.n("sourcedataabort",C))}))}_getMapId(){return this._mapId}setGlobalStateProperty(g,t){return this.style.setGlobalStateProperty(g,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(g,t){if(t===void 0&&(t=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g?.onAdd)return this.fire(new l.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let o=g.onAdd(this);this._controls.push(g);let h=this._controlPositions[t];return t.includes("bottom")?h.insertBefore(o,h.firstChild):h.appendChild(o),this}removeControl(g){if(!g?.onRemove)return this.fire(new l.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(g);return t>-1&&this._controls.splice(t,1),g.onRemove(this),this}hasControl(g){return this._controls.includes(g)}coveringTiles(g){return zo(this.transform,g)}calculateCameraOptionsFromTo(g,t,o,h){return h==null&&this.terrain&&(h=this.terrain.getElevationForLngLat(o,this.transform)),super.calculateCameraOptionsFromTo(g,t,o,h)}resize(g,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let o=!this._moving;return o&&(this.stop(),this.fire(new l.n("movestart",g)).fire(new l.n("move",g))),this.fire(new l.n("resize",g)),o&&this.fire(new l.n("moveend",g)),this}_resizeInternal(g=!0){let[t,o]=this._containerDimensions(),h=this._getClampedPixelRatio(t,o);if(this._resizeCanvas(t,o,h),this.painter.resize(t,o,h),this.painter.overLimit()){let p=this.painter.context.gl;this._maxCanvasSize=[p.drawingBufferWidth,p.drawingBufferHeight];let v=this._getClampedPixelRatio(t,o);this._resizeCanvas(t,o,v),this.painter.resize(t,o,v)}this._resizeTransform(g)}_resizeTransform(g=!0){var t;let[o,h]=this._containerDimensions();this.transform.resize(o,h,g),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,h,g)}_getClampedPixelRatio(g,t){let{0:o,1:h}=this._maxCanvasSize,p=this.getPixelRatio(),v=g*p,T=t*p;return Math.min(v>o?o/v:1,T>h?h/T:1)*p}getPixelRatio(){var g;return(g=this._overridePixelRatio)!==null&&g!==void 0?g:devicePixelRatio}setPixelRatio(g){this._overridePixelRatio=g,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(g){return this.transform.setMaxBounds(tt.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom){let t=this.transform.zoom,o=this._getTransformForUpdate();return o.setMinZoom(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.zoom&&this.fire(new l.n("zoomstart")).fire(new l.n("zoom")).fire(new l.n("zoomend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(g){if((g=g??22)>=this.transform.minZoom){let t=this.transform.zoom,o=this._getTransformForUpdate();return o.setMaxZoom(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.zoom&&this.fire(new l.n("zoomstart")).fire(new l.n("zoom")).fire(new l.n("zoomend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch){let t=this.transform.pitch,o=this._getTransformForUpdate();return o.setMinPitch(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.pitch&&this.fire(new l.n("pitchstart")).fire(new l.n("pitch")).fire(new l.n("pitchend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(g){if((g=g??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(g>=this.transform.minPitch){let t=this.transform.pitch,o=this._getTransformForUpdate();return o.setMaxPitch(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.pitch&&this.fire(new l.n("pitchstart")).fire(new l.n("pitch")).fire(new l.n("pitchend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(g){if((g=g??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(g<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=g,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.setRenderWorldCopies(g),this._update()}setTransformConstrain(g){return this.transform.setConstrainOverride(g),this._update()}project(g){return this.transform.locationToScreenPoint(l.W.convert(g),this.style&&this.terrain)}unproject(g){return this.transform.screenPointToLocation(l.P.convert(g),this.terrain)}isMoving(){var g;return this._moving||((g=this.handlers)===null||g===void 0?void 0:g.isMoving())}isZooming(){var g;return this._zooming||((g=this.handlers)===null||g===void 0?void 0:g.isZooming())}isRotating(){var g;return this._rotating||((g=this.handlers)===null||g===void 0?void 0:g.isRotating())}_createDelegatedListener(g,t,o){if(g==="mouseenter"||g==="mouseover"){let h=!1;return{layers:t,listener:o,delegates:{mousemove:v=>{let T=t.filter((C=>this.getLayer(C))),M=T.length!==0?this.queryRenderedFeatures(v.point,{layers:T}):[];M.length?h||(h=!0,o.call(this,new hr(g,this,v.originalEvent,{features:M}))):h=!1},mouseout:()=>{h=!1}}}}if(g==="mouseleave"||g==="mouseout"){let h=!1;return{layers:t,listener:o,delegates:{mousemove:T=>{let M=t.filter((C=>this.getLayer(C)));(M.length!==0?this.queryRenderedFeatures(T.point,{layers:M}):[]).length?h=!0:h&&(h=!1,o.call(this,new hr(g,this,T.originalEvent)))},mouseout:T=>{h&&(h=!1,o.call(this,new hr(g,this,T.originalEvent)))}}}}{let h=p=>{let v=t.filter((M=>this.getLayer(M))),T=v.length!==0?this.queryRenderedFeatures(p.point,{layers:v}):[];T.length&&(p.features=T,o.call(this,p),delete p.features)};return{layers:t,listener:o,delegates:{[g]:h}}}}_saveDelegatedListener(g,t){var o;this._delegatedListeners||(this._delegatedListeners={}),(o=this._delegatedListeners)[g]||(o[g]=[]),this._delegatedListeners[g].push(t)}_removeDelegatedListener(g,t,o){var h;if(!(!((h=this._delegatedListeners)===null||h===void 0)&&h[g]))return;let p=this._delegatedListeners[g];for(let v=0;v<p.length;v++){let T=p[v];if(T.listener===o&&T.layers.length===t.length&&T.layers.every((M=>t.includes(M)))){for(let M in T.delegates)this.off(M,T.delegates[M]);return void p.splice(v,1)}}}on(g,t,o){if(o===void 0)return super.on(g,t);let h=typeof t=="string"?[t]:t,p=this._createDelegatedListener(g,h,o);this._saveDelegatedListener(g,p);for(let v in p.delegates)this.on(v,p.delegates[v]);return{unsubscribe:()=>{this._removeDelegatedListener(g,h,o)}}}once(g,t,o){if(o===void 0)return super.once(g,t);let h=typeof t=="string"?[t]:t,p=this._createDelegatedListener(g,h,o);for(let v in p.delegates){let T=p.delegates[v];p.delegates[v]=(...M)=>{this._removeDelegatedListener(g,h,o),T(...M)}}this._saveDelegatedListener(g,p);for(let v in p.delegates)this.once(v,p.delegates[v]);return this}off(g,t,o){return o===void 0?super.off(g,t):(this._removeDelegatedListener(g,typeof t=="string"?[t]:t,o),this)}queryRenderedFeatures(g,t){if(!this.style)return[];let o,h=g instanceof l.P||Array.isArray(g),p=h?g:[[0,0],[this.transform.width,this.transform.height]];if(t||(t=(h?{}:g)||{}),p instanceof l.P||typeof p[0]=="number")o=[l.P.convert(p)];else{let v=l.P.convert(p[0]),T=l.P.convert(p[1]);o=[v,new l.P(T.x,v.y),T,new l.P(v.x,T.y),v]}return this.style.queryRenderedFeatures(o,t,this.transform)}querySourceFeatures(g,t){return this.style.querySourceFeatures(g,t)}setStyle(g,t){return(t=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&g?(this._diffStyle(g,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(g,t))}setTransformRequest(g){return this._requestManager.setTransformRequest(g),this}_getUIString(g){let t=this._locale[g];if(t==null)throw new Error(`Missing UI string '${g}'`);return t}_updateStyle(g,t){var o,h,p;if((o=this._diffStyleRequest)===null||o===void 0||o.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(g,t)));let v=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!g)),g?(this.style=new No(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof g=="string"?this.style.loadURL(g,t,v):this.style.loadJSON(g,t,v),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(p=(h=this.style)===null||h===void 0?void 0:h.projection)===null||p===void 0||p.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new No(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(g,t){return l._(this,void 0,void 0,(function*(){var o;if((o=this._diffStyleRequest)===null||o===void 0||o.abort(),typeof g=="string"){let h=g;this._diffStyleRequest=new AbortController;let p=this._diffStyleRequest;try{let v=yield this._requestManager.transformRequest(h,"Style");if(p.signal.aborted)return void(this._diffStyleRequest=null);let T=yield l.k(v,p);this._diffStyleRequest=null,this._updateDiff(T.data,t)}catch(v){this._diffStyleRequest=null,l.$(v)||this.fire(new l.l(l.d(v)))}}else typeof g=="object"&&(this._diffStyleRequest=null,this._updateDiff(g,t))}))}_updateDiff(g,t){try{this.style.setState(g,t)&&this._update(!0)}catch(o){l.w(`Unable to perform style diff: ${l.d(o).message}. Rebuilding the style from scratch.`),this._updateStyle(g,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();l.w("There is no style added to the map.")}addSource(g,t){return this._lazyInitEmptyStyle(),this.style.addSource(g,t),this._update(!0)}isSourceLoaded(g){var t;let o=(t=this.style)===null||t===void 0?void 0:t.tileManagers[g];if(o!==void 0)return o.loaded();this.fire(new l.l(new Error(`There is no tile manager with ID '${g}'`)))}setTerrain(g){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),g){let t=this.style.tileManagers[g.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${g.source}`);this.terrain===null&&t.reload();for(let o in this.style._layers){let h=this.style._layers[o];h.type==="hillshade"&&h.source===g.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),h.type==="color-relief"&&h.source===g.source&&l.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new hc(this.painter,t,g),this.painter.renderToTexture=new Nm(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=o=>{var h;o.dataType==="style"?this.terrain.tileManager.freeRtt():o.dataType==="source"&&o.tile&&(o.sourceId!==g.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((h=o.source)===null||h===void 0?void 0:h.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(o.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new l.n("terrain",{terrain:g})),this}getTerrain(){var g,t;return(t=(g=this.terrain)===null||g===void 0?void 0:g.options)!==null&&t!==void 0?t:null}areTilesLoaded(){var g;let t=(g=this.style)===null||g===void 0?void 0:g.tileManagers;for(let o of Object.values(t))if(!o.areTilesLoaded())return!1;return!0}removeSource(g){return this.style.removeSource(g),this._update(!0)}getSource(g){return this.style.getSource(g)}setSourceTileLodParams(g,t,o){if(o){let h=this.getSource(o);if(!h)throw new Error(`There is no source with ID "${o}", cannot set LOD parameters`);h.calculateTileZoom=sd(Math.max(1,g),Math.max(1,t))}else for(let h in this.style.tileManagers)this.style.tileManagers[h].getSource().calculateTileZoom=sd(Math.max(1,g),Math.max(1,t));return this._update(!0),this}refreshTiles(g,t){let o=this.style.tileManagers[g];if(!o)throw new Error(`There is no tile manager with ID "${g}", cannot refresh tile`);t===void 0?o.reload(!0):o.refreshTiles(t.map((h=>new l.aa(h.z,h.x,h.y))))}addImage(g,t,o={}){let{pixelRatio:h=1,sdf:p=!1,stretchX:v,stretchY:T,content:M,textFitWidth:C,textFitHeight:z}=o;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||l.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new l.l(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:P,height:k,data:L}=t,N=t;return this.style.addImage(g,{data:new l.R({width:P,height:k},new Uint8Array(L)),pixelRatio:h,stretchX:v,stretchY:T,content:M,textFitWidth:C,textFitHeight:z,sdf:p,version:0,userImage:N}),N.onAdd&&N.onAdd(this,g),this}}{let{width:P,height:k,data:L}=de.getImageData(t);this.style.addImage(g,{data:new l.R({width:P,height:k},L),pixelRatio:h,stretchX:v,stretchY:T,content:M,textFitWidth:C,textFitHeight:z,sdf:p,version:0})}}updateImage(g,t){let o=this.style.getImage(g);if(!o)return this.fire(new l.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let h=t instanceof HTMLImageElement||l.b(t)?de.getImageData(t):t,{width:p,height:v,data:T}=h;if(p===void 0||v===void 0)return this.fire(new l.l(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==o.data.width||v!==o.data.height)return this.fire(new l.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));let M=!(t instanceof HTMLImageElement||l.b(t));return o.data.replace(T,M),this.style.updateImage(g,o),this}getImage(g){return this.style.getImage(g)}hasImage(g){return g?!!this.style.getImage(g):(this.fire(new l.l(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(g)}loadImage(g){return l._(this,void 0,void 0,(function*(){return Ne.getImage(yield this._requestManager.transformRequest(g,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(g,t){return this._lazyInitEmptyStyle(),this.style.addLayer(g,t),this._update(!0)}moveLayer(g,t){return this.style.moveLayer(g,t),this._update(!0)}removeLayer(g){return this.style.removeLayer(g),this._update(!0)}getLayer(g){return this.style.getLayer(g)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(g,t,o){return this.style.setLayerZoomRange(g,t,o),this._update(!0)}setFilter(g,t,o={}){return this.style.setFilter(g,t,o),this._update(!0)}getFilter(g){return this.style.getFilter(g)}setPaintProperty(g,t,o,h={}){return this.style.setPaintProperty(g,t,o,h),this._update(!0)}getPaintProperty(g,t){return this.style.getPaintProperty(g,t)}setLayoutProperty(g,t,o,h={}){return this.style.setLayoutProperty(g,t,o,h),this._update(!0)}getLayoutProperty(g,t){return this.style.getLayoutProperty(g,t)}setGlyphs(g,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(g,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(g,t,o={}){return this._lazyInitEmptyStyle(),this.style.addSprite(g,t,o,(h=>{h||this._update(!0)})),this}removeSprite(g){return this._lazyInitEmptyStyle(),this.style.removeSprite(g),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(g,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(g,t,(o=>{o||this._update(!0)})),this}setLight(g,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(g,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(g,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(g,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(g,t){return this.style.setFeatureState(g,t),this._update()}removeFeatureState(g,t){return this.style.removeFeatureState(g,t),this._update()}getFeatureState(g){return this.style.getFeatureState(g)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let g=0,t=0;return this._container&&(g=this._container.clientWidth||400,t=this._container.clientHeight||300),[g,t]}_setupResizeObserver(){var g;let t=!1,o=jd((p=>{this._trackResize&&!this._removed&&(this.resize(p),this.redraw())}),50),h=(g=this._ownerWindow.ResizeObserver)!==null&&g!==void 0?g:ResizeObserver;this._resizeObserver=new h((p=>{t?o(p):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(g){if(typeof g=="string"){let t=document.getElementById(g);if(!t)throw new Error(`Container '${g}' not found.`);return t}if(g instanceof HTMLElement||g&&typeof g=="object"&&g.nodeType===1)return g;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let g=this._container;g.classList.add("maplibregl-map");let t=this._canvasContainer=ve.create("div","maplibregl-canvas-container",g);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ve.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let o=this._containerDimensions(),h=this._getClampedPixelRatio(o[0],o[1]);this._resizeCanvas(o[0],o[1],h);let p=this._controlContainer=ve.create("div","maplibregl-control-container",g),v=this._controlPositions={};for(let T of["top-left","top-right","bottom-left","bottom-right"])v[T]=ve.create("div",`maplibregl-ctrl-${T} `,p);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(g,t,o){this._canvas.width=Math.floor(o*g),this._canvas.height=Math.floor(o*t),this._canvas.style.width=`${g}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let g=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",(h=>{t={requestedAttributes:g},h&&(t.statusMessage=h.statusMessage,t.type=h.type)}),{once:!0});let o=null;if(o=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,g):this._canvas.getContext("webgl2",g)||this._canvas.getContext("webgl",g),!o){let h="Failed to initialize WebGL";throw t?(t.message=h,new Error(JSON.stringify(t))):new Error(h)}this.painter=new nc(o,this.transform)}migrateProjection(g,t){super.migrateProjection(g,t),this.painter.transform=g,this.fire(new l.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(g){var t;return!((t=this.style)===null||t===void 0)&&t._loaded?(this._styleDirty||(this._styleDirty=g),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_render(g){var t,o,h,p,v,T;let M=this._idleTriggered?this._fadeDuration:0,C=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(g),this._removed)return;let z=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let L=this.transform.zoom,N=ce();this.style.zoomHistory.update(L,N);let G=new l.J(L,{now:N,fadeDuration:M,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),$=G.crossFadingFactor();$===1&&$===this._crossFadingFactor||(z=!0,this._crossFadingFactor=$),this.style.update(G)}let P=((o=this.style.projection)===null||o===void 0?void 0:o.transitionState)>0!==C;(h=this.style.projection)===null||h===void 0||h.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((p=this.style.projection)===null||p===void 0?void 0:p.transitionState,(v=this.style.projection)===null||v===void 0?void 0:v.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||P)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=(T=this.style)===null||T===void 0?void 0:T._updatePlacement(this.transform,this.showCollisionBoxes,M,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:M,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new l.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new l.n("load"))),this.style&&(this.style.hasTransitions()||z)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let k=this._sourcesDirty||this._styleDirty||this._placementDirty;return k||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.n("idle")),!this._loaded||this._fullyLoaded||k||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var g,t;this._hash&&this._hash.remove();for(let h of this._controls)h.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(g=this._diffStyleRequest)===null||g===void 0||g.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ne.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();let o=this.painter.context.gl.getExtension("WEBGL_lose_context");o?.loseContext&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new l.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,de.frame(this._frameRequest,(g=>{this._frameRequest=null;try{this._render(g)}catch(t){if(!l.$(t)&&!(function(o){return o.message===bu})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}get version(){return zu}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(g){return this._lazyInitEmptyStyle(),this.style.setProjection(g),this._update(!0)}},Jd={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class pc{constructor(t,o,h=!1){this.mousedown=v=>{this.startMove(v,ve.mousePos(this.element,v)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=v=>{this.move(v,ve.mousePos(this.element,v))},this.mouseup=v=>{this._rotatePitchHandler.dragEnd(v),this.offTemp()},this.touchstart=v=>{v.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ve.touchPos(this.element,v.targetTouches)[0],this.startMove(v,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=v=>{v.targetTouches.length!==1?this.reset():(this._lastPos=ve.touchPos(this.element,v.targetTouches)[0],this.move(v,this._lastPos))},this.touchend=v=>{v.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=o;let p=new Gd;this._rotatePitchHandler=new Ia({clickTolerance:3,move:(v,T)=>{let M=o.getBoundingClientRect(),C=new l.P((M.bottom-M.top)/2,(M.right-M.left)/2);return{bearingDelta:l.cx(new l.P(v.x,T.y),T,C),pitchDelta:h?-.5*(T.y-v.y):void 0}},moveStateManager:p,enable:!0,assignEvents:()=>{}}),this.map=t,o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchcancel",this.reset)}startMove(t,o){this._rotatePitchHandler.dragStart(t,o),ve.disableDrag()}move(t,o){let h=this.map,{bearingDelta:p,pitchDelta:v}=this._rotatePitchHandler.dragMove(t,o)||{};p&&h.setBearing(h.getBearing()+p),v&&h.setPitch(h.getPitch()+v)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ve.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let La;function Ru(g,t,o,h=!1){if(h||!o.getCoveringTilesDetailsProvider().allowWorldCopies())return g?.wrap();let p=new l.W(g.lng,g.lat);if(g=new l.W(g.lng,g.lat),t){let v=new l.W(g.lng-360,g.lat),T=new l.W(g.lng+360,g.lat),M=o.locationToScreenPoint(g).distSqr(t);o.locationToScreenPoint(v).distSqr(t)<M?g=v:o.locationToScreenPoint(T).distSqr(t)<M&&(g=T)}for(;Math.abs(g.lng-o.center.lng)>180;){let v=o.locationToScreenPoint(g);if(v.x>=0&&v.y>=0&&v.x<=o.width&&v.y<=o.height)break;g.lng>o.center.lng?g.lng-=360:g.lng+=360}return g.lng!==p.lng&&o.isPointOnMapSurface(o.locationToScreenPoint(g))?g:p}let fc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Iu(g,t,o){let h=g.classList;for(let p in fc)h.remove(`maplibregl-${o}-anchor-${p}`);h.add(`maplibregl-${o}-anchor-${t}`)}class mc extends l.E{constructor(t){if(super(),this._onClick=o=>{this.fire(new l.n("click",{originalEvent:o}))},this._onKeyPress=o=>{o.code!=="Space"&&o.code!=="Enter"||this.togglePopup()},this._onMapClick=o=>{let h=o.originalEvent.target,p=this._element;this._popup&&(h===p||p.contains(h))&&this.togglePopup()},this._update=o=>{if(!this._map)return;let h=this._map.loaded()&&!this._map.isMoving();(o?.type==="terrain"||o?.type==="render"&&!h)&&this._map.once("render",this._update),this._lngLat=Ru(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let p="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?p=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(p=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let v="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?v="rotateX(0deg)":this._pitchAlignment==="map"&&(v=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||o&&o.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${fc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${v} ${p}`,de.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(o?.type==="moveend")})).catch((()=>{}))},this._onMove=o=>{if(!this._isDragging){let h=this._clickTolerance||this._map._clickTolerance;this._isDragging=o.point.dist(this._pointerdownPos)>=h}this._isDragging&&(this._pos=o.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.n("dragstart"))),this.fire(new l.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.n("dragend")),this._state="inactive"},this._addDragHandler=o=>{this._element.contains(o.originalEvent.target)&&(o.preventDefault(),this._positionDelta=o.point.sub(this._pos).add(this._offset),this._pointerdownPos=o.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=l.P.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=ve.create("div");let o=ve.createNS("http://www.w3.org/2000/svg","svg"),h=41,p=27;o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height",`${h}px`),o.setAttributeNS(null,"width",`${p}px`),o.setAttributeNS(null,"viewBox",`0 0 ${p} ${h}`);let v=ve.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");let T=ve.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill-rule","nonzero");let M=ve.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");let C=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let W of C){let ee=ve.createNS("http://www.w3.org/2000/svg","ellipse");ee.setAttributeNS(null,"opacity","0.04"),ee.setAttributeNS(null,"cx","10.5"),ee.setAttributeNS(null,"cy","5.80029008"),ee.setAttributeNS(null,"rx",W.rx),ee.setAttributeNS(null,"ry",W.ry),M.appendChild(ee)}let z=ve.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);let P=ve.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),z.appendChild(P);let k=ve.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");let L=ve.createNS("http://www.w3.org/2000/svg","path");L.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),k.appendChild(L);let N=ve.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(6.0, 7.0)"),N.setAttributeNS(null,"fill","#FFFFFF");let G=ve.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");let $=ve.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");let J=ve.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),G.appendChild($),G.appendChild(J),T.appendChild(M),T.appendChild(z),T.appendChild(k),T.appendChild(N),T.appendChild(G),o.appendChild(T),o.setAttributeNS(null,"height",h*this._scale+"px"),o.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(o),this._offset=l.P.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(o=>{o.preventDefault()})),this._element.addEventListener("mousedown",(o=>{o.preventDefault()})),Iu(this._element,this._anchor,"marker"),t?.className)for(let o of t.className.split(" "))this._element.classList.add(o);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let p=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var o,h;let p=(o=this._map)===null||o===void 0?void 0:o.terrain,v=this._map.transform.isLocationOccluded(this._lngLat);if(!p||v){let N=v?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==N&&(this._element.style.opacity=N,this._element.classList.toggle("maplibregl-marker-covered",v)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}let T=this._map,M=T.terrain.depthAtPoint(this._pos),C=T.terrain.getElevationForLngLat(this._lngLat,T.transform);if(T.transform.lngLatToCameraDepth(this._lngLat,C)-M<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let z=-this._offset.y/T.transform.pixelsPerMeter,P=Math.sin(T.getPitch()*Math.PI/180)*z,k=T.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),L=T.transform.lngLatToCameraDepth(this._lngLat,C+P)-k>.006;!((h=this._popup)===null||h===void 0)&&h.isOpen()&&L&&this._popup.remove(),this._element.style.opacity=L?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",L)}getOffset(){return this._offset}setOffset(t){return this._offset=l.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,o){return(this._opacity===void 0||t===void 0&&o===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=String(t)),o!==void 0&&(this._opacityWhenCovered=String(o)),this._map&&this._updateOpacity(!0),this}}let ep={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Ys=0,Xo=!1,tp={maxWidth:100,unit:"metric"};function gc(g,t,o){let h=o?.maxWidth||100,p=g._container.clientHeight/2,v=g._container.clientWidth/2,T=g.unproject([v-h/2,p]),M=g.unproject([v+h/2,p]),C=Math.round(g.project(M).x-g.project(T).x),z=Math.min(h,C,g._container.clientWidth),P=T.distanceTo(M);if(o?.unit==="imperial"){let k=3.2808*P;k>5280?Yo(t,z,k/5280,g._getUIString("ScaleControl.Miles")):Yo(t,z,k,g._getUIString("ScaleControl.Feet"))}else o?.unit==="nautical"?Yo(t,z,P/1852,g._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Yo(t,z,P/1e3,g._getUIString("ScaleControl.Kilometers")):Yo(t,z,P,g._getUIString("ScaleControl.Meters"))}function Yo(g,t,o,h){let p=(function(v){let T=Math.pow(10,`${Math.floor(v)}`.length-1),M=v/T;return M=M>=10?10:M>=5?5:M>=3?3:M>=2?2:M>=1?1:(function(C){let z=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*z)/z})(M),T*M})(o);g.style.width=t*(p/o)+"px",g.innerHTML=`${p}&nbsp;${h}`}let ip={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},ku=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Lu(g){if(g){if(typeof g=="number"){let t=Math.round(Math.abs(g)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,g),"top-left":new l.P(t,t),"top-right":new l.P(-t,t),bottom:new l.P(0,-g),"bottom-left":new l.P(t,-t),"bottom-right":new l.P(-t,-t),left:new l.P(g,0),right:new l.P(-g,0)}}if(g instanceof l.P||Array.isArray(g)){let t=l.P.convert(g);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:l.P.convert(g.center||[0,0]),top:l.P.convert(g.top||[0,0]),"top-left":l.P.convert(g["top-left"]||[0,0]),"top-right":l.P.convert(g["top-right"]||[0,0]),bottom:l.P.convert(g.bottom||[0,0]),"bottom-left":l.P.convert(g["bottom-left"]||[0,0]),"bottom-right":l.P.convert(g["bottom-right"]||[0,0]),left:l.P.convert(g.left||[0,0]),right:l.P.convert(g.right||[0,0])}}return Lu(new l.P(0,0))}let np=D;y.AJAXError=l.cG,y.EXTENT=l.a6,y.Event=l.n,y.Evented=l.E,y.LngLat=l.W,y.MercatorCoordinate=l.a7,y.Point=l.P,y.addProtocol=l.cH,y.config=l.c,y.removeProtocol=l.cI,y.AttributionControl=Er,y.BoxZoomHandler=pa,y.CanvasSource=Il,y.CooperativeGesturesHandler=nt,y.DoubleClickZoomHandler=Kd,y.DragPanHandler=Xr,y.DragRotateHandler=uc,y.EdgeInsets=Ps,y.FullscreenControl=class extends l.E{constructor(g={}){var t;super(),this._onFullscreenChange=()=>{var o;let h=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((o=h?.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=g.pseudo)!==null&&t!==void 0&&t,g?.container&&(g.container instanceof HTMLElement?this._container=g.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=ve.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let g=this._fullscreenButton=ve.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ve.create("span","maplibregl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.title=g}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},y.GeoJSONSource=Ya,y.GeolocateControl=class extends l.E{constructor(g){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new l.n("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{let o=new l.W(t.coords.longitude,t.coords.latitude),h=t.coords.accuracy,p=this._map.getBearing(),v=l.e({bearing:p},this.options.fitBoundsOptions),T=tt.fromLngLat(o,h);this._map.fitBounds(T,v,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let o=new l.W(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Xo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.n("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let o=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.n("trackuserlocationend")),this.fire(new l.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>{t.preventDefault()})),this._geolocateButton=ve.create("button","maplibregl-ctrl-geolocate",this._container),ve.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");let o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{let o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ve.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new mc({element:this._dotElement}),this._circleElement=ve.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new mc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=l.e({},ep,g)}onAdd(g){return this._map=g,this._container=ve.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return l._(this,arguments,void 0,(function*(t=!1){if(La!==void 0&&!t)return La;if(window.navigator.permissions===void 0)return La=!!window.navigator.geolocation,La;try{La=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{La=!!window.navigator.geolocation}return La}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Ys=0,Xo=!1}_isOutOfMapMaxBounds(g){let t=this._map.getMaxBounds(),o=g.coords;return t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let g=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&g))return;let t=this._map.project(g),o=this._map.unproject([t.x+100,t.y]),h=g.distanceTo(o)/100,p=2*this._accuracy/h;this._circleElement.style.width=`${p.toFixed(2)}px`,this._circleElement.style.height=`${p.toFixed(2)}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ys--,Xo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.n("trackuserlocationstart")),this.fire(new l.n("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let g;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ys++,Ys>1?(g={maximumAge:6e5,timeout:0},Xo=!0):(g=this.options.positionOptions,Xo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,g)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},y.GlobeControl=class{constructor(){this._toggleProjection=()=>{var g;let t=(g=this._map.getProjection())===null||g===void 0?void 0:g.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var g;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((g=this._map.getProjection())===null||g===void 0?void 0:g.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(g){return this._map=g,this._container=ve.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ve.create("button","maplibregl-ctrl-globe",this._container),ve.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},y.Hash=rc,y.ImageSource=Tr,y.KeyboardHandler=Lm,y.LngLatBounds=tt,y.LogoControl=Qd,y.Map=Pu,y.MapLibreMap=Pu,y.MapMouseEvent=hr,y.MapTouchEvent=oc,y.MapWheelEvent=Cm,y.Marker=mc,y.NavigationControl=class{constructor(g){this._updateZoomButtons=()=>{let t=this._map.getZoom(),o=t===this._map.getMaxZoom(),h=t===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,o)=>{let h=this._map._getUIString(`NavigationControl.${o}`);t.title=h,t.setAttribute("aria-label",h)},this.options=l.e({},Jd,g),this._container=ve.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),ve.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),ve.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=ve.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(g){return this._map=g,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new pc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(g,t){let o=ve.create("button",g,this._container);return o.type="button",o.addEventListener("click",t),o}},y.Popup=class extends l.E{constructor(g){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.n("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ve.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ve.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let M of this.options.className.split(" "))this._container.classList.add(M);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let o;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Ru(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(o=t.point),this._trackPointer&&!o)return;let h=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationToScreenPoint(this._lngLat));let p=this.options.anchor,v=Lu(this.options.offset);if(!p){let M=this._container.offsetWidth,C=this._container.offsetHeight,z=(function(k){var L,N,G,$;return k?{top:(L=k.top)!==null&&L!==void 0?L:0,right:(N=k.right)!==null&&N!==void 0?N:0,bottom:(G=k.bottom)!==null&&G!==void 0?G:0,left:($=k.left)!==null&&$!==void 0?$:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding),P;P=h.y+v.bottom.y<C+z.top?["top"]:h.y>this._map.transform.height-C-z.bottom?["bottom"]:[],h.x<M/2+z.left?P.push("left"):h.x>this._map.transform.width-M/2-z.right&&P.push("right"),p=P.length===0?"bottom":P.join("-")}let T=h.add(v[p]);this.options.subpixelPositioning||(T=T.round()),this._container.style.transform=`${fc[p]} translate(${T.x}px,${T.y}px)`,Iu(this._container,p,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(ip),g)}addTo(g){return this._map&&this.remove(),this._map=g,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(g){return this._lngLat=l.W.convert(g),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){let t=document.createDocumentFragment(),o=document.createElement("body"),h;for(o.innerHTML=g;h=o.firstChild,h;)t.appendChild(h);return this.setDOMContent(t)}getMaxWidth(){var g;return(g=this._container)===null||g===void 0?void 0:g.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ve.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(g),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(g){return this._container&&this._container.classList.add(g),this}removeClassName(g){return this._container&&this._container.classList.remove(g),this}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){if(this._container)return this._container.classList.toggle(g)}setSubpixelPositioning(g){this.options.subpixelPositioning=g}setPadding(g){this.options.padding=g,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ve.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let g=this._container.querySelector(ku);g&&g.focus()}},y.RasterDEMTileSource=di,y.RasterTileSource=Fi,y.ScaleControl=class{constructor(g){this._onMove=()=>{gc(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,gc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},tp),g)}getDefaultPosition(){return"bottom-left"}onAdd(g){return this._map=g,this._container=ve.create("div","maplibregl-ctrl maplibregl-ctrl-scale",g.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},y.ScrollZoomHandler=Wd,y.Style=No,y.TerrainControl=class{constructor(g){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=g}onAdd(g){return this._map=g,this._container=ve.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ve.create("button","maplibregl-ctrl-terrain",this._container),ve.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},y.TwoFingersTouchPitchHandler=ka,y.TwoFingersTouchRotateHandler=km,y.TwoFingersTouchZoomHandler=Im,y.TwoFingersTouchZoomRotateHandler=Je,y.VectorTileSource=Wt,y.VideoSource=Ur,y.addSourceType=(g,t)=>l._(void 0,void 0,void 0,(function*(){if(Ms(g))throw new Error(`A source type called "${g}" already exists.`);((o,h)=>{kl[o]=h})(g,t)})),y.clearPrewarmedResources=function(){let g=Zt;g&&(g.isPreloaded()&&g.numActive()===1?(g.release(yt),Zt=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()"))},y.createTileMesh=Ls,y.getGlobalDispatcher=ri,y.getMaxParallelImageRequests=function(){return l.c.MAX_PARALLEL_IMAGE_REQUESTS},y.getRTLTextPluginStatus=function(){return Vr().getRTLTextPluginStatus()},y.getVersion=function(){return np},y.getWorkerCount=function(){return st.workerCount},y.getWorkerUrl=function(){return l.c.WORKER_URL},y.importScriptInWorkers=function(g){return ri().broadcast("IS",g)},y.isTimeFrozen=function(){return oe.isFrozen()},y.now=ce,y.prewarm=function(){Ji().acquire(yt)},y.restoreNow=function(){oe.restoreNow()},y.setMaxParallelImageRequests=function(g){l.c.MAX_PARALLEL_IMAGE_REQUESTS=g},y.setNow=function(g){oe.setNow(g)},y.setRTLTextPlugin=function(g,t){return Vr().setRTLTextPlugin(g,t)},y.setWorkerCount=function(g){st.workerCount=g},y.setWorkerUrl=function(g){l.c.WORKER_URL=g}}));var f=i;return f}))});var e3=qa(_r=>{"use strict";var _C=At();function Jw(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function al(){}var gr={d:{f:al,r:function(){throw Error(Jw(522))},D:al,C:al,L:al,m:al,X:al,S:al,M:al},p:0,findDOMNode:null},yC=Symbol.for("react.portal");function vC(i,a,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yC,key:f==null?null:""+f,children:i,containerInfo:a,implementation:u}}var Dp=_C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function S0(i,a){if(i==="font")return"";if(typeof a=="string")return a==="use-credentials"?a:""}_r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=gr;_r.createPortal=function(i,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)throw Error(Jw(299));return vC(i,a,null,u)};_r.flushSync=function(i){var a=Dp.T,u=gr.p;try{if(Dp.T=null,gr.p=2,i)return i()}finally{Dp.T=a,gr.p=u,gr.d.f()}};_r.preconnect=function(i,a){typeof i=="string"&&(a?(a=a.crossOrigin,a=typeof a=="string"?a==="use-credentials"?a:"":void 0):a=null,gr.d.C(i,a))};_r.prefetchDNS=function(i){typeof i=="string"&&gr.d.D(i)};_r.preinit=function(i,a){if(typeof i=="string"&&a&&typeof a.as=="string"){var u=a.as,f=S0(u,a.crossOrigin),y=typeof a.integrity=="string"?a.integrity:void 0,l=typeof a.fetchPriority=="string"?a.fetchPriority:void 0;u==="style"?gr.d.S(i,typeof a.precedence=="string"?a.precedence:void 0,{crossOrigin:f,integrity:y,fetchPriority:l}):u==="script"&&gr.d.X(i,{crossOrigin:f,integrity:y,fetchPriority:l,nonce:typeof a.nonce=="string"?a.nonce:void 0})}};_r.preinitModule=function(i,a){if(typeof i=="string")if(typeof a=="object"&&a!==null){if(a.as==null||a.as==="script"){var u=S0(a.as,a.crossOrigin);gr.d.M(i,{crossOrigin:u,integrity:typeof a.integrity=="string"?a.integrity:void 0,nonce:typeof a.nonce=="string"?a.nonce:void 0})}}else a==null&&gr.d.M(i)};_r.preload=function(i,a){if(typeof i=="string"&&typeof a=="object"&&a!==null&&typeof a.as=="string"){var u=a.as,f=S0(u,a.crossOrigin);gr.d.L(i,u,{crossOrigin:f,integrity:typeof a.integrity=="string"?a.integrity:void 0,nonce:typeof a.nonce=="string"?a.nonce:void 0,type:typeof a.type=="string"?a.type:void 0,fetchPriority:typeof a.fetchPriority=="string"?a.fetchPriority:void 0,referrerPolicy:typeof a.referrerPolicy=="string"?a.referrerPolicy:void 0,imageSrcSet:typeof a.imageSrcSet=="string"?a.imageSrcSet:void 0,imageSizes:typeof a.imageSizes=="string"?a.imageSizes:void 0,media:typeof a.media=="string"?a.media:void 0})}};_r.preloadModule=function(i,a){if(typeof i=="string")if(a){var u=S0(a.as,a.crossOrigin);gr.d.m(i,{as:typeof a.as=="string"&&a.as!=="script"?a.as:void 0,crossOrigin:u,integrity:typeof a.integrity=="string"?a.integrity:void 0})}else gr.d.m(i)};_r.requestFormReset=function(i){gr.d.r(i)};_r.unstable_batchedUpdates=function(i,a){return i(a)};_r.useFormState=function(i,a,u){return Dp.H.useFormState(i,a,u)};_r.useFormStatus=function(){return Dp.H.useHostTransitionStatus()};_r.version="19.2.7"});var M0=qa((X7,i3)=>{"use strict";function t3(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t3)}catch(i){console.error(i)}}t3(),i3.exports=e3()});var x3=qa(Di=>{"use strict";function yy(i,a){var u=i.length;i.push(a);e:for(;0<u;){var f=u-1>>>1,y=i[f];if(0<R0(y,a))i[f]=a,i[u]=y,u=f;else break e}}function yo(i){return i.length===0?null:i[0]}function k0(i){if(i.length===0)return null;var a=i[0],u=i.pop();if(u!==a){i[0]=u;e:for(var f=0,y=i.length,l=y>>>1;f<l;){var D=2*(f+1)-1,B=i[D],q=D+1,K=i[q];if(0>R0(B,u))q<y&&0>R0(K,B)?(i[f]=K,i[q]=u,f=q):(i[f]=B,i[D]=u,f=D);else if(q<y&&0>R0(K,u))i[f]=K,i[q]=u,f=q;else break e}}return a}function R0(i,a){var u=i.sortIndex-a.sortIndex;return u!==0?u:i.id-a.id}Di.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(d3=performance,Di.unstable_now=function(){return d3.now()}):(my=Date,p3=my.now(),Di.unstable_now=function(){return my.now()-p3});var d3,my,p3,rs=[],ol=[],GC=1,ya=null,or=3,vy=!1,kp=!1,Lp=!1,by=!1,g3=typeof setTimeout=="function"?setTimeout:null,_3=typeof clearTimeout=="function"?clearTimeout:null,f3=typeof setImmediate<"u"?setImmediate:null;function I0(i){for(var a=yo(ol);a!==null;){if(a.callback===null)k0(ol);else if(a.startTime<=i)k0(ol),a.sortIndex=a.expirationTime,yy(rs,a);else break;a=yo(ol)}}function xy(i){if(Lp=!1,I0(i),!kp)if(yo(rs)!==null)kp=!0,gh||(gh=!0,mh());else{var a=yo(ol);a!==null&&wy(xy,a.startTime-i)}}var gh=!1,Op=-1,y3=5,v3=-1;function b3(){return by?!0:!(Di.unstable_now()-v3<y3)}function gy(){if(by=!1,gh){var i=Di.unstable_now();v3=i;var a=!0;try{e:{kp=!1,Lp&&(Lp=!1,_3(Op),Op=-1),vy=!0;var u=or;try{t:{for(I0(i),ya=yo(rs);ya!==null&&!(ya.expirationTime>i&&b3());){var f=ya.callback;if(typeof f=="function"){ya.callback=null,or=ya.priorityLevel;var y=f(ya.expirationTime<=i);if(i=Di.unstable_now(),typeof y=="function"){ya.callback=y,I0(i),a=!0;break t}ya===yo(rs)&&k0(rs),I0(i)}else k0(rs);ya=yo(rs)}if(ya!==null)a=!0;else{var l=yo(ol);l!==null&&wy(xy,l.startTime-i),a=!1}}break e}finally{ya=null,or=u,vy=!1}a=void 0}}finally{a?mh():gh=!1}}}var mh;typeof f3=="function"?mh=function(){f3(gy)}:typeof MessageChannel<"u"?(_y=new MessageChannel,m3=_y.port2,_y.port1.onmessage=gy,mh=function(){m3.postMessage(null)}):mh=function(){g3(gy,0)};var _y,m3;function wy(i,a){Op=g3(function(){i(Di.unstable_now())},a)}Di.unstable_IdlePriority=5;Di.unstable_ImmediatePriority=1;Di.unstable_LowPriority=4;Di.unstable_NormalPriority=3;Di.unstable_Profiling=null;Di.unstable_UserBlockingPriority=2;Di.unstable_cancelCallback=function(i){i.callback=null};Di.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y3=0<i?Math.floor(1e3/i):5};Di.unstable_getCurrentPriorityLevel=function(){return or};Di.unstable_next=function(i){switch(or){case 1:case 2:case 3:var a=3;break;default:a=or}var u=or;or=a;try{return i()}finally{or=u}};Di.unstable_requestPaint=function(){by=!0};Di.unstable_runWithPriority=function(i,a){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var u=or;or=i;try{return a()}finally{or=u}};Di.unstable_scheduleCallback=function(i,a,u){var f=Di.unstable_now();switch(typeof u=="object"&&u!==null?(u=u.delay,u=typeof u=="number"&&0<u?f+u:f):u=f,i){case 1:var y=-1;break;case 2:y=250;break;case 5:y=1073741823;break;case 4:y=1e4;break;default:y=5e3}return y=u+y,i={id:GC++,callback:a,priorityLevel:i,startTime:u,expirationTime:y,sortIndex:-1},u>f?(i.sortIndex=u,yy(ol,i),yo(rs)===null&&i===yo(ol)&&(Lp?(_3(Op),Op=-1):Lp=!0,wy(xy,u-f))):(i.sortIndex=y,yy(rs,i),kp||vy||(kp=!0,gh||(gh=!0,mh()))),i};Di.unstable_shouldYield=b3;Di.unstable_wrapCallback=function(i){var a=or;return function(){var u=or;or=a;try{return i.apply(this,arguments)}finally{or=u}}}});var T3=qa((NP,w3)=>{"use strict";w3.exports=x3()});var LS=qa(a1=>{"use strict";var Tn=T3(),Y5=At(),ZC=M0();function Re(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function W5(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Tf(i){var a=i,u=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(u=a.return),i=a.return;while(i)}return a.tag===3?u:null}function K5(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function Q5(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function S3(i){if(Tf(i)!==i)throw Error(Re(188))}function HC(i){var a=i.alternate;if(!a){if(a=Tf(i),a===null)throw Error(Re(188));return a!==i?null:i}for(var u=i,f=a;;){var y=u.return;if(y===null)break;var l=y.alternate;if(l===null){if(f=y.return,f!==null){u=f;continue}break}if(y.child===l.child){for(l=y.child;l;){if(l===u)return S3(y),i;if(l===f)return S3(y),a;l=l.sibling}throw Error(Re(188))}if(u.return!==f.return)u=y,f=l;else{for(var D=!1,B=y.child;B;){if(B===u){D=!0,u=y,f=l;break}if(B===f){D=!0,f=y,u=l;break}B=B.sibling}if(!D){for(B=l.child;B;){if(B===u){D=!0,u=l,f=y;break}if(B===f){D=!0,f=l,u=y;break}B=B.sibling}if(!D)throw Error(Re(189))}}if(u.alternate!==f)throw Error(Re(190))}if(u.tag!==3)throw Error(Re(188));return u.stateNode.current===u?i:a}function J5(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=J5(i),a!==null)return a;i=i.sibling}return null}var Ei=Object.assign,$C=Symbol.for("react.element"),L0=Symbol.for("react.transitional.element"),Gp=Symbol.for("react.portal"),wh=Symbol.for("react.fragment"),e4=Symbol.for("react.strict_mode"),iv=Symbol.for("react.profiler"),t4=Symbol.for("react.consumer"),ds=Symbol.for("react.context"),Kv=Symbol.for("react.forward_ref"),nv=Symbol.for("react.suspense"),rv=Symbol.for("react.suspense_list"),Qv=Symbol.for("react.memo"),sl=Symbol.for("react.lazy"),av=Symbol.for("react.activity"),XC=Symbol.for("react.memo_cache_sentinel"),M3=Symbol.iterator;function Bp(i){return i===null||typeof i!="object"?null:(i=M3&&i[M3]||i["@@iterator"],typeof i=="function"?i:null)}var YC=Symbol.for("react.client.reference");function ov(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===YC?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case wh:return"Fragment";case iv:return"Profiler";case e4:return"StrictMode";case nv:return"Suspense";case rv:return"SuspenseList";case av:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case Gp:return"Portal";case ds:return i.displayName||"Context";case t4:return(i._context.displayName||"Context")+".Consumer";case Kv:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Qv:return a=i.displayName||null,a!==null?a:ov(i.type)||"Memo";case sl:a=i._payload,i=i._init;try{return ov(i(a))}catch{}}return null}var Zp=Array.isArray,ct=Y5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Gt=ZC.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Rc={pending:!1,data:null,method:null,action:null},sv=[],Th=-1;function To(i){return{current:i}}function Fn(i){0>Th||(i.current=sv[Th],sv[Th]=null,Th--)}function yi(i,a){Th++,sv[Th]=i.current,i.current=a}var wo=To(null),cf=To(null),yl=To(null),fg=To(null);function mg(i,a){switch(yi(yl,a),yi(cf,i),yi(wo,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?R5(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=R5(a),i=xS(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Fn(wo),yi(wo,i)}function Vh(){Fn(wo),Fn(cf),Fn(yl)}function lv(i){i.memoizedState!==null&&yi(fg,i);var a=wo.current,u=xS(a,i.type);a!==u&&(yi(cf,i),yi(wo,u))}function gg(i){cf.current===i&&(Fn(wo),Fn(cf)),fg.current===i&&(Fn(fg),bf._currentValue=Rc)}var Ty,E3;function Ac(i){if(Ty===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Ty=a&&a[1]||"",E3=-1<u.stack.indexOf(`
801
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
802
+ `+Ty+i+E3}var Sy=!1;function My(i,a){if(!i||Sy)return"";Sy=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ce){var oe=ce}Reflect.construct(i,[],de)}else{try{de.call()}catch(ce){oe=ce}i.call(de.prototype)}}else{try{throw Error()}catch(ce){oe=ce}(de=i())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ce){if(ce&&oe&&typeof ce.stack=="string")return[ce.stack,oe.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=f.DetermineComponentFrameRoot(),D=l[0],B=l[1];if(D&&B){var q=D.split(`
803
+ `),K=B.split(`
804
+ `);for(y=f=0;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;for(;y<K.length&&!K[y].includes("DetermineComponentFrameRoot");)y++;if(f===q.length||y===K.length)for(f=q.length-1,y=K.length-1;1<=f&&0<=y&&q[f]!==K[y];)y--;for(;1<=f&&0<=y;f--,y--)if(q[f]!==K[y]){if(f!==1||y!==1)do if(f--,y--,0>y||q[f]!==K[y]){var fe=`
805
+ `+q[f].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=f&&0<=y);break}}}finally{Sy=!1,Error.prepareStackTrace=u}return(u=i?i.displayName||i.name:"")?Ac(u):""}function WC(i,a){switch(i.tag){case 26:case 27:case 5:return Ac(i.type);case 16:return Ac("Lazy");case 13:return i.child!==a&&a!==null?Ac("Suspense Fallback"):Ac("Suspense");case 19:return Ac("SuspenseList");case 0:case 15:return My(i.type,!1);case 11:return My(i.type.render,!1);case 1:return My(i.type,!0);case 31:return Ac("Activity");default:return""}}function C3(i){try{var a="",u=null;do a+=WC(i,u),u=i,i=i.return;while(i);return a}catch(f){return`
806
+ Error generating stack: `+f.message+`
807
+ `+f.stack}}var cv=Object.prototype.hasOwnProperty,Jv=Tn.unstable_scheduleCallback,Ey=Tn.unstable_cancelCallback,KC=Tn.unstable_shouldYield,QC=Tn.unstable_requestPaint,ia=Tn.unstable_now,JC=Tn.unstable_getCurrentPriorityLevel,i4=Tn.unstable_ImmediatePriority,n4=Tn.unstable_UserBlockingPriority,_g=Tn.unstable_NormalPriority,e8=Tn.unstable_LowPriority,r4=Tn.unstable_IdlePriority,t8=Tn.log,i8=Tn.unstable_setDisableYieldValue,Sf=null,na=null;function pl(i){if(typeof t8=="function"&&i8(i),na&&typeof na.setStrictMode=="function")try{na.setStrictMode(Sf,i)}catch{}}var ra=Math.clz32?Math.clz32:a8,n8=Math.log,r8=Math.LN2;function a8(i){return i>>>=0,i===0?32:31-(n8(i)/r8|0)|0}var O0=256,B0=262144,F0=4194304;function zc(i){var a=i&42;if(a!==0)return a;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function qg(i,a,u){var f=i.pendingLanes;if(f===0)return 0;var y=0,l=i.suspendedLanes,D=i.pingedLanes;i=i.warmLanes;var B=f&134217727;return B!==0?(f=B&~l,f!==0?y=zc(f):(D&=B,D!==0?y=zc(D):u||(u=B&~i,u!==0&&(y=zc(u))))):(B=f&~l,B!==0?y=zc(B):D!==0?y=zc(D):u||(u=f&~i,u!==0&&(y=zc(u)))),y===0?0:a!==0&&a!==y&&(a&l)===0&&(l=y&-y,u=a&-a,l>=u||l===32&&(u&4194048)!==0)?a:y}function Mf(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function o8(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function a4(){var i=F0;return F0<<=1,(F0&62914560)===0&&(F0=4194304),i}function Cy(i){for(var a=[],u=0;31>u;u++)a.push(i);return a}function Ef(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function s8(i,a,u,f,y,l){var D=i.pendingLanes;i.pendingLanes=u,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=u,i.entangledLanes&=u,i.errorRecoveryDisabledLanes&=u,i.shellSuspendCounter=0;var B=i.entanglements,q=i.expirationTimes,K=i.hiddenUpdates;for(u=D&~u;0<u;){var fe=31-ra(u),de=1<<fe;B[fe]=0,q[fe]=-1;var oe=K[fe];if(oe!==null)for(K[fe]=null,fe=0;fe<oe.length;fe++){var ce=oe[fe];ce!==null&&(ce.lane&=-536870913)}u&=~de}f!==0&&o4(i,f,0),l!==0&&y===0&&i.tag!==0&&(i.suspendedLanes|=l&~(D&~a))}function o4(i,a,u){i.pendingLanes|=a,i.suspendedLanes&=~a;var f=31-ra(a);i.entangledLanes|=a,i.entanglements[f]=i.entanglements[f]|1073741824|u&261930}function s4(i,a){var u=i.entangledLanes|=a;for(i=i.entanglements;u;){var f=31-ra(u),y=1<<f;y&a|i[f]&a&&(i[f]|=a),u&=~y}}function l4(i,a){var u=a&-a;return u=(u&42)!==0?1:eb(u),(u&(i.suspendedLanes|a))!==0?0:u}function eb(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function tb(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function c4(){var i=Gt.p;return i!==0?i:(i=window.event,i===void 0?32:RS(i.type))}function A3(i,a){var u=Gt.p;try{return Gt.p=i,a()}finally{Gt.p=u}}var Pl=Math.random().toString(36).slice(2),Yn="__reactFiber$"+Pl,Or="__reactProps$"+Pl,Qh="__reactContainer$"+Pl,uv="__reactEvents$"+Pl,l8="__reactListeners$"+Pl,c8="__reactHandles$"+Pl,z3="__reactResources$"+Pl,Cf="__reactMarker$"+Pl;function ib(i){delete i[Yn],delete i[Or],delete i[uv],delete i[l8],delete i[c8]}function Sh(i){var a=i[Yn];if(a)return a;for(var u=i.parentNode;u;){if(a=u[Qh]||u[Yn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(i=B5(i);i!==null;){if(u=i[Yn])return u;i=B5(i)}return a}i=u,u=i.parentNode}return null}function Jh(i){if(i=i[Yn]||i[Qh]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function Hp(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(Re(33))}function kh(i){var a=i[z3];return a||(a=i[z3]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Bn(i){i[Cf]=!0}var u4=new Set,h4={};function jc(i,a){jh(i,a),jh(i+"Capture",a)}function jh(i,a){for(h4[i]=a,i=0;i<a.length;i++)u4.add(a[i])}var u8=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),D3={},P3={};function h8(i){return cv.call(P3,i)?!0:cv.call(D3,i)?!1:u8.test(i)?P3[i]=!0:(D3[i]=!0,!1)}function J0(i,a,u){if(h8(a))if(u===null)i.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+u)}}function N0(i,a,u){if(u===null)i.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+u)}}function as(i,a,u,f){if(f===null)i.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(u);return}i.setAttributeNS(a,u,""+f)}}function ba(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function d4(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function d8(i,a,u){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,l=f.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return y.call(this)},set:function(D){u=""+D,l.call(this,D)}}),Object.defineProperty(i,a,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(D){u=""+D},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function hv(i){if(!i._valueTracker){var a=d4(i)?"checked":"value";i._valueTracker=d8(i,a,""+i[a])}}function p4(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var u=a.getValue(),f="";return i&&(f=d4(i)?i.checked?"true":"false":i.value),i=f,i!==u?(a.setValue(i),!0):!1}function yg(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var p8=/[\n"\\]/g;function Ta(i){return i.replace(p8,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function dv(i,a,u,f,y,l,D,B){i.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?i.type=D:i.removeAttribute("type"),a!=null?D==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+ba(a)):i.value!==""+ba(a)&&(i.value=""+ba(a)):D!=="submit"&&D!=="reset"||i.removeAttribute("value"),a!=null?pv(i,D,ba(a)):u!=null?pv(i,D,ba(u)):f!=null&&i.removeAttribute("value"),y==null&&l!=null&&(i.defaultChecked=!!l),y!=null&&(i.checked=y&&typeof y!="function"&&typeof y!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?i.name=""+ba(B):i.removeAttribute("name")}function f4(i,a,u,f,y,l,D,B){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(i.type=l),a!=null||u!=null){if(!(l!=="submit"&&l!=="reset"||a!=null)){hv(i);return}u=u!=null?""+ba(u):"",a=a!=null?""+ba(a):u,B||a===i.value||(i.value=a),i.defaultValue=a}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=B?i.checked:!!f,i.defaultChecked=!!f,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(i.name=D),hv(i)}function pv(i,a,u){a==="number"&&yg(i.ownerDocument)===i||i.defaultValue===""+u||(i.defaultValue=""+u)}function Lh(i,a,u,f){if(i=i.options,a){a={};for(var y=0;y<u.length;y++)a["$"+u[y]]=!0;for(u=0;u<i.length;u++)y=a.hasOwnProperty("$"+i[u].value),i[u].selected!==y&&(i[u].selected=y),y&&f&&(i[u].defaultSelected=!0)}else{for(u=""+ba(u),a=null,y=0;y<i.length;y++){if(i[y].value===u){i[y].selected=!0,f&&(i[y].defaultSelected=!0);return}a!==null||i[y].disabled||(a=i[y])}a!==null&&(a.selected=!0)}}function m4(i,a,u){if(a!=null&&(a=""+ba(a),a!==i.value&&(i.value=a),u==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=u!=null?""+ba(u):""}function g4(i,a,u,f){if(a==null){if(f!=null){if(u!=null)throw Error(Re(92));if(Zp(f)){if(1<f.length)throw Error(Re(93));f=f[0]}u=f}u==null&&(u=""),a=u}u=ba(a),i.defaultValue=u,f=i.textContent,f===u&&f!==""&&f!==null&&(i.value=f),hv(i)}function qh(i,a){if(a){var u=i.firstChild;if(u&&u===i.lastChild&&u.nodeType===3){u.nodeValue=a;return}}i.textContent=a}var f8=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function R3(i,a,u){var f=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":f?i.setProperty(a,u):typeof u!="number"||u===0||f8.has(a)?a==="float"?i.cssFloat=u:i[a]=(""+u).trim():i[a]=u+"px"}function _4(i,a,u){if(a!=null&&typeof a!="object")throw Error(Re(62));if(i=i.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var y in a)f=a[y],a.hasOwnProperty(y)&&u[y]!==f&&R3(i,y,f)}else for(var l in a)a.hasOwnProperty(l)&&R3(i,l,a[l])}function nb(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var m8=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),g8=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function eg(i){return g8.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function ps(){}var fv=null;function rb(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Mh=null,Oh=null;function I3(i){var a=Jh(i);if(a&&(i=a.stateNode)){var u=i[Or]||null;e:switch(i=a.stateNode,a.type){case"input":if(dv(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=i;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ta(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var f=u[a];if(f!==i&&f.form===i.form){var y=f[Or]||null;if(!y)throw Error(Re(90));dv(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<u.length;a++)f=u[a],f.form===i.form&&p4(f)}break e;case"textarea":m4(i,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Lh(i,!!u.multiple,a,!1)}}}var Ay=!1;function y4(i,a,u){if(Ay)return i(a,u);Ay=!0;try{var f=i(a);return f}finally{if(Ay=!1,(Mh!==null||Oh!==null)&&(t1(),Mh&&(a=Mh,i=Oh,Oh=Mh=null,I3(a),i)))for(a=0;a<i.length;a++)I3(i[a])}}function uf(i,a){var u=i.stateNode;if(u===null)return null;var f=u[Or]||null;if(f===null)return null;u=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(u&&typeof u!="function")throw Error(Re(231,a,typeof u));return u}var ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mv=!1;if(ys)try{_h={},Object.defineProperty(_h,"passive",{get:function(){mv=!0}}),window.addEventListener("test",_h,_h),window.removeEventListener("test",_h,_h)}catch{mv=!1}var _h,fl=null,ab=null,tg=null;function v4(){if(tg)return tg;var i,a=ab,u=a.length,f,y="value"in fl?fl.value:fl.textContent,l=y.length;for(i=0;i<u&&a[i]===y[i];i++);var D=u-i;for(f=1;f<=D&&a[u-f]===y[l-f];f++);return tg=y.slice(i,1<f?1-f:void 0)}function ig(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function U0(){return!0}function k3(){return!1}function Br(i){function a(u,f,y,l,D){this._reactName=u,this._targetInst=y,this.type=f,this.nativeEvent=l,this.target=D,this.currentTarget=null;for(var B in i)i.hasOwnProperty(B)&&(u=i[B],this[B]=u?u(l):l[B]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?U0:k3,this.isPropagationStopped=k3,this}return Ei(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=U0)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=U0)},persist:function(){},isPersistent:U0}),a}var qc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gg=Br(qc),Af=Ei({},qc,{view:0,detail:0}),_8=Br(Af),zy,Dy,Fp,Zg=Ei({},Af,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ob,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Fp&&(Fp&&i.type==="mousemove"?(zy=i.screenX-Fp.screenX,Dy=i.screenY-Fp.screenY):Dy=zy=0,Fp=i),zy)},movementY:function(i){return"movementY"in i?i.movementY:Dy}}),L3=Br(Zg),y8=Ei({},Zg,{dataTransfer:0}),v8=Br(y8),b8=Ei({},Af,{relatedTarget:0}),Py=Br(b8),x8=Ei({},qc,{animationName:0,elapsedTime:0,pseudoElement:0}),w8=Br(x8),T8=Ei({},qc,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),S8=Br(T8),M8=Ei({},qc,{data:0}),O3=Br(M8),E8={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},C8={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},A8={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z8(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=A8[i])?!!a[i]:!1}function ob(){return z8}var D8=Ei({},Af,{key:function(i){if(i.key){var a=E8[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=ig(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?C8[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ob,charCode:function(i){return i.type==="keypress"?ig(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?ig(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),P8=Br(D8),R8=Ei({},Zg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),B3=Br(R8),I8=Ei({},Af,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ob}),k8=Br(I8),L8=Ei({},qc,{propertyName:0,elapsedTime:0,pseudoElement:0}),O8=Br(L8),B8=Ei({},Zg,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),F8=Br(B8),N8=Ei({},qc,{newState:0,oldState:0}),U8=Br(N8),V8=[9,13,27,32],sb=ys&&"CompositionEvent"in window,Yp=null;ys&&"documentMode"in document&&(Yp=document.documentMode);var j8=ys&&"TextEvent"in window&&!Yp,b4=ys&&(!sb||Yp&&8<Yp&&11>=Yp),F3=" ",N3=!1;function x4(i,a){switch(i){case"keyup":return V8.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function w4(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Eh=!1;function q8(i,a){switch(i){case"compositionend":return w4(a);case"keypress":return a.which!==32?null:(N3=!0,F3);case"textInput":return i=a.data,i===F3&&N3?null:i;default:return null}}function G8(i,a){if(Eh)return i==="compositionend"||!sb&&x4(i,a)?(i=v4(),tg=ab=fl=null,Eh=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return b4&&a.locale!=="ko"?null:a.data;default:return null}}var Z8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function U3(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!Z8[i.type]:a==="textarea"}function T4(i,a,u,f){Mh?Oh?Oh.push(f):Oh=[f]:Mh=f,a=Og(a,"onChange"),0<a.length&&(u=new Gg("onChange","change",null,u,f),i.push({event:u,listeners:a}))}var Wp=null,hf=null;function H8(i){yS(i,0)}function Hg(i){var a=Hp(i);if(p4(a))return i}function V3(i,a){if(i==="change")return a}var S4=!1;ys&&(ys?(j0="oninput"in document,j0||(Ry=document.createElement("div"),Ry.setAttribute("oninput","return;"),j0=typeof Ry.oninput=="function"),V0=j0):V0=!1,S4=V0&&(!document.documentMode||9<document.documentMode));var V0,j0,Ry;function j3(){Wp&&(Wp.detachEvent("onpropertychange",M4),hf=Wp=null)}function M4(i){if(i.propertyName==="value"&&Hg(hf)){var a=[];T4(a,hf,i,rb(i)),y4(H8,a)}}function $8(i,a,u){i==="focusin"?(j3(),Wp=a,hf=u,Wp.attachEvent("onpropertychange",M4)):i==="focusout"&&j3()}function X8(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Hg(hf)}function Y8(i,a){if(i==="click")return Hg(a)}function W8(i,a){if(i==="input"||i==="change")return Hg(a)}function K8(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var oa=typeof Object.is=="function"?Object.is:K8;function df(i,a){if(oa(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var u=Object.keys(i),f=Object.keys(a);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var y=u[f];if(!cv.call(a,y)||!oa(i[y],a[y]))return!1}return!0}function q3(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function G3(i,a){var u=q3(i);i=0;for(var f;u;){if(u.nodeType===3){if(f=i+u.textContent.length,i<=a&&f>=a)return{node:u,offset:a-i};i=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=q3(u)}}function E4(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?E4(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function C4(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=yg(i.document);a instanceof i.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)i=a.contentWindow;else break;a=yg(i.document)}return a}function lb(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var Q8=ys&&"documentMode"in document&&11>=document.documentMode,Ch=null,gv=null,Kp=null,_v=!1;function Z3(i,a,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;_v||Ch==null||Ch!==yg(f)||(f=Ch,"selectionStart"in f&&lb(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Kp&&df(Kp,f)||(Kp=f,f=Og(gv,"onSelect"),0<f.length&&(a=new Gg("onSelect","select",null,a,u),i.push({event:a,listeners:f}),a.target=Ch)))}function Cc(i,a){var u={};return u[i.toLowerCase()]=a.toLowerCase(),u["Webkit"+i]="webkit"+a,u["Moz"+i]="moz"+a,u}var Ah={animationend:Cc("Animation","AnimationEnd"),animationiteration:Cc("Animation","AnimationIteration"),animationstart:Cc("Animation","AnimationStart"),transitionrun:Cc("Transition","TransitionRun"),transitionstart:Cc("Transition","TransitionStart"),transitioncancel:Cc("Transition","TransitionCancel"),transitionend:Cc("Transition","TransitionEnd")},Iy={},A4={};ys&&(A4=document.createElement("div").style,"AnimationEvent"in window||(delete Ah.animationend.animation,delete Ah.animationiteration.animation,delete Ah.animationstart.animation),"TransitionEvent"in window||delete Ah.transitionend.transition);function Gc(i){if(Iy[i])return Iy[i];if(!Ah[i])return i;var a=Ah[i],u;for(u in a)if(a.hasOwnProperty(u)&&u in A4)return Iy[i]=a[u];return i}var z4=Gc("animationend"),D4=Gc("animationiteration"),P4=Gc("animationstart"),J8=Gc("transitionrun"),eA=Gc("transitionstart"),tA=Gc("transitioncancel"),R4=Gc("transitionend"),I4=new Map,yv="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yv.push("scrollEnd");function Xa(i,a){I4.set(i,a),jc(a,[i])}var vg=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},va=[],zh=0,cb=0;function $g(){for(var i=zh,a=cb=zh=0;a<i;){var u=va[a];va[a++]=null;var f=va[a];va[a++]=null;var y=va[a];va[a++]=null;var l=va[a];if(va[a++]=null,f!==null&&y!==null){var D=f.pending;D===null?y.next=y:(y.next=D.next,D.next=y),f.pending=y}l!==0&&k4(u,y,l)}}function Xg(i,a,u,f){va[zh++]=i,va[zh++]=a,va[zh++]=u,va[zh++]=f,cb|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function ub(i,a,u,f){return Xg(i,a,u,f),bg(i)}function Zc(i,a){return Xg(i,null,null,a),bg(i)}function k4(i,a,u){i.lanes|=u;var f=i.alternate;f!==null&&(f.lanes|=u);for(var y=!1,l=i.return;l!==null;)l.childLanes|=u,f=l.alternate,f!==null&&(f.childLanes|=u),l.tag===22&&(i=l.stateNode,i===null||i._visibility&1||(y=!0)),i=l,l=l.return;return i.tag===3?(l=i.stateNode,y&&a!==null&&(y=31-ra(u),i=l.hiddenUpdates,f=i[y],f===null?i[y]=[a]:f.push(a),a.lane=u|536870912),l):null}function bg(i){if(50<sf)throw sf=0,Nv=null,Error(Re(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var Dh={};function iA(i,a,u,f){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ea(i,a,u,f){return new iA(i,a,u,f)}function hb(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ms(i,a){var u=i.alternate;return u===null?(u=ea(i.tag,a,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=a,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&65011712,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,a=i.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u.refCleanup=i.refCleanup,u}function L4(i,a){i.flags&=65011714;var u=i.alternate;return u===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=u.childLanes,i.lanes=u.lanes,i.child=u.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=u.memoizedProps,i.memoizedState=u.memoizedState,i.updateQueue=u.updateQueue,i.type=u.type,a=u.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function ng(i,a,u,f,y,l){var D=0;if(f=i,typeof i=="function")hb(i)&&(D=1);else if(typeof i=="string")D=az(i,u,wo.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case av:return i=ea(31,u,a,y),i.elementType=av,i.lanes=l,i;case wh:return Ic(u.children,y,l,a);case e4:D=8,y|=24;break;case iv:return i=ea(12,u,a,y|2),i.elementType=iv,i.lanes=l,i;case nv:return i=ea(13,u,a,y),i.elementType=nv,i.lanes=l,i;case rv:return i=ea(19,u,a,y),i.elementType=rv,i.lanes=l,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case ds:D=10;break e;case t4:D=9;break e;case Kv:D=11;break e;case Qv:D=14;break e;case sl:D=16,f=null;break e}D=29,u=Error(Re(130,i===null?"null":typeof i,"")),f=null}return a=ea(D,u,a,y),a.elementType=i,a.type=f,a.lanes=l,a}function Ic(i,a,u,f){return i=ea(7,i,f,a),i.lanes=u,i}function ky(i,a,u){return i=ea(6,i,null,a),i.lanes=u,i}function O4(i){var a=ea(18,null,null,0);return a.stateNode=i,a}function Ly(i,a,u){return a=ea(4,i.children!==null?i.children:[],i.key,a),a.lanes=u,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var H3=new WeakMap;function Sa(i,a){if(typeof i=="object"&&i!==null){var u=H3.get(i);return u!==void 0?u:(a={value:i,source:a,stack:C3(a)},H3.set(i,a),a)}return{value:i,source:a,stack:C3(a)}}var Ph=[],Rh=0,xg=null,pf=0,xa=[],wa=0,Cl=null,vo=1,bo="";function us(i,a){Ph[Rh++]=pf,Ph[Rh++]=xg,xg=i,pf=a}function B4(i,a,u){xa[wa++]=vo,xa[wa++]=bo,xa[wa++]=Cl,Cl=i;var f=vo;i=bo;var y=32-ra(f)-1;f&=~(1<<y),u+=1;var l=32-ra(a)+y;if(30<l){var D=y-y%5;l=(f&(1<<D)-1).toString(32),f>>=D,y-=D,vo=1<<32-ra(a)+y|u<<y|f,bo=l+i}else vo=1<<l|u<<y|f,bo=i}function db(i){i.return!==null&&(us(i,1),B4(i,1,0))}function pb(i){for(;i===xg;)xg=Ph[--Rh],Ph[Rh]=null,pf=Ph[--Rh],Ph[Rh]=null;for(;i===Cl;)Cl=xa[--wa],xa[wa]=null,bo=xa[--wa],xa[wa]=null,vo=xa[--wa],xa[wa]=null}function F4(i,a){xa[wa++]=vo,xa[wa++]=bo,xa[wa++]=Cl,vo=a.id,bo=a.overflow,Cl=i}var Wn=null,Mi=null,Pt=!1,vl=null,Ma=!1,vv=Error(Re(519));function Al(i){var a=Error(Re(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ff(Sa(a,i)),vv}function $3(i){var a=i.stateNode,u=i.type,f=i.memoizedProps;switch(a[Yn]=i,a[Or]=f,u){case"dialog":Tt("cancel",a),Tt("close",a);break;case"iframe":case"object":case"embed":Tt("load",a);break;case"video":case"audio":for(u=0;u<yf.length;u++)Tt(yf[u],a);break;case"source":Tt("error",a);break;case"img":case"image":case"link":Tt("error",a),Tt("load",a);break;case"details":Tt("toggle",a);break;case"input":Tt("invalid",a),f4(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Tt("invalid",a);break;case"textarea":Tt("invalid",a),g4(a,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||f.suppressHydrationWarning===!0||bS(a.textContent,u)?(f.popover!=null&&(Tt("beforetoggle",a),Tt("toggle",a)),f.onScroll!=null&&Tt("scroll",a),f.onScrollEnd!=null&&Tt("scrollend",a),f.onClick!=null&&(a.onclick=ps),a=!0):a=!1,a||Al(i,!0)}function X3(i){for(Wn=i.return;Wn;)switch(Wn.tag){case 5:case 31:case 13:Ma=!1;return;case 27:case 3:Ma=!0;return;default:Wn=Wn.return}}function yh(i){if(i!==Wn)return!1;if(!Pt)return X3(i),Pt=!0,!1;var a=i.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=i.type,u=!(u!=="form"&&u!=="button")||Gv(i.type,i.memoizedProps)),u=!u),u&&Mi&&Al(i),X3(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Re(317));Mi=O5(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Re(317));Mi=O5(i)}else a===27?(a=Mi,Rl(i.type)?(i=Xv,Xv=null,Mi=i):Mi=a):Mi=Wn?Ca(i.stateNode.nextSibling):null;return!0}function Bc(){Mi=Wn=null,Pt=!1}function Oy(){var i=vl;return i!==null&&(kr===null?kr=i:kr.push.apply(kr,i),vl=null),i}function ff(i){vl===null?vl=[i]:vl.push(i)}var bv=To(null),Hc=null,fs=null;function cl(i,a,u){yi(bv,a._currentValue),a._currentValue=u}function gs(i){i._currentValue=bv.current,Fn(bv)}function xv(i,a,u){for(;i!==null;){var f=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),i===u)break;i=i.return}}function wv(i,a,u,f){var y=i.child;for(y!==null&&(y.return=i);y!==null;){var l=y.dependencies;if(l!==null){var D=y.child;l=l.firstContext;e:for(;l!==null;){var B=l;l=y;for(var q=0;q<a.length;q++)if(B.context===a[q]){l.lanes|=u,B=l.alternate,B!==null&&(B.lanes|=u),xv(l.return,u,i),f||(D=null);break e}l=B.next}}else if(y.tag===18){if(D=y.return,D===null)throw Error(Re(341));D.lanes|=u,l=D.alternate,l!==null&&(l.lanes|=u),xv(D,u,i),D=null}else D=y.child;if(D!==null)D.return=y;else for(D=y;D!==null;){if(D===i){D=null;break}if(y=D.sibling,y!==null){y.return=D.return,D=y;break}D=D.return}y=D}}function ed(i,a,u,f){i=null;for(var y=a,l=!1;y!==null;){if(!l){if((y.flags&524288)!==0)l=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var D=y.alternate;if(D===null)throw Error(Re(387));if(D=D.memoizedProps,D!==null){var B=y.type;oa(y.pendingProps.value,D.value)||(i!==null?i.push(B):i=[B])}}else if(y===fg.current){if(D=y.alternate,D===null)throw Error(Re(387));D.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(i!==null?i.push(bf):i=[bf])}y=y.return}i!==null&&wv(a,i,u,f),a.flags|=262144}function wg(i){for(i=i.firstContext;i!==null;){if(!oa(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Fc(i){Hc=i,fs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Kn(i){return N4(Hc,i)}function q0(i,a){return Hc===null&&Fc(i),N4(i,a)}function N4(i,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},fs===null){if(i===null)throw Error(Re(308));fs=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else fs=fs.next=a;return u}var nA=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(u,f){i.push(f)}};this.abort=function(){a.aborted=!0,i.forEach(function(u){return u()})}},rA=Tn.unstable_scheduleCallback,aA=Tn.unstable_NormalPriority,un={$$typeof:ds,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fb(){return{controller:new nA,data:new Map,refCount:0}}function zf(i){i.refCount--,i.refCount===0&&rA(aA,function(){i.controller.abort()})}var Qp=null,Tv=0,Gh=0,Bh=null;function oA(i,a){if(Qp===null){var u=Qp=[];Tv=0,Gh=Nb(),Bh={status:"pending",value:void 0,then:function(f){u.push(f)}}}return Tv++,a.then(Y3,Y3),a}function Y3(){if(--Tv===0&&Qp!==null){Bh!==null&&(Bh.status="fulfilled");var i=Qp;Qp=null,Gh=0,Bh=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function sA(i,a){var u=[],f={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return i.then(function(){f.status="fulfilled",f.value=a;for(var y=0;y<u.length;y++)(0,u[y])(a)},function(y){for(f.status="rejected",f.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),f}var W3=ct.S;ct.S=function(i,a){JT=ia(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&oA(i,a),W3!==null&&W3(i,a)};var kc=To(null);function mb(){var i=kc.current;return i!==null?i:ui.pooledCache}function rg(i,a){a===null?yi(kc,kc.current):yi(kc,a.pool)}function U4(){var i=mb();return i===null?null:{parent:un._currentValue,pool:i}}var td=Error(Re(460)),gb=Error(Re(474)),Yg=Error(Re(542)),Tg={then:function(){}};function K3(i){return i=i.status,i==="fulfilled"||i==="rejected"}function V4(i,a,u){switch(u=i[u],u===void 0?i.push(a):u!==a&&(a.then(ps,ps),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,J3(i),i;default:if(typeof a.status=="string")a.then(ps,ps);else{if(i=ui,i!==null&&100<i.shellSuspendCounter)throw Error(Re(482));i=a,i.status="pending",i.then(function(f){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=f}},function(f){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,J3(i),i}throw Lc=a,td}}function Dc(i){try{var a=i._init;return a(i._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Lc=u,td):u}}var Lc=null;function Q3(){if(Lc===null)throw Error(Re(459));var i=Lc;return Lc=null,i}function J3(i){if(i===td||i===Yg)throw Error(Re(483))}var Fh=null,mf=0;function G0(i){var a=mf;return mf+=1,Fh===null&&(Fh=[]),V4(Fh,i,a)}function Np(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function Z0(i,a){throw a.$$typeof===$C?Error(Re(525)):(i=Object.prototype.toString.call(a),Error(Re(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function j4(i){function a(se,le){if(i){var pe=se.deletions;pe===null?(se.deletions=[le],se.flags|=16):pe.push(le)}}function u(se,le){if(!i)return null;for(;le!==null;)a(se,le),le=le.sibling;return null}function f(se){for(var le=new Map;se!==null;)se.key!==null?le.set(se.key,se):le.set(se.index,se),se=se.sibling;return le}function y(se,le){return se=ms(se,le),se.index=0,se.sibling=null,se}function l(se,le,pe){return se.index=pe,i?(pe=se.alternate,pe!==null?(pe=pe.index,pe<le?(se.flags|=67108866,le):pe):(se.flags|=67108866,le)):(se.flags|=1048576,le)}function D(se){return i&&se.alternate===null&&(se.flags|=67108866),se}function B(se,le,pe,ge){return le===null||le.tag!==6?(le=ky(pe,se.mode,ge),le.return=se,le):(le=y(le,pe),le.return=se,le)}function q(se,le,pe,ge){var Be=pe.type;return Be===wh?fe(se,le,pe.props.children,ge,pe.key):le!==null&&(le.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===sl&&Dc(Be)===le.type)?(le=y(le,pe.props),Np(le,pe),le.return=se,le):(le=ng(pe.type,pe.key,pe.props,null,se.mode,ge),Np(le,pe),le.return=se,le)}function K(se,le,pe,ge){return le===null||le.tag!==4||le.stateNode.containerInfo!==pe.containerInfo||le.stateNode.implementation!==pe.implementation?(le=Ly(pe,se.mode,ge),le.return=se,le):(le=y(le,pe.children||[]),le.return=se,le)}function fe(se,le,pe,ge,Be){return le===null||le.tag!==7?(le=Ic(pe,se.mode,ge,Be),le.return=se,le):(le=y(le,pe),le.return=se,le)}function de(se,le,pe){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=ky(""+le,se.mode,pe),le.return=se,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case L0:return pe=ng(le.type,le.key,le.props,null,se.mode,pe),Np(pe,le),pe.return=se,pe;case Gp:return le=Ly(le,se.mode,pe),le.return=se,le;case sl:return le=Dc(le),de(se,le,pe)}if(Zp(le)||Bp(le))return le=Ic(le,se.mode,pe,null),le.return=se,le;if(typeof le.then=="function")return de(se,G0(le),pe);if(le.$$typeof===ds)return de(se,q0(se,le),pe);Z0(se,le)}return null}function oe(se,le,pe,ge){var Be=le!==null?le.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return Be!==null?null:B(se,le,""+pe,ge);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case L0:return pe.key===Be?q(se,le,pe,ge):null;case Gp:return pe.key===Be?K(se,le,pe,ge):null;case sl:return pe=Dc(pe),oe(se,le,pe,ge)}if(Zp(pe)||Bp(pe))return Be!==null?null:fe(se,le,pe,ge,null);if(typeof pe.then=="function")return oe(se,le,G0(pe),ge);if(pe.$$typeof===ds)return oe(se,le,q0(se,pe),ge);Z0(se,pe)}return null}function ce(se,le,pe,ge,Be){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return se=se.get(pe)||null,B(le,se,""+ge,Be);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case L0:return se=se.get(ge.key===null?pe:ge.key)||null,q(le,se,ge,Be);case Gp:return se=se.get(ge.key===null?pe:ge.key)||null,K(le,se,ge,Be);case sl:return ge=Dc(ge),ce(se,le,pe,ge,Be)}if(Zp(ge)||Bp(ge))return se=se.get(pe)||null,fe(le,se,ge,Be,null);if(typeof ge.then=="function")return ce(se,le,pe,G0(ge),Be);if(ge.$$typeof===ds)return ce(se,le,pe,q0(le,ge),Be);Z0(le,ge)}return null}function ke(se,le,pe,ge){for(var Be=null,qe=null,Z=le,Y=le=0,ne=null;Z!==null&&Y<pe.length;Y++){Z.index>Y?(ne=Z,Z=null):ne=Z.sibling;var xe=oe(se,Z,pe[Y],ge);if(xe===null){Z===null&&(Z=ne);break}i&&Z&&xe.alternate===null&&a(se,Z),le=l(xe,le,Y),qe===null?Be=xe:qe.sibling=xe,qe=xe,Z=ne}if(Y===pe.length)return u(se,Z),Pt&&us(se,Y),Be;if(Z===null){for(;Y<pe.length;Y++)Z=de(se,pe[Y],ge),Z!==null&&(le=l(Z,le,Y),qe===null?Be=Z:qe.sibling=Z,qe=Z);return Pt&&us(se,Y),Be}for(Z=f(Z);Y<pe.length;Y++)ne=ce(Z,se,Y,pe[Y],ge),ne!==null&&(i&&ne.alternate!==null&&Z.delete(ne.key===null?Y:ne.key),le=l(ne,le,Y),qe===null?Be=ne:qe.sibling=ne,qe=ne);return i&&Z.forEach(function(Fe){return a(se,Fe)}),Pt&&us(se,Y),Be}function Ne(se,le,pe,ge){if(pe==null)throw Error(Re(151));for(var Be=null,qe=null,Z=le,Y=le=0,ne=null,xe=pe.next();Z!==null&&!xe.done;Y++,xe=pe.next()){Z.index>Y?(ne=Z,Z=null):ne=Z.sibling;var Fe=oe(se,Z,xe.value,ge);if(Fe===null){Z===null&&(Z=ne);break}i&&Z&&Fe.alternate===null&&a(se,Z),le=l(Fe,le,Y),qe===null?Be=Fe:qe.sibling=Fe,qe=Fe,Z=ne}if(xe.done)return u(se,Z),Pt&&us(se,Y),Be;if(Z===null){for(;!xe.done;Y++,xe=pe.next())xe=de(se,xe.value,ge),xe!==null&&(le=l(xe,le,Y),qe===null?Be=xe:qe.sibling=xe,qe=xe);return Pt&&us(se,Y),Be}for(Z=f(Z);!xe.done;Y++,xe=pe.next())xe=ce(Z,se,Y,xe.value,ge),xe!==null&&(i&&xe.alternate!==null&&Z.delete(xe.key===null?Y:xe.key),le=l(xe,le,Y),qe===null?Be=xe:qe.sibling=xe,qe=xe);return i&&Z.forEach(function(Ye){return a(se,Ye)}),Pt&&us(se,Y),Be}function ve(se,le,pe,ge){if(typeof pe=="object"&&pe!==null&&pe.type===wh&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case L0:e:{for(var Be=pe.key;le!==null;){if(le.key===Be){if(Be=pe.type,Be===wh){if(le.tag===7){u(se,le.sibling),ge=y(le,pe.props.children),ge.return=se,se=ge;break e}}else if(le.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===sl&&Dc(Be)===le.type){u(se,le.sibling),ge=y(le,pe.props),Np(ge,pe),ge.return=se,se=ge;break e}u(se,le);break}else a(se,le);le=le.sibling}pe.type===wh?(ge=Ic(pe.props.children,se.mode,ge,pe.key),ge.return=se,se=ge):(ge=ng(pe.type,pe.key,pe.props,null,se.mode,ge),Np(ge,pe),ge.return=se,se=ge)}return D(se);case Gp:e:{for(Be=pe.key;le!==null;){if(le.key===Be)if(le.tag===4&&le.stateNode.containerInfo===pe.containerInfo&&le.stateNode.implementation===pe.implementation){u(se,le.sibling),ge=y(le,pe.children||[]),ge.return=se,se=ge;break e}else{u(se,le);break}else a(se,le);le=le.sibling}ge=Ly(pe,se.mode,ge),ge.return=se,se=ge}return D(se);case sl:return pe=Dc(pe),ve(se,le,pe,ge)}if(Zp(pe))return ke(se,le,pe,ge);if(Bp(pe)){if(Be=Bp(pe),typeof Be!="function")throw Error(Re(150));return pe=Be.call(pe),Ne(se,le,pe,ge)}if(typeof pe.then=="function")return ve(se,le,G0(pe),ge);if(pe.$$typeof===ds)return ve(se,le,q0(se,pe),ge);Z0(se,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,le!==null&&le.tag===6?(u(se,le.sibling),ge=y(le,pe),ge.return=se,se=ge):(u(se,le),ge=ky(pe,se.mode,ge),ge.return=se,se=ge),D(se)):u(se,le)}return function(se,le,pe,ge){try{mf=0;var Be=ve(se,le,pe,ge);return Fh=null,Be}catch(Z){if(Z===td||Z===Yg)throw Z;var qe=ea(29,Z,null,se.mode);return qe.lanes=ge,qe.return=se,qe}}}var Nc=j4(!0),q4=j4(!1),ll=!1;function _b(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sv(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function bl(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function xl(i,a,u){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(qt&2)!==0){var y=f.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),f.pending=a,a=bg(i),k4(i,null,u),a}return Xg(i,f,a,u),bg(i)}function Jp(i,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var f=a.lanes;f&=i.pendingLanes,u|=f,a.lanes=u,s4(i,u)}}function By(i,a){var u=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var y=null,l=null;if(u=u.firstBaseUpdate,u!==null){do{var D={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};l===null?y=l=D:l=l.next=D,u=u.next}while(u!==null);l===null?y=l=a:l=l.next=a}else y=l=a;u={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:l,shared:f.shared,callbacks:f.callbacks},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=a:i.next=a,u.lastBaseUpdate=a}var Mv=!1;function ef(){if(Mv){var i=Bh;if(i!==null)throw i}}function tf(i,a,u,f){Mv=!1;var y=i.updateQueue;ll=!1;var l=y.firstBaseUpdate,D=y.lastBaseUpdate,B=y.shared.pending;if(B!==null){y.shared.pending=null;var q=B,K=q.next;q.next=null,D===null?l=K:D.next=K,D=q;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,B=fe.lastBaseUpdate,B!==D&&(B===null?fe.firstBaseUpdate=K:B.next=K,fe.lastBaseUpdate=q))}if(l!==null){var de=y.baseState;D=0,fe=K=q=null,B=l;do{var oe=B.lane&-536870913,ce=oe!==B.lane;if(ce?(Mt&oe)===oe:(f&oe)===oe){oe!==0&&oe===Gh&&(Mv=!0),fe!==null&&(fe=fe.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var ke=i,Ne=B;oe=a;var ve=u;switch(Ne.tag){case 1:if(ke=Ne.payload,typeof ke=="function"){de=ke.call(ve,de,oe);break e}de=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Ne.payload,oe=typeof ke=="function"?ke.call(ve,de,oe):ke,oe==null)break e;de=Ei({},de,oe);break e;case 2:ll=!0}}oe=B.callback,oe!==null&&(i.flags|=64,ce&&(i.flags|=8192),ce=y.callbacks,ce===null?y.callbacks=[oe]:ce.push(oe))}else ce={lane:oe,tag:B.tag,payload:B.payload,callback:B.callback,next:null},fe===null?(K=fe=ce,q=de):fe=fe.next=ce,D|=oe;if(B=B.next,B===null){if(B=y.shared.pending,B===null)break;ce=B,B=ce.next,ce.next=null,y.lastBaseUpdate=ce,y.shared.pending=null}}while(!0);fe===null&&(q=de),y.baseState=q,y.firstBaseUpdate=K,y.lastBaseUpdate=fe,l===null&&(y.shared.lanes=0),Dl|=D,i.lanes=D,i.memoizedState=de}}function G4(i,a){if(typeof i!="function")throw Error(Re(191,i));i.call(a)}function Z4(i,a){var u=i.callbacks;if(u!==null)for(i.callbacks=null,i=0;i<u.length;i++)G4(u[i],a)}var Zh=To(null),Sg=To(0);function e5(i,a){i=ws,yi(Sg,i),yi(Zh,a),ws=i|a.baseLanes}function Ev(){yi(Sg,ws),yi(Zh,Zh.current)}function yb(){ws=Sg.current,Fn(Zh),Fn(Sg)}var sa=To(null),Ea=null;function ul(i){var a=i.alternate;yi(Wi,Wi.current&1),yi(sa,i),Ea===null&&(a===null||Zh.current!==null||a.memoizedState!==null)&&(Ea=i)}function Cv(i){yi(Wi,Wi.current),yi(sa,i),Ea===null&&(Ea=i)}function H4(i){i.tag===22?(yi(Wi,Wi.current),yi(sa,i),Ea===null&&(Ea=i)):hl(i)}function hl(){yi(Wi,Wi.current),yi(sa,sa.current)}function Jr(i){Fn(sa),Ea===i&&(Ea=null),Fn(Wi)}var Wi=To(0);function Mg(i){for(var a=i;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Hv(u)||$v(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var vs=0,_t=null,si=null,ln=null,Eg=!1,Nh=!1,Uc=!1,Cg=0,gf=0,Uh=null,lA=0;function Gi(){throw Error(Re(321))}function vb(i,a){if(a===null)return!1;for(var u=0;u<a.length&&u<i.length;u++)if(!oa(i[u],a[u]))return!1;return!0}function bb(i,a,u,f,y,l){return vs=l,_t=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,ct.H=i===null||i.memoizedState===null?TT:Pb,Uc=!1,l=u(f,y),Uc=!1,Nh&&(l=X4(a,u,f,y)),$4(i),l}function $4(i){ct.H=_f;var a=si!==null&&si.next!==null;if(vs=0,ln=si=_t=null,Eg=!1,gf=0,Uh=null,a)throw Error(Re(300));i===null||hn||(i=i.dependencies,i!==null&&wg(i)&&(hn=!0))}function X4(i,a,u,f){_t=i;var y=0;do{if(Nh&&(Uh=null),gf=0,Nh=!1,25<=y)throw Error(Re(301));if(y+=1,ln=si=null,i.updateQueue!=null){var l=i.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}ct.H=ST,l=a(u,f)}while(Nh);return l}function cA(){var i=ct.H,a=i.useState()[0];return a=typeof a.then=="function"?Df(a):a,i=i.useState()[0],(si!==null?si.memoizedState:null)!==i&&(_t.flags|=1024),a}function xb(){var i=Cg!==0;return Cg=0,i}function wb(i,a,u){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~u}function Tb(i){if(Eg){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Eg=!1}vs=0,ln=si=_t=null,Nh=!1,gf=Cg=0,Uh=null}function xr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?_t.memoizedState=ln=i:ln=ln.next=i,ln}function Ki(){if(si===null){var i=_t.alternate;i=i!==null?i.memoizedState:null}else i=si.next;var a=ln===null?_t.memoizedState:ln.next;if(a!==null)ln=a,si=i;else{if(i===null)throw _t.alternate===null?Error(Re(467)):Error(Re(310));si=i,i={memoizedState:si.memoizedState,baseState:si.baseState,baseQueue:si.baseQueue,queue:si.queue,next:null},ln===null?_t.memoizedState=ln=i:ln=ln.next=i}return ln}function Wg(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Df(i){var a=gf;return gf+=1,Uh===null&&(Uh=[]),i=V4(Uh,i,a),a=_t,(ln===null?a.memoizedState:ln.next)===null&&(a=a.alternate,ct.H=a===null||a.memoizedState===null?TT:Pb),i}function Kg(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Df(i);if(i.$$typeof===ds)return Kn(i)}throw Error(Re(438,String(i)))}function Sb(i){var a=null,u=_t.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var f=_t.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=Wg(),_t.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(i),f=0;f<i;f++)u[f]=XC;return a.index++,u}function bs(i,a){return typeof a=="function"?a(i):a}function ag(i){var a=Ki();return Mb(a,si,i)}function Mb(i,a,u){var f=i.queue;if(f===null)throw Error(Re(311));f.lastRenderedReducer=u;var y=i.baseQueue,l=f.pending;if(l!==null){if(y!==null){var D=y.next;y.next=l.next,l.next=D}a.baseQueue=y=l,f.pending=null}if(l=i.baseState,y===null)i.memoizedState=l;else{a=y.next;var B=D=null,q=null,K=a,fe=!1;do{var de=K.lane&-536870913;if(de!==K.lane?(Mt&de)===de:(vs&de)===de){var oe=K.revertLane;if(oe===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),de===Gh&&(fe=!0);else if((vs&oe)===oe){K=K.next,oe===Gh&&(fe=!0);continue}else de={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},q===null?(B=q=de,D=l):q=q.next=de,_t.lanes|=oe,Dl|=oe;de=K.action,Uc&&u(l,de),l=K.hasEagerState?K.eagerState:u(l,de)}else oe={lane:de,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},q===null?(B=q=oe,D=l):q=q.next=oe,_t.lanes|=de,Dl|=de;K=K.next}while(K!==null&&K!==a);if(q===null?D=l:q.next=B,!oa(l,i.memoizedState)&&(hn=!0,fe&&(u=Bh,u!==null)))throw u;i.memoizedState=l,i.baseState=D,i.baseQueue=q,f.lastRenderedState=l}return y===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function Fy(i){var a=Ki(),u=a.queue;if(u===null)throw Error(Re(311));u.lastRenderedReducer=i;var f=u.dispatch,y=u.pending,l=a.memoizedState;if(y!==null){u.pending=null;var D=y=y.next;do l=i(l,D.action),D=D.next;while(D!==y);oa(l,a.memoizedState)||(hn=!0),a.memoizedState=l,a.baseQueue===null&&(a.baseState=l),u.lastRenderedState=l}return[l,f]}function Y4(i,a,u){var f=_t,y=Ki(),l=Pt;if(l){if(u===void 0)throw Error(Re(407));u=u()}else u=a();var D=!oa((si||y).memoizedState,u);if(D&&(y.memoizedState=u,hn=!0),y=y.queue,Eb(Q4.bind(null,f,y,i),[i]),y.getSnapshot!==a||D||ln!==null&&ln.memoizedState.tag&1){if(f.flags|=2048,Hh(9,{destroy:void 0},K4.bind(null,f,y,u,a),null),ui===null)throw Error(Re(349));l||(vs&127)!==0||W4(f,a,u)}return u}function W4(i,a,u){i.flags|=16384,i={getSnapshot:a,value:u},a=_t.updateQueue,a===null?(a=Wg(),_t.updateQueue=a,a.stores=[i]):(u=a.stores,u===null?a.stores=[i]:u.push(i))}function K4(i,a,u,f){a.value=u,a.getSnapshot=f,J4(a)&&eT(i)}function Q4(i,a,u){return u(function(){J4(a)&&eT(i)})}function J4(i){var a=i.getSnapshot;i=i.value;try{var u=a();return!oa(i,u)}catch{return!0}}function eT(i){var a=Zc(i,2);a!==null&&Lr(a,i,2)}function Av(i){var a=xr();if(typeof i=="function"){var u=i;if(i=u(),Uc){pl(!0);try{u()}finally{pl(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:i},a}function tT(i,a,u,f){return i.baseState=u,Mb(i,si,typeof f=="function"?f:bs)}function uA(i,a,u,f,y){if(Jg(i))throw Error(Re(485));if(i=a.action,i!==null){var l={payload:y,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){l.listeners.push(D)}};ct.T!==null?u(!0):l.isTransition=!1,f(l),u=a.pending,u===null?(l.next=a.pending=l,iT(a,l)):(l.next=u.next,a.pending=u.next=l)}}function iT(i,a){var u=a.action,f=a.payload,y=i.state;if(a.isTransition){var l=ct.T,D={};ct.T=D;try{var B=u(y,f),q=ct.S;q!==null&&q(D,B),t5(i,a,B)}catch(K){zv(i,a,K)}finally{l!==null&&D.types!==null&&(l.types=D.types),ct.T=l}}else try{l=u(y,f),t5(i,a,l)}catch(K){zv(i,a,K)}}function t5(i,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){i5(i,a,f)},function(f){return zv(i,a,f)}):i5(i,a,u)}function i5(i,a,u){a.status="fulfilled",a.value=u,nT(a),i.state=u,a=i.pending,a!==null&&(u=a.next,u===a?i.pending=null:(u=u.next,a.next=u,iT(i,u)))}function zv(i,a,u){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=u,nT(a),a=a.next;while(a!==f)}i.action=null}function nT(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function rT(i,a){return a}function n5(i,a){if(Pt){var u=ui.formState;if(u!==null){e:{var f=_t;if(Pt){if(Mi){t:{for(var y=Mi,l=Ma;y.nodeType!==8;){if(!l){y=null;break t}if(y=Ca(y.nextSibling),y===null){y=null;break t}}l=y.data,y=l==="F!"||l==="F"?y:null}if(y){Mi=Ca(y.nextSibling),f=y.data==="F!";break e}}Al(f)}f=!1}f&&(a=u[0])}}return u=xr(),u.memoizedState=u.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rT,lastRenderedState:a},u.queue=f,u=bT.bind(null,_t,f),f.dispatch=u,f=Av(!1),l=Db.bind(null,_t,!1,f.queue),f=xr(),y={state:a,dispatch:null,action:i,pending:null},f.queue=y,u=uA.bind(null,_t,y,l,u),y.dispatch=u,f.memoizedState=i,[a,u,!1]}function r5(i){var a=Ki();return aT(a,si,i)}function aT(i,a,u){if(a=Mb(i,a,rT)[0],i=ag(bs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Df(a)}catch(D){throw D===td?Yg:D}else f=a;a=Ki();var y=a.queue,l=y.dispatch;return u!==a.memoizedState&&(_t.flags|=2048,Hh(9,{destroy:void 0},hA.bind(null,y,u),null)),[f,l,i]}function hA(i,a){i.action=a}function a5(i){var a=Ki(),u=si;if(u!==null)return aT(a,u,i);Ki(),a=a.memoizedState,u=Ki();var f=u.queue.dispatch;return u.memoizedState=i,[a,f,!1]}function Hh(i,a,u,f){return i={tag:i,create:u,deps:f,inst:a,next:null},a=_t.updateQueue,a===null&&(a=Wg(),_t.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=i.next=i:(f=u.next,u.next=i,i.next=f,a.lastEffect=i),i}function oT(){return Ki().memoizedState}function og(i,a,u,f){var y=xr();_t.flags|=i,y.memoizedState=Hh(1|a,{destroy:void 0},u,f===void 0?null:f)}function Qg(i,a,u,f){var y=Ki();f=f===void 0?null:f;var l=y.memoizedState.inst;si!==null&&f!==null&&vb(f,si.memoizedState.deps)?y.memoizedState=Hh(a,l,u,f):(_t.flags|=i,y.memoizedState=Hh(1|a,l,u,f))}function o5(i,a){og(8390656,8,i,a)}function Eb(i,a){Qg(2048,8,i,a)}function dA(i){_t.flags|=4;var a=_t.updateQueue;if(a===null)a=Wg(),_t.updateQueue=a,a.events=[i];else{var u=a.events;u===null?a.events=[i]:u.push(i)}}function sT(i){var a=Ki().memoizedState;return dA({ref:a,nextImpl:i}),function(){if((qt&2)!==0)throw Error(Re(440));return a.impl.apply(void 0,arguments)}}function lT(i,a){return Qg(4,2,i,a)}function cT(i,a){return Qg(4,4,i,a)}function uT(i,a){if(typeof a=="function"){i=i();var u=a(i);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function hT(i,a,u){u=u!=null?u.concat([i]):null,Qg(4,4,uT.bind(null,a,i),u)}function Cb(){}function dT(i,a){var u=Ki();a=a===void 0?null:a;var f=u.memoizedState;return a!==null&&vb(a,f[1])?f[0]:(u.memoizedState=[i,a],i)}function pT(i,a){var u=Ki();a=a===void 0?null:a;var f=u.memoizedState;if(a!==null&&vb(a,f[1]))return f[0];if(f=i(),Uc){pl(!0);try{i()}finally{pl(!1)}}return u.memoizedState=[f,a],f}function Ab(i,a,u){return u===void 0||(vs&1073741824)!==0&&(Mt&261930)===0?i.memoizedState=a:(i.memoizedState=u,i=tS(),_t.lanes|=i,Dl|=i,u)}function fT(i,a,u,f){return oa(u,a)?u:Zh.current!==null?(i=Ab(i,u,f),oa(i,a)||(hn=!0),i):(vs&42)===0||(vs&1073741824)!==0&&(Mt&261930)===0?(hn=!0,i.memoizedState=u):(i=tS(),_t.lanes|=i,Dl|=i,a)}function mT(i,a,u,f,y){var l=Gt.p;Gt.p=l!==0&&8>l?l:8;var D=ct.T,B={};ct.T=B,Db(i,!1,a,u);try{var q=y(),K=ct.S;if(K!==null&&K(B,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var fe=sA(q,f);nf(i,a,fe,aa(i))}else nf(i,a,f,aa(i))}catch(de){nf(i,a,{then:function(){},status:"rejected",reason:de},aa())}finally{Gt.p=l,D!==null&&B.types!==null&&(D.types=B.types),ct.T=D}}function pA(){}function Dv(i,a,u,f){if(i.tag!==5)throw Error(Re(476));var y=gT(i).queue;mT(i,y,a,Rc,u===null?pA:function(){return _T(i),u(f)})}function gT(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:Rc,baseState:Rc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:Rc},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:u},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function _T(i){var a=gT(i);a.next===null&&(a=i.alternate.memoizedState),nf(i,a.next.queue,{},aa())}function zb(){return Kn(bf)}function yT(){return Ki().memoizedState}function vT(){return Ki().memoizedState}function fA(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var u=aa();i=bl(u);var f=xl(a,i,u);f!==null&&(Lr(f,a,u),Jp(f,a,u)),a={cache:fb()},i.payload=a;return}a=a.return}}function mA(i,a,u){var f=aa();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Jg(i)?xT(a,u):(u=ub(i,a,u,f),u!==null&&(Lr(u,i,f),wT(u,a,f)))}function bT(i,a,u){var f=aa();nf(i,a,u,f)}function nf(i,a,u,f){var y={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Jg(i))xT(a,y);else{var l=i.alternate;if(i.lanes===0&&(l===null||l.lanes===0)&&(l=a.lastRenderedReducer,l!==null))try{var D=a.lastRenderedState,B=l(D,u);if(y.hasEagerState=!0,y.eagerState=B,oa(B,D))return Xg(i,a,y,0),ui===null&&$g(),!1}catch{}if(u=ub(i,a,y,f),u!==null)return Lr(u,i,f),wT(u,a,f),!0}return!1}function Db(i,a,u,f){if(f={lane:2,revertLane:Nb(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Jg(i)){if(a)throw Error(Re(479))}else a=ub(i,u,f,2),a!==null&&Lr(a,i,2)}function Jg(i){var a=i.alternate;return i===_t||a!==null&&a===_t}function xT(i,a){Nh=Eg=!0;var u=i.pending;u===null?a.next=a:(a.next=u.next,u.next=a),i.pending=a}function wT(i,a,u){if((u&4194048)!==0){var f=a.lanes;f&=i.pendingLanes,u|=f,a.lanes=u,s4(i,u)}}var _f={readContext:Kn,use:Kg,useCallback:Gi,useContext:Gi,useEffect:Gi,useImperativeHandle:Gi,useLayoutEffect:Gi,useInsertionEffect:Gi,useMemo:Gi,useReducer:Gi,useRef:Gi,useState:Gi,useDebugValue:Gi,useDeferredValue:Gi,useTransition:Gi,useSyncExternalStore:Gi,useId:Gi,useHostTransitionStatus:Gi,useFormState:Gi,useActionState:Gi,useOptimistic:Gi,useMemoCache:Gi,useCacheRefresh:Gi};_f.useEffectEvent=Gi;var TT={readContext:Kn,use:Kg,useCallback:function(i,a){return xr().memoizedState=[i,a===void 0?null:a],i},useContext:Kn,useEffect:o5,useImperativeHandle:function(i,a,u){u=u!=null?u.concat([i]):null,og(4194308,4,uT.bind(null,a,i),u)},useLayoutEffect:function(i,a){return og(4194308,4,i,a)},useInsertionEffect:function(i,a){og(4,2,i,a)},useMemo:function(i,a){var u=xr();a=a===void 0?null:a;var f=i();if(Uc){pl(!0);try{i()}finally{pl(!1)}}return u.memoizedState=[f,a],f},useReducer:function(i,a,u){var f=xr();if(u!==void 0){var y=u(a);if(Uc){pl(!0);try{u(a)}finally{pl(!1)}}}else y=a;return f.memoizedState=f.baseState=y,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:y},f.queue=i,i=i.dispatch=mA.bind(null,_t,i),[f.memoizedState,i]},useRef:function(i){var a=xr();return i={current:i},a.memoizedState=i},useState:function(i){i=Av(i);var a=i.queue,u=bT.bind(null,_t,a);return a.dispatch=u,[i.memoizedState,u]},useDebugValue:Cb,useDeferredValue:function(i,a){var u=xr();return Ab(u,i,a)},useTransition:function(){var i=Av(!1);return i=mT.bind(null,_t,i.queue,!0,!1),xr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,u){var f=_t,y=xr();if(Pt){if(u===void 0)throw Error(Re(407));u=u()}else{if(u=a(),ui===null)throw Error(Re(349));(Mt&127)!==0||W4(f,a,u)}y.memoizedState=u;var l={value:u,getSnapshot:a};return y.queue=l,o5(Q4.bind(null,f,l,i),[i]),f.flags|=2048,Hh(9,{destroy:void 0},K4.bind(null,f,l,u,a),null),u},useId:function(){var i=xr(),a=ui.identifierPrefix;if(Pt){var u=bo,f=vo;u=(f&~(1<<32-ra(f)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Cg++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=lA++,a="_"+a+"r_"+u.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:zb,useFormState:n5,useActionState:n5,useOptimistic:function(i){var a=xr();a.memoizedState=a.baseState=i;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Db.bind(null,_t,!0,u),u.dispatch=a,[i,a]},useMemoCache:Sb,useCacheRefresh:function(){return xr().memoizedState=fA.bind(null,_t)},useEffectEvent:function(i){var a=xr(),u={impl:i};return a.memoizedState=u,function(){if((qt&2)!==0)throw Error(Re(440));return u.impl.apply(void 0,arguments)}}},Pb={readContext:Kn,use:Kg,useCallback:dT,useContext:Kn,useEffect:Eb,useImperativeHandle:hT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:pT,useReducer:ag,useRef:oT,useState:function(){return ag(bs)},useDebugValue:Cb,useDeferredValue:function(i,a){var u=Ki();return fT(u,si.memoizedState,i,a)},useTransition:function(){var i=ag(bs)[0],a=Ki().memoizedState;return[typeof i=="boolean"?i:Df(i),a]},useSyncExternalStore:Y4,useId:yT,useHostTransitionStatus:zb,useFormState:r5,useActionState:r5,useOptimistic:function(i,a){var u=Ki();return tT(u,si,i,a)},useMemoCache:Sb,useCacheRefresh:vT};Pb.useEffectEvent=sT;var ST={readContext:Kn,use:Kg,useCallback:dT,useContext:Kn,useEffect:Eb,useImperativeHandle:hT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:pT,useReducer:Fy,useRef:oT,useState:function(){return Fy(bs)},useDebugValue:Cb,useDeferredValue:function(i,a){var u=Ki();return si===null?Ab(u,i,a):fT(u,si.memoizedState,i,a)},useTransition:function(){var i=Fy(bs)[0],a=Ki().memoizedState;return[typeof i=="boolean"?i:Df(i),a]},useSyncExternalStore:Y4,useId:yT,useHostTransitionStatus:zb,useFormState:a5,useActionState:a5,useOptimistic:function(i,a){var u=Ki();return si!==null?tT(u,si,i,a):(u.baseState=i,[i,u.queue.dispatch])},useMemoCache:Sb,useCacheRefresh:vT};ST.useEffectEvent=sT;function Ny(i,a,u,f){a=i.memoizedState,u=u(f,a),u=u==null?a:Ei({},a,u),i.memoizedState=u,i.lanes===0&&(i.updateQueue.baseState=u)}var Pv={enqueueSetState:function(i,a,u){i=i._reactInternals;var f=aa(),y=bl(f);y.payload=a,u!=null&&(y.callback=u),a=xl(i,y,f),a!==null&&(Lr(a,i,f),Jp(a,i,f))},enqueueReplaceState:function(i,a,u){i=i._reactInternals;var f=aa(),y=bl(f);y.tag=1,y.payload=a,u!=null&&(y.callback=u),a=xl(i,y,f),a!==null&&(Lr(a,i,f),Jp(a,i,f))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var u=aa(),f=bl(u);f.tag=2,a!=null&&(f.callback=a),a=xl(i,f,u),a!==null&&(Lr(a,i,u),Jp(a,i,u))}};function s5(i,a,u,f,y,l,D){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,l,D):a.prototype&&a.prototype.isPureReactComponent?!df(u,f)||!df(y,l):!0}function l5(i,a,u,f){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,f),a.state!==i&&Pv.enqueueReplaceState(a,a.state,null)}function Vc(i,a){var u=a;if("ref"in a){u={};for(var f in a)f!=="ref"&&(u[f]=a[f])}if(i=i.defaultProps){u===a&&(u=Ei({},u));for(var y in i)u[y]===void 0&&(u[y]=i[y])}return u}function MT(i){vg(i)}function ET(i){console.error(i)}function CT(i){vg(i)}function Ag(i,a){try{var u=i.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function c5(i,a,u){try{var f=i.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Rv(i,a,u){return u=bl(u),u.tag=3,u.payload={element:null},u.callback=function(){Ag(i,a)},u}function AT(i){return i=bl(i),i.tag=3,i}function zT(i,a,u,f){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var l=f.value;i.payload=function(){return y(l)},i.callback=function(){c5(a,u,f)}}var D=u.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(i.callback=function(){c5(a,u,f),typeof y!="function"&&(wl===null?wl=new Set([this]):wl.add(this));var B=f.stack;this.componentDidCatch(f.value,{componentStack:B!==null?B:""})})}function gA(i,a,u,f,y){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=u.alternate,a!==null&&ed(a,u,y,!0),u=sa.current,u!==null){switch(u.tag){case 31:case 13:return Ea===null?Ig():u.alternate===null&&Zi===0&&(Zi=3),u.flags&=-257,u.flags|=65536,u.lanes=y,f===Tg?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([f]):a.add(f),Wy(i,f,y)),!1;case 22:return u.flags|=65536,f===Tg?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([f]):u.add(f)),Wy(i,f,y)),!1}throw Error(Re(435,u.tag))}return Wy(i,f,y),Ig(),!1}if(Pt)return a=sa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,f!==vv&&(i=Error(Re(422),{cause:f}),ff(Sa(i,u)))):(f!==vv&&(a=Error(Re(423),{cause:f}),ff(Sa(a,u))),i=i.current.alternate,i.flags|=65536,y&=-y,i.lanes|=y,f=Sa(f,u),y=Rv(i.stateNode,f,y),By(i,y),Zi!==4&&(Zi=2)),!1;var l=Error(Re(520),{cause:f});if(l=Sa(l,u),of===null?of=[l]:of.push(l),Zi!==4&&(Zi=2),a===null)return!0;f=Sa(f,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,i=y&-y,u.lanes|=i,i=Rv(u.stateNode,f,i),By(u,i),!1;case 1:if(a=u.type,l=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(wl===null||!wl.has(l))))return u.flags|=65536,y&=-y,u.lanes|=y,y=AT(y),zT(y,i,u,f),By(u,y),!1}u=u.return}while(u!==null);return!1}var Rb=Error(Re(461)),hn=!1;function Xn(i,a,u,f){a.child=i===null?q4(a,null,u,f):Nc(a,i.child,u,f)}function u5(i,a,u,f,y){u=u.render;var l=a.ref;if("ref"in f){var D={};for(var B in f)B!=="ref"&&(D[B]=f[B])}else D=f;return Fc(a),f=bb(i,a,u,D,l,y),B=xb(),i!==null&&!hn?(wb(i,a,y),xs(i,a,y)):(Pt&&B&&db(a),a.flags|=1,Xn(i,a,f,y),a.child)}function h5(i,a,u,f,y){if(i===null){var l=u.type;return typeof l=="function"&&!hb(l)&&l.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=l,DT(i,a,l,f,y)):(i=ng(u.type,null,f,a,a.mode,y),i.ref=a.ref,i.return=a,a.child=i)}if(l=i.child,!Ib(i,y)){var D=l.memoizedProps;if(u=u.compare,u=u!==null?u:df,u(D,f)&&i.ref===a.ref)return xs(i,a,y)}return a.flags|=1,i=ms(l,f),i.ref=a.ref,i.return=a,a.child=i}function DT(i,a,u,f,y){if(i!==null){var l=i.memoizedProps;if(df(l,f)&&i.ref===a.ref)if(hn=!1,a.pendingProps=f=l,Ib(i,y))(i.flags&131072)!==0&&(hn=!0);else return a.lanes=i.lanes,xs(i,a,y)}return Iv(i,a,u,f,y)}function PT(i,a,u,f){var y=f.children,l=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(l=l!==null?l.baseLanes|u:u,i!==null){for(f=a.child=i.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~l}else f=0,a.child=null;return d5(i,a,l,u,f)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&rg(a,l!==null?l.cachePool:null),l!==null?e5(a,l):Ev(),H4(a);else return f=a.lanes=536870912,d5(i,a,l!==null?l.baseLanes|u:u,u,f)}else l!==null?(rg(a,l.cachePool),e5(a,l),hl(a),a.memoizedState=null):(i!==null&&rg(a,null),Ev(),hl(a));return Xn(i,a,y,u),a.child}function $p(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function d5(i,a,u,f,y){var l=mb();return l=l===null?null:{parent:un._currentValue,pool:l},a.memoizedState={baseLanes:u,cachePool:l},i!==null&&rg(a,null),Ev(),H4(a),i!==null&&ed(i,a,f,!0),a.childLanes=y,null}function sg(i,a){return a=zg({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function p5(i,a,u){return Nc(a,i.child,null,u),i=sg(a,a.pendingProps),i.flags|=2,Jr(a),a.memoizedState=null,i}function _A(i,a,u){var f=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(Pt){if(f.mode==="hidden")return i=sg(a,f),a.lanes=536870912,$p(null,i);if(Cv(a),(i=Mi)?(i=TS(i,Ma),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Cl!==null?{id:vo,overflow:bo}:null,retryLane:536870912,hydrationErrors:null},u=O4(i),u.return=a,a.child=u,Wn=a,Mi=null)):i=null,i===null)throw Al(a);return a.lanes=536870912,null}return sg(a,f)}var l=i.memoizedState;if(l!==null){var D=l.dehydrated;if(Cv(a),y)if(a.flags&256)a.flags&=-257,a=p5(i,a,u);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(Re(558));else if(hn||ed(i,a,u,!1),y=(u&i.childLanes)!==0,hn||y){if(f=ui,f!==null&&(D=l4(f,u),D!==0&&D!==l.retryLane))throw l.retryLane=D,Zc(i,D),Lr(f,i,D),Rb;Ig(),a=p5(i,a,u)}else i=l.treeContext,Mi=Ca(D.nextSibling),Wn=a,Pt=!0,vl=null,Ma=!1,i!==null&&F4(a,i),a=sg(a,f),a.flags|=4096;return a}return i=ms(i.child,{mode:f.mode,children:f.children}),i.ref=a.ref,a.child=i,i.return=a,i}function lg(i,a){var u=a.ref;if(u===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(Re(284));(i===null||i.ref!==u)&&(a.flags|=4194816)}}function Iv(i,a,u,f,y){return Fc(a),u=bb(i,a,u,f,void 0,y),f=xb(),i!==null&&!hn?(wb(i,a,y),xs(i,a,y)):(Pt&&f&&db(a),a.flags|=1,Xn(i,a,u,y),a.child)}function f5(i,a,u,f,y,l){return Fc(a),a.updateQueue=null,u=X4(a,f,u,y),$4(i),f=xb(),i!==null&&!hn?(wb(i,a,l),xs(i,a,l)):(Pt&&f&&db(a),a.flags|=1,Xn(i,a,u,l),a.child)}function m5(i,a,u,f,y){if(Fc(a),a.stateNode===null){var l=Dh,D=u.contextType;typeof D=="object"&&D!==null&&(l=Kn(D)),l=new u(f,l),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Pv,a.stateNode=l,l._reactInternals=a,l=a.stateNode,l.props=f,l.state=a.memoizedState,l.refs={},_b(a),D=u.contextType,l.context=typeof D=="object"&&D!==null?Kn(D):Dh,l.state=a.memoizedState,D=u.getDerivedStateFromProps,typeof D=="function"&&(Ny(a,u,D,f),l.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(D=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),D!==l.state&&Pv.enqueueReplaceState(l,l.state,null),tf(a,f,l,y),ef(),l.state=a.memoizedState),typeof l.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(i===null){l=a.stateNode;var B=a.memoizedProps,q=Vc(u,B);l.props=q;var K=l.context,fe=u.contextType;D=Dh,typeof fe=="object"&&fe!==null&&(D=Kn(fe));var de=u.getDerivedStateFromProps;fe=typeof de=="function"||typeof l.getSnapshotBeforeUpdate=="function",B=a.pendingProps!==B,fe||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(B||K!==D)&&l5(a,l,f,D),ll=!1;var oe=a.memoizedState;l.state=oe,tf(a,f,l,y),ef(),K=a.memoizedState,B||oe!==K||ll?(typeof de=="function"&&(Ny(a,u,de,f),K=a.memoizedState),(q=ll||s5(a,u,q,f,oe,K,D))?(fe||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(a.flags|=4194308)):(typeof l.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=K),l.props=f,l.state=K,l.context=D,f=q):(typeof l.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{l=a.stateNode,Sv(i,a),D=a.memoizedProps,fe=Vc(u,D),l.props=fe,de=a.pendingProps,oe=l.context,K=u.contextType,q=Dh,typeof K=="object"&&K!==null&&(q=Kn(K)),B=u.getDerivedStateFromProps,(K=typeof B=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(D!==de||oe!==q)&&l5(a,l,f,q),ll=!1,oe=a.memoizedState,l.state=oe,tf(a,f,l,y),ef();var ce=a.memoizedState;D!==de||oe!==ce||ll||i!==null&&i.dependencies!==null&&wg(i.dependencies)?(typeof B=="function"&&(Ny(a,u,B,f),ce=a.memoizedState),(fe=ll||s5(a,u,fe,f,oe,ce,q)||i!==null&&i.dependencies!==null&&wg(i.dependencies))?(K||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(f,ce,q),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(f,ce,q)),typeof l.componentDidUpdate=="function"&&(a.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof l.componentDidUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ce),l.props=f,l.state=ce,l.context=q,f=fe):(typeof l.componentDidUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),f=!1)}return l=f,lg(i,a),f=(a.flags&128)!==0,l||f?(l=a.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:l.render(),a.flags|=1,i!==null&&f?(a.child=Nc(a,i.child,null,y),a.child=Nc(a,null,u,y)):Xn(i,a,u,y),a.memoizedState=l.state,i=a.child):i=xs(i,a,y),i}function g5(i,a,u,f){return Bc(),a.flags|=256,Xn(i,a,u,f),a.child}var Uy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vy(i){return{baseLanes:i,cachePool:U4()}}function jy(i,a,u){return i=i!==null?i.childLanes&~u:0,a&&(i|=ta),i}function RT(i,a,u){var f=a.pendingProps,y=!1,l=(a.flags&128)!==0,D;if((D=l)||(D=i!==null&&i.memoizedState===null?!1:(Wi.current&2)!==0),D&&(y=!0,a.flags&=-129),D=(a.flags&32)!==0,a.flags&=-33,i===null){if(Pt){if(y?ul(a):hl(a),(i=Mi)?(i=TS(i,Ma),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Cl!==null?{id:vo,overflow:bo}:null,retryLane:536870912,hydrationErrors:null},u=O4(i),u.return=a,a.child=u,Wn=a,Mi=null)):i=null,i===null)throw Al(a);return $v(i)?a.lanes=32:a.lanes=536870912,null}var B=f.children;return f=f.fallback,y?(hl(a),y=a.mode,B=zg({mode:"hidden",children:B},y),f=Ic(f,y,u,null),B.return=a,f.return=a,B.sibling=f,a.child=B,f=a.child,f.memoizedState=Vy(u),f.childLanes=jy(i,D,u),a.memoizedState=Uy,$p(null,f)):(ul(a),kv(a,B))}var q=i.memoizedState;if(q!==null&&(B=q.dehydrated,B!==null)){if(l)a.flags&256?(ul(a),a.flags&=-257,a=qy(i,a,u)):a.memoizedState!==null?(hl(a),a.child=i.child,a.flags|=128,a=null):(hl(a),B=f.fallback,y=a.mode,f=zg({mode:"visible",children:f.children},y),B=Ic(B,y,u,null),B.flags|=2,f.return=a,B.return=a,f.sibling=B,a.child=f,Nc(a,i.child,null,u),f=a.child,f.memoizedState=Vy(u),f.childLanes=jy(i,D,u),a.memoizedState=Uy,a=$p(null,f));else if(ul(a),$v(B)){if(D=B.nextSibling&&B.nextSibling.dataset,D)var K=D.dgst;D=K,f=Error(Re(419)),f.stack="",f.digest=D,ff({value:f,source:null,stack:null}),a=qy(i,a,u)}else if(hn||ed(i,a,u,!1),D=(u&i.childLanes)!==0,hn||D){if(D=ui,D!==null&&(f=l4(D,u),f!==0&&f!==q.retryLane))throw q.retryLane=f,Zc(i,f),Lr(D,i,f),Rb;Hv(B)||Ig(),a=qy(i,a,u)}else Hv(B)?(a.flags|=192,a.child=i.child,a=null):(i=q.treeContext,Mi=Ca(B.nextSibling),Wn=a,Pt=!0,vl=null,Ma=!1,i!==null&&F4(a,i),a=kv(a,f.children),a.flags|=4096);return a}return y?(hl(a),B=f.fallback,y=a.mode,q=i.child,K=q.sibling,f=ms(q,{mode:"hidden",children:f.children}),f.subtreeFlags=q.subtreeFlags&65011712,K!==null?B=ms(K,B):(B=Ic(B,y,u,null),B.flags|=2),B.return=a,f.return=a,f.sibling=B,a.child=f,$p(null,f),f=a.child,B=i.child.memoizedState,B===null?B=Vy(u):(y=B.cachePool,y!==null?(q=un._currentValue,y=y.parent!==q?{parent:q,pool:q}:y):y=U4(),B={baseLanes:B.baseLanes|u,cachePool:y}),f.memoizedState=B,f.childLanes=jy(i,D,u),a.memoizedState=Uy,$p(i.child,f)):(ul(a),u=i.child,i=u.sibling,u=ms(u,{mode:"visible",children:f.children}),u.return=a,u.sibling=null,i!==null&&(D=a.deletions,D===null?(a.deletions=[i],a.flags|=16):D.push(i)),a.child=u,a.memoizedState=null,u)}function kv(i,a){return a=zg({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function zg(i,a){return i=ea(22,i,null,a),i.lanes=0,i}function qy(i,a,u){return Nc(a,i.child,null,u),i=kv(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function _5(i,a,u){i.lanes|=a;var f=i.alternate;f!==null&&(f.lanes|=a),xv(i.return,a,u)}function Gy(i,a,u,f,y,l){var D=i.memoizedState;D===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:y,treeForkCount:l}:(D.isBackwards=a,D.rendering=null,D.renderingStartTime=0,D.last=f,D.tail=u,D.tailMode=y,D.treeForkCount=l)}function IT(i,a,u){var f=a.pendingProps,y=f.revealOrder,l=f.tail;f=f.children;var D=Wi.current,B=(D&2)!==0;if(B?(D=D&1|2,a.flags|=128):D&=1,yi(Wi,D),Xn(i,a,f,u),f=Pt?pf:0,!B&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&_5(i,u,a);else if(i.tag===19)_5(i,u,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(y){case"forwards":for(u=a.child,y=null;u!==null;)i=u.alternate,i!==null&&Mg(i)===null&&(y=u),u=u.sibling;u=y,u===null?(y=a.child,a.child=null):(y=u.sibling,u.sibling=null),Gy(a,!1,y,u,l,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=a.child,a.child=null;y!==null;){if(i=y.alternate,i!==null&&Mg(i)===null){a.child=y;break}i=y.sibling,y.sibling=u,u=y,y=i}Gy(a,!0,u,null,l,f);break;case"together":Gy(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function xs(i,a,u){if(i!==null&&(a.dependencies=i.dependencies),Dl|=a.lanes,(u&a.childLanes)===0)if(i!==null){if(ed(i,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(Re(153));if(a.child!==null){for(i=a.child,u=ms(i,i.pendingProps),a.child=u,u.return=a;i.sibling!==null;)i=i.sibling,u=u.sibling=ms(i,i.pendingProps),u.return=a;u.sibling=null}return a.child}function Ib(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&wg(i)))}function yA(i,a,u){switch(a.tag){case 3:mg(a,a.stateNode.containerInfo),cl(a,un,i.memoizedState.cache),Bc();break;case 27:case 5:lv(a);break;case 4:mg(a,a.stateNode.containerInfo);break;case 10:cl(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Cv(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(ul(a),a.flags|=128,null):(u&a.child.childLanes)!==0?RT(i,a,u):(ul(a),i=xs(i,a,u),i!==null?i.sibling:null);ul(a);break;case 19:var y=(i.flags&128)!==0;if(f=(u&a.childLanes)!==0,f||(ed(i,a,u,!1),f=(u&a.childLanes)!==0),y){if(f)return IT(i,a,u);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),yi(Wi,Wi.current),f)break;return null;case 22:return a.lanes=0,PT(i,a,u,a.pendingProps);case 24:cl(a,un,i.memoizedState.cache)}return xs(i,a,u)}function kT(i,a,u){if(i!==null)if(i.memoizedProps!==a.pendingProps)hn=!0;else{if(!Ib(i,u)&&(a.flags&128)===0)return hn=!1,yA(i,a,u);hn=(i.flags&131072)!==0}else hn=!1,Pt&&(a.flags&1048576)!==0&&B4(a,pf,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(i=Dc(a.elementType),a.type=i,typeof i=="function")hb(i)?(f=Vc(i,f),a.tag=1,a=m5(null,a,i,f,u)):(a.tag=0,a=Iv(null,a,i,f,u));else{if(i!=null){var y=i.$$typeof;if(y===Kv){a.tag=11,a=u5(null,a,i,f,u);break e}else if(y===Qv){a.tag=14,a=h5(null,a,i,f,u);break e}}throw a=ov(i)||i,Error(Re(306,a,""))}}return a;case 0:return Iv(i,a,a.type,a.pendingProps,u);case 1:return f=a.type,y=Vc(f,a.pendingProps),m5(i,a,f,y,u);case 3:e:{if(mg(a,a.stateNode.containerInfo),i===null)throw Error(Re(387));f=a.pendingProps;var l=a.memoizedState;y=l.element,Sv(i,a),tf(a,f,null,u);var D=a.memoizedState;if(f=D.cache,cl(a,un,f),f!==l.cache&&wv(a,[un],u,!0),ef(),f=D.element,l.isDehydrated)if(l={element:f,isDehydrated:!1,cache:D.cache},a.updateQueue.baseState=l,a.memoizedState=l,a.flags&256){a=g5(i,a,f,u);break e}else if(f!==y){y=Sa(Error(Re(424)),a),ff(y),a=g5(i,a,f,u);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Mi=Ca(i.firstChild),Wn=a,Pt=!0,vl=null,Ma=!0,u=q4(a,null,f,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Bc(),f===y){a=xs(i,a,u);break e}Xn(i,a,f,u)}a=a.child}return a;case 26:return lg(i,a),i===null?(u=N5(a.type,null,a.pendingProps,null))?a.memoizedState=u:Pt||(u=a.type,i=a.pendingProps,f=Bg(yl.current).createElement(u),f[Yn]=a,f[Or]=i,Qn(f,u,i),Bn(f),a.stateNode=f):a.memoizedState=N5(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return lv(a),i===null&&Pt&&(f=a.stateNode=SS(a.type,a.pendingProps,yl.current),Wn=a,Ma=!0,y=Mi,Rl(a.type)?(Xv=y,Mi=Ca(f.firstChild)):Mi=y),Xn(i,a,a.pendingProps.children,u),lg(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&Pt&&((y=f=Mi)&&(f=HA(f,a.type,a.pendingProps,Ma),f!==null?(a.stateNode=f,Wn=a,Mi=Ca(f.firstChild),Ma=!1,y=!0):y=!1),y||Al(a)),lv(a),y=a.type,l=a.pendingProps,D=i!==null?i.memoizedProps:null,f=l.children,Gv(y,l)?f=null:D!==null&&Gv(y,D)&&(a.flags|=32),a.memoizedState!==null&&(y=bb(i,a,cA,null,null,u),bf._currentValue=y),lg(i,a),Xn(i,a,f,u),a.child;case 6:return i===null&&Pt&&((i=u=Mi)&&(u=$A(u,a.pendingProps,Ma),u!==null?(a.stateNode=u,Wn=a,Mi=null,i=!0):i=!1),i||Al(a)),null;case 13:return RT(i,a,u);case 4:return mg(a,a.stateNode.containerInfo),f=a.pendingProps,i===null?a.child=Nc(a,null,f,u):Xn(i,a,f,u),a.child;case 11:return u5(i,a,a.type,a.pendingProps,u);case 7:return Xn(i,a,a.pendingProps,u),a.child;case 8:return Xn(i,a,a.pendingProps.children,u),a.child;case 12:return Xn(i,a,a.pendingProps.children,u),a.child;case 10:return f=a.pendingProps,cl(a,a.type,f.value),Xn(i,a,f.children,u),a.child;case 9:return y=a.type._context,f=a.pendingProps.children,Fc(a),y=Kn(y),f=f(y),a.flags|=1,Xn(i,a,f,u),a.child;case 14:return h5(i,a,a.type,a.pendingProps,u);case 15:return DT(i,a,a.type,a.pendingProps,u);case 19:return IT(i,a,u);case 31:return _A(i,a,u);case 22:return PT(i,a,u,a.pendingProps);case 24:return Fc(a),f=Kn(un),i===null?(y=mb(),y===null&&(y=ui,l=fb(),y.pooledCache=l,l.refCount++,l!==null&&(y.pooledCacheLanes|=u),y=l),a.memoizedState={parent:f,cache:y},_b(a),cl(a,un,y)):((i.lanes&u)!==0&&(Sv(i,a),tf(a,null,null,u),ef()),y=i.memoizedState,l=a.memoizedState,y.parent!==f?(y={parent:f,cache:f},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),cl(a,un,f)):(f=l.cache,cl(a,un,f),f!==y.cache&&wv(a,[un],u,!0))),Xn(i,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(Re(156,a.tag))}function os(i){i.flags|=4}function Zy(i,a,u,f,y){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(y&335544128)===y)if(i.stateNode.complete)i.flags|=8192;else if(rS())i.flags|=8192;else throw Lc=Tg,gb}else i.flags&=-16777217}function y5(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!CS(a))if(rS())i.flags|=8192;else throw Lc=Tg,gb}function H0(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?a4():536870912,i.lanes|=a,$h|=a)}function Up(i,a){if(!Pt)switch(i.tailMode){case"hidden":a=i.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i.tail=null:u.sibling=null;break;case"collapsed":u=i.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Si(i){var a=i.alternate!==null&&i.alternate.child===i.child,u=0,f=0;if(a)for(var y=i.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=i,y=y.sibling;else for(y=i.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=i,y=y.sibling;return i.subtreeFlags|=f,i.childLanes=u,a}function vA(i,a,u){var f=a.pendingProps;switch(pb(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Si(a),null;case 1:return Si(a),null;case 3:return u=a.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),gs(un),Vh(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(i===null||i.child===null)&&(yh(a)?os(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Oy())),Si(a),null;case 26:var y=a.type,l=a.memoizedState;return i===null?(os(a),l!==null?(Si(a),y5(a,l)):(Si(a),Zy(a,y,null,f,u))):l?l!==i.memoizedState?(os(a),Si(a),y5(a,l)):(Si(a),a.flags&=-16777217):(i=i.memoizedProps,i!==f&&os(a),Si(a),Zy(a,y,i,f,u)),null;case 27:if(gg(a),u=yl.current,y=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&os(a);else{if(!f){if(a.stateNode===null)throw Error(Re(166));return Si(a),null}i=wo.current,yh(a)?$3(a,i):(i=SS(y,f,u),a.stateNode=i,os(a))}return Si(a),null;case 5:if(gg(a),y=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&os(a);else{if(!f){if(a.stateNode===null)throw Error(Re(166));return Si(a),null}if(l=wo.current,yh(a))$3(a,l);else{var D=Bg(yl.current);switch(l){case 1:l=D.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:l=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":l=D.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":l=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":l=D.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof f.is=="string"?D.createElement("select",{is:f.is}):D.createElement("select"),f.multiple?l.multiple=!0:f.size&&(l.size=f.size);break;default:l=typeof f.is=="string"?D.createElement(y,{is:f.is}):D.createElement(y)}}l[Yn]=a,l[Or]=f;e:for(D=a.child;D!==null;){if(D.tag===5||D.tag===6)l.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===a)break e;for(;D.sibling===null;){if(D.return===null||D.return===a)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}a.stateNode=l;e:switch(Qn(l,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&os(a)}}return Si(a),Zy(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,u),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==f&&os(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(Re(166));if(i=yl.current,yh(a)){if(i=a.stateNode,u=a.memoizedProps,f=null,y=Wn,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}i[Yn]=a,i=!!(i.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||bS(i.nodeValue,u)),i||Al(a,!0)}else i=Bg(i).createTextNode(f),i[Yn]=a,a.stateNode=i}return Si(a),null;case 31:if(u=a.memoizedState,i===null||i.memoizedState!==null){if(f=yh(a),u!==null){if(i===null){if(!f)throw Error(Re(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Re(557));i[Yn]=a}else Bc(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Si(a),i=!1}else u=Oy(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),i=!0;if(!i)return a.flags&256?(Jr(a),a):(Jr(a),null);if((a.flags&128)!==0)throw Error(Re(558))}return Si(a),null;case 13:if(f=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(y=yh(a),f!==null&&f.dehydrated!==null){if(i===null){if(!y)throw Error(Re(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(Re(317));y[Yn]=a}else Bc(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Si(a),y=!1}else y=Oy(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(Jr(a),a):(Jr(a),null)}return Jr(a),(a.flags&128)!==0?(a.lanes=u,a):(u=f!==null,i=i!==null&&i.memoizedState!==null,u&&(f=a.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),l=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(l=f.memoizedState.cachePool.pool),l!==y&&(f.flags|=2048)),u!==i&&u&&(a.child.flags|=8192),H0(a,a.updateQueue),Si(a),null);case 4:return Vh(),i===null&&Ub(a.stateNode.containerInfo),Si(a),null;case 10:return gs(a.type),Si(a),null;case 19:if(Fn(Wi),f=a.memoizedState,f===null)return Si(a),null;if(y=(a.flags&128)!==0,l=f.rendering,l===null)if(y)Up(f,!1);else{if(Zi!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(l=Mg(i),l!==null){for(a.flags|=128,Up(f,!1),i=l.updateQueue,a.updateQueue=i,H0(a,i),a.subtreeFlags=0,i=u,u=a.child;u!==null;)L4(u,i),u=u.sibling;return yi(Wi,Wi.current&1|2),Pt&&us(a,f.treeForkCount),a.child}i=i.sibling}f.tail!==null&&ia()>Pg&&(a.flags|=128,y=!0,Up(f,!1),a.lanes=4194304)}else{if(!y)if(i=Mg(l),i!==null){if(a.flags|=128,y=!0,i=i.updateQueue,a.updateQueue=i,H0(a,i),Up(f,!0),f.tail===null&&f.tailMode==="hidden"&&!l.alternate&&!Pt)return Si(a),null}else 2*ia()-f.renderingStartTime>Pg&&u!==536870912&&(a.flags|=128,y=!0,Up(f,!1),a.lanes=4194304);f.isBackwards?(l.sibling=a.child,a.child=l):(i=f.last,i!==null?i.sibling=l:a.child=l,f.last=l)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=ia(),i.sibling=null,u=Wi.current,yi(Wi,y?u&1|2:u&1),Pt&&us(a,f.treeForkCount),i):(Si(a),null);case 22:case 23:return Jr(a),yb(),f=a.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(u&536870912)!==0&&(a.flags&128)===0&&(Si(a),a.subtreeFlags&6&&(a.flags|=8192)):Si(a),u=a.updateQueue,u!==null&&H0(a,u.retryQueue),u=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==u&&(a.flags|=2048),i!==null&&Fn(kc),null;case 24:return u=null,i!==null&&(u=i.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),gs(un),Si(a),null;case 25:return null;case 30:return null}throw Error(Re(156,a.tag))}function bA(i,a){switch(pb(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return gs(un),Vh(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return gg(a),null;case 31:if(a.memoizedState!==null){if(Jr(a),a.alternate===null)throw Error(Re(340));Bc()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Jr(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(Re(340));Bc()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Fn(Wi),null;case 4:return Vh(),null;case 10:return gs(a.type),null;case 22:case 23:return Jr(a),yb(),i!==null&&Fn(kc),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return gs(un),null;case 25:return null;default:return null}}function LT(i,a){switch(pb(a),a.tag){case 3:gs(un),Vh();break;case 26:case 27:case 5:gg(a);break;case 4:Vh();break;case 31:a.memoizedState!==null&&Jr(a);break;case 13:Jr(a);break;case 19:Fn(Wi);break;case 10:gs(a.type);break;case 22:case 23:Jr(a),yb(),i!==null&&Fn(kc);break;case 24:gs(un)}}function Pf(i,a){try{var u=a.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var y=f.next;u=y;do{if((u.tag&i)===i){f=void 0;var l=u.create,D=u.inst;f=l(),D.destroy=f}u=u.next}while(u!==y)}}catch(B){ii(a,a.return,B)}}function zl(i,a,u){try{var f=a.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var l=y.next;f=l;do{if((f.tag&i)===i){var D=f.inst,B=D.destroy;if(B!==void 0){D.destroy=void 0,y=a;var q=u,K=B;try{K()}catch(fe){ii(y,q,fe)}}}f=f.next}while(f!==l)}}catch(fe){ii(a,a.return,fe)}}function OT(i){var a=i.updateQueue;if(a!==null){var u=i.stateNode;try{Z4(a,u)}catch(f){ii(i,i.return,f)}}}function BT(i,a,u){u.props=Vc(i.type,i.memoizedProps),u.state=i.memoizedState;try{u.componentWillUnmount()}catch(f){ii(i,a,f)}}function rf(i,a){try{var u=i.ref;if(u!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof u=="function"?i.refCleanup=u(f):u.current=f}}catch(y){ii(i,a,y)}}function xo(i,a){var u=i.ref,f=i.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(y){ii(i,a,y)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){ii(i,a,y)}else u.current=null}function FT(i){var a=i.type,u=i.memoizedProps,f=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(y){ii(i,i.return,y)}}function Hy(i,a,u){try{var f=i.stateNode;UA(f,i.type,u,a),f[Or]=a}catch(y){ii(i,i.return,y)}}function NT(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Rl(i.type)||i.tag===4}function $y(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||NT(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Rl(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Lv(i,a,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(i,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(i),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=ps));else if(f!==4&&(f===27&&Rl(i.type)&&(u=i.stateNode,a=null),i=i.child,i!==null))for(Lv(i,a,u),i=i.sibling;i!==null;)Lv(i,a,u),i=i.sibling}function Dg(i,a,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?u.insertBefore(i,a):u.appendChild(i);else if(f!==4&&(f===27&&Rl(i.type)&&(u=i.stateNode),i=i.child,i!==null))for(Dg(i,a,u),i=i.sibling;i!==null;)Dg(i,a,u),i=i.sibling}function UT(i){var a=i.stateNode,u=i.memoizedProps;try{for(var f=i.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);Qn(a,f,u),a[Yn]=i,a[Or]=u}catch(l){ii(i,i.return,l)}}var hs=!1,cn=!1,Xy=!1,v5=typeof WeakSet=="function"?WeakSet:Set,On=null;function xA(i,a){if(i=i.containerInfo,jv=Vg,i=C4(i),lb(i)){if("selectionStart"in i)var u={start:i.selectionStart,end:i.selectionEnd};else e:{u=(u=i.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var y=f.anchorOffset,l=f.focusNode;f=f.focusOffset;try{u.nodeType,l.nodeType}catch{u=null;break e}var D=0,B=-1,q=-1,K=0,fe=0,de=i,oe=null;t:for(;;){for(var ce;de!==u||y!==0&&de.nodeType!==3||(B=D+y),de!==l||f!==0&&de.nodeType!==3||(q=D+f),de.nodeType===3&&(D+=de.nodeValue.length),(ce=de.firstChild)!==null;)oe=de,de=ce;for(;;){if(de===i)break t;if(oe===u&&++K===y&&(B=D),oe===l&&++fe===f&&(q=D),(ce=de.nextSibling)!==null)break;de=oe,oe=de.parentNode}de=ce}u=B===-1||q===-1?null:{start:B,end:q}}else u=null}u=u||{start:0,end:0}}else u=null;for(qv={focusedElem:i,selectionRange:u},Vg=!1,On=a;On!==null;)if(a=On,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,On=i;else for(;On!==null;){switch(a=On,l=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(u=0;u<i.length;u++)y=i[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&l!==null){i=void 0,u=a,y=l.memoizedProps,l=l.memoizedState,f=u.stateNode;try{var ke=Vc(u.type,y);i=f.getSnapshotBeforeUpdate(ke,l),f.__reactInternalSnapshotBeforeUpdate=i}catch(Ne){ii(u,u.return,Ne)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,u=i.nodeType,u===9)Zv(i);else if(u===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Zv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(Re(163))}if(i=a.sibling,i!==null){i.return=a.return,On=i;break}On=a.return}}function VT(i,a,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:ls(i,u),f&4&&Pf(5,u);break;case 1:if(ls(i,u),f&4)if(i=u.stateNode,a===null)try{i.componentDidMount()}catch(D){ii(u,u.return,D)}else{var y=Vc(u.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(y,a,i.__reactInternalSnapshotBeforeUpdate)}catch(D){ii(u,u.return,D)}}f&64&&OT(u),f&512&&rf(u,u.return);break;case 3:if(ls(i,u),f&64&&(i=u.updateQueue,i!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{Z4(i,a)}catch(D){ii(u,u.return,D)}}break;case 27:a===null&&f&4&&UT(u);case 26:case 5:ls(i,u),a===null&&f&4&&FT(u),f&512&&rf(u,u.return);break;case 12:ls(i,u);break;case 31:ls(i,u),f&4&&GT(i,u);break;case 13:ls(i,u),f&4&&ZT(i,u),f&64&&(i=u.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(u=DA.bind(null,u),XA(i,u))));break;case 22:if(f=u.memoizedState!==null||hs,!f){a=a!==null&&a.memoizedState!==null||cn,y=hs;var l=cn;hs=f,(cn=a)&&!l?cs(i,u,(u.subtreeFlags&8772)!==0):ls(i,u),hs=y,cn=l}break;case 30:break;default:ls(i,u)}}function jT(i){var a=i.alternate;a!==null&&(i.alternate=null,jT(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&ib(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Pi=null,Ir=!1;function ss(i,a,u){for(u=u.child;u!==null;)qT(i,a,u),u=u.sibling}function qT(i,a,u){if(na&&typeof na.onCommitFiberUnmount=="function")try{na.onCommitFiberUnmount(Sf,u)}catch{}switch(u.tag){case 26:cn||xo(u,a),ss(i,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:cn||xo(u,a);var f=Pi,y=Ir;Rl(u.type)&&(Pi=u.stateNode,Ir=!1),ss(i,a,u),lf(u.stateNode),Pi=f,Ir=y;break;case 5:cn||xo(u,a);case 6:if(f=Pi,y=Ir,Pi=null,ss(i,a,u),Pi=f,Ir=y,Pi!==null)if(Ir)try{(Pi.nodeType===9?Pi.body:Pi.nodeName==="HTML"?Pi.ownerDocument.body:Pi).removeChild(u.stateNode)}catch(l){ii(u,a,l)}else try{Pi.removeChild(u.stateNode)}catch(l){ii(u,a,l)}break;case 18:Pi!==null&&(Ir?(i=Pi,k5(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,u.stateNode),Kh(i)):k5(Pi,u.stateNode));break;case 4:f=Pi,y=Ir,Pi=u.stateNode.containerInfo,Ir=!0,ss(i,a,u),Pi=f,Ir=y;break;case 0:case 11:case 14:case 15:zl(2,u,a),cn||zl(4,u,a),ss(i,a,u);break;case 1:cn||(xo(u,a),f=u.stateNode,typeof f.componentWillUnmount=="function"&&BT(u,a,f)),ss(i,a,u);break;case 21:ss(i,a,u);break;case 22:cn=(f=cn)||u.memoizedState!==null,ss(i,a,u),cn=f;break;default:ss(i,a,u)}}function GT(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Kh(i)}catch(u){ii(a,a.return,u)}}}function ZT(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Kh(i)}catch(u){ii(a,a.return,u)}}function wA(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new v5),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new v5),a;default:throw Error(Re(435,i.tag))}}function $0(i,a){var u=wA(i);a.forEach(function(f){if(!u.has(f)){u.add(f);var y=PA.bind(null,i,f);f.then(y,y)}})}function Pr(i,a){var u=a.deletions;if(u!==null)for(var f=0;f<u.length;f++){var y=u[f],l=i,D=a,B=D;e:for(;B!==null;){switch(B.tag){case 27:if(Rl(B.type)){Pi=B.stateNode,Ir=!1;break e}break;case 5:Pi=B.stateNode,Ir=!1;break e;case 3:case 4:Pi=B.stateNode.containerInfo,Ir=!0;break e}B=B.return}if(Pi===null)throw Error(Re(160));qT(l,D,y),Pi=null,Ir=!1,l=y.alternate,l!==null&&(l.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)HT(a,i),a=a.sibling}var $a=null;function HT(i,a){var u=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Pr(a,i),Rr(i),f&4&&(zl(3,i,i.return),Pf(3,i),zl(5,i,i.return));break;case 1:Pr(a,i),Rr(i),f&512&&(cn||u===null||xo(u,u.return)),f&64&&hs&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(u=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var y=$a;if(Pr(a,i),Rr(i),f&512&&(cn||u===null||xo(u,u.return)),f&4){var l=u!==null?u.memoizedState:null;if(f=i.memoizedState,u===null)if(f===null)if(i.stateNode===null){e:{f=i.type,u=i.memoizedProps,y=y.ownerDocument||y;t:switch(f){case"title":l=y.getElementsByTagName("title")[0],(!l||l[Cf]||l[Yn]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=y.createElement(f),y.head.insertBefore(l,y.querySelector("head > title"))),Qn(l,f,u),l[Yn]=i,Bn(l),f=l;break e;case"link":var D=V5("link","href",y).get(f+(u.href||""));if(D){for(var B=0;B<D.length;B++)if(l=D[B],l.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&l.getAttribute("rel")===(u.rel==null?null:u.rel)&&l.getAttribute("title")===(u.title==null?null:u.title)&&l.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){D.splice(B,1);break t}}l=y.createElement(f),Qn(l,f,u),y.head.appendChild(l);break;case"meta":if(D=V5("meta","content",y).get(f+(u.content||""))){for(B=0;B<D.length;B++)if(l=D[B],l.getAttribute("content")===(u.content==null?null:""+u.content)&&l.getAttribute("name")===(u.name==null?null:u.name)&&l.getAttribute("property")===(u.property==null?null:u.property)&&l.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&l.getAttribute("charset")===(u.charSet==null?null:u.charSet)){D.splice(B,1);break t}}l=y.createElement(f),Qn(l,f,u),y.head.appendChild(l);break;default:throw Error(Re(468,f))}l[Yn]=i,Bn(l),f=l}i.stateNode=f}else j5(y,i.type,i.stateNode);else i.stateNode=U5(y,f,i.memoizedProps);else l!==f?(l===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):l.count--,f===null?j5(y,i.type,i.stateNode):U5(y,f,i.memoizedProps)):f===null&&i.stateNode!==null&&Hy(i,i.memoizedProps,u.memoizedProps)}break;case 27:Pr(a,i),Rr(i),f&512&&(cn||u===null||xo(u,u.return)),u!==null&&f&4&&Hy(i,i.memoizedProps,u.memoizedProps);break;case 5:if(Pr(a,i),Rr(i),f&512&&(cn||u===null||xo(u,u.return)),i.flags&32){y=i.stateNode;try{qh(y,"")}catch(ke){ii(i,i.return,ke)}}f&4&&i.stateNode!=null&&(y=i.memoizedProps,Hy(i,y,u!==null?u.memoizedProps:y)),f&1024&&(Xy=!0);break;case 6:if(Pr(a,i),Rr(i),f&4){if(i.stateNode===null)throw Error(Re(162));f=i.memoizedProps,u=i.stateNode;try{u.nodeValue=f}catch(ke){ii(i,i.return,ke)}}break;case 3:if(hg=null,y=$a,$a=Fg(a.containerInfo),Pr(a,i),$a=y,Rr(i),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Kh(a.containerInfo)}catch(ke){ii(i,i.return,ke)}Xy&&(Xy=!1,$T(i));break;case 4:f=$a,$a=Fg(i.stateNode.containerInfo),Pr(a,i),Rr(i),$a=f;break;case 12:Pr(a,i),Rr(i);break;case 31:Pr(a,i),Rr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,$0(i,f)));break;case 13:Pr(a,i),Rr(i),i.child.flags&8192&&i.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(e1=ia()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,$0(i,f)));break;case 22:y=i.memoizedState!==null;var q=u!==null&&u.memoizedState!==null,K=hs,fe=cn;if(hs=K||y,cn=fe||q,Pr(a,i),cn=fe,hs=K,Rr(i),f&8192)e:for(a=i.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(u===null||q||hs||cn||Pc(i)),u=null,a=i;;){if(a.tag===5||a.tag===26){if(u===null){q=u=a;try{if(l=q.stateNode,y)D=l.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{B=q.stateNode;var de=q.memoizedProps.style,oe=de!=null&&de.hasOwnProperty("display")?de.display:null;B.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(ke){ii(q,q.return,ke)}}}else if(a.tag===6){if(u===null){q=a;try{q.stateNode.nodeValue=y?"":q.memoizedProps}catch(ke){ii(q,q.return,ke)}}}else if(a.tag===18){if(u===null){q=a;try{var ce=q.stateNode;y?L5(ce,!0):L5(q.stateNode,!1)}catch(ke){ii(q,q.return,ke)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=i.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,$0(i,u))));break;case 19:Pr(a,i),Rr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,$0(i,f)));break;case 30:break;case 21:break;default:Pr(a,i),Rr(i)}}function Rr(i){var a=i.flags;if(a&2){try{for(var u,f=i.return;f!==null;){if(NT(f)){u=f;break}f=f.return}if(u==null)throw Error(Re(160));switch(u.tag){case 27:var y=u.stateNode,l=$y(i);Dg(i,l,y);break;case 5:var D=u.stateNode;u.flags&32&&(qh(D,""),u.flags&=-33);var B=$y(i);Dg(i,B,D);break;case 3:case 4:var q=u.stateNode.containerInfo,K=$y(i);Lv(i,K,q);break;default:throw Error(Re(161))}}catch(fe){ii(i,i.return,fe)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function $T(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;$T(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function ls(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)VT(i,a.alternate,a),a=a.sibling}function Pc(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:zl(4,a,a.return),Pc(a);break;case 1:xo(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&BT(a,a.return,u),Pc(a);break;case 27:lf(a.stateNode);case 26:case 5:xo(a,a.return),Pc(a);break;case 22:a.memoizedState===null&&Pc(a);break;case 30:Pc(a);break;default:Pc(a)}i=i.sibling}}function cs(i,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,y=i,l=a,D=l.flags;switch(l.tag){case 0:case 11:case 15:cs(y,l,u),Pf(4,l);break;case 1:if(cs(y,l,u),f=l,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(K){ii(f,f.return,K)}if(f=l,y=f.updateQueue,y!==null){var B=f.stateNode;try{var q=y.shared.hiddenCallbacks;if(q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<q.length;y++)G4(q[y],B)}catch(K){ii(f,f.return,K)}}u&&D&64&&OT(l),rf(l,l.return);break;case 27:UT(l);case 26:case 5:cs(y,l,u),u&&f===null&&D&4&&FT(l),rf(l,l.return);break;case 12:cs(y,l,u);break;case 31:cs(y,l,u),u&&D&4&&GT(y,l);break;case 13:cs(y,l,u),u&&D&4&&ZT(y,l);break;case 22:l.memoizedState===null&&cs(y,l,u),rf(l,l.return);break;case 30:break;default:cs(y,l,u)}a=a.sibling}}function kb(i,a){var u=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==u&&(i!=null&&i.refCount++,u!=null&&zf(u))}function Lb(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&zf(i))}function Ha(i,a,u,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)XT(i,a,u,f),a=a.sibling}function XT(i,a,u,f){var y=a.flags;switch(a.tag){case 0:case 11:case 15:Ha(i,a,u,f),y&2048&&Pf(9,a);break;case 1:Ha(i,a,u,f);break;case 3:Ha(i,a,u,f),y&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&zf(i)));break;case 12:if(y&2048){Ha(i,a,u,f),i=a.stateNode;try{var l=a.memoizedProps,D=l.id,B=l.onPostCommit;typeof B=="function"&&B(D,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(q){ii(a,a.return,q)}}else Ha(i,a,u,f);break;case 31:Ha(i,a,u,f);break;case 13:Ha(i,a,u,f);break;case 23:break;case 22:l=a.stateNode,D=a.alternate,a.memoizedState!==null?l._visibility&2?Ha(i,a,u,f):af(i,a):l._visibility&2?Ha(i,a,u,f):(l._visibility|=2,bh(i,a,u,f,(a.subtreeFlags&10256)!==0||!1)),y&2048&&kb(D,a);break;case 24:Ha(i,a,u,f),y&2048&&Lb(a.alternate,a);break;default:Ha(i,a,u,f)}}function bh(i,a,u,f,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var l=i,D=a,B=u,q=f,K=D.flags;switch(D.tag){case 0:case 11:case 15:bh(l,D,B,q,y),Pf(8,D);break;case 23:break;case 22:var fe=D.stateNode;D.memoizedState!==null?fe._visibility&2?bh(l,D,B,q,y):af(l,D):(fe._visibility|=2,bh(l,D,B,q,y)),y&&K&2048&&kb(D.alternate,D);break;case 24:bh(l,D,B,q,y),y&&K&2048&&Lb(D.alternate,D);break;default:bh(l,D,B,q,y)}a=a.sibling}}function af(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=i,f=a,y=f.flags;switch(f.tag){case 22:af(u,f),y&2048&&kb(f.alternate,f);break;case 24:af(u,f),y&2048&&Lb(f.alternate,f);break;default:af(u,f)}a=a.sibling}}var Xp=8192;function vh(i,a,u){if(i.subtreeFlags&Xp)for(i=i.child;i!==null;)YT(i,a,u),i=i.sibling}function YT(i,a,u){switch(i.tag){case 26:vh(i,a,u),i.flags&Xp&&i.memoizedState!==null&&oz(u,$a,i.memoizedState,i.memoizedProps);break;case 5:vh(i,a,u);break;case 3:case 4:var f=$a;$a=Fg(i.stateNode.containerInfo),vh(i,a,u),$a=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=Xp,Xp=16777216,vh(i,a,u),Xp=f):vh(i,a,u));break;default:vh(i,a,u)}}function WT(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function Vp(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];On=f,QT(f,i)}WT(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)KT(i),i=i.sibling}function KT(i){switch(i.tag){case 0:case 11:case 15:Vp(i),i.flags&2048&&zl(9,i,i.return);break;case 3:Vp(i);break;case 12:Vp(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,cg(i)):Vp(i);break;default:Vp(i)}}function cg(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];On=f,QT(f,i)}WT(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:zl(8,a,a.return),cg(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,cg(a));break;default:cg(a)}i=i.sibling}}function QT(i,a){for(;On!==null;){var u=On;switch(u.tag){case 0:case 11:case 15:zl(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:zf(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,On=f;else e:for(u=i;On!==null;){f=On;var y=f.sibling,l=f.return;if(jT(f),f===u){On=null;break e}if(y!==null){y.return=l,On=y;break e}On=l}}}var TA={getCacheForType:function(i){var a=Kn(un),u=a.data.get(i);return u===void 0&&(u=i(),a.data.set(i,u)),u},cacheSignal:function(){return Kn(un).controller.signal}},SA=typeof WeakMap=="function"?WeakMap:Map,qt=0,ui=null,St=null,Mt=0,ti=0,Qr=null,ml=!1,id=!1,Ob=!1,ws=0,Zi=0,Dl=0,Oc=0,Bb=0,ta=0,$h=0,of=null,kr=null,Ov=!1,e1=0,JT=0,Pg=1/0,Rg=null,wl=null,wn=0,Tl=null,Xh=null,_s=0,Bv=0,Fv=null,eS=null,sf=0,Nv=null;function aa(){return(qt&2)!==0&&Mt!==0?Mt&-Mt:ct.T!==null?Nb():c4()}function tS(){if(ta===0)if((Mt&536870912)===0||Pt){var i=B0;B0<<=1,(B0&3932160)===0&&(B0=262144),ta=i}else ta=536870912;return i=sa.current,i!==null&&(i.flags|=32),ta}function Lr(i,a,u){(i===ui&&(ti===2||ti===9)||i.cancelPendingCommit!==null)&&(Yh(i,0),gl(i,Mt,ta,!1)),Ef(i,u),((qt&2)===0||i!==ui)&&(i===ui&&((qt&2)===0&&(Oc|=u),Zi===4&&gl(i,Mt,ta,!1)),So(i))}function iS(i,a,u){if((qt&6)!==0)throw Error(Re(327));var f=!u&&(a&127)===0&&(a&i.expiredLanes)===0||Mf(i,a),y=f?CA(i,a):Yy(i,a,!0),l=f;do{if(y===0){id&&!f&&gl(i,a,0,!1);break}else{if(u=i.current.alternate,l&&!MA(u)){y=Yy(i,a,!1),l=!1;continue}if(y===2){if(l=a,i.errorRecoveryDisabledLanes&l)var D=0;else D=i.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){a=D;e:{var B=i;y=of;var q=B.current.memoizedState.isDehydrated;if(q&&(Yh(B,D).flags|=256),D=Yy(B,D,!1),D!==2){if(Ob&&!q){B.errorRecoveryDisabledLanes|=l,Oc|=l,y=4;break e}l=kr,kr=y,l!==null&&(kr===null?kr=l:kr.push.apply(kr,l))}y=D}if(l=!1,y!==2)continue}}if(y===1){Yh(i,0),gl(i,a,0,!0);break}e:{switch(f=i,l=y,l){case 0:case 1:throw Error(Re(345));case 4:if((a&4194048)!==a)break;case 6:gl(f,a,ta,!ml);break e;case 2:kr=null;break;case 3:case 5:break;default:throw Error(Re(329))}if((a&62914560)===a&&(y=e1+300-ia(),10<y)){if(gl(f,a,ta,!ml),qg(f,0,!0)!==0)break e;_s=a,f.timeoutHandle=wS(b5.bind(null,f,u,kr,Rg,Ov,a,ta,Oc,$h,ml,l,"Throttled",-0,0),y);break e}b5(f,u,kr,Rg,Ov,a,ta,Oc,$h,ml,l,null,-0,0)}}break}while(!0);So(i)}function b5(i,a,u,f,y,l,D,B,q,K,fe,de,oe,ce){if(i.timeoutHandle=-1,de=a.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ps},YT(a,l,de);var ke=(l&62914560)===l?e1-ia():(l&4194048)===l?JT-ia():0;if(ke=sz(de,ke),ke!==null){_s=l,i.cancelPendingCommit=ke(w5.bind(null,i,a,l,u,f,y,D,B,q,fe,de,null,oe,ce)),gl(i,l,D,!K);return}}w5(i,a,l,u,f,y,D,B,q)}function MA(i){for(var a=i;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var y=u[f],l=y.getSnapshot;y=y.value;try{if(!oa(l(),y))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function gl(i,a,u,f){a&=~Bb,a&=~Oc,i.suspendedLanes|=a,i.pingedLanes&=~a,f&&(i.warmLanes|=a),f=i.expirationTimes;for(var y=a;0<y;){var l=31-ra(y),D=1<<l;f[l]=-1,y&=~D}u!==0&&o4(i,u,a)}function t1(){return(qt&6)===0?(Rf(0,!1),!1):!0}function Fb(){if(St!==null){if(ti===0)var i=St.return;else i=St,fs=Hc=null,Tb(i),Fh=null,mf=0,i=St;for(;i!==null;)LT(i.alternate,i),i=i.return;St=null}}function Yh(i,a){var u=i.timeoutHandle;u!==-1&&(i.timeoutHandle=-1,qA(u)),u=i.cancelPendingCommit,u!==null&&(i.cancelPendingCommit=null,u()),_s=0,Fb(),ui=i,St=u=ms(i.current,null),Mt=a,ti=0,Qr=null,ml=!1,id=Mf(i,a),Ob=!1,$h=ta=Bb=Oc=Dl=Zi=0,kr=of=null,Ov=!1,(a&8)!==0&&(a|=a&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=a;0<f;){var y=31-ra(f),l=1<<y;a|=i[y],f&=~l}return ws=a,$g(),u}function nS(i,a){_t=null,ct.H=_f,a===td||a===Yg?(a=Q3(),ti=3):a===gb?(a=Q3(),ti=4):ti=a===Rb?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Qr=a,St===null&&(Zi=1,Ag(i,Sa(a,i.current)))}function rS(){var i=sa.current;return i===null?!0:(Mt&4194048)===Mt?Ea===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?i===Ea:!1}function aS(){var i=ct.H;return ct.H=_f,i===null?_f:i}function oS(){var i=ct.A;return ct.A=TA,i}function Ig(){Zi=4,ml||(Mt&4194048)!==Mt&&sa.current!==null||(id=!0),(Dl&134217727)===0&&(Oc&134217727)===0||ui===null||gl(ui,Mt,ta,!1)}function Yy(i,a,u){var f=qt;qt|=2;var y=aS(),l=oS();(ui!==i||Mt!==a)&&(Rg=null,Yh(i,a)),a=!1;var D=Zi;e:do try{if(ti!==0&&St!==null){var B=St,q=Qr;switch(ti){case 8:Fb(),D=6;break e;case 3:case 2:case 9:case 6:sa.current===null&&(a=!0);var K=ti;if(ti=0,Qr=null,Ih(i,B,q,K),u&&id){D=0;break e}break;default:K=ti,ti=0,Qr=null,Ih(i,B,q,K)}}EA(),D=Zi;break}catch(fe){nS(i,fe)}while(!0);return a&&i.shellSuspendCounter++,fs=Hc=null,qt=f,ct.H=y,ct.A=l,St===null&&(ui=null,Mt=0,$g()),D}function EA(){for(;St!==null;)sS(St)}function CA(i,a){var u=qt;qt|=2;var f=aS(),y=oS();ui!==i||Mt!==a?(Rg=null,Pg=ia()+500,Yh(i,a)):id=Mf(i,a);e:do try{if(ti!==0&&St!==null){a=St;var l=Qr;t:switch(ti){case 1:ti=0,Qr=null,Ih(i,a,l,1);break;case 2:case 9:if(K3(l)){ti=0,Qr=null,x5(a);break}a=function(){ti!==2&&ti!==9||ui!==i||(ti=7),So(i)},l.then(a,a);break e;case 3:ti=7;break e;case 4:ti=5;break e;case 7:K3(l)?(ti=0,Qr=null,x5(a)):(ti=0,Qr=null,Ih(i,a,l,7));break;case 5:var D=null;switch(St.tag){case 26:D=St.memoizedState;case 5:case 27:var B=St;if(D?CS(D):B.stateNode.complete){ti=0,Qr=null;var q=B.sibling;if(q!==null)St=q;else{var K=B.return;K!==null?(St=K,i1(K)):St=null}break t}}ti=0,Qr=null,Ih(i,a,l,5);break;case 6:ti=0,Qr=null,Ih(i,a,l,6);break;case 8:Fb(),Zi=6;break e;default:throw Error(Re(462))}}AA();break}catch(fe){nS(i,fe)}while(!0);return fs=Hc=null,ct.H=f,ct.A=y,qt=u,St!==null?0:(ui=null,Mt=0,$g(),Zi)}function AA(){for(;St!==null&&!KC();)sS(St)}function sS(i){var a=kT(i.alternate,i,ws);i.memoizedProps=i.pendingProps,a===null?i1(i):St=a}function x5(i){var a=i,u=a.alternate;switch(a.tag){case 15:case 0:a=f5(u,a,a.pendingProps,a.type,void 0,Mt);break;case 11:a=f5(u,a,a.pendingProps,a.type.render,a.ref,Mt);break;case 5:Tb(a);default:LT(u,a),a=St=L4(a,ws),a=kT(u,a,ws)}i.memoizedProps=i.pendingProps,a===null?i1(i):St=a}function Ih(i,a,u,f){fs=Hc=null,Tb(a),Fh=null,mf=0;var y=a.return;try{if(gA(i,y,a,u,Mt)){Zi=1,Ag(i,Sa(u,i.current)),St=null;return}}catch(l){if(y!==null)throw St=y,l;Zi=1,Ag(i,Sa(u,i.current)),St=null;return}a.flags&32768?(Pt||f===1?i=!0:id||(Mt&536870912)!==0?i=!1:(ml=i=!0,(f===2||f===9||f===3||f===6)&&(f=sa.current,f!==null&&f.tag===13&&(f.flags|=16384))),lS(a,i)):i1(a)}function i1(i){var a=i;do{if((a.flags&32768)!==0){lS(a,ml);return}i=a.return;var u=vA(a.alternate,a,ws);if(u!==null){St=u;return}if(a=a.sibling,a!==null){St=a;return}St=a=i}while(a!==null);Zi===0&&(Zi=5)}function lS(i,a){do{var u=bA(i.alternate,i);if(u!==null){u.flags&=32767,St=u;return}if(u=i.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(i=i.sibling,i!==null)){St=i;return}St=i=u}while(i!==null);Zi=6,St=null}function w5(i,a,u,f,y,l,D,B,q){i.cancelPendingCommit=null;do n1();while(wn!==0);if((qt&6)!==0)throw Error(Re(327));if(a!==null){if(a===i.current)throw Error(Re(177));if(l=a.lanes|a.childLanes,l|=cb,s8(i,u,l,D,B,q),i===ui&&(St=ui=null,Mt=0),Xh=a,Tl=i,_s=u,Bv=l,Fv=y,eS=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,RA(_g,function(){return pS(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=ct.T,ct.T=null,y=Gt.p,Gt.p=2,D=qt,qt|=4;try{xA(i,a,u)}finally{qt=D,Gt.p=y,ct.T=f}}wn=1,cS(),uS(),hS()}}function cS(){if(wn===1){wn=0;var i=Tl,a=Xh,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=ct.T,ct.T=null;var f=Gt.p;Gt.p=2;var y=qt;qt|=4;try{HT(a,i);var l=qv,D=C4(i.containerInfo),B=l.focusedElem,q=l.selectionRange;if(D!==B&&B&&B.ownerDocument&&E4(B.ownerDocument.documentElement,B)){if(q!==null&&lb(B)){var K=q.start,fe=q.end;if(fe===void 0&&(fe=K),"selectionStart"in B)B.selectionStart=K,B.selectionEnd=Math.min(fe,B.value.length);else{var de=B.ownerDocument||document,oe=de&&de.defaultView||window;if(oe.getSelection){var ce=oe.getSelection(),ke=B.textContent.length,Ne=Math.min(q.start,ke),ve=q.end===void 0?Ne:Math.min(q.end,ke);!ce.extend&&Ne>ve&&(D=ve,ve=Ne,Ne=D);var se=G3(B,Ne),le=G3(B,ve);if(se&&le&&(ce.rangeCount!==1||ce.anchorNode!==se.node||ce.anchorOffset!==se.offset||ce.focusNode!==le.node||ce.focusOffset!==le.offset)){var pe=de.createRange();pe.setStart(se.node,se.offset),ce.removeAllRanges(),Ne>ve?(ce.addRange(pe),ce.extend(le.node,le.offset)):(pe.setEnd(le.node,le.offset),ce.addRange(pe))}}}}for(de=[],ce=B;ce=ce.parentNode;)ce.nodeType===1&&de.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<de.length;B++){var ge=de[B];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}Vg=!!jv,qv=jv=null}finally{qt=y,Gt.p=f,ct.T=u}}i.current=a,wn=2}}function uS(){if(wn===2){wn=0;var i=Tl,a=Xh,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=ct.T,ct.T=null;var f=Gt.p;Gt.p=2;var y=qt;qt|=4;try{VT(i,a.alternate,a)}finally{qt=y,Gt.p=f,ct.T=u}}wn=3}}function hS(){if(wn===4||wn===3){wn=0,QC();var i=Tl,a=Xh,u=_s,f=eS;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?wn=5:(wn=0,Xh=Tl=null,dS(i,i.pendingLanes));var y=i.pendingLanes;if(y===0&&(wl=null),tb(u),a=a.stateNode,na&&typeof na.onCommitFiberRoot=="function")try{na.onCommitFiberRoot(Sf,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=ct.T,y=Gt.p,Gt.p=2,ct.T=null;try{for(var l=i.onRecoverableError,D=0;D<f.length;D++){var B=f[D];l(B.value,{componentStack:B.stack})}}finally{ct.T=a,Gt.p=y}}(_s&3)!==0&&n1(),So(i),y=i.pendingLanes,(u&261930)!==0&&(y&42)!==0?i===Nv?sf++:(sf=0,Nv=i):sf=0,Rf(0,!1)}}function dS(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,zf(a)))}function n1(){return cS(),uS(),hS(),pS()}function pS(){if(wn!==5)return!1;var i=Tl,a=Bv;Bv=0;var u=tb(_s),f=ct.T,y=Gt.p;try{Gt.p=32>u?32:u,ct.T=null,u=Fv,Fv=null;var l=Tl,D=_s;if(wn=0,Xh=Tl=null,_s=0,(qt&6)!==0)throw Error(Re(331));var B=qt;if(qt|=4,KT(l.current),XT(l,l.current,D,u),qt=B,Rf(0,!1),na&&typeof na.onPostCommitFiberRoot=="function")try{na.onPostCommitFiberRoot(Sf,l)}catch{}return!0}finally{Gt.p=y,ct.T=f,dS(i,a)}}function T5(i,a,u){a=Sa(u,a),a=Rv(i.stateNode,a,2),i=xl(i,a,2),i!==null&&(Ef(i,2),So(i))}function ii(i,a,u){if(i.tag===3)T5(i,i,u);else for(;a!==null;){if(a.tag===3){T5(a,i,u);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(wl===null||!wl.has(f))){i=Sa(u,i),u=AT(2),f=xl(a,u,2),f!==null&&(zT(u,f,a,i),Ef(f,2),So(f));break}}a=a.return}}function Wy(i,a,u){var f=i.pingCache;if(f===null){f=i.pingCache=new SA;var y=new Set;f.set(a,y)}else y=f.get(a),y===void 0&&(y=new Set,f.set(a,y));y.has(u)||(Ob=!0,y.add(u),i=zA.bind(null,i,a,u),a.then(i,i))}function zA(i,a,u){var f=i.pingCache;f!==null&&f.delete(a),i.pingedLanes|=i.suspendedLanes&u,i.warmLanes&=~u,ui===i&&(Mt&u)===u&&(Zi===4||Zi===3&&(Mt&62914560)===Mt&&300>ia()-e1?(qt&2)===0&&Yh(i,0):Bb|=u,$h===Mt&&($h=0)),So(i)}function fS(i,a){a===0&&(a=a4()),i=Zc(i,a),i!==null&&(Ef(i,a),So(i))}function DA(i){var a=i.memoizedState,u=0;a!==null&&(u=a.retryLane),fS(i,u)}function PA(i,a){var u=0;switch(i.tag){case 31:case 13:var f=i.stateNode,y=i.memoizedState;y!==null&&(u=y.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(Re(314))}f!==null&&f.delete(a),fS(i,u)}function RA(i,a){return Jv(i,a)}var kg=null,xh=null,Uv=!1,Lg=!1,Ky=!1,_l=0;function So(i){i!==xh&&i.next===null&&(xh===null?kg=xh=i:xh=xh.next=i),Lg=!0,Uv||(Uv=!0,kA())}function Rf(i,a){if(!Ky&&Lg){Ky=!0;do for(var u=!1,f=kg;f!==null;){if(!a)if(i!==0){var y=f.pendingLanes;if(y===0)var l=0;else{var D=f.suspendedLanes,B=f.pingedLanes;l=(1<<31-ra(42|i)+1)-1,l&=y&~(D&~B),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(u=!0,S5(f,l))}else l=Mt,l=qg(f,f===ui?l:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(l&3)===0||Mf(f,l)||(u=!0,S5(f,l));f=f.next}while(u);Ky=!1}}function IA(){mS()}function mS(){Lg=Uv=!1;var i=0;_l!==0&&jA()&&(i=_l);for(var a=ia(),u=null,f=kg;f!==null;){var y=f.next,l=gS(f,a);l===0?(f.next=null,u===null?kg=y:u.next=y,y===null&&(xh=u)):(u=f,(i!==0||(l&3)!==0)&&(Lg=!0)),f=y}wn!==0&&wn!==5||Rf(i,!1),_l!==0&&(_l=0)}function gS(i,a){for(var u=i.suspendedLanes,f=i.pingedLanes,y=i.expirationTimes,l=i.pendingLanes&-62914561;0<l;){var D=31-ra(l),B=1<<D,q=y[D];q===-1?((B&u)===0||(B&f)!==0)&&(y[D]=o8(B,a)):q<=a&&(i.expiredLanes|=B),l&=~B}if(a=ui,u=Mt,u=qg(i,i===a?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,u===0||i===a&&(ti===2||ti===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&Ey(f),i.callbackNode=null,i.callbackPriority=0;if((u&3)===0||Mf(i,u)){if(a=u&-u,a===i.callbackPriority)return a;switch(f!==null&&Ey(f),tb(u)){case 2:case 8:u=n4;break;case 32:u=_g;break;case 268435456:u=r4;break;default:u=_g}return f=_S.bind(null,i),u=Jv(u,f),i.callbackPriority=a,i.callbackNode=u,a}return f!==null&&f!==null&&Ey(f),i.callbackPriority=2,i.callbackNode=null,2}function _S(i,a){if(wn!==0&&wn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var u=i.callbackNode;if(n1()&&i.callbackNode!==u)return null;var f=Mt;return f=qg(i,i===ui?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(iS(i,f,a),gS(i,ia()),i.callbackNode!=null&&i.callbackNode===u?_S.bind(null,i):null)}function S5(i,a){if(n1())return null;iS(i,a,!0)}function kA(){GA(function(){(qt&6)!==0?Jv(i4,IA):mS()})}function Nb(){if(_l===0){var i=Gh;i===0&&(i=O0,O0<<=1,(O0&261888)===0&&(O0=256)),_l=i}return _l}function M5(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:eg(""+i)}function E5(i,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,i.id&&u.setAttribute("form",i.id),a.parentNode.insertBefore(u,a),i=new FormData(i),u.parentNode.removeChild(u),i}function LA(i,a,u,f,y){if(a==="submit"&&u&&u.stateNode===y){var l=M5((y[Or]||null).action),D=f.submitter;D&&(a=(a=D[Or]||null)?M5(a.formAction):D.getAttribute("formAction"),a!==null&&(l=a,D=null));var B=new Gg("action","action",null,f,y);i.push({event:B,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(_l!==0){var q=D?E5(y,D):new FormData(y);Dv(u,{pending:!0,data:q,method:y.method,action:l},null,q)}}else typeof l=="function"&&(B.preventDefault(),q=D?E5(y,D):new FormData(y),Dv(u,{pending:!0,data:q,method:y.method,action:l},l,q))},currentTarget:y}]})}}for(X0=0;X0<yv.length;X0++)Y0=yv[X0],C5=Y0.toLowerCase(),A5=Y0[0].toUpperCase()+Y0.slice(1),Xa(C5,"on"+A5);var Y0,C5,A5,X0;Xa(z4,"onAnimationEnd");Xa(D4,"onAnimationIteration");Xa(P4,"onAnimationStart");Xa("dblclick","onDoubleClick");Xa("focusin","onFocus");Xa("focusout","onBlur");Xa(J8,"onTransitionRun");Xa(eA,"onTransitionStart");Xa(tA,"onTransitionCancel");Xa(R4,"onTransitionEnd");jh("onMouseEnter",["mouseout","mouseover"]);jh("onMouseLeave",["mouseout","mouseover"]);jh("onPointerEnter",["pointerout","pointerover"]);jh("onPointerLeave",["pointerout","pointerover"]);jc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));jc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));jc("onBeforeInput",["compositionend","keypress","textInput","paste"]);jc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));jc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));jc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),OA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yf));function yS(i,a){a=(a&4)!==0;for(var u=0;u<i.length;u++){var f=i[u],y=f.event;f=f.listeners;e:{var l=void 0;if(a)for(var D=f.length-1;0<=D;D--){var B=f[D],q=B.instance,K=B.currentTarget;if(B=B.listener,q!==l&&y.isPropagationStopped())break e;l=B,y.currentTarget=K;try{l(y)}catch(fe){vg(fe)}y.currentTarget=null,l=q}else for(D=0;D<f.length;D++){if(B=f[D],q=B.instance,K=B.currentTarget,B=B.listener,q!==l&&y.isPropagationStopped())break e;l=B,y.currentTarget=K;try{l(y)}catch(fe){vg(fe)}y.currentTarget=null,l=q}}}}function Tt(i,a){var u=a[uv];u===void 0&&(u=a[uv]=new Set);var f=i+"__bubble";u.has(f)||(vS(a,i,2,!1),u.add(f))}function Qy(i,a,u){var f=0;a&&(f|=4),vS(u,i,f,a)}var W0="_reactListening"+Math.random().toString(36).slice(2);function Ub(i){if(!i[W0]){i[W0]=!0,u4.forEach(function(u){u!=="selectionchange"&&(OA.has(u)||Qy(u,!1,i),Qy(u,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[W0]||(a[W0]=!0,Qy("selectionchange",!1,a))}}function vS(i,a,u,f){switch(RS(a)){case 2:var y=uz;break;case 8:y=hz;break;default:y=Gb}u=y.bind(null,a,u,i),y=void 0,!mv||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),f?y!==void 0?i.addEventListener(a,u,{capture:!0,passive:y}):i.addEventListener(a,u,!0):y!==void 0?i.addEventListener(a,u,{passive:y}):i.addEventListener(a,u,!1)}function Jy(i,a,u,f,y){var l=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var D=f.tag;if(D===3||D===4){var B=f.stateNode.containerInfo;if(B===y)break;if(D===4)for(D=f.return;D!==null;){var q=D.tag;if((q===3||q===4)&&D.stateNode.containerInfo===y)return;D=D.return}for(;B!==null;){if(D=Sh(B),D===null)return;if(q=D.tag,q===5||q===6||q===26||q===27){f=l=D;continue e}B=B.parentNode}}f=f.return}y4(function(){var K=l,fe=rb(u),de=[];e:{var oe=I4.get(i);if(oe!==void 0){var ce=Gg,ke=i;switch(i){case"keypress":if(ig(u)===0)break e;case"keydown":case"keyup":ce=P8;break;case"focusin":ke="focus",ce=Py;break;case"focusout":ke="blur",ce=Py;break;case"beforeblur":case"afterblur":ce=Py;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=L3;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=v8;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=k8;break;case z4:case D4:case P4:ce=w8;break;case R4:ce=O8;break;case"scroll":case"scrollend":ce=_8;break;case"wheel":ce=F8;break;case"copy":case"cut":case"paste":ce=S8;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=B3;break;case"toggle":case"beforetoggle":ce=U8}var Ne=(a&4)!==0,ve=!Ne&&(i==="scroll"||i==="scrollend"),se=Ne?oe!==null?oe+"Capture":null:oe;Ne=[];for(var le=K,pe;le!==null;){var ge=le;if(pe=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||pe===null||se===null||(ge=uf(le,se),ge!=null&&Ne.push(vf(le,ge,pe))),ve)break;le=le.return}0<Ne.length&&(oe=new ce(oe,ke,null,u,fe),de.push({event:oe,listeners:Ne}))}}if((a&7)===0){e:{if(oe=i==="mouseover"||i==="pointerover",ce=i==="mouseout"||i==="pointerout",oe&&u!==fv&&(ke=u.relatedTarget||u.fromElement)&&(Sh(ke)||ke[Qh]))break e;if((ce||oe)&&(oe=fe.window===fe?fe:(oe=fe.ownerDocument)?oe.defaultView||oe.parentWindow:window,ce?(ke=u.relatedTarget||u.toElement,ce=K,ke=ke?Sh(ke):null,ke!==null&&(ve=Tf(ke),Ne=ke.tag,ke!==ve||Ne!==5&&Ne!==27&&Ne!==6)&&(ke=null)):(ce=null,ke=K),ce!==ke)){if(Ne=L3,ge="onMouseLeave",se="onMouseEnter",le="mouse",(i==="pointerout"||i==="pointerover")&&(Ne=B3,ge="onPointerLeave",se="onPointerEnter",le="pointer"),ve=ce==null?oe:Hp(ce),pe=ke==null?oe:Hp(ke),oe=new Ne(ge,le+"leave",ce,u,fe),oe.target=ve,oe.relatedTarget=pe,ge=null,Sh(fe)===K&&(Ne=new Ne(se,le+"enter",ke,u,fe),Ne.target=pe,Ne.relatedTarget=ve,ge=Ne),ve=ge,ce&&ke)t:{for(Ne=BA,se=ce,le=ke,pe=0,ge=se;ge;ge=Ne(ge))pe++;ge=0;for(var Be=le;Be;Be=Ne(Be))ge++;for(;0<pe-ge;)se=Ne(se),pe--;for(;0<ge-pe;)le=Ne(le),ge--;for(;pe--;){if(se===le||le!==null&&se===le.alternate){Ne=se;break t}se=Ne(se),le=Ne(le)}Ne=null}else Ne=null;ce!==null&&z5(de,oe,ce,Ne,!1),ke!==null&&ve!==null&&z5(de,ve,ke,Ne,!0)}}e:{if(oe=K?Hp(K):window,ce=oe.nodeName&&oe.nodeName.toLowerCase(),ce==="select"||ce==="input"&&oe.type==="file")var qe=V3;else if(U3(oe))if(S4)qe=W8;else{qe=X8;var Z=$8}else ce=oe.nodeName,!ce||ce.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?K&&nb(K.elementType)&&(qe=V3):qe=Y8;if(qe&&(qe=qe(i,K))){T4(de,qe,u,fe);break e}Z&&Z(i,oe,K),i==="focusout"&&K&&oe.type==="number"&&K.memoizedProps.value!=null&&pv(oe,"number",oe.value)}switch(Z=K?Hp(K):window,i){case"focusin":(U3(Z)||Z.contentEditable==="true")&&(Ch=Z,gv=K,Kp=null);break;case"focusout":Kp=gv=Ch=null;break;case"mousedown":_v=!0;break;case"contextmenu":case"mouseup":case"dragend":_v=!1,Z3(de,u,fe);break;case"selectionchange":if(Q8)break;case"keydown":case"keyup":Z3(de,u,fe)}var Y;if(sb)e:{switch(i){case"compositionstart":var ne="onCompositionStart";break e;case"compositionend":ne="onCompositionEnd";break e;case"compositionupdate":ne="onCompositionUpdate";break e}ne=void 0}else Eh?x4(i,u)&&(ne="onCompositionEnd"):i==="keydown"&&u.keyCode===229&&(ne="onCompositionStart");ne&&(b4&&u.locale!=="ko"&&(Eh||ne!=="onCompositionStart"?ne==="onCompositionEnd"&&Eh&&(Y=v4()):(fl=fe,ab="value"in fl?fl.value:fl.textContent,Eh=!0)),Z=Og(K,ne),0<Z.length&&(ne=new O3(ne,i,null,u,fe),de.push({event:ne,listeners:Z}),Y?ne.data=Y:(Y=w4(u),Y!==null&&(ne.data=Y)))),(Y=j8?q8(i,u):G8(i,u))&&(ne=Og(K,"onBeforeInput"),0<ne.length&&(Z=new O3("onBeforeInput","beforeinput",null,u,fe),de.push({event:Z,listeners:ne}),Z.data=Y)),LA(de,i,K,u,fe)}yS(de,a)})}function vf(i,a,u){return{instance:i,listener:a,currentTarget:u}}function Og(i,a){for(var u=a+"Capture",f=[];i!==null;){var y=i,l=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||l===null||(y=uf(i,u),y!=null&&f.unshift(vf(i,y,l)),y=uf(i,a),y!=null&&f.push(vf(i,y,l))),i.tag===3)return f;i=i.return}return[]}function BA(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function z5(i,a,u,f,y){for(var l=a._reactName,D=[];u!==null&&u!==f;){var B=u,q=B.alternate,K=B.stateNode;if(B=B.tag,q!==null&&q===f)break;B!==5&&B!==26&&B!==27||K===null||(q=K,y?(K=uf(u,l),K!=null&&D.unshift(vf(u,K,q))):y||(K=uf(u,l),K!=null&&D.push(vf(u,K,q)))),u=u.return}D.length!==0&&i.push({event:a,listeners:D})}var FA=/\r\n?/g,NA=/\u0000|\uFFFD/g;function D5(i){return(typeof i=="string"?i:""+i).replace(FA,`
808
+ `).replace(NA,"")}function bS(i,a){return a=D5(a),D5(i)===a}function oi(i,a,u,f,y,l){switch(u){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||qh(i,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&qh(i,""+f);break;case"className":N0(i,"class",f);break;case"tabIndex":N0(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":N0(i,u,f);break;case"style":_4(i,f,l);break;case"data":if(a!=="object"){N0(i,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||u!=="href")){i.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(u);break}f=eg(""+f),i.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof l=="function"&&(u==="formAction"?(a!=="input"&&oi(i,a,"name",y.name,y,null),oi(i,a,"formEncType",y.formEncType,y,null),oi(i,a,"formMethod",y.formMethod,y,null),oi(i,a,"formTarget",y.formTarget,y,null)):(oi(i,a,"encType",y.encType,y,null),oi(i,a,"method",y.method,y,null),oi(i,a,"target",y.target,y,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(u);break}f=eg(""+f),i.setAttribute(u,f);break;case"onClick":f!=null&&(i.onclick=ps);break;case"onScroll":f!=null&&Tt("scroll",i);break;case"onScrollEnd":f!=null&&Tt("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(Re(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(Re(60));i.innerHTML=u}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}u=eg(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,""+f):i.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,""):i.removeAttribute(u);break;case"capture":case"download":f===!0?i.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,f):i.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(u,f):i.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(u):i.setAttribute(u,f);break;case"popover":Tt("beforetoggle",i),Tt("toggle",i),J0(i,"popover",f);break;case"xlinkActuate":as(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":as(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":as(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":as(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":as(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":as(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":as(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":as(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":as(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":J0(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=m8.get(u)||u,J0(i,u,f))}}function Vv(i,a,u,f,y,l){switch(u){case"style":_4(i,f,l);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(Re(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(Re(60));i.innerHTML=u}}break;case"children":typeof f=="string"?qh(i,f):(typeof f=="number"||typeof f=="bigint")&&qh(i,""+f);break;case"onScroll":f!=null&&Tt("scroll",i);break;case"onScrollEnd":f!=null&&Tt("scrollend",i);break;case"onClick":f!=null&&(i.onclick=ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!h4.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),a=u.slice(2,y?u.length-7:void 0),l=i[Or]||null,l=l!=null?l[u]:null,typeof l=="function"&&i.removeEventListener(a,l,y),typeof f=="function")){typeof l!="function"&&l!==null&&(u in i?i[u]=null:i.hasAttribute(u)&&i.removeAttribute(u)),i.addEventListener(a,f,y);break e}u in i?i[u]=f:f===!0?i.setAttribute(u,""):J0(i,u,f)}}}function Qn(i,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",i),Tt("load",i);var f=!1,y=!1,l;for(l in u)if(u.hasOwnProperty(l)){var D=u[l];if(D!=null)switch(l){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Re(137,a));default:oi(i,a,l,D,u,null)}}y&&oi(i,a,"srcSet",u.srcSet,u,null),f&&oi(i,a,"src",u.src,u,null);return;case"input":Tt("invalid",i);var B=l=D=y=null,q=null,K=null;for(f in u)if(u.hasOwnProperty(f)){var fe=u[f];if(fe!=null)switch(f){case"name":y=fe;break;case"type":D=fe;break;case"checked":q=fe;break;case"defaultChecked":K=fe;break;case"value":l=fe;break;case"defaultValue":B=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(Re(137,a));break;default:oi(i,a,f,fe,u,null)}}f4(i,l,B,q,K,D,y,!1);return;case"select":Tt("invalid",i),f=D=l=null;for(y in u)if(u.hasOwnProperty(y)&&(B=u[y],B!=null))switch(y){case"value":l=B;break;case"defaultValue":D=B;break;case"multiple":f=B;default:oi(i,a,y,B,u,null)}a=l,u=D,i.multiple=!!f,a!=null?Lh(i,!!f,a,!1):u!=null&&Lh(i,!!f,u,!0);return;case"textarea":Tt("invalid",i),l=y=f=null;for(D in u)if(u.hasOwnProperty(D)&&(B=u[D],B!=null))switch(D){case"value":f=B;break;case"defaultValue":y=B;break;case"children":l=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(Re(91));break;default:oi(i,a,D,B,u,null)}g4(i,f,y,l);return;case"option":for(q in u)u.hasOwnProperty(q)&&(f=u[q],f!=null)&&(q==="selected"?i.selected=f&&typeof f!="function"&&typeof f!="symbol":oi(i,a,q,f,u,null));return;case"dialog":Tt("beforetoggle",i),Tt("toggle",i),Tt("cancel",i),Tt("close",i);break;case"iframe":case"object":Tt("load",i);break;case"video":case"audio":for(f=0;f<yf.length;f++)Tt(yf[f],i);break;case"image":Tt("error",i),Tt("load",i);break;case"details":Tt("toggle",i);break;case"embed":case"source":case"link":Tt("error",i),Tt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in u)if(u.hasOwnProperty(K)&&(f=u[K],f!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(Re(137,a));default:oi(i,a,K,f,u,null)}return;default:if(nb(a)){for(fe in u)u.hasOwnProperty(fe)&&(f=u[fe],f!==void 0&&Vv(i,a,fe,f,u,void 0));return}}for(B in u)u.hasOwnProperty(B)&&(f=u[B],f!=null&&oi(i,a,B,f,u,null))}function UA(i,a,u,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,l=null,D=null,B=null,q=null,K=null,fe=null;for(ce in u){var de=u[ce];if(u.hasOwnProperty(ce)&&de!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":q=de;default:f.hasOwnProperty(ce)||oi(i,a,ce,null,f,de)}}for(var oe in f){var ce=f[oe];if(de=u[oe],f.hasOwnProperty(oe)&&(ce!=null||de!=null))switch(oe){case"type":l=ce;break;case"name":y=ce;break;case"checked":K=ce;break;case"defaultChecked":fe=ce;break;case"value":D=ce;break;case"defaultValue":B=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(Re(137,a));break;default:ce!==de&&oi(i,a,oe,ce,f,de)}}dv(i,D,B,q,K,fe,l,y);return;case"select":ce=D=B=oe=null;for(l in u)if(q=u[l],u.hasOwnProperty(l)&&q!=null)switch(l){case"value":break;case"multiple":ce=q;default:f.hasOwnProperty(l)||oi(i,a,l,null,f,q)}for(y in f)if(l=f[y],q=u[y],f.hasOwnProperty(y)&&(l!=null||q!=null))switch(y){case"value":oe=l;break;case"defaultValue":B=l;break;case"multiple":D=l;default:l!==q&&oi(i,a,y,l,f,q)}a=B,u=D,f=ce,oe!=null?Lh(i,!!u,oe,!1):!!f!=!!u&&(a!=null?Lh(i,!!u,a,!0):Lh(i,!!u,u?[]:"",!1));return;case"textarea":ce=oe=null;for(B in u)if(y=u[B],u.hasOwnProperty(B)&&y!=null&&!f.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:oi(i,a,B,null,f,y)}for(D in f)if(y=f[D],l=u[D],f.hasOwnProperty(D)&&(y!=null||l!=null))switch(D){case"value":oe=y;break;case"defaultValue":ce=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(Re(91));break;default:y!==l&&oi(i,a,D,y,f,l)}m4(i,oe,ce);return;case"option":for(var ke in u)oe=u[ke],u.hasOwnProperty(ke)&&oe!=null&&!f.hasOwnProperty(ke)&&(ke==="selected"?i.selected=!1:oi(i,a,ke,null,f,oe));for(q in f)oe=f[q],ce=u[q],f.hasOwnProperty(q)&&oe!==ce&&(oe!=null||ce!=null)&&(q==="selected"?i.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":oi(i,a,q,oe,f,ce));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in u)oe=u[Ne],u.hasOwnProperty(Ne)&&oe!=null&&!f.hasOwnProperty(Ne)&&oi(i,a,Ne,null,f,oe);for(K in f)if(oe=f[K],ce=u[K],f.hasOwnProperty(K)&&oe!==ce&&(oe!=null||ce!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(Re(137,a));break;default:oi(i,a,K,oe,f,ce)}return;default:if(nb(a)){for(var ve in u)oe=u[ve],u.hasOwnProperty(ve)&&oe!==void 0&&!f.hasOwnProperty(ve)&&Vv(i,a,ve,void 0,f,oe);for(fe in f)oe=f[fe],ce=u[fe],!f.hasOwnProperty(fe)||oe===ce||oe===void 0&&ce===void 0||Vv(i,a,fe,oe,f,ce);return}}for(var se in u)oe=u[se],u.hasOwnProperty(se)&&oe!=null&&!f.hasOwnProperty(se)&&oi(i,a,se,null,f,oe);for(de in f)oe=f[de],ce=u[de],!f.hasOwnProperty(de)||oe===ce||oe==null&&ce==null||oi(i,a,de,oe,f,ce)}function P5(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function VA(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var y=u[f],l=y.transferSize,D=y.initiatorType,B=y.duration;if(l&&B&&P5(D)){for(D=0,B=y.responseEnd,f+=1;f<u.length;f++){var q=u[f],K=q.startTime;if(K>B)break;var fe=q.transferSize,de=q.initiatorType;fe&&P5(de)&&(q=q.responseEnd,D+=fe*(q<B?1:(B-K)/(q-K)))}if(--f,a+=8*(l+D)/(y.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var jv=null,qv=null;function Bg(i){return i.nodeType===9?i:i.ownerDocument}function R5(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function xS(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function Gv(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var ev=null;function jA(){var i=window.event;return i&&i.type==="popstate"?i===ev?!1:(ev=i,!0):(ev=null,!1)}var wS=typeof setTimeout=="function"?setTimeout:void 0,qA=typeof clearTimeout=="function"?clearTimeout:void 0,I5=typeof Promise=="function"?Promise:void 0,GA=typeof queueMicrotask=="function"?queueMicrotask:typeof I5<"u"?function(i){return I5.resolve(null).then(i).catch(ZA)}:wS;function ZA(i){setTimeout(function(){throw i})}function Rl(i){return i==="head"}function k5(i,a){var u=a,f=0;do{var y=u.nextSibling;if(i.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(f===0){i.removeChild(y),Kh(a);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")lf(i.ownerDocument.documentElement);else if(u==="head"){u=i.ownerDocument.head,lf(u);for(var l=u.firstChild;l;){var D=l.nextSibling,B=l.nodeName;l[Cf]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&l.rel.toLowerCase()==="stylesheet"||u.removeChild(l),l=D}}else u==="body"&&lf(i.ownerDocument.body);u=y}while(u);Kh(a)}function L5(i,a){var u=i;i=0;do{var f=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(i===0)break;i--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||i++;u=f}while(u)}function Zv(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Zv(u),ib(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}i.removeChild(u)}}function HA(i,a,u,f){for(;i.nodeType===1;){var y=u;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[Cf])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(l=i.getAttribute("rel"),l==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(l!==y.rel||i.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||i.getAttribute("title")!==(y.title==null?null:y.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(l=i.getAttribute("src"),(l!==(y.src==null?null:y.src)||i.getAttribute("type")!==(y.type==null?null:y.type)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&l&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var l=y.name==null?null:""+y.name;if(y.type==="hidden"&&i.getAttribute("name")===l)return i}else return i;if(i=Ca(i.nextSibling),i===null)break}return null}function $A(i,a,u){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!u||(i=Ca(i.nextSibling),i===null))return null;return i}function TS(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Ca(i.nextSibling),i===null))return null;return i}function Hv(i){return i.data==="$?"||i.data==="$~"}function $v(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function XA(i,a){var u=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||u.readyState!=="loading")a();else{var f=function(){a(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function Ca(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var Xv=null;function O5(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var u=i.data;if(u==="/$"||u==="/&"){if(a===0)return Ca(i.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}i=i.nextSibling}return null}function B5(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var u=i.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return i;a--}else u!=="/$"&&u!=="/&"||a++}i=i.previousSibling}return null}function SS(i,a,u){switch(a=Bg(u),i){case"html":if(i=a.documentElement,!i)throw Error(Re(452));return i;case"head":if(i=a.head,!i)throw Error(Re(453));return i;case"body":if(i=a.body,!i)throw Error(Re(454));return i;default:throw Error(Re(451))}}function lf(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);ib(i)}var Aa=new Map,F5=new Set;function Fg(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ts=Gt.d;Gt.d={f:YA,r:WA,D:KA,C:QA,L:JA,m:ez,X:iz,S:tz,M:nz};function YA(){var i=Ts.f(),a=t1();return i||a}function WA(i){var a=Jh(i);a!==null&&a.tag===5&&a.type==="form"?_T(a):Ts.r(i)}var nd=typeof document>"u"?null:document;function MS(i,a,u){var f=nd;if(f&&typeof a=="string"&&a){var y=Ta(a);y='link[rel="'+i+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),F5.has(y)||(F5.add(y),i={rel:i,crossOrigin:u,href:a},f.querySelector(y)===null&&(a=f.createElement("link"),Qn(a,"link",i),Bn(a),f.head.appendChild(a)))}}function KA(i){Ts.D(i),MS("dns-prefetch",i,null)}function QA(i,a){Ts.C(i,a),MS("preconnect",i,a)}function JA(i,a,u){Ts.L(i,a,u);var f=nd;if(f&&i&&a){var y='link[rel="preload"][as="'+Ta(a)+'"]';a==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Ta(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Ta(u.imageSizes)+'"]')):y+='[href="'+Ta(i)+'"]';var l=y;switch(a){case"style":l=Wh(i);break;case"script":l=rd(i)}Aa.has(l)||(i=Ei({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:i,as:a},u),Aa.set(l,i),f.querySelector(y)!==null||a==="style"&&f.querySelector(If(l))||a==="script"&&f.querySelector(kf(l))||(a=f.createElement("link"),Qn(a,"link",i),Bn(a),f.head.appendChild(a)))}}function ez(i,a){Ts.m(i,a);var u=nd;if(u&&i){var f=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Ta(f)+'"][href="'+Ta(i)+'"]',l=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=rd(i)}if(!Aa.has(l)&&(i=Ei({rel:"modulepreload",href:i},a),Aa.set(l,i),u.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(kf(l)))return}f=u.createElement("link"),Qn(f,"link",i),Bn(f),u.head.appendChild(f)}}}function tz(i,a,u){Ts.S(i,a,u);var f=nd;if(f&&i){var y=kh(f).hoistableStyles,l=Wh(i);a=a||"default";var D=y.get(l);if(!D){var B={loading:0,preload:null};if(D=f.querySelector(If(l)))B.loading=5;else{i=Ei({rel:"stylesheet",href:i,"data-precedence":a},u),(u=Aa.get(l))&&Vb(i,u);var q=D=f.createElement("link");Bn(q),Qn(q,"link",i),q._p=new Promise(function(K,fe){q.onload=K,q.onerror=fe}),q.addEventListener("load",function(){B.loading|=1}),q.addEventListener("error",function(){B.loading|=2}),B.loading|=4,ug(D,a,f)}D={type:"stylesheet",instance:D,count:1,state:B},y.set(l,D)}}}function iz(i,a){Ts.X(i,a);var u=nd;if(u&&i){var f=kh(u).hoistableScripts,y=rd(i),l=f.get(y);l||(l=u.querySelector(kf(y)),l||(i=Ei({src:i,async:!0},a),(a=Aa.get(y))&&jb(i,a),l=u.createElement("script"),Bn(l),Qn(l,"link",i),u.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},f.set(y,l))}}function nz(i,a){Ts.M(i,a);var u=nd;if(u&&i){var f=kh(u).hoistableScripts,y=rd(i),l=f.get(y);l||(l=u.querySelector(kf(y)),l||(i=Ei({src:i,async:!0,type:"module"},a),(a=Aa.get(y))&&jb(i,a),l=u.createElement("script"),Bn(l),Qn(l,"link",i),u.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},f.set(y,l))}}function N5(i,a,u,f){var y=(y=yl.current)?Fg(y):null;if(!y)throw Error(Re(446));switch(i){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Wh(u.href),u=kh(y).hoistableStyles,f=u.get(a),f||(f={type:"style",instance:null,count:0,state:null},u.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){i=Wh(u.href);var l=kh(y).hoistableStyles,D=l.get(i);if(D||(y=y.ownerDocument||y,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(i,D),(l=y.querySelector(If(i)))&&!l._p&&(D.instance=l,D.state.loading=5),Aa.has(i)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Aa.set(i,u),l||rz(y,i,u,D.state))),a&&f===null)throw Error(Re(528,""));return D}if(a&&f!==null)throw Error(Re(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=rd(u),u=kh(y).hoistableScripts,f=u.get(a),f||(f={type:"script",instance:null,count:0,state:null},u.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(Re(444,i))}}function Wh(i){return'href="'+Ta(i)+'"'}function If(i){return'link[rel="stylesheet"]['+i+"]"}function ES(i){return Ei({},i,{"data-precedence":i.precedence,precedence:null})}function rz(i,a,u,f){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=i.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Qn(a,"link",u),Bn(a),i.head.appendChild(a))}function rd(i){return'[src="'+Ta(i)+'"]'}function kf(i){return"script[async]"+i}function U5(i,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var f=i.querySelector('style[data-href~="'+Ta(u.href)+'"]');if(f)return a.instance=f,Bn(f),f;var y=Ei({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),Bn(f),Qn(f,"style",y),ug(f,u.precedence,i),a.instance=f;case"stylesheet":y=Wh(u.href);var l=i.querySelector(If(y));if(l)return a.state.loading|=4,a.instance=l,Bn(l),l;f=ES(u),(y=Aa.get(y))&&Vb(f,y),l=(i.ownerDocument||i).createElement("link"),Bn(l);var D=l;return D._p=new Promise(function(B,q){D.onload=B,D.onerror=q}),Qn(l,"link",f),a.state.loading|=4,ug(l,u.precedence,i),a.instance=l;case"script":return l=rd(u.src),(y=i.querySelector(kf(l)))?(a.instance=y,Bn(y),y):(f=u,(y=Aa.get(l))&&(f=Ei({},u),jb(f,y)),i=i.ownerDocument||i,y=i.createElement("script"),Bn(y),Qn(y,"link",f),i.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(Re(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,ug(f,u.precedence,i));return a.instance}function ug(i,a,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,l=y,D=0;D<f.length;D++){var B=f[D];if(B.dataset.precedence===a)l=B;else if(l!==y)break}l?l.parentNode.insertBefore(i,l.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(i,a.firstChild))}function Vb(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function jb(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var hg=null;function V5(i,a,u){if(hg===null){var f=new Map,y=hg=new Map;y.set(u,f)}else y=hg,f=y.get(u),f||(f=new Map,y.set(u,f));if(f.has(i))return f;for(f.set(i,null),u=u.getElementsByTagName(i),y=0;y<u.length;y++){var l=u[y];if(!(l[Cf]||l[Yn]||i==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var D=l.getAttribute(a)||"";D=i+D;var B=f.get(D);B?B.push(l):f.set(D,[l])}}return f}function j5(i,a,u){i=i.ownerDocument||i,i.head.insertBefore(u,a==="title"?i.querySelector("head > title"):null)}function az(i,a,u){if(u===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(i=a.disabled,typeof a.precedence=="string"&&i==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function CS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function oz(i,a,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Wh(f.href),l=a.querySelector(If(y));if(l){a=l._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Ng.bind(i),a.then(i,i)),u.state.loading|=4,u.instance=l,Bn(l);return}l=a.ownerDocument||a,f=ES(f),(y=Aa.get(y))&&Vb(f,y),l=l.createElement("link"),Bn(l);var D=l;D._p=new Promise(function(B,q){D.onload=B,D.onerror=q}),Qn(l,"link",f),u.instance=l}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(i.count++,u=Ng.bind(i),a.addEventListener("load",u),a.addEventListener("error",u))}}var tv=0;function sz(i,a){return i.stylesheets&&i.count===0&&dg(i,i.stylesheets),0<i.count||0<i.imgCount?function(u){var f=setTimeout(function(){if(i.stylesheets&&dg(i,i.stylesheets),i.unsuspend){var l=i.unsuspend;i.unsuspend=null,l()}},6e4+a);0<i.imgBytes&&tv===0&&(tv=62500*VA());var y=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&dg(i,i.stylesheets),i.unsuspend)){var l=i.unsuspend;i.unsuspend=null,l()}},(i.imgBytes>tv?50:800)+a);return i.unsuspend=u,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function Ng(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dg(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ug=null;function dg(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ug=new Map,a.forEach(lz,i),Ug=null,Ng.call(i))}function lz(i,a){if(!(a.state.loading&4)){var u=Ug.get(i);if(u)var f=u.get(null);else{u=new Map,Ug.set(i,u);for(var y=i.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<y.length;l++){var D=y[l];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(u.set(D.dataset.precedence,D),f=D)}f&&u.set(null,f)}y=a.instance,D=y.getAttribute("data-precedence"),l=u.get(D)||f,l===f&&u.set(null,y),u.set(D,y),this.count++,f=Ng.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),l?l.parentNode.insertBefore(y,l.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(y,i.firstChild)),a.state.loading|=4}}var bf={$$typeof:ds,Provider:null,Consumer:null,_currentValue:Rc,_currentValue2:Rc,_threadCount:0};function cz(i,a,u,f,y,l,D,B,q){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Cy(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cy(0),this.hiddenUpdates=Cy(null),this.identifierPrefix=f,this.onUncaughtError=y,this.onCaughtError=l,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function AS(i,a,u,f,y,l,D,B,q,K,fe,de){return i=new cz(i,a,u,D,q,K,fe,de,B),a=1,l===!0&&(a|=24),l=ea(3,null,null,a),i.current=l,l.stateNode=i,a=fb(),a.refCount++,i.pooledCache=a,a.refCount++,l.memoizedState={element:f,isDehydrated:u,cache:a},_b(l),i}function zS(i){return i?(i=Dh,i):Dh}function DS(i,a,u,f,y,l){y=zS(y),f.context===null?f.context=y:f.pendingContext=y,f=bl(a),f.payload={element:u},l=l===void 0?null:l,l!==null&&(f.callback=l),u=xl(i,f,a),u!==null&&(Lr(u,i,a),Jp(u,i,a))}function q5(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u<a?u:a}}function qb(i,a){q5(i,a),(i=i.alternate)&&q5(i,a)}function PS(i){if(i.tag===13||i.tag===31){var a=Zc(i,67108864);a!==null&&Lr(a,i,67108864),qb(i,67108864)}}function G5(i){if(i.tag===13||i.tag===31){var a=aa();a=eb(a);var u=Zc(i,a);u!==null&&Lr(u,i,a),qb(i,a)}}var Vg=!0;function uz(i,a,u,f){var y=ct.T;ct.T=null;var l=Gt.p;try{Gt.p=2,Gb(i,a,u,f)}finally{Gt.p=l,ct.T=y}}function hz(i,a,u,f){var y=ct.T;ct.T=null;var l=Gt.p;try{Gt.p=8,Gb(i,a,u,f)}finally{Gt.p=l,ct.T=y}}function Gb(i,a,u,f){if(Vg){var y=Yv(f);if(y===null)Jy(i,a,f,jg,u),Z5(i,f);else if(pz(y,i,a,u,f))f.stopPropagation();else if(Z5(i,f),a&4&&-1<dz.indexOf(i)){for(;y!==null;){var l=Jh(y);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var D=zc(l.pendingLanes);if(D!==0){var B=l;for(B.pendingLanes|=2,B.entangledLanes|=2;D;){var q=1<<31-ra(D);B.entanglements[1]|=q,D&=~q}So(l),(qt&6)===0&&(Pg=ia()+500,Rf(0,!1))}}break;case 31:case 13:B=Zc(l,2),B!==null&&Lr(B,l,2),t1(),qb(l,2)}if(l=Yv(f),l===null&&Jy(i,a,f,jg,u),l===y)break;y=l}y!==null&&f.stopPropagation()}else Jy(i,a,f,null,u)}}function Yv(i){return i=rb(i),Zb(i)}var jg=null;function Zb(i){if(jg=null,i=Sh(i),i!==null){var a=Tf(i);if(a===null)i=null;else{var u=a.tag;if(u===13){if(i=K5(a),i!==null)return i;i=null}else if(u===31){if(i=Q5(a),i!==null)return i;i=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return jg=i,null}function RS(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(JC()){case i4:return 2;case n4:return 8;case _g:case e8:return 32;case r4:return 268435456;default:return 32}default:return 32}}var Wv=!1,Sl=null,Ml=null,El=null,xf=new Map,wf=new Map,dl=[],dz="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Z5(i,a){switch(i){case"focusin":case"focusout":Sl=null;break;case"dragenter":case"dragleave":Ml=null;break;case"mouseover":case"mouseout":El=null;break;case"pointerover":case"pointerout":xf.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":wf.delete(a.pointerId)}}function jp(i,a,u,f,y,l){return i===null||i.nativeEvent!==l?(i={blockedOn:a,domEventName:u,eventSystemFlags:f,nativeEvent:l,targetContainers:[y]},a!==null&&(a=Jh(a),a!==null&&PS(a)),i):(i.eventSystemFlags|=f,a=i.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),i)}function pz(i,a,u,f,y){switch(a){case"focusin":return Sl=jp(Sl,i,a,u,f,y),!0;case"dragenter":return Ml=jp(Ml,i,a,u,f,y),!0;case"mouseover":return El=jp(El,i,a,u,f,y),!0;case"pointerover":var l=y.pointerId;return xf.set(l,jp(xf.get(l)||null,i,a,u,f,y)),!0;case"gotpointercapture":return l=y.pointerId,wf.set(l,jp(wf.get(l)||null,i,a,u,f,y)),!0}return!1}function IS(i){var a=Sh(i.target);if(a!==null){var u=Tf(a);if(u!==null){if(a=u.tag,a===13){if(a=K5(u),a!==null){i.blockedOn=a,A3(i.priority,function(){G5(u)});return}}else if(a===31){if(a=Q5(u),a!==null){i.blockedOn=a,A3(i.priority,function(){G5(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){i.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}i.blockedOn=null}function pg(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var u=Yv(i.nativeEvent);if(u===null){u=i.nativeEvent;var f=new u.constructor(u.type,u);fv=f,u.target.dispatchEvent(f),fv=null}else return a=Jh(u),a!==null&&PS(a),i.blockedOn=u,!1;a.shift()}return!0}function H5(i,a,u){pg(i)&&u.delete(a)}function fz(){Wv=!1,Sl!==null&&pg(Sl)&&(Sl=null),Ml!==null&&pg(Ml)&&(Ml=null),El!==null&&pg(El)&&(El=null),xf.forEach(H5),wf.forEach(H5)}function K0(i,a){i.blockedOn===a&&(i.blockedOn=null,Wv||(Wv=!0,Tn.unstable_scheduleCallback(Tn.unstable_NormalPriority,fz)))}var Q0=null;function $5(i){Q0!==i&&(Q0=i,Tn.unstable_scheduleCallback(Tn.unstable_NormalPriority,function(){Q0===i&&(Q0=null);for(var a=0;a<i.length;a+=3){var u=i[a],f=i[a+1],y=i[a+2];if(typeof f!="function"){if(Zb(f||u)===null)continue;break}var l=Jh(u);l!==null&&(i.splice(a,3),a-=3,Dv(l,{pending:!0,data:y,method:u.method,action:f},f,y))}}))}function Kh(i){function a(q){return K0(q,i)}Sl!==null&&K0(Sl,i),Ml!==null&&K0(Ml,i),El!==null&&K0(El,i),xf.forEach(a),wf.forEach(a);for(var u=0;u<dl.length;u++){var f=dl[u];f.blockedOn===i&&(f.blockedOn=null)}for(;0<dl.length&&(u=dl[0],u.blockedOn===null);)IS(u),u.blockedOn===null&&dl.shift();if(u=(i.ownerDocument||i).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var y=u[f],l=u[f+1],D=y[Or]||null;if(typeof l=="function")D||$5(u);else if(D){var B=null;if(l&&l.hasAttribute("formAction")){if(y=l,D=l[Or]||null)B=D.formAction;else if(Zb(y)!==null)continue}else B=D.action;typeof B=="function"?u[f+1]=B:(u.splice(f,3),f-=3),$5(u)}}}function kS(){function i(l){l.canIntercept&&l.info==="react-transition"&&l.intercept({handler:function(){return new Promise(function(D){return y=D})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),f||setTimeout(u,20)}function u(){if(!f&&!navigation.transition){var l=navigation.currentEntry;l&&l.url!=null&&navigation.navigate(l.url,{state:l.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,y=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function Hb(i){this._internalRoot=i}r1.prototype.render=Hb.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(Re(409));var u=a.current,f=aa();DS(u,f,i,a,null,null)};r1.prototype.unmount=Hb.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;DS(i.current,2,null,i,null,null),t1(),a[Qh]=null}};function r1(i){this._internalRoot=i}r1.prototype.unstable_scheduleHydration=function(i){if(i){var a=c4();i={blockedOn:null,target:i,priority:a};for(var u=0;u<dl.length&&a!==0&&a<dl[u].priority;u++);dl.splice(u,0,i),u===0&&IS(i)}};var X5=Y5.version;if(X5!=="19.2.7")throw Error(Re(527,X5,"19.2.7"));Gt.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(Re(188)):(i=Object.keys(i).join(","),Error(Re(268,i)));return i=HC(a),i=i!==null?J5(i):null,i=i===null?null:i.stateNode,i};var mz={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:ct,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(qp=__REACT_DEVTOOLS_GLOBAL_HOOK__,!qp.isDisabled&&qp.supportsFiber))try{Sf=qp.inject(mz),na=qp}catch{}var qp;a1.createRoot=function(i,a){if(!W5(i))throw Error(Re(299));var u=!1,f="",y=MT,l=ET,D=CT;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(l=a.onCaughtError),a.onRecoverableError!==void 0&&(D=a.onRecoverableError)),a=AS(i,1,!1,null,null,u,f,null,y,l,D,kS),i[Qh]=a.current,Ub(i),new Hb(a)};a1.hydrateRoot=function(i,a,u){if(!W5(i))throw Error(Re(299));var f=!1,y="",l=MT,D=ET,B=CT,q=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(l=u.onUncaughtError),u.onCaughtError!==void 0&&(D=u.onCaughtError),u.onRecoverableError!==void 0&&(B=u.onRecoverableError),u.formState!==void 0&&(q=u.formState)),a=AS(i,1,!0,a,u??null,f,y,q,l,D,B,kS),a.context=zS(null),u=a.current,f=aa(),f=eb(f),y=bl(f),y.callback=null,xl(u,y,f),u=f,a.current.lanes=u,Ef(a,u),So(a),i[Qh]=a.current,Ub(i),new r1(a)};a1.version="19.2.7"});var FS=qa((VP,BS)=>{"use strict";function OS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OS)}catch(i){console.error(i)}}OS(),BS.exports=LS()});var Sz={};VE(Sz,{BridgeMocker:()=>Yb,DebugConsole:()=>Wb,GeolocationEvent:()=>Ap,GlobalEvent:()=>qw,Map:()=>fy,MapControls:()=>K_,MapControlsContext:()=>fo,MapMenu:()=>Cp,MapMenuDivider:()=>y0,MapMenuFooter:()=>v0,MapMenuItem:()=>g0,MapMenuTitle:()=>_0,MiniAppSDK:()=>Of,RouteLayer:()=>dy,SDKMapProvider:()=>W_,SDKProvider:()=>vz,UIEvent:()=>jw,default:()=>Tz,handleClearRoute:()=>wz,handleDrawRoute:()=>xz,handleRouteRequest:()=>bz,renderMap:()=>$b,sdk:()=>qi,useIsMocked:()=>yz,useLiveRouting:()=>J_,useMapControls:()=>sC,useRoute:()=>lC,useTrimmedRoute:()=>ey,useUserLocation:()=>zp});var Ep=class{callbacks=new Map;eventListeners=new Map;constructor(){if(typeof window<"u"){let a=Object.freeze({onNativeMessage:u=>this.handleNativeMessage(u)});typeof window.__MiniAppBridge>"u"&&Object.defineProperty(window,"__MiniAppBridge",{configurable:!0,value:a,writable:!1}),window.addEventListener("message",u=>{if(u.data)try{let f=typeof u.data=="string"?JSON.parse(u.data):u.data;f&&typeof f=="object"&&(f.callbackId||f.event||f.eventName)&&this.handleNativeMessage(f)}catch{}})}}on(a,u){let f=this.eventListeners.get(a);return f||(f=[],this.eventListeners.set(a,f)),f.push(u),()=>this.off(a,u)}off(a,u){let f=this.eventListeners.get(a);f&&this.eventListeners.set(a,f.filter(y=>y!==u))}send(a,u,f=3e4){return this.isNative()?new Promise((y,l)=>{let D=`${a}_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,B=setTimeout(()=>{this.callbacks.has(D)&&(this.callbacks.delete(D),l(new Error(`Bridge request timeout: ${a}`)))},f);this.callbacks.set(D,{reject:l,resolve:y,timeout:B});let q={callbackId:D,payload:u,type:a},K=window;K.ReactNativeWebView?.postMessage?K.ReactNativeWebView.postMessage(JSON.stringify(q)):(clearTimeout(B),this.callbacks.delete(D),l(new Error("Bridge not available")))}):this.handleMockMessage(a,u)}handleNativeMessage(a){if(!a||typeof a!="object")return;let u=a.callbackId;if(u&&typeof u=="string"){let y=this.callbacks.get(u);if(y){clearTimeout(y.timeout);let{resolve:l,reject:D}=y;a.success===!1||a.error?D(a.error||"Unknown error"):l(a.value??a.payload??a),this.callbacks.delete(u);return}}let f=a.eventName||a.event;if(f&&(a.type==="EVENT"||!a.type||a.event)){let y=this.eventListeners.get(f);if(y)for(let l of y)try{l(a.payload||a.value)}catch(D){console.error(`Error in event listener for ${f}:`,D)}}}handleMockMessage(a,u){return console.warn(`[Bridge] Mock mode active: Unhandled message type ${a}`),Promise.resolve()}isNative(){return typeof window>"u"?!1:window.__UP_REACT_NATIVE_APP__===!0||!!window.ReactNativeWebView}};var Sc=it(At(),1),Jt=it(Qt(),1),m0=(i,a)=>typeof i=="number"?i:i.endsWith("%")?parseFloat(i)/100*a:parseFloat(i),Ow=(0,Sc.forwardRef)(({menuItems:i,state:a,onChangeState:u,side:f,etaBarHeight:y=0,etaData:l,touchStartY:D,setTouchStartY:B,currentTouchY:q,setCurrentTouchY:K,isDragging:fe,clampedDragOffset:de,drawerPeekHeight:oe,drawerFullHeight:ce,containerHeight:ke,menuContent:Ne,enableTouchDrag:ve=!1,safeAreaInsets:se={top:0,bottom:0,left:0,right:0}},le)=>{let pe=(0,Sc.useRef)(null),ge=(0,Sc.useRef)(null);(0,Sc.useImperativeHandle)(le,()=>pe.current);let Be=()=>{u(f==="left"?a==="closed"?"full":"closed":a==="closed"?"peek":a==="peek"?"full":"peek")},qe=Ye=>{f==="bottom"&&(B(Ye.targetTouches[0].clientY),K(Ye.targetTouches[0].clientY))},Z=Ye=>{if(D===null||f!=="bottom")return;let ze=pe.current?pe.current.scrollTop===0:!0,Ie=Ye.targetTouches[0].clientY;D-Ie<0&&!ze||K(Ie)},Y=Ye=>{if(D===null||q===null||f!=="bottom")return;let ze=Ye.changedTouches[0].clientY;if(Math.abs(ze-D)<10){B(null),K(null);return}let Ge=ge.current?.parentElement,We=ke||(Ge?Ge.getBoundingClientRect().height:window.innerHeight),Ke=Ge?Ge.getBoundingClientRect().top:0,yt=ze-Ke,st=We-yt,Nt=m0(ce||"85%",We),Zt=m0(oe||"15%",We),Ut=32+(a==="closed"?se.bottom:0),Ji=Math.abs(st-Nt),Bi=Math.abs(st-Zt),ri=Math.abs(st-Ut),dn=Math.min(Ji,Bi,ri);u(dn===Ji?"full":dn===Bi?"peek":"closed"),B(null),K(null)},xe=a==="full"?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none",Fe=()=>{let Ye=ke||window.innerHeight,ze=m0(ce||"85%",Ye),Ie=m0(oe||"15%",Ye);return a==="full"?`translateY(${de}px)`:a==="peek"?`translateY(calc(${ze-Ie}px + ${de}px))`:`translateY(calc(${ze-32}px + ${de}px))`};return(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)("style",{children:`
809
+ .no-scrollbar {
810
+ -ms-overflow-style: none;
811
+ scrollbar-width: none;
812
+ }
813
+ .no-scrollbar::-webkit-scrollbar {
814
+ display: none;
815
+ }
816
+ `}),(0,Jt.jsx)("div",{className:`absolute inset-0 bg-black/45 backdrop-blur-[1px] transition-opacity duration-300 z-30 ${xe}`,onClick:()=>u("closed")}),f==="left"?(0,Jt.jsxs)("div",{className:`absolute top-4 left-0 w-80 bg-zinc-950/85 backdrop-blur-md border-r border-y border-white/10 rounded-r-2xl shadow-2xl flex z-40 transition-transform duration-300 ease-out select-none ${a!=="closed"?"translate-x-0":"translate-x-[calc(-100%+24px)]"}`,ref:ge,style:{bottom:`calc(1rem + ${y}px)`},children:[(0,Jt.jsxs)("div",{className:"flex-1 flex flex-col h-full overflow-hidden pl-4 py-4 pr-1",children:[(0,Jt.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-white/10 mb-2",children:(0,Jt.jsx)("span",{className:"text-sm font-bold tracking-wider text-zinc-400 uppercase",children:"Menu"})}),(0,Jt.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar pr-2",ref:pe,children:Ne||(0,Jt.jsx)("div",{className:"flex flex-col gap-1.5",children:i.map(Ye=>(0,Jt.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${Ye.disabled?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:Ye.disabled,onClick:()=>{Ye.disabled||(Ye.onPress(),u("closed"))},children:[(0,Jt.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[Ye.icon,Ye.badge!==void 0&&(0,Jt.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:Ye.badge})]}),(0,Jt.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:Ye.label})]},Ye.id))})})]}),(0,Jt.jsx)("div",{className:"w-6 flex items-center justify-center cursor-pointer hover:bg-white/5 active:bg-white/10 transition-colors border-l border-white/5 rounded-r-2xl",onClick:Be,children:(0,Jt.jsx)("div",{className:"w-1.5 h-12 bg-white/20 rounded-full transition-colors group-hover:bg-white/40"})})]}):(0,Jt.jsxs)("div",{className:`absolute w-full bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-t-2xl shadow-2xl flex flex-col z-40 select-none ${fe?"transition-none":"transition-transform duration-300 ease-out"}`,onTouchEnd:ve?Y:void 0,onTouchMove:ve?Z:void 0,onTouchStart:ve?qe:void 0,ref:ge,style:{bottom:"0px",marginBottom:a==="closed"?`${se.bottom}px`:"0px",height:typeof ce=="number"?`${ce}px`:ce||"85%",transform:Fe(),transition:fe?"none":"transform 300ms ease-out, margin-bottom 250ms ease-in-out"},children:[(0,Jt.jsx)("div",{className:"w-full h-8 flex flex-col items-center justify-center cursor-pointer hover:bg-white/5 rounded-t-2xl transition-colors border-b border-white/5",onClick:Be,children:(0,Jt.jsx)("div",{className:"w-12 h-1 bg-white/25 rounded-full"})}),(0,Jt.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden px-4 pb-4 pt-2 transition-[margin-top] duration-250 ease-in-out",style:{marginTop:a==="closed"?`${se.bottom}px`:"0px"},children:(0,Jt.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar",ref:pe,children:Ne||(0,Jt.jsx)("div",{className:"flex flex-col gap-1",children:i.map(Ye=>(0,Jt.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${Ye.disabled?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:Ye.disabled,onClick:()=>{Ye.disabled||(Ye.onPress(),u("closed"))},children:[(0,Jt.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[Ye.icon,Ye.badge!==void 0&&(0,Jt.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:Ye.badge})]}),(0,Jt.jsx)("span",{className:"text-sm font-medium tracking-wide",children:Ye.label})]},Ye.id))})})})]})]})});var rt=it(Qt(),1),Bw=({etaData:i,layoutMode:a,onHeaderClick:u,style:f,isDragging:y=!1})=>a==="closed-banner"?(0,rt.jsxs)("div",{className:"w-full h-10 flex items-center justify-between px-4 pb-2 pt-1 border-b border-white/5 bg-zinc-950/15 relative overflow-hidden",children:[(0,rt.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:u,children:[(0,rt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,rt.jsxs)("span",{className:"text-xs font-bold text-emerald-400",children:[i.etaMins," min (",i.distanceRemainingKm.toFixed(1)," km)"]})]}),i.onAbort&&(0,rt.jsx)("button",{className:"px-1 py-1 text-[10px] font-black bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/25 active:scale-95 rounded-md transition-all cursor-pointer pointer-events-auto",onClick:l=>{l.stopPropagation(),i.onAbort?.()},children:(0,rt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,rt.jsx)("path",{d:"M18 6 6 18"}),(0,rt.jsx)("path",{d:"m6 6 12 12"})]})}),i.progress!==void 0&&(0,rt.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-white/5",children:(0,rt.jsx)("div",{className:"h-full bg-cyan-400",style:{width:`${i.progress}%`}})})]}):a==="open-card"?(0,rt.jsxs)("div",{className:"mx-4 mt-2 p-4 bg-white/5 border border-white/10 rounded-xl flex flex-col",children:[(0,rt.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,rt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,rt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,rt.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:i.label||"Journey Active"})]}),i.onAbort&&(0,rt.jsx)("button",{className:"px-1 px-1 text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer pointer-events-auto",onClick:i.onAbort,children:(0,rt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,rt.jsx)("path",{d:"M18 6 6 18"}),(0,rt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,rt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-1.5 mb-2.5",children:[(0,rt.jsxs)("div",{className:"text-center",children:[(0,rt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[i.etaMins,(0,rt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" min"})]}),(0,rt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Time Remaining"})]}),(0,rt.jsxs)("div",{className:"text-center",children:[(0,rt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[i.distanceRemainingKm.toFixed(1),(0,rt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" km"})]}),(0,rt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Distance Remaining"})]})]}),i.progress!==void 0&&(0,rt.jsxs)("div",{className:"mb-3",children:[(0,rt.jsxs)("div",{className:"flex justify-between text-[9px] font-bold text-zinc-450 mb-1",children:[(0,rt.jsx)("span",{children:"Progress"}),(0,rt.jsxs)("span",{children:[Math.round(i.progress),"%"]})]}),(0,rt.jsx)("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:(0,rt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${i.progress}%`}})})]}),i.mode==="preview"&&i.onStart&&(0,rt.jsx)("button",{className:"w-full py-2.5 text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 active:scale-95 rounded-lg transition-all cursor-pointer",onClick:i.onStart,children:"Start Guidance"})]}):(0,rt.jsxs)("div",{className:`absolute left-1/2 -translate-x-1/2 z-40 w-[calc(100%-2rem)] max-w-[320px] sm:max-w-[380px] bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-2xl shadow-2xl p-3 sm:p-4 flex flex-col pointer-events-auto select-none ${y?"transition-none":"transition-all duration-300 ease-out"}`,style:f,children:[(0,rt.jsxs)("div",{className:"flex items-center justify-between mb-2 sm:mb-3",children:[(0,rt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,rt.jsx)("span",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,rt.jsx)("span",{className:"text-[9px] sm:text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:i.label||"Guidance Active"})]}),i.onAbort&&(0,rt.jsx)("button",{className:"px-1 py-1 text-[10px] sm:text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer",onClick:i.onAbort,children:(0,rt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,rt.jsx)("path",{d:"M18 6 6 18"}),(0,rt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,rt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-0.5 sm:py-1 mb-2 sm:mb-3",children:[(0,rt.jsx)("div",{className:"text-center",children:(0,rt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[i.etaMins,(0,rt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","min"]})]})}),(0,rt.jsx)("div",{className:"text-center",children:(0,rt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[i.distanceRemainingKm.toFixed(1),(0,rt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","km"]})]})})]}),i.progress!==void 0&&(0,rt.jsxs)("div",{children:[(0,rt.jsxs)("div",{className:"flex justify-between text-[8px] sm:text-[9px] font-bold text-zinc-400 mb-1",children:[(0,rt.jsx)("span",{children:"Progress"}),(0,rt.jsxs)("span",{children:[Math.round(i.progress),"%"]})]}),(0,rt.jsx)("div",{className:"h-1 sm:h-1.5 bg-white/10 rounded-full overflow-hidden",children:(0,rt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${i.progress}%`}})})]}),i.mode==="preview"&&i.onStart&&(0,rt.jsx)("button",{className:"mt-2.5 sm:mt-3 py-1.5 sm:py-2 text-[11px] sm:text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 active:scale-95 rounded-lg transition-all cursor-pointer",onClick:i.onStart,children:"Start Guidance"})]});var zt=it(Qt(),1),Fw=({customControls:i=[],etaBarHeight:a,onRecenter:u,isMapCentered:f,mapBearing:y,mapPitch:l,onResetBearing:D,initialViewState:B,drawerState:q,side:K,etaData:fe,isDragging:de,clampedDragOffset:oe,customRecenterButton:ce,customCompassButton:ke,drawerPeekHeight:Ne,insets:ve={top:0,bottom:0,left:0,right:0}})=>{let se=i.filter(ne=>ne.position==="above-recenter"),le=i.filter(ne=>ne.position==="below-recenter"),pe=Math.abs(y)>=.5||Math.abs(l)>=.5,ge="32px",Be=fe?a:q==="closed"?ve.bottom:0,qe=typeof Ne=="number"?`${Ne}px`:Ne||"15%",Z=K==="bottom"?q==="closed"?`calc(${ge} + 1rem + ${Be}px - ${oe}px)`:`calc(${qe} + 1rem + ${fe?a:0}px - ${oe}px)`:`calc(1rem + ${ve.bottom}px)`;return(0,zt.jsxs)("div",{className:`absolute right-4 z-30 flex flex-col items-center gap-3 select-none pointer-events-none ${de?"transition-none":"transition-all duration-300 ease-out"} ${K!=="bottom"||q!=="full"?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-75 pointer-events-none"}`,style:{bottom:Z},children:[se.length>0&&(0,zt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:se.map(ne=>(0,zt.jsxs)("div",{className:"relative group flex items-center",children:[ne.tooltip&&(0,zt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ne.tooltip}),(0,zt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer ${ne.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":"hover:bg-zinc-900"}`,onClick:ne.onPress,children:ne.icon})]},ne.id))}),pe&&(ke?(0,zt.jsx)("div",{className:"pointer-events-auto",children:ke}):(0,zt.jsx)("div",{className:"pointer-events-auto",children:(0,zt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all duration-300 ${pe?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none h-0 w-0 border-none m-0 p-0 overflow-hidden"}`,onClick:()=>D({pitch:B?.pitch??0}),style:{transform:pe?"scale(1) rotate(0deg)":"scale(0.7) rotate(0deg)"},title:"Reset bearing to North",children:(0,zt.jsxs)("svg",{className:"w-7 h-7 transition-transform duration-75 ease-out",fill:"none",style:{transform:`rotate(${-y}deg)`},viewBox:"0 0 24 24",children:[(0,zt.jsx)("circle",{cx:"12",cy:"12",r:"9.5",stroke:"white",strokeOpacity:"0.2",strokeWidth:"1"}),(0,zt.jsx)("path",{d:"M12 4.5L15 12H9L12 4.5Z",fill:"#ef4444"}),(0,zt.jsx)("path",{d:"M12 19.5L9 12H15L12 19.5Z",fill:"#f4f4f5"}),(0,zt.jsx)("circle",{cx:"12",cy:"12",fill:"#18181b",r:"1.5"})]})})})),ce?(0,zt.jsx)("div",{className:"pointer-events-auto",children:ce}):(0,zt.jsx)("div",{className:"pointer-events-auto",children:(0,zt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer ${f?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":"hover:bg-zinc-900"}`,onClick:()=>u(),title:"Recenter Map",children:f?(0,zt.jsxs)("svg",{className:"w-6 h-6 text-cyan-400",fill:"none",stroke:"currentColor",strokeWidth:"2.2",viewBox:"0 0 24 24",children:[(0,zt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,zt.jsx)("circle",{cx:"12",cy:"12",fill:"currentColor",r:"3"}),(0,zt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,zt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,zt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,zt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]}):(0,zt.jsxs)("svg",{className:"w-6 h-6 text-zinc-300",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,zt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,zt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,zt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,zt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,zt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]})})}),le.length>0&&(0,zt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:le.map(ne=>(0,zt.jsxs)("div",{className:"relative group flex items-center",children:[ne.tooltip&&(0,zt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ne.tooltip}),(0,zt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer ${ne.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":"hover:bg-zinc-900"}`,onClick:ne.onPress,children:ne.icon})]},ne.id))})]})};var ei=it(At(),1),Nw=it(Qt(),1),fo=(0,ei.createContext)(null),W_=({children:i})=>{let[a,u]=(0,ei.useState)(!0),[f,y]=(0,ei.useState)(0),[l,D]=(0,ei.useState)(0),[B,q]=(0,ei.useState)("closed"),K=(0,ei.useRef)(null),fe=(0,ei.useCallback)(ze=>{q(ze)},[]),[de,oe]=(0,ei.useState)(!1),ce=(0,ei.useCallback)(ze=>{oe(Ie=>Ie===ze?Ie:ze)},[]),[ke,Ne]=(0,ei.useState)(void 0),ve=(0,ei.useCallback)(ze=>{Ne(Ie=>!Ie&&!ze?Ie:!Ie||!ze?ze:Ie.etaMins===ze.etaMins&&Ie.distanceRemainingKm===ze.distanceRemainingKm&&Ie.label===ze.label&&Ie.progress===ze.progress&&Ie.mode===ze.mode&&Ie.isCalculating===ze.isCalculating&&Ie.error===ze.error?Ie:ze)},[]),[se,le]=(0,ei.useState)({top:0,bottom:0,left:0,right:0}),pe=(0,ei.useCallback)(ze=>{le(Ie=>({...Ie,...ze}))},[]),ge=(0,ei.useRef)(null),Be=(0,ei.useRef)(null),qe=(0,ei.useCallback)(ze=>{ge.current&&ge.current(ze)},[]),Z=(0,ei.useCallback)(ze=>{Be.current&&Be.current(ze)},[]),Y=(0,ei.useCallback)(ze=>{ge.current=ze},[]),ne=(0,ei.useCallback)(ze=>{Be.current=ze},[]),xe=(0,ei.useCallback)(ze=>{y(ze)},[]),Fe=(0,ei.useCallback)(ze=>{D(ze)},[]),Ye=(0,ei.useMemo)(()=>({_registerCenterCallback:Y,_registerResetBearingCallback:ne,bearing:f,centerOnUser:qe,drawerContentRef:K,drawerState:B,etaData:ke,hasControls:de,isFollowing:a,pitch:l,resetBearing:Z,setBearing:xe,setDrawerState:fe,setEtaData:ve,setHasControls:ce,setIsFollowing:u,setPitch:Fe,insets:se,setInsets:pe}),[Y,ne,f,qe,B,ke,de,a,l,Z,xe,fe,ve,ce,Fe,se,pe]);return(0,Nw.jsx)(fo.Provider,{value:Ye,children:i})},sC=()=>{let i=(0,ei.useContext)(fo);if(!i)throw new Error("useMapControls must be used within a MapControlsProvider");return i};var kn=it(At(),1),is=it(Qt(),1),Uw=(i,a)=>typeof i=="number"?i:i.endsWith("%")?parseFloat(i)/100*a:parseFloat(i),K_=({menuItems:i=[],drawerSide:a,customControls:u=[],etaBarHeight:f=100,onRecenter:y,isMapCentered:l,mapBearing:D,onResetBearing:B,etaData:q,customRecenterButton:K,defaultState:fe,initialViewState:de,customCompassButton:oe,drawerPeekHeight:ce,drawerFullHeight:ke,drawerContentRef:Ne,menuContent:ve,children:se,enableTouchDrag:le=!1,isInternal:pe=!1})=>{let ge=(0,kn.useContext)(fo),Be=ge?.drawerContentRef,qe=(0,kn.useCallback)(Ht=>{Ne&&(typeof Ne=="function"?Ne(Ht):Ne.current=Ht),Be&&(Be.current=Ht)},[Ne,Be]),[Z,Y]=(0,kn.useState)(fe??"closed"),ne=ge?ge.drawerState:Z,xe=(0,kn.useCallback)(Ht=>{ge?ge.setDrawerState(Ht):Y(Ht)},[ge]);(0,kn.useEffect)(()=>{fe&&ge&&ge.setDrawerState(fe)},[]);let[Fe,Ye]=(0,kn.useState)("left"),ze=(0,kn.useRef)(null),[Ie,Ge]=(0,kn.useState)(600);(0,kn.useEffect)(()=>{let Ht=ze.current?.parentElement;if(!Ht)return;let Mn=()=>{Ge(Ht.getBoundingClientRect().height)};Mn();let wr=new ResizeObserver(Mn);return wr.observe(Ht),()=>{wr.disconnect()}},[]);let We=ge?.setHasControls;(0,kn.useEffect)(()=>{if(We&&!pe)return We(!0),()=>We(!1)},[We,pe]);let Ke=l!==void 0?l:ge?ge.isFollowing:!0,yt=D!==void 0?D:ge?ge.bearing:0,st=Ht=>{y?y(Ht):ge&&ge.centerOnUser(Ht)},Nt=Ht=>{B?B(Ht):ge&&ge.resetBearing(Ht)},Zt=ge?ge.pitch:0,Ut=q!==void 0?q:ge?.etaData,[Ji,Bi]=(0,kn.useState)(null),[ri,dn]=(0,kn.useState)(null);(0,kn.useEffect)(()=>{if(typeof window>"u")return;let Ht=()=>{a?Ye(a):window.innerWidth<768?Ye("bottom"):Ye("left")};return Ht(),window.addEventListener("resize",Ht),()=>window.removeEventListener("resize",Ht)},[a]);let hi=Ji!==null&&ri!==null,Fr=hi?ri-Ji:0,Sn=Fr;ne==="full"?Sn=Math.max(0,Fr):ne==="closed"&&(Sn=Math.min(0,Fr));let Nr=Uw(ke||"85%",Ie),tt=Uw(ce||"15%",Ie),kt=32;ne==="peek"?kt=tt:ne==="full"&&(kt=Nr);let Wt=kt-Sn,Fi=tt+20,di=tt+(Nr-tt)*.35,Ri=ge?.insets.bottom||0,pn=1,la="1rem";return Fe==="bottom"?(Wt<=Fi?pn=1:Wt>=di?pn=0:pn=1-(Wt-Fi)/(di-Fi),la=`${Wt+(ne==="closed"?Ri:0)+16}px`):(pn=ne==="full"?0:1,la=`calc(1rem + ${Ri}px)`),(0,is.jsxs)(is.Fragment,{children:[(0,is.jsx)("div",{ref:ze,style:{display:"none"}}),(0,is.jsx)(Ow,{clampedDragOffset:Sn,containerHeight:Ie,currentTouchY:ri,drawerFullHeight:ke,drawerPeekHeight:ce,enableTouchDrag:le,etaBarHeight:f,etaData:Ut,isDragging:hi,menuContent:se||ve,menuItems:i,onChangeState:xe,ref:qe,safeAreaInsets:ge?.insets,setCurrentTouchY:dn,setTouchStartY:Bi,side:Fe,state:ne,touchStartY:Ji}),(0,is.jsx)(Fw,{clampedDragOffset:Sn,customCompassButton:oe,customControls:u,customRecenterButton:K,drawerPeekHeight:ce,drawerState:ne,etaBarHeight:f+(ne==="closed"?Ri:0),etaData:Ut,initialViewState:de,insets:ge?.insets,isDragging:hi,isMapCentered:Ke,mapBearing:yt,mapPitch:Zt,onRecenter:()=>st(),onResetBearing:Nt,side:Fe}),Ut&&(0,is.jsx)(Bw,{etaData:Ut,isDragging:hi,layoutMode:"floating-card",style:{bottom:la,opacity:pn,pointerEvents:pn>.1?"auto":"none",transition:hi?"none":"bottom 250ms ease-in-out, opacity 300ms ease-out"}})]})};var Vw=it(At(),1),Ga=it(Qt(),1),Cp=({children:i})=>(0,Ga.jsx)("div",{className:"flex flex-col gap-1.5",children:i}),g0=({id:i,label:a,icon:u,onPress:f,badge:y,disabled:l=!1,children:D})=>{let B=(0,Vw.useContext)(fo);return(0,Ga.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${l?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:l,onClick:K=>{l||(f&&f(),B&&B.setDrawerState&&B.setDrawerState("closed"))},type:"button",children:[u&&(0,Ga.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[u,y!==void 0&&(0,Ga.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:y})]}),(0,Ga.jsxs)("div",{className:"flex-1 flex flex-col justify-center",children:[(0,Ga.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:a}),D]})]})};Cp.displayName="MapMenu";g0.displayName="MapMenuItem";var _0=({children:i,showDivider:a=!0,className:u=""})=>(0,Ga.jsx)("div",{className:`flex items-center justify-between pb-3 first:mt-0 px-3.5 ${u} ${a?"border-b border-white/10 mb-2 mt-4":""}`,children:i});_0.displayName="MapMenuTitle";var y0=({className:i=""})=>(0,Ga.jsx)("div",{className:`h-[1px] bg-white/10 my-3 mx-3.5 ${i}`});y0.displayName="MapMenuDivider";var v0=({children:i,className:a=""})=>(0,Ga.jsx)("div",{className:`mt-auto pt-4 border-t border-white/10 px-3.5 text-xs text-zinc-500 font-medium ${a}`,children:i});v0.displayName="MapMenuFooter";var jw=(f=>(f.TOP_SCROLL_MORE="TOP_SCROLL_MORE",f.BOTTOM_SCROLL_MORE="BOTTOM_SCROLL_MORE",f.BACK_GESTURE="BACK_GESTURE",f))(jw||{}),Ap=(u=>(u.LOCATION_UPDATE="LOCATION_UPDATE",u.LOCATION_STREAM_UPDATE="LOCATION_STREAM_UPDATE",u))(Ap||{}),qw=(a=>(a.UPDATE_CONTEXT="UPDATE_CONTEXT",a))(qw||{});var ns=it(At(),1),Q_=.12,zp=()=>{let[i,a]=(0,ns.useState)({accuracy:null,coords:null,heading:null}),u=(0,ns.useRef)({accuracy:null,coords:null,heading:null}),f=(0,ns.useRef)({accuracy:null,coords:null,heading:null}),y=(0,ns.useCallback)(l=>{let D=l.location?.coords||l.coords,B=l.heading||l.coords,q=D?[D.longitude,D.latitude]:null,K=null;return B?.trueHeading!==void 0&&B.trueHeading>=0?K=B.trueHeading:B?.magneticHeading!==void 0&&B.magneticHeading>=0?K=B.magneticHeading:B?.heading!==null&&B.heading>=0&&(K=B.heading),{accuracy:D?.accuracy||null,coords:q,heading:K}},[]);return(0,ns.useEffect)(()=>{let l,D=()=>{let K=!1;if(u.current.coords)if(!f.current.coords)f.current.coords=[...u.current.coords],K=!0;else{let[fe,de]=u.current.coords,[oe,ce]=f.current.coords,ke=oe+(fe-oe)*Q_,Ne=ce+(de-ce)*Q_;(Math.abs(ke-oe)>1e-7||Math.abs(Ne-ce)>1e-7)&&(f.current.coords=[ke,Ne],K=!0)}if(u.current.heading!==null)if(f.current.heading===null)f.current.heading=u.current.heading,K=!0;else{let fe=u.current.heading,de=f.current.heading,oe=fe-de;oe>180&&(oe-=360),oe<-180&&(oe+=360);let ke=((de+oe*Q_)%360+360)%360;Math.abs(oe)>.1&&(f.current.heading=ke,K=!0)}K&&a({accuracy:u.current.accuracy,coords:f.current.coords?[...f.current.coords]:null,heading:f.current.heading}),l=requestAnimationFrame(D)};l=requestAnimationFrame(D),qi.location.getCurrentPosition().then(K=>{let fe=y(K);u.current=fe}).catch(K=>console.warn("Initial location fetch failed",K));let B=qi.on("LOCATION_STREAM_UPDATE",K=>{u.current=y(K)}),q=qi.on("LOCATION_UPDATE",K=>{u.current=y(K)});return qi.location.startStream({distanceFilter:1,headingThreshold:2}).catch(K=>console.warn("Failed to start location stream",K)),()=>{cancelAnimationFrame(l),B(),q(),qi.location.stopStream().catch(()=>{})}},[y]),i};var Xi=it(At(),1),J_=({origin:i,destination:a,profile:u="driving",recalculateThreshold:f=50,enabled:y=!0,initialMode:l="preview"})=>{let[D,B]=(0,Xi.useState)(null),[q,K]=(0,Xi.useState)(null),[fe,de]=(0,Xi.useState)(!1),[oe,ce]=(0,Xi.useState)(null),[ke,Ne]=(0,Xi.useState)(l),ve=zp(),se=i||ve.coords,le=(0,Xi.useRef)(null),pe=(0,Xi.useRef)(null),ge=(0,Xi.useRef)(!1),Be=(0,Xi.useCallback)((Y,ne)=>{let Fe=Y[1]*Math.PI/180,Ye=ne[1]*Math.PI/180,ze=(ne[1]-Y[1])*Math.PI/180,Ie=(ne[0]-Y[0])*Math.PI/180,Ge=Math.sin(ze/2)*Math.sin(ze/2)+Math.cos(Fe)*Math.cos(Ye)*Math.sin(Ie/2)*Math.sin(Ie/2);return 6371e3*(2*Math.atan2(Math.sqrt(Ge),Math.sqrt(1-Ge)))},[]),qe=(0,Xi.useMemo)(()=>!se||!a?null:Be(se,a),[se,a,Be]),Z=(0,Xi.useCallback)(async(Y,ne,xe)=>{if(!ge.current){ge.current=!0,de(!0);try{let Fe=await qi.routing.getRoute({destination:ne,origin:Y,profile:u});B(Fe),ce(null),xe&&K(Fe.distanceMeters),le.current=Y,pe.current=ne}catch(Fe){ce(Fe.message||"Failed to fetch route")}finally{de(!1),ge.current=!1}}},[u]);return(0,Xi.useEffect)(()=>{if(!y||!a||!se){(!y||!a)&&(B(null),K(null),le.current=null,pe.current=null);return}!pe.current||pe.current[0]!==a[0]||pe.current[1]!==a[1]?Z(se,a,!0):le.current?Be(se,le.current)>f&&Z(se,a,!1):Z(se,a,!0)},[se,a,y,f,Z,Be]),{currentDistanceMeters:qe,error:oe,isCalculating:fe,mode:ke,recalculate:()=>se&&a&&Z(se,a,!1),route:D,start:()=>Ne("navigation"),totalDistance:q}},lC=(i,a,u="driving")=>{let[f,y]=(0,Xi.useState)(null),[l,D]=(0,Xi.useState)(!1),[B,q]=(0,Xi.useState)(null);return(0,Xi.useEffect)(()=>{if(!i||!a){y(null);return}(async()=>{D(!0);try{let fe=await qi.routing.getRoute({destination:a,origin:i,profile:u});y(fe),q(null)}catch(fe){q(fe.message||"Failed to fetch route")}finally{D(!1)}})()},[i,a,u]),{error:B,isCalculating:l,route:f}};var Gw=it(At(),1),ey=(i,a)=>(0,Gw.useMemo)(()=>{if(!i||!a||i.coordinates.length<2)return i;let u=i.coordinates,f=1/0,y=0,l=(B,q)=>(B[0]-q[0])**2+(B[1]-q[1])**2;for(let B=0;B<u.length;B++){let q=l(a,u[B]);q<f&&(f=q,y=B)}let D=u.slice(y+1);return{coordinates:[a,...D],type:"LineString"}},[i,a]);var rl=it(At(),1),Kr=it(At(),1);var b0=it(At(),1),mo=it(At(),1);var x0=b0.createContext(null),ty=i=>{let[a,u]=(0,mo.useState)({}),f=(0,mo.useCallback)((l,D="default")=>{u(B=>{if(D==="current")throw new Error("'current' cannot be used as map id");if(B[D])throw new Error(`Multiple maps with the same id: ${D}`);return{...B,[D]:l}})},[]),y=(0,mo.useCallback)((l="default")=>{u(D=>{if(D[l]){let B={...D};return delete B[l],B}return D})},[]);return b0.createElement(x0.Provider,{value:{maps:a,onMapMount:f,onMapUnmount:y}},i.children)};function iy(){let i=(0,mo.useContext)(x0)?.maps,a=(0,mo.useContext)(Wr);return(0,mo.useMemo)(()=>({...i,current:a?.map}),[i,a])}function Zw(i,a){let u=Array.isArray(i)?i[0]:i?i.x:0,f=Array.isArray(i)?i[1]:i?i.y:0,y=Array.isArray(a)?a[0]:a?a.x:0,l=Array.isArray(a)?a[1]:a?a.y:0;return u===y&&f===l}function xn(i,a){if(i===a)return!0;if(!i||!a)return!1;if(Array.isArray(i)){if(!Array.isArray(a)||i.length!==a.length)return!1;for(let u=0;u<i.length;u++)if(!xn(i[u],a[u]))return!1;return!0}else if(Array.isArray(a))return!1;if(typeof i=="object"&&typeof a=="object"){let u=Object.keys(i),f=Object.keys(a);if(u.length!==f.length)return!1;for(let y of u)if(!a.hasOwnProperty(y)||!xn(i[y],a[y]))return!1;return!0}return!1}function ny(i){return{longitude:i.center.lng,latitude:i.center.lat,zoom:i.zoom,pitch:i.pitch,bearing:i.bearing,padding:i.padding}}function ry(i,a){let u=a.viewState||a,f={};if("longitude"in u&&"latitude"in u&&(u.longitude!==i.center.lng||u.latitude!==i.center.lat)){let y=i.center.constructor;f.center=new y(u.longitude,u.latitude)}return"zoom"in u&&u.zoom!==i.zoom&&(f.zoom=u.zoom),"bearing"in u&&u.bearing!==i.bearing&&(f.bearing=u.bearing),"pitch"in u&&u.pitch!==i.pitch&&(f.pitch=u.pitch),u.padding&&i.padding&&!xn(u.padding,i.padding)&&(f.padding=u.padding),f}var cC=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ay(i){if(!i)return null;if(typeof i=="string"||("toJS"in i&&(i=i.toJS()),!i.layers))return i;let a={};for(let f of i.layers)a[f.id]=f;let u=i.layers.map(f=>{let y=null;"interactive"in f&&(y=Object.assign({},f),delete y.interactive);let l=a[f.ref];if(l){y=y||Object.assign({},f),delete y.ref;for(let D of cC)D in l&&(y[D]=l[D])}return y||f});return{...i,layers:u}}var Hw={version:8,sources:{},layers:[]},uC={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:"mercator",renderWorldCopies:!0},$w={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Xw={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Yw={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},hC=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],dC=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"],w0=class i{constructor(a,u,f){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=y=>{let l=this.props[Yw[y.type]];l?l(y):y.type==="error"&&console.error(y.error)},this._onCameraEvent=y=>{if(this._internalUpdate)return;y.viewState=this._propsedCameraUpdate||ny(this._map.transform);let l=this.props[Xw[y.type]];l&&l(y)},this._onCameraUpdate=y=>this._internalUpdate?y:(this._propsedCameraUpdate=ny(y),ry(y,this.props)),this._onPointerEvent=y=>{(y.type==="mousemove"||y.type==="mouseout")&&this._updateHover(y);let l=this.props[$w[y.type]];l&&(this.props.interactiveLayerIds&&y.type!=="mouseover"&&y.type!=="mouseout"&&(y.features=this._hoveredFeatures||this._queryRenderedFeatures(y.point)),l(y),delete y.features)},this._MapClass=a,this.props=u,this._initialize(f)}get map(){return this._map}setProps(a){let u=this.props;this.props=a;let f=this._updateSettings(a,u),y=this._updateSize(a),l=this._updateViewState(a);this._updateStyle(a,u),this._updateStyleComponents(a),this._updateHandlers(a,u),(f||y||l&&!this._map.isMoving())&&this.redraw()}static reuse(a,u){let f=i.savedMaps.pop();if(!f)return null;let y=f.map,l=y.getContainer();for(u.className=l.className;l.childNodes.length>0;)u.appendChild(l.childNodes[0]);y._container=u;let D=y._resizeObserver;D&&(D.disconnect(),D.observe(u)),f.setProps({...a,styleDiffing:!1}),y.resize();let{initialViewState:B}=a;return B&&(B.bounds?y.fitBounds(B.bounds,{...B.fitBoundsOptions,duration:0}):f._updateViewState(B)),y.isStyleLoaded()?y.fire("load"):y.once("style.load",()=>y.fire("load")),y._update(),f}_initialize(a){let{props:u}=this,{mapStyle:f=Hw}=u,y={...u,...u.initialViewState,container:a,style:ay(f)},l=y.initialViewState||y.viewState||y;if(Object.assign(y,{center:[l.longitude||0,l.latitude||0],zoom:l.zoom||0,pitch:l.pitch||0,bearing:l.bearing||0}),u.gl){let B=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=B,u.gl)}let D=new this._MapClass(y);l.padding&&D.setPadding(l.padding),u.cursor&&(D.getCanvas().style.cursor=u.cursor),D.transformCameraUpdate=this._onCameraUpdate,D.on("style.load",()=>{this._styleComponents={light:D.getLight(),sky:D.getSky(),projection:D.getProjection?.(),terrain:D.getTerrain()},this._updateStyleComponents(this.props)}),D.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(let B in $w)D.on(B,this._onPointerEvent);for(let B in Xw)D.on(B,this._onCameraEvent);for(let B in Yw)D.on(B,this._onEvent);this._map=D}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),i.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}_updateSize(a){let{viewState:u}=a;if(u){let f=this._map;if(u.width!==f.transform.width||u.height!==f.transform.height)return f.resize(),!0}return!1}_updateViewState(a){let u=this._map,f=u.transform;if(!u.isMoving()){let l=ry(f,a);if(Object.keys(l).length>0)return this._internalUpdate=!0,u.jumpTo(l),this._internalUpdate=!1,!0}return!1}_updateSettings(a,u){let f=this._map,y=!1;for(let l of hC)if((l in a||l in u)&&!xn(a[l],u[l])){y=!0;let B=l in a?a[l]:uC[l];f[`set${l[0].toUpperCase()}${l.slice(1)}`]?.call(f,B)}return y}_updateStyle(a,u){if(a.cursor!==u.cursor&&(this._map.getCanvas().style.cursor=a.cursor||""),a.mapStyle!==u.mapStyle){let{mapStyle:f=Hw,styleDiffing:y=!0}=a,l={diff:y};"localIdeographFontFamily"in a&&(l.localIdeographFontFamily=a.localIdeographFontFamily),this._map.setStyle(ay(f),l)}}_updateStyleComponents({light:a,projection:u,sky:f,terrain:y}){let l=this._map,D=this._styleComponents;l.style?._loaded&&(a&&!xn(a,D.light)&&(D.light=a,l.setLight(a)),u&&!xn(u,D.projection)&&u!==D.projection?.type&&(D.projection=typeof u=="string"?{type:u}:u,l.setProjection?.(D.projection)),f&&!xn(f,D.sky)&&(D.sky=f,l.setSky(f)),y!==void 0&&!xn(y,D.terrain)&&(!y||l.getSource(y.source))&&(D.terrain=y,l.setTerrain(y)))}_updateHandlers(a,u){let f=this._map;for(let y of dC){let l=a[y]??!0,D=u[y]??!0;xn(l,D)||(l?f[y].enable(l):f[y].disable())}}_queryRenderedFeatures(a){let u=this._map,{interactiveLayerIds:f=[]}=this.props;try{return u.queryRenderedFeatures(a,{layers:f.filter(u.getLayer.bind(u))})}catch{return[]}}_updateHover(a){let{props:u}=this;if(u.interactiveLayerIds&&(u.onMouseMove||u.onMouseEnter||u.onMouseLeave)){let y=a.type,l=this._hoveredFeatures?.length>0,D=this._queryRenderedFeatures(a.point),B=D.length>0;!B&&l&&(a.type="mouseleave",this._onPointerEvent(a)),this._hoveredFeatures=D,B&&!l&&(a.type="mouseenter",this._onPointerEvent(a)),a.type=y}else this._hoveredFeatures=null}};w0.savedMaps=[];var oy=w0;var pC=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function sy(i){if(!i)return null;let a=i.map,u={getMap:()=>a};for(let f of fC(a))!(f in u)&&!pC.includes(f)&&(u[f]=a[f].bind(a));return u}function fC(i){let a=new Set,u=i;for(;u;){for(let f of Object.getOwnPropertyNames(u))f[0]!=="_"&&typeof i[f]=="function"&&f!=="fire"&&f!=="setEventedParent"&&a.add(f);u=Object.getPrototypeOf(u)}return Array.from(a)}var T0=it(At(),1),mC=typeof document<"u"?T0.useLayoutEffect:T0.useEffect,Ww=mC;function ly(i,a){let{RTLTextPlugin:u,maxParallelImageRequests:f,workerCount:y,workerUrl:l}=a;if(u&&i.getRTLTextPluginStatus&&i.getRTLTextPluginStatus()==="unavailable"){let{pluginUrl:D,lazy:B=!0}=typeof u=="string"?{pluginUrl:u}:u;i.setRTLTextPlugin(D,q=>{q&&console.error(q)},B)}f!==void 0&&i.setMaxParallelImageRequests(f),y!==void 0&&i.setWorkerCount(y),l!==void 0&&i.setWorkerUrl(l)}var Wr=rl.createContext(null);function gC(i,a){let u=(0,Kr.useContext)(x0),[f,y]=(0,Kr.useState)(null),l=(0,Kr.useRef)(),{current:D}=(0,Kr.useRef)({mapLib:null,map:null});(0,Kr.useEffect)(()=>{let K=i.mapLib,fe=!0,de;return Promise.resolve(K||Promise.resolve().then(()=>it(Qw(),1))).then(oe=>{if(!fe)return;if(!oe)throw new Error("Invalid mapLib");let ce="Map"in oe?oe:oe.default;if(!ce.Map)throw new Error("Invalid mapLib");ly(ce,i),i.reuseMaps&&(de=oy.reuse(i,l.current)),de||(de=new oy(ce.Map,i,l.current)),D.map=sy(de),D.mapLib=ce,y(de),u?.onMapMount(D.map,i.id)}).catch(oe=>{let{onError:ce}=i;ce?ce({type:"error",target:null,originalEvent:null,error:oe}):console.error(oe)}),()=>{fe=!1,de&&(u?.onMapUnmount(i.id),i.reuseMaps?de.recycle():de.destroy())}},[]),Ww(()=>{f&&f.setProps(i)}),(0,Kr.useImperativeHandle)(a,()=>D.map,[f]);let B=(0,Kr.useMemo)(()=>({position:"relative",width:"100%",height:"100%",...i.style}),[i.style]),q={height:"100%"};return rl.createElement("div",{id:i.id,ref:l,style:B},f&&rl.createElement(Wr.Provider,{value:D},rl.createElement("div",{"mapboxgl-children":"",style:q},i.children)))}var hy=rl.forwardRef(gC);var r3=it(At(),1),a3=it(M0(),1),yr=it(At(),1);var bC=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ln(i,a){if(!i||!a)return;let u=i.style;for(let f in a){let y=a[f];Number.isFinite(y)&&!bC.test(f)?u[f]=`${y}px`:u[f]=y}}function E0(i,a){if(i===a)return null;let u=n3(i),f=n3(a),y=[];for(let l of f)u.has(l)||y.push(l);for(let l of u)f.has(l)||y.push(l);return y.length===0?null:y}function n3(i){return new Set(i?i.trim().split(/\s+/):[])}var Pp=(0,yr.memo)((0,yr.forwardRef)((i,a)=>{let{map:u,mapLib:f}=(0,yr.useContext)(Wr),y=(0,yr.useRef)({props:i}),l=(0,yr.useMemo)(()=>{let se=!1;r3.Children.forEach(i.children,ge=>{ge&&(se=!0)});let le={...i,element:se?document.createElement("div"):void 0},pe=new f.Marker(le);return pe.setLngLat([i.longitude,i.latitude]),pe.getElement().addEventListener("click",ge=>{y.current.props.onClick?.({type:"click",target:pe,originalEvent:ge})}),pe.on("dragstart",ge=>{let Be=ge;Be.lngLat=l.getLngLat(),y.current.props.onDragStart?.(Be)}),pe.on("drag",ge=>{let Be=ge;Be.lngLat=l.getLngLat(),y.current.props.onDrag?.(Be)}),pe.on("dragend",ge=>{let Be=ge;Be.lngLat=l.getLngLat(),y.current.props.onDragEnd?.(Be)}),pe},[]);(0,yr.useEffect)(()=>(l.addTo(u.getMap()),()=>{l.remove()}),[]);let{longitude:D,latitude:B,offset:q,style:K,draggable:fe=!1,popup:de=null,rotation:oe=0,rotationAlignment:ce="auto",pitchAlignment:ke="auto"}=i;(0,yr.useEffect)(()=>{Ln(l.getElement(),K)},[K]),(0,yr.useImperativeHandle)(a,()=>l,[]);let Ne=y.current.props;(l.getLngLat().lng!==D||l.getLngLat().lat!==B)&&l.setLngLat([D,B]),q&&!Zw(l.getOffset(),q)&&l.setOffset(q),l.isDraggable()!==fe&&l.setDraggable(fe),l.getRotation()!==oe&&l.setRotation(oe),l.getRotationAlignment()!==ce&&l.setRotationAlignment(ce),l.getPitchAlignment()!==ke&&l.setPitchAlignment(ke),l.getPopup()!==de&&l.setPopup(de);let ve=E0(Ne.className,i.className);if(ve)for(let se of ve)l.toggleClassName(se);return y.current.props=i,(0,a3.createPortal)(i.children,l.getElement())}));var o3=it(M0(),1),ar=it(At(),1);var xC=(0,ar.memo)((0,ar.forwardRef)((i,a)=>{let{map:u,mapLib:f}=(0,ar.useContext)(Wr),y=(0,ar.useMemo)(()=>document.createElement("div"),[]),l=(0,ar.useRef)({props:i}),D=(0,ar.useMemo)(()=>{let B={...i},q=new f.Popup(B);return q.setLngLat([i.longitude,i.latitude]),q.once("open",K=>{l.current.props.onOpen?.(K)}),q},[]);if((0,ar.useEffect)(()=>{let B=q=>{l.current.props.onClose?.(q)};return D.on("close",B),D.setDOMContent(y).addTo(u.getMap()),()=>{D.off("close",B),D.isOpen()&&D.remove()}},[]),(0,ar.useEffect)(()=>{Ln(D.getElement(),i.style)},[i.style]),(0,ar.useImperativeHandle)(a,()=>D,[]),D.isOpen()){let B=l.current.props;(D.getLngLat().lng!==i.longitude||D.getLngLat().lat!==i.latitude)&&D.setLngLat([i.longitude,i.latitude]),i.offset&&!xn(B.offset,i.offset)&&D.setOffset(i.offset),(B.anchor!==i.anchor||B.maxWidth!==i.maxWidth)&&(D.options.anchor=i.anchor,D.setMaxWidth(i.maxWidth));let q=E0(B.className,i.className);if(q)for(let K of q)D.toggleClassName(K);l.current.props=i}return(0,o3.createPortal)(i.children,y)}));var C0=it(At(),1);var dh=it(At(),1);function vr(i,a,u,f){let y=(0,dh.useContext)(Wr),l=(0,dh.useMemo)(()=>i(y),[]);return(0,dh.useEffect)(()=>{let D=f||u||a,B=typeof a=="function"&&typeof u=="function"?a:null,q=typeof u=="function"?u:typeof a=="function"?a:null,{map:K}=y;return K.hasControl(l)||(K.addControl(l,D?.position),B&&B(y)),()=>{q&&q(y),K.hasControl(l)&&K.removeControl(l)}},[]),l}function wC(i){let a=vr(({mapLib:u})=>new u.AttributionControl(i),{position:i.position});return(0,C0.useEffect)(()=>{Ln(a._container,i.style)},[i.style]),null}var TC=(0,C0.memo)(wC);var A0=it(At(),1);function SC(i){let a=vr(({mapLib:u})=>new u.FullscreenControl({container:i.containerId&&document.getElementById(i.containerId)}),{position:i.position});return(0,A0.useEffect)(()=>{Ln(a._controlContainer,i.style)},[i.style]),null}var MC=(0,A0.memo)(SC);var go=it(At(),1);function EC(i,a){let u=(0,go.useRef)({props:i}),f=vr(({mapLib:y})=>{let l=new y.GeolocateControl(i),D=l._setupUI;return l._setupUI=()=>{l._container.hasChildNodes()||D()},l.on("geolocate",B=>{u.current.props.onGeolocate?.(B)}),l.on("error",B=>{u.current.props.onError?.(B)}),l.on("outofmaxbounds",B=>{u.current.props.onOutOfMaxBounds?.(B)}),l.on("trackuserlocationstart",B=>{u.current.props.onTrackUserLocationStart?.(B)}),l.on("trackuserlocationend",B=>{u.current.props.onTrackUserLocationEnd?.(B)}),l},{position:i.position});return u.current.props=i,(0,go.useImperativeHandle)(a,()=>f,[]),(0,go.useEffect)(()=>{Ln(f._container,i.style)},[i.style]),null}var CC=(0,go.memo)((0,go.forwardRef)(EC));var z0=it(At(),1);function AC(i){let a=vr(({mapLib:u})=>new u.NavigationControl(i),{position:i.position});return(0,z0.useEffect)(()=>{Ln(a._container,i.style)},[i.style]),null}var zC=(0,z0.memo)(AC);var ph=it(At(),1);function DC(i){let a=vr(({mapLib:l})=>new l.ScaleControl(i),{position:i.position}),u=(0,ph.useRef)(i),f=u.current;u.current=i;let{style:y}=i;return i.maxWidth!==void 0&&i.maxWidth!==f.maxWidth&&(a.options.maxWidth=i.maxWidth),i.unit!==void 0&&i.unit!==f.unit&&a.setUnit(i.unit),(0,ph.useEffect)(()=>{Ln(a._container,y)},[y]),null}var PC=(0,ph.memo)(DC);var D0=it(At(),1);function RC(i){let a=vr(({mapLib:u})=>new u.TerrainControl(i),{position:i.position});return(0,D0.useEffect)(()=>{Ln(a._container,i.style)},[i.style]),null}var IC=(0,D0.memo)(RC);var P0=it(At(),1);function kC(i){let a=vr(({mapLib:u})=>new u.LogoControl(i),{position:i.position});return(0,P0.useEffect)(()=>{Ln(a._container,i.style)},[i.style]),null}var LC=(0,P0.memo)(kC);var s3=it(At(),1),_a=it(At(),1);function Mc(i,a){if(!i)throw new Error(a)}var OC=0;function BC(i,a,u){if(i.style&&i.style._loaded){let f={...u};return delete f.id,delete f.children,i.addSource(a,f),i.getSource(a)}return null}function FC(i,a,u){Mc(a.id===u.id,"source id changed"),Mc(a.type===u.type,"source type changed");let f="",y=0;for(let D in a)D!=="children"&&D!=="id"&&!xn(u[D],a[D])&&(f=D,y++);if(!y)return;let l=a.type;if(l==="geojson")i.setData(a.data);else if(l==="image")i.updateImage({url:a.url,coordinates:a.coordinates});else switch(f){case"coordinates":i.setCoordinates?.(a.coordinates);break;case"url":i.setUrl?.(a.url);break;case"tiles":i.setTiles?.(a.tiles);break;default:console.warn(`Unable to update <Source> prop: ${f}`)}}function Rp(i){let a=(0,_a.useContext)(Wr).map.getMap(),u=(0,_a.useRef)(i),[,f]=(0,_a.useState)(0),y=(0,_a.useMemo)(()=>i.id||`jsx-source-${OC++}`,[]);(0,_a.useEffect)(()=>{if(a){let D=()=>setTimeout(()=>f(B=>B+1),0);return a.on("styledata",D),D(),()=>{if(a.off("styledata",D),a.style&&a.style._loaded&&a.getSource(y)){let B=a.getStyle()?.layers;if(B)for(let q of B)q.source===y&&a.removeLayer(q.id);a.removeSource(y)}}}},[a]);let l=a&&a.style&&a.getSource(y);return l?FC(l,i,u.current):l=BC(a,y,i),u.current=i,l&&s3.Children.map(i.children,D=>D&&(0,_a.cloneElement)(D,{source:y}))||null}var _o=it(At(),1);function NC(i,a,u,f){if(Mc(u.id===f.id,"layer id changed"),Mc(u.type===f.type,"layer type changed"),u.type==="custom"||f.type==="custom")return;let{layout:y={},paint:l={},filter:D,minzoom:B,maxzoom:q,beforeId:K}=u;if(K!==f.beforeId&&i.moveLayer(a,K),y!==f.layout){let fe=f.layout||{};for(let de in y)xn(y[de],fe[de])||i.setLayoutProperty(a,de,y[de]);for(let de in fe)y.hasOwnProperty(de)||i.setLayoutProperty(a,de,void 0)}if(l!==f.paint){let fe=f.paint||{};for(let de in l)xn(l[de],fe[de])||i.setPaintProperty(a,de,l[de]);for(let de in fe)l.hasOwnProperty(de)||i.setPaintProperty(a,de,void 0)}xn(D,f.filter)||i.setFilter(a,D),(B!==f.minzoom||q!==f.maxzoom)&&i.setLayerZoomRange(a,B,q)}function UC(i,a,u){if(i.style&&i.style._loaded&&(!("source"in u)||i.getSource(u.source))){let f={...u,id:a};delete f.beforeId,i.addLayer(f,u.beforeId)}}var VC=0;function fh(i){let a=(0,_o.useContext)(Wr).map.getMap(),u=(0,_o.useRef)(i),[,f]=(0,_o.useState)(0),y=(0,_o.useMemo)(()=>i.id||`jsx-layer-${VC++}`,[]);if((0,_o.useEffect)(()=>{if(a){let D=()=>f(B=>B+1);return a.on("styledata",D),D(),()=>{a.off("styledata",D),a.style&&a.style._loaded&&a.getLayer(y)&&a.removeLayer(y)}}},[a]),a&&a.style&&a.getLayer(y))try{NC(a,y,i,u.current)}catch(D){console.warn(D)}else UC(a,y,i);return u.current=i,null}var Ip=it(Qt(),1),dy=({geometry:i,color:a="#3b82f6",width:u=5,opacity:f=.8})=>i?(0,Ip.jsxs)(Rp,{data:{geometry:i,properties:{},type:"Feature"},id:"sdk-route-source",type:"geojson",children:[(0,Ip.jsx)(fh,{id:"sdk-route-layer-casing",paint:{"line-blur":1,"line-color":"#ffffff","line-opacity":f,"line-width":u+2},type:"line"}),(0,Ip.jsx)(fh,{id:"sdk-route-layer",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":a,"line-opacity":f,"line-width":u},type:"line"})]}):null;var Dt=it(At(),1);var Ec=it(At(),1),py=it(Qt(),1);function l3(i,a=64){let u=document.createElement("canvas");u.width=a,u.height=a;let f=u.getContext("2d");return f.font=`${a*.75}px serif`,f.textAlign="center",f.textBaseline="middle",f.fillText(i,a/2,a/2),f.getImageData(0,0,a,a)}var c3=({pois:i})=>{let[a,u]=(0,Ec.useState)(0),{current:f}=iy(),y=(0,Ec.useMemo)(()=>i.filter(D=>!D.displayMode||D.displayMode==="gl"),[i]);(0,Ec.useEffect)(()=>{if(!f)return;let D=f.getMap();[{emoji:"\u{1F37A}",name:"sdk-default-bar"},{emoji:"\u{1F37D}\uFE0F",name:"sdk-default-restaurant"},{emoji:"\u{1F4CD}",name:"sdk-default-poi"}].forEach(K=>{D.hasImage(K.name)||D.addImage(K.name,l3(K.emoji),{pixelRatio:2})});let q=0;y.forEach(K=>{if(K.imageUrl){let fe=`custom-url-${K.id}`;D.hasImage(fe)||D.loadImage(K.imageUrl,(de,oe)=>{!de&&oe&&(D.hasImage(fe)||(D.addImage(fe,oe),u(ce=>ce+1)))})}if(K.emoji){let fe=`custom-emoji-${K.emoji}`;D.hasImage(fe)||(D.addImage(fe,l3(K.emoji),{pixelRatio:2}),q++)}}),q>0&&u(K=>K+q)},[f,y]);let l=(0,Ec.useMemo)(()=>({features:y.map(D=>({geometry:{coordinates:[D.longitude,D.latitude],type:"Point"},properties:{...D,"sdk-icon":D.imageUrl?`custom-url-${D.id}`:D.spriteName?D.spriteName:D.emoji?`custom-emoji-${D.emoji}`:D.type==="bar"?"sdk-default-bar":D.type==="restaurant"?"sdk-default-restaurant":"sdk-default-poi"},type:"Feature"})),type:"FeatureCollection"}),[y]);return(0,py.jsx)(Rp,{data:l,id:"sdk-pois",type:"geojson",children:(0,py.jsx)(fh,{id:"sdk-poi-layer",layout:{"icon-allow-overlap":!0,"icon-image":["get","sdk-icon"],"icon-size":1,"text-anchor":"top","text-field":["step",["zoom"],"",14,["get","name"]],"text-font":["Open Sans Bold"],"text-offset":[0,1.5],"text-optional":!0,"text-size":11},paint:{"icon-opacity":["interpolate",["linear"],["zoom"],11,0,12,1],"text-color":"#ffffff","text-halo-color":"#000000","text-halo-width":1,"text-opacity":["interpolate",["linear"],["zoom"],13.5,0,14,1]},type:"symbol"})})};var Za=it(Qt(),1),u3=({pois:i,onClick:a})=>{let u=i.filter(f=>f.displayMode==="marker");return u.length===0?null:(0,Za.jsx)(Za.Fragment,{children:u.map(f=>(0,Za.jsx)(Pp,{anchor:"bottom",latitude:f.latitude,longitude:f.longitude,onClick:y=>{y.originalEvent.stopPropagation(),a&&a(f)},children:f.markerComponent?f.markerComponent:(0,Za.jsxs)("div",{style:{cursor:"pointer",filter:"drop-shadow(0 4px 6px rgba(0,0,0,0.1))",transform:"transition-transform duration-200 hover:scale-110"},children:[(0,Za.jsx)("div",{style:{alignItems:"center",backgroundColor:f.type==="bar"?"#f97316":"#10b981",border:"2px solid white",borderRadius:"50%",display:"flex",height:"32px",justifyContent:"center",width:"32px"},children:f.emoji?(0,Za.jsx)("span",{style:{fontSize:"16px"},children:f.emoji}):(0,Za.jsx)("div",{style:{backgroundColor:"white",borderRadius:"50%",height:"8px",width:"8px"}})}),(0,Za.jsx)("div",{style:{borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`8px solid ${f.type==="bar"?"#f97316":"#10b981"}`,height:0,margin:"-2px auto 0",width:0}})]})},f.id))})};var br=it(Qt(),1),h3=({forcedLocation:i,heading:a})=>i?(0,br.jsx)(Pp,{anchor:"center",latitude:i[1],longitude:i[0],children:(0,br.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",position:"relative"},children:[(0,br.jsx)("div",{style:{animation:"pulse 2s infinite",backgroundColor:"rgba(59, 130, 246, 0.4)",borderRadius:"50%",height:"40px",position:"absolute",width:"40px"}}),a!=null&&(0,br.jsx)("div",{style:{height:"60px",position:"absolute",transform:`rotate(${a}deg)`,width:"60px",zIndex:0},children:(0,br.jsxs)("svg",{style:{height:"100%",width:"100%"},viewBox:"0 0 100 100",children:[(0,br.jsx)("defs",{children:(0,br.jsxs)("radialGradient",{cx:"50%",cy:"50%",fx:"50%",fy:"50%",id:"grad1",r:"50%",children:[(0,br.jsx)("stop",{offset:"0%",style:{stopColor:"rgba(37, 99, 235, 0.6)",stopOpacity:1}}),(0,br.jsx)("stop",{offset:"100%",style:{stopColor:"rgba(37, 99, 235, 0)",stopOpacity:0}})]})}),(0,br.jsx)("path",{d:"M 50 50 L 35 0 A 50 50 0 0 1 65 0 Z",fill:"url(#grad1)"})]})}),(0,br.jsx)("div",{style:{alignItems:"center",backgroundColor:"white",borderRadius:"50%",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(37, 99, 235, 0.2)",display:"flex",height:"20px",justifyContent:"center",width:"20px",zIndex:1},children:(0,br.jsx)("div",{style:{backgroundColor:"#2563eb",border:"2px solid white",borderRadius:"50%",height:"12px",width:"12px"}})}),(0,br.jsx)("style",{children:"@keyframes pulse { 0% { transform: scale(0.95); opacity: 0.7; } 70% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(0.95); opacity: 0; } }"})]})}):null;var Yi=it(Qt(),1),jC=({initialViewState:i={latitude:45.90583599233422,longitude:6.12589018919138,zoom:12},style:a={},mapStyle:u="https://tiles.cloudparse.fr/style/up_dark_matter",className:f="",maxBounds:y,children:l,onClick:D,onMapClickMiss:B,onContextMenu:q,interactiveLayerIds:K=[],onLoad:fe,showUserLocation:de=!0,followUser:oe=!1,showUserLocationButton:ce=!0,renderUserLocation:ke,pois:Ne=[],onPoiClick:ve,route:se,showNavigationUI:le,navigationData:pe,onNavigationAbort:ge,onNavigationModeChange:Be,navigation:qe,showControls:Z=!0,menuItems:Y,menuContent:ne,drawerState:xe,drawerContentRef:Fe,controlProps:Ye={},enableTouchDrag:ze=!1})=>{let Ie=(0,Dt.useContext)(fo),Ge=(0,Dt.useRef)(null),We=zp(),[Ke,yt]=(0,Dt.useState)(null);(0,Dt.useEffect)(()=>{let Lt=qi.on("SDK_NAVIGATION_CREATE",Et=>{yt(Et)}),Ni=qi.on("SDK_NAVIGATION_START",()=>{yt(Et=>Et?{...Et,mode:"navigation"}:null)}),mn=qi.on("SDK_NAVIGATION_ABORT",()=>{yt(null)});return()=>{Lt(),Ni(),mn()}},[]);let st=Ke||qe,Nt=J_({destination:st?.destination||null,enabled:!!st?.destination,initialMode:st?.mode||"preview",origin:st?.origin,profile:st?.profile||"driving",recalculateThreshold:st?.recalculateThreshold||50});(0,Dt.useEffect)(()=>{Be&&qe&&Be(Nt.mode)},[Nt.mode,Be,qe]);let Zt=st?Nt:pe,Ut=st?Nt.route?.geometry:se,Ji=st?.showUI!==!1&&(st?!!st.destination:le),Bi=Zt?.mode||"preview",ri=Ie?Ie.isFollowing:oe,dn=(0,Dt.useRef)(ri),hi=(0,Dt.useRef)(!1),[Fr,Sn]=(0,Dt.useState)(ri),Nr=Ie?Ie.isFollowing:Fr,tt=Ie?.setIsFollowing,kt=(0,Dt.useCallback)(Lt=>{dn.current=Lt,Sn(Lt),tt&&tt(Lt)},[tt]);(0,Dt.useEffect)(()=>{Ie&&Ie.isFollowing!==dn.current&&(dn.current=Ie.isFollowing)},[Ie?.isFollowing,Ie]);let Wt=[...K];Ne.length>0&&!Wt.includes("sdk-poi-layer")&&Wt.push("sdk-poi-layer");let Fi=(0,Dt.useRef)(oe);(0,Dt.useEffect)(()=>{oe!==Fi.current&&(kt(oe),Fi.current=oe,oe&&We.coords&&Ge.current&&(hi.current=!0,Ge.current.flyTo({center:We.coords,duration:1e3,essential:!0,zoom:Math.max(Ge.current.getZoom(),16)}),setTimeout(()=>{hi.current=!1},1050)))},[oe,kt,We.coords]);let di=(0,Dt.useRef)(null);(0,Dt.useEffect)(()=>{if(!Ut||!Ge.current){Ut||(di.current=null);return}let Lt=Ut!==di.current;if(!(!Lt&&Bi==="navigation")){if(Bi==="navigation")kt(!0);else if(Bi==="preview"&&Lt){kt(!1);let Ni=Ut.coordinates;if(Ni.length>0){let mn=Ni.reduce((Et,Ii)=>[[Math.min(Et[0][0],Ii[0]),Math.min(Et[0][1],Ii[1])],[Math.max(Et[1][0],Ii[0]),Math.max(Et[1][1],Ii[1])]],[[Ni[0][0],Ni[0][1]],[Ni[0][0],Ni[0][1]]]);Ge.current.fitBounds([mn[0][0],mn[0][1],mn[1][0],mn[1][1]],{padding:100,speed:1.2})}}di.current=Ut}},[Ut,Bi,kt]),(0,Dt.useEffect)(()=>{dn.current&&!hi.current&&We.coords&&Ge.current&&Ge.current.easeTo({center:We.coords,duration:50,easing:Lt=>Lt,essential:!0})},[We.coords]);let Ri=ey(Ut,de?We.coords:null),pn=Zt?.currentDistanceMeters??Zt?.route?.distanceMeters??0,la=Zt?.route?.durationSeconds?Math.ceil(Zt.route.durationSeconds/60):0,Ht=pn/1e3,Mn=Zt?.totalDistance??0,wr=Mn>0?(Mn-pn)/Mn*100:0,Ya=(0,Dt.useMemo)(()=>{if(!(!Zt||!Ut))return{distanceRemainingKm:Ht,etaMins:la,label:Bi==="navigation"?"Walking Guidance Active":"Route Preview",mode:Bi,onAbort:ge||(()=>{yt(null)}),onStart:Zt.start,progress:wr}},[Zt,Ut,la,Ht,Bi,wr,ge]),Tr=Ie?.setEtaData;(0,Dt.useEffect)(()=>{Tr&&Tr(Ya)},[Ya,Tr]);let Ur=Ie?.setDrawerState;(0,Dt.useEffect)(()=>{Ur&&xe!==void 0&&Ur(xe)},[xe,Ur]);let Il=(0,Dt.useMemo)(()=>[{icon:(0,Yi.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,Yi.jsx)("path",{d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4",strokeLinecap:"round",strokeLinejoin:"round"})}),id:"walking",label:"Walking Mode",onPress:()=>{}}],[]),kl=Y||Il,{mapLibreChildren:Ms,menuContentFromChildren:Eo}=(0,Dt.useMemo)(()=>{let Lt=[],Ni=[];Dt.default.Children.forEach(l,Et=>{if(Dt.default.isValidElement(Et)){let Ii=Et.type,ca=Ii?.displayName||Ii?.name,Wa=Ii===Cp||ca==="MapMenu",Ka=Wa||Ii===g0||Ii===_0||Ii===y0||Ii===v0||["MapMenuItem","MapMenuTitle","MapMenuDivider","MapMenuFooter"].includes(ca);Wa?Dt.default.Children.forEach(Et.props.children,Ao=>{Ao&&Ni.push(Ao)}):Ka?Ni.push(Et):Lt.push(Et)}else Lt.push(Et)});let mn=Ni.length>0?(0,Yi.jsx)(Cp,{children:Ni}):null;return{mapLibreChildren:Lt,menuContentFromChildren:mn}},[l]),$c=Lt=>{let Ni=Lt.features||[];if(ve){let Et=Ni.find(Ii=>Ii.layer.id==="sdk-poi-layer");if(Et){ve(Et.properties);return}}Ni.some(Et=>Wt.includes(Et.layer.id))||B&&B(Lt),D&&D(Lt)},Co=(0,Dt.useCallback)(Lt=>{We.coords&&Ge.current&&(kt(!0),hi.current=!0,Ge.current.flyTo({center:We.coords,duration:1e3,essential:!0,pitch:Lt?.pitch||0,zoom:Math.max(Ge.current.getZoom(),16)}),setTimeout(()=>{hi.current=!1},1050))},[We.coords,kt]),Vr=(0,Dt.useCallback)(Lt=>{Ge.current&&Ge.current.easeTo({bearing:0,duration:500,essential:!0,pitch:Lt?.pitch??0})},[]);(0,Dt.useEffect)(()=>{Ie&&(Ie._registerCenterCallback(Co),Ie._registerResetBearingCallback(Vr))},[Ie,Co,Vr]);let jr=(0,Dt.useCallback)(()=>{Ge.current&&Ie&&(Ie.setBearing(Ge.current.getBearing()),Ie.setPitch(Ge.current.getPitch()))},[Ie]),fn=()=>{dn.current&&(console.log("[SDK:Map] Manual interaction detected. Halting tracking."),kt(!1),Ge.current&&Ge.current.stop())};return(0,Yi.jsxs)("div",{className:`w-full h-full overflow-hidden relative ${f}`,style:a,children:[(0,Yi.jsxs)(hy,{attributionControl:!1,initialViewState:i,interactiveLayerIds:Wt,mapStyle:u,maxBounds:y,onClick:$c,onContextMenu:q,onDragStart:fn,onLoad:Lt=>{fe&&fe(Lt),oe&&We.coords&&Ge.current&&Ge.current.jumpTo({center:We.coords,zoom:16})},onMouseDown:fn,onMove:jr,onTouchStart:fn,onWheel:fn,ref:Ge,children:[de&&We.coords&&(ke?ke({coords:We.coords,heading:We.heading}):(0,Yi.jsx)(h3,{forcedLocation:We.coords,heading:We.heading})),Ri&&(0,Yi.jsx)(dy,{geometry:Ri}),Ne.length>0&&(0,Yi.jsxs)(Yi.Fragment,{children:[(0,Yi.jsx)(c3,{pois:Ne}),(0,Yi.jsx)(u3,{onClick:ve,pois:Ne})]}),Ms]}),Z&&Ie&&!Ie.hasControls&&(0,Yi.jsx)(K_,{drawerContentRef:Fe,enableTouchDrag:ze,etaData:Ya,initialViewState:i,isInternal:!0,menuContent:ne||Eo,menuItems:kl,...Ye})]})},qC=({children:i})=>(0,Dt.useContext)(fo)?(0,Yi.jsx)(Yi.Fragment,{children:i}):(0,Yi.jsx)(W_,{children:i}),fy=i=>(0,Yi.jsx)(qC,{children:(0,Yi.jsx)(ty,{children:(0,Yi.jsx)(jC,{...i})})});var NS=it(At(),1),US=it(FS(),1);function $b(i,a={}){let u=document.getElementById(i);if(!u)throw new Error(`Container with id "${i}" not found.`);let f=(0,US.createRoot)(u);return f.render(NS.default.createElement(fy,a)),f}var o1={createErrorResponse(i,a,u){return{error:{code:a,message:u},requestId:i.requestId,sdkVersion:i.sdkVersion,success:!1,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},decodePolyline(i,a){let u=0,f=0,y=0,l=[],D=10**a;for(;u<i.length;){let B,q=0,K=0;do B=i.charCodeAt(u++)-63,K|=(B&31)<<q,q+=5;while(B>=32);let fe=K&1?~(K>>1):K>>1;f+=fe,q=0,K=0;do B=i.charCodeAt(u++)-63,K|=(B&31)<<q,q+=5;while(B>=32);let de=K&1?~(K>>1):K>>1;y+=de,l.push([y/D,f/D])}return l},async fetchOSRMRoute(i,a,u,f){let y=a.map(de=>`${de[0]},${de[1]}`).join(";"),D=`${f}/route/v1/${u==="walking"?"foot":u==="driving"?"car":"bike"}/${y}?overview=full&geometries=geojson&steps=true`,B=await fetch(D);if(!B.ok)throw new Error(`OSRM Error: ${B.statusText}`);let q=await B.json();if(q.code!=="Ok"||!q.routes||q.routes.length===0)throw new Error("NO_ROUTE");let K=q.routes[0],fe=K.legs?.flatMap(de=>de.steps?.map(oe=>({distance:oe.distance,duration:oe.duration,instruction:oe.maneuver?.instruction||"Continue"})))||[];return{data:{distanceMeters:K.distance,durationSeconds:K.duration,geometry:K.geometry,steps:fe},requestId:i.requestId,sdkVersion:i.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},async fetchRoute(i,a){let{origin:u,destination:f,waypoints:y,profile:l,language:D}=i.payload;if(!this.isValidCoordinate(u)||!this.isValidCoordinate(f))return this.createErrorResponse(i,"INVALID_INPUT","Origin or destination coordinates are invalid.");if(y&&!y.every(this.isValidCoordinate))return this.createErrorResponse(i,"INVALID_INPUT","One or more waypoints are invalid.");let B=[u,...y||[],f];try{return a.backend==="osrm"?await this.fetchOSRMRoute(i,B,l,a.baseUrl):await this.fetchValhallaRoute(i,B,l,D,a.baseUrl)}catch(q){return q instanceof Error&&q.message.includes("NO_ROUTE")?this.createErrorResponse(i,"NO_ROUTE","No route could be found for the given points."):q instanceof TypeError?this.createErrorResponse(i,"NETWORK_ERROR","Failed to connect to the routing backend."):this.createErrorResponse(i,"BACKEND_ERROR",`Routing backend error: ${q instanceof Error?q.message:"Unknown error"}`)}},async fetchValhallaRoute(i,a,u,f,y){let D={costing:u==="driving"?"auto":u==="walking"?"pedestrian":"bicycle",directions_options:{language:f||"en-US"},locations:a.map(oe=>({lat:oe[1],lon:oe[0]}))},B=await fetch(`${y}/route`,{body:JSON.stringify(D),headers:{"Content-Type":"application/json"},method:"POST"});if(!B.ok)throw new Error(`Valhalla Error: ${B.statusText}`);let q=await B.json();if(!q.trip||!q.trip.legs||q.trip.legs.length===0)throw new Error("NO_ROUTE");let K=q.trip,fe=this.decodePolyline(K.legs[0].shape,6),de=K.legs.flatMap(oe=>oe.maneuvers?.map(ce=>({distance:ce.length*1e3,duration:ce.time,instruction:ce.instruction||"Continue"})))||[];return{data:{distanceMeters:K.summary.length*1e3,durationSeconds:K.summary.time,geometry:{coordinates:fe,type:"LineString"},steps:de},requestId:i.requestId,sdkVersion:i.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},isValidCoordinate(i){let[a,u]=i;return a>=-180&&a<=180&&u>=-90&&u<=90}};var Lf="0.2.0";function VS(i){let a=Object.getOwnPropertyNames(i);for(let u of a){let f=i[u];f&&typeof f=="object"&&!Object.isFrozen(f)&&!(f instanceof Ep)&&VS(f)}return Object.freeze(i)}var Xb=null,Of=class{maps=Object.freeze({render:$b});bridge;storage=Object.freeze({get:a=>this.bridge.send("STORAGE_GET",{key:a}),getAll:()=>this.bridge.send("STORAGE_GET_ALL"),set:(a,u)=>this.bridge.send("STORAGE_SET",{key:a,value:u})});secureStore=Object.freeze({get:a=>this.bridge.send("SECURE_GET",{key:a}),set:(a,u)=>this.bridge.send("SECURE_SET",{key:a,value:u})});database=Object.freeze({getUserData:()=>this.bridge.send("DATABASE_GET_USER_DATA"),setUserData:a=>this.bridge.send("DATABASE_SET_USER_DATA",{data:a})});location=Object.freeze({getCurrentPosition:()=>this.bridge.send("GET_CURRENT_POSITION"),startStream:a=>this.bridge.send("START_LOCATION_STREAM",a),stopStream:()=>this.bridge.send("STOP_LOCATION_STREAM")});user=Object.freeze({getProfile:a=>this.bridge.send("GET_USER_PROFILE",{fields:a})});permission=Object.freeze({request:((a,u)=>this.bridge.send("REQUEST_PERMISSION",{fields:u,type:a}))});payment=Object.freeze({request:a=>this.bridge.send("PAYMENT_REQUEST",a)});activity=Object.freeze({start:(a,u,f)=>this.bridge.send("START_ACTIVITY",{id:a,status:f,title:u})});haptic=Object.freeze({trigger:a=>this.bridge.send("TRIGGER_HAPTIC",{style:a})});network=Object.freeze({request:async a=>this.bridge.send("NETWORK_REQUEST",a)});navigation=Object.freeze({abort:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_ABORT",type:"EVENT"})},createJourney:a=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_CREATE",payload:{...a,mode:"preview"},type:"EVENT"})},start:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_START",type:"EVENT"})}});fidelity=Object.freeze({getFidelityBalance:()=>this.bridge.send("GET_FIDELITY_BALANCE"),getFidelityHistory:a=>this.bridge.send("GET_FIDELITY_HISTORY",a),showHistory:()=>this.bridge.send("SHOW_FIDELITY_HISTORY"),spendFPoints:a=>this.bridge.send("SPEND_FPOINTS",{intentUuid:a})});ui=Object.freeze({exit:()=>this.bridge.send("EXIT"),setScrollConfig:a=>this.bridge.send("SET_SCROLL_CONFIG",a)});debug=Object.freeze({log:(...a)=>this.bridge.send("DEBUG_LOG",{message:a})});routing=Object.freeze({clearRoute:()=>{let a=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_CLEARROUTE",{requestId:a,sdkVersion:Lf})},drawRoute:a=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_DRAWROUTE",{payload:{routeData:a},requestId:u,sdkVersion:Lf})},getRoute:async a=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2),f={payload:a,requestId:u,sdkVersion:Lf,type:"SDK_ROUTING_GETROUTE"};if(Xb){let y=await o1.fetchRoute(f,Xb);if(y.success&&y.data)return y.data;throw new Error(y.error?.message||"Routing failed")}return this.bridge.send("SDK_ROUTING_GETROUTE",{payload:a,requestId:u,sdkVersion:Lf})}});constructor(){this.bridge=new Ep,this.initialize=this.initialize.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this)}config(a){a.routingBackend&&(Xb=a.routingBackend)}updateContext(a){return this.bridge.send("UPDATE_CONTEXT",a)}initialize(a){return this.bridge.send("INITIALIZE",a)}on(a,u){return this.bridge.on(a,u)}off(a,u){this.bridge.off(a,u)}},qi=VS(new Of);var Qi=it(At(),1),xt=it(Qt(),1),_z=(i,a)=>{let u=i[1]*Math.PI/180,f=a[1]*Math.PI/180,y=(a[0]-i[0])*Math.PI/180,l=Math.sin(y)*Math.cos(f),D=Math.cos(u)*Math.sin(f)-Math.sin(u)*Math.cos(f)*Math.cos(y);return(Math.atan2(l,D)*180/Math.PI+360)%360},Yb=({appId:i,initialLocation:a=[6.1258,45.9058],isMoving:u=!1,simulationPath:f,simulationSpeed:y=1,mockJWTToken:l,children:D})=>{let[B,q]=(0,Qi.useState)(u),[K,fe]=(0,Qi.useState)(a),[de,oe]=(0,Qi.useState)(0),[ce,ke]=(0,Qi.useState)(y),[Ne,ve]=(0,Qi.useState)(!1),[se,le]=(0,Qi.useState)(!0),pe=(0,Qi.useRef)(null),ge=(0,Qi.useRef)(0),Be=(0,Qi.useRef)(null),qe=(0,Qi.useRef)({autoMove:B,heading:de,location:K,mockJWTToken:l,pushLocationUpdate:()=>{},setHeading:oe,setLocation:fe,simulationPath:f,speedMultiplier:ce}),Z=(0,Qi.useCallback)(()=>{let Y=qe.current,ne={accelerometer:null,heading:{accuracy:3,magneticHeading:Y.heading,trueHeading:Y.heading},location:{coords:{accuracy:10,altitude:0,altitudeAccuracy:null,heading:Y.heading,latitude:Y.location[1],longitude:Y.location[0],speed:Y.autoMove?1.5*Y.speedMultiplier:0},timestamp:Date.now()},timestamp:Date.now()};window.__MiniAppBridge?.onNativeMessage({eventName:"LOCATION_STREAM_UPDATE",payload:ne,type:"EVENT"})},[]);return(0,Qi.useEffect)(()=>{qe.current={autoMove:B,heading:de,location:K,mockJWTToken:l,pushLocationUpdate:Z,setHeading:oe,setLocation:fe,simulationPath:f,speedMultiplier:ce}},[K,de,B,Z,f,ce,l]),(0,Qi.useEffect)(()=>{q(u)},[u]),(0,Qi.useEffect)(()=>{ke(y)},[y]),(0,Qi.useEffect)(()=>{f&&f.length>0&&(ge.current=0,fe(f[0]))},[f]),(0,Qi.useEffect)(()=>{pe.current&&Be.current&&qi.bridge.send("START_LOCATION_STREAM",Be.current)},[ce]),(0,Qi.useEffect)(()=>{let Y=qi.bridge,ne=Y.send.bind(Y),xe=()=>{pe.current&&(clearInterval(pe.current),pe.current=null),Be.current=null},Fe=ze=>{xe(),Be.current=ze||{};let Ie=ze?.interval||500,Ge=Math.max(10,Ie/qe.current.speedMultiplier);pe.current=setInterval(()=>{let We=qe.current;if(We.autoMove)if(We.simulationPath&&We.simulationPath.length>0)if(ge.current<We.simulationPath.length-1){let Ke=We.simulationPath[ge.current],yt=We.simulationPath[ge.current+1];ge.current+=1;let st=_z(Ke,yt);We.setHeading(st),We.setLocation(yt)}else We.setLocation(We.simulationPath[We.simulationPath.length-1]);else We.setLocation(Ke=>[Ke[0]+(Math.random()-.5)*1e-4,Ke[1]+(Math.random()-.5)*1e-4]);We.pushLocationUpdate()},Ge)},Ye=async ze=>{let{url:Ie,method:Ge="GET",headers:We={},body:Ke}=ze,yt=qe.current,st=new Headers(We);yt.mockJWTToken&&st.set("Authorization",`Bearer ${yt.mockJWTToken.replace("Bearer ","")}`),Ke&&typeof Ke=="object"&&!st.has("Content-Type")&&st.set("Content-Type","application/json");try{let Nt=await fetch(Ie,{body:Ke?typeof Ke=="string"?Ke:JSON.stringify(Ke):void 0,headers:st,method:Ge}),Zt=Nt.headers.get("content-type"),Ut;Zt?.includes("application/json")?Ut=await Nt.json():Ut=await Nt.text();let Ji={};return Nt.headers.forEach((Bi,ri)=>{Ji[ri]=Bi}),{data:Ut,headers:Ji,status:Nt.status,statusText:Nt.statusText}}catch(Nt){throw{error:Nt.message||"Network request failed",status:0}}};return Y.send=async(ze,Ie)=>{if(ze==="INITIALIZE")return Promise.resolve({appId:i,context:{theme:"dark"},description:"Mocked for Dev",env:{},insets:{bottom:0,left:0,right:0,top:0},name:"Vite Dev (Mock)",params:{},profile:{countryCode:"FR",email:"caveman@up.app",fullName:"Smart Caveman",localNumber:"0600000000",username:"smart_caveman",uuid:"mock-user-42"},success:!0,userData:{},uuid:i||"mock-app-id",version:"1.0.0"});if(ze==="GET_CURRENT_POSITION"){let Ge=qe.current;return Promise.resolve({coords:{accuracy:10,altitude:0,altitudeAccuracy:0,heading:Ge.heading,latitude:Ge.location[1],longitude:Ge.location[0],speed:Ge.autoMove?1.5*Ge.speedMultiplier:0},timestamp:Date.now()})}return ze==="START_LOCATION_STREAM"?(Fe(Ie),Promise.resolve()):ze==="STOP_LOCATION_STREAM"?(xe(),Promise.resolve()):ze==="NETWORK_REQUEST"?Ye(Ie):ze==="STORAGE_GET"||ze==="SECURE_GET"?Promise.resolve(localStorage.getItem(`mock_sdk_${Ie.key}`)):ze==="STORAGE_SET"||ze==="SECURE_SET"?(localStorage.setItem(`mock_sdk_${Ie.key}`,Ie.value),Promise.resolve()):ze==="GET_USER_PROFILE"?Promise.resolve({countryCode:"FR",email:"caveman@up.app",fullName:"Smart Caveman",localNumber:"0600000000",username:"smart_caveman",uuid:"mock-user-42"}):ze==="GET_FIDELITY_BALANCE"?Promise.resolve({balance:1337,currency:"FPoints"}):ze==="PAYMENT_REQUEST"?Promise.resolve({success:!0,transactionId:`tx_${Math.random().toString(36).slice(2)}`}):ze==="TRIGGER_HAPTIC"||ze==="EXIT"||ze==="UPDATE_CONTEXT"?Promise.resolve({success:!0}):ne(ze,Ie)},ve(!0),()=>{xe(),Y.send=ne}},[i]),Ne?(0,xt.jsxs)("div",{className:"relative w-full h-full",children:[(0,xt.jsx)("div",{className:"w-full h-full",children:D}),se?(0,xt.jsx)("button",{className:"fixed bottom-4 right-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-blue-400 z-[9999] transition-all shadow-lg group",onClick:()=>le(!1),title:"Open Simulation Controls",type:"button",children:(0,xt.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,xt.jsx)("path",{d:"M21 4H3"}),(0,xt.jsx)("path",{d:"M10 8H3"}),(0,xt.jsx)("path",{d:"M21 12H3"}),(0,xt.jsx)("path",{d:"M10 16H3"}),(0,xt.jsx)("path",{d:"M21 20H3"}),(0,xt.jsx)("circle",{cx:"14",cy:"8",r:"2"}),(0,xt.jsx)("circle",{cx:"14",cy:"16",r:"2"})]})}):(0,xt.jsxs)("div",{className:"fixed bottom-4 right-4 bg-slate-900 text-slate-300 font-mono text-xs rounded-xl shadow-2xl border border-slate-700 pointer-events-auto flex flex-col w-80 overflow-hidden animate-in slide-in-from-right duration-300",style:{zIndex:9998},children:[(0,xt.jsxs)("div",{className:"flex justify-between items-center p-3 border-b border-slate-800 cursor-pointer bg-slate-800/50 hover:bg-slate-800 transition-colors",onClick:()=>le(!0),children:[(0,xt.jsxs)("span",{className:"font-bold text-slate-100 flex items-center gap-2",children:[(0,xt.jsx)("span",{className:"text-lg",children:"\u{1F6E0}\uFE0F"})," Simulation Controls"]}),(0,xt.jsx)("button",{className:"text-slate-500 hover:text-white",type:"button",children:"\u25BC"})]}),(0,xt.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,xt.jsxs)("div",{className:"flex justify-between items-center",children:[(0,xt.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,xt.jsx)("input",{checked:B,className:"accent-blue-500 w-4 h-4",onChange:Y=>q(Y.target.checked),type:"checkbox"}),(0,xt.jsxs)("span",{className:"text-slate-200 font-bold",children:["Auto-Move ",f?"(Path)":"(Random)"]})]}),(0,xt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,xt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),(0,xt.jsx)("select",{className:"bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white focus:outline-none focus:border-blue-500 text-[10px]",onChange:Y=>ke(Number(Y.target.value)),value:ce,children:[1,2,5,10,50,100,250].map(Y=>(0,xt.jsxs)("option",{value:Y,children:[Y,"x"]},Y))})]})]}),(0,xt.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,xt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,xt.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lng"}),(0,xt.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Y=>{let ne=parseFloat(Y.target.value)||0;fe([ne,K[1]]),Z()},step:"0.001",type:"number",value:K[0]})]}),(0,xt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,xt.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lat"}),(0,xt.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Y=>{let ne=parseFloat(Y.target.value)||0;fe([K[0],ne]),Z()},step:"0.001",type:"number",value:K[1]})]}),(0,xt.jsxs)("div",{className:"flex flex-col gap-1 col-span-2",children:[(0,xt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Heading (Degrees)"}),(0,xt.jsx)("input",{className:"w-full accent-blue-500",max:"360",min:"0",onChange:Y=>{oe(parseInt(Y.target.value,10)),Z()},type:"range",value:de}),(0,xt.jsxs)("div",{className:"text-right text-slate-400",children:[de,"\xB0"]})]})]})]})]})]}):null};var Mo=it(At(),1),ni=it(Qt(),1),Wb=({isOpen:i=!1,onClose:a})=>{let[u,f]=(0,Mo.useState)(i),[y,l]=(0,Mo.useState)([]),D=(0,Mo.useRef)(null);(0,Mo.useEffect)(()=>{f(i)},[i]);let B=()=>l([]),q=(0,Mo.useCallback)((K,fe)=>{if(K.includes("LOCATION_STREAM_UPDATE"))return;let de={content:typeof fe=="string"?fe:JSON.stringify(fe,null,2),id:Math.random().toString(36).slice(2),label:K,time:new Date().toLocaleTimeString()};l(oe=>[de,...oe].slice(0,100))},[]);return(0,Mo.useEffect)(()=>{if(typeof window>"u")return;let K=qi.bridge,fe=K.send.bind(K);K.send=async(oe,ce)=>(q(`OUT: ${oe}`,ce),fe(oe,ce));let de=K.handleNativeMessage.bind(K);return K.handleNativeMessage=oe=>{let ce=oe.eventName||oe.event||oe.type||"MSG";typeof ce=="string"&&(q(`IN: ${ce}`,oe.payload||oe.value||oe),de(oe))},()=>{K.send=fe,K.handleNativeMessage=de}},[q]),u?(0,ni.jsxs)("div",{className:"fixed inset-x-0 bottom-0 w-full bg-[#0a080f] border-t border-slate-800 z-[9998] p-4 shadow-2xl flex flex-col animate-in slide-in-from-bottom duration-300",children:[(0,ni.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ni.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-400 flex items-center gap-2",children:[(0,ni.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),"UP SDK Debug Console"]}),(0,ni.jsxs)("div",{className:"flex gap-4",children:[(0,ni.jsx)("button",{className:"text-[10px] text-slate-500 font-bold uppercase hover:text-slate-300 transition-colors",onClick:B,type:"button",children:"Clear"}),(0,ni.jsx)("button",{className:"text-[10px] text-pink-500 font-bold uppercase hover:underline transition-colors",onClick:()=>{f(!1),a&&a()},type:"button",children:"Close"})]})]}),(0,ni.jsx)("div",{className:"bg-black/80 rounded-xl p-3 font-mono text-[10px] text-emerald-400 min-h-[120px] max-h-[240px] overflow-y-auto border border-slate-900 custom-scrollbar",ref:D,children:y.length===0?(0,ni.jsx)("div",{className:"text-slate-600 italic text-center py-8",children:"No logs yet. Interacting with the SDK will show events here."}):y.map(K=>(0,ni.jsxs)("div",{className:"mb-3 pb-3 border-b border-slate-900/50 last:border-0 last:mb-0 last:pb-0",children:[(0,ni.jsxs)("div",{className:"flex gap-2 text-slate-500 mb-1 items-center",children:[(0,ni.jsx)("span",{className:"text-[8px]",children:K.time}),(0,ni.jsx)("span",{className:"font-bold text-white uppercase text-[8px] bg-slate-800 px-1.5 py-0.5 rounded leading-none",children:K.label})]}),(0,ni.jsx)("pre",{className:"whitespace-pre-wrap break-all opacity-90",children:K.content})]},K.id))})]}):(0,ni.jsx)("button",{className:"fixed bottom-4 left-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-emerald-400 transition-all z-[9998] shadow-lg group",onClick:()=>f(!0),title:"Open Debug Console",type:"button",children:(0,ni.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,ni.jsx)("path",{d:"m8 2 1.88 1.88"}),(0,ni.jsx)("path",{d:"M14.12 3.88 16 2"}),(0,ni.jsx)("path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"}),(0,ni.jsx)("path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"}),(0,ni.jsx)("path",{d:"M12 20v-9"}),(0,ni.jsx)("path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5"}),(0,ni.jsx)("path",{d:"M6 13H2"}),(0,ni.jsx)("path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4"}),(0,ni.jsx)("path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4"}),(0,ni.jsx)("path",{d:"M22 13h-4"}),(0,ni.jsx)("path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4"})]})})};var ad=it(At(),1);var Ss=it(Qt(),1),Kb=(0,ad.createContext)({isMocked:!1}),yz=()=>(0,ad.useContext)(Kb).isMocked,vz=({children:i,debug:a=!1,...u})=>{let f=typeof window<"u"&&!(window.__UP_REACT_NATIVE_APP__===!0||window.ReactNativeWebView),y=(0,ad.useMemo)(()=>({isMocked:f}),[f]),l=(0,Ss.jsxs)(Ss.Fragment,{children:[i,a&&(0,Ss.jsx)(Wb,{})]});return f?(0,Ss.jsx)(Kb.Provider,{value:y,children:(0,Ss.jsx)(Yb,{...u,children:l})}):(0,Ss.jsx)(Kb.Provider,{value:y,children:l})};async function bz(i,a){return o1.fetchRoute(i,a)}function xz(i,a,u){let f=`sdk-route-${a}`,y=`sdk-route-casing-${a}`,l=`sdk-route-line-${a}`,D={features:[{geometry:u.payload.routeData.geometry,properties:{},type:"Feature"}],type:"FeatureCollection"},B=i.getSource(f);B?B.setData(D):(i.addSource(f,{data:D,type:"geojson"}),i.addLayer({id:y,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#111111","line-opacity":.8,"line-width":8},source:f,type:"line"}),i.addLayer({id:l,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":4},source:f,type:"line"}))}function wz(i,a){let u=`sdk-route-${a}`,f=`sdk-route-casing-${a}`,y=`sdk-route-line-${a}`;i.getLayer(y)&&i.removeLayer(y),i.getLayer(f)&&i.removeLayer(f),i.getSource(u)&&i.removeSource(u)}var Tz=qi;return jE(Sz);})();
817
+ /*! Bundled license information:
818
+
819
+ react/cjs/react.production.js:
820
+ (**
821
+ * @license React
822
+ * react.production.js
823
+ *
824
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
825
+ *
826
+ * This source code is licensed under the MIT license found in the
827
+ * LICENSE file in the root directory of this source tree.
828
+ *)
829
+
830
+ react/cjs/react-jsx-runtime.production.js:
831
+ (**
832
+ * @license React
833
+ * react-jsx-runtime.production.js
834
+ *
835
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
836
+ *
837
+ * This source code is licensed under the MIT license found in the
838
+ * LICENSE file in the root directory of this source tree.
839
+ *)
840
+
841
+ maplibre-gl/dist/maplibre-gl.js:
842
+ (**
843
+ * MapLibre GL JS
844
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.24.0/LICENSE.txt
845
+ *)
846
+
847
+ react-dom/cjs/react-dom.production.js:
848
+ (**
849
+ * @license React
850
+ * react-dom.production.js
851
+ *
852
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
853
+ *
854
+ * This source code is licensed under the MIT license found in the
855
+ * LICENSE file in the root directory of this source tree.
856
+ *)
857
+
858
+ scheduler/cjs/scheduler.production.js:
859
+ (**
860
+ * @license React
861
+ * scheduler.production.js
862
+ *
863
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
864
+ *
865
+ * This source code is licensed under the MIT license found in the
866
+ * LICENSE file in the root directory of this source tree.
867
+ *)
868
+
869
+ react-dom/cjs/react-dom-client.production.js:
870
+ (**
871
+ * @license React
872
+ * react-dom-client.production.js
873
+ *
874
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
875
+ *
876
+ * This source code is licensed under the MIT license found in the
877
+ * LICENSE file in the root directory of this source tree.
878
+ *)
879
+ */
2
880
  //# sourceMappingURL=index.browser.min.js.map