diff --git a/CNAME b/CNAME deleted file mode 100644 index 49165e4..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -chatmap.hotosm.org \ No newline at end of file diff --git a/assets/index-CWqD2zKx.js b/assets/index-AWVp3Sk_.js similarity index 85% rename from assets/index-CWqD2zKx.js rename to assets/index-AWVp3Sk_.js index 50e6829..d75a3d7 100644 --- a/assets/index-CWqD2zKx.js +++ b/assets/index-AWVp3Sk_.js @@ -1,4 +1,4 @@ -var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))o(h);new MutationObserver(h=>{for(const f of h)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function i(h){const f={};return h.integrity&&(f.integrity=h.integrity),h.referrerPolicy&&(f.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?f.credentials="include":h.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(h){if(h.ep)return;h.ep=!0;const f=i(h);fetch(h.href,f)}})();var ff=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mD(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var i=function o(){return this instanceof o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var h=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(i,o,h.get?h:{enumerable:!0,get:function(){return e[o]}})}),i}var JT={exports:{}},Ay={},QT={exports:{}},yr={};/** +var mD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var jj=mD((Vj,Bg)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))o(h);new MutationObserver(h=>{for(const f of h)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function i(h){const f={};return h.integrity&&(f.integrity=h.integrity),h.referrerPolicy&&(f.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?f.credentials="include":h.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(h){if(h.ep)return;h.ep=!0;const f=i(h);fetch(h.href,f)}})();var ff=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function gD(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var i=function o(){return this instanceof o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var h=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(i,o,h.get?h:{enumerable:!0,get:function(){return e[o]}})}),i}var JT={exports:{}},Ay={},QT={exports:{}},yr={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fp=Symbol.for("react.element"),gD=Symbol.for("react.portal"),yD=Symbol.for("react.fragment"),_D=Symbol.for("react.strict_mode"),vD=Symbol.for("react.profiler"),xD=Symbol.for("react.provider"),wD=Symbol.for("react.context"),bD=Symbol.for("react.forward_ref"),SD=Symbol.for("react.suspense"),kD=Symbol.for("react.memo"),TD=Symbol.for("react.lazy"),eS=Symbol.iterator;function ED(e){return e===null||typeof e!="object"?null:(e=eS&&e[eS]||e["@@iterator"],typeof e=="function"?e:null)}var eE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tE=Object.assign,rE={};function Fh(e,t,i){this.props=e,this.context=t,this.refs=rE,this.updater=i||eE}Fh.prototype.isReactComponent={};Fh.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Fh.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function nE(){}nE.prototype=Fh.prototype;function xx(e,t,i){this.props=e,this.context=t,this.refs=rE,this.updater=i||eE}var wx=xx.prototype=new nE;wx.constructor=xx;tE(wx,Fh.prototype);wx.isPureReactComponent=!0;var tS=Array.isArray,iE=Object.prototype.hasOwnProperty,bx={current:null},sE={key:!0,ref:!0,__self:!0,__source:!0};function oE(e,t,i){var o,h={},f=null,g=null;if(t!=null)for(o in t.ref!==void 0&&(g=t.ref),t.key!==void 0&&(f=""+t.key),t)iE.call(t,o)&&!sE.hasOwnProperty(o)&&(h[o]=t[o]);var c=arguments.length-2;if(c===1)h.children=i;else if(1()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var AD=Ht,DD=Symbol.for("react.element"),zD=Symbol.for("react.fragment"),RD=Object.prototype.hasOwnProperty,LD=AD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,OD={key:!0,ref:!0,__self:!0,__source:!0};function lE(e,t,i){var o,h={},f=null,g=null;i!==void 0&&(f=""+i),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)RD.call(t,o)&&!OD.hasOwnProperty(o)&&(h[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)h[o]===void 0&&(h[o]=t[o]);return{$$typeof:DD,type:e,key:f,ref:g,props:h,_owner:LD.current}}Ay.Fragment=zD;Ay.jsx=lE;Ay.jsxs=lE;JT.exports=Ay;var Ke=JT.exports,$v={},uE={exports:{}},Bs={},cE={exports:{}},hE={};/** + */var DD=Ht,zD=Symbol.for("react.element"),RD=Symbol.for("react.fragment"),LD=Object.prototype.hasOwnProperty,OD=DD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,FD={key:!0,ref:!0,__self:!0,__source:!0};function lE(e,t,i){var o,h={},f=null,g=null;i!==void 0&&(f=""+i),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)LD.call(t,o)&&!FD.hasOwnProperty(o)&&(h[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)h[o]===void 0&&(h[o]=t[o]);return{$$typeof:zD,type:e,key:f,ref:g,props:h,_owner:OD.current}}Ay.Fragment=RD;Ay.jsx=lE;Ay.jsxs=lE;JT.exports=Ay;var We=JT.exports,$v={},uE={exports:{}},Bs={},cE={exports:{}},hE={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(Be,Le){var Xe=Be.length;Be.push(Le);e:for(;0>>1,Ee=Be[xe];if(0>>1;xeh(rt,Xe))Jth(er,rt)?(Be[xe]=er,Be[Jt]=Xe,xe=Jt):(Be[xe]=rt,Be[nt]=Xe,xe=nt);else if(Jth(er,Xe))Be[xe]=er,Be[Jt]=Xe,xe=Jt;else break e}}return Le}function h(Be,Le){var Xe=Be.sortIndex-Le.sortIndex;return Xe!==0?Xe:Be.id-Le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,c=g.now();e.unstable_now=function(){return g.now()-c}}var T=[],P=[],R=1,A=null,M=3,N=!1,Y=!1,j=!1,te=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function q(Be){for(var Le=i(P);Le!==null;){if(Le.callback===null)o(P);else if(Le.startTime<=Be)o(P),Le.sortIndex=Le.expirationTime,t(T,Le);else break;Le=i(P)}}function ne(Be){if(j=!1,q(Be),!Y)if(i(T)!==null)Y=!0,vt(oe);else{var Le=i(P);Le!==null&&ye(ne,Le.startTime-Be)}}function oe(Be,Le){Y=!1,j&&(j=!1,O(Fe),Fe=-1),N=!0;var Xe=M;try{for(q(Le),A=i(T);A!==null&&(!(A.expirationTime>Le)||Be&&!it());){var xe=A.callback;if(typeof xe=="function"){A.callback=null,M=A.priorityLevel;var Ee=xe(A.expirationTime<=Le);Le=e.unstable_now(),typeof Ee=="function"?A.callback=Ee:A===i(T)&&o(T),q(Le)}else o(T);A=i(T)}if(A!==null)var mt=!0;else{var nt=i(P);nt!==null&&ye(ne,nt.startTime-Le),mt=!1}return mt}finally{A=null,M=Xe,N=!1}}var ke=!1,ge=null,Fe=-1,Oe=5,We=-1;function it(){return!(e.unstable_now()-WeBe||125xe?(Be.sortIndex=Xe,t(P,Be),i(T)===null&&Be===i(P)&&(j?(O(Fe),Fe=-1):j=!0,ye(ne,Xe-xe))):(Be.sortIndex=Ee,t(T,Be),Y||N||(Y=!0,vt(oe))),Be},e.unstable_shouldYield=it,e.unstable_wrapCallback=function(Be){var Le=M;return function(){var Xe=M;M=Le;try{return Be.apply(this,arguments)}finally{M=Xe}}}})(hE);cE.exports=hE;var FD=cE.exports;/** + */(function(e){function t(Be,Le){var Ke=Be.length;Be.push(Le);e:for(;0>>1,Ee=Be[xe];if(0>>1;xeh(rt,Ke))Jth(er,rt)?(Be[xe]=er,Be[Jt]=Ke,xe=Jt):(Be[xe]=rt,Be[nt]=Ke,xe=nt);else if(Jth(er,Ke))Be[xe]=er,Be[Jt]=Ke,xe=Jt;else break e}}return Le}function h(Be,Le){var Ke=Be.sortIndex-Le.sortIndex;return Ke!==0?Ke:Be.id-Le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,c=g.now();e.unstable_now=function(){return g.now()-c}}var T=[],P=[],R=1,A=null,M=3,N=!1,Y=!1,U=!1,te=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function q(Be){for(var Le=i(P);Le!==null;){if(Le.callback===null)o(P);else if(Le.startTime<=Be)o(P),Le.sortIndex=Le.expirationTime,t(T,Le);else break;Le=i(P)}}function ne(Be){if(U=!1,q(Be),!Y)if(i(T)!==null)Y=!0,vt(oe);else{var Le=i(P);Le!==null&&ye(ne,Le.startTime-Be)}}function oe(Be,Le){Y=!1,U&&(U=!1,O(Fe),Fe=-1),N=!0;var Ke=M;try{for(q(Le),A=i(T);A!==null&&(!(A.expirationTime>Le)||Be&&!it());){var xe=A.callback;if(typeof xe=="function"){A.callback=null,M=A.priorityLevel;var Ee=xe(A.expirationTime<=Le);Le=e.unstable_now(),typeof Ee=="function"?A.callback=Ee:A===i(T)&&o(T),q(Le)}else o(T);A=i(T)}if(A!==null)var mt=!0;else{var nt=i(P);nt!==null&&ye(ne,nt.startTime-Le),mt=!1}return mt}finally{A=null,M=Ke,N=!1}}var ke=!1,ge=null,Fe=-1,Oe=5,Ge=-1;function it(){return!(e.unstable_now()-GeBe||125xe?(Be.sortIndex=Ke,t(P,Be),i(T)===null&&Be===i(P)&&(U?(O(Fe),Fe=-1):U=!0,ye(ne,Ke-xe))):(Be.sortIndex=Ee,t(T,Be),Y||N||(Y=!0,vt(oe))),Be},e.unstable_shouldYield=it,e.unstable_wrapCallback=function(Be){var Le=M;return function(){var Ke=M;M=Le;try{return Be.apply(this,arguments)}finally{M=Ke}}}})(hE);cE.exports=hE;var BD=cE.exports;/** * @license React * react-dom.production.min.js * @@ -30,15 +30,15 @@ var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var BD=Ht,Fs=FD;function lt(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uv=Object.prototype.hasOwnProperty,ND=/^[: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]*$/,nS={},iS={};function $D(e){return Uv.call(iS,e)?!0:Uv.call(nS,e)?!1:ND.test(e)?iS[e]=!0:(nS[e]=!0,!1)}function UD(e,t,i,o){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return o?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function jD(e,t,i,o){if(t===null||typeof t>"u"||UD(e,t,i,o))return!0;if(o)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Gi(e,t,i,o,h,f,g){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=o,this.attributeNamespace=h,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=f,this.removeEmptyString=g}var hi={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){hi[e]=new Gi(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];hi[t]=new Gi(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){hi[e]=new Gi(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hi[e]=new Gi(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){hi[e]=new Gi(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){hi[e]=new Gi(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){hi[e]=new Gi(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){hi[e]=new Gi(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){hi[e]=new Gi(e,5,!1,e.toLowerCase(),null,!1,!1)});var kx=/[\-:]([a-z])/g;function Tx(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(kx,Tx);hi[t]=new Gi(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(kx,Tx);hi[t]=new Gi(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(kx,Tx);hi[t]=new Gi(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){hi[e]=new Gi(e,1,!1,e.toLowerCase(),null,!1,!1)});hi.xlinkHref=new Gi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){hi[e]=new Gi(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ex(e,t,i,o){var h=hi.hasOwnProperty(t)?hi[t]:null;(h!==null?h.type!==0:o||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jv=Object.prototype.hasOwnProperty,$D=/^[: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]*$/,nS={},iS={};function jD(e){return jv.call(iS,e)?!0:jv.call(nS,e)?!1:$D.test(e)?iS[e]=!0:(nS[e]=!0,!1)}function UD(e,t,i,o){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return o?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function VD(e,t,i,o){if(t===null||typeof t>"u"||UD(e,t,i,o))return!0;if(o)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Gi(e,t,i,o,h,f,g){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=o,this.attributeNamespace=h,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=f,this.removeEmptyString=g}var hi={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){hi[e]=new Gi(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];hi[t]=new Gi(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){hi[e]=new Gi(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hi[e]=new Gi(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){hi[e]=new Gi(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){hi[e]=new Gi(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){hi[e]=new Gi(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){hi[e]=new Gi(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){hi[e]=new Gi(e,5,!1,e.toLowerCase(),null,!1,!1)});var kx=/[\-:]([a-z])/g;function Tx(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(kx,Tx);hi[t]=new Gi(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(kx,Tx);hi[t]=new Gi(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(kx,Tx);hi[t]=new Gi(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){hi[e]=new Gi(e,1,!1,e.toLowerCase(),null,!1,!1)});hi.xlinkHref=new Gi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){hi[e]=new Gi(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ex(e,t,i,o){var h=hi.hasOwnProperty(t)?hi[t]:null;(h!==null?h.type!==0:o||!(2c||h[g]!==f[c]){var T=` -`+h[g].replace(" at new "," at ");return e.displayName&&T.includes("")&&(T=T.replace("",e.displayName)),T}while(1<=g&&0<=c);break}}}finally{G0=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?pf(e):""}function VD(e){switch(e.tag){case 5:return pf(e.type);case 16:return pf("Lazy");case 13:return pf("Suspense");case 19:return pf("SuspenseList");case 0:case 2:case 15:return e=Z0(e.type,!1),e;case 11:return e=Z0(e.type.render,!1),e;case 1:return e=Z0(e.type,!0),e;default:return""}}function Wv(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Jc:return"Fragment";case Kc:return"Portal";case jv:return"Profiler";case Cx:return"StrictMode";case Vv:return"Suspense";case Hv:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pE:return(e.displayName||"Context")+".Consumer";case fE:return(e._context.displayName||"Context")+".Provider";case Ix:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Px:return t=e.displayName||null,t!==null?t:Wv(e.type)||"Memo";case wl:t=e._payload,e=e._init;try{return Wv(e(t))}catch{}}return null}function HD(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wv(t);case 8:return t===Cx?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ul(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function WD(e){var t=gE(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),o=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var h=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return h.call(this)},set:function(g){o=""+g,f.call(this,g)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return o},setValue:function(g){o=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rm(e){e._valueTracker||(e._valueTracker=WD(e))}function yE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),o="";return e&&(o=gE(e)?e.checked?"true":"false":e.value),e=o,e!==i?(t.setValue(e),!0):!1}function Ng(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Gv(e,t){var i=t.checked;return kn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function oS(e,t){var i=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;i=Ul(t.value!=null?t.value:i),e._wrapperState={initialChecked:o,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _E(e,t){t=t.checked,t!=null&&Ex(e,"checked",t,!1)}function Zv(e,t){_E(e,t);var i=Ul(t.value),o=t.type;if(i!=null)o==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?qv(e,t.type,i):t.hasOwnProperty("defaultValue")&&qv(e,t.type,Ul(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function aS(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var o=t.type;if(!(o!=="submit"&&o!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function qv(e,t,i){(t!=="number"||Ng(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var mf=Array.isArray;function dh(e,t,i,o){if(e=e.options,t){t={};for(var h=0;h"+t.valueOf().toString()+"",t=Lm.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nf(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var Sf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},GD=["Webkit","ms","Moz","O"];Object.keys(Sf).forEach(function(e){GD.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Sf[t]=Sf[e]})});function bE(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||Sf.hasOwnProperty(e)&&Sf[e]?(""+t).trim():t+"px"}function SE(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var o=i.indexOf("--")===0,h=bE(i,t[i],o);i==="float"&&(i="cssFloat"),o?e.setProperty(i,h):e[i]=h}}var ZD=kn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Kv(e,t){if(t){if(ZD[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(lt(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(lt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(lt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(lt(62))}}function Jv(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Qv=null;function Mx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var e1=null,fh=null,ph=null;function cS(e){if(e=gp(e)){if(typeof e1!="function")throw Error(lt(280));var t=e.stateNode;t&&(t=Oy(t),e1(e.stateNode,e.type,t))}}function kE(e){fh?ph?ph.push(e):ph=[e]:fh=e}function TE(){if(fh){var e=fh,t=ph;if(ph=fh=null,cS(e),t)for(e=0;e>>=0,e===0?32:31-(iz(e)/sz|0)|0}var Om=64,Fm=4194304;function gf(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Vg(e,t){var i=e.pendingLanes;if(i===0)return 0;var o=0,h=e.suspendedLanes,f=e.pingedLanes,g=i&268435455;if(g!==0){var c=g&~h;c!==0?o=gf(c):(f&=g,f!==0&&(o=gf(f)))}else g=i&~h,g!==0?o=gf(g):f!==0&&(o=gf(f));if(o===0)return 0;if(t!==0&&t!==o&&!(t&h)&&(h=o&-o,f=t&-t,h>=f||h===16&&(f&4194240)!==0))return t;if(o&4&&(o|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=o;0i;i++)t.push(e);return t}function pp(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vo(t),e[t]=i}function uz(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0=Tf),vS=" ",xS=!1;function WE(e,t){switch(e){case"keyup":return Fz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qc=!1;function Nz(e,t){switch(e){case"compositionend":return GE(t);case"keypress":return t.which!==32?null:(xS=!0,vS);case"textInput":return e=t.data,e===vS&&xS?null:e;default:return null}}function $z(e,t){if(Qc)return e==="compositionend"||!Bx&&WE(e,t)?(e=VE(),cg=Lx=Tl=null,Qc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:i,offset:t-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=kS(i)}}function XE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?XE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function KE(){for(var e=window,t=Ng();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Ng(e.document)}return t}function Nx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Yz(e){var t=KE(),i=e.focusedElem,o=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&XE(i.ownerDocument.documentElement,i)){if(o!==null&&Nx(i)){if(t=o.start,e=o.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var h=i.textContent.length,f=Math.min(o.start,h);o=o.end===void 0?f:Math.min(o.end,h),!e.extend&&f>o&&(h=o,o=f,f=h),h=TS(i,f);var g=TS(i,o);h&&g&&(e.rangeCount!==1||e.anchorNode!==h.node||e.anchorOffset!==h.offset||e.focusNode!==g.node||e.focusOffset!==g.offset)&&(t=t.createRange(),t.setStart(h.node,h.offset),e.removeAllRanges(),f>o?(e.addRange(t),e.extend(g.node,g.offset)):(t.setEnd(g.node,g.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i=document.documentMode,eh=null,o1=null,Cf=null,a1=!1;function ES(e,t,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;a1||eh==null||eh!==Ng(o)||(o=eh,"selectionStart"in o&&Nx(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Cf&&Wf(Cf,o)||(Cf=o,o=Gg(o1,"onSelect"),0nh||(e.current=f1[nh],f1[nh]=null,nh--)}function en(e,t){nh++,f1[nh]=e.current,e.current=t}var jl={},Pi=Hl(jl),cs=Hl(!1),Uu=jl;function Sh(e,t){var i=e.type.contextTypes;if(!i)return jl;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var h={},f;for(f in i)h[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=h),h}function hs(e){return e=e.childContextTypes,e!=null}function qg(){cn(cs),cn(Pi)}function zS(e,t,i){if(Pi.current!==jl)throw Error(lt(168));en(Pi,t),en(cs,i)}function oC(e,t,i){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return i;o=o.getChildContext();for(var h in o)if(!(h in t))throw Error(lt(108,HD(e)||"Unknown",h));return kn({},i,o)}function Yg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||jl,Uu=Pi.current,en(Pi,e),en(cs,cs.current),!0}function RS(e,t,i){var o=e.stateNode;if(!o)throw Error(lt(169));i?(e=oC(e,t,Uu),o.__reactInternalMemoizedMergedChildContext=e,cn(cs),cn(Pi),en(Pi,e)):cn(cs),en(cs,i)}var va=null,Fy=!1,av=!1;function aC(e){va===null?va=[e]:va.push(e)}function aR(e){Fy=!0,aC(e)}function Wl(){if(!av&&va!==null){av=!0;var e=0,t=Ur;try{var i=va;for(Ur=1;e>=g,h-=g,xa=1<<32-vo(t)+h|i<Fe?(Oe=ge,ge=null):Oe=ge.sibling;var We=M(O,ge,q[Fe],ne);if(We===null){ge===null&&(ge=Oe);break}e&&ge&&We.alternate===null&&t(O,ge),$=f(We,$,Fe),ke===null?oe=We:ke.sibling=We,ke=We,ge=Oe}if(Fe===q.length)return i(O,ge),yn&&wu(O,Fe),oe;if(ge===null){for(;FeFe?(Oe=ge,ge=null):Oe=ge.sibling;var it=M(O,ge,We.value,ne);if(it===null){ge===null&&(ge=Oe);break}e&&ge&&it.alternate===null&&t(O,ge),$=f(it,$,Fe),ke===null?oe=it:ke.sibling=it,ke=it,ge=Oe}if(We.done)return i(O,ge),yn&&wu(O,Fe),oe;if(ge===null){for(;!We.done;Fe++,We=q.next())We=A(O,We.value,ne),We!==null&&($=f(We,$,Fe),ke===null?oe=We:ke.sibling=We,ke=We);return yn&&wu(O,Fe),oe}for(ge=o(O,ge);!We.done;Fe++,We=q.next())We=N(ge,O,Fe,We.value,ne),We!==null&&(e&&We.alternate!==null&&ge.delete(We.key===null?Fe:We.key),$=f(We,$,Fe),ke===null?oe=We:ke.sibling=We,ke=We);return e&&ge.forEach(function(ve){return t(O,ve)}),yn&&wu(O,Fe),oe}function te(O,$,q,ne){if(typeof q=="object"&&q!==null&&q.type===Jc&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case zm:e:{for(var oe=q.key,ke=$;ke!==null;){if(ke.key===oe){if(oe=q.type,oe===Jc){if(ke.tag===7){i(O,ke.sibling),$=h(ke,q.props.children),$.return=O,O=$;break e}}else if(ke.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===wl&&FS(oe)===ke.type){i(O,ke.sibling),$=h(ke,q.props),$.ref=lf(O,ke,q),$.return=O,O=$;break e}i(O,ke);break}else t(O,ke);ke=ke.sibling}q.type===Jc?($=Lu(q.props.children,O.mode,ne,q.key),$.return=O,O=$):(ne=_g(q.type,q.key,q.props,null,O.mode,ne),ne.ref=lf(O,$,q),ne.return=O,O=ne)}return g(O);case Kc:e:{for(ke=q.key;$!==null;){if($.key===ke)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){i(O,$.sibling),$=h($,q.children||[]),$.return=O,O=$;break e}else{i(O,$);break}else t(O,$);$=$.sibling}$=mv(q,O.mode,ne),$.return=O,O=$}return g(O);case wl:return ke=q._init,te(O,$,ke(q._payload),ne)}if(mf(q))return Y(O,$,q,ne);if(rf(q))return j(O,$,q,ne);Hm(O,q)}return typeof q=="string"&&q!==""||typeof q=="number"?(q=""+q,$!==null&&$.tag===6?(i(O,$.sibling),$=h($,q),$.return=O,O=$):(i(O,$),$=pv(q,O.mode,ne),$.return=O,O=$),g(O)):i(O,$)}return te}var Th=hC(!0),dC=hC(!1),Jg=Hl(null),Qg=null,oh=null,Vx=null;function Hx(){Vx=oh=Qg=null}function Wx(e){var t=Jg.current;cn(Jg),e._currentValue=t}function g1(e,t,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===i)break;e=e.return}}function gh(e,t){Qg=e,Vx=oh=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function eo(e){var t=e._currentValue;if(Vx!==e)if(e={context:e,memoizedValue:t,next:null},oh===null){if(Qg===null)throw Error(lt(308));oh=e,Qg.dependencies={lanes:0,firstContext:e}}else oh=oh.next=e;return t}var Iu=null;function Gx(e){Iu===null?Iu=[e]:Iu.push(e)}function fC(e,t,i,o){var h=t.interleaved;return h===null?(i.next=i,Gx(t)):(i.next=h.next,h.next=i),t.interleaved=i,Pa(e,o)}function Pa(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var bl=!1;function Zx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pC(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ka(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ol(e,t,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Pr&2){var h=o.pending;return h===null?t.next=t:(t.next=h.next,h.next=t),o.pending=t,Pa(e,i)}return h=o.interleaved,h===null?(t.next=t,Gx(o)):(t.next=h.next,h.next=t),o.interleaved=t,Pa(e,i)}function dg(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,Dx(e,i)}}function BS(e,t){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var h=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var g={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};f===null?h=f=g:f=f.next=g,i=i.next}while(i!==null);f===null?h=f=t:f=f.next=t}else h=f=t;i={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:f,shared:o.shared,effects:o.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function ey(e,t,i,o){var h=e.updateQueue;bl=!1;var f=h.firstBaseUpdate,g=h.lastBaseUpdate,c=h.shared.pending;if(c!==null){h.shared.pending=null;var T=c,P=T.next;T.next=null,g===null?f=P:g.next=P,g=T;var R=e.alternate;R!==null&&(R=R.updateQueue,c=R.lastBaseUpdate,c!==g&&(c===null?R.firstBaseUpdate=P:c.next=P,R.lastBaseUpdate=T))}if(f!==null){var A=h.baseState;g=0,R=P=T=null,c=f;do{var M=c.lane,N=c.eventTime;if((o&M)===M){R!==null&&(R=R.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var Y=e,j=c;switch(M=t,N=i,j.tag){case 1:if(Y=j.payload,typeof Y=="function"){A=Y.call(N,A,M);break e}A=Y;break e;case 3:Y.flags=Y.flags&-65537|128;case 0:if(Y=j.payload,M=typeof Y=="function"?Y.call(N,A,M):Y,M==null)break e;A=kn({},A,M);break e;case 2:bl=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,M=h.effects,M===null?h.effects=[c]:M.push(c))}else N={eventTime:N,lane:M,tag:c.tag,payload:c.payload,callback:c.callback,next:null},R===null?(P=R=N,T=A):R=R.next=N,g|=M;if(c=c.next,c===null){if(c=h.shared.pending,c===null)break;M=c,c=M.next,M.next=null,h.lastBaseUpdate=M,h.shared.pending=null}}while(!0);if(R===null&&(T=A),h.baseState=T,h.firstBaseUpdate=P,h.lastBaseUpdate=R,t=h.shared.interleaved,t!==null){h=t;do g|=h.lane,h=h.next;while(h!==t)}else f===null&&(h.shared.lanes=0);Hu|=g,e.lanes=g,e.memoizedState=A}}function NS(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;ti?i:4,e(!0);var o=uv.transition;uv.transition={};try{e(!1),t()}finally{Ur=i,uv.transition=o}}function AC(){return to().memoizedState}function hR(e,t,i){var o=Bl(e);if(i={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null},DC(e))zC(t,i);else if(i=fC(e,t,i,o),i!==null){var h=Hi();xo(i,e,o,h),RC(i,t,o)}}function dR(e,t,i){var o=Bl(e),h={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null};if(DC(e))zC(t,h);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,c=f(g,i);if(h.hasEagerState=!0,h.eagerState=c,So(c,g)){var T=t.interleaved;T===null?(h.next=h,Gx(t)):(h.next=T.next,T.next=h),t.interleaved=h;return}}catch{}finally{}i=fC(e,t,h,o),i!==null&&(h=Hi(),xo(i,e,o,h),RC(i,t,o))}}function DC(e){var t=e.alternate;return e===Sn||t!==null&&t===Sn}function zC(e,t){If=ry=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function RC(e,t,i){if(i&4194240){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,Dx(e,i)}}var ny={readContext:eo,useCallback:ki,useContext:ki,useEffect:ki,useImperativeHandle:ki,useInsertionEffect:ki,useLayoutEffect:ki,useMemo:ki,useReducer:ki,useRef:ki,useState:ki,useDebugValue:ki,useDeferredValue:ki,useTransition:ki,useMutableSource:ki,useSyncExternalStore:ki,useId:ki,unstable_isNewReconciler:!1},fR={readContext:eo,useCallback:function(e,t){return Uo().memoizedState=[e,t===void 0?null:t],e},useContext:eo,useEffect:US,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,pg(4194308,4,EC.bind(null,t,e),i)},useLayoutEffect:function(e,t){return pg(4194308,4,e,t)},useInsertionEffect:function(e,t){return pg(4,2,e,t)},useMemo:function(e,t){var i=Uo();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var o=Uo();return t=i!==void 0?i(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=hR.bind(null,Sn,e),[o.memoizedState,e]},useRef:function(e){var t=Uo();return e={current:e},t.memoizedState=e},useState:$S,useDebugValue:tw,useDeferredValue:function(e){return Uo().memoizedState=e},useTransition:function(){var e=$S(!1),t=e[0];return e=cR.bind(null,e[1]),Uo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var o=Sn,h=Uo();if(yn){if(i===void 0)throw Error(lt(407));i=i()}else{if(i=t(),ti===null)throw Error(lt(349));Vu&30||_C(o,t,i)}h.memoizedState=i;var f={value:i,getSnapshot:t};return h.queue=f,US(xC.bind(null,o,f,e),[e]),o.flags|=2048,Qf(9,vC.bind(null,o,f,i,t),void 0,null),i},useId:function(){var e=Uo(),t=ti.identifierPrefix;if(yn){var i=wa,o=xa;i=(o&~(1<<32-vo(o)-1)).toString(32)+i,t=":"+t+"R"+i,i=Kf++,0")&&(T=T.replace("",e.displayName)),T}while(1<=g&&0<=c);break}}}finally{G0=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?pf(e):""}function HD(e){switch(e.tag){case 5:return pf(e.type);case 16:return pf("Lazy");case 13:return pf("Suspense");case 19:return pf("SuspenseList");case 0:case 2:case 15:return e=Z0(e.type,!1),e;case 11:return e=Z0(e.type.render,!1),e;case 1:return e=Z0(e.type,!0),e;default:return""}}function Wv(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Qc:return"Fragment";case Jc:return"Portal";case Uv:return"Profiler";case Cx:return"StrictMode";case Vv:return"Suspense";case Hv:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pE:return(e.displayName||"Context")+".Consumer";case fE:return(e._context.displayName||"Context")+".Provider";case Ix:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Px:return t=e.displayName||null,t!==null?t:Wv(e.type)||"Memo";case wl:t=e._payload,e=e._init;try{return Wv(e(t))}catch{}}return null}function WD(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wv(t);case 8:return t===Cx?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function jl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function GD(e){var t=gE(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),o=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var h=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return h.call(this)},set:function(g){o=""+g,f.call(this,g)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return o},setValue:function(g){o=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rm(e){e._valueTracker||(e._valueTracker=GD(e))}function yE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),o="";return e&&(o=gE(e)?e.checked?"true":"false":e.value),e=o,e!==i?(t.setValue(e),!0):!1}function Ng(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Gv(e,t){var i=t.checked;return kn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function oS(e,t){var i=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;i=jl(t.value!=null?t.value:i),e._wrapperState={initialChecked:o,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _E(e,t){t=t.checked,t!=null&&Ex(e,"checked",t,!1)}function Zv(e,t){_E(e,t);var i=jl(t.value),o=t.type;if(i!=null)o==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?qv(e,t.type,i):t.hasOwnProperty("defaultValue")&&qv(e,t.type,jl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function aS(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var o=t.type;if(!(o!=="submit"&&o!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function qv(e,t,i){(t!=="number"||Ng(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var mf=Array.isArray;function fh(e,t,i,o){if(e=e.options,t){t={};for(var h=0;h"+t.valueOf().toString()+"",t=Lm.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nf(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var Sf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ZD=["Webkit","ms","Moz","O"];Object.keys(Sf).forEach(function(e){ZD.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Sf[t]=Sf[e]})});function bE(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||Sf.hasOwnProperty(e)&&Sf[e]?(""+t).trim():t+"px"}function SE(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var o=i.indexOf("--")===0,h=bE(i,t[i],o);i==="float"&&(i="cssFloat"),o?e.setProperty(i,h):e[i]=h}}var qD=kn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Kv(e,t){if(t){if(qD[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(lt(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(lt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(lt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(lt(62))}}function Jv(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Qv=null;function Mx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var e1=null,ph=null,mh=null;function cS(e){if(e=gp(e)){if(typeof e1!="function")throw Error(lt(280));var t=e.stateNode;t&&(t=Oy(t),e1(e.stateNode,e.type,t))}}function kE(e){ph?mh?mh.push(e):mh=[e]:ph=e}function TE(){if(ph){var e=ph,t=mh;if(mh=ph=null,cS(e),t)for(e=0;e>>=0,e===0?32:31-(sz(e)/oz|0)|0}var Om=64,Fm=4194304;function gf(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Vg(e,t){var i=e.pendingLanes;if(i===0)return 0;var o=0,h=e.suspendedLanes,f=e.pingedLanes,g=i&268435455;if(g!==0){var c=g&~h;c!==0?o=gf(c):(f&=g,f!==0&&(o=gf(f)))}else g=i&~h,g!==0?o=gf(g):f!==0&&(o=gf(f));if(o===0)return 0;if(t!==0&&t!==o&&!(t&h)&&(h=o&-o,f=t&-t,h>=f||h===16&&(f&4194240)!==0))return t;if(o&4&&(o|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=o;0i;i++)t.push(e);return t}function pp(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vo(t),e[t]=i}function cz(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0=Tf),vS=" ",xS=!1;function WE(e,t){switch(e){case"keyup":return Bz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var eh=!1;function $z(e,t){switch(e){case"compositionend":return GE(t);case"keypress":return t.which!==32?null:(xS=!0,vS);case"textInput":return e=t.data,e===vS&&xS?null:e;default:return null}}function jz(e,t){if(eh)return e==="compositionend"||!Bx&&WE(e,t)?(e=VE(),cg=Lx=Tl=null,eh=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:i,offset:t-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=kS(i)}}function XE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?XE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function KE(){for(var e=window,t=Ng();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Ng(e.document)}return t}function Nx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Xz(e){var t=KE(),i=e.focusedElem,o=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&XE(i.ownerDocument.documentElement,i)){if(o!==null&&Nx(i)){if(t=o.start,e=o.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var h=i.textContent.length,f=Math.min(o.start,h);o=o.end===void 0?f:Math.min(o.end,h),!e.extend&&f>o&&(h=o,o=f,f=h),h=TS(i,f);var g=TS(i,o);h&&g&&(e.rangeCount!==1||e.anchorNode!==h.node||e.anchorOffset!==h.offset||e.focusNode!==g.node||e.focusOffset!==g.offset)&&(t=t.createRange(),t.setStart(h.node,h.offset),e.removeAllRanges(),f>o?(e.addRange(t),e.extend(g.node,g.offset)):(t.setEnd(g.node,g.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i=document.documentMode,th=null,o1=null,Cf=null,a1=!1;function ES(e,t,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;a1||th==null||th!==Ng(o)||(o=th,"selectionStart"in o&&Nx(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Cf&&Wf(Cf,o)||(Cf=o,o=Gg(o1,"onSelect"),0ih||(e.current=f1[ih],f1[ih]=null,ih--)}function en(e,t){ih++,f1[ih]=e.current,e.current=t}var Ul={},Pi=Hl(Ul),cs=Hl(!1),Uu=Ul;function Sh(e,t){var i=e.type.contextTypes;if(!i)return Ul;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var h={},f;for(f in i)h[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=h),h}function hs(e){return e=e.childContextTypes,e!=null}function qg(){cn(cs),cn(Pi)}function zS(e,t,i){if(Pi.current!==Ul)throw Error(lt(168));en(Pi,t),en(cs,i)}function oC(e,t,i){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return i;o=o.getChildContext();for(var h in o)if(!(h in t))throw Error(lt(108,WD(e)||"Unknown",h));return kn({},i,o)}function Yg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ul,Uu=Pi.current,en(Pi,e),en(cs,cs.current),!0}function RS(e,t,i){var o=e.stateNode;if(!o)throw Error(lt(169));i?(e=oC(e,t,Uu),o.__reactInternalMemoizedMergedChildContext=e,cn(cs),cn(Pi),en(Pi,e)):cn(cs),en(cs,i)}var va=null,Fy=!1,av=!1;function aC(e){va===null?va=[e]:va.push(e)}function lR(e){Fy=!0,aC(e)}function Wl(){if(!av&&va!==null){av=!0;var e=0,t=jr;try{var i=va;for(jr=1;e>=g,h-=g,xa=1<<32-vo(t)+h|i<Fe?(Oe=ge,ge=null):Oe=ge.sibling;var Ge=M(O,ge,q[Fe],ne);if(Ge===null){ge===null&&(ge=Oe);break}e&&ge&&Ge.alternate===null&&t(O,ge),$=f(Ge,$,Fe),ke===null?oe=Ge:ke.sibling=Ge,ke=Ge,ge=Oe}if(Fe===q.length)return i(O,ge),yn&&wu(O,Fe),oe;if(ge===null){for(;FeFe?(Oe=ge,ge=null):Oe=ge.sibling;var it=M(O,ge,Ge.value,ne);if(it===null){ge===null&&(ge=Oe);break}e&&ge&&it.alternate===null&&t(O,ge),$=f(it,$,Fe),ke===null?oe=it:ke.sibling=it,ke=it,ge=Oe}if(Ge.done)return i(O,ge),yn&&wu(O,Fe),oe;if(ge===null){for(;!Ge.done;Fe++,Ge=q.next())Ge=A(O,Ge.value,ne),Ge!==null&&($=f(Ge,$,Fe),ke===null?oe=Ge:ke.sibling=Ge,ke=Ge);return yn&&wu(O,Fe),oe}for(ge=o(O,ge);!Ge.done;Fe++,Ge=q.next())Ge=N(ge,O,Fe,Ge.value,ne),Ge!==null&&(e&&Ge.alternate!==null&&ge.delete(Ge.key===null?Fe:Ge.key),$=f(Ge,$,Fe),ke===null?oe=Ge:ke.sibling=Ge,ke=Ge);return e&&ge.forEach(function(ve){return t(O,ve)}),yn&&wu(O,Fe),oe}function te(O,$,q,ne){if(typeof q=="object"&&q!==null&&q.type===Qc&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case zm:e:{for(var oe=q.key,ke=$;ke!==null;){if(ke.key===oe){if(oe=q.type,oe===Qc){if(ke.tag===7){i(O,ke.sibling),$=h(ke,q.props.children),$.return=O,O=$;break e}}else if(ke.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===wl&&FS(oe)===ke.type){i(O,ke.sibling),$=h(ke,q.props),$.ref=lf(O,ke,q),$.return=O,O=$;break e}i(O,ke);break}else t(O,ke);ke=ke.sibling}q.type===Qc?($=Lu(q.props.children,O.mode,ne,q.key),$.return=O,O=$):(ne=_g(q.type,q.key,q.props,null,O.mode,ne),ne.ref=lf(O,$,q),ne.return=O,O=ne)}return g(O);case Jc:e:{for(ke=q.key;$!==null;){if($.key===ke)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){i(O,$.sibling),$=h($,q.children||[]),$.return=O,O=$;break e}else{i(O,$);break}else t(O,$);$=$.sibling}$=mv(q,O.mode,ne),$.return=O,O=$}return g(O);case wl:return ke=q._init,te(O,$,ke(q._payload),ne)}if(mf(q))return Y(O,$,q,ne);if(rf(q))return U(O,$,q,ne);Hm(O,q)}return typeof q=="string"&&q!==""||typeof q=="number"?(q=""+q,$!==null&&$.tag===6?(i(O,$.sibling),$=h($,q),$.return=O,O=$):(i(O,$),$=pv(q,O.mode,ne),$.return=O,O=$),g(O)):i(O,$)}return te}var Th=hC(!0),dC=hC(!1),Jg=Hl(null),Qg=null,ah=null,Vx=null;function Hx(){Vx=ah=Qg=null}function Wx(e){var t=Jg.current;cn(Jg),e._currentValue=t}function g1(e,t,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===i)break;e=e.return}}function yh(e,t){Qg=e,Vx=ah=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function eo(e){var t=e._currentValue;if(Vx!==e)if(e={context:e,memoizedValue:t,next:null},ah===null){if(Qg===null)throw Error(lt(308));ah=e,Qg.dependencies={lanes:0,firstContext:e}}else ah=ah.next=e;return t}var Iu=null;function Gx(e){Iu===null?Iu=[e]:Iu.push(e)}function fC(e,t,i,o){var h=t.interleaved;return h===null?(i.next=i,Gx(t)):(i.next=h.next,h.next=i),t.interleaved=i,Pa(e,o)}function Pa(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var bl=!1;function Zx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pC(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ka(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ol(e,t,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Pr&2){var h=o.pending;return h===null?t.next=t:(t.next=h.next,h.next=t),o.pending=t,Pa(e,i)}return h=o.interleaved,h===null?(t.next=t,Gx(o)):(t.next=h.next,h.next=t),o.interleaved=t,Pa(e,i)}function dg(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,Dx(e,i)}}function BS(e,t){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var h=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var g={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};f===null?h=f=g:f=f.next=g,i=i.next}while(i!==null);f===null?h=f=t:f=f.next=t}else h=f=t;i={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:f,shared:o.shared,effects:o.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function ey(e,t,i,o){var h=e.updateQueue;bl=!1;var f=h.firstBaseUpdate,g=h.lastBaseUpdate,c=h.shared.pending;if(c!==null){h.shared.pending=null;var T=c,P=T.next;T.next=null,g===null?f=P:g.next=P,g=T;var R=e.alternate;R!==null&&(R=R.updateQueue,c=R.lastBaseUpdate,c!==g&&(c===null?R.firstBaseUpdate=P:c.next=P,R.lastBaseUpdate=T))}if(f!==null){var A=h.baseState;g=0,R=P=T=null,c=f;do{var M=c.lane,N=c.eventTime;if((o&M)===M){R!==null&&(R=R.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var Y=e,U=c;switch(M=t,N=i,U.tag){case 1:if(Y=U.payload,typeof Y=="function"){A=Y.call(N,A,M);break e}A=Y;break e;case 3:Y.flags=Y.flags&-65537|128;case 0:if(Y=U.payload,M=typeof Y=="function"?Y.call(N,A,M):Y,M==null)break e;A=kn({},A,M);break e;case 2:bl=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,M=h.effects,M===null?h.effects=[c]:M.push(c))}else N={eventTime:N,lane:M,tag:c.tag,payload:c.payload,callback:c.callback,next:null},R===null?(P=R=N,T=A):R=R.next=N,g|=M;if(c=c.next,c===null){if(c=h.shared.pending,c===null)break;M=c,c=M.next,M.next=null,h.lastBaseUpdate=M,h.shared.pending=null}}while(!0);if(R===null&&(T=A),h.baseState=T,h.firstBaseUpdate=P,h.lastBaseUpdate=R,t=h.shared.interleaved,t!==null){h=t;do g|=h.lane,h=h.next;while(h!==t)}else f===null&&(h.shared.lanes=0);Wu|=g,e.lanes=g,e.memoizedState=A}}function NS(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;ti?i:4,e(!0);var o=uv.transition;uv.transition={};try{e(!1),t()}finally{jr=i,uv.transition=o}}function AC(){return to().memoizedState}function dR(e,t,i){var o=Bl(e);if(i={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null},DC(e))zC(t,i);else if(i=fC(e,t,i,o),i!==null){var h=Hi();xo(i,e,o,h),RC(i,t,o)}}function fR(e,t,i){var o=Bl(e),h={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null};if(DC(e))zC(t,h);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,c=f(g,i);if(h.hasEagerState=!0,h.eagerState=c,So(c,g)){var T=t.interleaved;T===null?(h.next=h,Gx(t)):(h.next=T.next,T.next=h),t.interleaved=h;return}}catch{}finally{}i=fC(e,t,h,o),i!==null&&(h=Hi(),xo(i,e,o,h),RC(i,t,o))}}function DC(e){var t=e.alternate;return e===Sn||t!==null&&t===Sn}function zC(e,t){If=ry=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function RC(e,t,i){if(i&4194240){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,Dx(e,i)}}var ny={readContext:eo,useCallback:ki,useContext:ki,useEffect:ki,useImperativeHandle:ki,useInsertionEffect:ki,useLayoutEffect:ki,useMemo:ki,useReducer:ki,useRef:ki,useState:ki,useDebugValue:ki,useDeferredValue:ki,useTransition:ki,useMutableSource:ki,useSyncExternalStore:ki,useId:ki,unstable_isNewReconciler:!1},pR={readContext:eo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:eo,useEffect:jS,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,pg(4194308,4,EC.bind(null,t,e),i)},useLayoutEffect:function(e,t){return pg(4194308,4,e,t)},useInsertionEffect:function(e,t){return pg(4,2,e,t)},useMemo:function(e,t){var i=jo();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var o=jo();return t=i!==void 0?i(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=dR.bind(null,Sn,e),[o.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:$S,useDebugValue:tw,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=$S(!1),t=e[0];return e=hR.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var o=Sn,h=jo();if(yn){if(i===void 0)throw Error(lt(407));i=i()}else{if(i=t(),ti===null)throw Error(lt(349));Hu&30||_C(o,t,i)}h.memoizedState=i;var f={value:i,getSnapshot:t};return h.queue=f,jS(xC.bind(null,o,f,e),[e]),o.flags|=2048,Qf(9,vC.bind(null,o,f,i,t),void 0,null),i},useId:function(){var e=jo(),t=ti.identifierPrefix;if(yn){var i=wa,o=xa;i=(o&~(1<<32-vo(o)-1)).toString(32)+i,t=":"+t+"R"+i,i=Kf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=g.createElement(i,{is:o.is}):(e=g.createElement(i),i==="select"&&(g=e,o.multiple?g.multiple=!0:o.size&&(g.size=o.size))):e=g.createElementNS(e,i),e[Vo]=t,e[qf]=o,HC(e,t,!1,!1),t.stateNode=e;e:{switch(g=Jv(i,o),i){case"dialog":sn("cancel",e),sn("close",e),h=o;break;case"iframe":case"object":case"embed":sn("load",e),h=o;break;case"video":case"audio":for(h=0;hIh&&(t.flags|=128,o=!0,uf(f,!1),t.lanes=4194304)}else{if(!o)if(e=ty(g),e!==null){if(t.flags|=128,o=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),uf(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!yn)return Ti(t),null}else 2*An()-f.renderingStartTime>Ih&&i!==1073741824&&(t.flags|=128,o=!0,uf(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(i=f.last,i!==null?i.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=An(),t.sibling=null,i=bn.current,en(bn,o?i&1|2:i&1),t):(Ti(t),null);case 22:case 23:return aw(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?Ms&1073741824&&(Ti(t),t.subtreeFlags&6&&(t.flags|=8192)):Ti(t),null;case 24:return null;case 25:return null}throw Error(lt(156,t.tag))}function wR(e,t){switch(Ux(t),t.tag){case 1:return hs(t.type)&&qg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eh(),cn(cs),cn(Pi),Xx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yx(t),null;case 13:if(cn(bn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(lt(340));kh()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cn(bn),null;case 4:return Eh(),null;case 10:return Wx(t.type._context),null;case 22:case 23:return aw(),null;case 24:return null;default:return null}}var Gm=!1,Ci=!1,bR=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function ah(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(o){In(e,t,o)}else i.current=null}function T1(e,t,i){try{i()}catch(o){In(e,t,o)}}var JS=!1;function SR(e,t){if(l1=Hg,e=KE(),Nx(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var h=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var g=0,c=-1,T=-1,P=0,R=0,A=e,M=null;t:for(;;){for(var N;A!==i||h!==0&&A.nodeType!==3||(c=g+h),A!==f||o!==0&&A.nodeType!==3||(T=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(N=A.firstChild)!==null;)M=A,A=N;for(;;){if(A===e)break t;if(M===i&&++P===h&&(c=g),M===f&&++R===o&&(T=g),(N=A.nextSibling)!==null)break;A=M,M=A.parentNode}A=N}i=c===-1||T===-1?null:{start:c,end:T}}else i=null}i=i||{start:0,end:0}}else i=null;for(u1={focusedElem:e,selectionRange:i},Hg=!1,Lt=t;Lt!==null;)if(t=Lt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Lt=e;else for(;Lt!==null;){t=Lt;try{var Y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Y!==null){var j=Y.memoizedProps,te=Y.memoizedState,O=t.stateNode,$=O.getSnapshotBeforeUpdate(t.elementType===t.type?j:po(t.type,j),te);O.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var q=t.stateNode.containerInfo;q.nodeType===1?q.textContent="":q.nodeType===9&&q.documentElement&&q.removeChild(q.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(lt(163))}}catch(ne){In(t,t.return,ne)}if(e=t.sibling,e!==null){e.return=t.return,Lt=e;break}Lt=t.return}return Y=JS,JS=!1,Y}function Pf(e,t,i){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var h=o=o.next;do{if((h.tag&e)===e){var f=h.destroy;h.destroy=void 0,f!==void 0&&T1(t,i,f)}h=h.next}while(h!==o)}}function $y(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var o=i.create;i.destroy=o()}i=i.next}while(i!==t)}}function E1(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function ZC(e){var t=e.alternate;t!==null&&(e.alternate=null,ZC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vo],delete t[qf],delete t[d1],delete t[sR],delete t[oR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qC(e){return e.tag===5||e.tag===3||e.tag===4}function QS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function C1(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Zg));else if(o!==4&&(e=e.child,e!==null))for(C1(e,t,i),e=e.sibling;e!==null;)C1(e,t,i),e=e.sibling}function I1(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(I1(e,t,i),e=e.sibling;e!==null;)I1(e,t,i),e=e.sibling}var li=null,go=!1;function yl(e,t,i){for(i=i.child;i!==null;)YC(e,t,i),i=i.sibling}function YC(e,t,i){if(Wo&&typeof Wo.onCommitFiberUnmount=="function")try{Wo.onCommitFiberUnmount(Dy,i)}catch{}switch(i.tag){case 5:Ci||ah(i,t);case 6:var o=li,h=go;li=null,yl(e,t,i),li=o,go=h,li!==null&&(go?(e=li,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):li.removeChild(i.stateNode));break;case 18:li!==null&&(go?(e=li,i=i.stateNode,e.nodeType===8?ov(e.parentNode,i):e.nodeType===1&&ov(e,i),Vf(e)):ov(li,i.stateNode));break;case 4:o=li,h=go,li=i.stateNode.containerInfo,go=!0,yl(e,t,i),li=o,go=h;break;case 0:case 11:case 14:case 15:if(!Ci&&(o=i.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){h=o=o.next;do{var f=h,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&T1(i,t,g),h=h.next}while(h!==o)}yl(e,t,i);break;case 1:if(!Ci&&(ah(i,t),o=i.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=i.memoizedProps,o.state=i.memoizedState,o.componentWillUnmount()}catch(c){In(i,t,c)}yl(e,t,i);break;case 21:yl(e,t,i);break;case 22:i.mode&1?(Ci=(o=Ci)||i.memoizedState!==null,yl(e,t,i),Ci=o):yl(e,t,i);break;default:yl(e,t,i)}}function ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new bR),t.forEach(function(o){var h=DR.bind(null,e,o);i.has(o)||(i.add(o),o.then(h,h))})}}function fo(e,t){var i=t.deletions;if(i!==null)for(var o=0;oh&&(h=g),o&=~f}if(o=h,o=An()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*TR(o/1960))-o,10e?16:e,El===null)var o=!1;else{if(e=El,El=null,oy=0,Pr&6)throw Error(lt(331));var h=Pr;for(Pr|=4,Lt=e.current;Lt!==null;){var f=Lt,g=f.child;if(Lt.flags&16){var c=f.deletions;if(c!==null){for(var T=0;TAn()-sw?Ru(e,0):iw|=i),ds(e,t)}function nI(e,t){t===0&&(e.mode&1?(t=Fm,Fm<<=1,!(Fm&130023424)&&(Fm=4194304)):t=1);var i=Hi();e=Pa(e,t),e!==null&&(pp(e,t,i),ds(e,i))}function AR(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),nI(e,i)}function DR(e,t){var i=0;switch(e.tag){case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(i=h.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(lt(314))}o!==null&&o.delete(t),nI(e,i)}var iI;iI=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||cs.current)ls=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return ls=!1,vR(e,t,i);ls=!!(e.flags&131072)}else ls=!1,yn&&t.flags&1048576&&lC(t,Kg,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;mg(e,t),e=t.pendingProps;var h=Sh(t,Pi.current);gh(t,i),h=Jx(null,t,o,e,h,i);var f=Qx();return t.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,hs(o)?(f=!0,Yg(t)):f=!1,t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,Zx(t),h.updater=Ny,t.stateNode=h,h._reactInternals=t,_1(t,o,e,i),t=w1(null,t,o,!0,f,i)):(t.tag=0,yn&&f&&$x(t),Ni(null,t,h,i),t=t.child),t;case 16:o=t.elementType;e:{switch(mg(e,t),e=t.pendingProps,h=o._init,o=h(o._payload),t.type=o,h=t.tag=RR(o),e=po(o,e),h){case 0:t=x1(null,t,o,e,i);break e;case 1:t=YS(null,t,o,e,i);break e;case 11:t=ZS(null,t,o,e,i);break e;case 14:t=qS(null,t,o,po(o.type,e),i);break e}throw Error(lt(306,o,""))}return t;case 0:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),x1(e,t,o,h,i);case 1:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),YS(e,t,o,h,i);case 3:e:{if(UC(t),e===null)throw Error(lt(387));o=t.pendingProps,f=t.memoizedState,h=f.element,pC(e,t),ey(t,o,null,i);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){h=Ch(Error(lt(423)),t),t=XS(e,t,o,i,h);break e}else if(o!==h){h=Ch(Error(lt(424)),t),t=XS(e,t,o,i,h);break e}else for(Ls=Ll(t.stateNode.containerInfo.firstChild),Os=t,yn=!0,yo=null,i=dC(t,null,o,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(kh(),o===h){t=Ma(e,t,i);break e}Ni(e,t,o,i)}t=t.child}return t;case 5:return mC(t),e===null&&m1(t),o=t.type,h=t.pendingProps,f=e!==null?e.memoizedProps:null,g=h.children,c1(o,h)?g=null:f!==null&&c1(o,f)&&(t.flags|=32),$C(e,t),Ni(e,t,g,i),t.child;case 6:return e===null&&m1(t),null;case 13:return jC(e,t,i);case 4:return qx(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Th(t,null,o,i):Ni(e,t,o,i),t.child;case 11:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),ZS(e,t,o,h,i);case 7:return Ni(e,t,t.pendingProps,i),t.child;case 8:return Ni(e,t,t.pendingProps.children,i),t.child;case 12:return Ni(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(o=t.type._context,h=t.pendingProps,f=t.memoizedProps,g=h.value,en(Jg,o._currentValue),o._currentValue=g,f!==null)if(So(f.value,g)){if(f.children===h.children&&!cs.current){t=Ma(e,t,i);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var c=f.dependencies;if(c!==null){g=f.child;for(var T=c.firstContext;T!==null;){if(T.context===o){if(f.tag===1){T=ka(-1,i&-i),T.tag=2;var P=f.updateQueue;if(P!==null){P=P.shared;var R=P.pending;R===null?T.next=T:(T.next=R.next,R.next=T),P.pending=T}}f.lanes|=i,T=f.alternate,T!==null&&(T.lanes|=i),g1(f.return,i,t),c.lanes|=i;break}T=T.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(lt(341));g.lanes|=i,c=g.alternate,c!==null&&(c.lanes|=i),g1(g,i,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ni(e,t,h.children,i),t=t.child}return t;case 9:return h=t.type,o=t.pendingProps.children,gh(t,i),h=eo(h),o=o(h),t.flags|=1,Ni(e,t,o,i),t.child;case 14:return o=t.type,h=po(o,t.pendingProps),h=po(o.type,h),qS(e,t,o,h,i);case 15:return BC(e,t,t.type,t.pendingProps,i);case 17:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),mg(e,t),t.tag=1,hs(o)?(e=!0,Yg(t)):e=!1,gh(t,i),LC(t,o,h),_1(t,o,h,i),w1(null,t,o,!0,e,i);case 19:return VC(e,t,i);case 22:return NC(e,t,i)}throw Error(lt(156,t.tag))};function sI(e,t){return DE(e,t)}function zR(e,t,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Js(e,t,i,o){return new zR(e,t,i,o)}function uw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function RR(e){if(typeof e=="function")return uw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ix)return 11;if(e===Px)return 14}return 2}function Nl(e,t){var i=e.alternate;return i===null?(i=Js(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function _g(e,t,i,o,h,f){var g=2;if(o=e,typeof e=="function")uw(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Jc:return Lu(i.children,h,f,t);case Cx:g=8,h|=8;break;case jv:return e=Js(12,i,t,h|2),e.elementType=jv,e.lanes=f,e;case Vv:return e=Js(13,i,t,h),e.elementType=Vv,e.lanes=f,e;case Hv:return e=Js(19,i,t,h),e.elementType=Hv,e.lanes=f,e;case mE:return jy(i,h,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fE:g=10;break e;case pE:g=9;break e;case Ix:g=11;break e;case Px:g=14;break e;case wl:g=16,o=null;break e}throw Error(lt(130,e==null?e:typeof e,""))}return t=Js(g,i,t,h),t.elementType=e,t.type=o,t.lanes=f,t}function Lu(e,t,i,o){return e=Js(7,e,o,t),e.lanes=i,e}function jy(e,t,i,o){return e=Js(22,e,o,t),e.elementType=mE,e.lanes=i,e.stateNode={isHidden:!1},e}function pv(e,t,i){return e=Js(6,e,null,t),e.lanes=i,e}function mv(e,t,i){return t=Js(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function LR(e,t,i,o,h){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Y0(0),this.expirationTimes=Y0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Y0(0),this.identifierPrefix=o,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function cw(e,t,i,o,h,f,g,c,T){return e=new LR(e,t,i,c,T),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Js(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zx(f),e}function OR(e,t,i){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uI)}catch(e){console.error(e)}}uI(),uE.exports=Bs;var cI=uE.exports,lk=cI;$v.createRoot=lk.createRoot,$v.hydrateRoot=lk.hydrateRoot;const UR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='80'%20height='48'%20viewBox='0%200%2080%2048'%3e%3cg%20fill='%23D73F3F'%20fill-rule='evenodd'%3e%3cpath%20d='M37.02656,20.77496%20C37.02656,20.29096%2037.12976,19.85896%2037.33616,19.48616%20C37.54096,19.11176%2037.81296,18.80696%2038.15056,18.56376%20C38.48656,18.32136%2038.86496,18.13736%2039.28576,18.01336%20C39.70496,17.89016%2040.12736,17.82776%2040.55376,17.82776%20C40.97856,17.82776%2041.40256,17.89016%2041.82336,18.01336%20C42.24176,18.13736%2042.62016,18.32136%2042.95616,18.56376%20C43.29456,18.80696%2043.56576,19.11176%2043.77216,19.48616%20C43.97856,19.85896%2044.08096,20.29096%2044.08096,20.77496%20L44.08096,27.14696%20C44.08096,27.64136%2043.97856,28.07496%2043.77216,28.44216%20C43.56576,28.81096%2043.29456,29.11416%2042.95616,29.35736%20C42.62016,29.60136%2042.24176,29.78616%2041.82336,29.90856%20C41.40256,30.03176%2040.97856,30.09336%2040.55376,30.09336%20C40.12736,30.09336%2039.70496,30.03176%2039.28576,29.90856%20C38.86496,29.78616%2038.48656,29.60136%2038.15056,29.35736%20C37.81296,29.11416%2037.54096,28.81096%2037.33616,28.44216%20C37.12976,28.07496%2037.02656,27.64136%2037.02656,27.14696%20L37.02656,20.77496%20Z%20M39.05136,27.15016%20C39.05136,27.56536%2039.28256,27.87496%2039.56576,28.07176%20C39.84736,28.27016%2040.18096,28.37496%2040.56576,28.37496%20C40.94896,28.37496%2041.28416,28.27016%2041.56656,28.07176%20C41.84736,27.87496%2042.00816,27.56536%2042.00816,27.15016%20L42.00816,20.77816%20C42.00816,20.36136%2041.84736,20.05256%2041.56656,19.85576%20C41.28416,19.65816%2040.94896,19.52536%2040.56576,19.52536%20C40.18096,19.52536%2039.84736,19.65816%2039.56576,19.85576%20C39.28256,20.05256%2039.05136,20.36136%2039.05136,20.77816%20L39.05136,27.15016%20Z'/%3e%3cpolygon%20points='33.379%2017.815%2033.379%2022.99%2030.152%2022.99%2030.152%2017.815%2028.387%2017.815%2028.387%2030.1%2030.152%2030.1%2030.152%2024.923%2033.379%2024.923%2033.379%2030.1%2035.278%2030.1%2035.278%2017.815'/%3e%3cpolygon%20points='52.431%2017.815%2045.426%2017.815%2045.426%2019.622%2048.015%2019.622%2047.985%2030.1%2049.847%2030.1%2049.847%2019.622%2052.431%2019.622'/%3e%3cpath%20d='M65.42344,28.7668%20L79.67944,28.7668%20L71.15544,19.1684%20L62.66904,9.57%20L54.18104,0.000400000001%20L11.53944,0.000400000001%20L20.02584,9.57%20L5.73784,9.57%20L14.22584,19.1684%20L14.29144,19.2332%20L0.000239999999,19.2332%20L8.52184,28.8316%20L17.01304,38.43%20L25.50024,48.0004%20L68.14184,48.0004%20L59.65064,38.43%20L59.58824,38.3364%20L73.87864,38.3364%20L65.42344,28.7668%20Z%20M39.83944,39.9492%20C30.31864,39.9492%2022.60104,32.8084%2022.60104,24.0012%20C22.60104,15.1908%2030.31864,8.05%2039.83944,8.05%20C49.36104,8.05%2057.07944,15.1908%2057.07944,24.0012%20C57.07944,32.8084%2049.36104,39.9492%2039.83944,39.9492%20Z'/%3e%3c/g%3e%3c/svg%3e";var us=function(){return us=Object.assign||function(t){for(var i,o=1,h=arguments.length;o0?ei($h,--ro):0,Mh--,On===10&&(Mh=1,qy--),On}function wo(){return On=ro2||R1(On)>3?"":" "}function KR(e,t){for(;--t&&wo()&&!(On<48||On>102||On>57&&On<65||On>70&&On<97););return Xy(e,xg()+(t<6&&Ou()==32&&wo()==32))}function L1(e){for(;wo();)switch(On){case e:return ro;case 34:case 39:e!==34&&e!==39&&L1(On);break;case 40:e===41&&L1(e);break;case 92:wo();break}return ro}function JR(e,t){for(;wo()&&e+On!==57;)if(e+On===84&&Ou()===47)break;return"/*"+Xy(t,ro-1)+"*"+mw(e===47?e:wo())}function QR(e){for(;!R1(Ou());)wo();return Xy(e,ro)}function e5(e){return YR(wg("",null,null,null,[""],e=qR(e),0,[0],e))}function wg(e,t,i,o,h,f,g,c,T){for(var P=0,R=0,A=g,M=0,N=0,Y=0,j=1,te=1,O=1,$=0,q="",ne=h,oe=f,ke=o,ge=q;te;)switch(Y=$,$=wo()){case 40:if(Y!=108&&ei(ge,A-1)==58){vg(ge+=hr(gv($),"&","&\f"),"&\f",fI(P?c[P-1]:0))!=-1&&(O=-1);break}case 34:case 39:case 91:ge+=gv($);break;case 9:case 10:case 13:case 32:ge+=XR(Y);break;case 92:ge+=KR(xg()-1,7);continue;case 47:switch(Ou()){case 42:case 47:_f(t5(JR(wo(),xg()),t,i,T),T);break;default:ge+="/"}break;case 123*j:c[P++]=jo(ge)*O;case 125*j:case 59:case 0:switch($){case 0:case 125:te=0;case 59+R:O==-1&&(ge=hr(ge,/\f/g,"")),N>0&&jo(ge)-A&&_f(N>32?hk(ge+";",o,i,A-1,T):hk(hr(ge," ","")+";",o,i,A-2,T),T);break;case 59:ge+=";";default:if(_f(ke=ck(ge,t,i,P,R,h,c,q,ne=[],oe=[],A,f),f),$===123)if(R===0)wg(ge,t,ke,ke,ne,f,A,c,oe);else switch(M===99&&ei(ge,3)===110?100:M){case 100:case 108:case 109:case 115:wg(e,ke,ke,o&&_f(ck(e,ke,ke,0,0,h,c,q,h,ne=[],A,oe),oe),h,oe,A,c,o?ne:oe);break;default:wg(ge,ke,ke,ke,[""],oe,0,c,oe)}}P=R=N=0,j=O=1,q=ge="",A=g;break;case 58:A=1+jo(ge),N=Y;default:if(j<1){if($==123)--j;else if($==125&&j++==0&&ZR()==125)continue}switch(ge+=mw($),$*j){case 38:O=R>0?1:(ge+="\f",-1);break;case 44:c[P++]=(jo(ge)-1)*O,O=1;break;case 64:Ou()===45&&(ge+=gv(wo())),M=Ou(),R=A=jo(q=ge+=QR(xg())),$++;break;case 45:Y===45&&jo(ge)==2&&(j=0)}}return f}function ck(e,t,i,o,h,f,g,c,T,P,R,A){for(var M=h-1,N=h===0?f:[""],Y=mI(N),j=0,te=0,O=0;j0?N[$]+" "+q:hr(q,/&\f/g,N[$])))&&(T[O++]=ne);return Yy(e,t,i,h===0?Zy:c,T,P,R,A)}function t5(e,t,i,o){return Yy(e,t,i,hI,mw(GR()),Ph(e,2,-2),0,o)}function hk(e,t,i,o,h){return Yy(e,t,i,pw,Ph(e,0,o),Ph(e,o+1,-1),o,h)}function yI(e,t,i){switch(HR(e,t)){case 5103:return Br+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Br+e+e;case 4789:return Df+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Br+e+Df+e+on+e+e;case 5936:switch(ei(e,t+11)){case 114:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Br+e+on+e+e;case 6165:return Br+e+on+"flex-"+e+e;case 5187:return Br+e+hr(e,/(\w+).+(:[^]+)/,Br+"box-$1$2"+on+"flex-$1$2")+e;case 5443:return Br+e+on+"flex-item-"+hr(e,/flex-|-self/g,"")+(ya(e,/flex-|baseline/)?"":on+"grid-row-"+hr(e,/flex-|-self/g,""))+e;case 4675:return Br+e+on+"flex-line-pack"+hr(e,/align-content|flex-|-self/g,"")+e;case 5548:return Br+e+on+hr(e,"shrink","negative")+e;case 5292:return Br+e+on+hr(e,"basis","preferred-size")+e;case 6060:return Br+"box-"+hr(e,"-grow","")+Br+e+on+hr(e,"grow","positive")+e;case 4554:return Br+hr(e,/([^-])(transform)/g,"$1"+Br+"$2")+e;case 6187:return hr(hr(hr(e,/(zoom-|grab)/,Br+"$1"),/(image-set)/,Br+"$1"),e,"")+e;case 5495:case 3959:return hr(e,/(image-set\([^]*)/,Br+"$1$`$1");case 4968:return hr(hr(e,/(.+:)(flex-)?(.*)/,Br+"box-pack:$3"+on+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Br+e+e;case 4200:if(!ya(e,/flex-|baseline/))return on+"grid-column-align"+Ph(e,t)+e;break;case 2592:case 3360:return on+hr(e,"template-","")+e;case 4384:case 3616:return i&&i.some(function(o,h){return t=h,ya(o.props,/grid-\w+-end/)})?~vg(e+(i=i[t].value),"span",0)?e:on+hr(e,"-start","")+e+on+"grid-row-span:"+(~vg(i,"span",0)?ya(i,/\d+/):+ya(i,/\d+/)-+ya(e,/\d+/))+";":on+hr(e,"-start","")+e;case 4896:case 4128:return i&&i.some(function(o){return ya(o.props,/grid-\w+-start/)})?e:on+hr(hr(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return hr(e,/(.+)-inline(.+)/,Br+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(jo(e)-1-t>6)switch(ei(e,t+1)){case 109:if(ei(e,t+4)!==45)break;case 102:return hr(e,/(.+:)(.+)-([^]+)/,"$1"+Br+"$2-$3$1"+Df+(ei(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~vg(e,"stretch",0)?yI(hr(e,"stretch","fill-available"),t,i)+e:e}break;case 5152:case 5920:return hr(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,h,f,g,c,T,P){return on+h+":"+f+P+(g?on+h+"-span:"+(c?T:+T-+f)+P:"")+e});case 4949:if(ei(e,t+6)===121)return hr(e,":",":"+Br)+e;break;case 6444:switch(ei(e,ei(e,14)===45?18:11)){case 120:return hr(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Br+(ei(e,14)===45?"inline-":"")+"box$3$1"+Br+"$2$3$1"+on+"$2box$3")+e;case 100:return hr(e,":",":"+on)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return hr(e,"scroll-","scroll-snap-")+e}return e}function cy(e,t){for(var i="",o=0;o-1&&!e.return)switch(e.type){case pw:e.return=yI(e.value,e.length,i);return;case dI:return cy([_l(e,{value:hr(e.value,"@","@"+Br)})],o);case Zy:if(e.length)return WR(i=e.props,function(h){switch(ya(h,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Zc(_l(e,{props:[hr(h,/:(read-\w+)/,":"+Df+"$1")]})),Zc(_l(e,{props:[h]})),z1(e,{props:uk(i,o)});break;case"::placeholder":Zc(_l(e,{props:[hr(h,/:(plac\w+)/,":"+Br+"input-$1")]})),Zc(_l(e,{props:[hr(h,/:(plac\w+)/,":"+Df+"$1")]})),Zc(_l(e,{props:[hr(h,/:(plac\w+)/,on+"input-$1")]})),Zc(_l(e,{props:[h]})),z1(e,{props:uk(i,o)});break}return""})}}var o5={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ps={},Ah=typeof process<"u"&&Ps!==void 0&&(Ps.REACT_APP_SC_ATTR||Ps.SC_ATTR)||"data-styled",_I="active",vI="data-styled-version",Ky="6.1.13",gw=`/*!sc*/ -`,hy=typeof window<"u"&&"HTMLElement"in window,a5=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==""?Ps.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Ps.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.SC_DISABLE_SPEEDY!==void 0&&Ps.SC_DISABLE_SPEEDY!==""&&Ps.SC_DISABLE_SPEEDY!=="false"&&Ps.SC_DISABLE_SPEEDY),Jy=Object.freeze([]),Dh=Object.freeze({});function l5(e,t,i){return i===void 0&&(i=Dh),e.theme!==i.theme&&e.theme||t||i.theme}var xI=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),u5=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,c5=/(^-|-$)/g;function dk(e){return e.replace(u5,"-").replace(c5,"")}var h5=/(a)(d)/gi,Ym=52,fk=function(e){return String.fromCharCode(e+(e>25?39:97))};function O1(e){var t,i="";for(t=Math.abs(e);t>Ym;t=t/Ym|0)i=fk(t%Ym)+i;return(fk(t%Ym)+i).replace(h5,"$1-$2")}var yv,wI=5381,uh=function(e,t){for(var i=t.length;i;)e=33*e^t.charCodeAt(--i);return e},bI=function(e){return uh(wI,e)};function d5(e){return O1(bI(e)>>>0)}function f5(e){return e.displayName||e.name||"Component"}function _v(e){return typeof e=="string"&&!0}var SI=typeof Symbol=="function"&&Symbol.for,kI=SI?Symbol.for("react.memo"):60115,p5=SI?Symbol.for("react.forward_ref"):60112,m5={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},g5={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},TI={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},y5=((yv={})[p5]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},yv[kI]=TI,yv);function pk(e){return("type"in(t=e)&&t.type.$$typeof)===kI?TI:"$$typeof"in e?y5[e.$$typeof]:m5;var t}var _5=Object.defineProperty,v5=Object.getOwnPropertyNames,mk=Object.getOwnPropertySymbols,x5=Object.getOwnPropertyDescriptor,w5=Object.getPrototypeOf,gk=Object.prototype;function EI(e,t,i){if(typeof t!="string"){if(gk){var o=w5(t);o&&o!==gk&&EI(e,o,i)}var h=v5(t);mk&&(h=h.concat(mk(t)));for(var f=pk(e),g=pk(t),c=0;c0?" Args: ".concat(t.join(", ")):""))}var b5=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var i=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,h=o.length,f=h;t>=f;)if((f<<=1)<0)throw _p(16,"".concat(t));this.groupSizes=new Uint32Array(f),this.groupSizes.set(o),this.length=f;for(var g=h;g=this.length||this.groupSizes[t]===0)return i;for(var o=this.groupSizes[t],h=this.indexOfGroup(t),f=h+o,g=h;g=0){var o=document.createTextNode(i);return this.element.insertBefore(o,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t0&&(te+="".concat(O,","))}),T+="".concat(Y).concat(j,'{content:"').concat(te,'"}').concat(gw)},R=0;R0?".".concat(t):M},R=T.slice();R.push(function(M){M.type===Zy&&M.value.includes("&")&&(M.props[0]=M.props[0].replace(z5,i).replace(o,P))}),g.prefix&&R.push(s5),R.push(r5);var A=function(M,N,Y,j){N===void 0&&(N=""),Y===void 0&&(Y=""),j===void 0&&(j="&"),t=j,i=N,o=new RegExp("\\".concat(i,"\\b"),"g");var te=M.replace(R5,""),O=e5(Y||N?"".concat(Y," ").concat(N," { ").concat(te," }"):te);g.namespace&&(O=PI(O,g.namespace));var $=[];return cy(O,n5(R.concat(i5(function(q){return $.push(q)})))),$};return A.hash=T.length?T.reduce(function(M,N){return N.name||_p(15),uh(M,N.name)},wI).toString():"",A}var O5=new II,B1=L5(),MI=wh.createContext({shouldForwardProp:void 0,styleSheet:O5,stylis:B1});MI.Consumer;wh.createContext(void 0);function xk(){return Ht.useContext(MI)}var F5=function(){function e(t,i){var o=this;this.inject=function(h,f){f===void 0&&(f=B1);var g=o.name+f.hash;h.hasNameForId(o.id,g)||h.insertRules(o.id,g,f(o.rules,g,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=i,_w(this,function(){throw _p(12,String(o.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=B1),this.name+t.hash},e}(),B5=function(e){return e>="A"&&e<="Z"};function wk(e){for(var t="",i=0;i>>0);if(!i.hasNameForId(this.componentId,g)){var c=o(f,".".concat(g),void 0,this.componentId);i.insertRules(this.componentId,g,c)}h=Mu(h,g),this.staticRulesId=g}else{for(var T=uh(this.baseHash,o.hash),P="",R=0;R>>0);i.hasNameForId(this.componentId,N)||i.insertRules(this.componentId,N,o(P,".".concat(N),void 0,this.componentId)),h=Mu(h,N)}}return h},e}(),zI=wh.createContext(void 0);zI.Consumer;var vv={};function j5(e,t,i){var o=yw(e),h=e,f=!_v(e),g=t.attrs,c=g===void 0?Jy:g,T=t.componentId,P=T===void 0?function(ne,oe){var ke=typeof ne!="string"?"sc":dk(ne);vv[ke]=(vv[ke]||0)+1;var ge="".concat(ke,"-").concat(d5(Ky+ke+vv[ke]));return oe?"".concat(oe,"-").concat(ge):ge}(t.displayName,t.parentComponentId):T,R=t.displayName,A=R===void 0?function(ne){return _v(ne)?"styled.".concat(ne):"Styled(".concat(f5(ne),")")}(e):R,M=t.displayName&&t.componentId?"".concat(dk(t.displayName),"-").concat(t.componentId):t.componentId||P,N=o&&h.attrs?h.attrs.concat(c).filter(Boolean):c,Y=t.shouldForwardProp;if(o&&h.shouldForwardProp){var j=h.shouldForwardProp;if(t.shouldForwardProp){var te=t.shouldForwardProp;Y=function(ne,oe){return j(ne,oe)&&te(ne,oe)}}else Y=j}var O=new U5(i,M,o?h.componentStyle:void 0);function $(ne,oe){return function(ke,ge,Fe){var Oe=ke.attrs,We=ke.componentStyle,it=ke.defaultProps,ve=ke.foldedComponentIds,Ue=ke.styledComponentId,H=ke.target,Re=wh.useContext(zI),vt=xk(),ye=ke.shouldForwardProp||vt.shouldForwardProp,Be=l5(ge,Re,it)||Dh,Le=function(rt,Jt,er){for(var Vt,Yt=us(us({},Jt),{className:void 0,theme:er}),_r=0;_r<\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=g.createElement(i,{is:o.is}):(e=g.createElement(i),i==="select"&&(g=e,o.multiple?g.multiple=!0:o.size&&(g.size=o.size))):e=g.createElementNS(e,i),e[Vo]=t,e[qf]=o,HC(e,t,!1,!1),t.stateNode=e;e:{switch(g=Jv(i,o),i){case"dialog":sn("cancel",e),sn("close",e),h=o;break;case"iframe":case"object":case"embed":sn("load",e),h=o;break;case"video":case"audio":for(h=0;hIh&&(t.flags|=128,o=!0,uf(f,!1),t.lanes=4194304)}else{if(!o)if(e=ty(g),e!==null){if(t.flags|=128,o=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),uf(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!yn)return Ti(t),null}else 2*An()-f.renderingStartTime>Ih&&i!==1073741824&&(t.flags|=128,o=!0,uf(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(i=f.last,i!==null?i.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=An(),t.sibling=null,i=bn.current,en(bn,o?i&1|2:i&1),t):(Ti(t),null);case 22:case 23:return aw(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?Ms&1073741824&&(Ti(t),t.subtreeFlags&6&&(t.flags|=8192)):Ti(t),null;case 24:return null;case 25:return null}throw Error(lt(156,t.tag))}function bR(e,t){switch(jx(t),t.tag){case 1:return hs(t.type)&&qg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eh(),cn(cs),cn(Pi),Xx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yx(t),null;case 13:if(cn(bn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(lt(340));kh()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cn(bn),null;case 4:return Eh(),null;case 10:return Wx(t.type._context),null;case 22:case 23:return aw(),null;case 24:return null;default:return null}}var Gm=!1,Ci=!1,SR=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function lh(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(o){In(e,t,o)}else i.current=null}function T1(e,t,i){try{i()}catch(o){In(e,t,o)}}var JS=!1;function kR(e,t){if(l1=Hg,e=KE(),Nx(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var h=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var g=0,c=-1,T=-1,P=0,R=0,A=e,M=null;t:for(;;){for(var N;A!==i||h!==0&&A.nodeType!==3||(c=g+h),A!==f||o!==0&&A.nodeType!==3||(T=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(N=A.firstChild)!==null;)M=A,A=N;for(;;){if(A===e)break t;if(M===i&&++P===h&&(c=g),M===f&&++R===o&&(T=g),(N=A.nextSibling)!==null)break;A=M,M=A.parentNode}A=N}i=c===-1||T===-1?null:{start:c,end:T}}else i=null}i=i||{start:0,end:0}}else i=null;for(u1={focusedElem:e,selectionRange:i},Hg=!1,Lt=t;Lt!==null;)if(t=Lt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Lt=e;else for(;Lt!==null;){t=Lt;try{var Y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Y!==null){var U=Y.memoizedProps,te=Y.memoizedState,O=t.stateNode,$=O.getSnapshotBeforeUpdate(t.elementType===t.type?U:po(t.type,U),te);O.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var q=t.stateNode.containerInfo;q.nodeType===1?q.textContent="":q.nodeType===9&&q.documentElement&&q.removeChild(q.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(lt(163))}}catch(ne){In(t,t.return,ne)}if(e=t.sibling,e!==null){e.return=t.return,Lt=e;break}Lt=t.return}return Y=JS,JS=!1,Y}function Pf(e,t,i){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var h=o=o.next;do{if((h.tag&e)===e){var f=h.destroy;h.destroy=void 0,f!==void 0&&T1(t,i,f)}h=h.next}while(h!==o)}}function $y(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var o=i.create;i.destroy=o()}i=i.next}while(i!==t)}}function E1(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function ZC(e){var t=e.alternate;t!==null&&(e.alternate=null,ZC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vo],delete t[qf],delete t[d1],delete t[oR],delete t[aR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qC(e){return e.tag===5||e.tag===3||e.tag===4}function QS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function C1(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Zg));else if(o!==4&&(e=e.child,e!==null))for(C1(e,t,i),e=e.sibling;e!==null;)C1(e,t,i),e=e.sibling}function I1(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(I1(e,t,i),e=e.sibling;e!==null;)I1(e,t,i),e=e.sibling}var li=null,go=!1;function yl(e,t,i){for(i=i.child;i!==null;)YC(e,t,i),i=i.sibling}function YC(e,t,i){if(Wo&&typeof Wo.onCommitFiberUnmount=="function")try{Wo.onCommitFiberUnmount(Dy,i)}catch{}switch(i.tag){case 5:Ci||lh(i,t);case 6:var o=li,h=go;li=null,yl(e,t,i),li=o,go=h,li!==null&&(go?(e=li,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):li.removeChild(i.stateNode));break;case 18:li!==null&&(go?(e=li,i=i.stateNode,e.nodeType===8?ov(e.parentNode,i):e.nodeType===1&&ov(e,i),Vf(e)):ov(li,i.stateNode));break;case 4:o=li,h=go,li=i.stateNode.containerInfo,go=!0,yl(e,t,i),li=o,go=h;break;case 0:case 11:case 14:case 15:if(!Ci&&(o=i.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){h=o=o.next;do{var f=h,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&T1(i,t,g),h=h.next}while(h!==o)}yl(e,t,i);break;case 1:if(!Ci&&(lh(i,t),o=i.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=i.memoizedProps,o.state=i.memoizedState,o.componentWillUnmount()}catch(c){In(i,t,c)}yl(e,t,i);break;case 21:yl(e,t,i);break;case 22:i.mode&1?(Ci=(o=Ci)||i.memoizedState!==null,yl(e,t,i),Ci=o):yl(e,t,i);break;default:yl(e,t,i)}}function ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new SR),t.forEach(function(o){var h=zR.bind(null,e,o);i.has(o)||(i.add(o),o.then(h,h))})}}function fo(e,t){var i=t.deletions;if(i!==null)for(var o=0;oh&&(h=g),o&=~f}if(o=h,o=An()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*ER(o/1960))-o,10e?16:e,El===null)var o=!1;else{if(e=El,El=null,oy=0,Pr&6)throw Error(lt(331));var h=Pr;for(Pr|=4,Lt=e.current;Lt!==null;){var f=Lt,g=f.child;if(Lt.flags&16){var c=f.deletions;if(c!==null){for(var T=0;TAn()-sw?Ru(e,0):iw|=i),ds(e,t)}function nI(e,t){t===0&&(e.mode&1?(t=Fm,Fm<<=1,!(Fm&130023424)&&(Fm=4194304)):t=1);var i=Hi();e=Pa(e,t),e!==null&&(pp(e,t,i),ds(e,i))}function DR(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),nI(e,i)}function zR(e,t){var i=0;switch(e.tag){case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(i=h.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(lt(314))}o!==null&&o.delete(t),nI(e,i)}var iI;iI=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||cs.current)ls=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return ls=!1,xR(e,t,i);ls=!!(e.flags&131072)}else ls=!1,yn&&t.flags&1048576&&lC(t,Kg,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;mg(e,t),e=t.pendingProps;var h=Sh(t,Pi.current);yh(t,i),h=Jx(null,t,o,e,h,i);var f=Qx();return t.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,hs(o)?(f=!0,Yg(t)):f=!1,t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,Zx(t),h.updater=Ny,t.stateNode=h,h._reactInternals=t,_1(t,o,e,i),t=w1(null,t,o,!0,f,i)):(t.tag=0,yn&&f&&$x(t),Ni(null,t,h,i),t=t.child),t;case 16:o=t.elementType;e:{switch(mg(e,t),e=t.pendingProps,h=o._init,o=h(o._payload),t.type=o,h=t.tag=LR(o),e=po(o,e),h){case 0:t=x1(null,t,o,e,i);break e;case 1:t=YS(null,t,o,e,i);break e;case 11:t=ZS(null,t,o,e,i);break e;case 14:t=qS(null,t,o,po(o.type,e),i);break e}throw Error(lt(306,o,""))}return t;case 0:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),x1(e,t,o,h,i);case 1:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),YS(e,t,o,h,i);case 3:e:{if(jC(t),e===null)throw Error(lt(387));o=t.pendingProps,f=t.memoizedState,h=f.element,pC(e,t),ey(t,o,null,i);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){h=Ch(Error(lt(423)),t),t=XS(e,t,o,i,h);break e}else if(o!==h){h=Ch(Error(lt(424)),t),t=XS(e,t,o,i,h);break e}else for(Ls=Ll(t.stateNode.containerInfo.firstChild),Os=t,yn=!0,yo=null,i=dC(t,null,o,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(kh(),o===h){t=Ma(e,t,i);break e}Ni(e,t,o,i)}t=t.child}return t;case 5:return mC(t),e===null&&m1(t),o=t.type,h=t.pendingProps,f=e!==null?e.memoizedProps:null,g=h.children,c1(o,h)?g=null:f!==null&&c1(o,f)&&(t.flags|=32),$C(e,t),Ni(e,t,g,i),t.child;case 6:return e===null&&m1(t),null;case 13:return UC(e,t,i);case 4:return qx(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Th(t,null,o,i):Ni(e,t,o,i),t.child;case 11:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),ZS(e,t,o,h,i);case 7:return Ni(e,t,t.pendingProps,i),t.child;case 8:return Ni(e,t,t.pendingProps.children,i),t.child;case 12:return Ni(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(o=t.type._context,h=t.pendingProps,f=t.memoizedProps,g=h.value,en(Jg,o._currentValue),o._currentValue=g,f!==null)if(So(f.value,g)){if(f.children===h.children&&!cs.current){t=Ma(e,t,i);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var c=f.dependencies;if(c!==null){g=f.child;for(var T=c.firstContext;T!==null;){if(T.context===o){if(f.tag===1){T=ka(-1,i&-i),T.tag=2;var P=f.updateQueue;if(P!==null){P=P.shared;var R=P.pending;R===null?T.next=T:(T.next=R.next,R.next=T),P.pending=T}}f.lanes|=i,T=f.alternate,T!==null&&(T.lanes|=i),g1(f.return,i,t),c.lanes|=i;break}T=T.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(lt(341));g.lanes|=i,c=g.alternate,c!==null&&(c.lanes|=i),g1(g,i,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ni(e,t,h.children,i),t=t.child}return t;case 9:return h=t.type,o=t.pendingProps.children,yh(t,i),h=eo(h),o=o(h),t.flags|=1,Ni(e,t,o,i),t.child;case 14:return o=t.type,h=po(o,t.pendingProps),h=po(o.type,h),qS(e,t,o,h,i);case 15:return BC(e,t,t.type,t.pendingProps,i);case 17:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),mg(e,t),t.tag=1,hs(o)?(e=!0,Yg(t)):e=!1,yh(t,i),LC(t,o,h),_1(t,o,h,i),w1(null,t,o,!0,e,i);case 19:return VC(e,t,i);case 22:return NC(e,t,i)}throw Error(lt(156,t.tag))};function sI(e,t){return DE(e,t)}function RR(e,t,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Js(e,t,i,o){return new RR(e,t,i,o)}function uw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function LR(e){if(typeof e=="function")return uw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ix)return 11;if(e===Px)return 14}return 2}function Nl(e,t){var i=e.alternate;return i===null?(i=Js(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function _g(e,t,i,o,h,f){var g=2;if(o=e,typeof e=="function")uw(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Qc:return Lu(i.children,h,f,t);case Cx:g=8,h|=8;break;case Uv:return e=Js(12,i,t,h|2),e.elementType=Uv,e.lanes=f,e;case Vv:return e=Js(13,i,t,h),e.elementType=Vv,e.lanes=f,e;case Hv:return e=Js(19,i,t,h),e.elementType=Hv,e.lanes=f,e;case mE:return Uy(i,h,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fE:g=10;break e;case pE:g=9;break e;case Ix:g=11;break e;case Px:g=14;break e;case wl:g=16,o=null;break e}throw Error(lt(130,e==null?e:typeof e,""))}return t=Js(g,i,t,h),t.elementType=e,t.type=o,t.lanes=f,t}function Lu(e,t,i,o){return e=Js(7,e,o,t),e.lanes=i,e}function Uy(e,t,i,o){return e=Js(22,e,o,t),e.elementType=mE,e.lanes=i,e.stateNode={isHidden:!1},e}function pv(e,t,i){return e=Js(6,e,null,t),e.lanes=i,e}function mv(e,t,i){return t=Js(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function OR(e,t,i,o,h){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Y0(0),this.expirationTimes=Y0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Y0(0),this.identifierPrefix=o,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function cw(e,t,i,o,h,f,g,c,T){return e=new OR(e,t,i,c,T),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Js(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zx(f),e}function FR(e,t,i){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uI)}catch(e){console.error(e)}}uI(),uE.exports=Bs;var cI=uE.exports,lk=cI;$v.createRoot=lk.createRoot,$v.hydrateRoot=lk.hydrateRoot;const hI="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='80'%20height='48'%20viewBox='0%200%2080%2048'%3e%3cg%20fill='%23D73F3F'%20fill-rule='evenodd'%3e%3cpath%20d='M37.02656,20.77496%20C37.02656,20.29096%2037.12976,19.85896%2037.33616,19.48616%20C37.54096,19.11176%2037.81296,18.80696%2038.15056,18.56376%20C38.48656,18.32136%2038.86496,18.13736%2039.28576,18.01336%20C39.70496,17.89016%2040.12736,17.82776%2040.55376,17.82776%20C40.97856,17.82776%2041.40256,17.89016%2041.82336,18.01336%20C42.24176,18.13736%2042.62016,18.32136%2042.95616,18.56376%20C43.29456,18.80696%2043.56576,19.11176%2043.77216,19.48616%20C43.97856,19.85896%2044.08096,20.29096%2044.08096,20.77496%20L44.08096,27.14696%20C44.08096,27.64136%2043.97856,28.07496%2043.77216,28.44216%20C43.56576,28.81096%2043.29456,29.11416%2042.95616,29.35736%20C42.62016,29.60136%2042.24176,29.78616%2041.82336,29.90856%20C41.40256,30.03176%2040.97856,30.09336%2040.55376,30.09336%20C40.12736,30.09336%2039.70496,30.03176%2039.28576,29.90856%20C38.86496,29.78616%2038.48656,29.60136%2038.15056,29.35736%20C37.81296,29.11416%2037.54096,28.81096%2037.33616,28.44216%20C37.12976,28.07496%2037.02656,27.64136%2037.02656,27.14696%20L37.02656,20.77496%20Z%20M39.05136,27.15016%20C39.05136,27.56536%2039.28256,27.87496%2039.56576,28.07176%20C39.84736,28.27016%2040.18096,28.37496%2040.56576,28.37496%20C40.94896,28.37496%2041.28416,28.27016%2041.56656,28.07176%20C41.84736,27.87496%2042.00816,27.56536%2042.00816,27.15016%20L42.00816,20.77816%20C42.00816,20.36136%2041.84736,20.05256%2041.56656,19.85576%20C41.28416,19.65816%2040.94896,19.52536%2040.56576,19.52536%20C40.18096,19.52536%2039.84736,19.65816%2039.56576,19.85576%20C39.28256,20.05256%2039.05136,20.36136%2039.05136,20.77816%20L39.05136,27.15016%20Z'/%3e%3cpolygon%20points='33.379%2017.815%2033.379%2022.99%2030.152%2022.99%2030.152%2017.815%2028.387%2017.815%2028.387%2030.1%2030.152%2030.1%2030.152%2024.923%2033.379%2024.923%2033.379%2030.1%2035.278%2030.1%2035.278%2017.815'/%3e%3cpolygon%20points='52.431%2017.815%2045.426%2017.815%2045.426%2019.622%2048.015%2019.622%2047.985%2030.1%2049.847%2030.1%2049.847%2019.622%2052.431%2019.622'/%3e%3cpath%20d='M65.42344,28.7668%20L79.67944,28.7668%20L71.15544,19.1684%20L62.66904,9.57%20L54.18104,0.000400000001%20L11.53944,0.000400000001%20L20.02584,9.57%20L5.73784,9.57%20L14.22584,19.1684%20L14.29144,19.2332%20L0.000239999999,19.2332%20L8.52184,28.8316%20L17.01304,38.43%20L25.50024,48.0004%20L68.14184,48.0004%20L59.65064,38.43%20L59.58824,38.3364%20L73.87864,38.3364%20L65.42344,28.7668%20Z%20M39.83944,39.9492%20C30.31864,39.9492%2022.60104,32.8084%2022.60104,24.0012%20C22.60104,15.1908%2030.31864,8.05%2039.83944,8.05%20C49.36104,8.05%2057.07944,15.1908%2057.07944,24.0012%20C57.07944,32.8084%2049.36104,39.9492%2039.83944,39.9492%20Z'/%3e%3c/g%3e%3c/svg%3e";var us=function(){return us=Object.assign||function(t){for(var i,o=1,h=arguments.length;o0?ei($h,--ro):0,Mh--,On===10&&(Mh=1,qy--),On}function wo(){return On=ro2||R1(On)>3?"":" "}function KR(e,t){for(;--t&&wo()&&!(On<48||On>102||On>57&&On<65||On>70&&On<97););return Xy(e,xg()+(t<6&&Ou()==32&&wo()==32))}function L1(e){for(;wo();)switch(On){case e:return ro;case 34:case 39:e!==34&&e!==39&&L1(On);break;case 40:e===41&&L1(e);break;case 92:wo();break}return ro}function JR(e,t){for(;wo()&&e+On!==57;)if(e+On===84&&Ou()===47)break;return"/*"+Xy(t,ro-1)+"*"+mw(e===47?e:wo())}function QR(e){for(;!R1(Ou());)wo();return Xy(e,ro)}function e5(e){return YR(wg("",null,null,null,[""],e=qR(e),0,[0],e))}function wg(e,t,i,o,h,f,g,c,T){for(var P=0,R=0,A=g,M=0,N=0,Y=0,U=1,te=1,O=1,$=0,q="",ne=h,oe=f,ke=o,ge=q;te;)switch(Y=$,$=wo()){case 40:if(Y!=108&&ei(ge,A-1)==58){vg(ge+=hr(gv($),"&","&\f"),"&\f",pI(P?c[P-1]:0))!=-1&&(O=-1);break}case 34:case 39:case 91:ge+=gv($);break;case 9:case 10:case 13:case 32:ge+=XR(Y);break;case 92:ge+=KR(xg()-1,7);continue;case 47:switch(Ou()){case 42:case 47:_f(t5(JR(wo(),xg()),t,i,T),T);break;default:ge+="/"}break;case 123*U:c[P++]=Uo(ge)*O;case 125*U:case 59:case 0:switch($){case 0:case 125:te=0;case 59+R:O==-1&&(ge=hr(ge,/\f/g,"")),N>0&&Uo(ge)-A&&_f(N>32?hk(ge+";",o,i,A-1,T):hk(hr(ge," ","")+";",o,i,A-2,T),T);break;case 59:ge+=";";default:if(_f(ke=ck(ge,t,i,P,R,h,c,q,ne=[],oe=[],A,f),f),$===123)if(R===0)wg(ge,t,ke,ke,ne,f,A,c,oe);else switch(M===99&&ei(ge,3)===110?100:M){case 100:case 108:case 109:case 115:wg(e,ke,ke,o&&_f(ck(e,ke,ke,0,0,h,c,q,h,ne=[],A,oe),oe),h,oe,A,c,o?ne:oe);break;default:wg(ge,ke,ke,ke,[""],oe,0,c,oe)}}P=R=N=0,U=O=1,q=ge="",A=g;break;case 58:A=1+Uo(ge),N=Y;default:if(U<1){if($==123)--U;else if($==125&&U++==0&&ZR()==125)continue}switch(ge+=mw($),$*U){case 38:O=R>0?1:(ge+="\f",-1);break;case 44:c[P++]=(Uo(ge)-1)*O,O=1;break;case 64:Ou()===45&&(ge+=gv(wo())),M=Ou(),R=A=Uo(q=ge+=QR(xg())),$++;break;case 45:Y===45&&Uo(ge)==2&&(U=0)}}return f}function ck(e,t,i,o,h,f,g,c,T,P,R,A){for(var M=h-1,N=h===0?f:[""],Y=gI(N),U=0,te=0,O=0;U0?N[$]+" "+q:hr(q,/&\f/g,N[$])))&&(T[O++]=ne);return Yy(e,t,i,h===0?Zy:c,T,P,R,A)}function t5(e,t,i,o){return Yy(e,t,i,dI,mw(GR()),Ph(e,2,-2),0,o)}function hk(e,t,i,o,h){return Yy(e,t,i,pw,Ph(e,0,o),Ph(e,o+1,-1),o,h)}function _I(e,t,i){switch(HR(e,t)){case 5103:return Br+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Br+e+e;case 4789:return Df+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Br+e+Df+e+on+e+e;case 5936:switch(ei(e,t+11)){case 114:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Br+e+on+e+e;case 6165:return Br+e+on+"flex-"+e+e;case 5187:return Br+e+hr(e,/(\w+).+(:[^]+)/,Br+"box-$1$2"+on+"flex-$1$2")+e;case 5443:return Br+e+on+"flex-item-"+hr(e,/flex-|-self/g,"")+(ya(e,/flex-|baseline/)?"":on+"grid-row-"+hr(e,/flex-|-self/g,""))+e;case 4675:return Br+e+on+"flex-line-pack"+hr(e,/align-content|flex-|-self/g,"")+e;case 5548:return Br+e+on+hr(e,"shrink","negative")+e;case 5292:return Br+e+on+hr(e,"basis","preferred-size")+e;case 6060:return Br+"box-"+hr(e,"-grow","")+Br+e+on+hr(e,"grow","positive")+e;case 4554:return Br+hr(e,/([^-])(transform)/g,"$1"+Br+"$2")+e;case 6187:return hr(hr(hr(e,/(zoom-|grab)/,Br+"$1"),/(image-set)/,Br+"$1"),e,"")+e;case 5495:case 3959:return hr(e,/(image-set\([^]*)/,Br+"$1$`$1");case 4968:return hr(hr(e,/(.+:)(flex-)?(.*)/,Br+"box-pack:$3"+on+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Br+e+e;case 4200:if(!ya(e,/flex-|baseline/))return on+"grid-column-align"+Ph(e,t)+e;break;case 2592:case 3360:return on+hr(e,"template-","")+e;case 4384:case 3616:return i&&i.some(function(o,h){return t=h,ya(o.props,/grid-\w+-end/)})?~vg(e+(i=i[t].value),"span",0)?e:on+hr(e,"-start","")+e+on+"grid-row-span:"+(~vg(i,"span",0)?ya(i,/\d+/):+ya(i,/\d+/)-+ya(e,/\d+/))+";":on+hr(e,"-start","")+e;case 4896:case 4128:return i&&i.some(function(o){return ya(o.props,/grid-\w+-start/)})?e:on+hr(hr(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return hr(e,/(.+)-inline(.+)/,Br+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Uo(e)-1-t>6)switch(ei(e,t+1)){case 109:if(ei(e,t+4)!==45)break;case 102:return hr(e,/(.+:)(.+)-([^]+)/,"$1"+Br+"$2-$3$1"+Df+(ei(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~vg(e,"stretch",0)?_I(hr(e,"stretch","fill-available"),t,i)+e:e}break;case 5152:case 5920:return hr(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,h,f,g,c,T,P){return on+h+":"+f+P+(g?on+h+"-span:"+(c?T:+T-+f)+P:"")+e});case 4949:if(ei(e,t+6)===121)return hr(e,":",":"+Br)+e;break;case 6444:switch(ei(e,ei(e,14)===45?18:11)){case 120:return hr(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Br+(ei(e,14)===45?"inline-":"")+"box$3$1"+Br+"$2$3$1"+on+"$2box$3")+e;case 100:return hr(e,":",":"+on)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return hr(e,"scroll-","scroll-snap-")+e}return e}function cy(e,t){for(var i="",o=0;o-1&&!e.return)switch(e.type){case pw:e.return=_I(e.value,e.length,i);return;case fI:return cy([_l(e,{value:hr(e.value,"@","@"+Br)})],o);case Zy:if(e.length)return WR(i=e.props,function(h){switch(ya(h,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":qc(_l(e,{props:[hr(h,/:(read-\w+)/,":"+Df+"$1")]})),qc(_l(e,{props:[h]})),z1(e,{props:uk(i,o)});break;case"::placeholder":qc(_l(e,{props:[hr(h,/:(plac\w+)/,":"+Br+"input-$1")]})),qc(_l(e,{props:[hr(h,/:(plac\w+)/,":"+Df+"$1")]})),qc(_l(e,{props:[hr(h,/:(plac\w+)/,on+"input-$1")]})),qc(_l(e,{props:[h]})),z1(e,{props:uk(i,o)});break}return""})}}var o5={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ps={},Ah=typeof process<"u"&&Ps!==void 0&&(Ps.REACT_APP_SC_ATTR||Ps.SC_ATTR)||"data-styled",vI="active",xI="data-styled-version",Ky="6.1.13",gw=`/*!sc*/ +`,hy=typeof window<"u"&&"HTMLElement"in window,a5=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==""?Ps.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Ps.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.SC_DISABLE_SPEEDY!==void 0&&Ps.SC_DISABLE_SPEEDY!==""&&Ps.SC_DISABLE_SPEEDY!=="false"&&Ps.SC_DISABLE_SPEEDY),Jy=Object.freeze([]),Dh=Object.freeze({});function l5(e,t,i){return i===void 0&&(i=Dh),e.theme!==i.theme&&e.theme||t||i.theme}var wI=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),u5=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,c5=/(^-|-$)/g;function dk(e){return e.replace(u5,"-").replace(c5,"")}var h5=/(a)(d)/gi,Ym=52,fk=function(e){return String.fromCharCode(e+(e>25?39:97))};function O1(e){var t,i="";for(t=Math.abs(e);t>Ym;t=t/Ym|0)i=fk(t%Ym)+i;return(fk(t%Ym)+i).replace(h5,"$1-$2")}var yv,bI=5381,ch=function(e,t){for(var i=t.length;i;)e=33*e^t.charCodeAt(--i);return e},SI=function(e){return ch(bI,e)};function d5(e){return O1(SI(e)>>>0)}function f5(e){return e.displayName||e.name||"Component"}function _v(e){return typeof e=="string"&&!0}var kI=typeof Symbol=="function"&&Symbol.for,TI=kI?Symbol.for("react.memo"):60115,p5=kI?Symbol.for("react.forward_ref"):60112,m5={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},g5={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},EI={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},y5=((yv={})[p5]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},yv[TI]=EI,yv);function pk(e){return("type"in(t=e)&&t.type.$$typeof)===TI?EI:"$$typeof"in e?y5[e.$$typeof]:m5;var t}var _5=Object.defineProperty,v5=Object.getOwnPropertyNames,mk=Object.getOwnPropertySymbols,x5=Object.getOwnPropertyDescriptor,w5=Object.getPrototypeOf,gk=Object.prototype;function CI(e,t,i){if(typeof t!="string"){if(gk){var o=w5(t);o&&o!==gk&&CI(e,o,i)}var h=v5(t);mk&&(h=h.concat(mk(t)));for(var f=pk(e),g=pk(t),c=0;c0?" Args: ".concat(t.join(", ")):""))}var b5=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var i=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,h=o.length,f=h;t>=f;)if((f<<=1)<0)throw _p(16,"".concat(t));this.groupSizes=new Uint32Array(f),this.groupSizes.set(o),this.length=f;for(var g=h;g=this.length||this.groupSizes[t]===0)return i;for(var o=this.groupSizes[t],h=this.indexOfGroup(t),f=h+o,g=h;g=0){var o=document.createTextNode(i);return this.element.insertBefore(o,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t0&&(te+="".concat(O,","))}),T+="".concat(Y).concat(U,'{content:"').concat(te,'"}').concat(gw)},R=0;R0?".".concat(t):M},R=T.slice();R.push(function(M){M.type===Zy&&M.value.includes("&")&&(M.props[0]=M.props[0].replace(z5,i).replace(o,P))}),g.prefix&&R.push(s5),R.push(r5);var A=function(M,N,Y,U){N===void 0&&(N=""),Y===void 0&&(Y=""),U===void 0&&(U="&"),t=U,i=N,o=new RegExp("\\".concat(i,"\\b"),"g");var te=M.replace(R5,""),O=e5(Y||N?"".concat(Y," ").concat(N," { ").concat(te," }"):te);g.namespace&&(O=MI(O,g.namespace));var $=[];return cy(O,n5(R.concat(i5(function(q){return $.push(q)})))),$};return A.hash=T.length?T.reduce(function(M,N){return N.name||_p(15),ch(M,N.name)},bI).toString():"",A}var O5=new PI,B1=L5(),AI=ju.createContext({shouldForwardProp:void 0,styleSheet:O5,stylis:B1});AI.Consumer;ju.createContext(void 0);function xk(){return Ht.useContext(AI)}var F5=function(){function e(t,i){var o=this;this.inject=function(h,f){f===void 0&&(f=B1);var g=o.name+f.hash;h.hasNameForId(o.id,g)||h.insertRules(o.id,g,f(o.rules,g,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=i,_w(this,function(){throw _p(12,String(o.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=B1),this.name+t.hash},e}(),B5=function(e){return e>="A"&&e<="Z"};function wk(e){for(var t="",i=0;i>>0);if(!i.hasNameForId(this.componentId,g)){var c=o(f,".".concat(g),void 0,this.componentId);i.insertRules(this.componentId,g,c)}h=Mu(h,g),this.staticRulesId=g}else{for(var T=ch(this.baseHash,o.hash),P="",R=0;R>>0);i.hasNameForId(this.componentId,N)||i.insertRules(this.componentId,N,o(P,".".concat(N),void 0,this.componentId)),h=Mu(h,N)}}return h},e}(),RI=ju.createContext(void 0);RI.Consumer;var vv={};function U5(e,t,i){var o=yw(e),h=e,f=!_v(e),g=t.attrs,c=g===void 0?Jy:g,T=t.componentId,P=T===void 0?function(ne,oe){var ke=typeof ne!="string"?"sc":dk(ne);vv[ke]=(vv[ke]||0)+1;var ge="".concat(ke,"-").concat(d5(Ky+ke+vv[ke]));return oe?"".concat(oe,"-").concat(ge):ge}(t.displayName,t.parentComponentId):T,R=t.displayName,A=R===void 0?function(ne){return _v(ne)?"styled.".concat(ne):"Styled(".concat(f5(ne),")")}(e):R,M=t.displayName&&t.componentId?"".concat(dk(t.displayName),"-").concat(t.componentId):t.componentId||P,N=o&&h.attrs?h.attrs.concat(c).filter(Boolean):c,Y=t.shouldForwardProp;if(o&&h.shouldForwardProp){var U=h.shouldForwardProp;if(t.shouldForwardProp){var te=t.shouldForwardProp;Y=function(ne,oe){return U(ne,oe)&&te(ne,oe)}}else Y=U}var O=new j5(i,M,o?h.componentStyle:void 0);function $(ne,oe){return function(ke,ge,Fe){var Oe=ke.attrs,Ge=ke.componentStyle,it=ke.defaultProps,ve=ke.foldedComponentIds,je=ke.styledComponentId,H=ke.target,Re=ju.useContext(RI),vt=xk(),ye=ke.shouldForwardProp||vt.shouldForwardProp,Be=l5(ge,Re,it)||Dh,Le=function(rt,Jt,er){for(var Vt,Yt=us(us({},Jt),{className:void 0,theme:er}),_r=0;_rc?(ye(!0),R&&R("File size is too big"),!1):!(T&&Pk(xe.size)0||Yt(!1)},[]),Xr=Ht.useCallback(function(je){je.preventDefault(),je.stopPropagation()},[]),V=Ht.useCallback(function(je){je.preventDefault(),je.stopPropagation(),Yt(!1),xv=0;var ie=je.dataTransfer.files;if(ie&&ie.length>0){var de=nt?ie:ie[0],se=rt(de);Jt&&se&&Jt(de)}},[rt]);return Ht.useEffect(function(){var je=Ee.current;return je.addEventListener("click",_r),je.addEventListener("dragenter",fr),je.addEventListener("dragleave",br),je.addEventListener("dragover",Xr),je.addEventListener("drop",V),function(){je.removeEventListener("click",_r),je.removeEventListener("dragenter",fr),je.removeEventListener("dragleave",br),je.removeEventListener("dragover",Xr),je.removeEventListener("drop",V)}},[_r,fr,br,Xr,V,Ee]),Vt}({labelRef:ge,inputRef:Fe,multiple:O,handleChanges:Le,onDrop:N});return Ht.useEffect(function(){q==null||q(Xe)},[Xe]),Ht.useEffect(function(){P?(it(!0),H(P)):(Fe.current&&(Fe.current.value=""),it(!1),H(null))},[P]),Ke.jsxs(H5,Bu({overRide:g,className:"".concat(f||""," ").concat(Y?"is-disabled":""),ref:ge,htmlFor:t,onClick:function(xe){xe.preventDefault(),xe.stopPropagation()},"aria-describedby":ke,role:"button","aria-label":oe},{children:[Ke.jsx("input",{onClick:function(xe){xe.stopPropagation(),Fe&&Fe.current&&(Fe.current.value="",Fe.current.click())},onChange:function(xe){var Ee=xe.target.files,mt=O?Ee:Ee[0],nt=Le(mt);M&&nt&&M(mt)},accept:q5(o),ref:Fe,type:"file",id:t,name:t,disabled:Y,multiple:O,required:$},void 0),Xe&&Ke.jsx(W5,Bu({style:ne},{children:Ke.jsx("span",{children:i||"Drop Here"},void 0)}),void 0),!g&&Ke.jsxs(Ke.Fragment,{children:[Ke.jsx(X5,{},void 0),Ke.jsxs(G5,Bu({error:vt},{children:[K5(Ue,We,vt,Y,j,te),Ke.jsx(Y5,{types:o,minSize:T,maxSize:c},void 0)]}),void 0)]},void 0),g]}),void 0)};function Km(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var OI={exports:{}};/*! +`])),"#666"),Pk=function(e){return e/1024/1024},q5=function(e){return e===void 0?"":e.map(function(t){return".".concat(t.toLowerCase())}).join(",")};function Y5(e){var t=e.types,i=e.minSize,o=e.maxSize;if(t){var h=t.toString(),f="";return o&&(f+="size >= ".concat(o,", ")),i&&(f+="size <= ".concat(i,", ")),We.jsx("span",Bu({title:"".concat(f,"types: ").concat(h),className:"file-types"},{children:h}),void 0)}return null}function X5(){return We.jsxs("svg",Bu({width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[We.jsx("path",{d:"M5.33317 6.66667H22.6665V16H25.3332V6.66667C25.3332 5.196 24.1372 4 22.6665 4H5.33317C3.8625 4 2.6665 5.196 2.6665 6.66667V22.6667C2.6665 24.1373 3.8625 25.3333 5.33317 25.3333H15.9998V22.6667H5.33317V6.66667Z",fill:"#0658C2"},void 0),We.jsx("path",{d:"M10.6665 14.6667L6.6665 20H21.3332L15.9998 12L11.9998 17.3333L10.6665 14.6667Z",fill:"#0658C2"},void 0),We.jsx("path",{d:"M25.3332 18.6667H22.6665V22.6667H18.6665V25.3333H22.6665V29.3333H25.3332V25.3333H29.3332V22.6667H25.3332V18.6667Z",fill:"#0658C2"},void 0)]}),void 0)}var xv=0,K5=function(e,t,i,o,h,f){return i?We.jsx("span",{children:"File type/size error, Hovered on types!"},void 0):We.jsx(Z5,{children:o?We.jsx("span",{children:"Upload disabled"},void 0):We.jsx(We.Fragment,e||t?{children:f?We.jsx(We.Fragment,{children:We.jsx("span",{children:f},void 0)},void 0):We.jsxs(We.Fragment,{children:[We.jsx("span",{children:"Uploaded Successfully!"},void 0)," Upload another?"]},void 0)}:{children:We.jsxs(We.Fragment,h?{children:[We.jsx("span",{children:h.split(" ")[0]},void 0)," ",h.substr(h.indexOf(" ")+1)]}:{children:[We.jsx("span",{children:"Upload"},void 0)," or drop a file right here"]},void 0)},void 0)},void 0)},J5=function(e){var t=e.name,i=e.hoverTitle,o=e.types,h=e.handleChange,f=e.classes,g=e.children,c=e.maxSize,T=e.minSize,P=e.fileOrFiles,R=e.onSizeError,A=e.onTypeError,M=e.onSelect,N=e.onDrop,Y=e.disabled,U=e.label,te=e.uploadedLabel,O=e.multiple,$=e.required,q=e.onDraggingStateChange,ne=e.dropMessageStyle,oe=e.ariaLabel,ke=e.ariaDescribedby,ge=Ht.useRef(null),Fe=Ht.useRef(null),Oe=Ht.useState(!1),Ge=Oe[0],it=Oe[1],ve=Ht.useState(null),je=ve[0],H=ve[1],Re=Ht.useState(!1),vt=Re[0],ye=Re[1],Be=function(xe){return o&&!function(Ee,mt){var nt=Ee.name.split(".").pop();return mt.map(function(rt){return rt.toLowerCase()}).includes(nt.toLowerCase())}(xe,o)?(ye(!0),A&&A("File type is not supported"),!1):c&&Pk(xe.size)>c?(ye(!0),R&&R("File size is too big"),!1):!(T&&Pk(xe.size)0||Yt(!1)},[]),Xr=Ht.useCallback(function(Ue){Ue.preventDefault(),Ue.stopPropagation()},[]),V=Ht.useCallback(function(Ue){Ue.preventDefault(),Ue.stopPropagation(),Yt(!1),xv=0;var ie=Ue.dataTransfer.files;if(ie&&ie.length>0){var de=nt?ie:ie[0],se=rt(de);Jt&&se&&Jt(de)}},[rt]);return Ht.useEffect(function(){var Ue=Ee.current;return Ue.addEventListener("click",_r),Ue.addEventListener("dragenter",fr),Ue.addEventListener("dragleave",br),Ue.addEventListener("dragover",Xr),Ue.addEventListener("drop",V),function(){Ue.removeEventListener("click",_r),Ue.removeEventListener("dragenter",fr),Ue.removeEventListener("dragleave",br),Ue.removeEventListener("dragover",Xr),Ue.removeEventListener("drop",V)}},[_r,fr,br,Xr,V,Ee]),Vt}({labelRef:ge,inputRef:Fe,multiple:O,handleChanges:Le,onDrop:N});return Ht.useEffect(function(){q==null||q(Ke)},[Ke]),Ht.useEffect(function(){P?(it(!0),H(P)):(Fe.current&&(Fe.current.value=""),it(!1),H(null))},[P]),We.jsxs(H5,Bu({overRide:g,className:"".concat(f||""," ").concat(Y?"is-disabled":""),ref:ge,htmlFor:t,onClick:function(xe){xe.preventDefault(),xe.stopPropagation()},"aria-describedby":ke,role:"button","aria-label":oe},{children:[We.jsx("input",{onClick:function(xe){xe.stopPropagation(),Fe&&Fe.current&&(Fe.current.value="",Fe.current.click())},onChange:function(xe){var Ee=xe.target.files,mt=O?Ee:Ee[0],nt=Le(mt);M&&nt&&M(mt)},accept:q5(o),ref:Fe,type:"file",id:t,name:t,disabled:Y,multiple:O,required:$},void 0),Ke&&We.jsx(W5,Bu({style:ne},{children:We.jsx("span",{children:i||"Drop Here"},void 0)}),void 0),!g&&We.jsxs(We.Fragment,{children:[We.jsx(X5,{},void 0),We.jsxs(G5,Bu({error:vt},{children:[K5(je,Ge,vt,Y,U,te),We.jsx(Y5,{types:o,minSize:T,maxSize:c},void 0)]}),void 0)]},void 0),g]}),void 0)};function Km(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var FI={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -207,40 +207,40 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(e,t){(function(i){e.exports=i()})(function(){return function i(o,h,f){function g(P,R){if(!h[P]){if(!o[P]){var A=typeof Km=="function"&&Km;if(!R&&A)return A(P,!0);if(c)return c(P,!0);var M=new Error("Cannot find module '"+P+"'");throw M.code="MODULE_NOT_FOUND",M}var N=h[P]={exports:{}};o[P][0].call(N.exports,function(Y){var j=o[P][1][Y];return g(j||Y)},N,N.exports,i,o,h,f)}return h[P].exports}for(var c=typeof Km=="function"&&Km,T=0;T>2,N=(3&P)<<4|R>>4,Y=1>6:64,j=2>4,R=(15&M)<<4|(N=c.indexOf(T.charAt(j++)))>>2,A=(3&N)<<6|(Y=c.indexOf(T.charAt(j++))),$[te++]=P,N!==64&&($[te++]=R),Y!==64&&($[te++]=A);return $}},{"./support":30,"./utils":32}],2:[function(i,o,h){var f=i("./external"),g=i("./stream/DataWorker"),c=i("./stream/Crc32Probe"),T=i("./stream/DataLengthProbe");function P(R,A,M,N,Y){this.compressedSize=R,this.uncompressedSize=A,this.crc32=M,this.compression=N,this.compressedContent=Y}P.prototype={getContentWorker:function(){var R=new g(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new T("data_length")),A=this;return R.on("end",function(){if(this.streamInfo.data_length!==A.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),R},getCompressedWorker:function(){return new g(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},P.createWorkerFrom=function(R,A,M){return R.pipe(new c).pipe(new T("uncompressedSize")).pipe(A.compressWorker(M)).pipe(new T("compressedSize")).withStreamInfo("compression",A)},o.exports=P},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,o,h){var f=i("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},h.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,o,h){var f=i("./utils"),g=function(){for(var c,T=[],P=0;P<256;P++){c=P;for(var R=0;R<8;R++)c=1&c?3988292384^c>>>1:c>>>1;T[P]=c}return T}();o.exports=function(c,T){return c!==void 0&&c.length?f.getTypeOf(c)!=="string"?function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var j=M;j>>8^N[255&(P^R[j])];return-1^P}(0|T,c,c.length,0):function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var j=M;j>>8^N[255&(P^R.charCodeAt(j))];return-1^P}(0|T,c,c.length,0):0}},{"./utils":32}],5:[function(i,o,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(i,o,h){var f=null;f=typeof Promise<"u"?Promise:i("lie"),o.exports={Promise:f}},{lie:37}],7:[function(i,o,h){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=i("pako"),c=i("./utils"),T=i("./stream/GenericWorker"),P=f?"uint8array":"array";function R(A,M){T.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=M,this.meta={}}h.magic="\b\0",c.inherits(R,T),R.prototype.processChunk=function(A){this.meta=A.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(P,A.data),!1)},R.prototype.flush=function(){T.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},R.prototype.cleanUp=function(){T.prototype.cleanUp.call(this),this._pako=null},R.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(M){A.push({data:M,meta:A.meta})}},h.compressWorker=function(A){return new R("Deflate",A)},h.uncompressWorker=function(){return new R("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,o,h){function f(N,Y){var j,te="";for(j=0;j>>=8;return te}function g(N,Y,j,te,O,$){var q,ne,oe=N.file,ke=N.compression,ge=$!==P.utf8encode,Fe=c.transformTo("string",$(oe.name)),Oe=c.transformTo("string",P.utf8encode(oe.name)),We=oe.comment,it=c.transformTo("string",$(We)),ve=c.transformTo("string",P.utf8encode(We)),Ue=Oe.length!==oe.name.length,H=ve.length!==We.length,Re="",vt="",ye="",Be=oe.dir,Le=oe.date,Xe={crc32:0,compressedSize:0,uncompressedSize:0};Y&&!j||(Xe.crc32=N.crc32,Xe.compressedSize=N.compressedSize,Xe.uncompressedSize=N.uncompressedSize);var xe=0;Y&&(xe|=8),ge||!Ue&&!H||(xe|=2048);var Ee=0,mt=0;Be&&(Ee|=16),O==="UNIX"?(mt=798,Ee|=function(rt,Jt){var er=rt;return rt||(er=Jt?16893:33204),(65535&er)<<16}(oe.unixPermissions,Be)):(mt=20,Ee|=function(rt){return 63&(rt||0)}(oe.dosPermissions)),q=Le.getUTCHours(),q<<=6,q|=Le.getUTCMinutes(),q<<=5,q|=Le.getUTCSeconds()/2,ne=Le.getUTCFullYear()-1980,ne<<=4,ne|=Le.getUTCMonth()+1,ne<<=5,ne|=Le.getUTCDate(),Ue&&(vt=f(1,1)+f(R(Fe),4)+Oe,Re+="up"+f(vt.length,2)+vt),H&&(ye=f(1,1)+f(R(it),4)+ve,Re+="uc"+f(ye.length,2)+ye);var nt="";return nt+=` -\0`,nt+=f(xe,2),nt+=ke.magic,nt+=f(q,2),nt+=f(ne,2),nt+=f(Xe.crc32,4),nt+=f(Xe.compressedSize,4),nt+=f(Xe.uncompressedSize,4),nt+=f(Fe.length,2),nt+=f(Re.length,2),{fileRecord:A.LOCAL_FILE_HEADER+nt+Fe+Re,dirRecord:A.CENTRAL_FILE_HEADER+f(mt,2)+nt+f(it.length,2)+"\0\0\0\0"+f(Ee,4)+f(te,4)+Fe+Re+it}}var c=i("../utils"),T=i("../stream/GenericWorker"),P=i("../utf8"),R=i("../crc32"),A=i("../signature");function M(N,Y,j,te){T.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=j,this.encodeFileName=te,this.streamFiles=N,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(M,T),M.prototype.push=function(N){var Y=N.meta.percent||0,j=this.entriesCount,te=this._sources.length;this.accumulate?this.contentBuffer.push(N):(this.bytesWritten+=N.data.length,T.prototype.push.call(this,{data:N.data,meta:{currentFile:this.currentFile,percent:j?(Y+100*(j-te-1))/j:100}}))},M.prototype.openedSource=function(N){this.currentSourceOffset=this.bytesWritten,this.currentFile=N.file.name;var Y=this.streamFiles&&!N.file.dir;if(Y){var j=g(N,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},M.prototype.closedSource=function(N){this.accumulate=!1;var Y=this.streamFiles&&!N.file.dir,j=g(N,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),Y)this.push({data:function(te){return A.DATA_DESCRIPTOR+f(te.crc32,4)+f(te.compressedSize,4)+f(te.uncompressedSize,4)}(N),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},M.prototype.flush=function(){for(var N=this.bytesWritten,Y=0;Y=this.index;T--)P=(P<<8)+this.byteAt(T);return this.index+=c,P},readString:function(c){return f.transformTo("string",this.readData(c))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var c=this.readInt(4);return new Date(Date.UTC(1980+(c>>25&127),(c>>21&15)-1,c>>16&31,c>>11&31,c>>5&63,(31&c)<<1))}},o.exports=g},{"../utils":32}],19:[function(i,o,h){var f=i("./Uint8ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,o,h){var f=i("./DataReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},g.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},g.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./DataReader":18}],21:[function(i,o,h){var f=i("./ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){if(this.checkOffset(c),c===0)return new Uint8Array(0);var T=this.data.subarray(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(i,o,h){var f=i("../utils"),g=i("../support"),c=i("./ArrayReader"),T=i("./StringReader"),P=i("./NodeBufferReader"),R=i("./Uint8ArrayReader");o.exports=function(A){var M=f.getTypeOf(A);return f.checkSupport(M),M!=="string"||g.uint8array?M==="nodebuffer"?new P(A):g.uint8array?new R(f.transformTo("uint8array",A)):new c(f.transformTo("array",A)):new T(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,o,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,o,h){var f=i("./GenericWorker"),g=i("../utils");function c(T){f.call(this,"ConvertWorker to "+T),this.destType=T}g.inherits(c,f),c.prototype.processChunk=function(T){this.push({data:g.transformTo(this.destType,T.data),meta:T.meta})},o.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(i,o,h){var f=i("./GenericWorker"),g=i("../crc32");function c(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(c,f),c.prototype.processChunk=function(T){this.streamInfo.crc32=g(T.data,this.streamInfo.crc32||0),this.push(T)},o.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataLengthProbe for "+T),this.propName=T,this.withStreamInfo(T,0)}f.inherits(c,g),c.prototype.processChunk=function(T){if(T){var P=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=P+T.data.length}g.prototype.processChunk.call(this,T)},o.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataWorker");var P=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,T.then(function(R){P.dataIsReady=!0,P.data=R,P.max=R&&R.length||0,P.type=f.getTypeOf(R),P.isPaused||P._tickAndRepeat()},function(R){P.error(R)})}f.inherits(c,g),c.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var T=null,P=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":T=this.data.substring(this.index,P);break;case"uint8array":T=this.data.subarray(this.index,P);break;case"array":case"nodebuffer":T=this.data.slice(this.index,P)}return this.index=P,this.push({data:T,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(i,o,h){function f(g){this.name=g||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,c){return this._listeners[g].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,c){if(this._listeners[g])for(var T=0;T "+g:g}},o.exports=f},{}],29:[function(i,o,h){var f=i("../utils"),g=i("./ConvertWorker"),c=i("./GenericWorker"),T=i("../base64"),P=i("../support"),R=i("../external"),A=null;if(P.nodestream)try{A=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function M(Y,j){return new R.Promise(function(te,O){var $=[],q=Y._internalType,ne=Y._outputType,oe=Y._mimeType;Y.on("data",function(ke,ge){$.push(ke),j&&j(ge)}).on("error",function(ke){$=[],O(ke)}).on("end",function(){try{var ke=function(ge,Fe,Oe){switch(ge){case"blob":return f.newBlob(f.transformTo("arraybuffer",Fe),Oe);case"base64":return T.encode(Fe);default:return f.transformTo(ge,Fe)}}(ne,function(ge,Fe){var Oe,We=0,it=null,ve=0;for(Oe=0;Oe"u")h.blob=!1;else{var f=new ArrayBuffer(0);try{h.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(f),h.blob=g.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!i("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(i,o,h){for(var f=i("./utils"),g=i("./support"),c=i("./nodejsUtils"),T=i("./stream/GenericWorker"),P=new Array(256),R=0;R<256;R++)P[R]=252<=R?6:248<=R?5:240<=R?4:224<=R?3:192<=R?2:1;P[254]=P[254]=1;function A(){T.call(this,"utf-8 decode"),this.leftOver=null}function M(){T.call(this,"utf-8 encode")}h.utf8encode=function(N){return g.nodebuffer?c.newBufferFrom(N,"utf-8"):function(Y){var j,te,O,$,q,ne=Y.length,oe=0;for($=0;$>>6:(te<65536?j[q++]=224|te>>>12:(j[q++]=240|te>>>18,j[q++]=128|te>>>12&63),j[q++]=128|te>>>6&63),j[q++]=128|63&te);return j}(N)},h.utf8decode=function(N){return g.nodebuffer?f.transformTo("nodebuffer",N).toString("utf-8"):function(Y){var j,te,O,$,q=Y.length,ne=new Array(2*q);for(j=te=0;j>10&1023,ne[te++]=56320|1023&O)}return ne.length!==te&&(ne.subarray?ne=ne.subarray(0,te):ne.length=te),f.applyFromCharCode(ne)}(N=f.transformTo(g.uint8array?"uint8array":"array",N))},f.inherits(A,T),A.prototype.processChunk=function(N){var Y=f.transformTo(g.uint8array?"uint8array":"array",N.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var j=Y;(Y=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),Y.set(j,this.leftOver.length)}else Y=this.leftOver.concat(Y);this.leftOver=null}var te=function($,q){var ne;for((q=q||$.length)>$.length&&(q=$.length),ne=q-1;0<=ne&&(192&$[ne])==128;)ne--;return ne<0||ne===0?q:ne+P[$[ne]]>q?ne:q}(Y),O=Y;te!==Y.length&&(g.uint8array?(O=Y.subarray(0,te),this.leftOver=Y.subarray(te,Y.length)):(O=Y.slice(0,te),this.leftOver=Y.slice(te,Y.length))),this.push({data:h.utf8decode(O),meta:N.meta})},A.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=A,f.inherits(M,T),M.prototype.processChunk=function(N){this.push({data:h.utf8encode(N.data),meta:N.meta})},h.Utf8EncodeWorker=M},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,o,h){var f=i("./support"),g=i("./base64"),c=i("./nodejsUtils"),T=i("./external");function P(j){return j}function R(j,te){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),N==0&&(this.dosPermissions=63&this.externalFileAttributes),N==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var N=f(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=N.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=N.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=N.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=N.readInt(4))}},readExtraFields:function(N){var Y,j,te,O=N.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});N.index+4>>6:(N<65536?M[te++]=224|N>>>12:(M[te++]=240|N>>>18,M[te++]=128|N>>>12&63),M[te++]=128|N>>>6&63),M[te++]=128|63&N);return M},h.buf2binstring=function(A){return R(A,A.length)},h.binstring2buf=function(A){for(var M=new f.Buf8(A.length),N=0,Y=M.length;N>10&1023,$[Y++]=56320|1023&j)}return R($,Y)},h.utf8border=function(A,M){var N;for((M=M||A.length)>A.length&&(M=A.length),N=M-1;0<=N&&(192&A[N])==128;)N--;return N<0||N===0?M:N+T[A[N]]>M?N:M}},{"./common":41}],43:[function(i,o,h){o.exports=function(f,g,c,T){for(var P=65535&f|0,R=f>>>16&65535|0,A=0;c!==0;){for(c-=A=2e3>>1:g>>>1;c[T]=g}return c}();o.exports=function(g,c,T,P){var R=f,A=P+T;g^=-1;for(var M=P;M>>8^R[255&(g^c[M])];return-1^g}},{}],46:[function(i,o,h){var f,g=i("../utils/common"),c=i("./trees"),T=i("./adler32"),P=i("./crc32"),R=i("./messages"),A=0,M=4,N=0,Y=-2,j=-1,te=4,O=2,$=8,q=9,ne=286,oe=30,ke=19,ge=2*ne+1,Fe=15,Oe=3,We=258,it=We+Oe+1,ve=42,Ue=113,H=1,Re=2,vt=3,ye=4;function Be(V,je){return V.msg=R[je],je}function Le(V){return(V<<1)-(4V.avail_out&&(ie=V.avail_out),ie!==0&&(g.arraySet(V.output,je.pending_buf,je.pending_out,ie,V.next_out),V.next_out+=ie,je.pending_out+=ie,V.total_out+=ie,V.avail_out-=ie,je.pending-=ie,je.pending===0&&(je.pending_out=0))}function Ee(V,je){c._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,je),V.block_start=V.strstart,xe(V.strm)}function mt(V,je){V.pending_buf[V.pending++]=je}function nt(V,je){V.pending_buf[V.pending++]=je>>>8&255,V.pending_buf[V.pending++]=255&je}function rt(V,je){var ie,de,se=V.max_chain_length,Te=V.strstart,Ge=V.prev_length,tt=V.nice_match,Ne=V.strstart>V.w_size-it?V.strstart-(V.w_size-it):0,ot=V.window,kt=V.w_mask,at=V.prev,Bt=V.strstart+We,Tr=ot[Te+Ge-1],Ze=ot[Te+Ge];V.prev_length>=V.good_match&&(se>>=2),tt>V.lookahead&&(tt=V.lookahead);do if(ot[(ie=je)+Ge]===Ze&&ot[ie+Ge-1]===Tr&&ot[ie]===ot[Te]&&ot[++ie]===ot[Te+1]){Te+=2,ie++;do;while(ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&TeNe&&--se!=0);return Ge<=V.lookahead?Ge:V.lookahead}function Jt(V){var je,ie,de,se,Te,Ge,tt,Ne,ot,kt,at=V.w_size;do{if(se=V.window_size-V.lookahead-V.strstart,V.strstart>=at+(at-it)){for(g.arraySet(V.window,V.window,at,at,0),V.match_start-=at,V.strstart-=at,V.block_start-=at,je=ie=V.hash_size;de=V.head[--je],V.head[je]=at<=de?de-at:0,--ie;);for(je=ie=at;de=V.prev[--je],V.prev[je]=at<=de?de-at:0,--ie;);se+=at}if(V.strm.avail_in===0)break;if(Ge=V.strm,tt=V.window,Ne=V.strstart+V.lookahead,ot=se,kt=void 0,kt=Ge.avail_in,ot=Oe)for(Te=V.strstart-V.insert,V.ins_h=V.window[Te],V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe)if(de=c._tr_tally(V,V.strstart-V.match_start,V.match_length-Oe),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=Oe){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe&&V.match_length<=V.prev_length){for(se=V.strstart+V.lookahead-Oe,de=c._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-Oe),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=se&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ie=V.pending_buf_size-5);;){if(V.lookahead<=1){if(Jt(V),V.lookahead===0&&je===A)return H;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var de=V.block_start+ie;if((V.strstart===0||V.strstart>=de)&&(V.lookahead=V.strstart-de,V.strstart=de,Ee(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-it&&(Ee(V,!1),V.strm.avail_out===0))return H}return V.insert=0,je===M?(Ee(V,!0),V.strm.avail_out===0?vt:ye):(V.strstart>V.block_start&&(Ee(V,!1),V.strm.avail_out),H)}),new Yt(4,4,8,4,er),new Yt(4,5,16,8,er),new Yt(4,6,32,32,er),new Yt(4,4,16,16,Vt),new Yt(8,16,32,32,Vt),new Yt(8,16,128,128,Vt),new Yt(8,32,128,256,Vt),new Yt(32,128,258,1024,Vt),new Yt(32,258,258,4096,Vt)],h.deflateInit=function(V,je){return Xr(V,je,$,15,8,0)},h.deflateInit2=Xr,h.deflateReset=br,h.deflateResetKeep=fr,h.deflateSetHeader=function(V,je){return V&&V.state?V.state.wrap!==2?Y:(V.state.gzhead=je,N):Y},h.deflate=function(V,je){var ie,de,se,Te;if(!V||!V.state||5>8&255),mt(de,de.gzhead.time>>16&255),mt(de,de.gzhead.time>>24&255),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,255&de.gzhead.os),de.gzhead.extra&&de.gzhead.extra.length&&(mt(de,255&de.gzhead.extra.length),mt(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(V.adler=P(V.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=69):(mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,3),de.status=Ue);else{var Ge=$+(de.w_bits-8<<4)<<8;Ge|=(2<=de.strategy||de.level<2?0:de.level<6?1:de.level===6?2:3)<<6,de.strstart!==0&&(Ge|=32),Ge+=31-Ge%31,de.status=Ue,nt(de,Ge),de.strstart!==0&&(nt(de,V.adler>>>16),nt(de,65535&V.adler)),V.adler=1}if(de.status===69)if(de.gzhead.extra){for(se=de.pending;de.gzindex<(65535&de.gzhead.extra.length)&&(de.pending!==de.pending_buf_size||(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending!==de.pending_buf_size));)mt(de,255&de.gzhead.extra[de.gzindex]),de.gzindex++;de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=73)}else de.status=73;if(de.status===73)if(de.gzhead.name){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.gzindex=0,de.status=91)}else de.status=91;if(de.status===91)if(de.gzhead.comment){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.status=103)}else de.status=103;if(de.status===103&&(de.gzhead.hcrc?(de.pending+2>de.pending_buf_size&&xe(V),de.pending+2<=de.pending_buf_size&&(mt(de,255&V.adler),mt(de,V.adler>>8&255),V.adler=0,de.status=Ue)):de.status=Ue),de.pending!==0){if(xe(V),V.avail_out===0)return de.last_flush=-1,N}else if(V.avail_in===0&&Le(je)<=Le(ie)&&je!==M)return Be(V,-5);if(de.status===666&&V.avail_in!==0)return Be(V,-5);if(V.avail_in!==0||de.lookahead!==0||je!==A&&de.status!==666){var tt=de.strategy===2?function(Ne,ot){for(var kt;;){if(Ne.lookahead===0&&(Jt(Ne),Ne.lookahead===0)){if(ot===A)return H;break}if(Ne.match_length=0,kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,je):de.strategy===3?function(Ne,ot){for(var kt,at,Bt,Tr,Ze=Ne.window;;){if(Ne.lookahead<=We){if(Jt(Ne),Ne.lookahead<=We&&ot===A)return H;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=Oe&&0Ne.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=Oe?(kt=c._tr_tally(Ne,1,Ne.match_length-Oe),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,je):f[de.level].func(de,je);if(tt!==vt&&tt!==ye||(de.status=666),tt===H||tt===vt)return V.avail_out===0&&(de.last_flush=-1),N;if(tt===Re&&(je===1?c._tr_align(de):je!==5&&(c._tr_stored_block(de,0,0,!1),je===3&&(Xe(de.head),de.lookahead===0&&(de.strstart=0,de.block_start=0,de.insert=0))),xe(V),V.avail_out===0))return de.last_flush=-1,N}return je!==M?N:de.wrap<=0?1:(de.wrap===2?(mt(de,255&V.adler),mt(de,V.adler>>8&255),mt(de,V.adler>>16&255),mt(de,V.adler>>24&255),mt(de,255&V.total_in),mt(de,V.total_in>>8&255),mt(de,V.total_in>>16&255),mt(de,V.total_in>>24&255)):(nt(de,V.adler>>>16),nt(de,65535&V.adler)),xe(V),0=ie.w_size&&(Te===0&&(Xe(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),ot=new g.Buf8(ie.w_size),g.arraySet(ot,je,kt-ie.w_size,ie.w_size,0),je=ot,kt=ie.w_size),Ge=V.avail_in,tt=V.next_in,Ne=V.input,V.avail_in=kt,V.next_in=0,V.input=je,Jt(ie);ie.lookahead>=Oe;){for(de=ie.strstart,se=ie.lookahead-(Oe-1);ie.ins_h=(ie.ins_h<>>=Oe=Fe>>>24,q-=Oe,(Oe=Fe>>>16&255)===0)Re[R++]=65535&Fe;else{if(!(16&Oe)){if(!(64&Oe)){Fe=ne[(65535&Fe)+($&(1<>>=Oe,q-=Oe),q<15&&($+=H[T++]<>>=Oe=Fe>>>24,q-=Oe,!(16&(Oe=Fe>>>16&255))){if(!(64&Oe)){Fe=oe[(65535&Fe)+($&(1<>>=Oe,q-=Oe,(Oe=R-A)>3,$&=(1<<(q-=We<<3))-1,f.next_in=T,f.next_out=R,f.avail_in=T>>24&255)+(ve>>>8&65280)+((65280&ve)<<8)+((255&ve)<<24)}function $(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function q(ve){var Ue;return ve&&ve.state?(Ue=ve.state,ve.total_in=ve.total_out=Ue.total=0,ve.msg="",Ue.wrap&&(ve.adler=1&Ue.wrap),Ue.mode=Y,Ue.last=0,Ue.havedict=0,Ue.dmax=32768,Ue.head=null,Ue.hold=0,Ue.bits=0,Ue.lencode=Ue.lendyn=new f.Buf32(j),Ue.distcode=Ue.distdyn=new f.Buf32(te),Ue.sane=1,Ue.back=-1,M):N}function ne(ve){var Ue;return ve&&ve.state?((Ue=ve.state).wsize=0,Ue.whave=0,Ue.wnext=0,q(ve)):N}function oe(ve,Ue){var H,Re;return ve&&ve.state?(Re=ve.state,Ue<0?(H=0,Ue=-Ue):(H=1+(Ue>>4),Ue<48&&(Ue&=15)),Ue&&(Ue<8||15=ye.wsize?(f.arraySet(ye.window,Ue,H-ye.wsize,ye.wsize,0),ye.wnext=0,ye.whave=ye.wsize):(Re<(vt=ye.wsize-ye.wnext)&&(vt=Re),f.arraySet(ye.window,Ue,H-Re,vt,ye.wnext),(Re-=vt)?(f.arraySet(ye.window,Ue,H-Re,Re,0),ye.wnext=Re,ye.whave=ye.wsize):(ye.wnext+=vt,ye.wnext===ye.wsize&&(ye.wnext=0),ye.whave>>8&255,H.check=c(H.check,Te,2,0),Ee=xe=0,H.mode=2;break}if(H.flags=0,H.head&&(H.head.done=!1),!(1&H.wrap)||(((255&xe)<<8)+(xe>>8))%31){ve.msg="incorrect header check",H.mode=30;break}if((15&xe)!=8){ve.msg="unknown compression method",H.mode=30;break}if(Ee-=4,V=8+(15&(xe>>>=4)),H.wbits===0)H.wbits=V;else if(V>H.wbits){ve.msg="invalid window size",H.mode=30;break}H.dmax=1<>8&1),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=3;case 3:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,Te[2]=xe>>>16&255,Te[3]=xe>>>24&255,H.check=c(H.check,Te,4,0)),Ee=xe=0,H.mode=4;case 4:for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>8),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=5;case 5:if(1024&H.flags){for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0}else H.head&&(H.head.extra=null);H.mode=6;case 6:if(1024&H.flags&&(Le<(rt=H.length)&&(rt=Le),rt&&(H.head&&(V=H.head.extra_len-H.length,H.head.extra||(H.head.extra=new Array(H.head.extra_len)),f.arraySet(H.head.extra,Re,ye,rt,V)),512&H.flags&&(H.check=c(H.check,Re,rt,ye)),Le-=rt,ye+=rt,H.length-=rt),H.length))break e;H.length=0,H.mode=7;case 7:if(2048&H.flags){if(Le===0)break e;for(rt=0;V=Re[ye+rt++],H.head&&V&&H.length<65536&&(H.head.name+=String.fromCharCode(V)),V&&rt>9&1,H.head.done=!0),ve.adler=H.check=0,H.mode=12;break;case 10:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=7&Ee,Ee-=7&Ee,H.mode=27;break}for(;Ee<3;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=1)){case 0:H.mode=14;break;case 1:if(We(H),H.mode=20,Ue!==6)break;xe>>>=2,Ee-=2;break e;case 2:H.mode=17;break;case 3:ve.msg="invalid block type",H.mode=30}xe>>>=2,Ee-=2;break;case 14:for(xe>>>=7&Ee,Ee-=7&Ee;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>16^65535)){ve.msg="invalid stored block lengths",H.mode=30;break}if(H.length=65535&xe,Ee=xe=0,H.mode=15,Ue===6)break e;case 15:H.mode=16;case 16:if(rt=H.length){if(Le>>=5,Ee-=5,H.ndist=1+(31&xe),xe>>>=5,Ee-=5,H.ncode=4+(15&xe),xe>>>=4,Ee-=4,286>>=3,Ee-=3}for(;H.have<19;)H.lens[Ge[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,ie={bits:H.lenbits},je=P(0,H.lens,0,19,H.lencode,0,H.work,ie),H.lenbits=ie.bits,je){ve.msg="invalid code lengths set",H.mode=30;break}H.have=0,H.mode=19;case 19:for(;H.have>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=Vt,Ee-=Vt,H.lens[H.have++]=_r;else{if(_r===16){for(de=Vt+2;Ee>>=Vt,Ee-=Vt,H.have===0){ve.msg="invalid bit length repeat",H.mode=30;break}V=H.lens[H.have-1],rt=3+(3&xe),xe>>>=2,Ee-=2}else if(_r===17){for(de=Vt+3;Ee>>=Vt)),xe>>>=3,Ee-=3}else{for(de=Vt+7;Ee>>=Vt)),xe>>>=7,Ee-=7}if(H.have+rt>H.nlen+H.ndist){ve.msg="invalid bit length repeat",H.mode=30;break}for(;rt--;)H.lens[H.have++]=V}}if(H.mode===30)break;if(H.lens[256]===0){ve.msg="invalid code -- missing end-of-block",H.mode=30;break}if(H.lenbits=9,ie={bits:H.lenbits},je=P(R,H.lens,0,H.nlen,H.lencode,0,H.work,ie),H.lenbits=ie.bits,je){ve.msg="invalid literal/lengths set",H.mode=30;break}if(H.distbits=6,H.distcode=H.distdyn,ie={bits:H.distbits},je=P(A,H.lens,H.nlen,H.ndist,H.distcode,0,H.work,ie),H.distbits=ie.bits,je){ve.msg="invalid distances set",H.mode=30;break}if(H.mode=20,Ue===6)break e;case 20:H.mode=21;case 21:if(6<=Le&&258<=Xe){ve.next_out=Be,ve.avail_out=Xe,ve.next_in=ye,ve.avail_in=Le,H.hold=xe,H.bits=Ee,T(ve,nt),Be=ve.next_out,vt=ve.output,Xe=ve.avail_out,ye=ve.next_in,Re=ve.input,Le=ve.avail_in,xe=H.hold,Ee=H.bits,H.mode===12&&(H.back=-1);break}for(H.back=0;Yt=(se=H.lencode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,H.length=_r,Yt===0){H.mode=26;break}if(32&Yt){H.back=-1,H.mode=12;break}if(64&Yt){ve.msg="invalid literal/length code",H.mode=30;break}H.extra=15&Yt,H.mode=22;case 22:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=23;case 23:for(;Yt=(se=H.distcode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,64&Yt){ve.msg="invalid distance code",H.mode=30;break}H.offset=_r,H.extra=15&Yt,H.mode=24;case 24:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}if(H.offset>H.dmax){ve.msg="invalid distance too far back",H.mode=30;break}H.mode=25;case 25:if(Xe===0)break e;if(rt=nt-Xe,H.offset>rt){if((rt=H.offset-rt)>H.whave&&H.sane){ve.msg="invalid distance too far back",H.mode=30;break}Jt=rt>H.wnext?(rt-=H.wnext,H.wsize-rt):H.wnext-rt,rt>H.length&&(rt=H.length),er=H.window}else er=vt,Jt=Be-H.offset,rt=H.length;for(Xege?(Oe=Jt[er+te[Ue]],Ee[mt+te[Ue]]):(Oe=96,0),$=1<>Be)+(q-=$)]=Fe<<24|Oe<<16|We|0,q!==0;);for($=1<>=1;if($!==0?(xe&=$-1,xe+=$):xe=0,Ue++,--nt[ve]==0){if(ve===Re)break;ve=A[M+te[Ue]]}if(vt>>7)]}function mt(se,Te){se.pending_buf[se.pending++]=255&Te,se.pending_buf[se.pending++]=Te>>>8&255}function nt(se,Te,Ge){se.bi_valid>O-Ge?(se.bi_buf|=Te<>O-se.bi_valid,se.bi_valid+=Ge-O):(se.bi_buf|=Te<>>=1,Ge<<=1,0<--Te;);return Ge>>>1}function er(se,Te,Ge){var tt,Ne,ot=new Array(te+1),kt=0;for(tt=1;tt<=te;tt++)ot[tt]=kt=kt+Ge[tt-1]<<1;for(Ne=0;Ne<=Te;Ne++){var at=se[2*Ne+1];at!==0&&(se[2*Ne]=Jt(ot[at]++,at))}}function Vt(se){var Te;for(Te=0;Te>1;1<=Ge;Ge--)fr(se,ot,Ge);for(Ne=Bt;Ge=se.heap[1],se.heap[1]=se.heap[se.heap_len--],fr(se,ot,1),tt=se.heap[1],se.heap[--se.heap_max]=Ge,se.heap[--se.heap_max]=tt,ot[2*Ne]=ot[2*Ge]+ot[2*tt],se.depth[Ne]=(se.depth[Ge]>=se.depth[tt]?se.depth[Ge]:se.depth[tt])+1,ot[2*Ge+1]=ot[2*tt+1]=Ne,se.heap[1]=Ne++,fr(se,ot,1),2<=se.heap_len;);se.heap[--se.heap_max]=se.heap[1],function(Ze,tn){var _n,vn,pi,Qe,Kt,Ut,Kr=tn.dyn_tree,mi=tn.max_code,Xt=tn.stat_desc.static_tree,Yi=tn.stat_desc.has_stree,fs=tn.stat_desc.extra_bits,ps=tn.stat_desc.extra_base,Hn=tn.stat_desc.max_length,he=0;for(Qe=0;Qe<=te;Qe++)Ze.bl_count[Qe]=0;for(Kr[2*Ze.heap[Ze.heap_max]+1]=0,_n=Ze.heap_max+1;_n>=7;Ne>>=1)if(1&Tr&&at.dyn_ltree[2*Bt]!==0)return g;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return c;for(Bt=32;Bt>>3,(ot=se.static_len+3+7>>>3)<=Ne&&(Ne=ot)):Ne=ot=Ge+5,Ge+4<=Ne&&Te!==-1?de(se,Te,Ge,tt):se.strategy===4||ot===Ne?(nt(se,2+(tt?1:0),3),br(se,it,ve)):(nt(se,4+(tt?1:0),3),function(at,Bt,Tr,Ze){var tn;for(nt(at,Bt-257,5),nt(at,Tr-1,5),nt(at,Ze-4,4),tn=0;tn>>8&255,se.pending_buf[se.d_buf+2*se.last_lit+1]=255&Te,se.pending_buf[se.l_buf+se.last_lit]=255&Ge,se.last_lit++,Te===0?se.dyn_ltree[2*Ge]++:(se.matches++,Te--,se.dyn_ltree[2*(H[Ge]+A+1)]++,se.dyn_dtree[2*Ee(Te)]++),se.last_lit===se.lit_bufsize-1},h._tr_align=function(se){nt(se,2,3),rt(se,q,it),function(Te){Te.bi_valid===16?(mt(Te,Te.bi_buf),Te.bi_buf=0,Te.bi_valid=0):8<=Te.bi_valid&&(Te.pending_buf[Te.pending++]=255&Te.bi_buf,Te.bi_buf>>=8,Te.bi_valid-=8)}(se)}},{"../utils/common":41}],53:[function(i,o,h){o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,o,h){(function(f){(function(g,c){if(!g.setImmediate){var T,P,R,A,M=1,N={},Y=!1,j=g.document,te=Object.getPrototypeOf&&Object.getPrototypeOf(g);te=te&&te.setTimeout?te:g,T={}.toString.call(g.process)==="[object process]"?function(ne){process.nextTick(function(){$(ne)})}:function(){if(g.postMessage&&!g.importScripts){var ne=!0,oe=g.onmessage;return g.onmessage=function(){ne=!1},g.postMessage("","*"),g.onmessage=oe,ne}}()?(A="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",q,!1):g.attachEvent("onmessage",q),function(ne){g.postMessage(A+ne,"*")}):g.MessageChannel?((R=new MessageChannel).port1.onmessage=function(ne){$(ne.data)},function(ne){R.port2.postMessage(ne)}):j&&"onreadystatechange"in j.createElement("script")?(P=j.documentElement,function(ne){var oe=j.createElement("script");oe.onreadystatechange=function(){$(ne),oe.onreadystatechange=null,P.removeChild(oe),oe=null},P.appendChild(oe)}):function(ne){setTimeout($,0,ne)},te.setImmediate=function(ne){typeof ne!="function"&&(ne=new Function(""+ne));for(var oe=new Array(arguments.length-1),ke=0;ke"u"?f===void 0?this:f:self)}).call(this,typeof ff<"u"?ff:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(OI);var Q5=OI.exports;const eL=dp(Q5);var $1=function(e,t){return $1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(i[h]=o[h])},$1(e,t)};function no(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");$1(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var Ft=function(){return Ft=Object.assign||function(t){for(var i,o=1,h=arguments.length;o"u"&&(f=e.call(this,o),t.set(h,f)),f}function BI(e,t,i){var o=Array.prototype.slice.call(arguments,3),h=i(o),f=t.get(h);return typeof f>"u"&&(f=e.apply(this,o),t.set(h,f)),f}function vw(e,t,i,o,h){return i.bind(t,e,o,h)}function rL(e,t){var i=e.length===1?FI:BI;return vw(e,this,i,t.cache.create(),t.serializer)}function nL(e,t){return vw(e,this,BI,t.cache.create(),t.serializer)}function iL(e,t){return vw(e,this,FI,t.cache.create(),t.serializer)}var sL=function(){return JSON.stringify(arguments)};function xw(){this.cache=Object.create(null)}xw.prototype.get=function(e){return this.cache[e]};xw.prototype.set=function(e,t){this.cache[e]=t};var oL={create:function(){return new xw}},Ui={variadic:nL,monadic:iL};function NI(e,t,i){if(i===void 0&&(i=Error),!e)throw new i(t)}$i(function(){for(var e,t=[],i=0;i0}),i=[],o=0,h=t;o1)throw new RangeError("integer-width stems only accept a single optional option");h.options[0].replace(pL,function(T,P,R,A,M,N){if(P)t.minimumIntegerDigits=R.length;else{if(A&&M)throw new Error("We currently do not support maximum integer digits");if(N)throw new Error("We currently do not support exact integer digits")}return""});continue}if(YI.test(h.stem)){t.minimumIntegerDigits=h.stem.length;continue}if(Ak.test(h.stem)){if(h.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");h.stem.replace(Ak,function(T,P,R,A,M,N){return R==="*"?t.minimumFractionDigits=P.length:A&&A[0]==="#"?t.maximumFractionDigits=A.length:M&&N?(t.minimumFractionDigits=M.length,t.maximumFractionDigits=M.length+N.length):(t.minimumFractionDigits=P.length,t.maximumFractionDigits=P.length),""});var f=h.options[0];f==="w"?t=Ft(Ft({},t),{trailingZeroDisplay:"stripIfInteger"}):f&&(t=Ft(Ft({},t),Dk(f)));continue}if(qI.test(h.stem)){t=Ft(Ft({},t),Dk(h.stem));continue}var g=XI(h.stem);g&&(t=Ft(Ft({},t),g));var c=mL(h.stem);c&&(t=Ft(Ft({},t),c))}return t}var Jm={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function yL(e,t){for(var i="",o=0;o>1),T="a",P=_L(t);for((P=="H"||P=="k")&&(c=0);c-- >0;)i+=T;for(;g-- >0;)i=P+i}else h==="J"?i+="H":i+=h}return i}function _L(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var i=e.language,o;i!=="root"&&(o=e.maximize().region);var h=Jm[o||""]||Jm[i||""]||Jm["".concat(i,"-001")]||Jm["001"];return h[0]}var wv,vL=new RegExp("^".concat(ZI.source,"*")),xL=new RegExp("".concat(ZI.source,"*$"));function Cr(e,t){return{start:e,end:t}}var wL=!!String.prototype.startsWith&&"_a".startsWith("a",1),bL=!!String.fromCodePoint,SL=!!Object.fromEntries,kL=!!String.prototype.codePointAt,TL=!!String.prototype.trimStart,EL=!!String.prototype.trimEnd,CL=!!Number.isSafeInteger,IL=CL?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},j1=!0;try{var PL=JI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");j1=((wv=PL.exec("a"))===null||wv===void 0?void 0:wv[0])==="a"}catch{j1=!1}var Rk=wL?function(t,i,o){return t.startsWith(i,o)}:function(t,i,o){return t.slice(o,o+i.length)===i},V1=bL?String.fromCodePoint:function(){for(var t=[],i=0;if;){if(g=t[f++],g>1114111)throw RangeError(g+" is not a valid code point");o+=g<65536?String.fromCharCode(g):String.fromCharCode(((g-=65536)>>10)+55296,g%1024+56320)}return o},Lk=SL?Object.fromEntries:function(t){for(var i={},o=0,h=t;o=o)){var h=t.charCodeAt(i),f;return h<55296||h>56319||i+1===o||(f=t.charCodeAt(i+1))<56320||f>57343?h:(h-55296<<10)+(f-56320)+65536}},ML=TL?function(t){return t.trimStart()}:function(t){return t.replace(vL,"")},AL=EL?function(t){return t.trimEnd()}:function(t){return t.replace(xL,"")};function JI(e,t){return new RegExp(e,t)}var H1;if(j1){var Ok=JI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");H1=function(t,i){var o;Ok.lastIndex=i;var h=Ok.exec(t);return(o=h[1])!==null&&o!==void 0?o:""}}else H1=function(t,i){for(var o=[];;){var h=KI(t,i);if(h===void 0||QI(h)||LL(h))break;o.push(h),i+=h>=65536?2:1}return V1.apply(void 0,o)};var DL=function(){function e(t,i){i===void 0&&(i={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!i.ignoreTag,this.locale=i.locale,this.requiresOtherClause=!!i.requiresOtherClause,this.shouldParseSkeletons=!!i.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,i,o){for(var h=[];!this.isEOF();){var f=this.char();if(f===123){var g=this.parseArgument(t,o);if(g.err)return g;h.push(g.val)}else{if(f===125&&t>0)break;if(f===35&&(i==="plural"||i==="selectordinal")){var c=this.clonePosition();this.bump(),h.push({type:an.pound,location:Cr(c,this.clonePosition())})}else if(f===60&&!this.ignoreTag&&this.peek()===47){if(o)break;return this.error(kr.UNMATCHED_CLOSING_TAG,Cr(this.clonePosition(),this.clonePosition()))}else if(f===60&&!this.ignoreTag&&W1(this.peek()||0)){var g=this.parseTag(t,i);if(g.err)return g;h.push(g.val)}else{var g=this.parseLiteral(t,i);if(g.err)return g;h.push(g.val)}}}return{val:h,err:null}},e.prototype.parseTag=function(t,i){var o=this.clonePosition();this.bump();var h=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:an.literal,value:"<".concat(h,"/>"),location:Cr(o,this.clonePosition())},err:null};if(this.bumpIf(">")){var f=this.parseMessage(t+1,i,!0);if(f.err)return f;var g=f.val,c=this.clonePosition();if(this.bumpIf("")?{val:{type:an.tag,value:h,children:g,location:Cr(o,this.clonePosition())},err:null}:this.error(kr.INVALID_TAG,Cr(c,this.clonePosition())))}else return this.error(kr.UNCLOSED_TAG,Cr(o,this.clonePosition()))}else return this.error(kr.INVALID_TAG,Cr(o,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&RL(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,i){for(var o=this.clonePosition(),h="";;){var f=this.tryParseQuote(i);if(f){h+=f;continue}var g=this.tryParseUnquoted(t,i);if(g){h+=g;continue}var c=this.tryParseLeftAngleBracket();if(c){h+=c;continue}break}var T=Cr(o,this.clonePosition());return{val:{type:an.literal,value:h,location:T},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!zL(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var i=[this.char()];for(this.bump();!this.isEOF();){var o=this.char();if(o===39)if(this.peek()===39)i.push(39),this.bump();else{this.bump();break}else i.push(o);this.bump()}return V1.apply(void 0,i)},e.prototype.tryParseUnquoted=function(t,i){if(this.isEOF())return null;var o=this.char();return o===60||o===123||o===35&&(i==="plural"||i==="selectordinal")||o===125&&t>0?null:(this.bump(),V1(o))},e.prototype.parseArgument=function(t,i){var o=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(kr.EMPTY_ARGUMENT,Cr(o,this.clonePosition()));var h=this.parseIdentifierIfPossible().value;if(!h)return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:an.argument,value:h,location:Cr(o,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition())):this.parseArgumentOptions(t,i,h,o);default:return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),i=this.offset(),o=H1(this.message,i),h=i+o.length;this.bumpTo(h);var f=this.clonePosition(),g=Cr(t,f);return{value:o,location:g}},e.prototype.parseArgumentOptions=function(t,i,o,h){var f,g=this.clonePosition(),c=this.parseIdentifierIfPossible().value,T=this.clonePosition();switch(c){case"":return this.error(kr.EXPECT_ARGUMENT_TYPE,Cr(g,T));case"number":case"date":case"time":{this.bumpSpace();var P=null;if(this.bumpIf(",")){this.bumpSpace();var R=this.clonePosition(),A=this.parseSimpleArgStyleIfPossible();if(A.err)return A;var M=AL(A.val);if(M.length===0)return this.error(kr.EXPECT_ARGUMENT_STYLE,Cr(this.clonePosition(),this.clonePosition()));var N=Cr(R,this.clonePosition());P={style:M,styleLocation:N}}var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var j=Cr(h,this.clonePosition());if(P&&Rk(P==null?void 0:P.style,"::",0)){var te=ML(P.style.slice(2));if(c==="number"){var A=this.parseNumberSkeletonFromString(te,P.styleLocation);return A.err?A:{val:{type:an.number,value:o,location:j,style:A.val},err:null}}else{if(te.length===0)return this.error(kr.EXPECT_DATE_TIME_SKELETON,j);var O=te;this.locale&&(O=yL(te,this.locale));var M={type:Lh.dateTime,pattern:O,location:P.styleLocation,parsedOptions:this.shouldParseSkeletons?cL(O):{}},$=c==="date"?an.date:an.time;return{val:{type:$,value:o,location:j,style:M},err:null}}}return{val:{type:c==="number"?an.number:c==="date"?an.date:an.time,value:o,location:j,style:(f=P==null?void 0:P.style)!==null&&f!==void 0?f:null},err:null}}case"plural":case"selectordinal":case"select":{var q=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(kr.EXPECT_SELECT_ARGUMENT_OPTIONS,Cr(q,Ft({},q)));this.bumpSpace();var ne=this.parseIdentifierIfPossible(),oe=0;if(c!=="select"&&ne.value==="offset"){if(!this.bumpIf(":"))return this.error(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Cr(this.clonePosition(),this.clonePosition()));this.bumpSpace();var A=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,kr.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(A.err)return A;this.bumpSpace(),ne=this.parseIdentifierIfPossible(),oe=A.val}var ke=this.tryParsePluralOrSelectOptions(t,c,i,ne);if(ke.err)return ke;var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var ge=Cr(h,this.clonePosition());return c==="select"?{val:{type:an.select,value:o,options:Lk(ke.val),location:ge},err:null}:{val:{type:an.plural,value:o,options:Lk(ke.val),offset:oe,pluralType:c==="plural"?"cardinal":"ordinal",location:ge},err:null}}default:return this.error(kr.INVALID_ARGUMENT_TYPE,Cr(g,T))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,i=this.clonePosition();!this.isEOF();){var o=this.char();switch(o){case 39:{this.bump();var h=this.clonePosition();if(!this.bumpUntil("'"))return this.error(kr.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Cr(h,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(i.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(i.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,i){var o=[];try{o=dL(t)}catch{return this.error(kr.INVALID_NUMBER_SKELETON,i)}return{val:{type:Lh.number,tokens:o,location:i,parsedOptions:this.shouldParseSkeletons?gL(o):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,i,o,h){for(var f,g=!1,c=[],T=new Set,P=h.value,R=h.location;;){if(P.length===0){var A=this.clonePosition();if(i!=="select"&&this.bumpIf("=")){var M=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,kr.INVALID_PLURAL_ARGUMENT_SELECTOR);if(M.err)return M;R=Cr(A,this.clonePosition()),P=this.message.slice(A.offset,this.offset())}else break}if(T.has(P))return this.error(i==="select"?kr.DUPLICATE_SELECT_ARGUMENT_SELECTOR:kr.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,R);P==="other"&&(g=!0),this.bumpSpace();var N=this.clonePosition();if(!this.bumpIf("{"))return this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Cr(this.clonePosition(),this.clonePosition()));var Y=this.parseMessage(t+1,i,o);if(Y.err)return Y;var j=this.tryParseArgumentClose(N);if(j.err)return j;c.push([P,{value:Y.val,location:Cr(N,this.clonePosition())}]),T.add(P),this.bumpSpace(),f=this.parseIdentifierIfPossible(),P=f.value,R=f.location}return c.length===0?this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,Cr(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!g?this.error(kr.MISSING_OTHER_CLAUSE,Cr(this.clonePosition(),this.clonePosition())):{val:c,err:null}},e.prototype.tryParseDecimalInteger=function(t,i){var o=1,h=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(o=-1);for(var f=!1,g=0;!this.isEOF();){var c=this.char();if(c>=48&&c<=57)f=!0,g=g*10+(c-48),this.bump();else break}var T=Cr(h,this.clonePosition());return f?(g*=o,IL(g)?{val:g,err:null}:this.error(i,T)):this.error(t,T)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var i=KI(this.message,t);if(i===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return i},e.prototype.error=function(t,i){return{val:null,err:{kind:t,message:this.message,location:i}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(Rk(this.message,t,this.offset())){for(var i=0;i=0?(this.bumpTo(o),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var i=this.offset();if(i===t)break;if(i>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&QI(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),i=this.offset(),o=this.message.charCodeAt(i+(t>=65536?2:1));return o??null},e}();function W1(e){return e>=97&&e<=122||e>=65&&e<=90}function zL(e){return W1(e)||e===47}function RL(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function QI(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function LL(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function G1(e){e.forEach(function(t){if(delete t.location,VI(t)||HI(t))for(var i in t.options)delete t.options[i].location,G1(t.options[i].value);else $I(t)&&GI(t.style)||(UI(t)||jI(t))&&U1(t.style)?delete t.style.location:WI(t)&&G1(t.children)})}function OL(e,t){t===void 0&&(t={}),t=Ft({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var i=new DL(e,t).parse();if(i.err){var o=SyntaxError(kr[i.err.kind]);throw o.location=i.err.location,o.originalMessage=i.err.message,o}return t!=null&&t.captureLocation||G1(i.val),i.val}var Zo;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(Zo||(Zo={}));var Gl=function(e){no(t,e);function t(i,o,h){var f=e.call(this,i)||this;return f.code=o,f.originalMessage=h,f}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Fk=function(e){no(t,e);function t(i,o,h,f){return e.call(this,'Invalid values for "'.concat(i,'": "').concat(o,'". Options are "').concat(Object.keys(h).join('", "'),'"'),Zo.INVALID_VALUE,f)||this}return t}(Gl),FL=function(e){no(t,e);function t(i,o,h){return e.call(this,'Value for "'.concat(i,'" must be of type ').concat(o),Zo.INVALID_VALUE,h)||this}return t}(Gl),BL=function(e){no(t,e);function t(i,o){return e.call(this,'The intl string context variable "'.concat(i,'" was not provided to the string "').concat(o,'"'),Zo.MISSING_VALUE,o)||this}return t}(Gl),Bi;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(Bi||(Bi={}));function NL(e){return e.length<2?e:e.reduce(function(t,i){var o=t[t.length-1];return!o||o.type!==Bi.literal||i.type!==Bi.literal?t.push(i):o.value+=i.value,t},[])}function eP(e){return typeof e=="function"}function kg(e,t,i,o,h,f,g){if(e.length===1&&Mk(e[0]))return[{type:Bi.literal,value:e[0].value}];for(var c=[],T=0,P=e;T>2,N=(3&P)<<4|R>>4,Y=1>6:64,U=2>4,R=(15&M)<<4|(N=c.indexOf(T.charAt(U++)))>>2,A=(3&N)<<6|(Y=c.indexOf(T.charAt(U++))),$[te++]=P,N!==64&&($[te++]=R),Y!==64&&($[te++]=A);return $}},{"./support":30,"./utils":32}],2:[function(i,o,h){var f=i("./external"),g=i("./stream/DataWorker"),c=i("./stream/Crc32Probe"),T=i("./stream/DataLengthProbe");function P(R,A,M,N,Y){this.compressedSize=R,this.uncompressedSize=A,this.crc32=M,this.compression=N,this.compressedContent=Y}P.prototype={getContentWorker:function(){var R=new g(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new T("data_length")),A=this;return R.on("end",function(){if(this.streamInfo.data_length!==A.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),R},getCompressedWorker:function(){return new g(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},P.createWorkerFrom=function(R,A,M){return R.pipe(new c).pipe(new T("uncompressedSize")).pipe(A.compressWorker(M)).pipe(new T("compressedSize")).withStreamInfo("compression",A)},o.exports=P},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,o,h){var f=i("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},h.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,o,h){var f=i("./utils"),g=function(){for(var c,T=[],P=0;P<256;P++){c=P;for(var R=0;R<8;R++)c=1&c?3988292384^c>>>1:c>>>1;T[P]=c}return T}();o.exports=function(c,T){return c!==void 0&&c.length?f.getTypeOf(c)!=="string"?function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var U=M;U>>8^N[255&(P^R[U])];return-1^P}(0|T,c,c.length,0):function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var U=M;U>>8^N[255&(P^R.charCodeAt(U))];return-1^P}(0|T,c,c.length,0):0}},{"./utils":32}],5:[function(i,o,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(i,o,h){var f=null;f=typeof Promise<"u"?Promise:i("lie"),o.exports={Promise:f}},{lie:37}],7:[function(i,o,h){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=i("pako"),c=i("./utils"),T=i("./stream/GenericWorker"),P=f?"uint8array":"array";function R(A,M){T.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=M,this.meta={}}h.magic="\b\0",c.inherits(R,T),R.prototype.processChunk=function(A){this.meta=A.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(P,A.data),!1)},R.prototype.flush=function(){T.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},R.prototype.cleanUp=function(){T.prototype.cleanUp.call(this),this._pako=null},R.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(M){A.push({data:M,meta:A.meta})}},h.compressWorker=function(A){return new R("Deflate",A)},h.uncompressWorker=function(){return new R("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,o,h){function f(N,Y){var U,te="";for(U=0;U>>=8;return te}function g(N,Y,U,te,O,$){var q,ne,oe=N.file,ke=N.compression,ge=$!==P.utf8encode,Fe=c.transformTo("string",$(oe.name)),Oe=c.transformTo("string",P.utf8encode(oe.name)),Ge=oe.comment,it=c.transformTo("string",$(Ge)),ve=c.transformTo("string",P.utf8encode(Ge)),je=Oe.length!==oe.name.length,H=ve.length!==Ge.length,Re="",vt="",ye="",Be=oe.dir,Le=oe.date,Ke={crc32:0,compressedSize:0,uncompressedSize:0};Y&&!U||(Ke.crc32=N.crc32,Ke.compressedSize=N.compressedSize,Ke.uncompressedSize=N.uncompressedSize);var xe=0;Y&&(xe|=8),ge||!je&&!H||(xe|=2048);var Ee=0,mt=0;Be&&(Ee|=16),O==="UNIX"?(mt=798,Ee|=function(rt,Jt){var er=rt;return rt||(er=Jt?16893:33204),(65535&er)<<16}(oe.unixPermissions,Be)):(mt=20,Ee|=function(rt){return 63&(rt||0)}(oe.dosPermissions)),q=Le.getUTCHours(),q<<=6,q|=Le.getUTCMinutes(),q<<=5,q|=Le.getUTCSeconds()/2,ne=Le.getUTCFullYear()-1980,ne<<=4,ne|=Le.getUTCMonth()+1,ne<<=5,ne|=Le.getUTCDate(),je&&(vt=f(1,1)+f(R(Fe),4)+Oe,Re+="up"+f(vt.length,2)+vt),H&&(ye=f(1,1)+f(R(it),4)+ve,Re+="uc"+f(ye.length,2)+ye);var nt="";return nt+=` +\0`,nt+=f(xe,2),nt+=ke.magic,nt+=f(q,2),nt+=f(ne,2),nt+=f(Ke.crc32,4),nt+=f(Ke.compressedSize,4),nt+=f(Ke.uncompressedSize,4),nt+=f(Fe.length,2),nt+=f(Re.length,2),{fileRecord:A.LOCAL_FILE_HEADER+nt+Fe+Re,dirRecord:A.CENTRAL_FILE_HEADER+f(mt,2)+nt+f(it.length,2)+"\0\0\0\0"+f(Ee,4)+f(te,4)+Fe+Re+it}}var c=i("../utils"),T=i("../stream/GenericWorker"),P=i("../utf8"),R=i("../crc32"),A=i("../signature");function M(N,Y,U,te){T.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=te,this.streamFiles=N,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(M,T),M.prototype.push=function(N){var Y=N.meta.percent||0,U=this.entriesCount,te=this._sources.length;this.accumulate?this.contentBuffer.push(N):(this.bytesWritten+=N.data.length,T.prototype.push.call(this,{data:N.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-te-1))/U:100}}))},M.prototype.openedSource=function(N){this.currentSourceOffset=this.bytesWritten,this.currentFile=N.file.name;var Y=this.streamFiles&&!N.file.dir;if(Y){var U=g(N,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0},M.prototype.closedSource=function(N){this.accumulate=!1;var Y=this.streamFiles&&!N.file.dir,U=g(N,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:function(te){return A.DATA_DESCRIPTOR+f(te.crc32,4)+f(te.compressedSize,4)+f(te.uncompressedSize,4)}(N),meta:{percent:100}});else for(this.push({data:U.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},M.prototype.flush=function(){for(var N=this.bytesWritten,Y=0;Y=this.index;T--)P=(P<<8)+this.byteAt(T);return this.index+=c,P},readString:function(c){return f.transformTo("string",this.readData(c))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var c=this.readInt(4);return new Date(Date.UTC(1980+(c>>25&127),(c>>21&15)-1,c>>16&31,c>>11&31,c>>5&63,(31&c)<<1))}},o.exports=g},{"../utils":32}],19:[function(i,o,h){var f=i("./Uint8ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,o,h){var f=i("./DataReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},g.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},g.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./DataReader":18}],21:[function(i,o,h){var f=i("./ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){if(this.checkOffset(c),c===0)return new Uint8Array(0);var T=this.data.subarray(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(i,o,h){var f=i("../utils"),g=i("../support"),c=i("./ArrayReader"),T=i("./StringReader"),P=i("./NodeBufferReader"),R=i("./Uint8ArrayReader");o.exports=function(A){var M=f.getTypeOf(A);return f.checkSupport(M),M!=="string"||g.uint8array?M==="nodebuffer"?new P(A):g.uint8array?new R(f.transformTo("uint8array",A)):new c(f.transformTo("array",A)):new T(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,o,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,o,h){var f=i("./GenericWorker"),g=i("../utils");function c(T){f.call(this,"ConvertWorker to "+T),this.destType=T}g.inherits(c,f),c.prototype.processChunk=function(T){this.push({data:g.transformTo(this.destType,T.data),meta:T.meta})},o.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(i,o,h){var f=i("./GenericWorker"),g=i("../crc32");function c(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(c,f),c.prototype.processChunk=function(T){this.streamInfo.crc32=g(T.data,this.streamInfo.crc32||0),this.push(T)},o.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataLengthProbe for "+T),this.propName=T,this.withStreamInfo(T,0)}f.inherits(c,g),c.prototype.processChunk=function(T){if(T){var P=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=P+T.data.length}g.prototype.processChunk.call(this,T)},o.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataWorker");var P=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,T.then(function(R){P.dataIsReady=!0,P.data=R,P.max=R&&R.length||0,P.type=f.getTypeOf(R),P.isPaused||P._tickAndRepeat()},function(R){P.error(R)})}f.inherits(c,g),c.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var T=null,P=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":T=this.data.substring(this.index,P);break;case"uint8array":T=this.data.subarray(this.index,P);break;case"array":case"nodebuffer":T=this.data.slice(this.index,P)}return this.index=P,this.push({data:T,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(i,o,h){function f(g){this.name=g||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,c){return this._listeners[g].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,c){if(this._listeners[g])for(var T=0;T "+g:g}},o.exports=f},{}],29:[function(i,o,h){var f=i("../utils"),g=i("./ConvertWorker"),c=i("./GenericWorker"),T=i("../base64"),P=i("../support"),R=i("../external"),A=null;if(P.nodestream)try{A=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function M(Y,U){return new R.Promise(function(te,O){var $=[],q=Y._internalType,ne=Y._outputType,oe=Y._mimeType;Y.on("data",function(ke,ge){$.push(ke),U&&U(ge)}).on("error",function(ke){$=[],O(ke)}).on("end",function(){try{var ke=function(ge,Fe,Oe){switch(ge){case"blob":return f.newBlob(f.transformTo("arraybuffer",Fe),Oe);case"base64":return T.encode(Fe);default:return f.transformTo(ge,Fe)}}(ne,function(ge,Fe){var Oe,Ge=0,it=null,ve=0;for(Oe=0;Oe"u")h.blob=!1;else{var f=new ArrayBuffer(0);try{h.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(f),h.blob=g.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!i("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(i,o,h){for(var f=i("./utils"),g=i("./support"),c=i("./nodejsUtils"),T=i("./stream/GenericWorker"),P=new Array(256),R=0;R<256;R++)P[R]=252<=R?6:248<=R?5:240<=R?4:224<=R?3:192<=R?2:1;P[254]=P[254]=1;function A(){T.call(this,"utf-8 decode"),this.leftOver=null}function M(){T.call(this,"utf-8 encode")}h.utf8encode=function(N){return g.nodebuffer?c.newBufferFrom(N,"utf-8"):function(Y){var U,te,O,$,q,ne=Y.length,oe=0;for($=0;$>>6:(te<65536?U[q++]=224|te>>>12:(U[q++]=240|te>>>18,U[q++]=128|te>>>12&63),U[q++]=128|te>>>6&63),U[q++]=128|63&te);return U}(N)},h.utf8decode=function(N){return g.nodebuffer?f.transformTo("nodebuffer",N).toString("utf-8"):function(Y){var U,te,O,$,q=Y.length,ne=new Array(2*q);for(U=te=0;U>10&1023,ne[te++]=56320|1023&O)}return ne.length!==te&&(ne.subarray?ne=ne.subarray(0,te):ne.length=te),f.applyFromCharCode(ne)}(N=f.transformTo(g.uint8array?"uint8array":"array",N))},f.inherits(A,T),A.prototype.processChunk=function(N){var Y=f.transformTo(g.uint8array?"uint8array":"array",N.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var U=Y;(Y=new Uint8Array(U.length+this.leftOver.length)).set(this.leftOver,0),Y.set(U,this.leftOver.length)}else Y=this.leftOver.concat(Y);this.leftOver=null}var te=function($,q){var ne;for((q=q||$.length)>$.length&&(q=$.length),ne=q-1;0<=ne&&(192&$[ne])==128;)ne--;return ne<0||ne===0?q:ne+P[$[ne]]>q?ne:q}(Y),O=Y;te!==Y.length&&(g.uint8array?(O=Y.subarray(0,te),this.leftOver=Y.subarray(te,Y.length)):(O=Y.slice(0,te),this.leftOver=Y.slice(te,Y.length))),this.push({data:h.utf8decode(O),meta:N.meta})},A.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=A,f.inherits(M,T),M.prototype.processChunk=function(N){this.push({data:h.utf8encode(N.data),meta:N.meta})},h.Utf8EncodeWorker=M},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,o,h){var f=i("./support"),g=i("./base64"),c=i("./nodejsUtils"),T=i("./external");function P(U){return U}function R(U,te){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),N==0&&(this.dosPermissions=63&this.externalFileAttributes),N==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var N=f(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=N.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=N.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=N.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=N.readInt(4))}},readExtraFields:function(N){var Y,U,te,O=N.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});N.index+4>>6:(N<65536?M[te++]=224|N>>>12:(M[te++]=240|N>>>18,M[te++]=128|N>>>12&63),M[te++]=128|N>>>6&63),M[te++]=128|63&N);return M},h.buf2binstring=function(A){return R(A,A.length)},h.binstring2buf=function(A){for(var M=new f.Buf8(A.length),N=0,Y=M.length;N>10&1023,$[Y++]=56320|1023&U)}return R($,Y)},h.utf8border=function(A,M){var N;for((M=M||A.length)>A.length&&(M=A.length),N=M-1;0<=N&&(192&A[N])==128;)N--;return N<0||N===0?M:N+T[A[N]]>M?N:M}},{"./common":41}],43:[function(i,o,h){o.exports=function(f,g,c,T){for(var P=65535&f|0,R=f>>>16&65535|0,A=0;c!==0;){for(c-=A=2e3>>1:g>>>1;c[T]=g}return c}();o.exports=function(g,c,T,P){var R=f,A=P+T;g^=-1;for(var M=P;M>>8^R[255&(g^c[M])];return-1^g}},{}],46:[function(i,o,h){var f,g=i("../utils/common"),c=i("./trees"),T=i("./adler32"),P=i("./crc32"),R=i("./messages"),A=0,M=4,N=0,Y=-2,U=-1,te=4,O=2,$=8,q=9,ne=286,oe=30,ke=19,ge=2*ne+1,Fe=15,Oe=3,Ge=258,it=Ge+Oe+1,ve=42,je=113,H=1,Re=2,vt=3,ye=4;function Be(V,Ue){return V.msg=R[Ue],Ue}function Le(V){return(V<<1)-(4V.avail_out&&(ie=V.avail_out),ie!==0&&(g.arraySet(V.output,Ue.pending_buf,Ue.pending_out,ie,V.next_out),V.next_out+=ie,Ue.pending_out+=ie,V.total_out+=ie,V.avail_out-=ie,Ue.pending-=ie,Ue.pending===0&&(Ue.pending_out=0))}function Ee(V,Ue){c._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,Ue),V.block_start=V.strstart,xe(V.strm)}function mt(V,Ue){V.pending_buf[V.pending++]=Ue}function nt(V,Ue){V.pending_buf[V.pending++]=Ue>>>8&255,V.pending_buf[V.pending++]=255&Ue}function rt(V,Ue){var ie,de,se=V.max_chain_length,Te=V.strstart,Ze=V.prev_length,tt=V.nice_match,Ne=V.strstart>V.w_size-it?V.strstart-(V.w_size-it):0,ot=V.window,kt=V.w_mask,at=V.prev,Bt=V.strstart+Ge,Tr=ot[Te+Ze-1],qe=ot[Te+Ze];V.prev_length>=V.good_match&&(se>>=2),tt>V.lookahead&&(tt=V.lookahead);do if(ot[(ie=Ue)+Ze]===qe&&ot[ie+Ze-1]===Tr&&ot[ie]===ot[Te]&&ot[++ie]===ot[Te+1]){Te+=2,ie++;do;while(ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&TeNe&&--se!=0);return Ze<=V.lookahead?Ze:V.lookahead}function Jt(V){var Ue,ie,de,se,Te,Ze,tt,Ne,ot,kt,at=V.w_size;do{if(se=V.window_size-V.lookahead-V.strstart,V.strstart>=at+(at-it)){for(g.arraySet(V.window,V.window,at,at,0),V.match_start-=at,V.strstart-=at,V.block_start-=at,Ue=ie=V.hash_size;de=V.head[--Ue],V.head[Ue]=at<=de?de-at:0,--ie;);for(Ue=ie=at;de=V.prev[--Ue],V.prev[Ue]=at<=de?de-at:0,--ie;);se+=at}if(V.strm.avail_in===0)break;if(Ze=V.strm,tt=V.window,Ne=V.strstart+V.lookahead,ot=se,kt=void 0,kt=Ze.avail_in,ot=Oe)for(Te=V.strstart-V.insert,V.ins_h=V.window[Te],V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe)if(de=c._tr_tally(V,V.strstart-V.match_start,V.match_length-Oe),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=Oe){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe&&V.match_length<=V.prev_length){for(se=V.strstart+V.lookahead-Oe,de=c._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-Oe),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=se&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ie=V.pending_buf_size-5);;){if(V.lookahead<=1){if(Jt(V),V.lookahead===0&&Ue===A)return H;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var de=V.block_start+ie;if((V.strstart===0||V.strstart>=de)&&(V.lookahead=V.strstart-de,V.strstart=de,Ee(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-it&&(Ee(V,!1),V.strm.avail_out===0))return H}return V.insert=0,Ue===M?(Ee(V,!0),V.strm.avail_out===0?vt:ye):(V.strstart>V.block_start&&(Ee(V,!1),V.strm.avail_out),H)}),new Yt(4,4,8,4,er),new Yt(4,5,16,8,er),new Yt(4,6,32,32,er),new Yt(4,4,16,16,Vt),new Yt(8,16,32,32,Vt),new Yt(8,16,128,128,Vt),new Yt(8,32,128,256,Vt),new Yt(32,128,258,1024,Vt),new Yt(32,258,258,4096,Vt)],h.deflateInit=function(V,Ue){return Xr(V,Ue,$,15,8,0)},h.deflateInit2=Xr,h.deflateReset=br,h.deflateResetKeep=fr,h.deflateSetHeader=function(V,Ue){return V&&V.state?V.state.wrap!==2?Y:(V.state.gzhead=Ue,N):Y},h.deflate=function(V,Ue){var ie,de,se,Te;if(!V||!V.state||5>8&255),mt(de,de.gzhead.time>>16&255),mt(de,de.gzhead.time>>24&255),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,255&de.gzhead.os),de.gzhead.extra&&de.gzhead.extra.length&&(mt(de,255&de.gzhead.extra.length),mt(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(V.adler=P(V.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=69):(mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,3),de.status=je);else{var Ze=$+(de.w_bits-8<<4)<<8;Ze|=(2<=de.strategy||de.level<2?0:de.level<6?1:de.level===6?2:3)<<6,de.strstart!==0&&(Ze|=32),Ze+=31-Ze%31,de.status=je,nt(de,Ze),de.strstart!==0&&(nt(de,V.adler>>>16),nt(de,65535&V.adler)),V.adler=1}if(de.status===69)if(de.gzhead.extra){for(se=de.pending;de.gzindex<(65535&de.gzhead.extra.length)&&(de.pending!==de.pending_buf_size||(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending!==de.pending_buf_size));)mt(de,255&de.gzhead.extra[de.gzindex]),de.gzindex++;de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=73)}else de.status=73;if(de.status===73)if(de.gzhead.name){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.gzindex=0,de.status=91)}else de.status=91;if(de.status===91)if(de.gzhead.comment){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.status=103)}else de.status=103;if(de.status===103&&(de.gzhead.hcrc?(de.pending+2>de.pending_buf_size&&xe(V),de.pending+2<=de.pending_buf_size&&(mt(de,255&V.adler),mt(de,V.adler>>8&255),V.adler=0,de.status=je)):de.status=je),de.pending!==0){if(xe(V),V.avail_out===0)return de.last_flush=-1,N}else if(V.avail_in===0&&Le(Ue)<=Le(ie)&&Ue!==M)return Be(V,-5);if(de.status===666&&V.avail_in!==0)return Be(V,-5);if(V.avail_in!==0||de.lookahead!==0||Ue!==A&&de.status!==666){var tt=de.strategy===2?function(Ne,ot){for(var kt;;){if(Ne.lookahead===0&&(Jt(Ne),Ne.lookahead===0)){if(ot===A)return H;break}if(Ne.match_length=0,kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,Ue):de.strategy===3?function(Ne,ot){for(var kt,at,Bt,Tr,qe=Ne.window;;){if(Ne.lookahead<=Ge){if(Jt(Ne),Ne.lookahead<=Ge&&ot===A)return H;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=Oe&&0Ne.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=Oe?(kt=c._tr_tally(Ne,1,Ne.match_length-Oe),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,Ue):f[de.level].func(de,Ue);if(tt!==vt&&tt!==ye||(de.status=666),tt===H||tt===vt)return V.avail_out===0&&(de.last_flush=-1),N;if(tt===Re&&(Ue===1?c._tr_align(de):Ue!==5&&(c._tr_stored_block(de,0,0,!1),Ue===3&&(Ke(de.head),de.lookahead===0&&(de.strstart=0,de.block_start=0,de.insert=0))),xe(V),V.avail_out===0))return de.last_flush=-1,N}return Ue!==M?N:de.wrap<=0?1:(de.wrap===2?(mt(de,255&V.adler),mt(de,V.adler>>8&255),mt(de,V.adler>>16&255),mt(de,V.adler>>24&255),mt(de,255&V.total_in),mt(de,V.total_in>>8&255),mt(de,V.total_in>>16&255),mt(de,V.total_in>>24&255)):(nt(de,V.adler>>>16),nt(de,65535&V.adler)),xe(V),0=ie.w_size&&(Te===0&&(Ke(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),ot=new g.Buf8(ie.w_size),g.arraySet(ot,Ue,kt-ie.w_size,ie.w_size,0),Ue=ot,kt=ie.w_size),Ze=V.avail_in,tt=V.next_in,Ne=V.input,V.avail_in=kt,V.next_in=0,V.input=Ue,Jt(ie);ie.lookahead>=Oe;){for(de=ie.strstart,se=ie.lookahead-(Oe-1);ie.ins_h=(ie.ins_h<>>=Oe=Fe>>>24,q-=Oe,(Oe=Fe>>>16&255)===0)Re[R++]=65535&Fe;else{if(!(16&Oe)){if(!(64&Oe)){Fe=ne[(65535&Fe)+($&(1<>>=Oe,q-=Oe),q<15&&($+=H[T++]<>>=Oe=Fe>>>24,q-=Oe,!(16&(Oe=Fe>>>16&255))){if(!(64&Oe)){Fe=oe[(65535&Fe)+($&(1<>>=Oe,q-=Oe,(Oe=R-A)>3,$&=(1<<(q-=Ge<<3))-1,f.next_in=T,f.next_out=R,f.avail_in=T>>24&255)+(ve>>>8&65280)+((65280&ve)<<8)+((255&ve)<<24)}function $(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function q(ve){var je;return ve&&ve.state?(je=ve.state,ve.total_in=ve.total_out=je.total=0,ve.msg="",je.wrap&&(ve.adler=1&je.wrap),je.mode=Y,je.last=0,je.havedict=0,je.dmax=32768,je.head=null,je.hold=0,je.bits=0,je.lencode=je.lendyn=new f.Buf32(U),je.distcode=je.distdyn=new f.Buf32(te),je.sane=1,je.back=-1,M):N}function ne(ve){var je;return ve&&ve.state?((je=ve.state).wsize=0,je.whave=0,je.wnext=0,q(ve)):N}function oe(ve,je){var H,Re;return ve&&ve.state?(Re=ve.state,je<0?(H=0,je=-je):(H=1+(je>>4),je<48&&(je&=15)),je&&(je<8||15=ye.wsize?(f.arraySet(ye.window,je,H-ye.wsize,ye.wsize,0),ye.wnext=0,ye.whave=ye.wsize):(Re<(vt=ye.wsize-ye.wnext)&&(vt=Re),f.arraySet(ye.window,je,H-Re,vt,ye.wnext),(Re-=vt)?(f.arraySet(ye.window,je,H-Re,Re,0),ye.wnext=Re,ye.whave=ye.wsize):(ye.wnext+=vt,ye.wnext===ye.wsize&&(ye.wnext=0),ye.whave>>8&255,H.check=c(H.check,Te,2,0),Ee=xe=0,H.mode=2;break}if(H.flags=0,H.head&&(H.head.done=!1),!(1&H.wrap)||(((255&xe)<<8)+(xe>>8))%31){ve.msg="incorrect header check",H.mode=30;break}if((15&xe)!=8){ve.msg="unknown compression method",H.mode=30;break}if(Ee-=4,V=8+(15&(xe>>>=4)),H.wbits===0)H.wbits=V;else if(V>H.wbits){ve.msg="invalid window size",H.mode=30;break}H.dmax=1<>8&1),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=3;case 3:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,Te[2]=xe>>>16&255,Te[3]=xe>>>24&255,H.check=c(H.check,Te,4,0)),Ee=xe=0,H.mode=4;case 4:for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>8),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=5;case 5:if(1024&H.flags){for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0}else H.head&&(H.head.extra=null);H.mode=6;case 6:if(1024&H.flags&&(Le<(rt=H.length)&&(rt=Le),rt&&(H.head&&(V=H.head.extra_len-H.length,H.head.extra||(H.head.extra=new Array(H.head.extra_len)),f.arraySet(H.head.extra,Re,ye,rt,V)),512&H.flags&&(H.check=c(H.check,Re,rt,ye)),Le-=rt,ye+=rt,H.length-=rt),H.length))break e;H.length=0,H.mode=7;case 7:if(2048&H.flags){if(Le===0)break e;for(rt=0;V=Re[ye+rt++],H.head&&V&&H.length<65536&&(H.head.name+=String.fromCharCode(V)),V&&rt>9&1,H.head.done=!0),ve.adler=H.check=0,H.mode=12;break;case 10:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=7&Ee,Ee-=7&Ee,H.mode=27;break}for(;Ee<3;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=1)){case 0:H.mode=14;break;case 1:if(Ge(H),H.mode=20,je!==6)break;xe>>>=2,Ee-=2;break e;case 2:H.mode=17;break;case 3:ve.msg="invalid block type",H.mode=30}xe>>>=2,Ee-=2;break;case 14:for(xe>>>=7&Ee,Ee-=7&Ee;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>16^65535)){ve.msg="invalid stored block lengths",H.mode=30;break}if(H.length=65535&xe,Ee=xe=0,H.mode=15,je===6)break e;case 15:H.mode=16;case 16:if(rt=H.length){if(Le>>=5,Ee-=5,H.ndist=1+(31&xe),xe>>>=5,Ee-=5,H.ncode=4+(15&xe),xe>>>=4,Ee-=4,286>>=3,Ee-=3}for(;H.have<19;)H.lens[Ze[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,ie={bits:H.lenbits},Ue=P(0,H.lens,0,19,H.lencode,0,H.work,ie),H.lenbits=ie.bits,Ue){ve.msg="invalid code lengths set",H.mode=30;break}H.have=0,H.mode=19;case 19:for(;H.have>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=Vt,Ee-=Vt,H.lens[H.have++]=_r;else{if(_r===16){for(de=Vt+2;Ee>>=Vt,Ee-=Vt,H.have===0){ve.msg="invalid bit length repeat",H.mode=30;break}V=H.lens[H.have-1],rt=3+(3&xe),xe>>>=2,Ee-=2}else if(_r===17){for(de=Vt+3;Ee>>=Vt)),xe>>>=3,Ee-=3}else{for(de=Vt+7;Ee>>=Vt)),xe>>>=7,Ee-=7}if(H.have+rt>H.nlen+H.ndist){ve.msg="invalid bit length repeat",H.mode=30;break}for(;rt--;)H.lens[H.have++]=V}}if(H.mode===30)break;if(H.lens[256]===0){ve.msg="invalid code -- missing end-of-block",H.mode=30;break}if(H.lenbits=9,ie={bits:H.lenbits},Ue=P(R,H.lens,0,H.nlen,H.lencode,0,H.work,ie),H.lenbits=ie.bits,Ue){ve.msg="invalid literal/lengths set",H.mode=30;break}if(H.distbits=6,H.distcode=H.distdyn,ie={bits:H.distbits},Ue=P(A,H.lens,H.nlen,H.ndist,H.distcode,0,H.work,ie),H.distbits=ie.bits,Ue){ve.msg="invalid distances set",H.mode=30;break}if(H.mode=20,je===6)break e;case 20:H.mode=21;case 21:if(6<=Le&&258<=Ke){ve.next_out=Be,ve.avail_out=Ke,ve.next_in=ye,ve.avail_in=Le,H.hold=xe,H.bits=Ee,T(ve,nt),Be=ve.next_out,vt=ve.output,Ke=ve.avail_out,ye=ve.next_in,Re=ve.input,Le=ve.avail_in,xe=H.hold,Ee=H.bits,H.mode===12&&(H.back=-1);break}for(H.back=0;Yt=(se=H.lencode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,H.length=_r,Yt===0){H.mode=26;break}if(32&Yt){H.back=-1,H.mode=12;break}if(64&Yt){ve.msg="invalid literal/length code",H.mode=30;break}H.extra=15&Yt,H.mode=22;case 22:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=23;case 23:for(;Yt=(se=H.distcode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,64&Yt){ve.msg="invalid distance code",H.mode=30;break}H.offset=_r,H.extra=15&Yt,H.mode=24;case 24:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}if(H.offset>H.dmax){ve.msg="invalid distance too far back",H.mode=30;break}H.mode=25;case 25:if(Ke===0)break e;if(rt=nt-Ke,H.offset>rt){if((rt=H.offset-rt)>H.whave&&H.sane){ve.msg="invalid distance too far back",H.mode=30;break}Jt=rt>H.wnext?(rt-=H.wnext,H.wsize-rt):H.wnext-rt,rt>H.length&&(rt=H.length),er=H.window}else er=vt,Jt=Be-H.offset,rt=H.length;for(Kege?(Oe=Jt[er+te[je]],Ee[mt+te[je]]):(Oe=96,0),$=1<>Be)+(q-=$)]=Fe<<24|Oe<<16|Ge|0,q!==0;);for($=1<>=1;if($!==0?(xe&=$-1,xe+=$):xe=0,je++,--nt[ve]==0){if(ve===Re)break;ve=A[M+te[je]]}if(vt>>7)]}function mt(se,Te){se.pending_buf[se.pending++]=255&Te,se.pending_buf[se.pending++]=Te>>>8&255}function nt(se,Te,Ze){se.bi_valid>O-Ze?(se.bi_buf|=Te<>O-se.bi_valid,se.bi_valid+=Ze-O):(se.bi_buf|=Te<>>=1,Ze<<=1,0<--Te;);return Ze>>>1}function er(se,Te,Ze){var tt,Ne,ot=new Array(te+1),kt=0;for(tt=1;tt<=te;tt++)ot[tt]=kt=kt+Ze[tt-1]<<1;for(Ne=0;Ne<=Te;Ne++){var at=se[2*Ne+1];at!==0&&(se[2*Ne]=Jt(ot[at]++,at))}}function Vt(se){var Te;for(Te=0;Te>1;1<=Ze;Ze--)fr(se,ot,Ze);for(Ne=Bt;Ze=se.heap[1],se.heap[1]=se.heap[se.heap_len--],fr(se,ot,1),tt=se.heap[1],se.heap[--se.heap_max]=Ze,se.heap[--se.heap_max]=tt,ot[2*Ne]=ot[2*Ze]+ot[2*tt],se.depth[Ne]=(se.depth[Ze]>=se.depth[tt]?se.depth[Ze]:se.depth[tt])+1,ot[2*Ze+1]=ot[2*tt+1]=Ne,se.heap[1]=Ne++,fr(se,ot,1),2<=se.heap_len;);se.heap[--se.heap_max]=se.heap[1],function(qe,tn){var _n,vn,pi,Qe,Kt,jt,Kr=tn.dyn_tree,mi=tn.max_code,Xt=tn.stat_desc.static_tree,Yi=tn.stat_desc.has_stree,fs=tn.stat_desc.extra_bits,ps=tn.stat_desc.extra_base,Hn=tn.stat_desc.max_length,he=0;for(Qe=0;Qe<=te;Qe++)qe.bl_count[Qe]=0;for(Kr[2*qe.heap[qe.heap_max]+1]=0,_n=qe.heap_max+1;_n>=7;Ne>>=1)if(1&Tr&&at.dyn_ltree[2*Bt]!==0)return g;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return c;for(Bt=32;Bt>>3,(ot=se.static_len+3+7>>>3)<=Ne&&(Ne=ot)):Ne=ot=Ze+5,Ze+4<=Ne&&Te!==-1?de(se,Te,Ze,tt):se.strategy===4||ot===Ne?(nt(se,2+(tt?1:0),3),br(se,it,ve)):(nt(se,4+(tt?1:0),3),function(at,Bt,Tr,qe){var tn;for(nt(at,Bt-257,5),nt(at,Tr-1,5),nt(at,qe-4,4),tn=0;tn>>8&255,se.pending_buf[se.d_buf+2*se.last_lit+1]=255&Te,se.pending_buf[se.l_buf+se.last_lit]=255&Ze,se.last_lit++,Te===0?se.dyn_ltree[2*Ze]++:(se.matches++,Te--,se.dyn_ltree[2*(H[Ze]+A+1)]++,se.dyn_dtree[2*Ee(Te)]++),se.last_lit===se.lit_bufsize-1},h._tr_align=function(se){nt(se,2,3),rt(se,q,it),function(Te){Te.bi_valid===16?(mt(Te,Te.bi_buf),Te.bi_buf=0,Te.bi_valid=0):8<=Te.bi_valid&&(Te.pending_buf[Te.pending++]=255&Te.bi_buf,Te.bi_buf>>=8,Te.bi_valid-=8)}(se)}},{"../utils/common":41}],53:[function(i,o,h){o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,o,h){(function(f){(function(g,c){if(!g.setImmediate){var T,P,R,A,M=1,N={},Y=!1,U=g.document,te=Object.getPrototypeOf&&Object.getPrototypeOf(g);te=te&&te.setTimeout?te:g,T={}.toString.call(g.process)==="[object process]"?function(ne){process.nextTick(function(){$(ne)})}:function(){if(g.postMessage&&!g.importScripts){var ne=!0,oe=g.onmessage;return g.onmessage=function(){ne=!1},g.postMessage("","*"),g.onmessage=oe,ne}}()?(A="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",q,!1):g.attachEvent("onmessage",q),function(ne){g.postMessage(A+ne,"*")}):g.MessageChannel?((R=new MessageChannel).port1.onmessage=function(ne){$(ne.data)},function(ne){R.port2.postMessage(ne)}):U&&"onreadystatechange"in U.createElement("script")?(P=U.documentElement,function(ne){var oe=U.createElement("script");oe.onreadystatechange=function(){$(ne),oe.onreadystatechange=null,P.removeChild(oe),oe=null},P.appendChild(oe)}):function(ne){setTimeout($,0,ne)},te.setImmediate=function(ne){typeof ne!="function"&&(ne=new Function(""+ne));for(var oe=new Array(arguments.length-1),ke=0;ke"u"?f===void 0?this:f:self)}).call(this,typeof ff<"u"?ff:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(FI);var Q5=FI.exports;const eL=dp(Q5);var $1=function(e,t){return $1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(i[h]=o[h])},$1(e,t)};function no(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");$1(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var Ft=function(){return Ft=Object.assign||function(t){for(var i,o=1,h=arguments.length;o"u"&&(f=e.call(this,o),t.set(h,f)),f}function NI(e,t,i){var o=Array.prototype.slice.call(arguments,3),h=i(o),f=t.get(h);return typeof f>"u"&&(f=e.apply(this,o),t.set(h,f)),f}function vw(e,t,i,o,h){return i.bind(t,e,o,h)}function rL(e,t){var i=e.length===1?BI:NI;return vw(e,this,i,t.cache.create(),t.serializer)}function nL(e,t){return vw(e,this,NI,t.cache.create(),t.serializer)}function iL(e,t){return vw(e,this,BI,t.cache.create(),t.serializer)}var sL=function(){return JSON.stringify(arguments)};function xw(){this.cache=Object.create(null)}xw.prototype.get=function(e){return this.cache[e]};xw.prototype.set=function(e,t){this.cache[e]=t};var oL={create:function(){return new xw}},ji={variadic:nL,monadic:iL};function $I(e,t,i){if(i===void 0&&(i=Error),!e)throw new i(t)}$i(function(){for(var e,t=[],i=0;i0}),i=[],o=0,h=t;o1)throw new RangeError("integer-width stems only accept a single optional option");h.options[0].replace(pL,function(T,P,R,A,M,N){if(P)t.minimumIntegerDigits=R.length;else{if(A&&M)throw new Error("We currently do not support maximum integer digits");if(N)throw new Error("We currently do not support exact integer digits")}return""});continue}if(XI.test(h.stem)){t.minimumIntegerDigits=h.stem.length;continue}if(Ak.test(h.stem)){if(h.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");h.stem.replace(Ak,function(T,P,R,A,M,N){return R==="*"?t.minimumFractionDigits=P.length:A&&A[0]==="#"?t.maximumFractionDigits=A.length:M&&N?(t.minimumFractionDigits=M.length,t.maximumFractionDigits=M.length+N.length):(t.minimumFractionDigits=P.length,t.maximumFractionDigits=P.length),""});var f=h.options[0];f==="w"?t=Ft(Ft({},t),{trailingZeroDisplay:"stripIfInteger"}):f&&(t=Ft(Ft({},t),Dk(f)));continue}if(YI.test(h.stem)){t=Ft(Ft({},t),Dk(h.stem));continue}var g=KI(h.stem);g&&(t=Ft(Ft({},t),g));var c=mL(h.stem);c&&(t=Ft(Ft({},t),c))}return t}var Jm={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function yL(e,t){for(var i="",o=0;o>1),T="a",P=_L(t);for((P=="H"||P=="k")&&(c=0);c-- >0;)i+=T;for(;g-- >0;)i=P+i}else h==="J"?i+="H":i+=h}return i}function _L(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var i=e.language,o;i!=="root"&&(o=e.maximize().region);var h=Jm[o||""]||Jm[i||""]||Jm["".concat(i,"-001")]||Jm["001"];return h[0]}var wv,vL=new RegExp("^".concat(qI.source,"*")),xL=new RegExp("".concat(qI.source,"*$"));function Cr(e,t){return{start:e,end:t}}var wL=!!String.prototype.startsWith&&"_a".startsWith("a",1),bL=!!String.fromCodePoint,SL=!!Object.fromEntries,kL=!!String.prototype.codePointAt,TL=!!String.prototype.trimStart,EL=!!String.prototype.trimEnd,CL=!!Number.isSafeInteger,IL=CL?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},U1=!0;try{var PL=QI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");U1=((wv=PL.exec("a"))===null||wv===void 0?void 0:wv[0])==="a"}catch{U1=!1}var Rk=wL?function(t,i,o){return t.startsWith(i,o)}:function(t,i,o){return t.slice(o,o+i.length)===i},V1=bL?String.fromCodePoint:function(){for(var t=[],i=0;if;){if(g=t[f++],g>1114111)throw RangeError(g+" is not a valid code point");o+=g<65536?String.fromCharCode(g):String.fromCharCode(((g-=65536)>>10)+55296,g%1024+56320)}return o},Lk=SL?Object.fromEntries:function(t){for(var i={},o=0,h=t;o=o)){var h=t.charCodeAt(i),f;return h<55296||h>56319||i+1===o||(f=t.charCodeAt(i+1))<56320||f>57343?h:(h-55296<<10)+(f-56320)+65536}},ML=TL?function(t){return t.trimStart()}:function(t){return t.replace(vL,"")},AL=EL?function(t){return t.trimEnd()}:function(t){return t.replace(xL,"")};function QI(e,t){return new RegExp(e,t)}var H1;if(U1){var Ok=QI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");H1=function(t,i){var o;Ok.lastIndex=i;var h=Ok.exec(t);return(o=h[1])!==null&&o!==void 0?o:""}}else H1=function(t,i){for(var o=[];;){var h=JI(t,i);if(h===void 0||eP(h)||LL(h))break;o.push(h),i+=h>=65536?2:1}return V1.apply(void 0,o)};var DL=function(){function e(t,i){i===void 0&&(i={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!i.ignoreTag,this.locale=i.locale,this.requiresOtherClause=!!i.requiresOtherClause,this.shouldParseSkeletons=!!i.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,i,o){for(var h=[];!this.isEOF();){var f=this.char();if(f===123){var g=this.parseArgument(t,o);if(g.err)return g;h.push(g.val)}else{if(f===125&&t>0)break;if(f===35&&(i==="plural"||i==="selectordinal")){var c=this.clonePosition();this.bump(),h.push({type:an.pound,location:Cr(c,this.clonePosition())})}else if(f===60&&!this.ignoreTag&&this.peek()===47){if(o)break;return this.error(kr.UNMATCHED_CLOSING_TAG,Cr(this.clonePosition(),this.clonePosition()))}else if(f===60&&!this.ignoreTag&&W1(this.peek()||0)){var g=this.parseTag(t,i);if(g.err)return g;h.push(g.val)}else{var g=this.parseLiteral(t,i);if(g.err)return g;h.push(g.val)}}}return{val:h,err:null}},e.prototype.parseTag=function(t,i){var o=this.clonePosition();this.bump();var h=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:an.literal,value:"<".concat(h,"/>"),location:Cr(o,this.clonePosition())},err:null};if(this.bumpIf(">")){var f=this.parseMessage(t+1,i,!0);if(f.err)return f;var g=f.val,c=this.clonePosition();if(this.bumpIf("")?{val:{type:an.tag,value:h,children:g,location:Cr(o,this.clonePosition())},err:null}:this.error(kr.INVALID_TAG,Cr(c,this.clonePosition())))}else return this.error(kr.UNCLOSED_TAG,Cr(o,this.clonePosition()))}else return this.error(kr.INVALID_TAG,Cr(o,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&RL(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,i){for(var o=this.clonePosition(),h="";;){var f=this.tryParseQuote(i);if(f){h+=f;continue}var g=this.tryParseUnquoted(t,i);if(g){h+=g;continue}var c=this.tryParseLeftAngleBracket();if(c){h+=c;continue}break}var T=Cr(o,this.clonePosition());return{val:{type:an.literal,value:h,location:T},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!zL(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var i=[this.char()];for(this.bump();!this.isEOF();){var o=this.char();if(o===39)if(this.peek()===39)i.push(39),this.bump();else{this.bump();break}else i.push(o);this.bump()}return V1.apply(void 0,i)},e.prototype.tryParseUnquoted=function(t,i){if(this.isEOF())return null;var o=this.char();return o===60||o===123||o===35&&(i==="plural"||i==="selectordinal")||o===125&&t>0?null:(this.bump(),V1(o))},e.prototype.parseArgument=function(t,i){var o=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(kr.EMPTY_ARGUMENT,Cr(o,this.clonePosition()));var h=this.parseIdentifierIfPossible().value;if(!h)return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:an.argument,value:h,location:Cr(o,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition())):this.parseArgumentOptions(t,i,h,o);default:return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),i=this.offset(),o=H1(this.message,i),h=i+o.length;this.bumpTo(h);var f=this.clonePosition(),g=Cr(t,f);return{value:o,location:g}},e.prototype.parseArgumentOptions=function(t,i,o,h){var f,g=this.clonePosition(),c=this.parseIdentifierIfPossible().value,T=this.clonePosition();switch(c){case"":return this.error(kr.EXPECT_ARGUMENT_TYPE,Cr(g,T));case"number":case"date":case"time":{this.bumpSpace();var P=null;if(this.bumpIf(",")){this.bumpSpace();var R=this.clonePosition(),A=this.parseSimpleArgStyleIfPossible();if(A.err)return A;var M=AL(A.val);if(M.length===0)return this.error(kr.EXPECT_ARGUMENT_STYLE,Cr(this.clonePosition(),this.clonePosition()));var N=Cr(R,this.clonePosition());P={style:M,styleLocation:N}}var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var U=Cr(h,this.clonePosition());if(P&&Rk(P==null?void 0:P.style,"::",0)){var te=ML(P.style.slice(2));if(c==="number"){var A=this.parseNumberSkeletonFromString(te,P.styleLocation);return A.err?A:{val:{type:an.number,value:o,location:U,style:A.val},err:null}}else{if(te.length===0)return this.error(kr.EXPECT_DATE_TIME_SKELETON,U);var O=te;this.locale&&(O=yL(te,this.locale));var M={type:Lh.dateTime,pattern:O,location:P.styleLocation,parsedOptions:this.shouldParseSkeletons?cL(O):{}},$=c==="date"?an.date:an.time;return{val:{type:$,value:o,location:U,style:M},err:null}}}return{val:{type:c==="number"?an.number:c==="date"?an.date:an.time,value:o,location:U,style:(f=P==null?void 0:P.style)!==null&&f!==void 0?f:null},err:null}}case"plural":case"selectordinal":case"select":{var q=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(kr.EXPECT_SELECT_ARGUMENT_OPTIONS,Cr(q,Ft({},q)));this.bumpSpace();var ne=this.parseIdentifierIfPossible(),oe=0;if(c!=="select"&&ne.value==="offset"){if(!this.bumpIf(":"))return this.error(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Cr(this.clonePosition(),this.clonePosition()));this.bumpSpace();var A=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,kr.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(A.err)return A;this.bumpSpace(),ne=this.parseIdentifierIfPossible(),oe=A.val}var ke=this.tryParsePluralOrSelectOptions(t,c,i,ne);if(ke.err)return ke;var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var ge=Cr(h,this.clonePosition());return c==="select"?{val:{type:an.select,value:o,options:Lk(ke.val),location:ge},err:null}:{val:{type:an.plural,value:o,options:Lk(ke.val),offset:oe,pluralType:c==="plural"?"cardinal":"ordinal",location:ge},err:null}}default:return this.error(kr.INVALID_ARGUMENT_TYPE,Cr(g,T))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,i=this.clonePosition();!this.isEOF();){var o=this.char();switch(o){case 39:{this.bump();var h=this.clonePosition();if(!this.bumpUntil("'"))return this.error(kr.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Cr(h,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(i.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(i.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,i){var o=[];try{o=dL(t)}catch{return this.error(kr.INVALID_NUMBER_SKELETON,i)}return{val:{type:Lh.number,tokens:o,location:i,parsedOptions:this.shouldParseSkeletons?gL(o):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,i,o,h){for(var f,g=!1,c=[],T=new Set,P=h.value,R=h.location;;){if(P.length===0){var A=this.clonePosition();if(i!=="select"&&this.bumpIf("=")){var M=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,kr.INVALID_PLURAL_ARGUMENT_SELECTOR);if(M.err)return M;R=Cr(A,this.clonePosition()),P=this.message.slice(A.offset,this.offset())}else break}if(T.has(P))return this.error(i==="select"?kr.DUPLICATE_SELECT_ARGUMENT_SELECTOR:kr.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,R);P==="other"&&(g=!0),this.bumpSpace();var N=this.clonePosition();if(!this.bumpIf("{"))return this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Cr(this.clonePosition(),this.clonePosition()));var Y=this.parseMessage(t+1,i,o);if(Y.err)return Y;var U=this.tryParseArgumentClose(N);if(U.err)return U;c.push([P,{value:Y.val,location:Cr(N,this.clonePosition())}]),T.add(P),this.bumpSpace(),f=this.parseIdentifierIfPossible(),P=f.value,R=f.location}return c.length===0?this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,Cr(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!g?this.error(kr.MISSING_OTHER_CLAUSE,Cr(this.clonePosition(),this.clonePosition())):{val:c,err:null}},e.prototype.tryParseDecimalInteger=function(t,i){var o=1,h=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(o=-1);for(var f=!1,g=0;!this.isEOF();){var c=this.char();if(c>=48&&c<=57)f=!0,g=g*10+(c-48),this.bump();else break}var T=Cr(h,this.clonePosition());return f?(g*=o,IL(g)?{val:g,err:null}:this.error(i,T)):this.error(t,T)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var i=JI(this.message,t);if(i===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return i},e.prototype.error=function(t,i){return{val:null,err:{kind:t,message:this.message,location:i}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(Rk(this.message,t,this.offset())){for(var i=0;i=0?(this.bumpTo(o),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var i=this.offset();if(i===t)break;if(i>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&eP(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),i=this.offset(),o=this.message.charCodeAt(i+(t>=65536?2:1));return o??null},e}();function W1(e){return e>=97&&e<=122||e>=65&&e<=90}function zL(e){return W1(e)||e===47}function RL(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function eP(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function LL(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function G1(e){e.forEach(function(t){if(delete t.location,HI(t)||WI(t))for(var i in t.options)delete t.options[i].location,G1(t.options[i].value);else jI(t)&&ZI(t.style)||(UI(t)||VI(t))&&j1(t.style)?delete t.style.location:GI(t)&&G1(t.children)})}function OL(e,t){t===void 0&&(t={}),t=Ft({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var i=new DL(e,t).parse();if(i.err){var o=SyntaxError(kr[i.err.kind]);throw o.location=i.err.location,o.originalMessage=i.err.message,o}return t!=null&&t.captureLocation||G1(i.val),i.val}var Zo;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(Zo||(Zo={}));var Gl=function(e){no(t,e);function t(i,o,h){var f=e.call(this,i)||this;return f.code=o,f.originalMessage=h,f}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Fk=function(e){no(t,e);function t(i,o,h,f){return e.call(this,'Invalid values for "'.concat(i,'": "').concat(o,'". Options are "').concat(Object.keys(h).join('", "'),'"'),Zo.INVALID_VALUE,f)||this}return t}(Gl),FL=function(e){no(t,e);function t(i,o,h){return e.call(this,'Value for "'.concat(i,'" must be of type ').concat(o),Zo.INVALID_VALUE,h)||this}return t}(Gl),BL=function(e){no(t,e);function t(i,o){return e.call(this,'The intl string context variable "'.concat(i,'" was not provided to the string "').concat(o,'"'),Zo.MISSING_VALUE,o)||this}return t}(Gl),Bi;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(Bi||(Bi={}));function NL(e){return e.length<2?e:e.reduce(function(t,i){var o=t[t.length-1];return!o||o.type!==Bi.literal||i.type!==Bi.literal?t.push(i):o.value+=i.value,t},[])}function tP(e){return typeof e=="function"}function kg(e,t,i,o,h,f,g){if(e.length===1&&Mk(e[0]))return[{type:Bi.literal,value:e[0].value}];for(var c=[],T=0,P=e;T"u")){var i=Intl.NumberFormat.supportedLocalesOf(t);return i.length>0?new Intl.Locale(i[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=OL,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),Gu;(function(e){e.FORMAT_ERROR="FORMAT_ERROR",e.UNSUPPORTED_FORMATTER="UNSUPPORTED_FORMATTER",e.INVALID_CONFIG="INVALID_CONFIG",e.MISSING_DATA="MISSING_DATA",e.MISSING_TRANSLATION="MISSING_TRANSLATION"})(Gu||(Gu={}));var wp=function(e){no(t,e);function t(i,o,h){var f=this,g=h?h instanceof Error?h:new Error(String(h)):void 0;return f=e.call(this,"[@formatjs/intl Error ".concat(i,"] ").concat(o,` +`,Zo.MISSING_INTL_API,g);var ne=i.getPluralRules(t,{type:R.pluralType}).select(M-(R.offset||0));q=R.options[ne]||R.options.other}if(!q)throw new Fk(R.value,M,Object.keys(R.options),g);c.push.apply(c,kg(q.value,t,i,o,h,M-(R.offset||0)));continue}}return NL(c)}function $L(e,t){return t?Ft(Ft(Ft({},e||{}),t||{}),Object.keys(e).reduce(function(i,o){return i[o]=Ft(Ft({},e[o]),t[o]||{}),i},{})):e}function jL(e,t){return t?Object.keys(e).reduce(function(i,o){return i[o]=$L(e[o],t[o]),i},Ft({},e)):e}function bv(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,i){e[t]=i}}}}}function UL(e){return e===void 0&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:$i(function(){for(var t,i=[],o=0;o"u")){var i=Intl.NumberFormat.supportedLocalesOf(t);return i.length>0?new Intl.Locale(i[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=OL,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),Zu;(function(e){e.FORMAT_ERROR="FORMAT_ERROR",e.UNSUPPORTED_FORMATTER="UNSUPPORTED_FORMATTER",e.INVALID_CONFIG="INVALID_CONFIG",e.MISSING_DATA="MISSING_DATA",e.MISSING_TRANSLATION="MISSING_TRANSLATION"})(Zu||(Zu={}));var wp=function(e){no(t,e);function t(i,o,h){var f=this,g=h?h instanceof Error?h:new Error(String(h)):void 0;return f=e.call(this,"[@formatjs/intl Error ".concat(i,"] ").concat(o,` `).concat(g?` `.concat(g.message,` -`).concat(g.stack):""))||this,f.code=i,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(f,t),f}return t}(Error),VL=function(e){no(t,e);function t(i,o){return e.call(this,Gu.UNSUPPORTED_FORMATTER,i,o)||this}return t}(wp),HL=function(e){no(t,e);function t(i,o){return e.call(this,Gu.INVALID_CONFIG,i,o)||this}return t}(wp),Bk=function(e){no(t,e);function t(i,o){return e.call(this,Gu.MISSING_DATA,i,o)||this}return t}(wp),io=function(e){no(t,e);function t(i,o,h){var f=e.call(this,Gu.FORMAT_ERROR,"".concat(i,` +`).concat(g.stack):""))||this,f.code=i,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(f,t),f}return t}(Error),VL=function(e){no(t,e);function t(i,o){return e.call(this,Zu.UNSUPPORTED_FORMATTER,i,o)||this}return t}(wp),HL=function(e){no(t,e);function t(i,o){return e.call(this,Zu.INVALID_CONFIG,i,o)||this}return t}(wp),Bk=function(e){no(t,e);function t(i,o){return e.call(this,Zu.MISSING_DATA,i,o)||this}return t}(wp),io=function(e){no(t,e);function t(i,o,h){var f=e.call(this,Zu.FORMAT_ERROR,"".concat(i,` Locale: `).concat(o,` `),h)||this;return f.locale=o,f}return t}(wp),Sv=function(e){no(t,e);function t(i,o,h,f){var g=e.call(this,"".concat(i,` MessageID: `).concat(h==null?void 0:h.id,` Default Message: `).concat(h==null?void 0:h.defaultMessage,` Description: `).concat(h==null?void 0:h.description,` -`),o,f)||this;return g.descriptor=h,g.locale=o,g}return t}(io),WL=function(e){no(t,e);function t(i,o){var h=e.call(this,Gu.MISSING_TRANSLATION,'Missing message: "'.concat(i.id,'" for locale "').concat(o,'", using ').concat(i.defaultMessage?"default message (".concat(typeof i.defaultMessage=="string"?i.defaultMessage:i.defaultMessage.map(function(f){var g;return(g=f.value)!==null&&g!==void 0?g:JSON.stringify(f)}).join(),")"):"id"," as fallback."))||this;return h.descriptor=i,h}return t}(wp);function Xu(e,t,i){return i===void 0&&(i={}),t.reduce(function(o,h){return h in e?o[h]=e[h]:h in i&&(o[h]=i[h]),o},{})}var GL=function(e){},ZL=function(e){},rP={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:GL,onWarn:ZL};function nP(){return{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{},list:{},displayNames:{}}}function vu(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,i){e[t]=i}}}}}function qL(e){e===void 0&&(e=nP());var t=Intl.RelativeTimeFormat,i=Intl.ListFormat,o=Intl.DisplayNames,h=$i(function(){for(var c,T=[],P=0;P needs to exist in the component ancestry.")}var lP=Ft(Ft({},rP),{textComponent:Ht.Fragment});function g4(e){return function(t){return e(Ht.Children.toArray(t))}}function q1(e,t){if(e===t)return!0;if(!e||!t)return!1;var i=Object.keys(e),o=Object.keys(t),h=i.length;if(o.length!==h)return!1;for(var f=0;f needs to exist in the component ancestry.")}var uP=Ft(Ft({},nP),{textComponent:Ht.Fragment});function g4(e){return function(t){return e(Ht.Children.toArray(t))}}function q1(e,t){if(e===t)return!0;if(!e||!t)return!1;var i=Object.keys(e),o=Object.keys(t),h=i.length;if(o.length!==h)return!1;for(var f=0;f{if(e.substring(0,8)==="__MACOSX")return;const t=e.toLowerCase();if(t.endsWith(".txt")||t.endsWith(".json"))return"chat";if(t.endsWith(".zip"))return"zip";if(t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".mp4"))return"media"},A4=({onFilesLoad:e,onDataFileLoad:t,onError:i})=>{const[o,h]=Ht.useState(),[f,g]=Ht.useState(),c=c_(),T=R=>{g(R.length);for(let M=0;M({...te,[N.name]:j.target.result}))},A.onerror=function(j){i(N.name)}}else Y==="zip"&&new eL().loadAsync(N).then(function(j){Object.keys(j.files).forEach(te=>{const O=Hk(te);O==="chat"?j.files[te].async("string").then(function($){h(q=>({...q,[N.name]:$}))}):O==="media"&&j.files[te].async("arraybuffer").then(function($){const q=new Uint8Array($),ne=new Blob([q.buffer]);t(te,ne)})})})}};Ht.useEffect(()=>{o&&Object.keys(o).length===f&&e(o)},[o,e]);const P=o&&Object.keys(o).length!==f;return Ke.jsxs(Ke.Fragment,{children:[P?Ke.jsxs("p",{style:{textAlign:"center"},children:[c.formatMessage({id:"app.loading",defaultMessage:"Loading"})," ..."]}):"",Ke.jsx("div",{style:P?{display:"none"}:null,children:Ke.jsx(J5,{classes:"fileUploadDropArea",handleChange:T,multiple:!0,name:"file",types:M4,label:c.formatMessage({id:"app.uploadLabel",defaultMessage:"Upload or drag a file right here"})})})]})};var gP={exports:{}};/** + */var ri=typeof Symbol=="function"&&Symbol.for,bw=ri?Symbol.for("react.element"):60103,Sw=ri?Symbol.for("react.portal"):60106,e_=ri?Symbol.for("react.fragment"):60107,t_=ri?Symbol.for("react.strict_mode"):60108,r_=ri?Symbol.for("react.profiler"):60114,n_=ri?Symbol.for("react.provider"):60109,i_=ri?Symbol.for("react.context"):60110,kw=ri?Symbol.for("react.async_mode"):60111,s_=ri?Symbol.for("react.concurrent_mode"):60111,o_=ri?Symbol.for("react.forward_ref"):60112,a_=ri?Symbol.for("react.suspense"):60113,y4=ri?Symbol.for("react.suspense_list"):60120,l_=ri?Symbol.for("react.memo"):60115,u_=ri?Symbol.for("react.lazy"):60116,_4=ri?Symbol.for("react.block"):60121,v4=ri?Symbol.for("react.fundamental"):60117,x4=ri?Symbol.for("react.responder"):60118,w4=ri?Symbol.for("react.scope"):60119;function $s(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case bw:switch(e=e.type,e){case kw:case s_:case e_:case r_:case t_:case a_:return e;default:switch(e=e&&e.$$typeof,e){case i_:case o_:case u_:case l_:case n_:return e;default:return t}}case Sw:return t}}}function hP(e){return $s(e)===s_}Ur.AsyncMode=kw;Ur.ConcurrentMode=s_;Ur.ContextConsumer=i_;Ur.ContextProvider=n_;Ur.Element=bw;Ur.ForwardRef=o_;Ur.Fragment=e_;Ur.Lazy=u_;Ur.Memo=l_;Ur.Portal=Sw;Ur.Profiler=r_;Ur.StrictMode=t_;Ur.Suspense=a_;Ur.isAsyncMode=function(e){return hP(e)||$s(e)===kw};Ur.isConcurrentMode=hP;Ur.isContextConsumer=function(e){return $s(e)===i_};Ur.isContextProvider=function(e){return $s(e)===n_};Ur.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===bw};Ur.isForwardRef=function(e){return $s(e)===o_};Ur.isFragment=function(e){return $s(e)===e_};Ur.isLazy=function(e){return $s(e)===u_};Ur.isMemo=function(e){return $s(e)===l_};Ur.isPortal=function(e){return $s(e)===Sw};Ur.isProfiler=function(e){return $s(e)===r_};Ur.isStrictMode=function(e){return $s(e)===t_};Ur.isSuspense=function(e){return $s(e)===a_};Ur.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===e_||e===s_||e===r_||e===t_||e===a_||e===y4||typeof e=="object"&&e!==null&&(e.$$typeof===u_||e.$$typeof===l_||e.$$typeof===n_||e.$$typeof===i_||e.$$typeof===o_||e.$$typeof===v4||e.$$typeof===x4||e.$$typeof===w4||e.$$typeof===_4)};Ur.typeOf=$s;cP.exports=Ur;var b4=cP.exports,dP=b4,S4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},k4={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},fP={};fP[dP.ForwardRef]=S4;fP[dP.Memo]=k4;var Tw=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=Ht.createContext(null)):Ht.createContext(null);Tw.Consumer;var T4=Tw.Provider,E4=T4,C4=Tw;function c_(){var e=Ht.useContext(C4);return lP(e),e}var Y1;(function(e){e.formatDate="FormattedDate",e.formatTime="FormattedTime",e.formatNumber="FormattedNumber",e.formatList="FormattedList",e.formatDisplayName="FormattedDisplayName"})(Y1||(Y1={}));var X1;(function(e){e.formatDate="FormattedDateParts",e.formatTime="FormattedTimeParts",e.formatNumber="FormattedNumberParts",e.formatList="FormattedListParts"})(X1||(X1={}));function pP(e){var t=function(i){var o=c_(),h=i.value,f=i.children,g=Rh(i,["value","children"]),c=typeof h=="string"?new Date(h||0):h,T=e==="formatDate"?o.formatDateToParts(c,g):o.formatTimeToParts(c,g);return f(T)};return t.displayName=X1[e],t}function bp(e){var t=function(i){var o=c_(),h=i.value,f=i.children,g=Rh(i,["value","children"]),c=o[e](h,g);if(typeof f=="function")return f(c);var T=o.textComponent||Ht.Fragment;return Ht.createElement(T,null,c)};return t.displayName=Y1[e],t}function mP(e){return e&&Object.keys(e).reduce(function(t,i){var o=e[i];return t[i]=tP(o)?g4(o):o,t},{})}var Uk=function(e,t,i,o){for(var h=[],f=4;f{if(e.substring(0,8)==="__MACOSX")return;const t=e.toLowerCase();if(t.endsWith(".txt")||t.endsWith(".json"))return"chat";if(t.endsWith(".zip"))return"zip";if(t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".mp4"))return"media"},A4=({onFilesLoad:e,onDataFileLoad:t,onError:i})=>{const[o,h]=Ht.useState(),[f,g]=Ht.useState(),c=c_(),T=R=>{g(R.length);for(let M=0;M({...te,[N.name]:U.target.result}))},A.onerror=function(U){i(N.name)}}else Y==="zip"&&new eL().loadAsync(N).then(function(U){Object.keys(U.files).forEach(te=>{const O=Hk(te);O==="chat"?U.files[te].async("string").then(function($){h(q=>({...q,[N.name]:$}))}):O==="media"&&U.files[te].async("arraybuffer").then(function($){const q=new Uint8Array($),ne=new Blob([q.buffer]);t(te,ne)})})})}};Ht.useEffect(()=>{o&&Object.keys(o).length===f&&e(o)},[o,e]);const P=o&&Object.keys(o).length!==f;return We.jsxs(We.Fragment,{children:[P?We.jsxs("p",{style:{textAlign:"center"},children:[c.formatMessage({id:"app.loading",defaultMessage:"Loading"})," ..."]}):"",We.jsx("div",{style:P?{display:"none"}:null,children:We.jsx(J5,{classes:"fileUploadDropArea",handleChange:T,multiple:!0,name:"file",types:M4,label:c.formatMessage({id:"app.uploadLabel",defaultMessage:"Upload or drag a file right here"})})})]})};var yP={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt - */(function(e,t){(function(i,o){e.exports=o()})(ff,function(){var i={},o={};function h(g,c,T){if(o[g]=T,g==="index"){var P="var sharedModule = {}; ("+o.shared+")(sharedModule); ("+o.worker+")(sharedModule);",R={};return o.shared(R),o.index(i,R),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([P],{type:"text/javascript"}))),i}}h("shared",["exports"],function(g){function c(s,n,a,d){return new(a||(a=Promise))(function(y,x){function w(I){try{k(d.next(I))}catch(D){x(D)}}function b(I){try{k(d.throw(I))}catch(D){x(D)}}function k(I){var D;I.done?y(I.value):(D=I.value,D instanceof a?D:new a(function(L){L(D)})).then(w,b)}k((d=d.apply(s,n||[])).next())})}function T(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var P=R;function R(s,n){this.x=s,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,n){return this.clone()._rotateAround(s,n)},matMult:function(s){return this.clone()._matMult(s)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var n=s.x-this.x,a=s.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,n){return Math.atan2(this.x*n-this.y*s,this.x*s+this.y*n)},_matMult:function(s){var n=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=n,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var n=Math.cos(s),a=Math.sin(s),d=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=d,this},_rotateAround:function(s,n){var a=Math.cos(s),d=Math.sin(s),y=n.y+d*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-d*(this.y-n.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(s){return s instanceof R?s:Array.isArray(s)?new R(s[0],s[1]):s};var A=T(P),M=N;function N(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}N.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var Y=T(M);let j,te;function O(){return j==null&&(j=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),j}function $(){if(te==null&&(te=!1,O())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let d=0;d<5*5;d++){const y=4*d;n.fillStyle=`rgb(${y},${y+1},${y+2})`,n.fillRect(d%5,Math.floor(d/5),1,1)}const a=n.getImageData(0,0,5,5).data;for(let d=0;d<5*5*4;d++)if(d%4!=3&&a[d]!==d){te=!0;break}}}return te||!1}function q(s,n,a,d){const y=new Y(s,n,a,d);return x=>y.solve(x)}const ne=q(.25,.1,.25,1);function oe(s,n,a){return Math.min(a,Math.max(n,s))}function ke(s,n,a){const d=a-n,y=((s-n)%d+d)%d+n;return y===n?a:y}function ge(s,...n){for(const a of n)for(const d in a)s[d]=a[d];return s}let Fe=1;function Oe(s,n,a){const d={};for(const y in s)d[y]=n.call(this,s[y],y,s);return d}function We(s,n,a){const d={};for(const y in s)n.call(this,s[y],y,s)&&(d[y]=s[y]);return d}function it(s){return Array.isArray(s)?s.map(it):typeof s=="object"&&s?Oe(s,it):s}const ve={};function Ue(s){ve[s]||(typeof console<"u"&&console.warn(s),ve[s]=!0)}function H(s,n,a){return(a.y-s.y)*(n.x-s.x)>(n.y-s.y)*(a.x-s.x)}function Re(s){return typeof WorkerGlobalScope<"u"&&s!==void 0&&s instanceof WorkerGlobalScope}let vt=null;function ye(s){return typeof ImageBitmap<"u"&&s instanceof ImageBitmap}const Be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Le(s,n,a,d,y){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(s,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const b=w.startsWith("BGR"),k=new Uint8ClampedArray(d*y*4);if(yield x.copyTo(k,function(I,D,L,U,Z){const K=4*Math.max(-D,0),J=(Math.max(0,L)-L)*U*4+K,le=4*U,fe=Math.max(0,D),De=Math.max(0,L);return{rect:{x:fe,y:De,width:Math.min(I.width,D+U)-fe,height:Math.min(I.height,L+Z)-De},layout:[{offset:J,stride:le}]}}(s,n,a,d,y)),b)for(let I=0;IRe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Yt=function(s,n){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const d=rt(s.url);if(d)return d(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:Jt},n)}if(!(/^file:/.test(a=s.url)||/^file:/.test(Vt())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(d,y){return c(this,void 0,void 0,function*(){const x=new Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,cache:d.cache,referrer:Vt(),signal:y.signal});d.type!=="json"||x.headers.has("Accept")||x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const I=yield w.blob();throw new er(w.status,w.statusText,d.url,I)}let b;b=d.type==="arrayBuffer"||d.type==="image"?w.arrayBuffer():d.type==="json"?w.json():w.text();const k=yield b;if(y.signal.aborted)throw mt();return{data:k,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:Jt},n)}var a;return function(d,y){return new Promise((x,w)=>{var b;const k=new XMLHttpRequest;k.open(d.method||"GET",d.url,!0),d.type!=="arrayBuffer"&&d.type!=="image"||(k.responseType="arraybuffer");for(const I in d.headers)k.setRequestHeader(I,d.headers[I]);d.type==="json"&&(k.responseType="text",!((b=d.headers)===null||b===void 0)&&b.Accept||k.setRequestHeader("Accept","application/json")),k.withCredentials=d.credentials==="include",k.onerror=()=>{w(new Error(k.statusText))},k.onload=()=>{if(!y.signal.aborted)if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let I=k.response;if(d.type==="json")try{I=JSON.parse(k.response)}catch(D){return void w(D)}x({data:I,cacheControl:k.getResponseHeader("Cache-Control"),expires:k.getResponseHeader("Expires")})}else{const I=new Blob([k.response],{type:k.getResponseHeader("Content-Type")});w(new er(k.status,k.statusText,d.url,I))}},y.signal.addEventListener("abort",()=>{k.abort(),w(mt())}),k.send(d.body)})}(s,n)};function _r(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const n=new URL(s),a=window.location;return n.protocol===a.protocol&&n.host===a.host}function fr(s,n,a){a[s]&&a[s].indexOf(n)!==-1||(a[s]=a[s]||[],a[s].push(n))}function br(s,n,a){if(a&&a[s]){const d=a[s].indexOf(n);d!==-1&&a[s].splice(d,1)}}class Xr{constructor(n,a={}){ge(this,a),this.type=n}}class V extends Xr{constructor(n,a={}){super("error",ge({error:n},a))}}class je{on(n,a){return this._listeners=this._listeners||{},fr(n,a,this._listeners),this}off(n,a){return br(n,a,this._listeners),br(n,a,this._oneTimeListeners),this}once(n,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fr(n,a,this._oneTimeListeners),this):new Promise(d=>this.once(n,d))}fire(n,a){typeof n=="string"&&(n=new Xr(n,a||{}));const d=n.type;if(this.listens(d)){n.target=this;const y=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const b of y)b.call(this,n);const x=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const b of x)br(d,b,this._oneTimeListeners),b.call(this,n);const w=this._eventedParent;w&&(ge(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(n))}else n instanceof V&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,a){return this._eventedParent=n,this._eventedParentData=a,this}}var ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},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},"*":{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:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},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:"*",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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},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"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};const de=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function se(s,n){const a={};for(const d in s)d!=="ref"&&(a[d]=s[d]);return de.forEach(d=>{d in n&&(a[d]=n[d])}),a}function Te(s,n){if(Array.isArray(s)){if(!Array.isArray(n)||s.length!==n.length)return!1;for(let a=0;a`:s.itemType.kind==="value"?"array":`array<${n}>`}return s.kind}const ee=[pi,Qe,Kt,Ut,Kr,fs,mi,G(Xt),ps,Hn,he];function ue(s,n){if(n.kind==="error")return null;if(s.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!ue(s.itemType,n.itemType))&&(typeof s.N!="number"||s.N===n.N))return null}else{if(s.kind===n.kind)return null;if(s.kind==="value"){for(const a of ee)if(!ue(a,n))return null}}return`Expected ${W(s)} but found ${W(n)} instead.`}function Se(s,n){return n.some(a=>a.kind===s.kind)}function Ie(s,n){return n.some(a=>a==="null"?s===null:a==="array"?Array.isArray(s):a==="object"?s&&!Array.isArray(s)&&typeof s=="object":a===typeof s)}function Ae(s,n){return s.kind==="array"&&n.kind==="array"?s.itemType.kind===n.itemType.kind&&typeof s.N=="number":s.kind===n.kind}const _e=.96422,He=.82521,Je=4/29,$e=6/29,ut=3*$e*$e,Rt=$e*$e*$e,Ot=Math.PI/180,mr=180/Math.PI;function Qt(s){return(s%=360)<0&&(s+=360),s}function gr([s,n,a,d]){let y,x;const w=Tn((.2225045*(s=or(s))+.7168786*(n=or(n))+.0606169*(a=or(a)))/1);s===n&&n===a?y=x=w:(y=Tn((.4360747*s+.3850649*n+.1430804*a)/_e),x=Tn((.0139322*s+.0971045*n+.7141733*a)/He));const b=116*w-16;return[b<0?0:b,500*(y-w),200*(w-x),d]}function or(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Tn(s){return s>Rt?Math.pow(s,1/3):s/ut+Je}function rn([s,n,a,d]){let y=(s+16)/116,x=isNaN(n)?y:y+n/500,w=isNaN(a)?y:y-a/200;return y=1*Mr(y),x=_e*Mr(x),w=He*Mr(w),[rr(3.1338561*x-1.6168667*y-.4906146*w),rr(-.9787684*x+1.9161415*y+.033454*w),rr(.0719453*x-.2289914*y+1.4052427*w),d]}function rr(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Mr(s){return s>$e?s*s*s:ut*(s-Je)}function Yr(s){return parseInt(s.padEnd(2,s),16)/255}function Dn(s,n){return Bn(n?s/100:s,0,1)}function Bn(s,n,a){return Math.min(Math.max(n,s),a)}function ni(s){return!s.some(Number.isNaN)}const Fa={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]};class Ar{constructor(n,a,d,y=1,x=!0){this.r=n,this.g=a,this.b=d,this.a=y,x||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[n,a,d,y]))}static parse(n){if(n instanceof Ar)return n;if(typeof n!="string")return;const a=function(d){if((d=d.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Fa[d];if(y){const[w,b,k]=y;return[w/255,b/255,k/255,1]}if(d.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(d)){const w=d.length<6?1:2;let b=1;return[Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+w)||"ff")]}if(d.startsWith("rgb")){const w=d.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[b,k,I,D,L,U,Z,K,J,le,fe,De]=w,be=[D||" ",Z||" ",le].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Me=[I,U,J].join(""),Ve=Me==="%%%"?100:Me===""?255:0;if(Ve){const et=[Bn(+k/Ve,0,1),Bn(+L/Ve,0,1),Bn(+K/Ve,0,1),fe?Dn(+fe,De):1];if(ni(et))return et}}return}}const x=d.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,b,k,I,D,L,U,Z,K]=x,J=[k||" ",D||" ",U].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const le=[+b,Bn(+I,0,100),Bn(+L,0,100),Z?Dn(+Z,K):1];if(ni(le))return function([fe,De,be,Me]){function Ve(et){const xt=(et+fe/30)%12,Nt=De*Math.min(be,1-be);return be-Nt*Math.max(-1,Math.min(xt-3,9-xt,1))}return fe=Qt(fe),De/=100,be/=100,[Ve(0),Ve(8),Ve(4),Me]}(le)}}}(n);return a?new Ar(...a,!1):void 0}get rgb(){const{r:n,g:a,b:d,a:y}=this,x=y||1/0;return this.overwriteGetter("rgb",[n/x,a/x,d/x,y])}get hcl(){return this.overwriteGetter("hcl",function(n){const[a,d,y,x]=gr(n),w=Math.sqrt(d*d+y*y);return[Math.round(1e4*w)?Qt(Math.atan2(y,d)*mr):NaN,w,a,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",gr(this.rgb))}overwriteGetter(n,a){return Object.defineProperty(this,n,{value:a}),a}toString(){const[n,a,d,y]=this.rgb;return`rgba(${[n,a,d].map(x=>Math.round(255*x)).join(",")},${y})`}}Ar.black=new Ar(0,0,0,1),Ar.white=new Ar(1,1,1,1),Ar.transparent=new Ar(0,0,0,0),Ar.red=new Ar(1,0,0,1);class qh{constructor(n,a,d){this.sensitivity=n?a?"variant":"case":a?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,a){return this.collator.compare(n,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yh{constructor(n,a,d,y,x){this.text=n,this.image=a,this.scale=d,this.fontStack=y,this.textColor=x}}class Mi{constructor(n){this.sections=n}static fromString(n){return new Mi([new Yh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof Mi?n:Mi.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class Ai{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Ai)return n;if(typeof n=="number")return new Ai([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const a of n)if(typeof a!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new Ai(n)}}toString(){return JSON.stringify(this.values)}}const P_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xi{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Xi)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let a=0;a=0&&s<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof a=="number"&&a>=0&&a<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,n,a,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,n,a,d]:[s,n,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ko(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Ar||s instanceof qh||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di)return!0;if(Array.isArray(s)){for(const n of s)if(!Ko(n))return!1;return!0}if(typeof s=="object"){for(const n in s)if(!Ko(s[n]))return!1;return!0}return!1}function En(s){if(s===null)return pi;if(typeof s=="string")return Kt;if(typeof s=="boolean")return Ut;if(typeof s=="number")return Qe;if(s instanceof Ar)return Kr;if(s instanceof qh)return Yi;if(s instanceof Mi)return fs;if(s instanceof Ai)return ps;if(s instanceof Xi)return he;if(s instanceof Di)return Hn;if(Array.isArray(s)){const n=s.length;let a;for(const d of s){const y=En(d);if(a){if(a===y)continue;a=Xt;break}a=y}return G(a||Xt,n)}return mi}function Zl(s){const n=typeof s;return s===null?"":n==="string"||n==="number"||n==="boolean"?String(s):s instanceof Ar||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di?s.toString():JSON.stringify(s)}class ms{constructor(n,a){this.type=n,this.value=a}static parse(n,a){if(n.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!Ko(n[1]))return a.error("invalid value");const d=n[1];let y=En(d);const x=a.expectedType;return y.kind!=="array"||y.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(y=x),new ms(y,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class xn{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const Ju={string:Kt,number:Qe,boolean:Ut,object:mi};class gs{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");let d,y=1;const x=n[0];if(x==="array"){let b,k;if(n.length>2){const I=n[1];if(typeof I!="string"||!(I in Ju)||I==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=Ju[I],y++}else b=Xt;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return a.error('The length argument to "array" must be a positive integer literal',2);k=n[2],y++}d=G(b,k)}else{if(!Ju[x])throw new Error(`Types doesn't contain name = ${x}`);d=Ju[x]}const w=[];for(;yn.outputDefined())}}const Xh={"to-boolean":Ut,"to-color":Kr,"to-number":Qe,"to-string":Kt};class ys{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[0];if(!Xh[d])throw new Error(`Can't parse ${d} as it is not part of the known types`);if((d==="to-boolean"||d==="to-string")&&n.length!==2)return a.error("Expected one argument.");const y=Xh[d],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Ba(a[0],a[1],a[2],a[3]),!d))return new Ar(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new xn(d||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const d of this.args){a=d.evaluate(n);const y=Ai.parse(a);if(y)return y}throw new xn(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const d of this.args){a=d.evaluate(n);const y=Xi.parse(a);if(y)return y}throw new xn(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const d of this.args){if(a=d.evaluate(n),a===null)return 0;const y=Number(a);if(!isNaN(y))return y}throw new xn(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Mi.fromString(Zl(this.args[0].evaluate(n)));case"resolvedImage":return Di.fromString(Zl(this.args[0].evaluate(n)));default:return Zl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const M_=["Unknown","Point","LineString","Polygon"];class Qu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?M_[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(n){let a=this._parseColorCache[n];return a||(a=this._parseColorCache[n]=Ar.parse(n)),a}}class Jo{constructor(n,a,d=[],y,x=new vn,w=[]){this.registry=n,this.path=d,this.key=d.map(b=>`[${b}]`).join(""),this.scope=x,this.errors=w,this.expectedType=y,this._isConstant=a}parse(n,a,d,y,x={}){return a?this.concat(a,d,y)._parse(n,x):this._parse(n,x)}_parse(n,a){function d(y,x,w){return w==="assert"?new gs(x,[y]):w==="coerce"?new ys(x,[y]):y}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=n[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[y];if(x){let w=x.parse(n,this);if(!w)return null;if(this.expectedType){const b=this.expectedType,k=w.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||k.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string")if(b.kind!=="padding"||k.kind!=="value"&&k.kind!=="number"&&k.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||k.kind!=="value"&&k.kind!=="array"){if(this.checkSubtype(b,k))return null}else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"assert")}if(!(w instanceof ms)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const b=new Qu;try{w=new ms(w.type,w.evaluate(b))}catch(k){return this.error(k.message),null}}return w}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,a,d){const y=typeof n=="number"?this.path.concat(n):this.path,x=d?this.scope.concat(d):this.scope;return new Jo(this.registry,this._isConstant,y,a||null,x,this.errors)}error(n,...a){const d=`${this.key}${a.map(y=>`[${y}]`).join("")}`;this.errors.push(new _n(d,n))}checkSubtype(n,a){const d=ue(n,a);return d&&this.error(d),d}}class Po{constructor(n,a){this.type=a.type,this.bindings=[].concat(n),this.result=a}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const a of this.bindings)n(a[1]);n(this.result)}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const d=[];for(let x=1;x=d.length)throw new xn(`Array index out of bounds: ${a} > ${d.length-1}.`);if(a!==Math.floor(a))throw new xn(`Array index must be an integer, but found ${a} instead.`);return d[a]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class Jh{constructor(n,a){this.type=Ut,this.needle=n,this.haystack=a}static parse(n,a){if(n.length!==3)return a.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);return d&&y?Se(d.type,[Ut,Kt,Qe,pi,Xt])?new Jh(d,y):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`):null}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!d)return!1;if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);if(!Ie(d,["string","array"]))throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`);return d.indexOf(a)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class Na{constructor(n,a,d){this.type=Qe,this.needle=n,this.haystack=a,this.fromIndex=d}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);if(!d||!y)return null;if(!Se(d.type,[Ut,Kt,Qe,pi,Xt]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new Na(d,y,x):null}return new Na(d,y)}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(n)),Ie(d,["string"])){const x=d.indexOf(a,y);return x===-1?-1:[...d.slice(0,x)].length}if(Ie(d,["array"]))return d.indexOf(a,y);throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class Qh{constructor(n,a,d,y,x,w){this.inputType=n,this.type=a,this.input=d,this.cases=y,this.outputs=x,this.otherwise=w}static parse(n,a){if(n.length<5)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return a.error("Expected an even number of arguments.");let d,y;a.expectedType&&a.expectedType.kind!=="value"&&(y=a.expectedType);const x={},w=[];for(let I=2;INumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return U.error("Numeric branch labels must be integer values.");if(d){if(U.checkSubtype(d,En(K)))return null}else d=En(K);if(x[String(K)]!==void 0)return U.error("Branch labels must be unique.");x[String(K)]=w.length}const Z=a.parse(L,I,y);if(!Z)return null;y=y||Z.type,w.push(Z)}const b=a.parse(n[1],1,Xt);if(!b)return null;const k=a.parse(n[n.length-1],n.length-1,y);return k?b.type.kind!=="value"&&a.concat(1).checkSubtype(d,b.type)?null:new Qh(d,y,b,x,w,k):null}evaluate(n){const a=this.input.evaluate(n);return(En(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class ec{constructor(n,a,d){this.type=n,this.branches=a,this.otherwise=d}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return a.error("Expected an odd number of arguments.");let d;a.expectedType&&a.expectedType.kind!=="value"&&(d=a.expectedType);const y=[];for(let w=1;wa.outputDefined())&&this.otherwise.outputDefined()}}class ql{constructor(n,a,d,y){this.type=n,this.input=a,this.beginIndex=d,this.endIndex=y}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Qe);if(!d||!y)return null;if(!Se(d.type,[G(Xt),Kt,Xt]))return a.error(`Expected first argument to be of type array or string, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new ql(d.type,d,y,x):null}return new ql(d.type,d,y)}evaluate(n){const a=this.input.evaluate(n),d=this.beginIndex.evaluate(n);let y;if(this.endIndex&&(y=this.endIndex.evaluate(n)),Ie(a,["string"]))return[...a].slice(d,y).join("");if(Ie(a,["array"]))return a.slice(d,y);throw new xn(`Expected first argument to be of type array or string, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function tc(s,n){const a=s.length-1;let d,y,x=0,w=a,b=0;for(;x<=w;)if(b=Math.floor((x+w)/2),d=s[b],y=s[b+1],d<=n){if(b===a||nn))throw new xn("Input is not a number.");w=b-1}return 0}class $a{constructor(n,a,d){this.type=n,this.input=a,this.labels=[],this.outputs=[];for(const[y,x]of d)this.labels.push(y),this.outputs.push(x)}static parse(n,a){if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=[];let x=null;a.expectedType&&a.expectedType.kind!=="value"&&(x=a.expectedType);for(let w=1;w=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);const L=a.parse(k,D,x);if(!L)return null;x=x||L.type,y.push([b,L])}return new $a(x,d,y)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;return y>=a[x-1]?d[x-1].evaluate(n):d[tc(a,y)].evaluate(n)}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Mp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var A_=Ap;function Ap(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}Ap.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var D_=Mp(A_);function Qo(s,n,a){return s+a*(n-s)}function Yl(s,n,a){return s.map((d,y)=>Qo(d,n[y],a))}const gi={number:Qo,color:function(s,n,a,d="rgb"){switch(d){case"rgb":{const[y,x,w,b]=Yl(s.rgb,n.rgb,a);return new Ar(y,x,w,b,!1)}case"hcl":{const[y,x,w,b]=s.hcl,[k,I,D,L]=n.hcl;let U,Z;if(isNaN(y)||isNaN(k))isNaN(y)?isNaN(k)?U=NaN:(U=k,w!==1&&w!==0||(Z=I)):(U=y,D!==1&&D!==0||(Z=x));else{let De=k-y;k>y&&De>180?De-=360:k180&&(De+=360),U=y+a*De}const[K,J,le,fe]=function([De,be,Me,Ve]){return De=isNaN(De)?0:De*Ot,rn([Me,Math.cos(De)*be,Math.sin(De)*be,Ve])}([U,Z??Qo(x,I,a),Qo(w,D,a),Qo(b,L,a)]);return new Ar(K,J,le,fe,!1)}case"lab":{const[y,x,w,b]=rn(Yl(s.lab,n.lab,a));return new Ar(y,x,w,b,!1)}}},array:Yl,padding:function(s,n,a){return new Ai(Yl(s.values,n.values,a))},variableAnchorOffsetCollection:function(s,n,a){const d=s.values,y=n.values;if(d.length!==y.length)throw new xn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${n.toString()}`);const x=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:I}}}if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(x=a.parse(x,2,Qe),!x)return null;const b=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=Kr:a.expectedType&&a.expectedType.kind!=="value"&&(k=a.expectedType);for(let I=0;I=D)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const K=a.parse(L,Z,k);if(!K)return null;k=k||K.type,b.push([D,K])}return Ae(k,Qe)||Ae(k,Kr)||Ae(k,ps)||Ae(k,he)||Ae(k,G(Qe))?new yi(k,d,y,x,b):a.error(`Type ${W(k)} is not interpolatable.`)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;if(y>=a[x-1])return d[x-1].evaluate(n);const w=tc(a,y),b=yi.interpolationFactor(this.interpolation,y,a[w],a[w+1]),k=d[w].evaluate(n),I=d[w+1].evaluate(n);switch(this.operator){case"interpolate":return gi[this.type.kind](k,I,b);case"interpolate-hcl":return gi.color(k,I,b,"hcl");case"interpolate-lab":return gi.color(k,I,b,"lab")}}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function rc(s,n,a,d){const y=d-a,x=s-a;return y===0?0:n===1?x/y:(Math.pow(n,x)-1)/(Math.pow(n,y)-1)}class nc{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expectected at least one argument.");let d=null;const y=a.expectedType;y&&y.kind!=="value"&&(d=y);const x=[];for(const b of n.slice(1)){const k=a.parse(b,1+x.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,x.push(k)}if(!d)throw new Error("No output type");const w=y&&x.some(b=>ue(y,b.type));return new nc(w?Xt:d,x)}evaluate(n){let a,d=null,y=0;for(const x of this.args)if(y++,d=x.evaluate(n),d&&d instanceof Di&&!d.available&&(a||(a=d.name),d=null,y===this.args.length&&(d=a)),d!==null)break;return d}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}function ic(s,n){return s==="=="||s==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function Dp(s,n,a,d){return d.compare(n,a)===0}function Ua(s,n,a){const d=s!=="=="&&s!=="!=";return class yP{constructor(x,w,b){this.type=Ut,this.lhs=x,this.rhs=w,this.collator=b,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const b=x[0];let k=w.parse(x[1],1,Xt);if(!k)return null;if(!ic(b,k.type))return w.concat(1).error(`"${b}" comparisons are not supported for type '${W(k.type)}'.`);let I=w.parse(x[2],2,Xt);if(!I)return null;if(!ic(b,I.type))return w.concat(2).error(`"${b}" comparisons are not supported for type '${W(I.type)}'.`);if(k.type.kind!==I.type.kind&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error(`Cannot compare types '${W(k.type)}' and '${W(I.type)}'.`);d&&(k.type.kind==="value"&&I.type.kind!=="value"?k=new gs(I.type,[k]):k.type.kind!=="value"&&I.type.kind==="value"&&(I=new gs(k.type,[I])));let D=null;if(x.length===4){if(k.type.kind!=="string"&&I.type.kind!=="string"&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(x[3],3,Yi),!D)return null}return new yP(k,I,D)}evaluate(x){const w=this.lhs.evaluate(x),b=this.rhs.evaluate(x);if(d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!==I.kind||k.kind!=="string"&&k.kind!=="number")throw new xn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${I.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!=="string"||I.kind!=="string")return n(x,w,b)}return this.collator?a(x,w,b,this.collator.evaluate(x)):n(x,w,b)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const z_=Ua("==",function(s,n,a){return n===a},Dp),zp=Ua("!=",function(s,n,a){return n!==a},function(s,n,a,d){return!Dp(0,n,a,d)}),Rp=Ua("<",function(s,n,a){return n",function(s,n,a){return n>a},function(s,n,a,d){return d.compare(n,a)>0}),L_=Ua("<=",function(s,n,a){return n<=a},function(s,n,a,d){return d.compare(n,a)<=0}),Lp=Ua(">=",function(s,n,a){return n>=a},function(s,n,a,d){return d.compare(n,a)>=0});class Xl{constructor(n,a,d){this.type=Yi,this.locale=d,this.caseSensitive=n,this.diacriticSensitive=a}static parse(n,a){if(n.length!==2)return a.error("Expected one argument.");const d=n[1];if(typeof d!="object"||Array.isArray(d))return a.error("Collator options argument must be an object.");const y=a.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,Ut);if(!y)return null;const x=a.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,Ut);if(!x)return null;let w=null;return d.locale&&(w=a.parse(d.locale,1,Kt),!w)?null:new Xl(y,x,w)}evaluate(n){return new qh(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}class ed{constructor(n,a,d,y,x){this.type=Kt,this.number=n,this.locale=a,this.currency=d,this.minFractionDigits=y,this.maxFractionDigits=x}static parse(n,a){if(n.length!==3)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=n[2];if(typeof y!="object"||Array.isArray(y))return a.error("NumberFormat options argument must be an object.");let x=null;if(y.locale&&(x=a.parse(y.locale,1,Kt),!x))return null;let w=null;if(y.currency&&(w=a.parse(y.currency,1,Kt),!w))return null;let b=null;if(y["min-fraction-digits"]&&(b=a.parse(y["min-fraction-digits"],1,Qe),!b))return null;let k=null;return y["max-fraction-digits"]&&(k=a.parse(y["max-fraction-digits"],1,Qe),!k)?null:new ed(d,x,w,b,k)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class sc{constructor(n){this.type=fs,this.sections=n}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[1];if(!Array.isArray(d)&&typeof d=="object")return a.error("First argument must be an image or text section.");const y=[];let x=!1;for(let w=1;w<=n.length-1;++w){const b=n[w];if(x&&typeof b=="object"&&!Array.isArray(b)){x=!1;let k=null;if(b["font-scale"]&&(k=a.parse(b["font-scale"],1,Qe),!k))return null;let I=null;if(b["text-font"]&&(I=a.parse(b["text-font"],1,G(Kt)),!I))return null;let D=null;if(b["text-color"]&&(D=a.parse(b["text-color"],1,Kr),!D))return null;const L=y[y.length-1];L.scale=k,L.font=I,L.textColor=D}else{const k=a.parse(n[w],1,Xt);if(!k)return null;const I=k.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,y.push({content:k,scale:null,font:null,textColor:null})}}return new sc(y)}evaluate(n){return new Mi(this.sections.map(a=>{const d=a.content.evaluate(n);return En(d)===Hn?new Yh("",d,null,null,null):new Yh(Zl(d),null,a.scale?a.scale.evaluate(n):null,a.font?a.font.evaluate(n).join(","):null,a.textColor?a.textColor.evaluate(n):null)}))}eachChild(n){for(const a of this.sections)n(a.content),a.scale&&n(a.scale),a.font&&n(a.font),a.textColor&&n(a.textColor)}outputDefined(){return!1}}class td{constructor(n){this.type=Hn,this.input=n}static parse(n,a){if(n.length!==2)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Kt);return d?new td(d):a.error("No image name provided.")}evaluate(n){const a=this.input.evaluate(n),d=Di.fromString(a);return d&&n.availableImages&&(d.available=n.availableImages.indexOf(a)>-1),d}eachChild(n){n(this.input)}outputDefined(){return!1}}class rd{constructor(n){this.type=Qe,this.input=n}static parse(n,a){if(n.length!==2)return a.error(`Expected 1 argument, but found ${n.length-1} instead.`);const d=a.parse(n[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${W(d.type)} instead.`):new rd(d):null}evaluate(n){const a=this.input.evaluate(n);if(typeof a=="string")return[...a].length;if(Array.isArray(a))return a.length;throw new xn(`Expected value to be of type string or array, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const js=8192;function O_(s,n){const a=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,y=Math.pow(2,n.z);return[Math.round(a*y*js),Math.round(d*y*js)]}function nd(s,n){const a=Math.pow(2,n.z);return[(y=(s[0]/js+n.x)/a,360*y-180),(d=(s[1]/js+n.y)/a,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,y}function ea(s,n){s[0]=Math.min(s[0],n[0]),s[1]=Math.min(s[1],n[1]),s[2]=Math.max(s[2],n[0]),s[3]=Math.max(s[3],n[1])}function Mo(s,n){return!(s[0]<=n[0]||s[2]>=n[2]||s[1]<=n[1]||s[3]>=n[3])}function Er(s,n,a){const d=s[0]-n[0],y=s[1]-n[1],x=s[0]-a[0],w=s[1]-a[1];return d*w-x*y==0&&d*x<=0&&y*w<=0}function oc(s,n,a,d){return(y=[d[0]-a[0],d[1]-a[1]])[0]*(x=[n[0]-s[0],n[1]-s[1]])[1]-y[1]*x[0]!=0&&!(!Fp(s,n,a,d)||!Fp(a,d,s,n));var y,x}function F_(s,n,a){for(const d of a)for(let y=0;y(y=s)[1]!=(w=b[k+1])[1]>y[1]&&y[0]<(w[0]-x[0])*(y[1]-x[1])/(w[1]-x[1])+x[0]&&(d=!d)}var y,x,w;return d}function B_(s,n){for(const a of n)if(ja(s,a))return!0;return!1}function Op(s,n){for(const a of s)if(!ja(a,n))return!1;for(let a=0;a0&&b<0||w<0&&b>0}function id(s,n,a){const d=[];for(let y=0;ya[2]){const y=.5*d;let x=s[0]-a[0]>y?-d:a[0]-s[0]>y?d:0;x===0&&(x=s[0]-a[2]>y?-d:a[2]-s[0]>y?d:0),s[0]+=x}ea(n,s)}function $p(s,n,a,d){const y=Math.pow(2,d.z)*js,x=[d.x*js,d.y*js],w=[];for(const b of s)for(const k of b){const I=[k.x+x[0],k.y+x[1]];Np(I,n,a,y),w.push(I)}return w}function Up(s,n,a,d){const y=Math.pow(2,d.z)*js,x=[d.x*js,d.y*js],w=[];for(const k of s){const I=[];for(const D of k){const L=[D.x+x[0],D.y+x[1]];ea(n,L),I.push(L)}w.push(I)}if(n[2]-n[0]<=y/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const k of w)for(const I of k)Np(I,n,a,y)}var b;return w}class ta{constructor(n,a){this.type=Ut,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection"){const y=[];for(const x of d.features){const{type:w,coordinates:b}=x.geometry;w==="Polygon"&&y.push(b),w==="MultiPolygon"&&y.push(...b)}if(y.length)return new ta(d,{type:"MultiPolygon",coordinates:y})}else if(d.type==="Feature"){const y=d.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new ta(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new ta(d,d)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!ja(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!B_(I,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=Up(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!Op(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=Up(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!N_(I,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let jp=class{constructor(s=[],n=(a,d)=>ad?1:0){if(this.data=s,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:n,compare:a}=this,d=n[s];for(;s>0;){const y=s-1>>1,x=n[y];if(a(d,x)>=0)break;n[s]=x,s=y}n[s]=d}_down(s){const{data:n,compare:a}=this,d=this.length>>1,y=n[s];for(;s=0)break;n[s]=n[x],s=x}n[s]=y}};function $_(s,n,a,d,y){Vp(s,n,a,d||s.length-1,y||U_)}function Vp(s,n,a,d,y){for(;d>a;){if(d-a>600){var x=d-a+1,w=n-a+1,b=Math.log(x),k=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*k*(x-k)/x)*(w-x/2<0?-1:1);Vp(s,n,Math.max(a,Math.floor(n-w*k/x+I)),Math.min(d,Math.floor(n+(x-w)*k/x+I)),y)}var D=s[n],L=a,U=d;for(Kl(s,a,n),y(s[d],D)>0&&Kl(s,a,d);L0;)U--}y(s[a],D)===0?Kl(s,a,U):Kl(s,++U,d),U<=n&&(a=U+1),n<=U&&(d=U-1)}}function Kl(s,n,a){var d=s[n];s[n]=s[a],s[a]=d}function U_(s,n){return sn?1:0}function ac(s,n){if(s.length<=1)return[s];const a=[];let d,y;for(const x of s){const w=V_(x);w!==0&&(x.area=Math.abs(w),y===void 0&&(y=w<0),y===w<0?(d&&a.push(d),d=[x]):d.push(x))}if(d&&a.push(d),n>1)for(let x=0;x1?(I=n[k+1][0],D=n[k+1][1]):Z>0&&(I+=L/this.kx*Z,D+=U/this.ky*Z)),L=this.wrap(a[0]-I)*this.kx,U=(a[1]-D)*this.ky;const K=L*L+U*U;K180;)n-=360;return n}}function Zp(s,n){return n[0]-s[0]}function lc(s){return s[1]-s[0]+1}function ao(s,n){return s[1]>=s[0]&&s[1]s[1])return[null,null];const a=lc(s);if(n){if(a===2)return[s,null];const y=Math.floor(a/2);return[[s[0],s[0]+y],[s[0]+y,s[1]]]}if(a===1)return[s,null];const d=Math.floor(a/2)-1;return[[s[0],s[0]+d],[s[0]+d+1,s[1]]]}function ad(s,n){if(!ao(n,s.length))return[1/0,1/0,-1/0,-1/0];const a=[1/0,1/0,-1/0,-1/0];for(let d=n[0];d<=n[1];++d)ea(a,s[d]);return a}function ld(s){const n=[1/0,1/0,-1/0,-1/0];for(const a of s)for(const d of a)ea(n,d);return n}function uc(s){return s[0]!==-1/0&&s[1]!==-1/0&&s[2]!==1/0&&s[3]!==1/0}function ud(s,n,a){if(!uc(s)||!uc(n))return NaN;let d=0,y=0;return s[2]n[2]&&(d=s[0]-n[2]),s[1]>n[3]&&(y=s[1]-n[3]),s[3]=d)return d;if(Mo(y,x)){if(cc(s,n))return 0}else if(cc(n,s))return 0;let w=1/0;for(const b of s)for(let k=0,I=b.length,D=I-1;k0;){const k=w.pop();if(k[0]>=x)continue;const I=k[1],D=n?50:100;if(lc(I)<=D){if(!ao(I,s.length))return NaN;if(n){const L=ir(s,I,a,d);if(isNaN(L)||L===0)return L;x=Math.min(x,L)}else for(let L=I[0];L<=I[1];++L){const U=W_(s[L],a,d);if(x=Math.min(x,U),x===0)return 0}}else{const L=od(I,n);Rr(w,x,d,s,b,L[0]),Rr(w,x,d,s,b,L[1])}}return x}function Ql(s,n,a,d,y,x=1/0){let w=Math.min(x,y.distance(s[0],a[0]));if(w===0)return w;const b=new jp([[0,[0,s.length-1],[0,a.length-1]]],Zp);for(;b.length>0;){const k=b.pop();if(k[0]>=w)continue;const I=k[1],D=k[2],L=n?50:100,U=d?50:100;if(lc(I)<=L&&lc(D)<=U){if(!ao(I,s.length)&&ao(D,a.length))return NaN;let Z;if(n&&d)Z=H_(s,I,a,D,y),w=Math.min(w,Z);else if(n&&!d){const K=s.slice(I[0],I[1]+1);for(let J=D[0];J<=D[1];++J)if(Z=ra(a[J],K,y),w=Math.min(w,Z),w===0)return w}else if(!n&&d){const K=a.slice(D[0],D[1]+1);for(let J=I[0];J<=I[1];++J)if(Z=ra(s[J],K,y),w=Math.min(w,Z),w===0)return w}else Z=fn(s,I,a,D,y),w=Math.min(w,Z)}else{const Z=od(I,n),K=od(D,d);na(b,w,y,s,a,Z[0],K[0]),na(b,w,y,s,a,Z[0],K[1]),na(b,w,y,s,a,Z[1],K[0]),na(b,w,y,s,a,Z[1],K[1])}}return w}function hd(s){return s.type==="MultiPolygon"?s.coordinates.map(n=>({type:"Polygon",coordinates:n})):s.type==="MultiLineString"?s.coordinates.map(n=>({type:"LineString",coordinates:n})):s.type==="MultiPoint"?s.coordinates.map(n=>({type:"Point",coordinates:n})):[s]}class ia{constructor(n,a){this.type=Qe,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'distance' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection")return new ia(d,d.features.map(y=>hd(y.geometry)).flat());if(d.type==="Feature")return new ia(d,hd(d.geometry));if("type"in d&&"coordinates"in d)return new ia(d,hd(d))}return a.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!1,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!1,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!1,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!0,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!0,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!0,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="Polygon")return function(a,d){const y=a.geometry();if(y.length===0||y[0].length===0)return NaN;const x=ac(y,0).map(k=>k.map(I=>I.map(D=>nd([D.x,D.y],a.canonical)))),w=new sd(x[0][0][0][1]);let b=1/0;for(const k of d)for(const I of x){switch(k.type){case"Point":b=Math.min(b,Jl([k.coordinates],!1,I,w,b));break;case"LineString":b=Math.min(b,Jl(k.coordinates,!0,I,w,b));break;case"Polygon":b=Math.min(b,Nr(I,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Va={"==":z_,"!=":zp,">":R_,"<":Rp,">=":Lp,"<=":L_,array:gs,at:Kh,boolean:gs,case:ec,coalesce:nc,collator:Xl,format:sc,image:td,in:Jh,"index-of":Na,interpolate:yi,"interpolate-hcl":yi,"interpolate-lab":yi,length:rd,let:Po,literal:ms,match:Qh,number:gs,"number-format":ed,object:gs,slice:ql,step:$a,string:gs,"to-boolean":ys,"to-color":ys,"to-number":ys,"to-string":ys,var:Sr,within:ta,distance:ia};class Ki{constructor(n,a,d,y){this.name=n,this.type=a,this._evaluate=d,this.args=y}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,a){const d=n[0],y=Ki.definitions[d];if(!y)return a.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(y)?y[0]:y.type,w=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,b=w.filter(([I])=>!Array.isArray(I)||I.length===n.length-1);let k=null;for(const[I,D]of b){k=new Jo(a.registry,eu,a.path,null,a.scope);const L=[];let U=!1;for(let Z=1;Z{return U=L,Array.isArray(U)?`(${U.map(W).join(", ")})`:`(${W(U.type)}...)`;var U}).join(" | "),D=[];for(let L=1;L{a=n?a&&eu(d):a&&d instanceof ms}),!!a&&tu(s)&&ru(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function tu(s){if(s instanceof Ki&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ta||s instanceof ia)return!1;let n=!0;return s.eachChild(a=>{n&&!tu(a)&&(n=!1)}),n}function Ha(s){if(s instanceof Ki&&s.name==="feature-state")return!1;let n=!0;return s.eachChild(a=>{n&&!Ha(a)&&(n=!1)}),n}function ru(s,n){if(s instanceof Ki&&n.indexOf(s.name)>=0)return!1;let a=!0;return s.eachChild(d=>{a&&!ru(d,n)&&(a=!1)}),a}function hc(s){return{result:"success",value:s}}function Wa(s){return{result:"error",value:s}}function Ga(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function qp(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function md(s){return!!s.expression&&s.expression.interpolated}function vr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function dc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function G_(s){return s}function Yp(s,n){const a=n.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",y=d||!(d||s.property!==void 0),x=s.type||(md(n)?"exponential":"interval");if(a||n.type==="padding"){const D=a?Ar.parse:Ai.parse;(s=tn({},s)).stops&&(s.stops=s.stops.map(L=>[L[0],D(L[1])])),s.default=D(s.default?s.default:n.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let b,k,I;if(x==="exponential")b=Kp;else if(x==="interval")b=fc;else if(x==="categorical"){b=Xp,k=Object.create(null);for(const D of s.stops)k[D[0]]=D[1];I=typeof s.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);b=Jp}if(d){const D={},L=[];for(let K=0;KK[0]),evaluate:({zoom:K},J)=>Kp({stops:U,base:s.base},n,K).evaluate(K,J)}}if(y){const D=x==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:yi.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(L=>L[0]),evaluate:({zoom:L})=>b(s,n,L,k,I)}}return{kind:"source",evaluate(D,L){const U=L&&L.properties?L.properties[s.property]:void 0;return U===void 0?Za(s.default,n.default):b(s,n,U,k,I)}}}function Za(s,n,a){return s!==void 0?s:n!==void 0?n:a!==void 0?a:void 0}function Xp(s,n,a,d,y){return Za(typeof a===y?d[a]:void 0,s.default,n.default)}function fc(s,n,a){if(vr(a)!=="number")return Za(s.default,n.default);const d=s.stops.length;if(d===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[d-1][0])return s.stops[d-1][1];const y=tc(s.stops.map(x=>x[0]),a);return s.stops[y][1]}function Kp(s,n,a){const d=s.base!==void 0?s.base:1;if(vr(a)!=="number")return Za(s.default,n.default);const y=s.stops.length;if(y===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[y-1][0])return s.stops[y-1][1];const x=tc(s.stops.map(D=>D[0]),a),w=function(D,L,U,Z){const K=Z-U,J=D-U;return K===0?0:L===1?J/K:(Math.pow(L,J)-1)/(Math.pow(L,K)-1)}(a,d,s.stops[x][0],s.stops[x+1][0]),b=s.stops[x][1],k=s.stops[x+1][1],I=gi[n.type]||G_;return typeof b.evaluate=="function"?{evaluate(...D){const L=b.evaluate.apply(void 0,D),U=k.evaluate.apply(void 0,D);if(L!==void 0&&U!==void 0)return I(L,U,w,s.colorSpace)}}:I(b,k,w,s.colorSpace)}function Jp(s,n,a){switch(n.type){case"color":a=Ar.parse(a);break;case"formatted":a=Mi.fromString(a.toString());break;case"resolvedImage":a=Di.fromString(a.toString());break;case"padding":a=Ai.parse(a);break;default:vr(a)===n.type||n.type==="enum"&&n.values[a]||(a=void 0)}return Za(a,s.default,n.default)}Ki.register(Va,{error:[{kind:"error"},[Kt],(s,[n])=>{throw new xn(n.evaluate(s))}],typeof:[Kt,[Xt],(s,[n])=>W(En(n.evaluate(s)))],"to-rgba":[G(Qe,4),[Kr],(s,[n])=>{const[a,d,y,x]=n.evaluate(s).rgb;return[255*a,255*d,255*y,x]}],rgb:[Kr,[Qe,Qe,Qe],dd],rgba:[Kr,[Qe,Qe,Qe,Qe],dd],has:{type:Ut,overloads:[[[Kt],(s,[n])=>fd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>fd(n.evaluate(s),a.evaluate(s))]]},get:{type:Xt,overloads:[[[Kt],(s,[n])=>pd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>pd(n.evaluate(s),a.evaluate(s))]]},"feature-state":[Xt,[Kt],(s,[n])=>pd(n.evaluate(s),s.featureState||{})],properties:[mi,[],s=>s.properties()],"geometry-type":[Kt,[],s=>s.geometryType()],id:[Xt,[],s=>s.id()],zoom:[Qe,[],s=>s.globals.zoom],"heatmap-density":[Qe,[],s=>s.globals.heatmapDensity||0],"line-progress":[Qe,[],s=>s.globals.lineProgress||0],accumulated:[Xt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Qe,sa(Qe),(s,n)=>{let a=0;for(const d of n)a+=d.evaluate(s);return a}],"*":[Qe,sa(Qe),(s,n)=>{let a=1;for(const d of n)a*=d.evaluate(s);return a}],"-":{type:Qe,overloads:[[[Qe,Qe],(s,[n,a])=>n.evaluate(s)-a.evaluate(s)],[[Qe],(s,[n])=>-n.evaluate(s)]]},"/":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)/a.evaluate(s)],"%":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)%a.evaluate(s)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(s,[n,a])=>Math.pow(n.evaluate(s),a.evaluate(s))],sqrt:[Qe,[Qe],(s,[n])=>Math.sqrt(n.evaluate(s))],log10:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN10],ln:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))],log2:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN2],sin:[Qe,[Qe],(s,[n])=>Math.sin(n.evaluate(s))],cos:[Qe,[Qe],(s,[n])=>Math.cos(n.evaluate(s))],tan:[Qe,[Qe],(s,[n])=>Math.tan(n.evaluate(s))],asin:[Qe,[Qe],(s,[n])=>Math.asin(n.evaluate(s))],acos:[Qe,[Qe],(s,[n])=>Math.acos(n.evaluate(s))],atan:[Qe,[Qe],(s,[n])=>Math.atan(n.evaluate(s))],min:[Qe,sa(Qe),(s,n)=>Math.min(...n.map(a=>a.evaluate(s)))],max:[Qe,sa(Qe),(s,n)=>Math.max(...n.map(a=>a.evaluate(s)))],abs:[Qe,[Qe],(s,[n])=>Math.abs(n.evaluate(s))],round:[Qe,[Qe],(s,[n])=>{const a=n.evaluate(s);return a<0?-Math.round(-a):Math.round(a)}],floor:[Qe,[Qe],(s,[n])=>Math.floor(n.evaluate(s))],ceil:[Qe,[Qe],(s,[n])=>Math.ceil(n.evaluate(s))],"filter-==":[Ut,[Kt,Xt],(s,[n,a])=>s.properties()[n.value]===a.value],"filter-id-==":[Ut,[Xt],(s,[n])=>s.id()===n.value],"filter-type-==":[Ut,[Kt],(s,[n])=>s.geometryType()===n.value],"filter-<":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d{const a=s.id(),d=n.value;return typeof a==typeof d&&a":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>y}],"filter-id->":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>d}],"filter-<=":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d<=y}],"filter-id-<=":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a<=d}],"filter->=":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>=y}],"filter-id->=":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>=d}],"filter-has":[Ut,[Xt],(s,[n])=>n.value in s.properties()],"filter-has-id":[Ut,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Ut,[G(Kt)],(s,[n])=>n.value.indexOf(s.geometryType())>=0],"filter-id-in":[Ut,[G(Xt)],(s,[n])=>n.value.indexOf(s.id())>=0],"filter-in-small":[Ut,[Kt,G(Xt)],(s,[n,a])=>a.value.indexOf(s.properties()[n.value])>=0],"filter-in-large":[Ut,[Kt,G(Xt)],(s,[n,a])=>function(d,y,x,w){for(;x<=w;){const b=x+w>>1;if(y[b]===d)return!0;y[b]>d?w=b-1:x=b+1}return!1}(s.properties()[n.value],a.value,0,a.value.length-1)],all:{type:Ut,overloads:[[[Ut,Ut],(s,[n,a])=>n.evaluate(s)&&a.evaluate(s)],[sa(Ut),(s,n)=>{for(const a of n)if(!a.evaluate(s))return!1;return!0}]]},any:{type:Ut,overloads:[[[Ut,Ut],(s,[n,a])=>n.evaluate(s)||a.evaluate(s)],[sa(Ut),(s,n)=>{for(const a of n)if(a.evaluate(s))return!0;return!1}]]},"!":[Ut,[Ut],(s,[n])=>!n.evaluate(s)],"is-supported-script":[Ut,[Kt],(s,[n])=>{const a=s.globals&&s.globals.isSupportedScript;return!a||a(n.evaluate(s))}],upcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toUpperCase()],downcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toLowerCase()],concat:[Kt,sa(Xt),(s,n)=>n.map(a=>Zl(a.evaluate(s))).join("")],"resolved-locale":[Kt,[Yi],(s,[n])=>n.evaluate(s).resolvedLocale()]});class pc{constructor(n,a){var d;this.expression=n,this._warningHistory={},this._evaluator=new Qu,this._defaultValue=a?(d=a).type==="color"&&dc(d.default)?new Ar(0,0,0,0):d.type==="color"?Ar.parse(d.default)||null:d.type==="padding"?Ai.parse(d.default)||null:d.type==="variableAnchorOffsetCollection"?Xi.parse(d.default)||null:d.default===void 0?null:d.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._evaluator.globals=n,this._evaluator.feature=a,this._evaluator.featureState=d,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(n,a,d,y,x,w){this._evaluator.globals=n,this._evaluator.feature=a||null,this._evaluator.featureState=d||null,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new xn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function mc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Va}function qa(s,n){const a=new Jo(Va,eu,[],n?function(y){const x={color:Kr,string:Kt,number:Qe,enum:Kt,boolean:Ut,formatted:fs,padding:ps,resolvedImage:Hn,variableAnchorOffsetCollection:he};return y.type==="array"?G(x[y.value]||Xt,y.length):x[y.type]}(n):void 0),d=a.parse(s,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?hc(new pc(d,n)):Wa(a.errors)}class Ya{constructor(n,a){this.kind=n,this._styleExpression=a,this.isStateDependent=n!=="constant"&&!Ha(a.expression)}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}}class Xa{constructor(n,a,d,y){this.kind=n,this.zoomStops=d,this._styleExpression=a,this.isStateDependent=n!=="camera"&&!Ha(a.expression),this.interpolationType=y}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}interpolationFactor(n,a,d){return this.interpolationType?yi.interpolationFactor(this.interpolationType,n,a,d):0}}function gd(s,n){const a=qa(s,n);if(a.result==="error")return a;const d=a.value.expression,y=tu(d);if(!y&&!Ga(n))return Wa([new _n("","data expressions not supported")]);const x=ru(d,["zoom"]);if(!x&&!qp(n))return Wa([new _n("","zoom expressions not supported")]);const w=nu(d);return w||x?w instanceof _n?Wa([w]):w instanceof yi&&!md(n)?Wa([new _n("",'"interpolate" expressions cannot be used with this property')]):hc(w?new Xa(y?"camera":"composite",a.value,w.labels,w instanceof yi?w.interpolation:void 0):new Ya(y?"constant":"source",a.value)):Wa([new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ka{constructor(n,a){this._parameters=n,this._specification=a,tn(this,Yp(this._parameters,this._specification))}static deserialize(n){return new Ka(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function nu(s){let n=null;if(s instanceof Po)n=nu(s.result);else if(s instanceof nc){for(const a of s.args)if(n=nu(a),n)break}else(s instanceof $a||s instanceof yi)&&s.input instanceof Ki&&s.input.name==="zoom"&&(n=s);return n instanceof _n||s.eachChild(a=>{const d=nu(a);d instanceof _n?n=d:!n&&d?n=new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&d&&n!==d&&(n=new _n("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function gc(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const n of s.slice(1))if(!gc(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const yc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yd(s){if(s==null)return{filter:()=>!0,needGeometry:!1};gc(s)||(s=_c(s));const n=qa(s,yc);if(n.result==="error")throw new Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,d,y)=>n.value.evaluate(a,d,{},y),needGeometry:Qp(s)}}function Z_(s,n){return sn?1:0}function Qp(s){if(!Array.isArray(s))return!1;if(s[0]==="within"||s[0]==="distance")return!0;for(let n=1;n"||n==="<="||n===">="?_d(s[1],s[2],n):n==="any"?(a=s.slice(1),["any"].concat(a.map(_c))):n==="all"?["all"].concat(s.slice(1).map(_c)):n==="none"?["all"].concat(s.slice(1).map(_c).map(Wn)):n==="in"?iu(s[1],s.slice(2)):n==="!in"?Wn(iu(s[1],s.slice(2))):n==="has"?su(s[1]):n!=="!has"||Wn(su(s[1]));var a}function _d(s,n,a){switch(s){case"$type":return[`filter-type-${a}`,n];case"$id":return[`filter-id-${a}`,n];default:return[`filter-${a}`,s,n]}}function iu(s,n){if(n.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(a=>typeof a!=typeof n[0])?["filter-in-large",s,["literal",n.sort(Z_)]]:["filter-in-small",s,["literal",n]]}}function su(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Wn(s){return["!",s]}function oa(s){const n=typeof s;if(n==="number"||n==="boolean"||n==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let y="[";for(const x of s)y+=`${oa(x)},`;return`${y}]`}const a=Object.keys(s).sort();let d="{";for(let y=0;yd.maximum?[new Ze(n,a,`${a} is greater than the maximum value ${d.maximum}`)]:[]}function vc(s){const n=s.valueSpec,a=pn(s.value.type);let d,y,x,w={};const b=a!=="categorical"&&s.value.property===void 0,k=!b,I=vr(s.value.stops)==="array"&&vr(s.value.stops[0])==="array"&&vr(s.value.stops[0][0])==="object",D=zi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(Z){if(a==="identity")return[new Ze(Z.key,Z.value,'identity function may not have a "stops" property')];let K=[];const J=Z.value;return K=K.concat(ou({key:Z.key,value:J,valueSpec:Z.valueSpec,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,arrayElementValidator:L})),vr(J)==="array"&&J.length===0&&K.push(new Ze(Z.key,J,"array must have at least one stop")),K},default:function(Z){return Z.validateSpec({key:Z.key,value:Z.value,valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec})}}});return a==="identity"&&b&&D.push(new Ze(s.key,s.value,'missing required property "property"')),a==="identity"||s.value.stops||D.push(new Ze(s.key,s.value,'missing required property "stops"')),a==="exponential"&&s.valueSpec.expression&&!md(s.valueSpec)&&D.push(new Ze(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!Ga(s.valueSpec)?D.push(new Ze(s.key,s.value,"property functions not supported")):b&&!qp(s.valueSpec)&&D.push(new Ze(s.key,s.value,"zoom functions not supported"))),a!=="categorical"&&!I||s.value.property!==void 0||D.push(new Ze(s.key,s.value,'"property" property is required')),D;function L(Z){let K=[];const J=Z.value,le=Z.key;if(vr(J)!=="array")return[new Ze(le,J,`array expected, ${vr(J)} found`)];if(J.length!==2)return[new Ze(le,J,`array length 2 expected, length ${J.length} found`)];if(I){if(vr(J[0])!=="object")return[new Ze(le,J,`object expected, ${vr(J[0])} found`)];if(J[0].zoom===void 0)return[new Ze(le,J,"object stop key must have zoom")];if(J[0].value===void 0)return[new Ze(le,J,"object stop key must have value")];if(x&&x>pn(J[0].zoom))return[new Ze(le,J[0].zoom,"stop zoom values must appear in ascending order")];pn(J[0].zoom)!==x&&(x=pn(J[0].zoom),y=void 0,w={}),K=K.concat(zi({key:`${le}[0]`,value:J[0],valueSpec:{zoom:{}},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{zoom:vd,value:U}}))}else K=K.concat(U({key:`${le}[0]`,value:J[0],valueSpec:{},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec},J));return mc(_s(J[1]))?K.concat([new Ze(`${le}[1]`,J[1],"expressions are not allowed in function stops.")]):K.concat(Z.validateSpec({key:`${le}[1]`,value:J[1],valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec}))}function U(Z,K){const J=vr(Z.value),le=pn(Z.value),fe=Z.value!==null?Z.value:K;if(d){if(J!==d)return[new Ze(Z.key,fe,`${J} stop domain type must match previous stop domain type ${d}`)]}else d=J;if(J!=="number"&&J!=="string"&&J!=="boolean")return[new Ze(Z.key,fe,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&a!=="categorical"){let De=`number expected, ${J} found`;return Ga(n)&&a===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ze(Z.key,fe,De)]}return a!=="categorical"||J!=="number"||isFinite(le)&&Math.floor(le)===le?a!=="categorical"&&J==="number"&&y!==void 0&&lenew Ze(`${s.key}${d.key}`,s.value,d.message));const a=n.value.expression||n.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!a.outputDefined())return[new Ze(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ha(a))return[new Ze(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Ha(a))return[new Ze(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!ru(a,["zoom","feature-state"]))return[new Ze(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!tu(a))return[new Ze(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lo(s){const n=s.key,a=s.value,d=s.valueSpec,y=[];return Array.isArray(d.values)?d.values.indexOf(pn(a))===-1&&y.push(new Ze(n,a,`expected one of [${d.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(d.values).indexOf(pn(a))===-1&&y.push(new Ze(n,a,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(a)} found`)),y}function xd(s){return gc(_s(s.value))?Ja(tn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(s)}function xc(s){const n=s.value,a=s.key;if(vr(n)!=="array")return[new Ze(a,n,`array expected, ${vr(n)} found`)];const d=s.styleSpec;let y,x=[];if(n.length<1)return[new Ze(a,n,"filter array must have at least 1 element")];switch(x=x.concat(lo({key:`${a}[0]`,value:n[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),pn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&pn(n[1])==="$type"&&x.push(new Ze(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&x.push(new Ze(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(y=vr(n[1]),y!=="string"&&x.push(new Ze(`${a}[1]`,n[1],`string expected, ${y} found`)));for(let w=2;w{I in a&&n.push(new Ze(d,a[I],`"${I}" is prohibited for ref layers`))}),y.layers.forEach(I=>{pn(I.id)===b&&(k=I)}),k?k.ref?n.push(new Ze(d,a.ref,"ref cannot reference another ref layer")):w=pn(k.type):n.push(new Ze(d,a.ref,`ref layer "${b}" not found`))}else if(w!=="background")if(a.source){const k=y.sources&&y.sources[a.source],I=k&&pn(k.type);k?I==="vector"&&w==="raster"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a raster source`)):I!=="raster-dem"&&w==="hillshade"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a raster-dem source`)):I==="raster"&&w!=="raster"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a vector source`)):I!=="vector"||a["source-layer"]?I==="raster-dem"&&w!=="hillshade"?n.push(new Ze(d,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!a.paint||!a.paint["line-gradient"]||I==="geojson"&&k.lineMetrics||n.push(new Ze(d,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new Ze(d,a,`layer "${a.id}" must specify a "source-layer"`)):n.push(new Ze(d,a.source,`source "${a.source}" not found`))}else n.push(new Ze(d,a,'missing required property "source"'));return n=n.concat(zi({key:d,value:a,valueSpec:x.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${d}.type`,value:a.type,valueSpec:x.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:a,objectKey:"type"}),filter:xd,layout:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>bd(tn({layerType:w},I))}}),paint:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>wc(tn({layerType:w},I))}})}})),n}function aa(s){const n=s.value,a=s.key,d=vr(n);return d!=="string"?[new Ze(a,n,`string expected, ${d} found`)]:[]}const bc={promoteId:function({key:s,value:n}){if(vr(n)==="string")return aa({key:s,value:n});{const a=[];for(const d in n)a.push(...aa({key:`${s}.${d}`,value:n[d]}));return a}}};function au(s){const n=s.value,a=s.key,d=s.styleSpec,y=s.style,x=s.validateSpec;if(!n.type)return[new Ze(a,n,'"type" is required')];const w=pn(n.type);let b;switch(w){case"vector":case"raster":return b=zi({key:a,value:n,valueSpec:d[`source_${w.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:bc,validateSpec:x}),b;case"raster-dem":return b=function(k){var I;const D=(I=k.sourceName)!==null&&I!==void 0?I:"",L=k.value,U=k.styleSpec,Z=U.source_raster_dem,K=k.style;let J=[];const le=vr(L);if(L===void 0)return J;if(le!=="object")return J.push(new Ze("source_raster_dem",L,`object expected, ${le} found`)),J;const fe=pn(L.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],be=k.value.encoding?`"${k.value.encoding}"`:"Default";for(const Me in L)!fe&&De.includes(Me)?J.push(new Ze(Me,L[Me],`In "${D}": "${Me}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):Z[Me]?J=J.concat(k.validateSpec({key:Me,value:L[Me],valueSpec:Z[Me],validateSpec:k.validateSpec,style:K,styleSpec:U})):J.push(new Ze(Me,L[Me],`unknown property "${Me}"`));return J}({sourceName:a,value:n,style:s.style,styleSpec:d,validateSpec:x}),b;case"geojson":if(b=zi({key:a,value:n,valueSpec:d.source_geojson,style:y,styleSpec:d,validateSpec:x,objectElementValidators:bc}),n.cluster)for(const k in n.clusterProperties){const[I,D]=n.clusterProperties[k],L=typeof I=="string"?[I,["accumulated"],["get",k]]:I;b.push(...Ja({key:`${a}.${k}.map`,value:D,validateSpec:x,expressionContext:"cluster-map"})),b.push(...Ja({key:`${a}.${k}.reduce`,value:L,validateSpec:x,expressionContext:"cluster-reduce"}))}return b;case"video":return zi({key:a,value:n,valueSpec:d.source_video,style:y,validateSpec:x,styleSpec:d});case"image":return zi({key:a,value:n,valueSpec:d.source_image,style:y,validateSpec:x,styleSpec:d});case"canvas":return[new Ze(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return lo({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:x,styleSpec:d})}}function kd(s){const n=s.value,a=s.styleSpec,d=a.light,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new Ze("light",n,`object expected, ${w} found`)]),x;for(const b in n){const k=b.match(/^(.*)-transition$/);x=x.concat(k&&d[k[1]]&&d[k[1]].transition?s.validateSpec({key:b,value:n[b],valueSpec:a.transition,validateSpec:s.validateSpec,style:y,styleSpec:a}):d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)])}return x}function Td(s){const n=s.value,a=s.styleSpec,d=a.sky,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new Ze("sky",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return w}function Ed(s){const n=s.value,a=s.styleSpec,d=a.terrain,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new Ze("terrain",n,`object expected, ${w} found`)]),x;for(const b in n)x=x.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return x}function Cd(s){let n=[];const a=s.value,d=s.key;if(Array.isArray(a)){const y=[],x=[];for(const w in a)a[w].id&&y.includes(a[w].id)&&n.push(new Ze(d,a,`all the sprites' ids must be unique, but ${a[w].id} is duplicated`)),y.push(a[w].id),a[w].url&&x.includes(a[w].url)&&n.push(new Ze(d,a,`all the sprites' URLs must be unique, but ${a[w].url} is duplicated`)),x.push(a[w].url),n=n.concat(zi({key:`${d}[${w}]`,value:a[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return n}return aa({key:d,value:a})}const Sc={"*":()=>[],array:ou,boolean:function(s){const n=s.value,a=s.key,d=vr(n);return d!=="boolean"?[new Ze(a,n,`boolean expected, ${d} found`)]:[]},number:vd,color:function(s){const n=s.key,a=s.value,d=vr(a);return d!=="string"?[new Ze(n,a,`color expected, ${d} found`)]:Ar.parse(String(a))?[]:[new Ze(n,a,`color expected, "${a}" found`)]},constants:tm,enum:lo,filter:xd,function:vc,layer:Sd,object:zi,source:au,light:kd,sky:Td,terrain:Ed,projection:function(s){const n=s.value,a=s.styleSpec,d=a.projection,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new Ze("projection",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return w},string:aa,formatted:function(s){return aa(s).length===0?[]:Ja(s)},resolvedImage:function(s){return aa(s).length===0?[]:Ja(s)},padding:function(s){const n=s.key,a=s.value;if(vr(a)==="array"){if(a.length<1||a.length>4)return[new Ze(n,a,`padding requires 1 to 4 values; ${a.length} values found`)];const d={type:"number"};let y=[];for(let x=0;x[]}})),s.constants&&(a=a.concat(tm({key:"constants",value:s.constants,style:s,styleSpec:n,validateSpec:Qa}))),Id(a)}function Vs(s){return function(n){return s({...n,validateSpec:Qa})}}function Id(s){return[].concat(s).sort((n,a)=>n.line-a.line)}function vs(s){return function(...n){return Id(s.apply(this,n))}}Ji.source=vs(Vs(au)),Ji.sprite=vs(Vs(Cd)),Ji.glyphs=vs(Vs(rm)),Ji.light=vs(Vs(kd)),Ji.sky=vs(Vs(Td)),Ji.terrain=vs(Vs(Ed)),Ji.layer=vs(Vs(Sd)),Ji.filter=vs(Vs(xd)),Ji.paintProperty=vs(Vs(wc)),Ji.layoutProperty=vs(Vs(bd));const la=Ji,q_=la.light,Y_=la.sky,nm=la.paintProperty,im=la.layoutProperty;function Pd(s,n){let a=!1;if(n&&n.length)for(const d of n)s.fire(new V(new Error(d.message))),a=!0;return a}class el{constructor(n,a,d){const y=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const w=new Int32Array(this.arrayBuffer);n=w[0],this.d=(a=w[1])+2*(d=w[2]);for(let k=0;k=L[K+0]&&y>=L[K+1])?(b[Z]=!0,w.push(D[Z])):b[Z]=!1}}}}_forEachCell(n,a,d,y,x,w,b,k){const I=this._convertToCellCoord(n),D=this._convertToCellCoord(a),L=this._convertToCellCoord(d),U=this._convertToCellCoord(y);for(let Z=I;Z<=L;Z++)for(let K=D;K<=U;K++){const J=this.d*K+Z;if((!k||k(this._convertFromCellCoord(Z),this._convertFromCellCoord(K),this._convertFromCellCoord(Z+1),this._convertFromCellCoord(K+1)))&&x.call(this,n,a,d,y,J,w,b,k))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,a=3+this.cells.length+1+1;let d=0;for(let w=0;w=0)continue;const w=s[x];y[x]=Qi[a].shallow.indexOf(x)>=0?w:tl(w,n)}s instanceof Error&&(y.message=s.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(y.$name=a),y}function rl(s){if(sm(s))return s;if(Array.isArray(s))return s.map(rl);if(typeof s!="object")throw new Error("can't deserialize object of type "+typeof s);const n=Md(s)||"Object";if(!Qi[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:a}=Qi[n];if(!a)throw new Error(`can't deserialize unregistered class ${n}`);if(a.deserialize)return a.deserialize(s);const d=Object.create(a.prototype);for(const y of Object.keys(s)){if(y==="$name")continue;const x=s[y];d[y]=Qi[n].shallow.indexOf(y)>=0?x:rl(x)}return d}class Ad{constructor(){this.first=!0}update(n,a){const d=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=d,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=d,!0):(this.lastFloorZoom>d?(this.lastIntegerZoom=d+1,this.lastIntegerZoomTime=a):this.lastFloorZooms>=128&&s<=255,"Hangul Jamo":s=>s>=4352&&s<=4607,Khmer:s=>s>=6016&&s<=6143,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Katakana:s=>s>=12448&&s<=12543,Kanbun:s=>s>=12688&&s<=12703,"CJK Strokes":s=>s>=12736&&s<=12783,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"Private Use Area":s=>s>=57344&&s<=63743,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Dd(s){for(const n of s)if(Rd(n.charCodeAt(0)))return!0;return!1}function X_(s){for(const n of s)if(!nl(n.charCodeAt(0)))return!1;return!0}function zd(s){const n=s.map(a=>{try{return new RegExp(`\\p{sc=${a}}`,"u").source}catch{return null}}).filter(a=>a);return new RegExp(n.join("|"),"u")}const K_=zd(["Arab","Dupl","Mong","Ougr","Syrc"]);function nl(s){return!K_.test(String.fromCodePoint(s))}const om=zd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Rd(s){return!(s!==746&&s!==747&&(s<4352||!(ur["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ur["CJK Compatibility"](s)||ur["CJK Strokes"](s)||!(!ur["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ur["Enclosed CJK Letters and Months"](s)||ur["Ideographic Description Characters"](s)||ur.Kanbun(s)||ur.Katakana(s)&&s!==12540||!(!ur["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ur["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ur["Vertical Forms"](s)||ur["Yijing Hexagram Symbols"](s)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(s))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(s))||om.test(String.fromCodePoint(s)))))}function am(s){return!(Rd(s)||function(n){return!!(ur["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||ur["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||ur["Letterlike Symbols"](n)||ur["Number Forms"](n)||ur["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||ur["Control Pictures"](n)&&n!==9251||ur["Optical Character Recognition"](n)||ur["Enclosed Alphanumerics"](n)||ur["Geometric Shapes"](n)||ur["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||ur["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||ur["CJK Symbols and Punctuation"](n)||ur.Katakana(n)||ur["Private Use Area"](n)||ur["CJK Compatibility Forms"](n)||ur["Small Form Variants"](n)||ur["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(s))}const J_=zd(["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 Ld(s){return J_.test(String.fromCodePoint(s))}function Q_(s,n){return!(!n&&Ld(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ur.Khmer(s))}function e0(s){for(const n of s)if(Ld(n.charCodeAt(0)))return!0;return!1}const Ri=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vr{constructor(n,a){this.zoom=n,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ad,this.transition={})}isSupportedScript(n){return function(a,d){for(const y of a)if(!Q_(y.charCodeAt(0),d))return!1;return!0}(n,Ri.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,a=n-Math.floor(n),d=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*d}:{fromScale:.5,toScale:1,t:1-(1-d)*a}}}class il{constructor(n,a){this.property=n,this.value=a,this.expression=function(d,y){if(dc(d))return new Ka(d,y);if(mc(d)){const x=gd(d,y);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=d;return y.type==="color"&&typeof d=="string"?x=Ar.parse(d):y.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(d)&&(x=Xi.parse(d)):x=Ai.parse(d),{kind:"constant",evaluate:()=>x}}}(a===void 0?n.specification.default:a,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,a,d){return this.property.possiblyEvaluate(this,n,a,d)}}class Tc{constructor(n){this.property=n,this.value=new il(n,void 0)}transitioned(n,a){return new lm(this.property,this.value,a,ge({},n.transition,this.transition),n.now)}untransitioned(){return new lm(this.property,this.value,null,{},0)}}class Ec{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return it(this._values[n].value.value)}setValue(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Tc(this._values[n].property)),this._values[n].value=new il(this._values[n].property,a===null?void 0:it(a))}getTransition(n){return it(this._values[n].transition)}setTransition(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Tc(this._values[n].property)),this._values[n].transition=it(a)||void 0}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d);const y=this.getTransition(a);y!==void 0&&(n[`${a}-transition`]=y)}return n}transitioned(n,a){const d=new lu(this._properties);for(const y of Object.keys(this._values))d._values[y]=this._values[y].transitioned(n,a._values[y]);return d}untransitioned(){const n=new lu(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].untransitioned();return n}}class lm{constructor(n,a,d,y,x){this.property=n,this.value=a,this.begin=x+y.delay||0,this.end=this.begin+y.duration||0,n.specification.transition&&(y.delay||y.duration)&&(this.prior=d)}possiblyEvaluate(n,a,d){const y=n.now||0,x=this.value.possiblyEvaluate(n,a,d),w=this.prior;if(w){if(y>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(y=1)return 1;const I=k*k,D=I*k;return 4*(k<.5?D:3*(k-I)+D-.75)}(b))}}return x}}class lu{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class uu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return it(this._values[n].value)}setValue(n,a){this._values[n]=new il(this._values[n].property,a===null?void 0:it(a))}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d)}return n}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}}class Hs{constructor(n,a,d){this.property=n,this.value=a,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,a,d,y){return this.property.evaluate(this.value,this.parameters,n,a,d,y)}}class cu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class It{constructor(n){this.specification=n}possiblyEvaluate(n,a){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(a)}interpolate(n,a,d){const y=gi[this.specification.type];return y?y(n,a,d):n}}class jt{constructor(n,a){this.specification=n,this.overrides=a}possiblyEvaluate(n,a,d,y){return new Hs(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(a,null,{},d,y)}:n.expression,a)}interpolate(n,a,d){if(n.value.kind!=="constant"||a.value.kind!=="constant")return n;if(n.value.value===void 0||a.value.value===void 0)return new Hs(this,{kind:"constant",value:void 0},n.parameters);const y=gi[this.specification.type];if(y){const x=y(n.value.value,a.value.value,d);return new Hs(this,{kind:"constant",value:x},n.parameters)}return n}evaluate(n,a,d,y,x,w){return n.kind==="constant"?n.value:n.evaluate(a,d,y,x,w)}}class Cc extends jt{possiblyEvaluate(n,a,d,y){if(n.value===void 0)return new Hs(this,{kind:"constant",value:void 0},a);if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y),w=n.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,b=this._calculate(w,w,w,a);return new Hs(this,{kind:"constant",value:b},a)}if(n.expression.kind==="camera"){const x=this._calculate(n.expression.evaluate({zoom:a.zoom-1}),n.expression.evaluate({zoom:a.zoom}),n.expression.evaluate({zoom:a.zoom+1}),a);return new Hs(this,{kind:"constant",value:x},a)}return new Hs(this,n.expression,a)}evaluate(n,a,d,y,x,w){if(n.kind==="source"){const b=n.evaluate(a,d,y,x,w);return this._calculate(b,b,b,a)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(a.zoom)-1},d,y),n.evaluate({zoom:Math.floor(a.zoom)},d,y),n.evaluate({zoom:Math.floor(a.zoom)+1},d,y),a):n.value}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Ic{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){if(n.value!==void 0){if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y);return this._calculate(x,x,x,a)}return this._calculate(n.expression.evaluate(new Vr(Math.floor(a.zoom-1),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom+1),a)),a)}}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Od{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){return!!n.expression.evaluate(a,null,{},d,y)}interpolate(){return!1}}class v{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in n){const d=n[a];d.specification.overridable&&this.overridableProperties.push(a);const y=this.defaultPropertyValues[a]=new il(d,void 0),x=this.defaultTransitionablePropertyValues[a]=new Tc(d);this.defaultTransitioningPropertyValues[a]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",jt),St("DataConstantProperty",It),St("CrossFadedDataDrivenProperty",Cc),St("CrossFadedProperty",Ic),St("ColorRampProperty",Od);const r="-transition";class u extends je{constructor(n,a){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),a.layout&&(this._unevaluatedLayout=new uu(a.layout)),a.paint)){this._transitionablePaint=new Ec(a.paint);for(const d in n.paint)this.setPaintProperty(d,n.paint[d],{validate:!1});for(const d in n.layout)this.setLayoutProperty(d,n.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new cu(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,a,d={}){a!=null&&this._validate(im,`layers.${this.id}.layout.${n}`,n,a,d)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,a):this.visibility=a)}getPaintProperty(n){return n.endsWith(r)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,a,d={}){if(a!=null&&this._validate(nm,`layers.${this.id}.paint.${n}`,n,a,d))return!1;if(n.endsWith(r))return this._transitionablePaint.setTransition(n.slice(0,-11),a||void 0),!1;{const y=this._transitionablePaint._values[n],x=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),b=y.value;this._transitionablePaint.setValue(n,a),this._handleSpecialPaintPropertyUpdate(n);const k=this._transitionablePaint._values[n].value;return k.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(n,b,k)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,a,d){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,a){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,a)}serialize(){const n={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),We(n,(a,d)=>!(a===void 0||d==="layout"&&!Object.keys(a).length||d==="paint"&&!Object.keys(a).length))}_validate(n,a,d,y,x={}){return(!x||x.validate!==!1)&&Pd(this,n.call(la,{key:a,layerType:this.type,objectKey:d,value:y,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const a=this.paint.get(n);if(a instanceof Hs&&Ga(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(n,a){this._structArray=n,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,a){return n._trim(),a&&(n.isTransferred=!0,a.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const a=Object.create(this.prototype);return a.arrayBuffer=n.arrayBuffer,a.length=n.length,a.capacity=n.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function S(s,n=1){let a=0,d=0;return{members:s.map(y=>{const x=p[y.type].BYTES_PER_ELEMENT,w=a=E(a,Math.max(n,x)),b=y.components||1;return d=Math.max(d,x),a+=x*b,{name:y.name,type:y.type,components:b,offset:w}}),size:E(a,Math.max(d,n)),alignment:n}}function E(s,n){return Math.ceil(s/n)*n}class C extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.int16[y+0]=a,this.int16[y+1]=d,n}}C.prototype.bytesPerElement=4,St("StructArrayLayout2i4",C);class z extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.int16[x+0]=a,this.int16[x+1]=d,this.int16[x+2]=y,n}}z.prototype.bytesPerElement=6,St("StructArrayLayout3i6",z);class F extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.int16[w+0]=a,this.int16[w+1]=d,this.int16[w+2]=y,this.int16[w+3]=x,n}}F.prototype.bytesPerElement=8,St("StructArrayLayout4i8",F);class B extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}B.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",B);class X extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=4*n,I=8*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.uint8[I+4]=y,this.uint8[I+5]=x,this.uint8[I+6]=w,this.uint8[I+7]=b,n}}X.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",X);class Q extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.float32[y+0]=a,this.float32[y+1]=d,n}}Q.prototype.bytesPerElement=8,St("StructArrayLayout2f8",Q);class re extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D){const L=this.length;return this.resize(L+1),this.emplace(L,n,a,d,y,x,w,b,k,I,D)}emplace(n,a,d,y,x,w,b,k,I,D,L){const U=10*n;return this.uint16[U+0]=a,this.uint16[U+1]=d,this.uint16[U+2]=y,this.uint16[U+3]=x,this.uint16[U+4]=w,this.uint16[U+5]=b,this.uint16[U+6]=k,this.uint16[U+7]=I,this.uint16[U+8]=D,this.uint16[U+9]=L,n}}re.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",re);class ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D,L,U){const Z=this.length;return this.resize(Z+1),this.emplace(Z,n,a,d,y,x,w,b,k,I,D,L,U)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z){const K=12*n;return this.int16[K+0]=a,this.int16[K+1]=d,this.int16[K+2]=y,this.int16[K+3]=x,this.uint16[K+4]=w,this.uint16[K+5]=b,this.uint16[K+6]=k,this.uint16[K+7]=I,this.int16[K+8]=D,this.int16[K+9]=L,this.int16[K+10]=U,this.int16[K+11]=Z,n}}ce.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",ce);class pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.float32[x+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}pe.prototype.bytesPerElement=12,St("StructArrayLayout3f12",pe);class me extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint32[1*n+0]=a,n}}me.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",me);class we extends _{_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(n,a,d,y,x,w,b,k,I){const D=this.length;return this.resize(D+1),this.emplace(D,n,a,d,y,x,w,b,k,I)}emplace(n,a,d,y,x,w,b,k,I,D){const L=10*n,U=5*n;return this.int16[L+0]=a,this.int16[L+1]=d,this.int16[L+2]=y,this.int16[L+3]=x,this.int16[L+4]=w,this.int16[L+5]=b,this.uint32[U+3]=k,this.uint16[L+8]=I,this.uint16[L+9]=D,n}}we.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",we);class ae extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}ae.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",ae);class Ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x){const w=this.length;return this.resize(w+1),this.emplace(w,n,a,d,y,x)}emplace(n,a,d,y,x,w){const b=4*n,k=8*n;return this.float32[b+0]=a,this.float32[b+1]=d,this.float32[b+2]=y,this.int16[k+6]=x,this.int16[k+7]=w,n}}Ce.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ce);class Pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=16*n,I=4*n,D=8*n;return this.uint8[k+0]=a,this.uint8[k+1]=d,this.float32[I+1]=y,this.float32[I+2]=x,this.int16[D+6]=w,this.int16[D+7]=b,n}}Pe.prototype.bytesPerElement=16,St("StructArrayLayout2ub2f2i16",Pe);class ze extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[x+0]=a,this.uint16[x+1]=d,this.uint16[x+2]=y,n}}ze.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",ze);class Ye extends _{_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(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe){const De=this.length;return this.resize(De+1),this.emplace(De,n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De){const be=24*n,Me=12*n,Ve=48*n;return this.int16[be+0]=a,this.int16[be+1]=d,this.uint16[be+2]=y,this.uint16[be+3]=x,this.uint32[Me+2]=w,this.uint32[Me+3]=b,this.uint32[Me+4]=k,this.uint16[be+10]=I,this.uint16[be+11]=D,this.uint16[be+12]=L,this.float32[Me+7]=U,this.float32[Me+8]=Z,this.uint8[Ve+36]=K,this.uint8[Ve+37]=J,this.uint8[Ve+38]=le,this.uint32[Me+10]=fe,this.int16[be+22]=De,n}}Ye.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ye);class st extends _{_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(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt){const bt=this.length;return this.resize(bt+1),this.emplace(bt,n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt,bt){const qe=32*n,Dt=16*n;return this.int16[qe+0]=a,this.int16[qe+1]=d,this.int16[qe+2]=y,this.int16[qe+3]=x,this.int16[qe+4]=w,this.int16[qe+5]=b,this.int16[qe+6]=k,this.int16[qe+7]=I,this.uint16[qe+8]=D,this.uint16[qe+9]=L,this.uint16[qe+10]=U,this.uint16[qe+11]=Z,this.uint16[qe+12]=K,this.uint16[qe+13]=J,this.uint16[qe+14]=le,this.uint16[qe+15]=fe,this.uint16[qe+16]=De,this.uint16[qe+17]=be,this.uint16[qe+18]=Me,this.uint16[qe+19]=Ve,this.uint16[qe+20]=et,this.uint16[qe+21]=xt,this.uint16[qe+22]=Nt,this.uint32[Dt+12]=yt,this.float32[Dt+13]=pt,this.float32[Dt+14]=At,this.uint16[qe+30]=Tt,this.uint16[qe+31]=bt,n}}st.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",st);class gt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.float32[1*n+0]=a,n}}gt.prototype.bytesPerElement=4,St("StructArrayLayout1f4",gt);class wt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[6*n+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}wt.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",wt);class dt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=4*n;return this.uint32[2*n+0]=a,this.uint16[x+2]=d,this.uint16[x+3]=y,n}}dt.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",dt);class ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.uint16[y+0]=a,this.uint16[y+1]=d,n}}ct.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",ct);class Pt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint16[1*n+0]=a,n}}Pt.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Pt);class qt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.float32[w+0]=a,this.float32[w+1]=d,this.float32[w+2]=y,this.float32[w+3]=x,n}}qt.prototype.bytesPerElement=16,St("StructArrayLayout4f16",qt);class ft extends m{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 A(this.anchorPointX,this.anchorPointY)}}ft.prototype.size=20;class _t extends we{get(n){return new ft(this,n)}}St("CollisionBoxArray",_t);class Gt extends m{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Gt.prototype.size=48;class Hr extends Ye{get(n){return new Gt(this,n)}}St("PlacedSymbolArray",Hr);class tr extends m{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(n){this._structArray.uint32[this._pos4+12]=n}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]}}tr.prototype.size=64;class ar extends st{get(n){return new tr(this,n)}}St("SymbolInstanceArray",ar);class Wr extends gt{getoffsetX(n){return this.float32[1*n+0]}}St("GlyphOffsetArray",Wr);class Gn extends z{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}St("SymbolLineVertexArray",Gn);class xs extends m{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]}}xs.prototype.size=12;class Gr extends wt{get(n){return new xs(this,n)}}St("TextAnchorOffsetArray",Gr);class _i extends m{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]}}_i.prototype.size=8;class ii extends dt{get(n){return new _i(this,n)}}St("FeatureIndexArray",ii);class Zn extends C{}class si extends C{}class Ws extends C{}class sl extends B{}class Pc extends X{}class ol extends Q{}class es extends re{}class Mc extends ce{}class Fd extends pe{}class ts extends me{}class rs extends ae{}class Ao extends Pe{}class ws extends ze{}class Nn extends ct{}const qn=S([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=qn;class cr{constructor(n=[]){this.segments=n}prepareSegment(n,a,d,y){let x=this.segments[this.segments.length-1];return n>cr.MAX_VERTEX_ARRAY_LENGTH&&Ue(`Max vertices per segment is ${cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!x||x.vertexLength+n>cr.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==y)&&(x={vertexOffset:a.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},y!==void 0&&(x.sortKey=y),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const n of this.segments)for(const a in n.vaos)n.vaos[a].destroy()}static simpleSegment(n,a,d,y){return new cr([{vertexOffset:n,primitiveOffset:a,vertexLength:d,primitiveLength:y,vaos:{},sortKey:0}])}}function ua(s,n){return 256*(s=oe(Math.floor(s),0,255))+oe(Math.floor(n),0,255)}cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",cr);const al=S([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ll={exports:{}},um={exports:{}};um.exports=function(s,n){var a,d,y,x,w,b,k,I;for(d=s.length-(a=3&s.length),y=n,w=3432918353,b=461845907,I=0;I>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(k=0,a){case 3:k^=(255&s.charCodeAt(I+2))<<16;case 2:k^=(255&s.charCodeAt(I+1))<<8;case 1:y^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(I)))*w+(((k>>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295}return y^=s.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var t0=um.exports,cm={exports:{}};cm.exports=function(s,n){for(var a,d=s.length,y=n^d,x=0;d>=4;)a=1540483477*(65535&(a=255&s.charCodeAt(x)|(255&s.charCodeAt(++x))<<8|(255&s.charCodeAt(++x))<<16|(255&s.charCodeAt(++x))<<24))+((1540483477*(a>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),d-=4,++x;switch(d){case 3:y^=(255&s.charCodeAt(x+2))<<16;case 2:y^=(255&s.charCodeAt(x+1))<<8;case 1:y=1540483477*(65535&(y^=255&s.charCodeAt(x)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var Do=t0,hm=cm.exports;ll.exports=Do,ll.exports.murmur3=Do,ll.exports.murmur2=hm;var Ac=T(ll.exports);class hu{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,a,d,y){this.ids.push(Dc(n)),this.positions.push(a,d,y)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Dc(n);let d=0,y=this.ids.length-1;for(;d>1;this.ids[w]>=a?y=w:d=w+1}const x=[];for(;this.ids[d]===a;)x.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return x}static serialize(n,a){const d=new Float64Array(n.ids),y=new Uint32Array(n.positions);return zc(d,y,0,d.length-1),a&&a.push(d.buffer,y.buffer),{ids:d,positions:y}}static deserialize(n){const a=new hu;return a.ids=n.ids,a.positions=n.positions,a.indexed=!0,a}}function Dc(s){const n=+s;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:Ac(String(s))}function zc(s,n,a,d){for(;a>1];let x=a-1,w=d+1;for(;;){do x++;while(s[x]y);if(x>=w)break;ul(s,x,w),ul(n,3*x,3*w),ul(n,3*x+1,3*w+1),ul(n,3*x+2,3*w+2)}w-a`u_${y}`),this.type=d}setUniform(n,a,d){n.set(d.constantOr(this.value))}getBinding(n,a,d){return this.type==="color"?new _b(n,a):new dm(n,a)}}class Rc{constructor(n,a){this.uniformNames=a.map(d=>`u_${d}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=n.tlbr}setUniform(n,a,d,y){const x=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&n.set(x)}getBinding(n,a,d){return d.substr(0,9)==="u_pattern"?new yb(n,a):new dm(n,a)}}class ca{constructor(n,a,d,y){this.expression=n,this.type=d,this.maxValue=0,this.paintVertexAttributes=a.map(x=>({name:`a_${x}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(n,a,d,y,x){const w=this.paintVertexArray.length,b=this.expression.evaluate(new Vr(0),a,{},y,[],x);this.paintVertexArray.resize(n),this._setPaintValue(w,n,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:0},d,y);this._setPaintValue(n,a,x)}_setPaintValue(n,a,d){if(this.type==="color"){const y=r0(d);for(let x=n;x`u_${b}_t`),this.type=d,this.useIntegerZoom=y,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(n,a,d,y,x){const w=this.expression.evaluate(new Vr(this.zoom),a,{},y,[],x),b=this.expression.evaluate(new Vr(this.zoom+1),a,{},y,[],x),k=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(k,n,w,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:this.zoom},d,y),w=this.expression.evaluate({zoom:this.zoom+1},d,y);this._setPaintValue(n,a,x,w)}_setPaintValue(n,a,d,y){if(this.type==="color"){const x=r0(d),w=r0(y);for(let b=n;b`#define HAS_UNIFORM_${y}`))}return n}getBinderAttributes(){const n=[];for(const a in this.binders){const d=this.binders[a];if(d instanceof ca||d instanceof uo)for(let y=0;y!0){this.programConfigurations={};for(const y of n)this.programConfigurations[y.id]=new vb(y,a,d);this.needsUpload=!1,this._featureMap=new hu,this._bufferOffset=0}populatePaintArrays(n,a,d,y,x,w){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,a,y,x,w);a.id!==void 0&&this._featureMap.add(a.id,d,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,a,d,y){for(const x of d)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(n,this._featureMap,a,x,y)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function SA(s,n){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]}function xb(s,n,a){const d={color:{source:Q,composite:qt},number:{source:gt,composite:Q}},y=function(x){return{"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es}}[x]}(s);return y&&y[a]||d[n][a]}St("ConstantBinder",Bd),St("CrossFadedConstantBinder",Rc),St("SourceExpressionBinder",ca),St("CrossFadedCompositeBinder",cl),St("CompositeExpressionBinder",uo),St("ProgramConfiguration",vb,{omit:["_buffers"]}),St("ProgramConfigurationSet",fu);const Cn=8192,n0=Math.pow(2,14)-1,wb=-n0-1;function pu(s){const n=Cn/s.extent,a=s.loadGeometry();for(let d=0;dw.x+1||kw.y+1)&&Ue("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function mu(s,n){return{type:s.type,id:s.id,properties:s.properties,geometry:n?pu(s):[]}}function fm(s,n,a,d,y){s.emplaceBack(2*n+(d+1)/2,2*a+(y+1)/2)}class i0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new si,this.indexArray=new ws,this.segments=new cr,this.programConfigurations=new fu(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){const y=this.layers[0],x=[];let w=null,b=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),b=!w.isConstant());for(const{feature:k,id:I,index:D,sourceLayerIndex:L}of n){const U=this.layers[0]._featureFilter.needGeometry,Z=mu(k,U);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),Z,d))continue;const K=b?w.evaluate(Z,{},d):void 0,J={id:I,properties:k.properties,type:k.type,sourceLayerIndex:L,index:D,geometry:U?Z.geometry:pu(k),patterns:{},sortKey:K};x.push(J)}b&&x.sort((k,I)=>k.sortKey-I.sortKey);for(const k of x){const{geometry:I,index:D,sourceLayerIndex:L}=k,U=n[D].feature;this.addFeature(k,I,D,d),a.featureIndex.insert(U,I,D,L,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Li),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,a,d,y){for(const x of a)for(const w of x){const b=w.x,k=w.y;if(b<0||b>=Cn||k<0||k>=Cn)continue;const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),D=I.vertexLength;fm(this.layoutVertexArray,b,k,-1,-1),fm(this.layoutVertexArray,b,k,1,-1),fm(this.layoutVertexArray,b,k,1,1),fm(this.layoutVertexArray,b,k,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,{},y)}}function bb(s,n){for(let a=0;a1){if(s0(s,n))return!0;for(let d=0;d1?a:a.sub(n)._mult(y)._add(n))}function Tb(s,n){let a,d,y,x=!1;for(let w=0;wn.y!=y.y>n.y&&n.x<(y.x-d.x)*(n.y-d.y)/(y.y-d.y)+d.x&&(x=!x)}return x}function Lc(s,n){let a=!1;for(let d=0,y=s.length-1;dn.y!=w.y>n.y&&n.x<(w.x-x.x)*(n.y-x.y)/(w.y-x.y)+x.x&&(a=!a)}return a}function CA(s,n,a){const d=a[0],y=a[2];if(s.xy.x&&n.x>y.x||s.yy.y&&n.y>y.y)return!1;const x=H(s,n,a[0]);return x!==H(s,n,a[1])||x!==H(s,n,a[2])||x!==H(s,n,a[3])}function Nd(s,n,a){const d=n.paint.get(s).value;return d.kind==="constant"?d.value:a.programConfigurations.get(n.id).getMaxValue(s)}function pm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mm(s,n,a,d,y){if(!n[0]&&!n[1])return s;const x=A.convert(n)._mult(y);a==="viewport"&&x._rotate(-d);const w=[];for(let b=0;bPb(le,J))}(I,k),Z=L?D*b:D;for(const K of y)for(const J of K){const le=L?J:Pb(J,k);let fe=Z;const De=gm([],[J.x,J.y,0,1],k);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=De[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=w.cameraToCenterDistance/De[3]),kA(U,le,fe))return!0}return!1}}function Pb(s,n){const a=gm([],[s.x,s.y,0,1],n);return new A(a[0]/a[3],a[1]/a[3])}class Mb extends i0{}let Ab;St("HeatmapBucket",Mb,{omit:["layers"]});var AA={get paint(){return Ab=Ab||new v({"heatmap-radius":new jt(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new jt(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new It(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Od(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new It(ie.paint_heatmap["heatmap-opacity"])})}};function l0(s,{width:n,height:a},d,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==n*a*d)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${n*a*d}`)}else y=new Uint8Array(n*a*d);return s.width=n,s.height=a,s.data=y,s}function Db(s,{width:n,height:a},d){if(n===s.width&&a===s.height)return;const y=l0({},{width:n,height:a},d);u0(s,y,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,n),height:Math.min(s.height,a)},d),s.width=n,s.height=a,s.data=y.data}function u0(s,n,a,d,y,x){if(y.width===0||y.height===0)return n;if(y.width>s.width||y.height>s.height||a.x>s.width-y.width||a.y>s.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>n.width||y.height>n.height||d.x>n.width-y.width||d.y>n.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,b=n.data;if(w===b)throw new Error("srcData equals dstData, so image is already copied");for(let k=0;k{n[s.evaluationKey]=k;const I=s.expression.evaluate(n);y.data[w+b+0]=Math.floor(255*I.r/I.a),y.data[w+b+1]=Math.floor(255*I.g/I.a),y.data[w+b+2]=Math.floor(255*I.b/I.a),y.data[w+b+3]=Math.floor(255*I.a)};if(s.clips)for(let w=0,b=0;w80*a){b=1/0,k=1/0;let D=-1/0,L=-1/0;for(let U=a;UD&&(D=Z),K>L&&(L=K)}I=Math.max(D-b,L-k),I=I!==0?32767/I:0}return jd(x,w,a,b,k,I,0),w}function Ob(s,n,a,d,y){let x;if(y===function(w,b,k,I){let D=0;for(let L=b,U=k-I;L0)for(let w=n;w=n;w-=d)x=Nb(w/d|0,s[w],s[w+1],x);return x&&ym(x,x.next)&&(Hd(x),x=x.next),x}function gu(s,n){if(!s)return s;n||(n=s);let a,d=s;do if(a=!1,d.steiner||!ym(d,d.next)&&wn(d.prev,d,d.next)!==0)d=d.next;else{if(Hd(d),d=n=d.prev,d===d.next)break;a=!0}while(a||d!==n);return n}function jd(s,n,a,d,y,x,w){if(!s)return;!w&&x&&function(k,I,D,L){let U=k;do U.z===0&&(U.z=h0(U.x,U.y,I,D,L)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==k);U.prevZ.nextZ=null,U.prevZ=null,function(Z){let K,J=1;do{let le,fe=Z;Z=null;let De=null;for(K=0;fe;){K++;let be=fe,Me=0;for(let et=0;et0||Ve>0&&be;)Me!==0&&(Ve===0||!be||fe.z<=be.z)?(le=fe,fe=fe.nextZ,Me--):(le=be,be=be.nextZ,Ve--),De?De.nextZ=le:Z=le,le.prevZ=De,De=le;fe=be}De.nextZ=null,J*=2}while(K>1)}(U)}(s,d,y,x);let b=s;for(;s.prev!==s.next;){const k=s.prev,I=s.next;if(x?BA(s,d,y,x):FA(s))n.push(k.i,s.i,I.i),Hd(s),s=I.next,b=I.next;else if((s=I)===b){w?w===1?jd(s=NA(gu(s),n),n,a,d,y,x,2):w===2&&$A(s,n,a,d,y,x):jd(gu(s),n,a,d,y,x,1);break}}}function FA(s){const n=s.prev,a=s,d=s.next;if(wn(n,a,d)>=0)return!1;const y=n.x,x=a.x,w=d.x,b=n.y,k=a.y,I=d.y,D=yx?y>w?y:w:x>w?x:w,Z=b>k?b>I?b:I:k>I?k:I;let K=d.next;for(;K!==n;){if(K.x>=D&&K.x<=U&&K.y>=L&&K.y<=Z&&Fc(y,b,x,k,w,I,K.x,K.y)&&wn(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function BA(s,n,a,d){const y=s.prev,x=s,w=s.next;if(wn(y,x,w)>=0)return!1;const b=y.x,k=x.x,I=w.x,D=y.y,L=x.y,U=w.y,Z=bk?b>I?b:I:k>I?k:I,le=D>L?D>U?D:U:L>U?L:U,fe=h0(Z,K,n,a,d),De=h0(J,le,n,a,d);let be=s.prevZ,Me=s.nextZ;for(;be&&be.z>=fe&&Me&&Me.z<=De;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Fc(b,D,k,L,I,U,be.x,be.y)&&wn(be.prev,be,be.next)>=0||(be=be.prevZ,Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Fc(b,D,k,L,I,U,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0))return!1;Me=Me.nextZ}for(;be&&be.z>=fe;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Fc(b,D,k,L,I,U,be.x,be.y)&&wn(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Me&&Me.z<=De;){if(Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Fc(b,D,k,L,I,U,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0)return!1;Me=Me.nextZ}return!0}function NA(s,n){let a=s;do{const d=a.prev,y=a.next.next;!ym(d,y)&&Fb(d,a,a.next,y)&&Vd(d,y)&&Vd(y,d)&&(n.push(d.i,a.i,y.i),Hd(a),Hd(a.next),a=s=y),a=a.next}while(a!==s);return gu(a)}function $A(s,n,a,d,y,x){let w=s;do{let b=w.next.next;for(;b!==w.prev;){if(w.i!==b.i&&WA(w,b)){let k=Bb(w,b);return w=gu(w,w.next),k=gu(k,k.next),jd(w,n,a,d,y,x,0),void jd(k,n,a,d,y,x,0)}b=b.next}w=w.next}while(w!==s)}function UA(s,n){return s.x-n.x}function jA(s,n){const a=function(y,x){let w=x;const b=y.x,k=y.y;let I,D=-1/0;do{if(k<=w.y&&k>=w.next.y&&w.next.y!==w.y){const J=w.x+(k-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(J<=b&&J>D&&(D=J,I=w.x=w.x&&w.x>=U&&b!==w.x&&Fc(kI.x||w.x===I.x&&VA(I,w)))&&(I=w,K=J)}w=w.next}while(w!==L);return I}(s,n);if(!a)return n;const d=Bb(a,s);return gu(d,d.next),gu(a,a.next)}function VA(s,n){return wn(s.prev,s,n.prev)<0&&wn(n.next,s,s.next)<0}function h0(s,n,a,d,y){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-a)*y|0)|s<<8))|s<<4))|s<<2))|s<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-d)*y|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function HA(s){let n=s,a=s;do(n.x=(s-w)*(x-b)&&(s-w)*(d-b)>=(a-w)*(n-b)&&(a-w)*(x-b)>=(y-w)*(d-b)}function WA(s,n){return s.next.i!==n.i&&s.prev.i!==n.i&&!function(a,d){let y=a;do{if(y.i!==a.i&&y.next.i!==a.i&&y.i!==d.i&&y.next.i!==d.i&&Fb(y,y.next,a,d))return!0;y=y.next}while(y!==a);return!1}(s,n)&&(Vd(s,n)&&Vd(n,s)&&function(a,d){let y=a,x=!1;const w=(a.x+d.x)/2,b=(a.y+d.y)/2;do y.y>b!=y.next.y>b&&y.next.y!==y.y&&w<(y.next.x-y.x)*(b-y.y)/(y.next.y-y.y)+y.x&&(x=!x),y=y.next;while(y!==a);return x}(s,n)&&(wn(s.prev,s,n.prev)||wn(s,n.prev,n))||ym(s,n)&&wn(s.prev,s,s.next)>0&&wn(n.prev,n,n.next)>0)}function wn(s,n,a){return(n.y-s.y)*(a.x-n.x)-(n.x-s.x)*(a.y-n.y)}function ym(s,n){return s.x===n.x&&s.y===n.y}function Fb(s,n,a,d){const y=vm(wn(s,n,a)),x=vm(wn(s,n,d)),w=vm(wn(a,d,s)),b=vm(wn(a,d,n));return y!==x&&w!==b||!(y!==0||!_m(s,a,n))||!(x!==0||!_m(s,d,n))||!(w!==0||!_m(a,s,d))||!(b!==0||!_m(a,n,d))}function _m(s,n,a){return n.x<=Math.max(s.x,a.x)&&n.x>=Math.min(s.x,a.x)&&n.y<=Math.max(s.y,a.y)&&n.y>=Math.min(s.y,a.y)}function vm(s){return s>0?1:s<0?-1:0}function Vd(s,n){return wn(s.prev,s,s.next)<0?wn(s,n,s.next)>=0&&wn(s,s.prev,n)>=0:wn(s,n,s.prev)<0||wn(s,s.next,n)<0}function Bb(s,n){const a=d0(s.i,s.x,s.y),d=d0(n.i,n.x,n.y),y=s.next,x=n.prev;return s.next=n,n.prev=s,a.next=y,y.prev=a,d.next=a,a.prev=d,x.next=d,d.prev=x,d}function Nb(s,n,a,d){const y=d0(s,n,a);return d?(y.next=d.next,y.prev=d,d.next.prev=y,d.next=y):(y.prev=y,y.next=y),y}function Hd(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function d0(s,n,a){return{i:s,x:n,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function f0(s,n,a){const d=a.patternDependencies;let y=!1;for(const x of n){const w=x.paint.get(`${s}-pattern`);w.isConstant()||(y=!0);const b=w.constantOr(null);b&&(y=!0,d[b.to]=!0,d[b.from]=!0)}return y}function p0(s,n,a,d,y){const x=y.patternDependencies;for(const w of n){const b=w.paint.get(`${s}-pattern`).value;if(b.kind!=="constant"){let k=b.evaluate({zoom:d-1},a,{},y.availableImages),I=b.evaluate({zoom:d},a,{},y.availableImages),D=b.evaluate({zoom:d+1},a,{},y.availableImages);k=k&&k.name?k.name:k,I=I&&I.name?I.name:I,D=D&&D.name?D.name:D,x[k]=!0,x[I]=!0,x[D]=!0,a.patterns[w.id]={min:k,mid:I,max:D}}}return a}class m0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new ws,this.indexArray2=new Nn,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.segments2=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("fill",this.layers,a);const y=this.layers[0].layout.get("fill-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,U=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),U,d))continue;const Z=x?y.evaluate(U,{},d,a.availableImages):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?U.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,OA),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,a,d,y,x){for(const w of ac(a,500)){let b=0;for(const Z of w)b+=Z.length;const k=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),I=k.vertexLength,D=[],L=[];for(const Z of w){if(Z.length===0)continue;Z!==w[0]&&L.push(D.length/2);const K=this.segments2.prepareSegment(Z.length,this.layoutVertexArray,this.indexArray2),J=K.vertexLength;this.layoutVertexArray.emplaceBack(Z[0].x,Z[0].y),this.indexArray2.emplaceBack(J+Z.length-1,J),D.push(Z[0].x),D.push(Z[0].y);for(let le=1;le>3}if(y--,d===1||d===2)x+=s.readSVarint(),w+=s.readSVarint(),d===1&&(n&&b.push(n),n=[]),n.push(new KA(x,w));else{if(d!==7)throw new Error("unknown command "+d);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Bc.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var n=s.readVarint()+s.pos,a=1,d=0,y=0,x=0,w=1/0,b=-1/0,k=1/0,I=-1/0;s.pos>3}if(d--,a===1||a===2)(y+=s.readSVarint())b&&(b=y),(x+=s.readSVarint())I&&(I=x);else if(a!==7)throw new Error("unknown command "+a)}return[w,k,b,I]},Bc.prototype.toGeoJSON=function(s,n,a){var d,y,x=this.extent*Math.pow(2,a),w=this.extent*s,b=this.extent*n,k=this.loadGeometry(),I=Bc.types[this.type];function D(Z){for(var K=0;K>3;y=w===1?d.readString():w===2?d.readFloat():w===3?d.readDouble():w===4?d.readVarint64():w===5?d.readVarint():w===6?d.readSVarint():w===7?d.readBoolean():null}return y}(a))}Hb.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var n=this._pbf.readVarint()+this._pbf.pos;return new e3(this._pbf,n,this.extent,this._keys,this._values)};var r3=Vb;function n3(s,n,a){if(s===3){var d=new r3(a,a.readVarint()+a.pos);d.length&&(n[d.name]=d)}}hl.VectorTile=function(s,n){this.layers=s.readFields(n3,{},n)},hl.VectorTileFeature=jb,hl.VectorTileLayer=Vb;const i3=hl.VectorTileFeature.types,g0=Math.pow(2,13);function Wd(s,n,a,d,y,x,w,b){s.emplaceBack(n,a,2*Math.floor(d*g0)+w,y*g0*2,x*g0*2,Math.round(b))}class y0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new sl,this.centroidVertexArray=new Zn,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.features=[],this.hasPattern=f0("fill-extrusion",this.layers,a);for(const{feature:y,id:x,index:w,sourceLayerIndex:b}of n){const k=this.layers[0]._featureFilter.needGeometry,I=mu(y,k);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),I,d))continue;const D={id:x,sourceLayerIndex:b,index:w,geometry:k?I.geometry:pu(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(p0("fill-extrusion",this.layers,D,this.zoom,a)):this.addFeature(D,D.geometry,w,d,{}),a.featureIndex.insert(y,D.geometry,w,b,this.index,!0)}}addFeatures(n,a,d){for(const y of this.features){const{geometry:x}=y;this.addFeature(y,x,y.index,a,d)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,XA),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,YA.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,a,d,y,x){for(const w of ac(a,500)){const b={x:0,y:0,vertexCount:0};let k=0;for(const K of w)k+=K.length;let I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of w){if(K.length===0||o3(K))continue;let J=0;for(let le=0;le=1){const De=K[le-1];if(!s3(fe,De)){I.vertexLength+4>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=fe.sub(De)._perp()._unit(),Me=De.dist(fe);J+Me>32768&&(J=0),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,1,J),b.x+=2*fe.x,b.y+=2*fe.y,b.vertexCount+=2,J+=Me,Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,1,J),b.x+=2*De.x,b.y+=2*De.y,b.vertexCount+=2;const Ve=I.vertexLength;this.indexArray.emplaceBack(Ve,Ve+2,Ve+1),this.indexArray.emplaceBack(Ve+1,Ve+2,Ve+3),I.vertexLength+=4,I.primitiveLength+=2}}}}if(I.vertexLength+k>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),i3[n.type]!=="Polygon")continue;const D=[],L=[],U=I.vertexLength;for(const K of w)if(K.length!==0){K!==w[0]&&L.push(D.length/2);for(let J=0;JCn)||s.y===n.y&&(s.y<0||s.y>Cn)}function o3(s){return s.every(n=>n.x<0)||s.every(n=>n.x>Cn)||s.every(n=>n.y<0)||s.every(n=>n.y>Cn)}let Wb;St("FillExtrusionBucket",y0,{omit:["layers","features"]});var a3={get paint(){return Wb=Wb||new v({"fill-extrusion-opacity":new It(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new jt(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Cc(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new jt(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new jt(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new It(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class l3 extends u{constructor(n){super(n,a3)}createBucket(n){return new y0(n)}queryRadius(){return pm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,a,d,y,x,w,b,k){const I=mm(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,b),D=this.paint.get("fill-extrusion-height").evaluate(a,d),L=this.paint.get("fill-extrusion-base").evaluate(a,d),U=function(K,J,le,fe){const De=[];for(const be of K){const Me=[be.x,be.y,0,1];gm(Me,Me,J),De.push(new A(Me[0]/Me[3],Me[1]/Me[3]))}return De}(I,k),Z=function(K,J,le,fe){const De=[],be=[],Me=fe[8]*J,Ve=fe[9]*J,et=fe[10]*J,xt=fe[11]*J,Nt=fe[8]*le,yt=fe[9]*le,pt=fe[10]*le,At=fe[11]*le;for(const Tt of K){const bt=[],qe=[];for(const Dt of Tt){const Mt=Dt.x,Zt=Dt.y,Fr=fe[0]*Mt+fe[4]*Zt+fe[12],Or=fe[1]*Mt+fe[5]*Zt+fe[13],zn=fe[2]*Mt+fe[6]*Zt+fe[14],Gs=fe[3]*Mt+fe[7]*Zt+fe[15],Xn=zn+et,Rn=Gs+xt,xi=Fr+Nt,wi=Or+yt,bi=zn+pt,mn=Gs+At,Ln=new A((Fr+Me)/Rn,(Or+Ve)/Rn);Ln.z=Xn/Rn,bt.push(Ln);const oi=new A(xi/mn,wi/mn);oi.z=bi/mn,qe.push(oi)}De.push(bt),be.push(qe)}return[De,be]}(y,L,D,k);return function(K,J,le){let fe=1/0;Sb(le,J)&&(fe=Gb(le,J[0]));for(let De=0;Dea.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new Pc,this.layoutVertexArray2=new ol,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("line",this.layers,a);const y=this.layers[0].layout.get("line-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,U=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),U,d))continue;const Z=x?y.evaluate(U,{},d):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?U.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("line",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,d3)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,c3),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,a,d,y,x){const w=this.layers[0].layout,b=w.get("line-join").evaluate(n,{}),k=w.get("line-cap"),I=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const L of a)this.addLine(L,n,b,k,I,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,x,y)}addLine(n,a,d,y,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe=2&&n[k-1].equals(n[k-2]);)k--;let I=0;for(;I0;if(xt&&fe>I){const At=U.dist(Z);if(At>2*D){const Tt=U.sub(U.sub(Z)._mult(D/At)._round());this.updateDistance(Z,Tt),this.addCurrentVertex(Tt,J,0,0,L),Z=Tt}}const yt=Z&&K;let pt=yt?d:b?"butt":y;if(yt&&pt==="round"&&(Vex&&(pt="bevel"),pt==="bevel"&&(Ve>2&&(pt="flipbevel"),Ve100)De=le.mult(-1);else{const At=Ve*J.add(le).mag()/J.sub(le).mag();De._perp()._mult(At*(Nt?-1:1))}this.addCurrentVertex(U,De,0,0,L),this.addCurrentVertex(U,De.mult(-1),0,0,L)}else if(pt==="bevel"||pt==="fakeround"){const At=-Math.sqrt(Ve*Ve-1),Tt=Nt?At:0,bt=Nt?0:At;if(Z&&this.addCurrentVertex(U,J,Tt,bt,L),pt==="fakeround"){const qe=Math.round(180*et/Math.PI/20);for(let Dt=1;Dt2*D){const Tt=U.add(K.sub(U)._mult(D/At)._round());this.updateDistance(U,Tt),this.addCurrentVertex(Tt,le,0,0,L),U=Tt}}}}addCurrentVertex(n,a,d,y,x,w=!1){const b=a.y*y-a.x,k=-a.y-a.x*y;this.addHalfVertex(n,a.x+a.y*d,a.y-a.x*d,w,!1,d,x),this.addHalfVertex(n,b,k,w,!0,-y,x),this.distance>Zb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,a,d,y,x,w))}addHalfVertex({x:n,y:a},d,y,x,w,b,k){const I=.5*(this.lineClips?this.scaledDistance*(Zb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(x?1:0),(a<<1)+(w?1:0),Math.round(63*d)+128,Math.round(63*y)+128,1+(b===0?0:b<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),k.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,a){this.distance+=n.dist(a),this.updateScaledDistance()}}let qb,Yb;St("LineBucket",_0,{omit:["layers","patternFeatures"]});var Xb={get paint(){return Yb=Yb||new v({"line-opacity":new jt(ie.paint_line["line-opacity"]),"line-color":new jt(ie.paint_line["line-color"]),"line-translate":new It(ie.paint_line["line-translate"]),"line-translate-anchor":new It(ie.paint_line["line-translate-anchor"]),"line-width":new jt(ie.paint_line["line-width"]),"line-gap-width":new jt(ie.paint_line["line-gap-width"]),"line-offset":new jt(ie.paint_line["line-offset"]),"line-blur":new jt(ie.paint_line["line-blur"]),"line-dasharray":new Ic(ie.paint_line["line-dasharray"]),"line-pattern":new Cc(ie.paint_line["line-pattern"]),"line-gradient":new Od(ie.paint_line["line-gradient"])})},get layout(){return qb=qb||new v({"line-cap":new It(ie.layout_line["line-cap"]),"line-join":new jt(ie.layout_line["line-join"]),"line-miter-limit":new It(ie.layout_line["line-miter-limit"]),"line-round-limit":new It(ie.layout_line["line-round-limit"]),"line-sort-key":new jt(ie.layout_line["line-sort-key"])})}};class m3 extends jt{possiblyEvaluate(n,a){return a=new Vr(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(n,a)}evaluate(n,a,d,y){return a=ge({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(n,a,d,y)}}let xm;class g3 extends u{constructor(n){super(n,Xb),this.gradientVersion=0,xm||(xm=new m3(Xb.paint.properties["line-width"].specification),xm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(d){return d._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof $a,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,a){super.recalculate(n,a),this.paint._values["line-floorwidth"]=xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new _0(n)}queryRadius(n){const a=n,d=Kb(Nd("line-width",this,a),Nd("line-gap-width",this,a)),y=Nd("line-offset",this,a);return d/2+Math.abs(y)+pm(this.paint.get("line-translate"))}queryIntersectsFeature(n,a,d,y,x,w,b){const k=mm(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,b),I=b/2*Kb(this.paint.get("line-width").evaluate(a,d),this.paint.get("line-gap-width").evaluate(a,d)),D=this.paint.get("line-offset").evaluate(a,d);return D&&(y=function(L,U){const Z=[];for(let K=0;K=3){for(let le=0;le0?n+2*s:s}const y3=S([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_3=S([{name:"a_projected_pos",components:3,type:"Float32"}],4);S([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const v3=S([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);S([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Jb=S([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x3=S([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function w3(s,n,a){return s.sections.forEach(d=>{d.text=function(y,x,w){const b=x.layout.get("text-transform").evaluate(w,{});return b==="uppercase"?y=y.toLocaleUpperCase():b==="lowercase"&&(y=y.toLocaleLowerCase()),Ri.applyArabicShaping&&(y=Ri.applyArabicShaping(y)),y}(d.text,n,a)}),s}S([{name:"triangle",components:3,type:"Uint16"}]),S([{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"}]),S([{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"}]),S([{type:"Float32",name:"offsetX"}]),S([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),S([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Pn=24,Qb=Lr,e2=function(s,n,a,d,y){var x,w,b=8*y-d-1,k=(1<>1,D=-7,L=y-1,U=-1,Z=s[n+L];for(L+=U,x=Z&(1<<-D)-1,Z>>=-D,D+=b;D>0;x=256*x+s[n+L],L+=U,D-=8);for(w=x&(1<<-D)-1,x>>=-D,D+=d;D>0;w=256*w+s[n+L],L+=U,D-=8);if(x===0)x=1-I;else{if(x===k)return w?NaN:1/0*(Z?-1:1);w+=Math.pow(2,d),x-=I}return(Z?-1:1)*w*Math.pow(2,x-d)},t2=function(s,n,a,d,y,x){var w,b,k,I=8*x-y-1,D=(1<>1,U=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,Z=0,K=1,J=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,w=D):(w=Math.floor(Math.log(n)/Math.LN2),n*(k=Math.pow(2,-w))<1&&(w--,k*=2),(n+=w+L>=1?U/k:U*Math.pow(2,1-L))*k>=2&&(w++,k/=2),w+L>=D?(b=0,w=D):w+L>=1?(b=(n*k-1)*Math.pow(2,y),w+=L):(b=n*Math.pow(2,L-1)*Math.pow(2,y),w=0));y>=8;s[a+Z]=255&b,Z+=K,b/=256,y-=8);for(w=w<0;s[a+Z]=255&w,Z+=K,w/=256,I-=8);s[a+Z-K]|=128*J};function Lr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Lr.Varint=0,Lr.Fixed64=1,Lr.Bytes=2,Lr.Fixed32=5;var v0=4294967296,r2=1/v0,n2=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ha(s){return s.type===Lr.Bytes?s.readVarint()+s.pos:s.pos+1}function Nc(s,n,a){return a?4294967296*n+(s>>>0):4294967296*(n>>>0)+(s>>>0)}function i2(s,n,a){var d=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));a.realloc(d);for(var y=a.pos-1;y>=s;y--)a.buf[y+d]=a.buf[y]}function b3(s,n){for(var a=0;a>>8,s[a+2]=n>>>16,s[a+3]=n>>>24}function s2(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+(s[n+3]<<24)}Lr.prototype={destroy:function(){this.buf=null},readFields:function(s,n,a){for(a=a||this.length;this.pos>3,x=this.pos;this.type=7&d,s(y,n,this),this.pos===x&&this.skip(d)}return n},readMessage:function(s,n){return this.readFields(s,n,this.readVarint()+this.pos)},readFixed32:function(){var s=wm(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=s2(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=wm(this.buf,this.pos)+wm(this.buf,this.pos+4)*v0;return this.pos+=8,s},readSFixed64:function(){var s=wm(this.buf,this.pos)+s2(this.buf,this.pos+4)*v0;return this.pos+=8,s},readFloat:function(){var s=e2(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=e2(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var n,a,d=this.buf;return n=127&(a=d[this.pos++]),a<128?n:(n|=(127&(a=d[this.pos++]))<<7,a<128?n:(n|=(127&(a=d[this.pos++]))<<14,a<128?n:(n|=(127&(a=d[this.pos++]))<<21,a<128?n:function(y,x,w){var b,k,I=w.buf;if(b=(112&(k=I[w.pos++]))>>4,k<128||(b|=(127&(k=I[w.pos++]))<<3,k<128)||(b|=(127&(k=I[w.pos++]))<<10,k<128)||(b|=(127&(k=I[w.pos++]))<<17,k<128)||(b|=(127&(k=I[w.pos++]))<<24,k<128)||(b|=(1&(k=I[w.pos++]))<<31,k<128))return Nc(y,b,x);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(a=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,n=this.pos;return this.pos=s,s-n>=12&&n2?function(a,d,y){return n2.decode(a.subarray(d,y))}(this.buf,n,s):function(a,d,y){for(var x="",w=d;w239?4:D>223?3:D>191?2:1;if(w+U>y)break;U===1?D<128&&(L=D):U===2?(192&(b=a[w+1]))==128&&(L=(31&D)<<6|63&b)<=127&&(L=null):U===3?(k=a[w+2],(192&(b=a[w+1]))==128&&(192&k)==128&&((L=(15&D)<<12|(63&b)<<6|63&k)<=2047||L>=55296&&L<=57343)&&(L=null)):U===4&&(k=a[w+2],I=a[w+3],(192&(b=a[w+1]))==128&&(192&k)==128&&(192&I)==128&&((L=(15&D)<<18|(63&b)<<12|(63&k)<<6|63&I)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,U=1):L>65535&&(L-=65536,x+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),x+=String.fromCharCode(L),w+=U}return x}(this.buf,n,s)},readBytes:function(){var s=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,s);return this.pos=s,n},readPackedVarint:function(s,n){if(this.type!==Lr.Bytes)return s.push(this.readVarint(n));var a=ha(this);for(s=s||[];this.pos127;);else if(n===Lr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===Lr.Fixed32)this.pos+=4;else{if(n!==Lr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(s,n){this.writeVarint(s<<3|n)},realloc:function(s){for(var n=this.length||16;n268435455||s<0?function(n,a){var d,y;if(n>=0?(d=n%4294967296|0,y=n/4294967296|0):(y=~(-n/4294967296),4294967295^(d=~(-n%4294967296))?d=d+1|0:(d=0,y=y+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(x,w,b){b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,b.buf[b.pos]=127&(x>>>=7)}(d,0,a),function(x,w){var b=(7&x)<<4;w.buf[w.pos++]|=b|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(y,a)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var n=this.pos;this.pos=function(d,y,x){for(var w,b,k=0;k55295&&w<57344){if(!b){w>56319||k+1===y.length?(d[x++]=239,d[x++]=191,d[x++]=189):b=w;continue}if(w<56320){d[x++]=239,d[x++]=191,d[x++]=189,b=w;continue}w=b-55296<<10|w-56320|65536,b=null}else b&&(d[x++]=239,d[x++]=191,d[x++]=189,b=null);w<128?d[x++]=w:(w<2048?d[x++]=w>>6|192:(w<65536?d[x++]=w>>12|224:(d[x++]=w>>18|240,d[x++]=w>>12&63|128),d[x++]=w>>6&63|128),d[x++]=63&w|128)}return x}(this.buf,s,this.pos);var a=this.pos-n;a>=128&&i2(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeFloat:function(s){this.realloc(4),t2(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),t2(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var n=s.length;this.writeVarint(n),this.realloc(n);for(var a=0;a=128&&i2(a,d,this),this.pos=a-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,n,a){this.writeTag(s,Lr.Bytes),this.writeRawMessage(n,a)},writePackedVarint:function(s,n){n.length&&this.writeMessage(s,b3,n)},writePackedSVarint:function(s,n){n.length&&this.writeMessage(s,S3,n)},writePackedBoolean:function(s,n){n.length&&this.writeMessage(s,E3,n)},writePackedFloat:function(s,n){n.length&&this.writeMessage(s,k3,n)},writePackedDouble:function(s,n){n.length&&this.writeMessage(s,T3,n)},writePackedFixed32:function(s,n){n.length&&this.writeMessage(s,C3,n)},writePackedSFixed32:function(s,n){n.length&&this.writeMessage(s,I3,n)},writePackedFixed64:function(s,n){n.length&&this.writeMessage(s,P3,n)},writePackedSFixed64:function(s,n){n.length&&this.writeMessage(s,M3,n)},writeBytesField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeBytes(n)},writeFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeVarint(n)},writeSVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeSVarint(n)},writeStringField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeString(n)},writeFloatField:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFloat(n)},writeDoubleField:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeDouble(n)},writeBooleanField:function(s,n){this.writeVarintField(s,!!n)}};var x0=T(Qb);const w0=3;function A3(s,n,a){s===1&&a.readMessage(D3,n)}function D3(s,n,a){if(s===3){const{id:d,bitmap:y,width:x,height:w,left:b,top:k,advance:I}=a.readMessage(z3,{});n.push({id:d,bitmap:new Ud({width:x+2*w0,height:w+2*w0},y),metrics:{width:x,height:w,left:b,top:k,advance:I}})}}function z3(s,n,a){s===1?n.id=a.readVarint():s===2?n.bitmap=a.readBytes():s===3?n.width=a.readVarint():s===4?n.height=a.readVarint():s===5?n.left=a.readSVarint():s===6?n.top=a.readSVarint():s===7&&(n.advance=a.readVarint())}const o2=w0;function a2(s){let n=0,a=0;for(const w of s)n+=w.w*w.h,a=Math.max(a,w.w);s.sort((w,b)=>b.h-w.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),a),h:1/0}];let y=0,x=0;for(const w of s)for(let b=d.length-1;b>=0;b--){const k=d[b];if(!(w.w>k.w||w.h>k.h)){if(w.x=k.x,w.y=k.y,x=Math.max(x,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===k.w&&w.h===k.h){const I=d.pop();b=0&&d>=n&&Sm[this.text.charCodeAt(d)];d--)a--;this.text=this.text.substring(n,a),this.sectionIndex=this.sectionIndex.slice(n,a)}substring(n,a){const d=new Uc;return d.text=this.text.substring(n,a),d.sectionIndex=this.sectionIndex.slice(n,a),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,a)=>Math.max(n,this.sections[a].scale),0)}addTextSection(n,a){this.text+=n.text,this.sections.push(Yd.forText(n.scale,n.fontStack||a));const d=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bm(s,n,a,d,y,x,w,b,k,I,D,L,U,Z,K){const J=Uc.fromFeature(s,y);let le;L===g.ah.vertical&&J.verticalizePunctuation();const{processBidirectionalText:fe,processStyledBidirectionalText:De}=Ri;if(fe&&J.sections.length===1){le=[];const Ve=fe(J.toString(),S0(J,I,x,n,d,Z));for(const et of Ve){const xt=new Uc;xt.text=et,xt.sections=J.sections;for(let Nt=0;Nt0&&da>Jn&&(Jn=da)}else{const Ts=xt[xr.fontStack],$n=Ts&&Ts[Zr];if($n&&$n.rect)Wc=$n.rect,nn=$n.metrics;else{const da=et[xr.fontStack],tf=da&&da[Zr];if(!tf)continue;nn=tf.metrics}ns=(Ln-xr.scale)*Pn}Zs?(Ve.verticalizable=!0,Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Wc}),Zt+=Lo*xr.scale+qe):(Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Wc}),Zt+=nn.advance*xr.scale+qe)}Si.length!==0&&(Or=Math.max(Zt-qe,Or),F3(Si,0,Si.length-1,Gs,Jn)),Zt=0;const ks=pt*Ln+Jn;Kn.lineOffset=Math.max(Jn,oi),Fr+=ks,zn=Math.max(ks,zn),++Xn}var Rn;const xi=Fr-qd,{horizontalAlign:wi,verticalAlign:bi}=k0(At);(function(mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr){const $r=(Ln-oi)*Si;let Zr=0;Zr=Jn!==ks?-Fi*Kn-qd:(-Kn*xr+.5)*ks;for(const ns of mn)for(const nn of ns.positionedGlyphs)nn.x+=$r,nn.y+=Zr})(Ve.positionedLines,Gs,wi,bi,Or,zn,pt,xi,yt.length),Ve.top+=-bi*xi,Ve.bottom=Ve.top+xi,Ve.left+=-wi*Or,Ve.right=Ve.left+Or}(Me,n,a,d,le,w,b,k,L,I,U,K),!function(Ve){for(const et of Ve)if(et.positionedGlyphs.length!==0)return!1;return!0}(be)&&Me}const Sm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},R3={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},L3={40:!0};function u2(s,n,a,d,y,x){if(n.imageName){const w=d[n.imageName];return w?w.displaySize[0]*n.scale*Pn/x+y:0}{const w=a[n.fontStack],b=w&&w[s];return b?b.metrics.advance*n.scale+y:0}}function c2(s,n,a,d){const y=Math.pow(s-n,2);return d?s=0;let I=0;for(let L=0;LI){const D=Math.ceil(x/I);y*=D/w,w=D}return{x1:d,y1:y,x2:d+x,y2:y+w}}function p2(s,n,a,d,y,x){const w=s.image;let b;if(w.content){const le=w.content,fe=w.pixelRatio||1;b=[le[0]/fe,le[1]/fe,w.displaySize[0]-le[2]/fe,w.displaySize[1]-le[3]/fe]}const k=n.left*x,I=n.right*x;let D,L,U,Z;a==="width"||a==="both"?(Z=y[0]+k-d[3],L=y[0]+I+d[1]):(Z=y[0]+(k+I-w.displaySize[0])/2,L=Z+w.displaySize[0]);const K=n.top*x,J=n.bottom*x;return a==="height"||a==="both"?(D=y[1]+K-d[0],U=y[1]+J+d[2]):(D=y[1]+(K+J-w.displaySize[1])/2,U=D+w.displaySize[1]),{image:w,top:D,right:L,bottom:U,left:Z,collisionPadding:b}}const Xd=255,zo=128,fl=Xd*zo;function m2(s,n){const{expression:a}=n;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new Vr(s+1))};if(a.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:y}=a;let x=0;for(;xw.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a0([]),this.placementViewportMatrix=a0([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=m2(this.zoom,a["text-size"]),this.iconSizeData=m2(this.zoom,a["icon-size"]);const d=this.layers[0].layout,y=d.get("symbol-sort-key"),x=d.get("symbol-z-order");this.canOverlap=T0(d,"text-overlap","text-allow-overlap")!=="never"||T0(d,"icon-overlap","icon-allow-overlap")!=="never"||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,d.get("symbol-placement")==="point"&&(this.writingModes=d.get("text-writing-mode").map(w=>g.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=n.sourceID}createArrays(){this.text=new C0(new fu(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new C0(new fu(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new Wr,this.lineVertexArray=new Gn,this.symbolInstances=new ar,this.textAnchorOffsets=new Gr}calculateGlyphDependencies(n,a,d,y,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,L=x.get("symbol-sort-key");if(this.features=[],!I&&!D)return;const U=a.iconDependencies,Z=a.glyphDependencies,K=a.availableImages,J=new Vr(this.zoom);for(const{feature:le,id:fe,index:De,sourceLayerIndex:be}of n){const Me=y._featureFilter.needGeometry,Ve=mu(le,Me);if(!y._featureFilter.filter(J,Ve,d))continue;let et,xt;if(Me||(Ve.geometry=pu(le)),I){const yt=y.getValueAndResolveTokens("text-field",Ve,d,K),pt=Mi.factory(yt),At=this.hasRTLText=this.hasRTLText||U3(pt);(!At||Ri.getRTLTextPluginStatus()==="unavailable"||At&&Ri.isParsed())&&(et=w3(pt,y,Ve))}if(D){const yt=y.getValueAndResolveTokens("icon-image",Ve,d,K);xt=yt instanceof Di?yt:Di.fromString(yt)}if(!et&&!xt)continue;const Nt=this.sortFeaturesByKey?L.evaluate(Ve,{},d):void 0;if(this.features.push({id:fe,text:et,icon:xt,index:De,sourceLayerIndex:be,geometry:Ve.geometry,properties:le.properties,type:N3[le.type],sortKey:Nt}),xt&&(U[xt.name]=!0),et){const yt=w.evaluate(Ve,{},d).join(","),pt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(g.ah.vertical)>=0;for(const At of et.sections)if(At.image)U[At.image.name]=!0;else{const Tt=Dd(et.toString()),bt=At.fontStack||yt,qe=Z[bt]=Z[bt]||{};this.calculateGlyphDependencies(At.text,qe,pt,this.allowVerticalPlacement,Tt)}}}x.get("symbol-placement")==="line"&&(this.features=function(le){const fe={},De={},be=[];let Me=0;function Ve(yt){be.push(le[yt]),Me++}function et(yt,pt,At){const Tt=De[yt];return delete De[yt],De[pt]=Tt,be[Tt].geometry[0].pop(),be[Tt].geometry[0]=be[Tt].geometry[0].concat(At[0]),Tt}function xt(yt,pt,At){const Tt=fe[pt];return delete fe[pt],fe[yt]=Tt,be[Tt].geometry[0].shift(),be[Tt].geometry[0]=At[0].concat(be[Tt].geometry[0]),Tt}function Nt(yt,pt,At){const Tt=At?pt[0][pt[0].length-1]:pt[0][0];return`${yt}:${Tt.x}:${Tt.y}`}for(let yt=0;ytyt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,fe)=>le.sortKey-fe.sortKey)}update(n,a,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,a,this.layers,d),this.icon.programConfigurations.updatePaintArrays(n,a,this.layers,d))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,a){const d=this.lineVertexArray.length;if(n.segment!==void 0){let y=n.dist(a[n.segment+1]),x=n.dist(a[n.segment]);const w={};for(let b=n.segment+1;b=0;b--)w[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:x},b>0&&(x+=a[b-1].dist(a[b]));for(let b=0;b0}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(n,a){const d=n.placedSymbolArray.get(a),y=d.vertexStartIndex+4*d.numGlyphs;for(let x=d.vertexStartIndex;xy[b]-y[k]||x[k]-x[b]),w}addToSortKeyRanges(n,a){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===a?d.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const d=this.symbolInstances.get(a);this.featureSortOrder.push(d.featureIndex),[d.rightJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.leftJustifiedTextSymbolIndex].forEach((y,x,w)=>{y>=0&&w.indexOf(y)===x&&this.addIndicesForPlacedSymbol(this.text,y)}),d.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,d.verticalPlacedTextSymbolIndex),d.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.placedIconSymbolIndex),d.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let g2,y2;St("SymbolBucket",jc,{omit:["layers","collisionBoxArray","features","compareText"]}),jc.MAX_GLYPHS=65535,jc.addDynamicAttributes=E0;var P0={get paint(){return y2=y2||new v({"icon-opacity":new jt(ie.paint_symbol["icon-opacity"]),"icon-color":new jt(ie.paint_symbol["icon-color"]),"icon-halo-color":new jt(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new jt(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new jt(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new It(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new It(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new jt(ie.paint_symbol["text-opacity"]),"text-color":new jt(ie.paint_symbol["text-color"],{runtimeType:Kr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new jt(ie.paint_symbol["text-halo-color"]),"text-halo-width":new jt(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new jt(ie.paint_symbol["text-halo-blur"]),"text-translate":new It(ie.paint_symbol["text-translate"]),"text-translate-anchor":new It(ie.paint_symbol["text-translate-anchor"])})},get layout(){return g2=g2||new v({"symbol-placement":new It(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new It(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new It(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new jt(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new It(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new It(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new It(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new It(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new It(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new It(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new jt(ie.layout_symbol["icon-size"]),"icon-text-fit":new It(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new It(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new jt(ie.layout_symbol["icon-image"]),"icon-rotate":new jt(ie.layout_symbol["icon-rotate"]),"icon-padding":new jt(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new It(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new jt(ie.layout_symbol["icon-offset"]),"icon-anchor":new jt(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new It(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new It(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new It(ie.layout_symbol["text-rotation-alignment"]),"text-field":new jt(ie.layout_symbol["text-field"]),"text-font":new jt(ie.layout_symbol["text-font"]),"text-size":new jt(ie.layout_symbol["text-size"]),"text-max-width":new jt(ie.layout_symbol["text-max-width"]),"text-line-height":new It(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new jt(ie.layout_symbol["text-letter-spacing"]),"text-justify":new jt(ie.layout_symbol["text-justify"]),"text-radial-offset":new jt(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new It(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new jt(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new jt(ie.layout_symbol["text-anchor"]),"text-max-angle":new It(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new It(ie.layout_symbol["text-writing-mode"]),"text-rotate":new jt(ie.layout_symbol["text-rotate"]),"text-padding":new It(ie.layout_symbol["text-padding"]),"text-keep-upright":new It(ie.layout_symbol["text-keep-upright"]),"text-transform":new jt(ie.layout_symbol["text-transform"]),"text-offset":new jt(ie.layout_symbol["text-offset"]),"text-allow-overlap":new It(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new It(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new It(ie.layout_symbol["text-ignore-placement"]),"text-optional":new It(ie.layout_symbol["text-optional"])})}};class _2{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:pi,this.defaultValue=n}evaluate(n){if(n.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(n.formattedSection))return a.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",_2,{omit:["defaultValue"]});class Tm extends u{constructor(n){super(n,P0)}recalculate(n,a){if(super.recalculate(n,a),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"){const d=this.layout.get("text-writing-mode");if(d){const y=[];for(const x of d)y.indexOf(x)<0&&y.push(x);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,a,d,y){const x=this.layout.get(n).evaluate(a,{},d,y),w=this._unevaluatedLayout._values[n];return w.isDataDriven()||mc(w.value)||!x?x:function(b,k){return k.replace(/{([^{}]+)}/g,(I,D)=>b&&D in b?String(b[D]):"")}(a.properties,x)}createBucket(n){return new jc(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of P0.paint.overridableProperties){if(!Tm.hasPaintOverride(this.layout,n))continue;const a=this.paint.get(n),d=new _2(a),y=new pc(d,a.property.specification);let x=null;x=a.value.kind==="constant"||a.value.kind==="source"?new Ya("source",y):new Xa("composite",y,a.value.zoomStops),this.paint._values[n]=new Hs(a.property,x,a.parameters)}}_handleOverridablePaintPropertyUpdate(n,a,d){return!(!this.layout||a.isDataDriven()||d.isDataDriven())&&Tm.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,a){const d=n.get("text-field"),y=P0.paint.properties[a];let x=!1;const w=b=>{for(const k of b)if(y.overrides&&y.overrides.hasOverride(k))return void(x=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Mi)w(d.value.value.sections);else if(d.value.kind==="source"){const b=I=>{x||(I instanceof ms&&En(I.value)===fs?w(I.value.sections):I instanceof sc?w(I.sections):I.eachChild(b))},k=d.value;k._styleExpression&&b(k._styleExpression.expression)}return x}}let v2;var j3={get paint(){return v2=v2||new v({"background-color":new It(ie.paint_background["background-color"]),"background-pattern":new Ic(ie.paint_background["background-pattern"]),"background-opacity":new It(ie.paint_background["background-opacity"])})}};class V3 extends u{constructor(n){super(n,j3)}}let x2;var H3={get paint(){return x2=x2||new v({"raster-opacity":new It(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new It(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new It(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new It(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new It(ie.paint_raster["raster-saturation"]),"raster-contrast":new It(ie.paint_raster["raster-contrast"]),"raster-resampling":new It(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new It(ie.paint_raster["raster-fade-duration"])})}};class W3 extends u{constructor(n){super(n,H3)}}class G3 extends u{constructor(n){super(n,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=n}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 Z3{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const M0=63710088e-1;class pl{constructor(n,a){if(isNaN(n)||isNaN(a))throw new Error(`Invalid LngLat object: (${n}, ${a})`);if(this.lng=+n,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pl(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const a=Math.PI/180,d=this.lat*a,y=n.lat*a,x=Math.sin(d)*Math.sin(y)+Math.cos(d)*Math.cos(y)*Math.cos((n.lng-this.lng)*a);return M0*Math.acos(Math.min(x,1))}static convert(n){if(n instanceof pl)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new pl(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new pl(Number("lng"in n?n.lng:n.lon),Number(n.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const w2=2*Math.PI*M0;function b2(s){return w2*Math.cos(s*Math.PI/180)}function S2(s){return(180+s)/360}function k2(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function T2(s,n){return s/b2(n)}function A0(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Kd{constructor(n,a,d=0){this.x=+n,this.y=+a,this.z=+d}static fromLngLat(n,a=0){const d=pl.convert(n);return new Kd(S2(d.lng),k2(d.lat),T2(a,d.lat))}toLngLat(){return new pl(360*this.x-180,A0(this.y))}toAltitude(){return this.z*b2(A0(this.y))}meterInMercatorCoordinateUnits(){return 1/w2*(n=A0(this.y),1/Math.cos(n*Math.PI/180));var n}}function E2(s,n,a){var d=2*Math.PI*6378137/256/Math.pow(2,a);return[s*d-2*Math.PI*6378137/2,n*d-2*Math.PI*6378137/2]}class D0{constructor(n,a,d){if(!function(y,x,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||x<0||x>=Math.pow(2,y))}(n,a,d))throw new Error(`x=${a}, y=${d}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=a,this.y=d,this.key=Jd(0,n,n,a,d)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,a,d){const y=(w=this.y,b=this.z,k=E2(256*(x=this.x),256*(w=Math.pow(2,b)-w-1),b),I=E2(256*(x+1),256*(w+1),b),k[0]+","+k[1]+","+I[0]+","+I[1]);var x,w,b,k,I;const D=function(L,U,Z){let K,J="";for(let le=L;le>0;le--)K=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,y)}isChildOf(n){const a=this.z-n.z;return a>0&&n.x===this.x>>a&&n.y===this.y>>a}getTilePoint(n){const a=Math.pow(2,this.z);return new A((n.x*a-this.x)*Cn,(n.y*a-this.y)*Cn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class C2{constructor(n,a){this.wrap=n,this.canonical=a,this.key=Jd(n,a.z,a.z,a.x,a.y)}}class Ss{constructor(n,a,d,y,x){if(n= z; overscaledZ = ${n}; z = ${d}`);this.overscaledZ=n,this.wrap=a,this.canonical=new D0(d,+y,+x),this.key=Jd(a,n,d,y,x)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-n;return n>this.canonical.z?new Ss(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(n,this.wrap,n,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(n,a){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const d=this.canonical.z-n;return n>this.canonical.z?Jd(this.wrap*+a,n,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+a,n,n,this.canonical.x>>d,this.canonical.y>>d)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const a=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>a&&n.canonical.y===this.canonical.y>>a}children(n){if(this.overscaledZ>=n)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,d=2*this.canonical.x,y=2*this.canonical.y;return[new Ss(a,this.wrap,a,d,y),new Ss(a,this.wrap,a,d+1,y),new Ss(a,this.wrap,a,d,y+1),new Ss(a,this.wrap,a,d+1,y+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(n+1)}unpack(n,a,d){return n*this.redFactor+a*this.greenFactor+d*this.blueFactor-this.baseShift}getPixels(){return new bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,a,d){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let y=a*this.dim,x=a*this.dim+this.dim,w=d*this.dim,b=d*this.dim+this.dim;switch(a){case-1:y=x-1;break;case 1:x=y+1}switch(d){case-1:w=b-1;break;case 1:b=w+1}const k=-a*this.dim,I=-d*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class M2{constructor(n,a,d,y,x){this.type="Feature",this._vectorTileFeature=n,n._z=a,n._x=d,n._y=y,this.properties=n.properties,this.id=x}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(n[a]=this[a]);return n}}class A2{constructor(n,a){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new el(Cn,16,0),this.grid3D=new el(Cn,16,0),this.featureIndexArray=new ii,this.promoteId=a}insert(n,a,d,y,x,w){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,y,x);const k=w?this.grid3D:this.grid;for(let I=0;I=0&&L[3]>=0&&k.insert(b,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new hl.VectorTile(new x0(this.rawTileData)).layers,this.sourceLayerCoder=new P2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,a,d,y){this.loadVTLayers();const x=n.params||{},w=Cn/n.tileSize/n.scale,b=yd(x.filter),k=n.queryGeometry,I=n.queryPadding*w,D=z2(k),L=this.grid.query(D.minX-I,D.minY-I,D.maxX+I,D.maxY+I),U=z2(n.cameraQueryGeometry),Z=this.grid3D.query(U.minX-I,U.minY-I,U.maxX+I,U.maxY+I,(le,fe,De,be)=>function(Me,Ve,et,xt,Nt){for(const pt of Me)if(Ve<=pt.x&&et<=pt.y&&xt>=pt.x&&Nt>=pt.y)return!0;const yt=[new A(Ve,et),new A(Ve,Nt),new A(xt,Nt),new A(xt,et)];if(Me.length>2){for(const pt of yt)if(Lc(Me,pt))return!0}for(let pt=0;pt(be||(be=pu(Me)),Ve.queryIntersectsFeature(k,Me,et,be,this.z,n.transform,w,n.pixelPosMatrix)))}return K}loadMatchingFeature(n,a,d,y,x,w,b,k,I,D,L){const U=this.bucketLayerIDs[a];if(w&&!function(le,fe){for(let De=0;De=0)return!0;return!1}(w,U))return;const Z=this.sourceLayerCoder.decode(d),K=this.vtLayers[Z].feature(y);if(x.needGeometry){const le=mu(K,!0);if(!x.filter(new Vr(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!x.filter(new Vr(this.tileID.overscaledZ),K))return;const J=this.getId(K,Z);for(let le=0;le{const b=n instanceof cu?n.get(w):null;return b&&b.evaluate?b.evaluate(a,d,y):b})}function z2(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return{minX:n,minY:a,maxX:d,maxY:y}}function q3(s,n){return n-s}function R2(s,n,a,d,y){const x=[];for(let w=0;w=d&&L.x>=d||(D.x>=d?D=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round():L.x>=d&&(L=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round()),D.y>=y&&L.y>=y||(D.y>=y?D=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round():L.y>=y&&(L=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round()),k&&D.equals(k[k.length-1])||(k=[D],x.push(k)),k.push(L)))))}}return x}St("FeatureIndex",A2,{omit:["rawTileData","sourceLayerCoder"]});class ml extends A{constructor(n,a,d,y){super(n,a),this.angle=d,y!==void 0&&(this.segment=y)}clone(){return new ml(this.x,this.y,this.angle,this.segment)}}function L2(s,n,a,d,y){if(n.segment===void 0||a===0)return!0;let x=n,w=n.segment+1,b=0;for(;b>-a/2;){if(w--,w<0)return!1;b-=s[w].dist(x),x=s[w]}b+=s[w].dist(s[w+1]),w++;const k=[];let I=0;for(;bd;)I-=k.shift().angleDelta;if(I>y)return!1;w++,b+=D.dist(L)}return!0}function O2(s){let n=0;for(let a=0;aI){const K=(I-k)/Z,J=gi.number(L.x,U.x,K),le=gi.number(L.y,U.y,K),fe=new ml(J,le,U.angleTo(L),D);return fe._round(),!w||L2(s,fe,b,w,n)?fe:void 0}k+=Z}}function X3(s,n,a,d,y,x,w,b,k){const I=F2(d,x,w),D=B2(d,y),L=D*w,U=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return n-L=0&&Me=0&&Ve=0&&U+I<=D){const et=new ml(Me,Ve,De,K);et._round(),d&&!L2(s,et,x,d,y)||Z.push(et)}}L+=fe}return b||Z.length||w||(Z=N2(s,L/2,a,d,y,x,w,!0,k)),Z}St("Anchor",ml);const Vc=Oi;function $2(s,n,a,d){const y=[],x=s.image,w=x.pixelRatio,b=x.paddedRect.w-2*Vc,k=x.paddedRect.h-2*Vc;let I={x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};const D=x.stretchX||[[0,b]],L=x.stretchY||[[0,k]],U=(qe,Dt)=>qe+Dt[1]-Dt[0],Z=D.reduce(U,0),K=L.reduce(U,0),J=b-Z,le=k-K;let fe=0,De=Z,be=0,Me=K,Ve=0,et=J,xt=0,Nt=le;if(x.content&&d){const qe=x.content,Dt=qe[2]-qe[0],Mt=qe[3]-qe[1];(x.textFitWidth||x.textFitHeight)&&(I=f2(s)),fe=Em(D,0,qe[0]),be=Em(L,0,qe[1]),De=Em(D,qe[0],qe[2]),Me=Em(L,qe[1],qe[3]),Ve=qe[0]-fe,xt=qe[1]-be,et=Dt-De,Nt=Mt-Me}const yt=I.x1,pt=I.y1,At=I.x2-yt,Tt=I.y2-pt,bt=(qe,Dt,Mt,Zt)=>{const Fr=Cm(qe.stretch-fe,De,At,yt),Or=Im(qe.fixed-Ve,et,qe.stretch,Z),zn=Cm(Dt.stretch-be,Me,Tt,pt),Gs=Im(Dt.fixed-xt,Nt,Dt.stretch,K),Xn=Cm(Mt.stretch-fe,De,At,yt),Rn=Im(Mt.fixed-Ve,et,Mt.stretch,Z),xi=Cm(Zt.stretch-be,Me,Tt,pt),wi=Im(Zt.fixed-xt,Nt,Zt.stretch,K),bi=new A(Fr,zn),mn=new A(Xn,zn),Ln=new A(Xn,xi),oi=new A(Fr,xi),Kn=new A(Or/w,Gs/w),Si=new A(Rn/w,wi/w),Jn=n*Math.PI/180;if(Jn){const xr=Math.sin(Jn),$r=Math.cos(Jn),Zr=[$r,-xr,xr,$r];bi._matMult(Zr),mn._matMult(Zr),oi._matMult(Zr),Ln._matMult(Zr)}const ks=qe.stretch+qe.fixed,Fi=Dt.stretch+Dt.fixed;return{tl:bi,tr:mn,bl:oi,br:Ln,tex:{x:x.paddedRect.x+Vc+ks,y:x.paddedRect.y+Vc+Fi,w:Mt.stretch+Mt.fixed-ks,h:Zt.stretch+Zt.fixed-Fi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Kn,pixelOffsetBR:Si,minFontScaleX:et/w/At,minFontScaleY:Nt/w/Tt,isSDF:a}};if(d&&(x.stretchX||x.stretchY)){const qe=U2(D,J,Z),Dt=U2(L,le,K);for(let Mt=0;Mt0&&(J=Math.max(10,J),this.circleDiameter=J)}else{const U=!((L=w.image)===null||L===void 0)&&L.content&&(w.image.textFitWidth||w.image.textFitHeight)?f2(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};U.y1=U.y1*b-k[0],U.y2=U.y2*b+k[2],U.x1=U.x1*b-k[3],U.x2=U.x2*b+k[1];const Z=w.collisionPadding;if(Z&&(U.x1-=Z[0]*b,U.y1-=Z[1]*b,U.x2+=Z[2]*b,U.y2+=Z[3]*b),D){const K=new A(U.x1,U.y1),J=new A(U.x2,U.y1),le=new A(U.x1,U.y2),fe=new A(U.x2,U.y2),De=D*Math.PI/180;K._rotate(De),J._rotate(De),le._rotate(De),fe._rotate(De),U.x1=Math.min(K.x,J.x,le.x,fe.x),U.x2=Math.max(K.x,J.x,le.x,fe.x),U.y1=Math.min(K.y,J.y,le.y,fe.y),U.y2=Math.max(K.y,J.y,le.y,fe.y)}n.emplaceBack(a.x,a.y,U.x1,U.y1,U.x2,U.y2,d,y,x)}this.boxEndIndex=n.length}}class K3{constructor(n=[],a=(d,y)=>dy?1:0){if(this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],a=this.data.pop();return--this.length>0&&(this.data[0]=a,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:a,compare:d}=this,y=a[n];for(;n>0;){const x=n-1>>1,w=a[x];if(d(y,w)>=0)break;a[n]=w,n=x}a[n]=y}_down(n){const{data:a,compare:d}=this,y=this.length>>1,x=a[n];for(;n=0)break;a[n]=a[w],n=w}a[n]=x}}function J3(s,n=1,a=!1){let d=1/0,y=1/0,x=-1/0,w=-1/0;const b=s[0];for(let Z=0;Zx)&&(x=K.x),(!Z||K.y>w)&&(w=K.y)}const k=Math.min(x-d,w-y);let I=k/2;const D=new K3([],Q3);if(k===0)return new A(d,y);for(let Z=d;ZL.d||!L.d)&&(L=Z,a&&console.log("found best %d after %d probes",Math.round(1e4*Z.d)/1e4,U)),Z.max-L.d<=n||(I=Z.h/2,D.push(new Hc(Z.p.x-I,Z.p.y-I,I,s)),D.push(new Hc(Z.p.x+I,Z.p.y-I,I,s)),D.push(new Hc(Z.p.x-I,Z.p.y+I,I,s)),D.push(new Hc(Z.p.x+I,Z.p.y+I,I,s)),U+=4)}return a&&(console.log(`num probes: ${U}`),console.log(`best distance: ${L.d}`)),L.p}function Q3(s,n){return n.max-s.max}function Hc(s,n,a,d){this.p=new A(s,n),this.h=a,this.d=function(y,x){let w=!1,b=1/0;for(let k=0;ky.y!=K.y>y.y&&y.x<(K.x-Z.x)*(y.y-Z.y)/(K.y-Z.y)+Z.x&&(w=!w),b=Math.min(b,kb(y,Z,K))}}return(w?1:-1)*Math.sqrt(b)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}var Yn;g.aq=void 0,(Yn=g.aq||(g.aq={}))[Yn.center=1]="center",Yn[Yn.left=2]="left",Yn[Yn.right=3]="right",Yn[Yn.top=4]="top",Yn[Yn.bottom=5]="bottom",Yn[Yn["top-left"]=6]="top-left",Yn[Yn["top-right"]=7]="top-right",Yn[Yn["bottom-left"]=8]="bottom-left",Yn[Yn["bottom-right"]=9]="bottom-right";const gl=7,z0=Number.POSITIVE_INFINITY;function j2(s,n){return n[1]!==z0?function(a,d,y){let x=0,w=0;switch(d=Math.abs(d),y=Math.abs(y),a){case"top-right":case"top-left":case"top":w=y-gl;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+gl}switch(a){case"top-right":case"bottom-right":case"right":x=-d;break;case"top-left":case"bottom-left":case"left":x=d}return[x,w]}(s,n[0],n[1]):function(a,d){let y=0,x=0;d<0&&(d=0);const w=d/Math.SQRT2;switch(a){case"top-right":case"top-left":x=w-gl;break;case"bottom-right":case"bottom-left":x=-w+gl;break;case"bottom":x=-d+gl;break;case"top":x=d-gl}switch(a){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=d;break;case"right":y=-d}return[y,x]}(s,n[0])}function V2(s,n,a){var d;const y=s.layout,x=(d=y.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(n,{},a);if(x){const b=x.values,k=[];for(let I=0;IU*Pn);D.startsWith("top")?L[1]-=gl:D.startsWith("bottom")&&(L[1]+=gl),k[I+1]=L}return new Xi(k)}const w=y.get("text-variable-anchor");if(w){let b;b=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(n,{},a)*Pn,z0]:y.get("text-offset").evaluate(n,{},a).map(I=>I*Pn);const k=[];for(const I of w)k.push(I,j2(I,b));return new Xi(k)}return null}function R0(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eD(s,n,a,d,y,x,w,b,k,I,D){let L=x.textMaxSize.evaluate(n,{});L===void 0&&(L=w);const U=s.layers[0].layout,Z=U.get("icon-offset").evaluate(n,{},D),K=W2(a.horizontal),J=w/24,le=s.tilePixelRatio*J,fe=s.tilePixelRatio*L/24,De=s.tilePixelRatio*b,be=s.tilePixelRatio*U.get("symbol-spacing"),Me=U.get("text-padding")*s.tilePixelRatio,Ve=function(qe,Dt,Mt,Zt=1){const Fr=qe.get("icon-padding").evaluate(Dt,{},Mt),Or=Fr&&Fr.values;return[Or[0]*Zt,Or[1]*Zt,Or[2]*Zt,Or[3]*Zt]}(U,n,D,s.tilePixelRatio),et=U.get("text-max-angle")/180*Math.PI,xt=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Nt=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",yt=U.get("symbol-placement"),pt=be/2,At=U.get("icon-text-fit");let Tt;d&&At!=="none"&&(s.allowVerticalPlacement&&a.vertical&&(Tt=p2(d,a.vertical,At,U.get("icon-text-fit-padding"),Z,J)),K&&(d=p2(d,K,At,U.get("icon-text-fit-padding"),Z,J)));const bt=(qe,Dt)=>{Dt.x<0||Dt.x>=Cn||Dt.y<0||Dt.y>=Cn||function(Mt,Zt,Fr,Or,zn,Gs,Xn,Rn,xi,wi,bi,mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr,$r,Zr,ns,nn,Wc){const Ro=Mt.addToLineVertexArray(Zt,Fr);let Lo,Zs,Ts,$n,da=0,tf=0,Y2=0,X2=0,j0=-1,V0=-1;const fa={};let K2=Ac("");if(Mt.allowVerticalPlacement&&Or.vertical){const ai=Rn.layout.get("text-rotate").evaluate($r,{},nn)+90;Ts=new Pm(xi,Zt,wi,bi,mn,Or.vertical,Ln,oi,Kn,ai),Xn&&($n=new Pm(xi,Zt,wi,bi,mn,Xn,Jn,ks,Kn,ai))}if(zn){const ai=Rn.layout.get("icon-rotate").evaluate($r,{}),Es=Rn.layout.get("icon-text-fit")!=="none",yu=$2(zn,ai,ns,Es),ho=Xn?$2(Xn,ai,ns,Es):void 0;Zs=new Pm(xi,Zt,wi,bi,mn,zn,Jn,ks,!1,ai),da=4*yu.length;const _u=Mt.iconSizeData;let Oo=null;_u.kind==="source"?(Oo=[zo*Rn.layout.get("icon-size").evaluate($r,{})],Oo[0]>fl&&Ue(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)):_u.kind==="composite"&&(Oo=[zo*Zr.compositeIconSizes[0].evaluate($r,{},nn),zo*Zr.compositeIconSizes[1].evaluate($r,{},nn)],(Oo[0]>fl||Oo[1]>fl)&&Ue(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,yu,Oo,xr,Fi,$r,g.ah.none,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),j0=Mt.icon.placedSymbolArray.length-1,ho&&(tf=4*ho.length,Mt.addSymbols(Mt.icon,ho,Oo,xr,Fi,$r,g.ah.vertical,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),V0=Mt.icon.placedSymbolArray.length-1)}const J2=Object.keys(Or.horizontal);for(const ai of J2){const Es=Or.horizontal[ai];if(!Lo){K2=Ac(Es.text);const ho=Rn.layout.get("text-rotate").evaluate($r,{},nn);Lo=new Pm(xi,Zt,wi,bi,mn,Es,Ln,oi,Kn,ho)}const yu=Es.positionedLines.length===1;if(Y2+=H2(Mt,Zt,Es,Gs,Rn,Kn,$r,Si,Ro,Or.vertical?g.ah.horizontal:g.ah.horizontalOnly,yu?J2:[ai],fa,j0,Zr,nn),yu)break}Or.vertical&&(X2+=H2(Mt,Zt,Or.vertical,Gs,Rn,Kn,$r,Si,Ro,g.ah.vertical,["vertical"],fa,V0,Zr,nn));const nD=Lo?Lo.boxStartIndex:Mt.collisionBoxArray.length,iD=Lo?Lo.boxEndIndex:Mt.collisionBoxArray.length,sD=Ts?Ts.boxStartIndex:Mt.collisionBoxArray.length,oD=Ts?Ts.boxEndIndex:Mt.collisionBoxArray.length,aD=Zs?Zs.boxStartIndex:Mt.collisionBoxArray.length,lD=Zs?Zs.boxEndIndex:Mt.collisionBoxArray.length,uD=$n?$n.boxStartIndex:Mt.collisionBoxArray.length,cD=$n?$n.boxEndIndex:Mt.collisionBoxArray.length;let co=-1;const Am=(ai,Es)=>ai&&ai.circleDiameter?Math.max(ai.circleDiameter,Es):Es;co=Am(Lo,co),co=Am(Ts,co),co=Am(Zs,co),co=Am($n,co);const Q2=co>-1?1:0;Q2&&(co*=Wc/Pn),Mt.glyphOffsetArray.length>=jc.MAX_GLYPHS&&Ue("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$r.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,$r.sortKey);const hD=V2(Rn,$r,nn),[dD,fD]=function(ai,Es){const yu=ai.length,ho=Es==null?void 0:Es.values;if((ho==null?void 0:ho.length)>0)for(let _u=0;_u=0?fa.right:-1,fa.center>=0?fa.center:-1,fa.left>=0?fa.left:-1,fa.vertical||-1,j0,V0,K2,nD,iD,sD,oD,aD,lD,uD,cD,wi,Y2,X2,da,tf,Q2,0,Ln,co,dD,fD)}(s,Dt,qe,a,d,y,Tt,s.layers[0],s.collisionBoxArray,n.index,n.sourceLayerIndex,s.index,le,[Me,Me,Me,Me],xt,k,De,Ve,Nt,Z,n,x,I,D,w)};if(yt==="line")for(const qe of R2(n.geometry,0,0,Cn,Cn)){const Dt=X3(qe,be,et,a.vertical||K,d,24,fe,s.overscaling,Cn);for(const Mt of Dt)K&&tD(s,K.text,pt,Mt)||bt(qe,Mt)}else if(yt==="line-center"){for(const qe of n.geometry)if(qe.length>1){const Dt=Y3(qe,et,a.vertical||K,d,24,fe);Dt&&bt(qe,Dt)}}else if(n.type==="Polygon")for(const qe of ac(n.geometry,0)){const Dt=J3(qe,16);bt(qe[0],new ml(Dt.x,Dt.y,0))}else if(n.type==="LineString")for(const qe of n.geometry)bt(qe,new ml(qe[0].x,qe[0].y,0));else if(n.type==="Point")for(const qe of n.geometry)for(const Dt of qe)bt([Dt],new ml(Dt.x,Dt.y,0))}function H2(s,n,a,d,y,x,w,b,k,I,D,L,U,Z,K){const J=function(De,be,Me,Ve,et,xt,Nt,yt){const pt=Ve.layout.get("text-rotate").evaluate(xt,{})*Math.PI/180,At=[];for(const Tt of be.positionedLines)for(const bt of Tt.positionedGlyphs){if(!bt.rect)continue;const qe=bt.rect||{};let Dt=o2+1,Mt=!0,Zt=1,Fr=0;const Or=(et||yt)&&bt.vertical,zn=bt.metrics.advance*bt.scale/2;if(yt&&be.verticalizable&&(Fr=Tt.lineOffset/2-(bt.imageName?-(Pn-bt.metrics.width*bt.scale)/2:(bt.scale-1)*Pn)),bt.imageName){const xr=Nt[bt.imageName];Mt=xr.sdf,Zt=xr.pixelRatio,Dt=Oi/Zt}const Gs=et?[bt.x+zn,bt.y]:[0,0];let Xn=et?[0,0]:[bt.x+zn+Me[0],bt.y+Me[1]-Fr],Rn=[0,0];Or&&(Rn=Xn,Xn=[0,0]);const xi=bt.metrics.isDoubleResolution?2:1,wi=(bt.metrics.left-Dt)*bt.scale-zn+Xn[0],bi=(-bt.metrics.top-Dt)*bt.scale+Xn[1],mn=wi+qe.w/xi*bt.scale/Zt,Ln=bi+qe.h/xi*bt.scale/Zt,oi=new A(wi,bi),Kn=new A(mn,bi),Si=new A(wi,Ln),Jn=new A(mn,Ln);if(Or){const xr=new A(-zn,zn-qd),$r=-Math.PI/2,Zr=Pn/2-zn,ns=new A(5-qd-Zr,-(bt.imageName?Zr:0)),nn=new A(...Rn);oi._rotateAround($r,xr)._add(ns)._add(nn),Kn._rotateAround($r,xr)._add(ns)._add(nn),Si._rotateAround($r,xr)._add(ns)._add(nn),Jn._rotateAround($r,xr)._add(ns)._add(nn)}if(pt){const xr=Math.sin(pt),$r=Math.cos(pt),Zr=[$r,-xr,xr,$r];oi._matMult(Zr),Kn._matMult(Zr),Si._matMult(Zr),Jn._matMult(Zr)}const ks=new A(0,0),Fi=new A(0,0);At.push({tl:oi,tr:Kn,bl:Si,br:Jn,tex:qe,writingMode:be.writingMode,glyphOffset:Gs,sectionIndex:bt.sectionIndex,isSDF:Mt,pixelOffsetTL:ks,pixelOffsetBR:Fi,minFontScaleX:0,minFontScaleY:0})}return At}(0,a,b,y,x,w,d,s.allowVerticalPlacement),le=s.textSizeData;let fe=null;le.kind==="source"?(fe=[zo*y.layout.get("text-size").evaluate(w,{})],fe[0]>fl&&Ue(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)):le.kind==="composite"&&(fe=[zo*Z.compositeTextSizes[0].evaluate(w,{},K),zo*Z.compositeTextSizes[1].evaluate(w,{},K)],(fe[0]>fl||fe[1]>fl)&&Ue(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)),s.addSymbols(s.text,J,fe,b,x,w,I,n,k.lineStartIndex,k.lineLength,U,K);for(const De of D)L[De]=s.text.placedSymbolArray.length-1;return 4*J.length}function W2(s){for(const n in s)return s[n];return null}function tD(s,n,a,d){const y=s.compareText;if(n in y){const x=y[n];for(let w=x.length-1;w>=0;w--)if(d.dist(x[w])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const x=G2[15&d];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new L0(b,w,x,n)}constructor(n,a=64,d=Float64Array,y){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=d,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const x=G2.indexOf(this.ArrayType),w=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,k=(8-b%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${d}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+w+b+k),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=n)}add(n,a){const d=this._pos>>1;return this.ids[d]=d,this.coords[this._pos++]=n,this.coords[this._pos++]=a,d}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return O0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,a,d,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:b}=this,k=[0,x.length-1,0],I=[];for(;k.length;){const D=k.pop()||0,L=k.pop()||0,U=k.pop()||0;if(L-U<=b){for(let le=U;le<=L;le++){const fe=w[2*le],De=w[2*le+1];fe>=n&&fe<=d&&De>=a&&De<=y&&I.push(x[le])}continue}const Z=U+L>>1,K=w[2*Z],J=w[2*Z+1];K>=n&&K<=d&&J>=a&&J<=y&&I.push(x[Z]),(D===0?n<=K:a<=J)&&(k.push(U),k.push(Z-1),k.push(1-D)),(D===0?d>=K:y>=J)&&(k.push(Z+1),k.push(L),k.push(1-D))}return I}within(n,a,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:x,nodeSize:w}=this,b=[0,y.length-1,0],k=[],I=d*d;for(;b.length;){const D=b.pop()||0,L=b.pop()||0,U=b.pop()||0;if(L-U<=w){for(let le=U;le<=L;le++)q2(x[2*le],x[2*le+1],n,a)<=I&&k.push(y[le]);continue}const Z=U+L>>1,K=x[2*Z],J=x[2*Z+1];q2(K,J,n,a)<=I&&k.push(y[Z]),(D===0?n-d<=K:a-d<=J)&&(b.push(U),b.push(Z-1),b.push(1-D)),(D===0?n+d>=K:a+d>=J)&&(b.push(Z+1),b.push(L),b.push(1-D))}return k}}function O0(s,n,a,d,y,x){if(y-d<=a)return;const w=d+y>>1;Z2(s,n,w,d,y,x),O0(s,n,a,d,w-1,1-x),O0(s,n,a,w+1,y,1-x)}function Z2(s,n,a,d,y,x){for(;y>d;){if(y-d>600){const I=y-d+1,D=a-d+1,L=Math.log(I),U=.5*Math.exp(2*L/3),Z=.5*Math.sqrt(L*U*(I-U)/I)*(D-I/2<0?-1:1);Z2(s,n,a,Math.max(d,Math.floor(a-D*U/I+Z)),Math.min(y,Math.floor(a+(I-D)*U/I+Z)),x)}const w=n[2*a+x];let b=d,k=y;for(Qd(s,n,d,a),n[2*y+x]>w&&Qd(s,n,d,y);bw;)k--}n[2*d+x]===w?Qd(s,n,d,k):(k++,Qd(s,n,k,y)),k<=a&&(d=k+1),a<=k&&(y=k-1)}}function Qd(s,n,a,d){F0(s,a,d),F0(n,2*a,2*d),F0(n,2*a+1,2*d+1)}function F0(s,n,a){const d=s[n];s[n]=s[a],s[a]=d}function q2(s,n,a,d){const y=s-a,x=n-d;return y*y+x*x}var B0;g.bg=void 0,(B0=g.bg||(g.bg={})).create="create",B0.load="load",B0.fullLoad="fullLoad";let Mm=null,ef=[];const N0=1e3/60,$0="loadTime",U0="fullLoadTime",rD={mark(s){performance.mark(s)},frame(s){const n=s;Mm!=null&&ef.push(n-Mm),Mm=n},clearMetrics(){Mm=null,ef=[],performance.clearMeasures($0),performance.clearMeasures(U0);for(const s in g.bg)performance.clearMarks(g.bg[s])},getPerformanceMetrics(){performance.measure($0,g.bg.create,g.bg.load),performance.measure(U0,g.bg.create,g.bg.fullLoad);const s=performance.getEntriesByName($0)[0].duration,n=performance.getEntriesByName(U0)[0].duration,a=ef.length,d=1/(ef.reduce((x,w)=>x+w,0)/a/1e3),y=ef.filter(x=>x>N0).reduce((x,w)=>x+(w-N0)/N0,0);return{loadTime:s,fullLoadTime:n,fps:d,percentDroppedFrames:y/(a+y)*100,totalFrames:a}}};g.$=class extends F{},g.A=Oc,g.B=Y_,g.C=function(s){if(vt==null){const n=s.navigator?s.navigator.userAgent:null;vt=!!s.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return vt},g.D=It,g.E=je,g.F=class{constructor(s,n){this.target=s,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Z3(()=>this.process()),this.subscription=function(a,d,y,x){return a.addEventListener(d,y,!1),{unsubscribe:()=>{a.removeEventListener(d,y,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=Re(self)?s:window}registerMessageHandler(s,n){this.messageHandlers[s]=n}sendAsync(s,n){return new Promise((a,d)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:a,reject:d},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const b={id:y,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const x=[],w=Object.assign(Object.assign({},s),{id:y,sourceMapId:this.mapId,origin:location.origin,data:tl(s.data,x)});this.target.postMessage(w,{transfer:x})})}receive(s){const n=s.data,a=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!=="resource://android"&&location.origin!=="resource://android"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[a];const d=this.abortControllers[a];return delete this.abortControllers[a],void(d&&d.abort())}if(Re(self)||n.mustQueue)return this.tasks[a]=n,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,n)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),n=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(s,n)}processTask(s,n){return c(this,void 0,void 0,function*(){if(n.type===""){const y=this.resolveRejects[s];return delete this.resolveRejects[s],y?void(n.error?y.reject(rl(n.error)):y.resolve(rl(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=rl(n.data),d=new AbortController;this.abortControllers[s]=d;try{const y=yield this.messageHandlers[n.type](n.sourceMapId,a,d);this.completeTask(s,null,y)}catch(y){this.completeTask(s,y)}})}completeTask(s,n,a){const d=[];delete this.abortControllers[s];const y={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?tl(n):null,data:tl(a,d)};this.target.postMessage(y,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},g.G=Jt,g.H=function(){var s=new Oc(16);return Oc!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},g.I=b0,g.J=function(s,n,a){var d,y,x,w,b,k,I,D,L,U,Z,K,J=a[0],le=a[1],fe=a[2];return n===s?(s[12]=n[0]*J+n[4]*le+n[8]*fe+n[12],s[13]=n[1]*J+n[5]*le+n[9]*fe+n[13],s[14]=n[2]*J+n[6]*le+n[10]*fe+n[14],s[15]=n[3]*J+n[7]*le+n[11]*fe+n[15]):(y=n[1],x=n[2],w=n[3],b=n[4],k=n[5],I=n[6],D=n[7],L=n[8],U=n[9],Z=n[10],K=n[11],s[0]=d=n[0],s[1]=y,s[2]=x,s[3]=w,s[4]=b,s[5]=k,s[6]=I,s[7]=D,s[8]=L,s[9]=U,s[10]=Z,s[11]=K,s[12]=d*J+b*le+L*fe+n[12],s[13]=y*J+k*le+U*fe+n[13],s[14]=x*J+I*le+Z*fe+n[14],s[15]=w*J+D*le+K*fe+n[15]),s},g.K=function(s,n,a){var d=a[0],y=a[1],x=a[2];return s[0]=n[0]*d,s[1]=n[1]*d,s[2]=n[2]*d,s[3]=n[3]*d,s[4]=n[4]*y,s[5]=n[5]*y,s[6]=n[6]*y,s[7]=n[7]*y,s[8]=n[8]*x,s[9]=n[9]*x,s[10]=n[10]*x,s[11]=n[11]*x,s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15],s},g.L=Ib,g.M=function(s,n){const a={};for(let d=0;d{const n=window.document.createElement("video");return n.muted=!0,new Promise(a=>{n.onloadstart=()=>{a(n)};for(const d of s){const y=window.document.createElement("source");_r(d)||(n.crossOrigin="Anonymous"),y.src=d,n.appendChild(y)}})},g.a4=function(){return Fe++},g.a5=_t,g.a6=jc,g.a7=yd,g.a8=mu,g.a9=M2,g.aA=function(s){if(s.type==="custom")return new G3(s);switch(s.type){case"background":return new V3(s);case"circle":return new MA(s);case"fill":return new ZA(s);case"fill-extrusion":return new l3(s);case"heatmap":return new DA(s);case"hillshade":return new RA(s);case"line":return new g3(s);case"raster":return new W3(s);case"symbol":return new Tm(s)}},g.aB=it,g.aC=function(s,n){if(!s)return[{command:"setStyle",args:[n]}];let a=[];try{if(!Te(s.version,n.version))return[{command:"setStyle",args:[n]}];Te(s.center,n.center)||a.push({command:"setCenter",args:[n.center]}),Te(s.zoom,n.zoom)||a.push({command:"setZoom",args:[n.zoom]}),Te(s.bearing,n.bearing)||a.push({command:"setBearing",args:[n.bearing]}),Te(s.pitch,n.pitch)||a.push({command:"setPitch",args:[n.pitch]}),Te(s.sprite,n.sprite)||a.push({command:"setSprite",args:[n.sprite]}),Te(s.glyphs,n.glyphs)||a.push({command:"setGlyphs",args:[n.glyphs]}),Te(s.transition,n.transition)||a.push({command:"setTransition",args:[n.transition]}),Te(s.light,n.light)||a.push({command:"setLight",args:[n.light]}),Te(s.terrain,n.terrain)||a.push({command:"setTerrain",args:[n.terrain]}),Te(s.sky,n.sky)||a.push({command:"setSky",args:[n.sky]}),Te(s.projection,n.projection)||a.push({command:"setProjection",args:[n.projection]});const d={},y=[];(function(w,b,k,I){let D;for(D in b=b||{},w=w||{})Object.prototype.hasOwnProperty.call(w,D)&&(Object.prototype.hasOwnProperty.call(b,D)||Ne(D,k,I));for(D in b)Object.prototype.hasOwnProperty.call(b,D)&&(Object.prototype.hasOwnProperty.call(w,D)?Te(w[D],b[D])||(w[D].type==="geojson"&&b[D].type==="geojson"&&kt(w,b,D)?Ge(k,{command:"setGeoJSONSourceData",args:[D,b[D].data]}):ot(D,b,k,I)):tt(D,b,k))})(s.sources,n.sources,y,d);const x=[];s.layers&&s.layers.forEach(w=>{"source"in w&&d[w.source]?a.push({command:"removeLayer",args:[w.id]}):x.push(w)}),a=a.concat(y),function(w,b,k){b=b||[];const I=(w=w||[]).map(Bt),D=b.map(Bt),L=w.reduce(Tr,{}),U=b.reduce(Tr,{}),Z=I.slice(),K=Object.create(null);let J,le,fe,De,be;for(let Me=0,Ve=0;Me@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,d,y,x)=>{const w=y||x;return n[d]=!w||w.toLowerCase(),""}),n["max-age"]){const a=parseInt(n["max-age"],10);isNaN(a)?delete n["max-age"]:n["max-age"]=a}return n},g.ab=function(s,n){const a=[];for(const d in s)d in n||a.push(d);return a},g.ac=oe,g.ad=function(s,n,a){var d=Math.sin(a),y=Math.cos(a),x=n[0],w=n[1],b=n[2],k=n[3],I=n[4],D=n[5],L=n[6],U=n[7];return n!==s&&(s[8]=n[8],s[9]=n[9],s[10]=n[10],s[11]=n[11],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=x*y+I*d,s[1]=w*y+D*d,s[2]=b*y+L*d,s[3]=k*y+U*d,s[4]=I*y-x*d,s[5]=D*y-w*d,s[6]=L*y-b*d,s[7]=U*y-k*d,s},g.ae=function(s){var n=new Oc(16);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],n},g.af=gm,g.ag=function(s,n){let a=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:y,minZoom:x,maxZoom:w}=s,b=y?oe(yi.interpolationFactor(y,n,x,w),0,1):0;s.kind==="camera"?d=gi.number(s.minSize,s.maxSize,b):a=b}return{uSizeT:a,uSize:d}},g.ai=function(s,{uSize:n,uSizeT:a},{lowerSize:d,upperSize:y}){return s.kind==="source"?d/zo:s.kind==="composite"?gi.number(d/zo,y/zo,a):n},g.aj=E0,g.ak=function(s,n,a,d){const y=n.y-s.y,x=n.x-s.x,w=d.y-a.y,b=d.x-a.x,k=w*x-b*y;if(k===0)return null;const I=(b*(s.y-a.y)-w*(s.x-a.x))/k;return new A(s.x+I*x,s.y+I*y)},g.al=R2,g.am=bb,g.an=a0,g.ao=function(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return[n,a,d,y]},g.ap=Pn,g.ar=T0,g.as=function(s,n){var a=n[0],d=n[1],y=n[2],x=n[3],w=n[4],b=n[5],k=n[6],I=n[7],D=n[8],L=n[9],U=n[10],Z=n[11],K=n[12],J=n[13],le=n[14],fe=n[15],De=a*b-d*w,be=a*k-y*w,Me=a*I-x*w,Ve=d*k-y*b,et=d*I-x*b,xt=y*I-x*k,Nt=D*J-L*K,yt=D*le-U*K,pt=D*fe-Z*K,At=L*le-U*J,Tt=L*fe-Z*J,bt=U*fe-Z*le,qe=De*bt-be*Tt+Me*At+Ve*pt-et*yt+xt*Nt;return qe?(s[0]=(b*bt-k*Tt+I*At)*(qe=1/qe),s[1]=(y*Tt-d*bt-x*At)*qe,s[2]=(J*xt-le*et+fe*Ve)*qe,s[3]=(U*et-L*xt-Z*Ve)*qe,s[4]=(k*pt-w*bt-I*yt)*qe,s[5]=(a*bt-y*pt+x*yt)*qe,s[6]=(le*Me-K*xt-fe*be)*qe,s[7]=(D*xt-U*Me+Z*be)*qe,s[8]=(w*Tt-b*pt+I*Nt)*qe,s[9]=(d*pt-a*Tt-x*Nt)*qe,s[10]=(K*et-J*Me+fe*De)*qe,s[11]=(L*Me-D*et-Z*De)*qe,s[12]=(b*yt-w*At-k*Nt)*qe,s[13]=(a*At-d*yt+y*Nt)*qe,s[14]=(J*be-K*Ve-le*De)*qe,s[15]=(D*Ve-L*be+U*De)*qe,s):null},g.at=R0,g.au=k0,g.av=L0,g.aw=function(){const s={},n=ie.$version;for(const a in ie.$root){const d=ie.$root[a];if(d.required){let y=null;y=a==="version"?n:d.type==="array"?[]:{},y!=null&&(s[a]=y)}}return s},g.ax=Ad,g.ay=Vt,g.az=function(s){s=s.slice();const n=Object.create(null);for(let a=0;a25||d<0||d>=1||a<0||a>=1)},g.bc=function(s,n){return s[0]=n[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=n[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},g.bd=class extends z{},g.be=M0,g.bf=rD,g.bh=er,g.bi=function(s,n){nt.REGISTERED_PROTOCOLS[s]=n},g.bj=function(s){delete nt.REGISTERED_PROTOCOLS[s]},g.bk=function(s,n){const a={};for(let y=0;ybt*Pn)}let yt=w?"center":a.get("text-justify").evaluate(I,{},s.canonical);const pt=a.get("symbol-placement")==="point"?a.get("text-max-width").evaluate(I,{},s.canonical)*Pn:1/0,At=()=>{s.bucket.allowVerticalPlacement&&Dd(Me)&&(K.vertical=bm(J,s.glyphMap,s.glyphPositions,s.imagePositions,D,pt,x,xt,"left",et,fe,g.ah.vertical,!0,U,L))};if(!w&&Nt){const Tt=new Set;if(yt==="auto")for(let qe=0;qec(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(n)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),g.e=ge,g.f=s=>new Promise((n,a)=>{const d=new Image;d.onload=()=>{n(d),URL.revokeObjectURL(d.src),d.onload=null,window.requestAnimationFrame(()=>{d.src=Be})},d.onerror=()=>a(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const y=new Blob([new Uint8Array(s)],{type:"image/png"});d.src=s.byteLength?URL.createObjectURL(y):Be}),g.g=rt,g.h=(s,n)=>Yt(ge(s,{type:"json"}),n),g.i=Re,g.j=V,g.k=Xr,g.l=(s,n)=>Yt(ge(s,{type:"arrayBuffer"}),n),g.m=Yt,g.n=function(s){return new x0(s).readFields(A3,[])},g.o=Ud,g.p=a2,g.q=v,g.r=q_,g.s=_r,g.t=Pd,g.u=la,g.v=ie,g.w=Ue,g.x=function([s,n,a]){return n+=90,n*=Math.PI/180,a*=Math.PI/180,{x:s*Math.cos(n)*Math.sin(a),y:s*Math.sin(n)*Math.sin(a),z:s*Math.cos(a)}},g.y=gi,g.z=Vr}),h("worker",["./shared"],function(g){class c{constructor(G){this.keyCache={},G&&this.replace(G)}replace(G){this._layerConfigs={},this._layers={},this.update(G,[])}update(G,W){for(const ue of G){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=g.aA(ue);Se._featureFilter=g.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of W)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const ee=g.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of ee){const Se=ue.map($e=>this._layers[$e.id]),Ie=Se[0];if(Ie.visibility==="none")continue;const Ae=Ie.source||"";let _e=this.familiesBySource[Ae];_e||(_e=this.familiesBySource[Ae]={});const He=Ie.sourceLayer||"_geojsonTileLayer";let Je=_e[He];Je||(Je=_e[He]=[]),Je.push(Se)}}}class T{constructor(G){const W={},ee=[];for(const Ae in G){const _e=G[Ae],He=W[Ae]={};for(const Je in _e){const $e=_e[+Je];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const ut={x:0,y:0,w:$e.bitmap.width+2,h:$e.bitmap.height+2};ee.push(ut),He[Je]={rect:ut,metrics:$e.metrics}}}const{w:ue,h:Se}=g.p(ee),Ie=new g.o({width:ue||1,height:Se||1});for(const Ae in G){const _e=G[Ae];for(const He in _e){const Je=_e[+He];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const $e=W[Ae][He].rect;g.o.copy(Je.bitmap,Ie,{x:0,y:0},{x:$e.x+1,y:$e.y+1},Je.bitmap)}}this.image=Ie,this.positions=W}}g.bl("GlyphAtlas",T);class P{constructor(G){this.tileID=new g.S(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[]}parse(G,W,ee,ue){return g._(this,void 0,void 0,function*(){this.status="parsing",this.data=G,this.collisionBoxArray=new g.a5;const Se=new g.bm(Object.keys(G.layers).sort()),Ie=new g.bn(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Ae={},_e={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},He=W.familiesBySource[this.source];for(const rr in He){const Mr=G.layers[rr];if(!Mr)continue;Mr.version===1&&g.w(`Vector tile source "${this.source}" layer "${rr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Yr=Se.encode(rr),Dn=[];for(let Bn=0;Bn=ni.maxzoom||ni.visibility!=="none"&&(R(Bn,this.zoom,ee),(Ae[ni.id]=ni.createBucket({index:Ie.bucketLayerIDs.length,layers:Bn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Yr,sourceID:this.source})).populate(Dn,_e,this.tileID.canonical),Ie.bucketLayerIDs.push(Bn.map(Fa=>Fa.id)))}}const Je=g.aF(_e.glyphDependencies,rr=>Object.keys(rr).map(Number));this.inFlightDependencies.forEach(rr=>rr==null?void 0:rr.abort()),this.inFlightDependencies=[];let $e=Promise.resolve({});if(Object.keys(Je).length){const rr=new AbortController;this.inFlightDependencies.push(rr),$e=ue.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},rr)}const ut=Object.keys(_e.iconDependencies);let Rt=Promise.resolve({});if(ut.length){const rr=new AbortController;this.inFlightDependencies.push(rr),Rt=ue.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"icons"}},rr)}const Ot=Object.keys(_e.patternDependencies);let mr=Promise.resolve({});if(Ot.length){const rr=new AbortController;this.inFlightDependencies.push(rr),mr=ue.sendAsync({type:"GI",data:{icons:Ot,source:this.source,tileID:this.tileID,type:"patterns"}},rr)}const[Qt,gr,or]=yield Promise.all([$e,Rt,mr]),Tn=new T(Qt),rn=new g.bo(gr,or);for(const rr in Ae){const Mr=Ae[rr];Mr instanceof g.a6?(R(Mr.layers,this.zoom,ee),g.bp({bucket:Mr,glyphMap:Qt,glyphPositions:Tn.positions,imageMap:gr,imagePositions:rn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Mr.hasPattern&&(Mr instanceof g.bq||Mr instanceof g.br||Mr instanceof g.bs)&&(R(Mr.layers,this.zoom,ee),Mr.addFeatures(_e,this.tileID.canonical,rn.patternPositions))}return this.status="done",{buckets:Object.values(Ae).filter(rr=>!rr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tn.image,imageAtlas:rn,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?gr:null,glyphPositions:this.returnDependencies?Tn.positions:null}})}}function R(he,G,W){const ee=new g.z(G);for(const ue of he)ue.recalculate(ee,W)}class A{constructor(G,W,ee){this.actor=G,this.layerIndex=W,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(G,W){return g._(this,void 0,void 0,function*(){const ee=yield g.l(G.request,W);try{return{vectorTile:new g.bt.VectorTile(new g.bu(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch(ue){const Se=new Uint8Array(ee.data);let Ie=`Unable to parse the tile at ${G.request.url}, `;throw Ie+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.message}`,new Error(Ie)}})}loadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid,ee=!!(G&&G.request&&G.request.collectResourceTiming)&&new g.bv(G.request),ue=new P(G);this.loading[W]=ue;const Se=new AbortController;ue.abort=Se;try{const Ie=yield this.loadVectorTile(G,Se);if(delete this.loading[W],!Ie)return null;const Ae=Ie.rawData,_e={};Ie.expires&&(_e.expires=Ie.expires),Ie.cacheControl&&(_e.cacheControl=Ie.cacheControl);const He={};if(ee){const $e=ee.finish();$e&&(He.resourceTiming=JSON.parse(JSON.stringify($e)))}ue.vectorTile=Ie.vectorTile;const Je=ue.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=ue,this.fetching[W]={rawTileData:Ae,cacheControl:_e,resourceTiming:He};try{const $e=yield Je;return g.e({rawTileData:Ae.slice(0)},$e,_e,He)}finally{delete this.fetching[W]}}catch(Ie){throw delete this.loading[W],ue.status="done",this.loaded[W]=ue,Ie}})}reloadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ee=this.loaded[W];if(ee.showCollisionBoxes=G.showCollisionBoxes,ee.status==="parsing"){const ue=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[W]){const{rawTileData:Ie,cacheControl:Ae,resourceTiming:_e}=this.fetching[W];delete this.fetching[W],Se=g.e({rawTileData:Ie.slice(0)},ue,Ae,_e)}else Se=ue;return Se}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(G){return g._(this,void 0,void 0,function*(){const W=this.loading,ee=G.uid;W&&W[ee]&&W[ee].abort&&(W[ee].abort.abort(),delete W[ee])})}removeTile(G){return g._(this,void 0,void 0,function*(){this.loaded&&this.loaded[G.uid]&&delete this.loaded[G.uid]})}}class M{constructor(){this.loaded={}}loadTile(G){return g._(this,void 0,void 0,function*(){const{uid:W,encoding:ee,rawImageData:ue,redFactor:Se,greenFactor:Ie,blueFactor:Ae,baseShift:_e}=G,He=ue.width+2,Je=ue.height+2,$e=g.b(ue)?new g.R({width:He,height:Je},yield g.bw(ue,-1,-1,He,Je)):ue,ut=new g.bx(W,$e,ee,Se,Ie,Ae,_e);return this.loaded=this.loaded||{},this.loaded[W]=ut,ut})}removeTile(G){const W=this.loaded,ee=G.uid;W&&W[ee]&&delete W[ee]}}function N(he,G){if(he.length!==0){Y(he[0],G);for(var W=1;W=Math.abs(Ae)?W-_e+Ae:Ae-_e+W,W=_e}W+ee>=0!=!!G&&he.reverse()}var j=g.by(function he(G,W){var ee,ue=G&&G.type;if(ue==="FeatureCollection")for(ee=0;ee>31}function Re(he,G){for(var W=he.loadGeometry(),ee=he.type,ue=0,Se=0,Ie=W.length,Ae=0;Aehe},Le=Math.fround||(Xe=new Float32Array(1),he=>(Xe[0]=+he,Xe[0]));var Xe;const xe=3,Ee=5,mt=6;class nt{constructor(G){this.options=Object.assign(Object.create(Be),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:W,minZoom:ee,maxZoom:ue}=this.options;W&&console.time("total time");const Se=`prepare ${G.length} points`;W&&console.time(Se),this.points=G;const Ie=[];for(let _e=0;_e=ee;_e--){const He=+Date.now();Ae=this.trees[_e]=this._createTree(this._cluster(Ae,_e)),W&&console.log("z%d: %d clusters in %dms",_e,Ae.numItems,+Date.now()-He)}return W&&console.timeEnd("total time"),this}getClusters(G,W){let ee=((G[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,G[1]));let Se=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)ee=-180,Se=180;else if(ee>Se){const $e=this.getClusters([ee,ue,180,Ie],W),ut=this.getClusters([-180,ue,Se,Ie],W);return $e.concat(ut)}const Ae=this.trees[this._limitZoom(W)],_e=Ae.range(er(ee),Vt(Ie),er(Se),Vt(ue)),He=Ae.data,Je=[];for(const $e of _e){const ut=this.stride*$e;Je.push(He[ut+Ee]>1?rt(He,ut,this.clusterProps):this.points[He[ut+xe]])}return Je}getChildren(G){const W=this._getOriginId(G),ee=this._getOriginZoom(G),ue="No cluster with the specified id.",Se=this.trees[ee];if(!Se)throw new Error(ue);const Ie=Se.data;if(W*this.stride>=Ie.length)throw new Error(ue);const Ae=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),_e=Se.within(Ie[W*this.stride],Ie[W*this.stride+1],Ae),He=[];for(const Je of _e){const $e=Je*this.stride;Ie[$e+4]===G&&He.push(Ie[$e+Ee]>1?rt(Ie,$e,this.clusterProps):this.points[Ie[$e+xe]])}if(He.length===0)throw new Error(ue);return He}getLeaves(G,W,ee){const ue=[];return this._appendLeaves(ue,G,W=W||10,ee=ee||0,0),ue}getTile(G,W,ee){const ue=this.trees[this._limitZoom(G)],Se=Math.pow(2,G),{extent:Ie,radius:Ae}=this.options,_e=Ae/Ie,He=(ee-_e)/Se,Je=(ee+1+_e)/Se,$e={features:[]};return this._addTileFeatures(ue.range((W-_e)/Se,He,(W+1+_e)/Se,Je),ue.data,W,ee,Se,$e),W===0&&this._addTileFeatures(ue.range(1-_e/Se,He,1,Je),ue.data,Se,ee,Se,$e),W===Se-1&&this._addTileFeatures(ue.range(0,He,_e/Se,Je),ue.data,-1,ee,Se,$e),$e.features.length?$e:null}getClusterExpansionZoom(G){let W=this._getOriginZoom(G)-1;for(;W<=this.options.maxZoom;){const ee=this.getChildren(G);if(W++,ee.length!==1)break;G=ee[0].properties.cluster_id}return W}_appendLeaves(G,W,ee,ue,Se){const Ie=this.getChildren(W);for(const Ae of Ie){const _e=Ae.properties;if(_e&&_e.cluster?Se+_e.point_count<=ue?Se+=_e.point_count:Se=this._appendLeaves(G,_e.cluster_id,ee,ue,Se):Se1;let Je,$e,ut;if(He)Je=Jt(W,_e,this.clusterProps),$e=W[_e],ut=W[_e+1];else{const mr=this.points[W[_e+xe]];Je=mr.properties;const[Qt,gr]=mr.geometry.coordinates;$e=er(Qt),ut=Vt(gr)}const Rt={type:1,geometry:[[Math.round(this.options.extent*($e*Se-ee)),Math.round(this.options.extent*(ut*Se-ue))]],tags:Je};let Ot;Ot=He||this.options.generateId?W[_e+xe]:this.points[W[_e+xe]].id,Ot!==void 0&&(Rt.id=Ot),Ie.features.push(Rt)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,W){const{radius:ee,extent:ue,reduce:Se,minPoints:Ie}=this.options,Ae=ee/(ue*Math.pow(2,W)),_e=G.data,He=[],Je=this.stride;for(let $e=0;$e<_e.length;$e+=Je){if(_e[$e+2]<=W)continue;_e[$e+2]=W;const ut=_e[$e],Rt=_e[$e+1],Ot=G.within(_e[$e],_e[$e+1],Ae),mr=_e[$e+Ee];let Qt=mr;for(const gr of Ot){const or=gr*Je;_e[or+2]>W&&(Qt+=_e[or+Ee])}if(Qt>mr&&Qt>=Ie){let gr,or=ut*mr,Tn=Rt*mr,rn=-1;const rr=(($e/Je|0)<<5)+(W+1)+this.points.length;for(const Mr of Ot){const Yr=Mr*Je;if(_e[Yr+2]<=W)continue;_e[Yr+2]=W;const Dn=_e[Yr+Ee];or+=_e[Yr]*Dn,Tn+=_e[Yr+1]*Dn,_e[Yr+4]=rr,Se&&(gr||(gr=this._map(_e,$e,!0),rn=this.clusterProps.length,this.clusterProps.push(gr)),Se(gr,this._map(_e,Yr)))}_e[$e+4]=rr,He.push(or/Qt,Tn/Qt,1/0,rr,-1,Qt),Se&&He.push(rn)}else{for(let gr=0;gr1)for(const gr of Ot){const or=gr*Je;if(!(_e[or+2]<=W)){_e[or+2]=W;for(let Tn=0;Tn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,W,ee){if(G[W+Ee]>1){const Ie=this.clusterProps[G[W+mt]];return ee?Object.assign({},Ie):Ie}const ue=this.points[G[W+xe]].properties,Se=this.options.map(ue);return ee&&Se===ue?Object.assign({},Se):Se}}function rt(he,G,W){return{type:"Feature",id:he[G+xe],properties:Jt(he,G,W),geometry:{type:"Point",coordinates:[(ee=he[G],360*(ee-.5)),Yt(he[G+1])]}};var ee}function Jt(he,G,W){const ee=he[G+Ee],ue=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,Se=he[G+mt],Ie=Se===-1?{}:Object.assign({},W[Se]);return Object.assign(Ie,{cluster:!0,cluster_id:he[G+xe],point_count:ee,point_count_abbreviated:ue})}function er(he){return he/360+.5}function Vt(he){const G=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return W<0?0:W>1?1:W}function Yt(he){const G=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function _r(he,G,W,ee){let ue=ee;const Se=G+(W-G>>1);let Ie,Ae=W-G;const _e=he[G],He=he[G+1],Je=he[W],$e=he[W+1];for(let ut=G+3;utue)Ie=ut,ue=Rt;else if(Rt===ue){const Ot=Math.abs(ut-Se);Otee&&(Ie-G>3&&_r(he,G,Ie,ee),he[Ie+2]=ue,W-Ie>3&&_r(he,Ie,W,ee))}function fr(he,G,W,ee,ue,Se){let Ie=ue-W,Ae=Se-ee;if(Ie!==0||Ae!==0){const _e=((he-W)*Ie+(G-ee)*Ae)/(Ie*Ie+Ae*Ae);_e>1?(W=ue,ee=Se):_e>0&&(W+=Ie*_e,ee+=Ae*_e)}return Ie=he-W,Ae=G-ee,Ie*Ie+Ae*Ae}function br(he,G,W,ee){const ue={id:he??null,type:G,geometry:W,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(G==="Point"||G==="MultiPoint"||G==="LineString")Xr(ue,W);else if(G==="Polygon")Xr(ue,W[0]);else if(G==="MultiLineString")for(const Se of W)Xr(ue,Se);else if(G==="MultiPolygon")for(const Se of W)Xr(ue,Se[0]);return ue}function Xr(he,G){for(let W=0;W0&&(Ie+=ee?(ue*Je-He*Se)/2:Math.sqrt(Math.pow(He-ue,2)+Math.pow(Je-Se,2))),ue=He,Se=Je}const Ae=G.length-3;G[2]=1,_r(G,0,Ae,W),G[Ae+2]=1,G.size=Math.abs(Ie),G.start=0,G.end=G.size}function de(he,G,W,ee){for(let ue=0;ue1?1:W}function Ge(he,G,W,ee,ue,Se,Ie,Ae){if(ee/=G,Se>=(W/=G)&&Ie=ee)return null;const _e=[];for(const He of he){const Je=He.geometry;let $e=He.type;const ut=ue===0?He.minX:He.minY,Rt=ue===0?He.maxX:He.maxY;if(ut>=W&&Rt=ee)continue;let Ot=[];if($e==="Point"||$e==="MultiPoint")tt(Je,Ot,W,ee,ue);else if($e==="LineString")Ne(Je,Ot,W,ee,ue,!1,Ae.lineMetrics);else if($e==="MultiLineString")kt(Je,Ot,W,ee,ue,!1);else if($e==="Polygon")kt(Je,Ot,W,ee,ue,!0);else if($e==="MultiPolygon")for(const mr of Je){const Qt=[];kt(mr,Qt,W,ee,ue,!0),Qt.length&&Ot.push(Qt)}if(Ot.length){if(Ae.lineMetrics&&$e==="LineString"){for(const mr of Ot)_e.push(br(He.id,$e,mr,He.tags));continue}$e!=="LineString"&&$e!=="MultiLineString"||(Ot.length===1?($e="LineString",Ot=Ot[0]):$e="MultiLineString"),$e!=="Point"&&$e!=="MultiPoint"||($e=Ot.length===3?"Point":"MultiPoint"),_e.push(br(He.id,$e,Ot,He.tags))}}return _e.length?_e:null}function tt(he,G,W,ee,ue){for(let Se=0;Se=W&&Ie<=ee&&at(G,he[Se],he[Se+1],he[Se+2])}}function Ne(he,G,W,ee,ue,Se,Ie){let Ae=ot(he);const _e=ue===0?Bt:Tr;let He,Je,$e=he.start;for(let Qt=0;QtW&&(Je=_e(Ae,gr,or,rn,rr,W),Ie&&(Ae.start=$e+He*Je)):Mr>ee?Yr=W&&(Je=_e(Ae,gr,or,rn,rr,W),Dn=!0),Yr>ee&&Mr<=ee&&(Je=_e(Ae,gr,or,rn,rr,ee),Dn=!0),!Se&&Dn&&(Ie&&(Ae.end=$e+He*Je),G.push(Ae),Ae=ot(he)),Ie&&($e+=He)}let ut=he.length-3;const Rt=he[ut],Ot=he[ut+1],mr=ue===0?Rt:Ot;mr>=W&&mr<=ee&&at(Ae,Rt,Ot,he[ut+2]),ut=Ae.length-3,Se&&ut>=3&&(Ae[ut]!==Ae[0]||Ae[ut+1]!==Ae[1])&&at(Ae,Ae[0],Ae[1],Ae[2]),Ae.length&&G.push(Ae)}function ot(he){const G=[];return G.size=he.size,G.start=he.start,G.end=he.end,G}function kt(he,G,W,ee,ue,Se){for(const Ie of he)Ne(Ie,G,W,ee,ue,Se,!1)}function at(he,G,W,ee){he.push(G,W,ee)}function Bt(he,G,W,ee,ue,Se){const Ie=(Se-G)/(ee-G);return at(he,Se,W+(ue-W)*Ie,1),Ie}function Tr(he,G,W,ee,ue,Se){const Ie=(Se-W)/(ue-W);return at(he,G+(ee-G)*Ie,Se,1),Ie}function Ze(he,G){const W=[];for(let ee=0;ee0&&G.size<(ue?Ie:ee))return void(W.numPoints+=G.length/3);const Ae=[];for(let _e=0;_eIe)&&(W.numSimplified++,Ae.push(G[_e],G[_e+1])),W.numPoints++;ue&&function(_e,He){let Je=0;for(let $e=0,ut=_e.length,Rt=ut-2;$e0===He)for(let $e=0,ut=_e.length;$e24)throw new Error("maxZoom should be in the 0-24 range");if(W.promoteId&&W.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=function(Se,Ie){const Ae=[];if(Se.type==="FeatureCollection")for(let _e=0;_e1&&console.time("creation"),Rt=this.tiles[ut]=pi(G,W,ee,ue,He),this.tileCoords.push({z:W,x:ee,y:ue}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W,ee,ue,Rt.numFeatures,Rt.numPoints,Rt.numSimplified),console.timeEnd("creation"));const Dn=`z${W}`;this.stats[Dn]=(this.stats[Dn]||0)+1,this.total++}if(Rt.source=G,Se==null){if(W===He.indexMaxZoom||Rt.numPoints<=He.indexMaxPoints)continue}else{if(W===He.maxZoom||W===Se)continue;if(Se!=null){const Dn=Se-W;if(ee!==Ie>>Dn||ue!==Ae>>Dn)continue}}if(Rt.source=null,G.length===0)continue;Je>1&&console.time("clipping");const Ot=.5*He.buffer/He.extent,mr=.5-Ot,Qt=.5+Ot,gr=1+Ot;let or=null,Tn=null,rn=null,rr=null,Mr=Ge(G,$e,ee-Ot,ee+Qt,0,Rt.minX,Rt.maxX,He),Yr=Ge(G,$e,ee+mr,ee+gr,0,Rt.minX,Rt.maxX,He);G=null,Mr&&(or=Ge(Mr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),Tn=Ge(Mr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Mr=null),Yr&&(rn=Ge(Yr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),rr=Ge(Yr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Yr=null),Je>1&&console.timeEnd("clipping"),_e.push(or||[],W+1,2*ee,2*ue),_e.push(Tn||[],W+1,2*ee,2*ue+1),_e.push(rn||[],W+1,2*ee+1,2*ue),_e.push(rr||[],W+1,2*ee+1,2*ue+1)}}getTile(G,W,ee){G=+G,W=+W,ee=+ee;const ue=this.options,{extent:Se,debug:Ie}=ue;if(G<0||G>24)return null;const Ae=1<1&&console.log("drilling down to z%d-%d-%d",G,W,ee);let He,Je=G,$e=W,ut=ee;for(;!He&&Je>0;)Je--,$e>>=1,ut>>=1,He=this.tiles[mi(Je,$e,ut)];return He&&He.source?(Ie>1&&(console.log("found parent tile z%d-%d-%d",Je,$e,ut),console.time("drilling down")),this.splitTile(He.source,Je,$e,ut,G,W,ee),Ie>1&&console.timeEnd("drilling down"),this.tiles[_e]?_n(this.tiles[_e],Se):null):null}}function mi(he,G,W){return 32*((1<{$e.properties=Rt;const Ot={};for(const mr of ut)Ot[mr]=_e[mr].evaluate(Je,$e);return Ot},Ie.reduce=(Rt,Ot)=>{$e.properties=Ot;for(const mr of ut)Je.accumulated=Rt[mr],Rt[mr]=He[mr].evaluate(Je,$e)},Ie}(G)).load((yield this._pendingData).features):(ue=yield this._pendingData,new Kr(ue,G.geojsonVtOptions)),this.loaded={};const Se={};if(ee){const Ie=ee.finish();Ie&&(Se.resourceTiming={},Se.resourceTiming[G.source]=JSON.parse(JSON.stringify(Ie)))}return Se}catch(Se){if(delete this._pendingRequest,g.bB(Se))return{abandoned:!0};throw Se}var ue})}getData(){return g._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(G){const W=this.loaded;return W&&W[G.uid]?super.reloadTile(G):this.loadTile(G)}loadAndProcessGeoJSON(G,W){return g._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(G,W);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(j(ee,!0),G.filter){const ue=g.bC(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(Ie=>`${Ie.key}: ${Ie.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(Ie=>ue.value.evaluate({zoom:0},Ie))}}return ee})}loadGeoJSON(G,W){return g._(this,void 0,void 0,function*(){const{promoteId:ee}=G;if(G.request){const ue=yield g.h(G.request,W);return this._dataUpdateable=Yi(ue.data,ee)?fs(ue.data,ee):void 0,ue.data}if(typeof G.data=="string")try{const ue=JSON.parse(G.data);return this._dataUpdateable=Yi(ue,ee)?fs(ue,ee):void 0,ue}catch{throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`)}if(!G.dataDiff)throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${G.source}`);return function(ue,Se,Ie){var Ae,_e,He,Je;if(Se.removeAll&&ue.clear(),Se.remove)for(const $e of Se.remove)ue.delete($e);if(Se.add)for(const $e of Se.add){const ut=Xt($e,Ie);ut!=null&&ue.set(ut,$e)}if(Se.update)for(const $e of Se.update){let ut=ue.get($e.id);if(ut==null)continue;const Rt=!$e.removeAllProperties&&(((Ae=$e.removeProperties)===null||Ae===void 0?void 0:Ae.length)>0||((_e=$e.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if(($e.newGeometry||$e.removeAllProperties||Rt)&&(ut=Object.assign({},ut),ue.set($e.id,ut),Rt&&(ut.properties=Object.assign({},ut.properties))),$e.newGeometry&&(ut.geometry=$e.newGeometry),$e.removeAllProperties)ut.properties={};else if(((He=$e.removeProperties)===null||He===void 0?void 0:He.length)>0)for(const Ot of $e.removeProperties)Object.prototype.hasOwnProperty.call(ut.properties,Ot)&&delete ut.properties[Ot];if(((Je=$e.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Ot,value:mr}of $e.addOrUpdateProperties)ut.properties[Ot]=mr}}(this._dataUpdateable,G.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(G){return g._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(G){return this._geoJSONIndex.getClusterExpansionZoom(G.clusterId)}getClusterChildren(G){return this._geoJSONIndex.getChildren(G.clusterId)}getClusterLeaves(G){return this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset)}}class Hn{constructor(G){this.self=G,this.actor=new g.F(G),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,ee)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=ee},this.self.addProtocol=g.bi,this.self.removeProtocol=g.bj,this.self.registerRTLTextPlugin=W=>{if(g.bD.isParsed())throw new Error("RTL text plugin already registered.");g.bD.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,ee)=>this._getDEMWorkerSource(W,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(W,ee)=>g._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(W,ee)=>g._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][ee.type]||!this.workerSources[W][ee.type][ee.source])return;const ue=this.workerSources[W][ee.type][ee.source];delete this.workerSources[W][ee.type][ee.source],ue.removeSource!==void 0&&ue.removeSource(ee)})),this.actor.registerMessageHandler("RM",W=>g._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,ee)=>g._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(W,ee)=>this._syncRTLPluginState(W,ee)),this.actor.registerMessageHandler("IS",(W,ee)=>g._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(W,ee)=>this._setImages(W,ee)),this.actor.registerMessageHandler("UL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(ee)}))}_setImages(G,W){return g._(this,void 0,void 0,function*(){this.availableImages[G]=W;for(const ee in this.workerSources[G]){const ue=this.workerSources[G][ee];for(const Se in ue)ue[Se].availableImages=W}})}_syncRTLPluginState(G,W){return g._(this,void 0,void 0,function*(){if(g.bD.isParsed())return g.bD.getState();if(W.pluginStatus!=="loading")return g.bD.setState(W),W;const ee=W.pluginURL;if(this.self.importScripts(ee),g.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:ee};return g.bD.setState(ue),ue}throw g.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(G){let W=this.availableImages[G];return W||(W=[]),W}_getLayerIndex(G){let W=this.layerIndexes[G];return W||(W=this.layerIndexes[G]=new c),W}_getWorkerSource(G,W,ee){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][W]||(this.workerSources[G][W]={}),!this.workerSources[G][W][ee]){const ue={sendAsync:(Se,Ie)=>(Se.targetMapId=G,this.actor.sendAsync(Se,Ie))};switch(W){case"vector":this.workerSources[G][W][ee]=new A(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;case"geojson":this.workerSources[G][W][ee]=new ps(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;default:this.workerSources[G][W][ee]=new this.externalWorkerSourceTypes[W](ue,this._getLayerIndex(G),this._getAvailableImages(G))}}return this.workerSources[G][W][ee]}_getDEMWorkerSource(G,W){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][W]||(this.demWorkerSources[G][W]=new M),this.demWorkerSources[G][W]}}return g.i(self)&&(self.worker=new Hn(self)),Hn}),h("index",["exports","./shared"],function(g,c){var T="4.7.1";let P,R;const A={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((r,u)=>{const p=requestAnimationFrame(r);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),u(c.c())})}),getImageData(v,r=0){return this.getImageCanvasContext(v).getImageData(-r,-r,v.width+2*r,v.height+2*r)},getImageCanvasContext(v){const r=window.document.createElement("canvas"),u=r.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return r.width=v.width,r.height=v.height,u.drawImage(v,0,0,v.width,v.height),u},resolveURL:v=>(P||(P=document.createElement("a")),P.href=v,P.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class M{static testProp(r){if(!M.docStyle)return r[0];for(let u=0;u{window.removeEventListener("click",M.suppressClickInternal,!0)},0)}static getScale(r){const u=r.getBoundingClientRect();return{x:u.width/r.offsetWidth||1,y:u.height/r.offsetHeight||1,boundingClientRect:u}}static getPoint(r,u,p){const m=u.boundingClientRect;return new c.P((p.clientX-m.left)/u.x-r.clientLeft,(p.clientY-m.top)/u.y-r.clientTop)}static mousePos(r,u){const p=M.getScale(r);return M.getPoint(r,p,u)}static touchPos(r,u){const p=[],m=M.getScale(r);for(let _=0;_{Y&&$(Y),Y=null,O=!0},j.onerror=()=>{te=!0,Y=null},j.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let r,u,p,m;v.resetRequestQueue=()=>{r=[],u=0,p=0,m={}},v.addThrottleControl=C=>{const z=p++;return m[z]=C,z},v.removeThrottleControl=C=>{delete m[C],S()},v.getImage=(C,z,F=!0)=>new Promise((B,X)=>{N.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),r.push({abortController:z,requestParameters:C,supportImageRefresh:F,state:"queued",onError:Q=>{X(Q)},onSuccess:Q=>{B(Q)}}),S()});const _=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:z,supportImageRefresh:F,onError:B,onSuccess:X,abortController:Q}=C,re=F===!1&&!c.i(self)&&!c.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((me,we)=>me&&we==="accept",!0));u++;const ce=re?E(z,Q):c.m(z,Q);try{const me=yield ce;delete C.abortController,C.state="completed",me.data instanceof HTMLImageElement||c.b(me.data)?X(me):me.data&&X({data:yield(pe=me.data,typeof createImageBitmap=="function"?c.d(pe):c.f(pe)),cacheControl:me.cacheControl,expires:me.expires})}catch(me){delete C.abortController,B(me)}finally{u--,S()}var pe}),S=()=>{const C=(()=>{for(const z of Object.keys(m))if(m[z]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=u;z0;z++){const F=r.shift();F.abortController.signal.aborted?z--:_(F)}},E=(C,z)=>new Promise((F,B)=>{const X=new Image,Q=C.url,re=C.credentials;re&&re==="include"?X.crossOrigin="use-credentials":(re&&re==="same-origin"||!c.s(Q))&&(X.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{X.src="",B(c.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,F({data:X})},X.onerror=()=>{X.onerror=X.onload=null,z.signal.aborted||B(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."))},X.src=Q})}(q||(q={})),q.resetRequestQueue();class ne{constructor(r){this._transformRequestFn=r}transformRequest(r,u){return this._transformRequestFn&&this._transformRequestFn(r,u)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function oe(v){var r=new c.A(3);return r[0]=v[0],r[1]=v[1],r[2]=v[2],r}var ke,ge=function(v,r,u){return v[0]=r[0]-u[0],v[1]=r[1]-u[1],v[2]=r[2]-u[2],v};ke=new c.A(3),c.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Fe=function(v){var r=v[0],u=v[1];return r*r+u*u};function Oe(v){const r=[];if(typeof v=="string")r.push({id:"default",url:v});else if(v&&v.length>0){const u=[];for(const{id:p,url:m}of v){const _=`${p}${m}`;u.indexOf(_)===-1&&(u.push(_),r.push({id:p,url:m}))}}return r}function We(v,r,u){const p=v.split("?");return p[0]+=`${r}${u}`,p.join("?")}(function(){var v=new c.A(2);c.A!=Float32Array&&(v[0]=0,v[1]=0)})();class it{constructor(r,u,p,m){this.context=r,this.format=p,this.texture=r.gl.createTexture(),this.update(u,m)}update(r,u,p){const{width:m,height:_}=r,S=!(this.size&&this.size[0]===m&&this.size[1]===_||p),{context:E}=this,{gl:C}=E;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),S)this.size=[m,_],r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,r):C.texImage2D(C.TEXTURE_2D,0,this.format,m,_,0,this.format,C.UNSIGNED_BYTE,r.data);else{const{x:z,y:F}=p||{x:0,y:0};r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texSubImage2D(C.TEXTURE_2D,0,z,F,C.RGBA,C.UNSIGNED_BYTE,r):C.texSubImage2D(C.TEXTURE_2D,0,z,F,m,_,C.RGBA,C.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(r,u,p){const{context:m}=this,{gl:_}=m;_.bindTexture(_.TEXTURE_2D,this.texture),p!==_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=_.LINEAR),r!==this.filter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,r),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,p||r),this.filter=r),u!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,u),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}function ve(v){const{userImage:r}=v;return!!(r&&r.render&&r.render())&&(v.data.replace(new Uint8Array(r.data.buffer)),!0)}class Ue extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(r){if(this.loaded!==r&&(this.loaded=r,r)){for(const{ids:u,promiseResolve:p}of this.requestors)p(this._getImagesForIds(u));this.requestors=[]}}getImage(r){const u=this.images[r];if(u&&!u.data&&u.spriteData){const p=u.spriteData;u.data=new c.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),u.spriteData=null}return u}addImage(r,u){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);this._validate(r,u)&&(this.images[r]=u)}_validate(r,u){let p=!0;const m=u.data||u.spriteData;return this._validateStretch(u.stretchX,m&&m.width)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchX" value`))),p=!1),this._validateStretch(u.stretchY,m&&m.height)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchY" value`))),p=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "content" value`))),p=!1),p}_validateStretch(r,u){if(!r)return!0;let p=0;for(const m of r){if(m[0]{let m=!0;if(!this.isLoaded())for(const _ of r)this.images[_]||(m=!1);this.isLoaded()||m?u(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:u})})}_getImagesForIds(r){const u={};for(const p of r){let m=this.getImage(p);m||(this.fire(new c.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?u[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:c.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 u}getPixelSize(){const{width:r,height:u}=this.atlasImage;return{width:r,height:u}}getPattern(r){const u=this.patterns[r],p=this.getImage(r);if(!p)return null;if(u&&u.position.version===p.version)return u.position;if(u)u.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},_=new c.I(m,p);this.patterns[r]={bin:m,position:_}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const u=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(r,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const _ in this.patterns)r.push(this.patterns[_].bin);const{w:u,h:p}=c.p(r),m=this.atlasImage;m.resize({width:u||1,height:p||1});for(const _ in this.patterns){const{bin:S}=this.patterns[_],E=S.x+1,C=S.y+1,z=this.getImage(_).data,F=z.width,B=z.height;c.R.copy(z,m,{x:0,y:0},{x:E,y:C},{width:F,height:B}),c.R.copy(z,m,{x:0,y:B-1},{x:E,y:C-1},{width:F,height:1}),c.R.copy(z,m,{x:0,y:0},{x:E,y:C+B},{width:F,height:1}),c.R.copy(z,m,{x:F-1,y:0},{x:E-1,y:C},{width:1,height:B}),c.R.copy(z,m,{x:0,y:0},{x:E+F,y:C},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const u of r){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const p=this.getImage(u);p||c.w(`Image with ID: "${u}" was not found`),ve(p)&&this.updateImage(u,p)}}}const H=1e20;function Re(v,r,u,p,m,_,S,E,C){for(let z=r;z-1);C++,_[C]=E,S[C]=z,S[C+1]=H}for(let E=0,C=0;E65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[_])return{stack:r,id:u,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[_]){const E=ye.loadGlyphRange(r,_,this.url,this.requestManager);p.requests[_]=E}const S=yield p.requests[_];for(const E in S)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S[+E]);return p.ranges[_]=!0,{stack:r,id:u,glyph:S[u]||null}})}_doesCharSupportLocalGlyph(r){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(r))}_tinySDF(r,u,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let _=r.tinySDF;if(!_){let E="400";/bold/i.test(u)?E="900":/medium/i.test(u)?E="500":/light/i.test(u)&&(E="200"),_=r.tinySDF=new ye.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:E})}const S=_.draw(String.fromCharCode(p));return{id:p,bitmap:new c.o({width:S.width||60,height:S.height||60},S.data),metrics:{width:S.glyphWidth/2||24,height:S.glyphHeight/2||24,left:S.glyphLeft/2+.5||0,top:S.glyphTop/2-27.5||-8,advance:S.glyphAdvance/2||24,isDoubleResolution:!0}}}}ye.loadGlyphRange=function(v,r,u,p){return c._(this,void 0,void 0,function*(){const m=256*r,_=m+255,S=p.transformRequest(u.replace("{fontstack}",v).replace("{range}",`${m}-${_}`),"Glyphs"),E=yield c.l(S,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${r}, ${m}-${_}`);const C={};for(const z of c.n(E.data))C[z.id]=z;return C})},ye.TinySDF=class{constructor({fontSize:v=24,buffer:r=3,radius:u=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:_="normal",fontStyle:S="normal"}={}){this.buffer=r,this.cutoff=p,this.radius=u;const E=this.size=v+4*r,C=this._createCanvas(E),z=this.ctx=C.getContext("2d",{willReadFrequently:!0});z.font=`${S} ${_} ${v}px ${m}`,z.textBaseline="alphabetic",z.textAlign="left",z.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(v){const r=document.createElement("canvas");return r.width=r.height=v,r}draw(v){const{width:r,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:_}=this.ctx.measureText(v),S=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-m))),C=Math.min(this.size-this.buffer,S+Math.ceil(p)),z=E+2*this.buffer,F=C+2*this.buffer,B=Math.max(z*F,0),X=new Uint8ClampedArray(B),Q={data:X,width:z,height:F,glyphWidth:E,glyphHeight:C,glyphTop:S,glyphLeft:0,glyphAdvance:r};if(E===0||C===0)return Q;const{ctx:re,buffer:ce,gridInner:pe,gridOuter:me}=this;re.clearRect(ce,ce,E,C),re.fillText(v,ce,ce+S);const we=re.getImageData(ce,ce,E,C);me.fill(H,0,B),pe.fill(0,0,B);for(let ae=0;ae0?Ye*Ye:0,pe[ze]=Ye<0?Ye*Ye:0}}Re(me,0,0,z,F,z,this.f,this.v,this.z),Re(pe,ce,ce,E,C,z,this.f,this.v,this.z);for(let ae=0;ae1&&(C=r[++E]);const F=Math.abs(z-C.left),B=Math.abs(z-C.right),X=Math.min(F,B);let Q;const re=_/p*(m+1);if(C.isDash){const ce=m-Math.abs(re);Q=Math.sqrt(X*X+ce*ce)}else Q=m-Math.sqrt(X*X+re*re);this.data[S+z]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(r){for(let E=r.length-1;E>=0;--E){const C=r[E],z=r[E+1];C.zeroLength?r.splice(E,1):z&&z.isDash===C.isDash&&(z.left=C.left,r.splice(E,1))}const u=r[0],p=r[r.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const m=this.width*this.nextRow;let _=0,S=r[_];for(let E=0;E1&&(S=r[++_]);const C=Math.abs(E-S.left),z=Math.abs(E-S.right),F=Math.min(C,z);this.data[m+E]=Math.max(0,Math.min(255,(S.isDash?F:-F)+128))}}addDash(r,u){const p=u?7:0,m=2*p+1;if(this.nextRow+m>this.height)return c.w("LineAtlas out of space"),null;let _=0;for(let E=0;E{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[nt]}numActive(){return Object.keys(this.active).length}}const Jt=Math.floor(A.hardwareConcurrency/2);let er,Vt;function Yt(){return er||(er=new rt),er}rt.workerCount=c.C(globalThis)?Math.max(Math.min(Jt,3),1):1;class _r{constructor(r,u){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=u;const p=this.workerPool.acquire(u);for(let m=0;m{u.remove()}),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,u){for(const p of this.actors)p.registerMessageHandler(r,u)}}function fr(){return Vt||(Vt=new _r(Yt(),c.G),Vt.registerMessageHandler("GR",(v,r,u)=>c.m(r,u))),Vt}function br(v,r){const u=c.H();return c.J(u,u,[1,1,0]),c.K(u,u,[.5*v.width,.5*v.height,1]),c.L(u,u,v.calculatePosMatrix(r.toUnwrapped()))}function Xr(v,r,u,p,m,_){const S=function(B,X,Q){if(B)for(const re of B){const ce=X[re];if(ce&&ce.source===Q&&ce.type==="fill-extrusion")return!0}else for(const re in X){const ce=X[re];if(ce.source===Q&&ce.type==="fill-extrusion")return!0}return!1}(m&&m.layers,r,v.id),E=_.maxPitchScaleFactor(),C=v.tilesIn(p,E,S);C.sort(V);const z=[];for(const B of C)z.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(r,u,v._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,m,_,E,br(v.transform,B.tileID))});const F=function(B){const X={},Q={};for(const re of B){const ce=re.queryResults,pe=re.wrappedTileID,me=Q[pe]=Q[pe]||{};for(const we in ce){const ae=ce[we],Ce=me[we]=me[we]||{},Pe=X[we]=X[we]||[];for(const ze of ae)Ce[ze.featureIndex]||(Ce[ze.featureIndex]=!0,Pe.push(ze))}}return X}(z);for(const B in F)F[B].forEach(X=>{const Q=X.feature,re=v.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=re});return F}function V(v,r){const u=v.tileID,p=r.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}function je(v,r,u){return c._(this,void 0,void 0,function*(){let p=v;if(v.url?p=(yield c.h(r.transformRequest(v.url,"Source"),u)).data:yield A.frameAsync(u),!p)return null;const m=c.M(c.e(p,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(_=>_.id)),m})}class ie{constructor(r,u){r&&(u?this.setSouthWest(r).setNorthEast(u):Array.isArray(r)&&(r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1])))}setNorthEast(r){return this._ne=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}setSouthWest(r){return this._sw=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}extend(r){const u=this._sw,p=this._ne;let m,_;if(r instanceof c.N)m=r,_=r;else{if(!(r instanceof ie))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(ie.convert(r)):this.extend(c.N.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(c.N.convert(r)):this;if(m=r._sw,_=r._ne,!m||!_)return this}return u||p?(u.lng=Math.min(m.lng,u.lng),u.lat=Math.min(m.lat,u.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new c.N(m.lng,m.lat),this._ne=new c.N(_.lng,_.lat)),this}getCenter(){return new c.N((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 c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(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(r){const{lng:u,lat:p}=c.N.convert(r);let m=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(r){return r instanceof ie?r:r&&new ie(r)}static fromLngLat(r,u=0){const p=360*u/40075017,m=p/Math.cos(Math.PI/180*r.lat);return new ie(new c.N(r.lng-m,r.lat-p),new c.N(r.lng+m,r.lat+p))}adjustAntiMeridian(){const r=new c.N(this._sw.lng,this._sw.lat),u=new c.N(this._ne.lng,this._ne.lat);return new ie(r,r.lng>u.lng?new c.N(u.lng+360,u.lat):u)}}class de{constructor(r,u,p){this.bounds=ie.convert(this.validateBounds(r)),this.minzoom=u||0,this.maxzoom=p||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const u=Math.pow(2,r.z),p=Math.floor(c.O(this.bounds.getWest())*u),m=Math.floor(c.Q(this.bounds.getNorth())*u),_=Math.ceil(c.O(this.bounds.getEast())*u),S=Math.ceil(c.Q(this.bounds.getSouth())*u);return r.x>=p&&r.x<_&&r.y>=m&&r.y{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(u,"Tile"),uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(r.actor&&r.state!=="expired"){if(r.state==="loading")return new Promise((_,S)=>{r.reloadPromise={resolve:_,reject:S}})}else r.actor=this.dispatcher.getActor(),m="LT";r.abortController=new AbortController;try{const _=yield r.actor.sendAsync({type:m,data:p},r.abortController);if(delete r.abortController,r.aborted)return;this._afterTileLoadWorkerResponse(r,_)}catch(_){if(delete r.abortController,r.aborted)return;if(_&&_.status!==404)throw _;this._afterTileLoadWorkerResponse(r,null)}})}_afterTileLoadWorkerResponse(r,u){if(u&&u.resourceTiming&&(r.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&r.setExpiryData(u),r.loadVectorData(u,this.map.painter),r.reloadPromise){const p=r.reloadPromise;r.reloadPromise=null,this.loadTile(r).then(p.resolve).catch(p.reject)}}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.actor&&(yield r.actor.sendAsync({type:"AT",data:{uid:r.uid,type:this.type,source:this.id}}))})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),r.actor&&(yield r.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Te extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},u),c.e(this,c.M(u,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield je(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(c.e(this,r),r.bounds&&(this.tileBounds=new de(r.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new c.j(r))}})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(r){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),r(),this.load()}setTiles(r){return this.setSourceProperty(()=>{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}serialize(){return c.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const p=yield q.getImage(this.map._requestManager.transformRequest(u,"Tile"),r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&r.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,_=m.gl,S=p.data;r.texture=this.map.painter.getTileTexture(S.width),r.texture?r.texture.update(S,{useMipmap:!0}):(r.texture=new it(m,S,_.RGBA,{useMipmap:!0}),r.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST)),r.state="loaded"}}catch(p){if(delete r.abortController,r.aborted)r.state="unloaded";else if(p)throw r.state="errored",p}})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController)})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.texture&&this.map.painter.saveTileTexture(r.texture)})}hasTransition(){return!1}}class Ge extends Te{constructor(r,u,p,m){super(r,u,p,m),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(u,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const m=yield q.getImage(p,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(m&&m.data){const _=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&r.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const S=c.b(_)&&c.U()?_:yield this.readImageNow(_),E={type:this.type,uid:r.uid,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!r.actor||r.state==="expired"){r.actor=this.dispatcher.getActor();const C=yield r.actor.sendAsync({type:"LDT",data:E});r.dem=C,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(m){if(delete r.abortController,r.aborted)r.state="unloaded";else if(m)throw r.state="errored",m}})}readImageNow(r){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const u=r.width+2,p=r.height+2;try{return new c.R({width:u,height:p},yield c.W(r,-1,-1,u,p))}catch{}}return A.getImageData(r,1)})}_getNeighboringTiles(r){const u=r.canonical,p=Math.pow(2,u.z),m=(u.x-1+p)%p,_=u.x===0?r.wrap-1:r.wrap,S=(u.x+1+p)%p,E=u.x+1===p?r.wrap+1:r.wrap,C={};return C[new c.S(r.overscaledZ,_,u.z,m,u.y).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y).key]={backfilled:!1},u.y>0&&(C[new c.S(r.overscaledZ,_,u.z,m,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,r.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(_,{resourceTiming:m}),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.actor?"RT":"LT";r.actor=this.actor;const p={type:this.type,uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};r.abortController=new AbortController;const m=yield this.actor.sendAsync({type:u,data:p},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(m,this.map.painter,u==="RT")})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.aborted=!0})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:r.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 c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ne=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ot extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=u}load(r){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const u=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,r&&(this.coordinates=r),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;const u=r.map(c.Z.fromLngLat);this.tileID=function(m){let _=1/0,S=1/0,E=-1/0,C=-1/0;for(const X of m)_=Math.min(_,X.x),S=Math.min(S,X.y),E=Math.max(E,X.x),C=Math.max(C,X.y);const z=Math.max(E-_,C-S),F=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),B=Math.pow(2,F);return new c.a1(F,Math.floor((_+E)/2*B),Math.floor((S+C)/2*B))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,c.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,c.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(r,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(r){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class kt extends ot{constructor(r,u,p,m){super(r,u,p,m),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const u of r.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a3(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const u=this.video.seekable;ru.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(r){this.map||(this.map=r,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new it(r,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("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 at extends ot{constructor(r,u,p,m){super(r,u,p,m),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(S=>typeof S!="number"))||this.fire(new c.j(new c.a2(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${r}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${r}`,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 c.j(new c.a2(`sources.${r}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return c._(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 c.j(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(r){this.map=r,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(u,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const _ in this.tiles){const S=this.tiles[_];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,m=!0)}m&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const r of[this.canvas.width,this.canvas.height])if(isNaN(r)||r<=0)return!0;return!1}}const Bt={},Tr=v=>{switch(v){case"geojson":return tt;case"image":return ot;case"raster":return Te;case"raster-dem":return Ge;case"vector":return se;case"video":return kt;case"canvas":return at}return Bt[v]},Ze="RTLPluginLoaded";class tn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=fr()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return c._(this,arguments,void 0,function*(u,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=A.resolveURL(u),!this.url)throw new Error(`requested url ${u} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(Ze))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _n=null;function vn(){return _n||(_n=new tn),_n}class pi{constructor(r,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=c.a4(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(r){const u=r+this.timeAdded;u_.getLayer(z)).filter(Boolean);if(C.length!==0){E.layers=C,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(z=>C.filter(F=>F.id===z)[0]));for(const z of C)S[z.id]=E}}return S}(r.buckets,u.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6){if(this.hasSymbolBuckets=!0,!p)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6&&_.hasRTLText){this.hasRTLText=!0,vn().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const _=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(m).queryRadius(_))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(r){return this.buckets[r.id]}upload(r){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(r)}const u=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(r,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(r,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,u,p,m,_,S,E,C,z,F){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:_,scale:S,tileSize:this.tileSize,pixelPosMatrix:F,transform:C,params:E,queryPadding:this.queryPadding*z},r,u,p):{}}querySourceFeatures(r,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),_=u&&u.sourceLayer?u.sourceLayer:"",S=m._geojsonTileLayer||m[_];if(!S)return;const E=c.a7(u&&u.filter),{z:C,x:z,y:F}=this.tileID.canonical,B={z:C,x:z,y:F};for(let X=0;Xp)m=!1;else if(u)if(this.expirationTime{this.remove(r,_)},p)),this.data[m].push(_),this.order.push(m),this.order.length>this.max){const S=this._getAndRemoveByKey(this.order[0]);S&&this.onRemove(S)}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){const u=this.data[r].shift();return u.timeout&&clearTimeout(u.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),u.value}getByKey(r){const u=this.data[r];return u?u[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,u){if(!this.has(r))return this;const p=r.wrapped().key,m=u===void 0?0:this.data[p].indexOf(u),_=this.data[p][m];return this.data[p].splice(m,1),_.timeout&&clearTimeout(_.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(_.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(r){const u=[];for(const p in this.data)for(const m of this.data[p])r(m.value)||u.push(m);for(const p of u)this.remove(p.value.tileID,p)}}class Kt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,u,p){const m=String(u);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][m]=this.stateChanges[r][m]||{},c.e(this.stateChanges[r][m],p),this.deletedStates[r]===null){this.deletedStates[r]={};for(const _ in this.state[r])_!==m&&(this.deletedStates[r][_]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][m]===null){this.deletedStates[r][m]={};for(const _ in this.state[r][m])p[_]||(this.deletedStates[r][m][_]=null)}else for(const _ in p)this.deletedStates[r]&&this.deletedStates[r][m]&&this.deletedStates[r][m][_]===null&&delete this.deletedStates[r][m][_]}removeFeatureState(r,u,p){if(this.deletedStates[r]===null)return;const m=String(u);if(this.deletedStates[r]=this.deletedStates[r]||{},p&&u!==void 0)this.deletedStates[r][m]!==null&&(this.deletedStates[r][m]=this.deletedStates[r][m]||{},this.deletedStates[r][m][p]=null);else if(u!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][m])for(p in this.deletedStates[r][m]={},this.stateChanges[r][m])this.deletedStates[r][m][p]=null;else this.deletedStates[r][m]=null;else this.deletedStates[r]=null}getState(r,u){const p=String(u),m=c.e({},(this.state[r]||{})[p],(this.stateChanges[r]||{})[p]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const _=this.deletedStates[r][u];if(_===null)return{};for(const S in _)delete m[S]}return m}initializeTileState(r,u){r.setFeatureState(this.state,u)}coalesceChanges(r,u){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const _={};for(const S in this.stateChanges[m])this.state[m][S]||(this.state[m][S]={}),c.e(this.state[m][S],this.stateChanges[m][S]),_[S]=this.state[m][S];p[m]=_}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const _={};if(this.deletedStates[m]===null)for(const S in this.state[m])_[S]={},this.state[m][S]={};else for(const S in this.deletedStates[m]){if(this.deletedStates[m][S]===null)this.state[m][S]={};else for(const E of Object.keys(this.deletedStates[m][S]))delete this.state[m][S][E];_[S]=this.state[m][S]}p[m]=p[m]||{},c.e(p[m],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in r)r[m].setFeatureState(p,u)}}class Ut extends c.E{constructor(r,u,p){super(),this.id=r,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,_,S,E)=>{const C=new(Tr(_.type))(m,_,S,E);if(C.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${C.id}`);return C})(r,u,p,this),this._tiles={},this._cache=new Qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Kt,this._didEmitContent=!1,this._updated=!1}onAdd(r){this.map=r,this._maxTileCacheSize=r?r._maxTileCacheSize:null,this._maxTileCacheZoomLevels=r?r._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(r)}onRemove(r){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(r)}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(const r in this._tiles){const u=this._tiles[r];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(r,u,p){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,u,p)}catch(m){r.state="errored",m.status!==404?this._source.fire(new c.j(m,{tile:r})):this.update(this.transform,this.terrain)}})}_unloadTile(r){this._source.unloadTile&&this._source.unloadTile(r)}_abortTile(r){this._source.abortTile&&this._source.abortTile(r),this._source.fire(new c.k("dataabort",{tile:r,coord:r.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const p=this._tiles[u];p.upload(r),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(Kr).map(r=>r.key)}getRenderableIds(r){const u=[];for(const p in this._tiles)this._isIdRenderable(p,r)&&u.push(this._tiles[p]);return r?u.sort((p,m)=>{const _=p.tileID,S=m.tileID,E=new c.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),C=new c.P(S.canonical.x,S.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-S.overscaledZ||C.y-E.y||C.x-E.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Kr).map(p=>p.key)}hasRenderableParent(r){const u=this.findLoadedParent(r,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(r,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(u||!this._tiles[r].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}}_reloadTile(r,u){return c._(this,void 0,void 0,function*(){const p=this._tiles[r];p&&(p.state!=="loading"&&(p.state=u),yield this._loadTile(p,r,u))})}_tileLoaded(r,u,p){r.timeAdded=A.now(),p==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(u,r),this.getSource().type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),r.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:r,coord:r.tileID}))}_backfillDEM(r){const u=this.getRenderableIds();for(let m=0;m1||(Math.abs(S)>1&&(Math.abs(S+C)===1?S+=C:Math.abs(S-C)===1&&(S-=C)),_.dem&&m.dem&&(m.dem.backfillBorder(_.dem,S,E),m.neighboringTiles&&m.neighboringTiles[z]&&(m.neighboringTiles[z].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,u,p,m){for(const _ in this._tiles){let S=this._tiles[_];if(m[_]||!S.hasData()||S.tileID.overscaledZ<=u||S.tileID.overscaledZ>p)continue;let E=S.tileID;for(;S&&S.tileID.overscaledZ>u+1;){const z=S.tileID.scaledTo(S.tileID.overscaledZ-1);S=this._tiles[z.key],S&&S.hasData()&&(E=z)}let C=E;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),r[C.key]){m[E.key]=E;break}}}findLoadedParent(r,u){if(r.key in this._loadedParentTiles){const p=this._loadedParentTiles[r.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=r.overscaledZ-1;p>=u;p--){const m=r.scaledTo(p),_=this._getLoadedTile(m);if(_)return _}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const u=this._tiles[r.key];return u&&u.hasData()?u:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const u=Math.ceil(r.width/this._source.tileSize)+1,p=Math.ceil(r.height/this._source.tileSize)+1,m=Math.floor(u*p*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(_)}handleWrapJump(r){const u=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,u){const p={};for(const m in this._tiles){const _=this._tiles[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+u),p[_.tileID.key]=_}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(r,u,p,m,_,S){const E={},C={},z=Object.keys(r),F=A.now();for(const B of z){const X=r[B],Q=this._tiles[B];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=F)continue;const re=this.findLoadedParent(X,u),ce=this.findLoadedSibling(X),pe=re||ce||null;pe&&(this._addTile(pe.tileID),E[pe.tileID.key]=pe.tileID),C[B]=X}this._retainLoadedChildren(C,m,p,r);for(const B in E)r[B]||(this._coveredTiles[B]=!0,r[B]=E[B]);if(S){const B={},X={};for(const Q of _)this._tiles[Q.key].hasData()?B[Q.key]=Q:X[Q.key]=Q;for(const Q in X){const re=X[Q].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(B[re[0].key]=r[re[0].key]=re[0],B[re[1].key]=r[re[1].key]=re[1],B[re[2].key]=r[re[2].key]=re[2],B[re[3].key]=r[re[3].key]=re[3],delete X[Q])}for(const Q in X){const re=X[Q],ce=this.findLoadedParent(re,this._source.minzoom),pe=this.findLoadedSibling(re),me=ce||pe||null;if(me){B[me.tileID.key]=r[me.tileID.key]=me.tileID;for(const we in B)B[we].isChildOf(me.tileID)&&delete B[we]}}for(const Q in this._tiles)B[Q]||(this._coveredTiles[Q]=!0)}}update(r,u){if(!this._sourceLoaded||this._paused)return;let p;this.transform=r,this.terrain=u,this.updateCacheSize(r),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(F=>new c.S(F.canonical.z,F.wrap,F.canonical.z,F.canonical.x,F.canonical.y)):(p=r.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(p=p.filter(F=>this._source.hasTile(F)))):p=[];const m=r.coveringZoomLevel(this._source),_=Math.max(m-Ut.maxOverzooming,this._source.minzoom),S=Math.max(m+Ut.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const F={};for(const B of p)if(B.canonical.z>this._source.minzoom){const X=B.scaledTo(B.canonical.z-1);F[X.key]=X;const Q=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));F[Q.key]=Q}p=p.concat(Object.values(F))}const E=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(p,m);mi(this._source.type)&&this._updateCoveredAndRetainedTiles(C,_,S,m,p,u);for(const F in C)this._tiles[F].clearFadeHold();const z=c.ab(this._tiles,C);for(const F of z){const B=this._tiles[F];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(F)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,u){var p;const m={},_={},S=Math.max(u-Ut.maxOverzooming,this._source.minzoom),E=Math.max(u+Ut.maxUnderzooming,this._source.minzoom),C={};for(const z of r){const F=this._addTile(z);m[z.key]=z,F.hasData()||uthis._source.maxzoom){const X=z.children(this._source.maxzoom)[0],Q=this.getTile(X);if(Q&&Q.hasData()){m[X.key]=X;continue}}else{const X=z.children(this._source.maxzoom);if(m[X[0].key]&&m[X[1].key]&&m[X[2].key]&&m[X[3].key])continue}let B=F.wasRequested();for(let X=z.overscaledZ-1;X>=S;--X){const Q=z.scaledTo(X);if(_[Q.key])break;if(_[Q.key]=!0,F=this.getTile(Q),!F&&B&&(F=this._addTile(Q)),F){const re=F.hasData();if((re||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||B)&&(m[Q.key]=Q),B=F.wasRequested(),re)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const u=[];let p,m=this._tiles[r].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}u.push(m.key);const _=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(_),p)break;m=_}for(const _ of u)this._loadedParentTiles[_]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const u=this._tiles[r].tileID,p=this._getLoadedTile(u);this._loadedSiblingTiles[u.key]=p}}_addTile(r){let u=this._tiles[r.key];if(u)return u;u=this._cache.getAndRemove(r),u&&(this._setTileReloadTimer(r.key,u),u.tileID=r,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,u)));const p=u;return u||(u=new pi(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(u,r.key,u.state)),u.uses++,this._tiles[r.key]=u,p||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(r,u){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const p=u.getExpiryTimeout();p&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},p))}_removeTile(r){const u=this._tiles[r];u&&(u.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(r){const u=r.sourceDataType;r.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(r);this._cache.reset()}tilesIn(r,u,p){const m=[],_=this.transform;if(!_)return m;const S=p?_.getCameraQueryGeometry(r):r,E=r.map(re=>_.pointCoordinate(re,this.terrain)),C=S.map(re=>_.pointCoordinate(re,this.terrain)),z=this.getIds();let F=1/0,B=1/0,X=-1/0,Q=-1/0;for(const re of C)F=Math.min(F,re.x),B=Math.min(B,re.y),X=Math.max(X,re.x),Q=Math.max(Q,re.y);for(let re=0;re=0&&ae[1].y+we>=0){const Ce=E.map(ze=>pe.getTilePoint(ze)),Pe=C.map(ze=>pe.getTilePoint(ze));m.push({tile:ce,tileID:pe,queryGeometry:Ce,cameraQueryGeometry:Pe,scale:me})}}return m}getVisibleCoordinates(r){const u=this.getRenderableIds(r).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(mi(this._source.type)){const r=A.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=r)return!0}return!1}setFeatureState(r,u,p){this._state.updateState(r=r||"_geojsonTileLayer",u,p)}removeFeatureState(r,u,p){this._state.removeFeatureState(r=r||"_geojsonTileLayer",u,p)}getFeatureState(r,u){return this._state.getState(r=r||"_geojsonTileLayer",u)}setDependencies(r,u,p){const m=this._tiles[r];m&&m.setDependencies(u,p)}reloadTilesForDependencies(r,u){for(const p in this._tiles)this._tiles[p].hasDependency(r,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(r,u))}}function Kr(v,r){const u=Math.abs(2*v.wrap)-+(v.wrap<0),p=Math.abs(2*r.wrap)-+(r.wrap<0);return v.overscaledZ-r.overscaledZ||p-u||r.canonical.y-v.canonical.y||r.canonical.x-v.canonical.x}function mi(v){return v==="raster"||v==="image"||v==="video"}Ut.maxOverzooming=10,Ut.maxUnderzooming=3;class Xt{constructor(r,u){this.reset(r,u)}reset(r,u){this.points=r||[],this._distances=[0];for(let p=1;p0?(m-S)/E:0;return this.points[_].mult(1-C).add(this.points[u].mult(C))}}function Yi(v,r){let u=!0;return v==="always"||v!=="never"&&r!=="never"||(u=!1),u}class fs{constructor(r,u,p){const m=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(r/p),this.yCellCount=Math.ceil(u/p);for(let S=0;Sthis.width||m<0||u>this.height)return[];const C=[];if(r<=0&&u<=0&&this.width<=p&&this.height<=m){if(_)return[{key:null,x1:r,y1:u,x2:p,y2:m}];for(let z=0;z0}hitTestCircle(r,u,p,m,_){const S=r-p,E=r+p,C=u-p,z=u+p;if(E<0||S>this.width||z<0||C>this.height)return!1;const F=[];return this._forEachCell(S,C,E,z,this._queryCellCircle,F,{hitTest:!0,overlapMode:m,circle:{x:r,y:u,radius:p},seenUids:{box:{},circle:{}}},_),F.length>0}_queryCell(r,u,p,m,_,S,E,C){const{seenUids:z,hitTest:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!z.box[ce]){z.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(r<=re[pe+2]&&u<=re[pe+3]&&p>=re[pe+0]&&m>=re[pe+1]&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))&&(S.push({key:me,x1:re[pe],y1:re[pe+1],x2:re[pe+2],y2:re[pe+3]}),F))return!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!z.circle[ce]){z.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circleAndRectCollide(re[pe],re[pe+1],re[pe+2],r,u,p,m)&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))){const we=re[pe],ae=re[pe+1],Ce=re[pe+2];if(S.push({key:me,x1:we-Ce,y1:ae-Ce,x2:we+Ce,y2:ae+Ce}),F)return!0}}}return!1}_queryCellCircle(r,u,p,m,_,S,E,C){const{circle:z,seenUids:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!F.box[ce]){F.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(this._circleAndRectCollide(z.x,z.y,z.radius,re[pe+0],re[pe+1],re[pe+2],re[pe+3])&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!F.circle[ce]){F.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circlesCollide(re[pe],re[pe+1],re[pe+2],z.x,z.y,z.radius)&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}}_forEachCell(r,u,p,m,_,S,E,C){const z=this._convertToXCellCoord(r),F=this._convertToYCellCoord(u),B=this._convertToXCellCoord(p),X=this._convertToYCellCoord(m);for(let Q=z;Q<=B;Q++)for(let re=F;re<=X;re++)if(_.call(this,r,u,p,m,this.xCellCount*re+Q,S,E,C))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,u,p,m,_,S){const E=m-r,C=_-u,z=p+S;return z*z>E*E+C*C}_circleAndRectCollide(r,u,p,m,_,S,E){const C=(S-m)/2,z=Math.abs(r-(m+C));if(z>C+p)return!1;const F=(E-_)/2,B=Math.abs(u-(_+F));if(B>F+p)return!1;if(z<=C||B<=F)return!0;const X=z-C,Q=B-F;return X*X+Q*Q<=p*p}}function ps(v,r,u,p,m){const _=c.H();return r?(c.K(_,_,[1/m,1/m,1]),u||c.ad(_,_,p.angle)):c.L(_,p.labelPlaneMatrix,v),_}function Hn(v,r,u,p,m){if(r){const _=c.ae(v);return c.K(_,_,[m,m,1]),u||c.ad(_,_,-p.angle),_}return p.glCoordMatrix}function he(v,r,u,p){let m;p?(m=[v,r,p(v,r),1],c.af(m,m,u)):(m=[v,r,0,1],mr(m,m,u));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}function G(v,r){return .5+v/r*.5}function W(v,r){return v.x>=-r[0]&&v.x<=r[0]&&v.y>=-r[1]&&v.y<=r[1]}function ee(v,r,u,p,m,_,S,E,C,z,F,B,X,Q,re){const ce=p?v.textSizeData:v.iconSizeData,pe=c.ag(ce,u.transform.zoom),me=[256/u.width*2+1,256/u.height*2+1],we=p?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;we.clear();const ae=v.lineVertexArray,Ce=p?v.text.placedSymbolArray:v.icon.placedSymbolArray,Pe=u.transform.width/u.transform.height;let ze=!1;for(let Ye=0;YeMath.abs(u.x-r.x)*p?{useVertical:!0}:(v===c.ah.vertical?r.yu.x)?{needsFlipping:!0}:null}function Ie(v,r,u,p,m,_,S,E,C,z,F){const B=u/24,X=r.lineOffsetX*B,Q=r.lineOffsetY*B;let re;if(r.numGlyphs>1){const ce=r.glyphStartIndex+r.numGlyphs,pe=r.lineStartIndex,me=r.lineStartIndex+r.lineLength,we=ue(B,E,X,Q,p,r,F,v);if(!we)return{notEnoughRoom:!0};const ae=he(we.first.point.x,we.first.point.y,S,v.getElevation).point,Ce=he(we.last.point.x,we.last.point.y,S,v.getElevation).point;if(m&&!p){const Pe=Se(r.writingMode,ae,Ce,z);if(Pe)return Pe}re=[we.first];for(let Pe=r.glyphStartIndex+1;Pe0?ae.point:function(ze,Ye,st,gt,wt,dt){return Ae(ze,Ye,st,1,wt,dt)}(v.tileAnchorPoint,we,pe,0,_,v),Pe=Se(r.writingMode,pe,Ce,z);if(Pe)return Pe}const ce=ut(B*E.getoffsetX(r.glyphStartIndex),X,Q,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,v,F);if(!ce||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};re=[ce]}for(const ce of re)c.aj(C,ce.point,ce.angle);return{}}function Ae(v,r,u,p,m,_){const S=v.add(v.sub(r)._unit()),E=m!==void 0?he(S.x,S.y,m,_.getElevation).point:He(S.x,S.y,_).point,C=u.sub(E);return u.add(C._mult(p/C.mag()))}function _e(v,r,u){const p=r.projectionCache;if(p.projections[v])return p.projections[v];const m=new c.P(r.lineVertexArray.getx(v),r.lineVertexArray.gety(v)),_=He(m.x,m.y,r);if(_.signedDistanceFromCamera>0)return p.projections[v]=_.point,p.anyProjectionOccluded=p.anyProjectionOccluded||_.isOccluded,_.point;const S=v-u.direction;return function(E,C,z,F,B){return Ae(E,C,z,F,void 0,B)}(u.distanceFromAnchor===0?r.tileAnchorPoint:new c.P(r.lineVertexArray.getx(S),r.lineVertexArray.gety(S)),m,u.previousVertex,u.absOffsetX-u.distanceFromAnchor+1,r)}function He(v,r,u){const p=v+u.translation[0],m=r+u.translation[1];let _;return!u.pitchWithMap&&u.projection.useSpecialProjectionForSymbols?(_=u.projection.projectTileCoordinates(p,m,u.unwrappedTileID,u.getElevation),_.point.x=(.5*_.point.x+.5)*u.width,_.point.y=(.5*-_.point.y+.5)*u.height):(_=he(p,m,u.labelPlaneMatrix,u.getElevation),_.isOccluded=!1),_}function Je(v,r,u){return v._unit()._perp()._mult(r*u)}function $e(v,r,u,p,m,_,S,E,C){if(E.projectionCache.offsets[v])return E.projectionCache.offsets[v];const z=u.add(r);if(v+C.direction=m)return E.projectionCache.offsets[v]=z,z;const F=_e(v+C.direction,E,C),B=Je(F.sub(u),S,C.direction),X=u.add(B),Q=F.add(B);return E.projectionCache.offsets[v]=c.ak(_,z,X,Q)||z,E.projectionCache.offsets[v]}function ut(v,r,u,p,m,_,S,E,C){const z=p?v-r:v+r;let F=z>0?1:-1,B=0;p&&(F*=-1,B=Math.PI),F<0&&(B+=Math.PI);let X,Q=F>0?_+m:_+m+1;E.projectionCache.cachedAnchorPoint?X=E.projectionCache.cachedAnchorPoint:(X=He(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=X);let re,ce,pe=X,me=X,we=0,ae=0;const Ce=Math.abs(z),Pe=[];let ze;for(;we+ae<=Ce;){if(Q+=F,Q<_||Q>=S)return null;we+=ae,me=pe,ce=re;const gt={absOffsetX:Ce,direction:F,distanceFromAnchor:we,previousVertex:me};if(pe=_e(Q,E,gt),u===0)Pe.push(me),ze=pe.sub(me);else{let wt;const dt=pe.sub(me);wt=dt.mag()===0?Je(_e(Q+F,E,gt).sub(pe),u,F):Je(dt,u,F),ce||(ce=me.add(wt)),re=$e(Q,wt,pe,_,S,ce,u,E,gt),Pe.push(ce),ze=re.sub(ce)}ae=ze.mag()}const Ye=ze._mult((Ce-we)/ae)._add(ce||me),st=B+Math.atan2(pe.y-me.y,pe.x-me.x);return Pe.push(Ye),{point:Ye,angle:C?st:0,path:Pe}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ot(v,r){for(let u=0;u=1;tr--)_t.push(qt.path[tr]);for(let tr=1;trar.signedDistanceFromCamera<=0)?[]:tr.map(ar=>ar.point)}let Hr=[];if(_t.length>0){const tr=_t[0].clone(),ar=_t[0].clone();for(let Wr=1;Wr<_t.length;Wr++)tr.x=Math.min(tr.x,_t[Wr].x),tr.y=Math.min(tr.y,_t[Wr].y),ar.x=Math.max(ar.x,_t[Wr].x),ar.y=Math.max(ar.y,_t[Wr].y);Hr=tr.x>=dt.x&&ar.x<=ct.x&&tr.y>=dt.y&&ar.y<=ct.y?[_t]:ar.xct.x||ar.yct.y?[]:c.al([_t],dt.x,dt.y,ct.x,ct.y)}for(const tr of Hr){Pt.reset(tr,.25*wt);let ar=0;ar=Pt.length<=.5*wt?1:Math.ceil(Pt.paddedLength/Gt)+1;for(let Wr=0;Wrhe(m.x,m.y,p,u.getElevation))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const u=[];let p=1/0,m=1/0,_=-1/0,S=-1/0;for(const F of r){const B=new c.P(F.x+Qt,F.y+Qt);p=Math.min(p,B.x),m=Math.min(m,B.y),_=Math.max(_,B.x),S=Math.max(S,B.y),u.push(B)}const E=this.grid.query(p,m,_,S).concat(this.ignoredGrid.query(p,m,_,S)),C={},z={};for(const F of E){const B=F.key;if(C[B.bucketInstanceId]===void 0&&(C[B.bucketInstanceId]={}),C[B.bucketInstanceId][B.featureIndex])continue;const X=[new c.P(F.x1,F.y1),new c.P(F.x2,F.y1),new c.P(F.x2,F.y2),new c.P(F.x1,F.y2)];c.am(u,X)&&(C[B.bucketInstanceId][B.featureIndex]=!0,z[B.bucketInstanceId]===void 0&&(z[B.bucketInstanceId]=[]),z[B.bucketInstanceId].push(B.featureIndex))}return z}insertCollisionBox(r,u,p,m,_,S){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,u,p,m,_,S){const E=p?this.ignoredGrid:this.grid,C={bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u};for(let z=0;z=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(r,u,p,m){return p>=0&&r=0&&uthis.projectAndGetPerspectiveRatio(p,wt.x,wt.y,m,z));st=gt.some(wt=>!wt.isOccluded),Ye=gt.map(wt=>wt.point)}else st=!0;return{box:c.ao(Ye),allPointsOccluded:!st}}}function or(v,r,u){return r*(c.X/(v.tileSize*Math.pow(2,u-v.tileID.overscaledZ)))}class Tn{constructor(r,u,p,m){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?u:-u))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class rn{constructor(r,u,p,m,_){this.text=new Tn(r?r.text:null,u,p,_),this.icon=new Tn(r?r.icon:null,u,m,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rr{constructor(r,u,p){this.text=r,this.icon=u,this.skipFade=p}}class Mr{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class Yr{constructor(r,u,p,m,_){this.bucketInstanceId=r,this.featureIndex=u,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=_}}class Dn{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const u=++this.maxGroupID;this.collisionGroups[r]={ID:u,predicate:p=>p.collisionGroupID===u}}return this.collisionGroups[r]}}function Bn(v,r,u,p,m){const{horizontalAlign:_,verticalAlign:S}=c.au(v);return new c.P(-(_-.5)*r+p[0]*m,-(S-.5)*u+p[1]*m)}class ni{constructor(r,u,p,m,_,S){this.transform=r.clone(),this.terrain=p,this.collisionIndex=new gr(this.transform,u),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Dn(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const u=this.terrain;return u?(p,m)=>u.getElevation(r,p,m):null}getBucketParts(r,u,p,m){const _=p.getBucket(u),S=p.latestFeatureIndex;if(!_||!S||u.id!==_.layerIds[0])return;const E=p.collisionBoxArray,C=_.layers[0].layout,z=_.layers[0].paint,F=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),B=p.tileSize/c.X,X=p.tileID.toUnwrapped(),Q=this.transform.calculatePosMatrix(X),re=C.get("text-pitch-alignment")==="map",ce=C.get("text-rotation-alignment")==="map",pe=or(p,1,this.transform.zoom),me=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),we=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),ae=ps(Q,re,ce,this.transform,pe);let Ce=null;if(re){const ze=Hn(Q,re,ce,this.transform,pe);Ce=c.L([],this.transform.labelPlaneMatrix,ze)}this.retainedQueryData[_.bucketInstanceId]=new Yr(_.bucketInstanceId,S,_.sourceLayerIndex,_.index,p.tileID);const Pe={bucket:_,layout:C,translationText:me,translationIcon:we,posMatrix:Q,unwrappedTileID:X,textLabelPlaneMatrix:ae,labelToScreenMatrix:Ce,scale:F,textPixelRatio:B,holdingForFade:p.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:c.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(m)for(const ze of _.sortKeyRanges){const{sortKey:Ye,symbolInstanceStart:st,symbolInstanceEnd:gt}=ze;r.push({sortKey:Ye,symbolInstanceStart:st,symbolInstanceEnd:gt,parameters:Pe})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(r,u,p,m,_,S,E,C,z,F,B,X,Q,re,ce,pe,me,we,ae){const Ce=c.aq[r.textAnchor],Pe=[r.textOffset0,r.textOffset1],ze=Bn(Ce,p,m,Pe,_),Ye=this.collisionIndex.placeCollisionBox(u,X,C,z,F,E,S,pe,B.predicate,ae,ze);if((!we||this.collisionIndex.placeCollisionBox(we,X,C,z,F,E,S,me,B.predicate,ae,ze).placeable)&&Ye.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(st=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Pe,width:p,height:m,anchor:Ce,textBoxScale:_,prevAnchor:st},this.markUsedJustification(re,Ce,Q,ce),re.allowVerticalPlacement&&(this.markUsedOrientation(re,ce,Q),this.placedOrientations[Q.crossTileID]=ce),{shift:ze,placedGlyphBoxes:Ye}}}placeLayerBucketPart(r,u,p){const{bucket:m,layout:_,translationText:S,translationIcon:E,posMatrix:C,unwrappedTileID:z,textLabelPlaneMatrix:F,labelToScreenMatrix:B,textPixelRatio:X,holdingForFade:Q,collisionBoxArray:re,partiallyEvaluatedTextSize:ce,collisionGroup:pe}=r.parameters,me=_.get("text-optional"),we=_.get("icon-optional"),ae=c.ar(_,"text-overlap","text-allow-overlap"),Ce=ae==="always",Pe=c.ar(_,"icon-overlap","icon-allow-overlap"),ze=Pe==="always",Ye=_.get("text-rotation-alignment")==="map",st=_.get("text-pitch-alignment")==="map",gt=_.get("icon-text-fit")!=="none",wt=_.get("symbol-z-order")==="viewport-y",dt=Ce&&(ze||!m.hasIconData()||we),ct=ze&&(Ce||!m.hasTextData()||me);!m.collisionArrays&&re&&m.deserializeCollisionBoxes(re);const Pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),qt=(ft,_t,Gt)=>{var Hr,tr;if(u[ft.crossTileID])return;if(Q)return void(this.placements[ft.crossTileID]=new rr(!1,!1,!1));let ar=!1,Wr=!1,Gn=!0,xs=null,Gr={box:null,placeable:!1,offscreen:null},_i={box:null,placeable:!1,offscreen:null},ii=null,Zn=null,si=null,Ws=0,sl=0,Pc=0;_t.textFeatureIndex?Ws=_t.textFeatureIndex:ft.useRuntimeCollisionCircles&&(Ws=ft.featureIndex),_t.verticalTextFeatureIndex&&(sl=_t.verticalTextFeatureIndex);const ol=_t.textBox;if(ol){const ts=Nn=>{let qn=c.ah.horizontal;if(m.allowVerticalPlacement&&!Nn&&this.prevPlacement){const Li=this.prevPlacement.placedOrientations[ft.crossTileID];Li&&(this.placedOrientations[ft.crossTileID]=Li,qn=Li,this.markUsedOrientation(m,qn,ft))}return qn},rs=(Nn,qn)=>{if(m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&_t.verticalTextBox){for(const Li of m.writingModes)if(Li===c.ah.vertical?(Gr=qn(),_i=Gr):Gr=Nn(),Gr&&Gr.placeable)break}else Gr=Nn()},Ao=ft.textAnchorOffsetStartIndex,ws=ft.textAnchorOffsetEndIndex;if(ws===Ao){const Nn=(qn,Li)=>{const cr=this.collisionIndex.placeCollisionBox(qn,ae,X,C,z,st,Ye,S,pe.predicate,Pt);return cr&&cr.placeable&&(this.markUsedOrientation(m,Li,ft),this.placedOrientations[ft.crossTileID]=Li),cr};rs(()=>Nn(ol,c.ah.horizontal),()=>{const qn=_t.verticalTextBox;return m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&qn?Nn(qn,c.ah.vertical):{box:null,offscreen:null}}),ts(Gr&&Gr.placeable)}else{let Nn=c.aq[(tr=(Hr=this.prevPlacement)===null||Hr===void 0?void 0:Hr.variableOffsets[ft.crossTileID])===null||tr===void 0?void 0:tr.anchor];const qn=(cr,ua,al)=>{const ll=cr.x2-cr.x1,um=cr.y2-cr.y1,t0=ft.textBoxScale,cm=gt&&Pe==="never"?ua:null;let Do=null,hm=ae==="never"?1:2,Ac="never";Nn&&hm++;for(let hu=0;huqn(ol,_t.iconBox,c.ah.horizontal),()=>{const cr=_t.verticalTextBox;return m.allowVerticalPlacement&&(!Gr||!Gr.placeable)&&ft.numVerticalGlyphVertices>0&&cr?qn(cr,_t.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Gr&&(ar=Gr.placeable,Gn=Gr.offscreen);const Li=ts(Gr&&Gr.placeable);if(!ar&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[ft.crossTileID];cr&&(this.variableOffsets[ft.crossTileID]=cr,this.markUsedJustification(m,cr.anchor,ft,Li))}}}if(ii=Gr,ar=ii&&ii.placeable,Gn=ii&&ii.offscreen,ft.useRuntimeCollisionCircles){const ts=m.text.placedSymbolArray.get(ft.centerJustifiedTextSymbolIndex),rs=c.ai(m.textSizeData,ce,ts),Ao=_.get("text-padding");Zn=this.collisionIndex.placeCollisionCircles(ae,ts,m.lineVertexArray,m.glyphOffsetArray,rs,C,z,F,B,p,st,pe.predicate,ft.collisionCircleDiameter,Ao,S,Pt),Zn.circles.length&&Zn.collisionDetected&&!p&&c.w("Collisions detected, but collision boxes are not shown"),ar=Ce||Zn.circles.length>0&&!Zn.collisionDetected,Gn=Gn&&Zn.offscreen}if(_t.iconFeatureIndex&&(Pc=_t.iconFeatureIndex),_t.iconBox){const ts=rs=>this.collisionIndex.placeCollisionBox(rs,Pe,X,C,z,st,Ye,E,pe.predicate,Pt,gt&&xs?xs:void 0);_i&&_i.placeable&&_t.verticalIconBox?(si=ts(_t.verticalIconBox),Wr=si.placeable):(si=ts(_t.iconBox),Wr=si.placeable),Gn=Gn&&si.offscreen}const es=me||ft.numHorizontalGlyphVertices===0&&ft.numVerticalGlyphVertices===0,Mc=we||ft.numIconVertices===0;es||Mc?Mc?es||(Wr=Wr&&ar):ar=Wr&&ar:Wr=ar=Wr&&ar;const Fd=Wr&&si.placeable;if(ar&&ii.placeable&&this.collisionIndex.insertCollisionBox(ii.box,ae,_.get("text-ignore-placement"),m.bucketInstanceId,_i&&_i.placeable&&sl?sl:Ws,pe.ID),Fd&&this.collisionIndex.insertCollisionBox(si.box,Pe,_.get("icon-ignore-placement"),m.bucketInstanceId,Pc,pe.ID),Zn&&ar&&this.collisionIndex.insertCollisionCircles(Zn.circles,ae,_.get("text-ignore-placement"),m.bucketInstanceId,Ws,pe.ID),p&&this.storeCollisionData(m.bucketInstanceId,Gt,_t,ii,si,Zn),ft.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ft.crossTileID]=new rr(ar||dt,Wr||ct,Gn||m.justReloaded),u[ft.crossTileID]=!0};if(wt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ft=m.getSortedSymbolIndexes(this.transform.angle);for(let _t=ft.length-1;_t>=0;--_t){const Gt=ft[_t];qt(m.symbolInstances.get(Gt),m.collisionArrays[Gt],Gt)}}else for(let ft=r.symbolInstanceStart;ft=0&&(r.text.placedSymbolArray.get(E).crossTileID=_>=0&&E!==_?0:p.crossTileID)}markUsedOrientation(r,u,p){const m=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,_=u===c.ah.vertical?u:0,S=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const E of S)r.text.placedSymbolArray.get(E).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const m=u?u.symbolFadeChange(r):1,_=u?u.opacities:{},S=u?u.variableOffsets:{},E=u?u.placedOrientations:{};for(const C in this.placements){const z=this.placements[C],F=_[C];F?(this.opacities[C]=new rn(F,m,z.text,z.icon),p=p||z.text!==F.text.placed||z.icon!==F.icon.placed):(this.opacities[C]=new rn(null,m,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const C in _){const z=_[C];if(!this.opacities[C]){const F=new rn(z,m,!1,!1);F.isHidden()||(this.opacities[C]=F,p=p||z.text.placed||z.icon.placed)}}for(const C in S)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=S[C]);for(const C in E)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=E[C]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:r)}updateLayerOpacities(r,u){const p={};for(const m of u){const _=m.getBucket(r);_&&m.latestFeatureIndex&&r.id===_.layerIds[0]&&this.updateBucketOpacities(_,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(r,u,p,m){r.hasTextData()&&(r.text.opacityVertexArray.clear(),r.text.hasVisibleVertices=!1),r.hasIconData()&&(r.icon.opacityVertexArray.clear(),r.icon.hasVisibleVertices=!1),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const _=r.layers[0],S=_.layout,E=new rn(null,0,!1,!1,!0),C=S.get("text-allow-overlap"),z=S.get("icon-allow-overlap"),F=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=S.get("text-rotation-alignment")==="map",X=S.get("text-pitch-alignment")==="map",Q=S.get("icon-text-fit")!=="none",re=new rn(null,0,C&&(z||!r.hasIconData()||S.get("icon-optional")),z&&(C||!r.hasTextData()||S.get("text-optional")),!0);!r.collisionArrays&&m&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(m);const ce=(me,we,ae)=>{for(let Ce=0;Ce0,st=this.placedOrientations[we.crossTileID],gt=st===c.ah.vertical,wt=st===c.ah.horizontal||st===c.ah.horizontalOnly;if(ae>0||Ce>0){const ct=Di(ze.text);ce(r.text,ae,gt?Ba:ct),ce(r.text,Ce,wt?Ba:ct);const Pt=ze.text.isHidden();[we.rightJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(r.text.placedSymbolArray.get(_t).hidden=Pt||gt?1:0)}),we.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).hidden=Pt||wt?1:0);const qt=this.variableOffsets[we.crossTileID];qt&&this.markUsedJustification(r,qt.anchor,we,st);const ft=this.placedOrientations[we.crossTileID];ft&&(this.markUsedJustification(r,"left",we,ft),this.markUsedOrientation(r,ft,we))}if(Ye){const ct=Di(ze.icon),Pt=!(Q&&we.verticalPlacedIconSymbolIndex&>);we.placedIconSymbolIndex>=0&&(ce(r.icon,we.numIconVertices,Pt?ct:Ba),r.icon.placedSymbolArray.get(we.placedIconSymbolIndex).hidden=ze.icon.isHidden()),we.verticalPlacedIconSymbolIndex>=0&&(ce(r.icon,we.numVerticalIconVertices,Pt?Ba:ct),r.icon.placedSymbolArray.get(we.verticalPlacedIconSymbolIndex).hidden=ze.icon.isHidden())}const dt=pe&&pe.has(me)?pe.get(me):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ct=r.collisionArrays[me];if(ct){let Pt=new c.P(0,0);if(ct.textBox||ct.verticalTextBox){let qt=!0;if(F){const ft=this.variableOffsets[Pe];ft?(Pt=Bn(ft.anchor,ft.width,ft.height,ft.textOffset,ft.textBoxScale),B&&Pt._rotate(X?this.transform.angle:-this.transform.angle)):qt=!1}if(ct.textBox||ct.verticalTextBox){let ft;ct.textBox&&(ft=gt),ct.verticalTextBox&&(ft=wt),Fa(r.textCollisionBox.collisionVertexArray,ze.text.placed,!qt||ft,dt.text,Pt.x,Pt.y)}}if(ct.iconBox||ct.verticalIconBox){const qt=!!(!wt&&ct.verticalIconBox);let ft;ct.iconBox&&(ft=qt),ct.verticalIconBox&&(ft=!qt),Fa(r.iconCollisionBox.collisionVertexArray,ze.icon.placed,ft,dt.icon,Q?Pt.x:0,Q?Pt.y:0)}}}}if(r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.text.opacityVertexArray.length!==r.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${r.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${r.text.layoutVertexArray.length}) / 4`);if(r.icon.opacityVertexArray.length!==r.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${r.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${r.icon.layoutVertexArray.length}) / 4`);if(r.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=me.invProjMatrix,r.placementViewportMatrix=me.viewportMatrix,r.collisionCircleArray=me.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function Fa(v,r,u,p,m,_){p&&p.length!==0||(p=[0,0,0,0]);const S=p[0]-Qt,E=p[1]-Qt,C=p[2]-Qt,z=p[3]-Qt;v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,z),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,z)}const Ar=Math.pow(2,25),qh=Math.pow(2,24),Yh=Math.pow(2,17),Mi=Math.pow(2,16),Ai=Math.pow(2,9),P_=Math.pow(2,8),Xi=Math.pow(2,1);function Di(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const r=v.placed?1:0,u=Math.floor(127*v.opacity);return u*Ar+r*qh+u*Yh+r*Mi+u*Ai+r*P_+u*Xi+r}const Ba=0;function Ko(){return{isOccluded:(v,r,u)=>!1,getPitchedTextCorrection:(v,r,u)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,r,u,p){throw new Error("Not implemented.")},translatePosition:(v,r,u,p)=>function(m,_,S,E,C=!1){if(!S[0]&&!S[1])return[0,0];const z=C?E==="map"?m.angle:0:E==="viewport"?-m.angle:0;if(z){const F=Math.sin(z),B=Math.cos(z);S=[S[0]*B-S[1]*F,S[0]*F+S[1]*B]}return[C?S[0]:or(_,S[0],m.zoom),C?S[1]:or(_,S[1],m.zoom)]}(v,r,u,p),getCircleRadiusCorrection:v=>1}}class En{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&!r.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(r,u,p,m,_){const S=this._bucketParts;for(;this._currentTileIndexE.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&A.now()-m>2;for(;this._currentPlacementIndex>=0;){const S=u[r[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(S.type==="symbol"&&(!S.minzoom||S.minzoom<=E)&&(!S.maxzoom||S.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new En(S)),this._inProgressLayer.continuePlacement(p[S.source],this.placement,this._showCollisionBoxes,S,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const ms=512/c.X/2;class xn{constructor(r,u,p){this.tileID=r,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let _=0;_({x:Math.floor(C.anchorX*ms),y:Math.floor(C.anchorY*ms)})),crossTileIDs:S.map(C=>C.crossTileID)};if(E.positions.length>128){const C=new c.av(E.positions.length,16,Uint16Array);for(const{x:z,y:F}of E.positions)C.add(z,F);C.finish(),delete E.positions,E.index=C}this._symbolsByKey[_]=E}}getScaledCoordinates(r,u){const{x:p,y:m,z:_}=this.tileID.canonical,{x:S,y:E,z:C}=u.canonical,z=ms/Math.pow(2,C-_),F=(E*c.X+r.anchorY)*z,B=m*c.X*ms;return{x:Math.floor((S*c.X+r.anchorX)*z-p*c.X*ms),y:Math.floor(F-B)}}findMatches(r,u,p){const m=this.tileID.canonical.zr)}}class Ju{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const u=Math.round((r-this.lng)/360);if(u!==0)for(const p in this.indexes){const m=this.indexes[p],_={};for(const S in m){const E=m[S];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+u),_[E.tileID.key]=E}this.indexes[p]=_}this.lng=r}addBucket(r,u,p){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let _=0;_r.overscaledZ)for(const E in S){const C=S[E];C.tileID.isChildOf(r)&&C.findMatches(u.symbolInstances,r,m)}else{const E=S[r.scaledTo(Number(_)).key];E&&E.findMatches(u.symbolInstances,r,m)}}for(let _=0;_{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}const ys=(v,r)=>c.t(v,r&&r.filter(u=>u.identifier!=="source.canvas")),M_=c.aw();class Qu extends c.E{constructor(r,u={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=r,this.dispatcher=new _r(Yt(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new Ue,this.imageManager.setEventedParent(this),this.glyphManager=new ye(r._requestManager,u.localIdeographFontFamily),this.lineAtlas=new mt(256,512),this.crossTileSymbolIndex=new Xh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ay()),vn().on(Ze,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const _=m.getSource();if(_&&_.vectorLayerIds)for(const S in this._layers){const E=this._layers[S];E.source===_.id&&this._validateLayer(E)}})}loadURL(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const m=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;c.h(m,this._loadStyleRequest).then(S=>{this._loadStyleRequest=null,this._load(S.data,u,p)}).catch(S=>{this._loadStyleRequest=null,S&&!_.signal.aborted&&this.fire(new c.j(S))})}loadJSON(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(r,u,p)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(M_,{validate:!1})}_load(r,u,p){var m;const _=u.transformStyle?u.transformStyle(p,r):r;if(!u.validate||!ys(this,c.u(_))){this._loaded=!0,this.stylesheet=_;for(const S in _.sources)this.addSource(S,_.sources[S],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new Xe(this.stylesheet.light),this.sky=new Ee(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const r=c.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of r){const p=c.aA(u);p.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=p}}_loadSprite(r,u=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,S,E,C){return c._(this,void 0,void 0,function*(){const z=Oe(_),F=E>1?"@2x":"",B={},X={};for(const{id:Q,url:re}of z){const ce=S.transformRequest(We(re,F,".json"),"SpriteJSON");B[Q]=c.h(ce,C);const pe=S.transformRequest(We(re,F,".png"),"SpriteImage");X[Q]=q.getImage(pe,C)}return yield Promise.all([...Object.values(B),...Object.values(X)]),function(Q,re){return c._(this,void 0,void 0,function*(){const ce={};for(const pe in Q){ce[pe]={};const me=A.getImageCanvasContext((yield re[pe]).data),we=(yield Q[pe]).data;for(const ae in we){const{width:Ce,height:Pe,x:ze,y:Ye,sdf:st,pixelRatio:gt,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt}=we[ae];ce[pe][ae]={data:null,pixelRatio:gt,sdf:st,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt,spriteData:{width:Ce,height:Pe,x:ze,y:Ye,context:me}}}}return ce})}(B,X)})}(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const S in _){this._spritesImagesIds[S]=[];const E=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter(C=>!(C in _)):[];for(const C of E)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in _[S]){const z=S==="default"?C:`${S}:${C}`;this._spritesImagesIds[S].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,_[S][C],!1):this.imageManager.addImage(z,_[S][C]),u&&(this._changedImages[z]=!0)}}}).catch(_=>{this._spriteRequest=null,m=_,this.fire(new c.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(r){const u=this.sourceCaches[r.source];if(!u)return;const p=r.sourceLayer;if(!p)return;const m=u.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new c.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${r.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,u=!1){const p=this._serializedAllLayers();if(!r||r.length===0)return Object.values(u?c.aB(p):p);const m=[];for(const _ of r)if(p[_]){const S=u?c.aB(p[_]):p[_];m.push(S)}return m}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const u=Object.keys(this._layers);for(const p of u){const m=this._layers[p];m.type!=="custom"&&(r[p]=m.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(r){if(!this._loaded)return;const u=this._changed;if(u){const m=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(m.length||_.length)&&this._updateWorkerLayers(m,_);for(const S in this._updatedSources){const E=this._updatedSources[S];if(E==="reload")this._reloadSource(S);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);this._clearSource(S)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const S in this._updatedPaintProps)this._layers[S].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const _=this.sourceCaches[m];p[m]=_.used,_.used=!1}for(const m of this._order){const _=this._layers[m];_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const m in p){const _=this.sourceCaches[m];!!p[m]!=!!_.used&&_.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,u={}){var p;this._checkLoaded();const m=this.serialize();if(r=u.transformStyle?u.transformStyle(m,r):r,((p=u.validate)===null||p===void 0||p)&&ys(this,c.u(r)))return!1;(r=c.aB(r)).layers=c.az(r.layers);const _=c.aC(m,r),S=this._getOperationsToPerform(_);if(S.unimplemented.length>0)throw new Error(`Unimplemented: ${S.unimplemented.join(", ")}.`);if(S.operations.length===0)return!1;for(const E of S.operations)E();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const u=[],p=[];for(const m of r)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":u.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":u.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":u.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":u.push(()=>{});break;default:p.push(m.command)}return{operations:u,unimplemented:p}}addImage(r,u){if(this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,u),this._afterImageUpdated(r)}updateImage(r,u){this.imageManager.updateImage(r,u)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" does not exist.`)));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,u,p={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.u.source,`sources.${r}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const m=this.sourceCaches[r]=new Ut(r,u,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:r})),m.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new c.j(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));const u=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,u){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error(`There is no source with this ID=${r}`);const p=this.sourceCaches[r].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(u),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,u,p={}){this._checkLoaded();const m=r.id;if(this.getLayer(m))return void this.fire(new c.j(new Error(`Layer "${m}" already exists on this map.`)));let _;if(r.type==="custom"){if(ys(this,c.aD(r)))return;_=c.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(m,r.source),r=c.aB(r),r=c.e(r,{source:m})),this._validate(c.u.layer,`layers.${m}`,r,{arrayIndex:-1},p))return;_=c.aA(r),this._validateLayer(_),_.setEventedParent(this,{layer:{id:m}})}const S=u?this._order.indexOf(u):this._order.length;if(u&&S===-1)this.fire(new c.j(new Error(`Cannot add layer "${m}" before non-existing layer "${u}".`)));else{if(this._order.splice(S,0,m),this._layerOrderChanged=!0,this._layers[m]=_,this._removedLayers[m]&&_.source&&_.type!=="custom"){const E=this._removedLayers[m];delete this._removedLayers[m],E.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(r,u){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new c.j(new Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===u)return;const p=this._order.indexOf(r);this._order.splice(p,1);const m=u?this._order.indexOf(u):this._order.length;u&&m===-1?this.fire(new c.j(new Error(`Cannot move layer "${r}" before non-existing layer "${u}".`))):(this._order.splice(m,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const u=this._layers[r];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${r}".`)));u.setEventedParent(null);const p=this._order.indexOf(r);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=u,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],u.onRemove&&u.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,u,p){this._checkLoaded();const m=this.getLayer(r);m?m.minzoom===u&&m.maxzoom===p||(u!=null&&(m.minzoom=u),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,u,p={}){this._checkLoaded();const m=this.getLayer(r);if(m){if(!c.aE(m.filter,u))return u==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(c.u.filter,`layers.${m.id}.filter`,u,null,p)||(m.filter=c.aB(u),this._updateLayer(m)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${r}".`)))}getFilter(r){return c.aB(this.getLayer(r).filter)}setLayoutProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getLayoutProperty(u),p)||(_.setLayoutProperty(u,p,m),this._updateLayer(_)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,u){const p=this.getLayer(r);if(p)return p.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getPaintProperty(u),p)||(_.setPaintProperty(u,p,m)&&this._updateLayer(_),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getPaintProperty(r,u){return this.getLayer(r).getPaintProperty(u)}setFeatureState(r,u){this._checkLoaded();const p=r.source,m=r.sourceLayer,_=this.sourceCaches[p];if(_===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const S=_.getSource().type;S==="geojson"&&m?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||m?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(m,r.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,u){this._checkLoaded();const p=r.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const _=m.getSource().type,S=_==="vector"?r.sourceLayer:void 0;_!=="vector"||S?u&&typeof r.id!="string"&&typeof r.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(S,r.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const u=r.source,p=r.sourceLayer,m=this.sourceCaches[u];if(m!==void 0)return m.getSource().type!=="vector"||p?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,r.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const r=c.aF(this.sourceCaches,_=>_.serialize()),u=this._serializeByIds(this._order,!0),p=this.map.getTerrain()||void 0,m=this.stylesheet;return c.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:r,layers:u,terrain:p},_=>_!==void 0)}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){const u=S=>this._layers[S].type==="fill-extrusion",p={},m=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E)){p[E]=S;for(const C of r){const z=C[E];if(z)for(const F of z)m.push(F)}}}m.sort((S,E)=>E.intersectionZ-S.intersectionZ);const _=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E))for(let C=m.length-1;C>=0;C--){const z=m[C].feature;if(p[z.layer.id]{const st=me.featureSortOrder;if(st){const gt=st.indexOf(ze.featureIndex);return st.indexOf(Ye.featureIndex)-gt}return Ye.featureIndex-ze.featureIndex});for(const ze of Pe)Ce.push(ze)}}for(const me in re)re[me].forEach(we=>{const ae=we.feature,Ce=z[E[me].source].getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=Ce});return re}(this._layers,S,this.sourceCaches,r,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(r,u){u&&u.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[r];return p?function(m,_){const S=m.getRenderableIds().map(z=>m.getTileByID(z)),E=[],C={};for(let z=0;zX.getTileByID(Q)).sort((Q,re)=>re.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(re.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(F,C[F.source],r.center.lng);S=S||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(A.now(),r.zoom))&&(this.pauseablePlacement=new Zl(r,this.map.terrain,this._order,_,u,p,m,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(A.now()),E=!0),S&&this.pauseablePlacement.placement.setStale()),E||S)for(const z of this._order){const F=this._layers[z];F.type==="symbol"&&this.placement.updateLayerOpacities(F,C[F.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(A.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,u.icons),p})}getGlyphs(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(u.stacks),m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,u={}){this._checkLoaded(),r&&this._validate(c.u.glyphs,"glyphs",r,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,u,p={},m){this._checkLoaded();const _=[{id:r,url:u}],S=[...Oe(this.stylesheet.sprite),..._];this._validate(c.u.sprite,"sprite",S,null,p)||(this.stylesheet.sprite=S,this._loadSprite(_,!0,m))}removeSprite(r){this._checkLoaded();const u=Oe(this.stylesheet.sprite);if(u.find(p=>p.id===r)){if(this._spritesImagesIds[r])for(const p of this._spritesImagesIds[r])this.imageManager.removeImage(p),this._changedImages[p]=!0;u.splice(u.findIndex(p=>p.id===r),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${r}" doesn't exists on this map.`)))}getSprite(){return Oe(this.stylesheet.sprite)}setSprite(r,u={},p){this._checkLoaded(),r&&this._validate(c.u.sprite,"sprite",r,null,u)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,p):(this._unloadSprite(),p&&p(null)))}}var Jo=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Po={prelude:Sr(`#ifdef GL_ES + */(function(e,t){(function(i,o){e.exports=o()})(ff,function(){var i={},o={};function h(g,c,T){if(o[g]=T,g==="index"){var P="var sharedModule = {}; ("+o.shared+")(sharedModule); ("+o.worker+")(sharedModule);",R={};return o.shared(R),o.index(i,R),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([P],{type:"text/javascript"}))),i}}h("shared",["exports"],function(g){function c(s,n,a,d){return new(a||(a=Promise))(function(y,x){function w(I){try{k(d.next(I))}catch(D){x(D)}}function b(I){try{k(d.throw(I))}catch(D){x(D)}}function k(I){var D;I.done?y(I.value):(D=I.value,D instanceof a?D:new a(function(L){L(D)})).then(w,b)}k((d=d.apply(s,n||[])).next())})}function T(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var P=R;function R(s,n){this.x=s,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,n){return this.clone()._rotateAround(s,n)},matMult:function(s){return this.clone()._matMult(s)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var n=s.x-this.x,a=s.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,n){return Math.atan2(this.x*n-this.y*s,this.x*s+this.y*n)},_matMult:function(s){var n=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=n,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var n=Math.cos(s),a=Math.sin(s),d=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=d,this},_rotateAround:function(s,n){var a=Math.cos(s),d=Math.sin(s),y=n.y+d*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-d*(this.y-n.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(s){return s instanceof R?s:Array.isArray(s)?new R(s[0],s[1]):s};var A=T(P),M=N;function N(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}N.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var Y=T(M);let U,te;function O(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function $(){if(te==null&&(te=!1,O())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let d=0;d<5*5;d++){const y=4*d;n.fillStyle=`rgb(${y},${y+1},${y+2})`,n.fillRect(d%5,Math.floor(d/5),1,1)}const a=n.getImageData(0,0,5,5).data;for(let d=0;d<5*5*4;d++)if(d%4!=3&&a[d]!==d){te=!0;break}}}return te||!1}function q(s,n,a,d){const y=new Y(s,n,a,d);return x=>y.solve(x)}const ne=q(.25,.1,.25,1);function oe(s,n,a){return Math.min(a,Math.max(n,s))}function ke(s,n,a){const d=a-n,y=((s-n)%d+d)%d+n;return y===n?a:y}function ge(s,...n){for(const a of n)for(const d in a)s[d]=a[d];return s}let Fe=1;function Oe(s,n,a){const d={};for(const y in s)d[y]=n.call(this,s[y],y,s);return d}function Ge(s,n,a){const d={};for(const y in s)n.call(this,s[y],y,s)&&(d[y]=s[y]);return d}function it(s){return Array.isArray(s)?s.map(it):typeof s=="object"&&s?Oe(s,it):s}const ve={};function je(s){ve[s]||(typeof console<"u"&&console.warn(s),ve[s]=!0)}function H(s,n,a){return(a.y-s.y)*(n.x-s.x)>(n.y-s.y)*(a.x-s.x)}function Re(s){return typeof WorkerGlobalScope<"u"&&s!==void 0&&s instanceof WorkerGlobalScope}let vt=null;function ye(s){return typeof ImageBitmap<"u"&&s instanceof ImageBitmap}const Be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Le(s,n,a,d,y){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(s,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const b=w.startsWith("BGR"),k=new Uint8ClampedArray(d*y*4);if(yield x.copyTo(k,function(I,D,L,j,Z){const K=4*Math.max(-D,0),J=(Math.max(0,L)-L)*j*4+K,le=4*j,fe=Math.max(0,D),De=Math.max(0,L);return{rect:{x:fe,y:De,width:Math.min(I.width,D+j)-fe,height:Math.min(I.height,L+Z)-De},layout:[{offset:J,stride:le}]}}(s,n,a,d,y)),b)for(let I=0;IRe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Yt=function(s,n){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const d=rt(s.url);if(d)return d(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:Jt},n)}if(!(/^file:/.test(a=s.url)||/^file:/.test(Vt())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(d,y){return c(this,void 0,void 0,function*(){const x=new Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,cache:d.cache,referrer:Vt(),signal:y.signal});d.type!=="json"||x.headers.has("Accept")||x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const I=yield w.blob();throw new er(w.status,w.statusText,d.url,I)}let b;b=d.type==="arrayBuffer"||d.type==="image"?w.arrayBuffer():d.type==="json"?w.json():w.text();const k=yield b;if(y.signal.aborted)throw mt();return{data:k,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:Jt},n)}var a;return function(d,y){return new Promise((x,w)=>{var b;const k=new XMLHttpRequest;k.open(d.method||"GET",d.url,!0),d.type!=="arrayBuffer"&&d.type!=="image"||(k.responseType="arraybuffer");for(const I in d.headers)k.setRequestHeader(I,d.headers[I]);d.type==="json"&&(k.responseType="text",!((b=d.headers)===null||b===void 0)&&b.Accept||k.setRequestHeader("Accept","application/json")),k.withCredentials=d.credentials==="include",k.onerror=()=>{w(new Error(k.statusText))},k.onload=()=>{if(!y.signal.aborted)if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let I=k.response;if(d.type==="json")try{I=JSON.parse(k.response)}catch(D){return void w(D)}x({data:I,cacheControl:k.getResponseHeader("Cache-Control"),expires:k.getResponseHeader("Expires")})}else{const I=new Blob([k.response],{type:k.getResponseHeader("Content-Type")});w(new er(k.status,k.statusText,d.url,I))}},y.signal.addEventListener("abort",()=>{k.abort(),w(mt())}),k.send(d.body)})}(s,n)};function _r(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const n=new URL(s),a=window.location;return n.protocol===a.protocol&&n.host===a.host}function fr(s,n,a){a[s]&&a[s].indexOf(n)!==-1||(a[s]=a[s]||[],a[s].push(n))}function br(s,n,a){if(a&&a[s]){const d=a[s].indexOf(n);d!==-1&&a[s].splice(d,1)}}class Xr{constructor(n,a={}){ge(this,a),this.type=n}}class V extends Xr{constructor(n,a={}){super("error",ge({error:n},a))}}class Ue{on(n,a){return this._listeners=this._listeners||{},fr(n,a,this._listeners),this}off(n,a){return br(n,a,this._listeners),br(n,a,this._oneTimeListeners),this}once(n,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fr(n,a,this._oneTimeListeners),this):new Promise(d=>this.once(n,d))}fire(n,a){typeof n=="string"&&(n=new Xr(n,a||{}));const d=n.type;if(this.listens(d)){n.target=this;const y=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const b of y)b.call(this,n);const x=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const b of x)br(d,b,this._oneTimeListeners),b.call(this,n);const w=this._eventedParent;w&&(ge(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(n))}else n instanceof V&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,a){return this._eventedParent=n,this._eventedParentData=a,this}}var ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},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},"*":{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:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},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:"*",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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},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"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};const de=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function se(s,n){const a={};for(const d in s)d!=="ref"&&(a[d]=s[d]);return de.forEach(d=>{d in n&&(a[d]=n[d])}),a}function Te(s,n){if(Array.isArray(s)){if(!Array.isArray(n)||s.length!==n.length)return!1;for(let a=0;a`:s.itemType.kind==="value"?"array":`array<${n}>`}return s.kind}const ee=[pi,Qe,Kt,jt,Kr,fs,mi,G(Xt),ps,Hn,he];function ue(s,n){if(n.kind==="error")return null;if(s.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!ue(s.itemType,n.itemType))&&(typeof s.N!="number"||s.N===n.N))return null}else{if(s.kind===n.kind)return null;if(s.kind==="value"){for(const a of ee)if(!ue(a,n))return null}}return`Expected ${W(s)} but found ${W(n)} instead.`}function Se(s,n){return n.some(a=>a.kind===s.kind)}function Ie(s,n){return n.some(a=>a==="null"?s===null:a==="array"?Array.isArray(s):a==="object"?s&&!Array.isArray(s)&&typeof s=="object":a===typeof s)}function Ae(s,n){return s.kind==="array"&&n.kind==="array"?s.itemType.kind===n.itemType.kind&&typeof s.N=="number":s.kind===n.kind}const _e=.96422,He=.82521,Je=4/29,$e=6/29,ut=3*$e*$e,Rt=$e*$e*$e,Ot=Math.PI/180,mr=180/Math.PI;function Qt(s){return(s%=360)<0&&(s+=360),s}function gr([s,n,a,d]){let y,x;const w=Tn((.2225045*(s=or(s))+.7168786*(n=or(n))+.0606169*(a=or(a)))/1);s===n&&n===a?y=x=w:(y=Tn((.4360747*s+.3850649*n+.1430804*a)/_e),x=Tn((.0139322*s+.0971045*n+.7141733*a)/He));const b=116*w-16;return[b<0?0:b,500*(y-w),200*(w-x),d]}function or(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Tn(s){return s>Rt?Math.pow(s,1/3):s/ut+Je}function rn([s,n,a,d]){let y=(s+16)/116,x=isNaN(n)?y:y+n/500,w=isNaN(a)?y:y-a/200;return y=1*Mr(y),x=_e*Mr(x),w=He*Mr(w),[rr(3.1338561*x-1.6168667*y-.4906146*w),rr(-.9787684*x+1.9161415*y+.033454*w),rr(.0719453*x-.2289914*y+1.4052427*w),d]}function rr(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Mr(s){return s>$e?s*s*s:ut*(s-Je)}function Yr(s){return parseInt(s.padEnd(2,s),16)/255}function Dn(s,n){return Bn(n?s/100:s,0,1)}function Bn(s,n,a){return Math.min(Math.max(n,s),a)}function ni(s){return!s.some(Number.isNaN)}const Fa={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]};class Ar{constructor(n,a,d,y=1,x=!0){this.r=n,this.g=a,this.b=d,this.a=y,x||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[n,a,d,y]))}static parse(n){if(n instanceof Ar)return n;if(typeof n!="string")return;const a=function(d){if((d=d.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Fa[d];if(y){const[w,b,k]=y;return[w/255,b/255,k/255,1]}if(d.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(d)){const w=d.length<6?1:2;let b=1;return[Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+w)||"ff")]}if(d.startsWith("rgb")){const w=d.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[b,k,I,D,L,j,Z,K,J,le,fe,De]=w,be=[D||" ",Z||" ",le].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Me=[I,j,J].join(""),Ve=Me==="%%%"?100:Me===""?255:0;if(Ve){const et=[Bn(+k/Ve,0,1),Bn(+L/Ve,0,1),Bn(+K/Ve,0,1),fe?Dn(+fe,De):1];if(ni(et))return et}}return}}const x=d.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,b,k,I,D,L,j,Z,K]=x,J=[k||" ",D||" ",j].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const le=[+b,Bn(+I,0,100),Bn(+L,0,100),Z?Dn(+Z,K):1];if(ni(le))return function([fe,De,be,Me]){function Ve(et){const xt=(et+fe/30)%12,Nt=De*Math.min(be,1-be);return be-Nt*Math.max(-1,Math.min(xt-3,9-xt,1))}return fe=Qt(fe),De/=100,be/=100,[Ve(0),Ve(8),Ve(4),Me]}(le)}}}(n);return a?new Ar(...a,!1):void 0}get rgb(){const{r:n,g:a,b:d,a:y}=this,x=y||1/0;return this.overwriteGetter("rgb",[n/x,a/x,d/x,y])}get hcl(){return this.overwriteGetter("hcl",function(n){const[a,d,y,x]=gr(n),w=Math.sqrt(d*d+y*y);return[Math.round(1e4*w)?Qt(Math.atan2(y,d)*mr):NaN,w,a,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",gr(this.rgb))}overwriteGetter(n,a){return Object.defineProperty(this,n,{value:a}),a}toString(){const[n,a,d,y]=this.rgb;return`rgba(${[n,a,d].map(x=>Math.round(255*x)).join(",")},${y})`}}Ar.black=new Ar(0,0,0,1),Ar.white=new Ar(1,1,1,1),Ar.transparent=new Ar(0,0,0,0),Ar.red=new Ar(1,0,0,1);class qh{constructor(n,a,d){this.sensitivity=n?a?"variant":"case":a?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,a){return this.collator.compare(n,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yh{constructor(n,a,d,y,x){this.text=n,this.image=a,this.scale=d,this.fontStack=y,this.textColor=x}}class Mi{constructor(n){this.sections=n}static fromString(n){return new Mi([new Yh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof Mi?n:Mi.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class Ai{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Ai)return n;if(typeof n=="number")return new Ai([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const a of n)if(typeof a!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new Ai(n)}}toString(){return JSON.stringify(this.values)}}const P_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xi{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Xi)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let a=0;a=0&&s<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof a=="number"&&a>=0&&a<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,n,a,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,n,a,d]:[s,n,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ko(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Ar||s instanceof qh||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di)return!0;if(Array.isArray(s)){for(const n of s)if(!Ko(n))return!1;return!0}if(typeof s=="object"){for(const n in s)if(!Ko(s[n]))return!1;return!0}return!1}function En(s){if(s===null)return pi;if(typeof s=="string")return Kt;if(typeof s=="boolean")return jt;if(typeof s=="number")return Qe;if(s instanceof Ar)return Kr;if(s instanceof qh)return Yi;if(s instanceof Mi)return fs;if(s instanceof Ai)return ps;if(s instanceof Xi)return he;if(s instanceof Di)return Hn;if(Array.isArray(s)){const n=s.length;let a;for(const d of s){const y=En(d);if(a){if(a===y)continue;a=Xt;break}a=y}return G(a||Xt,n)}return mi}function Zl(s){const n=typeof s;return s===null?"":n==="string"||n==="number"||n==="boolean"?String(s):s instanceof Ar||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di?s.toString():JSON.stringify(s)}class ms{constructor(n,a){this.type=n,this.value=a}static parse(n,a){if(n.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!Ko(n[1]))return a.error("invalid value");const d=n[1];let y=En(d);const x=a.expectedType;return y.kind!=="array"||y.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(y=x),new ms(y,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class xn{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const Qu={string:Kt,number:Qe,boolean:jt,object:mi};class gs{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");let d,y=1;const x=n[0];if(x==="array"){let b,k;if(n.length>2){const I=n[1];if(typeof I!="string"||!(I in Qu)||I==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=Qu[I],y++}else b=Xt;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return a.error('The length argument to "array" must be a positive integer literal',2);k=n[2],y++}d=G(b,k)}else{if(!Qu[x])throw new Error(`Types doesn't contain name = ${x}`);d=Qu[x]}const w=[];for(;yn.outputDefined())}}const Xh={"to-boolean":jt,"to-color":Kr,"to-number":Qe,"to-string":Kt};class ys{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[0];if(!Xh[d])throw new Error(`Can't parse ${d} as it is not part of the known types`);if((d==="to-boolean"||d==="to-string")&&n.length!==2)return a.error("Expected one argument.");const y=Xh[d],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Ba(a[0],a[1],a[2],a[3]),!d))return new Ar(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new xn(d||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const d of this.args){a=d.evaluate(n);const y=Ai.parse(a);if(y)return y}throw new xn(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const d of this.args){a=d.evaluate(n);const y=Xi.parse(a);if(y)return y}throw new xn(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const d of this.args){if(a=d.evaluate(n),a===null)return 0;const y=Number(a);if(!isNaN(y))return y}throw new xn(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Mi.fromString(Zl(this.args[0].evaluate(n)));case"resolvedImage":return Di.fromString(Zl(this.args[0].evaluate(n)));default:return Zl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const M_=["Unknown","Point","LineString","Polygon"];class ec{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?M_[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(n){let a=this._parseColorCache[n];return a||(a=this._parseColorCache[n]=Ar.parse(n)),a}}class Jo{constructor(n,a,d=[],y,x=new vn,w=[]){this.registry=n,this.path=d,this.key=d.map(b=>`[${b}]`).join(""),this.scope=x,this.errors=w,this.expectedType=y,this._isConstant=a}parse(n,a,d,y,x={}){return a?this.concat(a,d,y)._parse(n,x):this._parse(n,x)}_parse(n,a){function d(y,x,w){return w==="assert"?new gs(x,[y]):w==="coerce"?new ys(x,[y]):y}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=n[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[y];if(x){let w=x.parse(n,this);if(!w)return null;if(this.expectedType){const b=this.expectedType,k=w.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||k.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string")if(b.kind!=="padding"||k.kind!=="value"&&k.kind!=="number"&&k.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||k.kind!=="value"&&k.kind!=="array"){if(this.checkSubtype(b,k))return null}else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"assert")}if(!(w instanceof ms)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const b=new ec;try{w=new ms(w.type,w.evaluate(b))}catch(k){return this.error(k.message),null}}return w}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,a,d){const y=typeof n=="number"?this.path.concat(n):this.path,x=d?this.scope.concat(d):this.scope;return new Jo(this.registry,this._isConstant,y,a||null,x,this.errors)}error(n,...a){const d=`${this.key}${a.map(y=>`[${y}]`).join("")}`;this.errors.push(new _n(d,n))}checkSubtype(n,a){const d=ue(n,a);return d&&this.error(d),d}}class Po{constructor(n,a){this.type=a.type,this.bindings=[].concat(n),this.result=a}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const a of this.bindings)n(a[1]);n(this.result)}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const d=[];for(let x=1;x=d.length)throw new xn(`Array index out of bounds: ${a} > ${d.length-1}.`);if(a!==Math.floor(a))throw new xn(`Array index must be an integer, but found ${a} instead.`);return d[a]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class Jh{constructor(n,a){this.type=jt,this.needle=n,this.haystack=a}static parse(n,a){if(n.length!==3)return a.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);return d&&y?Se(d.type,[jt,Kt,Qe,pi,Xt])?new Jh(d,y):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`):null}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!d)return!1;if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);if(!Ie(d,["string","array"]))throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`);return d.indexOf(a)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class Na{constructor(n,a,d){this.type=Qe,this.needle=n,this.haystack=a,this.fromIndex=d}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);if(!d||!y)return null;if(!Se(d.type,[jt,Kt,Qe,pi,Xt]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new Na(d,y,x):null}return new Na(d,y)}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(n)),Ie(d,["string"])){const x=d.indexOf(a,y);return x===-1?-1:[...d.slice(0,x)].length}if(Ie(d,["array"]))return d.indexOf(a,y);throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class Qh{constructor(n,a,d,y,x,w){this.inputType=n,this.type=a,this.input=d,this.cases=y,this.outputs=x,this.otherwise=w}static parse(n,a){if(n.length<5)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return a.error("Expected an even number of arguments.");let d,y;a.expectedType&&a.expectedType.kind!=="value"&&(y=a.expectedType);const x={},w=[];for(let I=2;INumber.MAX_SAFE_INTEGER)return j.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return j.error("Numeric branch labels must be integer values.");if(d){if(j.checkSubtype(d,En(K)))return null}else d=En(K);if(x[String(K)]!==void 0)return j.error("Branch labels must be unique.");x[String(K)]=w.length}const Z=a.parse(L,I,y);if(!Z)return null;y=y||Z.type,w.push(Z)}const b=a.parse(n[1],1,Xt);if(!b)return null;const k=a.parse(n[n.length-1],n.length-1,y);return k?b.type.kind!=="value"&&a.concat(1).checkSubtype(d,b.type)?null:new Qh(d,y,b,x,w,k):null}evaluate(n){const a=this.input.evaluate(n);return(En(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class tc{constructor(n,a,d){this.type=n,this.branches=a,this.otherwise=d}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return a.error("Expected an odd number of arguments.");let d;a.expectedType&&a.expectedType.kind!=="value"&&(d=a.expectedType);const y=[];for(let w=1;wa.outputDefined())&&this.otherwise.outputDefined()}}class ql{constructor(n,a,d,y){this.type=n,this.input=a,this.beginIndex=d,this.endIndex=y}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Qe);if(!d||!y)return null;if(!Se(d.type,[G(Xt),Kt,Xt]))return a.error(`Expected first argument to be of type array or string, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new ql(d.type,d,y,x):null}return new ql(d.type,d,y)}evaluate(n){const a=this.input.evaluate(n),d=this.beginIndex.evaluate(n);let y;if(this.endIndex&&(y=this.endIndex.evaluate(n)),Ie(a,["string"]))return[...a].slice(d,y).join("");if(Ie(a,["array"]))return a.slice(d,y);throw new xn(`Expected first argument to be of type array or string, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function rc(s,n){const a=s.length-1;let d,y,x=0,w=a,b=0;for(;x<=w;)if(b=Math.floor((x+w)/2),d=s[b],y=s[b+1],d<=n){if(b===a||nn))throw new xn("Input is not a number.");w=b-1}return 0}class $a{constructor(n,a,d){this.type=n,this.input=a,this.labels=[],this.outputs=[];for(const[y,x]of d)this.labels.push(y),this.outputs.push(x)}static parse(n,a){if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=[];let x=null;a.expectedType&&a.expectedType.kind!=="value"&&(x=a.expectedType);for(let w=1;w=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);const L=a.parse(k,D,x);if(!L)return null;x=x||L.type,y.push([b,L])}return new $a(x,d,y)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;return y>=a[x-1]?d[x-1].evaluate(n):d[rc(a,y)].evaluate(n)}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Mp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var A_=Ap;function Ap(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}Ap.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var D_=Mp(A_);function Qo(s,n,a){return s+a*(n-s)}function Yl(s,n,a){return s.map((d,y)=>Qo(d,n[y],a))}const gi={number:Qo,color:function(s,n,a,d="rgb"){switch(d){case"rgb":{const[y,x,w,b]=Yl(s.rgb,n.rgb,a);return new Ar(y,x,w,b,!1)}case"hcl":{const[y,x,w,b]=s.hcl,[k,I,D,L]=n.hcl;let j,Z;if(isNaN(y)||isNaN(k))isNaN(y)?isNaN(k)?j=NaN:(j=k,w!==1&&w!==0||(Z=I)):(j=y,D!==1&&D!==0||(Z=x));else{let De=k-y;k>y&&De>180?De-=360:k180&&(De+=360),j=y+a*De}const[K,J,le,fe]=function([De,be,Me,Ve]){return De=isNaN(De)?0:De*Ot,rn([Me,Math.cos(De)*be,Math.sin(De)*be,Ve])}([j,Z??Qo(x,I,a),Qo(w,D,a),Qo(b,L,a)]);return new Ar(K,J,le,fe,!1)}case"lab":{const[y,x,w,b]=rn(Yl(s.lab,n.lab,a));return new Ar(y,x,w,b,!1)}}},array:Yl,padding:function(s,n,a){return new Ai(Yl(s.values,n.values,a))},variableAnchorOffsetCollection:function(s,n,a){const d=s.values,y=n.values;if(d.length!==y.length)throw new xn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${n.toString()}`);const x=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:I}}}if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(x=a.parse(x,2,Qe),!x)return null;const b=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=Kr:a.expectedType&&a.expectedType.kind!=="value"&&(k=a.expectedType);for(let I=0;I=D)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const K=a.parse(L,Z,k);if(!K)return null;k=k||K.type,b.push([D,K])}return Ae(k,Qe)||Ae(k,Kr)||Ae(k,ps)||Ae(k,he)||Ae(k,G(Qe))?new yi(k,d,y,x,b):a.error(`Type ${W(k)} is not interpolatable.`)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;if(y>=a[x-1])return d[x-1].evaluate(n);const w=rc(a,y),b=yi.interpolationFactor(this.interpolation,y,a[w],a[w+1]),k=d[w].evaluate(n),I=d[w+1].evaluate(n);switch(this.operator){case"interpolate":return gi[this.type.kind](k,I,b);case"interpolate-hcl":return gi.color(k,I,b,"hcl");case"interpolate-lab":return gi.color(k,I,b,"lab")}}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function nc(s,n,a,d){const y=d-a,x=s-a;return y===0?0:n===1?x/y:(Math.pow(n,x)-1)/(Math.pow(n,y)-1)}class ic{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expectected at least one argument.");let d=null;const y=a.expectedType;y&&y.kind!=="value"&&(d=y);const x=[];for(const b of n.slice(1)){const k=a.parse(b,1+x.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,x.push(k)}if(!d)throw new Error("No output type");const w=y&&x.some(b=>ue(y,b.type));return new ic(w?Xt:d,x)}evaluate(n){let a,d=null,y=0;for(const x of this.args)if(y++,d=x.evaluate(n),d&&d instanceof Di&&!d.available&&(a||(a=d.name),d=null,y===this.args.length&&(d=a)),d!==null)break;return d}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}function sc(s,n){return s==="=="||s==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function Dp(s,n,a,d){return d.compare(n,a)===0}function ja(s,n,a){const d=s!=="=="&&s!=="!=";return class _P{constructor(x,w,b){this.type=jt,this.lhs=x,this.rhs=w,this.collator=b,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const b=x[0];let k=w.parse(x[1],1,Xt);if(!k)return null;if(!sc(b,k.type))return w.concat(1).error(`"${b}" comparisons are not supported for type '${W(k.type)}'.`);let I=w.parse(x[2],2,Xt);if(!I)return null;if(!sc(b,I.type))return w.concat(2).error(`"${b}" comparisons are not supported for type '${W(I.type)}'.`);if(k.type.kind!==I.type.kind&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error(`Cannot compare types '${W(k.type)}' and '${W(I.type)}'.`);d&&(k.type.kind==="value"&&I.type.kind!=="value"?k=new gs(I.type,[k]):k.type.kind!=="value"&&I.type.kind==="value"&&(I=new gs(k.type,[I])));let D=null;if(x.length===4){if(k.type.kind!=="string"&&I.type.kind!=="string"&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(x[3],3,Yi),!D)return null}return new _P(k,I,D)}evaluate(x){const w=this.lhs.evaluate(x),b=this.rhs.evaluate(x);if(d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!==I.kind||k.kind!=="string"&&k.kind!=="number")throw new xn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${I.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!=="string"||I.kind!=="string")return n(x,w,b)}return this.collator?a(x,w,b,this.collator.evaluate(x)):n(x,w,b)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const z_=ja("==",function(s,n,a){return n===a},Dp),zp=ja("!=",function(s,n,a){return n!==a},function(s,n,a,d){return!Dp(0,n,a,d)}),Rp=ja("<",function(s,n,a){return n",function(s,n,a){return n>a},function(s,n,a,d){return d.compare(n,a)>0}),L_=ja("<=",function(s,n,a){return n<=a},function(s,n,a,d){return d.compare(n,a)<=0}),Lp=ja(">=",function(s,n,a){return n>=a},function(s,n,a,d){return d.compare(n,a)>=0});class Xl{constructor(n,a,d){this.type=Yi,this.locale=d,this.caseSensitive=n,this.diacriticSensitive=a}static parse(n,a){if(n.length!==2)return a.error("Expected one argument.");const d=n[1];if(typeof d!="object"||Array.isArray(d))return a.error("Collator options argument must be an object.");const y=a.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,jt);if(!y)return null;const x=a.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,jt);if(!x)return null;let w=null;return d.locale&&(w=a.parse(d.locale,1,Kt),!w)?null:new Xl(y,x,w)}evaluate(n){return new qh(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}class ed{constructor(n,a,d,y,x){this.type=Kt,this.number=n,this.locale=a,this.currency=d,this.minFractionDigits=y,this.maxFractionDigits=x}static parse(n,a){if(n.length!==3)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=n[2];if(typeof y!="object"||Array.isArray(y))return a.error("NumberFormat options argument must be an object.");let x=null;if(y.locale&&(x=a.parse(y.locale,1,Kt),!x))return null;let w=null;if(y.currency&&(w=a.parse(y.currency,1,Kt),!w))return null;let b=null;if(y["min-fraction-digits"]&&(b=a.parse(y["min-fraction-digits"],1,Qe),!b))return null;let k=null;return y["max-fraction-digits"]&&(k=a.parse(y["max-fraction-digits"],1,Qe),!k)?null:new ed(d,x,w,b,k)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class oc{constructor(n){this.type=fs,this.sections=n}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[1];if(!Array.isArray(d)&&typeof d=="object")return a.error("First argument must be an image or text section.");const y=[];let x=!1;for(let w=1;w<=n.length-1;++w){const b=n[w];if(x&&typeof b=="object"&&!Array.isArray(b)){x=!1;let k=null;if(b["font-scale"]&&(k=a.parse(b["font-scale"],1,Qe),!k))return null;let I=null;if(b["text-font"]&&(I=a.parse(b["text-font"],1,G(Kt)),!I))return null;let D=null;if(b["text-color"]&&(D=a.parse(b["text-color"],1,Kr),!D))return null;const L=y[y.length-1];L.scale=k,L.font=I,L.textColor=D}else{const k=a.parse(n[w],1,Xt);if(!k)return null;const I=k.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,y.push({content:k,scale:null,font:null,textColor:null})}}return new oc(y)}evaluate(n){return new Mi(this.sections.map(a=>{const d=a.content.evaluate(n);return En(d)===Hn?new Yh("",d,null,null,null):new Yh(Zl(d),null,a.scale?a.scale.evaluate(n):null,a.font?a.font.evaluate(n).join(","):null,a.textColor?a.textColor.evaluate(n):null)}))}eachChild(n){for(const a of this.sections)n(a.content),a.scale&&n(a.scale),a.font&&n(a.font),a.textColor&&n(a.textColor)}outputDefined(){return!1}}class td{constructor(n){this.type=Hn,this.input=n}static parse(n,a){if(n.length!==2)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Kt);return d?new td(d):a.error("No image name provided.")}evaluate(n){const a=this.input.evaluate(n),d=Di.fromString(a);return d&&n.availableImages&&(d.available=n.availableImages.indexOf(a)>-1),d}eachChild(n){n(this.input)}outputDefined(){return!1}}class rd{constructor(n){this.type=Qe,this.input=n}static parse(n,a){if(n.length!==2)return a.error(`Expected 1 argument, but found ${n.length-1} instead.`);const d=a.parse(n[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${W(d.type)} instead.`):new rd(d):null}evaluate(n){const a=this.input.evaluate(n);if(typeof a=="string")return[...a].length;if(Array.isArray(a))return a.length;throw new xn(`Expected value to be of type string or array, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const Us=8192;function O_(s,n){const a=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,y=Math.pow(2,n.z);return[Math.round(a*y*Us),Math.round(d*y*Us)]}function nd(s,n){const a=Math.pow(2,n.z);return[(y=(s[0]/Us+n.x)/a,360*y-180),(d=(s[1]/Us+n.y)/a,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,y}function ea(s,n){s[0]=Math.min(s[0],n[0]),s[1]=Math.min(s[1],n[1]),s[2]=Math.max(s[2],n[0]),s[3]=Math.max(s[3],n[1])}function Mo(s,n){return!(s[0]<=n[0]||s[2]>=n[2]||s[1]<=n[1]||s[3]>=n[3])}function Er(s,n,a){const d=s[0]-n[0],y=s[1]-n[1],x=s[0]-a[0],w=s[1]-a[1];return d*w-x*y==0&&d*x<=0&&y*w<=0}function ac(s,n,a,d){return(y=[d[0]-a[0],d[1]-a[1]])[0]*(x=[n[0]-s[0],n[1]-s[1]])[1]-y[1]*x[0]!=0&&!(!Fp(s,n,a,d)||!Fp(a,d,s,n));var y,x}function F_(s,n,a){for(const d of a)for(let y=0;y(y=s)[1]!=(w=b[k+1])[1]>y[1]&&y[0]<(w[0]-x[0])*(y[1]-x[1])/(w[1]-x[1])+x[0]&&(d=!d)}var y,x,w;return d}function B_(s,n){for(const a of n)if(Ua(s,a))return!0;return!1}function Op(s,n){for(const a of s)if(!Ua(a,n))return!1;for(let a=0;a0&&b<0||w<0&&b>0}function id(s,n,a){const d=[];for(let y=0;ya[2]){const y=.5*d;let x=s[0]-a[0]>y?-d:a[0]-s[0]>y?d:0;x===0&&(x=s[0]-a[2]>y?-d:a[2]-s[0]>y?d:0),s[0]+=x}ea(n,s)}function $p(s,n,a,d){const y=Math.pow(2,d.z)*Us,x=[d.x*Us,d.y*Us],w=[];for(const b of s)for(const k of b){const I=[k.x+x[0],k.y+x[1]];Np(I,n,a,y),w.push(I)}return w}function jp(s,n,a,d){const y=Math.pow(2,d.z)*Us,x=[d.x*Us,d.y*Us],w=[];for(const k of s){const I=[];for(const D of k){const L=[D.x+x[0],D.y+x[1]];ea(n,L),I.push(L)}w.push(I)}if(n[2]-n[0]<=y/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const k of w)for(const I of k)Np(I,n,a,y)}var b;return w}class ta{constructor(n,a){this.type=jt,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection"){const y=[];for(const x of d.features){const{type:w,coordinates:b}=x.geometry;w==="Polygon"&&y.push(b),w==="MultiPolygon"&&y.push(...b)}if(y.length)return new ta(d,{type:"MultiPolygon",coordinates:y})}else if(d.type==="Feature"){const y=d.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new ta(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new ta(d,d)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!Ua(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!B_(I,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=jp(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!Op(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=jp(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!N_(I,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Up=class{constructor(s=[],n=(a,d)=>ad?1:0){if(this.data=s,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:n,compare:a}=this,d=n[s];for(;s>0;){const y=s-1>>1,x=n[y];if(a(d,x)>=0)break;n[s]=x,s=y}n[s]=d}_down(s){const{data:n,compare:a}=this,d=this.length>>1,y=n[s];for(;s=0)break;n[s]=n[x],s=x}n[s]=y}};function $_(s,n,a,d,y){Vp(s,n,a,d||s.length-1,y||j_)}function Vp(s,n,a,d,y){for(;d>a;){if(d-a>600){var x=d-a+1,w=n-a+1,b=Math.log(x),k=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*k*(x-k)/x)*(w-x/2<0?-1:1);Vp(s,n,Math.max(a,Math.floor(n-w*k/x+I)),Math.min(d,Math.floor(n+(x-w)*k/x+I)),y)}var D=s[n],L=a,j=d;for(Kl(s,a,n),y(s[d],D)>0&&Kl(s,a,d);L0;)j--}y(s[a],D)===0?Kl(s,a,j):Kl(s,++j,d),j<=n&&(a=j+1),n<=j&&(d=j-1)}}function Kl(s,n,a){var d=s[n];s[n]=s[a],s[a]=d}function j_(s,n){return sn?1:0}function lc(s,n){if(s.length<=1)return[s];const a=[];let d,y;for(const x of s){const w=V_(x);w!==0&&(x.area=Math.abs(w),y===void 0&&(y=w<0),y===w<0?(d&&a.push(d),d=[x]):d.push(x))}if(d&&a.push(d),n>1)for(let x=0;x1?(I=n[k+1][0],D=n[k+1][1]):Z>0&&(I+=L/this.kx*Z,D+=j/this.ky*Z)),L=this.wrap(a[0]-I)*this.kx,j=(a[1]-D)*this.ky;const K=L*L+j*j;K180;)n-=360;return n}}function Zp(s,n){return n[0]-s[0]}function uc(s){return s[1]-s[0]+1}function ao(s,n){return s[1]>=s[0]&&s[1]s[1])return[null,null];const a=uc(s);if(n){if(a===2)return[s,null];const y=Math.floor(a/2);return[[s[0],s[0]+y],[s[0]+y,s[1]]]}if(a===1)return[s,null];const d=Math.floor(a/2)-1;return[[s[0],s[0]+d],[s[0]+d+1,s[1]]]}function ad(s,n){if(!ao(n,s.length))return[1/0,1/0,-1/0,-1/0];const a=[1/0,1/0,-1/0,-1/0];for(let d=n[0];d<=n[1];++d)ea(a,s[d]);return a}function ld(s){const n=[1/0,1/0,-1/0,-1/0];for(const a of s)for(const d of a)ea(n,d);return n}function cc(s){return s[0]!==-1/0&&s[1]!==-1/0&&s[2]!==1/0&&s[3]!==1/0}function ud(s,n,a){if(!cc(s)||!cc(n))return NaN;let d=0,y=0;return s[2]n[2]&&(d=s[0]-n[2]),s[1]>n[3]&&(y=s[1]-n[3]),s[3]=d)return d;if(Mo(y,x)){if(hc(s,n))return 0}else if(hc(n,s))return 0;let w=1/0;for(const b of s)for(let k=0,I=b.length,D=I-1;k0;){const k=w.pop();if(k[0]>=x)continue;const I=k[1],D=n?50:100;if(uc(I)<=D){if(!ao(I,s.length))return NaN;if(n){const L=ir(s,I,a,d);if(isNaN(L)||L===0)return L;x=Math.min(x,L)}else for(let L=I[0];L<=I[1];++L){const j=W_(s[L],a,d);if(x=Math.min(x,j),x===0)return 0}}else{const L=od(I,n);Rr(w,x,d,s,b,L[0]),Rr(w,x,d,s,b,L[1])}}return x}function Ql(s,n,a,d,y,x=1/0){let w=Math.min(x,y.distance(s[0],a[0]));if(w===0)return w;const b=new Up([[0,[0,s.length-1],[0,a.length-1]]],Zp);for(;b.length>0;){const k=b.pop();if(k[0]>=w)continue;const I=k[1],D=k[2],L=n?50:100,j=d?50:100;if(uc(I)<=L&&uc(D)<=j){if(!ao(I,s.length)&&ao(D,a.length))return NaN;let Z;if(n&&d)Z=H_(s,I,a,D,y),w=Math.min(w,Z);else if(n&&!d){const K=s.slice(I[0],I[1]+1);for(let J=D[0];J<=D[1];++J)if(Z=ra(a[J],K,y),w=Math.min(w,Z),w===0)return w}else if(!n&&d){const K=a.slice(D[0],D[1]+1);for(let J=I[0];J<=I[1];++J)if(Z=ra(s[J],K,y),w=Math.min(w,Z),w===0)return w}else Z=fn(s,I,a,D,y),w=Math.min(w,Z)}else{const Z=od(I,n),K=od(D,d);na(b,w,y,s,a,Z[0],K[0]),na(b,w,y,s,a,Z[0],K[1]),na(b,w,y,s,a,Z[1],K[0]),na(b,w,y,s,a,Z[1],K[1])}}return w}function hd(s){return s.type==="MultiPolygon"?s.coordinates.map(n=>({type:"Polygon",coordinates:n})):s.type==="MultiLineString"?s.coordinates.map(n=>({type:"LineString",coordinates:n})):s.type==="MultiPoint"?s.coordinates.map(n=>({type:"Point",coordinates:n})):[s]}class ia{constructor(n,a){this.type=Qe,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'distance' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection")return new ia(d,d.features.map(y=>hd(y.geometry)).flat());if(d.type==="Feature")return new ia(d,hd(d.geometry));if("type"in d&&"coordinates"in d)return new ia(d,hd(d))}return a.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!1,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!1,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!1,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!0,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!0,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!0,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="Polygon")return function(a,d){const y=a.geometry();if(y.length===0||y[0].length===0)return NaN;const x=lc(y,0).map(k=>k.map(I=>I.map(D=>nd([D.x,D.y],a.canonical)))),w=new sd(x[0][0][0][1]);let b=1/0;for(const k of d)for(const I of x){switch(k.type){case"Point":b=Math.min(b,Jl([k.coordinates],!1,I,w,b));break;case"LineString":b=Math.min(b,Jl(k.coordinates,!0,I,w,b));break;case"Polygon":b=Math.min(b,Nr(I,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Va={"==":z_,"!=":zp,">":R_,"<":Rp,">=":Lp,"<=":L_,array:gs,at:Kh,boolean:gs,case:tc,coalesce:ic,collator:Xl,format:oc,image:td,in:Jh,"index-of":Na,interpolate:yi,"interpolate-hcl":yi,"interpolate-lab":yi,length:rd,let:Po,literal:ms,match:Qh,number:gs,"number-format":ed,object:gs,slice:ql,step:$a,string:gs,"to-boolean":ys,"to-color":ys,"to-number":ys,"to-string":ys,var:Sr,within:ta,distance:ia};class Ki{constructor(n,a,d,y){this.name=n,this.type=a,this._evaluate=d,this.args=y}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,a){const d=n[0],y=Ki.definitions[d];if(!y)return a.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(y)?y[0]:y.type,w=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,b=w.filter(([I])=>!Array.isArray(I)||I.length===n.length-1);let k=null;for(const[I,D]of b){k=new Jo(a.registry,eu,a.path,null,a.scope);const L=[];let j=!1;for(let Z=1;Z{return j=L,Array.isArray(j)?`(${j.map(W).join(", ")})`:`(${W(j.type)}...)`;var j}).join(" | "),D=[];for(let L=1;L{a=n?a&&eu(d):a&&d instanceof ms}),!!a&&tu(s)&&ru(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function tu(s){if(s instanceof Ki&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ta||s instanceof ia)return!1;let n=!0;return s.eachChild(a=>{n&&!tu(a)&&(n=!1)}),n}function Ha(s){if(s instanceof Ki&&s.name==="feature-state")return!1;let n=!0;return s.eachChild(a=>{n&&!Ha(a)&&(n=!1)}),n}function ru(s,n){if(s instanceof Ki&&n.indexOf(s.name)>=0)return!1;let a=!0;return s.eachChild(d=>{a&&!ru(d,n)&&(a=!1)}),a}function dc(s){return{result:"success",value:s}}function Wa(s){return{result:"error",value:s}}function Ga(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function qp(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function md(s){return!!s.expression&&s.expression.interpolated}function vr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function fc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function G_(s){return s}function Yp(s,n){const a=n.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",y=d||!(d||s.property!==void 0),x=s.type||(md(n)?"exponential":"interval");if(a||n.type==="padding"){const D=a?Ar.parse:Ai.parse;(s=tn({},s)).stops&&(s.stops=s.stops.map(L=>[L[0],D(L[1])])),s.default=D(s.default?s.default:n.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let b,k,I;if(x==="exponential")b=Kp;else if(x==="interval")b=pc;else if(x==="categorical"){b=Xp,k=Object.create(null);for(const D of s.stops)k[D[0]]=D[1];I=typeof s.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);b=Jp}if(d){const D={},L=[];for(let K=0;KK[0]),evaluate:({zoom:K},J)=>Kp({stops:j,base:s.base},n,K).evaluate(K,J)}}if(y){const D=x==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:yi.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(L=>L[0]),evaluate:({zoom:L})=>b(s,n,L,k,I)}}return{kind:"source",evaluate(D,L){const j=L&&L.properties?L.properties[s.property]:void 0;return j===void 0?Za(s.default,n.default):b(s,n,j,k,I)}}}function Za(s,n,a){return s!==void 0?s:n!==void 0?n:a!==void 0?a:void 0}function Xp(s,n,a,d,y){return Za(typeof a===y?d[a]:void 0,s.default,n.default)}function pc(s,n,a){if(vr(a)!=="number")return Za(s.default,n.default);const d=s.stops.length;if(d===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[d-1][0])return s.stops[d-1][1];const y=rc(s.stops.map(x=>x[0]),a);return s.stops[y][1]}function Kp(s,n,a){const d=s.base!==void 0?s.base:1;if(vr(a)!=="number")return Za(s.default,n.default);const y=s.stops.length;if(y===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[y-1][0])return s.stops[y-1][1];const x=rc(s.stops.map(D=>D[0]),a),w=function(D,L,j,Z){const K=Z-j,J=D-j;return K===0?0:L===1?J/K:(Math.pow(L,J)-1)/(Math.pow(L,K)-1)}(a,d,s.stops[x][0],s.stops[x+1][0]),b=s.stops[x][1],k=s.stops[x+1][1],I=gi[n.type]||G_;return typeof b.evaluate=="function"?{evaluate(...D){const L=b.evaluate.apply(void 0,D),j=k.evaluate.apply(void 0,D);if(L!==void 0&&j!==void 0)return I(L,j,w,s.colorSpace)}}:I(b,k,w,s.colorSpace)}function Jp(s,n,a){switch(n.type){case"color":a=Ar.parse(a);break;case"formatted":a=Mi.fromString(a.toString());break;case"resolvedImage":a=Di.fromString(a.toString());break;case"padding":a=Ai.parse(a);break;default:vr(a)===n.type||n.type==="enum"&&n.values[a]||(a=void 0)}return Za(a,s.default,n.default)}Ki.register(Va,{error:[{kind:"error"},[Kt],(s,[n])=>{throw new xn(n.evaluate(s))}],typeof:[Kt,[Xt],(s,[n])=>W(En(n.evaluate(s)))],"to-rgba":[G(Qe,4),[Kr],(s,[n])=>{const[a,d,y,x]=n.evaluate(s).rgb;return[255*a,255*d,255*y,x]}],rgb:[Kr,[Qe,Qe,Qe],dd],rgba:[Kr,[Qe,Qe,Qe,Qe],dd],has:{type:jt,overloads:[[[Kt],(s,[n])=>fd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>fd(n.evaluate(s),a.evaluate(s))]]},get:{type:Xt,overloads:[[[Kt],(s,[n])=>pd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>pd(n.evaluate(s),a.evaluate(s))]]},"feature-state":[Xt,[Kt],(s,[n])=>pd(n.evaluate(s),s.featureState||{})],properties:[mi,[],s=>s.properties()],"geometry-type":[Kt,[],s=>s.geometryType()],id:[Xt,[],s=>s.id()],zoom:[Qe,[],s=>s.globals.zoom],"heatmap-density":[Qe,[],s=>s.globals.heatmapDensity||0],"line-progress":[Qe,[],s=>s.globals.lineProgress||0],accumulated:[Xt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Qe,sa(Qe),(s,n)=>{let a=0;for(const d of n)a+=d.evaluate(s);return a}],"*":[Qe,sa(Qe),(s,n)=>{let a=1;for(const d of n)a*=d.evaluate(s);return a}],"-":{type:Qe,overloads:[[[Qe,Qe],(s,[n,a])=>n.evaluate(s)-a.evaluate(s)],[[Qe],(s,[n])=>-n.evaluate(s)]]},"/":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)/a.evaluate(s)],"%":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)%a.evaluate(s)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(s,[n,a])=>Math.pow(n.evaluate(s),a.evaluate(s))],sqrt:[Qe,[Qe],(s,[n])=>Math.sqrt(n.evaluate(s))],log10:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN10],ln:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))],log2:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN2],sin:[Qe,[Qe],(s,[n])=>Math.sin(n.evaluate(s))],cos:[Qe,[Qe],(s,[n])=>Math.cos(n.evaluate(s))],tan:[Qe,[Qe],(s,[n])=>Math.tan(n.evaluate(s))],asin:[Qe,[Qe],(s,[n])=>Math.asin(n.evaluate(s))],acos:[Qe,[Qe],(s,[n])=>Math.acos(n.evaluate(s))],atan:[Qe,[Qe],(s,[n])=>Math.atan(n.evaluate(s))],min:[Qe,sa(Qe),(s,n)=>Math.min(...n.map(a=>a.evaluate(s)))],max:[Qe,sa(Qe),(s,n)=>Math.max(...n.map(a=>a.evaluate(s)))],abs:[Qe,[Qe],(s,[n])=>Math.abs(n.evaluate(s))],round:[Qe,[Qe],(s,[n])=>{const a=n.evaluate(s);return a<0?-Math.round(-a):Math.round(a)}],floor:[Qe,[Qe],(s,[n])=>Math.floor(n.evaluate(s))],ceil:[Qe,[Qe],(s,[n])=>Math.ceil(n.evaluate(s))],"filter-==":[jt,[Kt,Xt],(s,[n,a])=>s.properties()[n.value]===a.value],"filter-id-==":[jt,[Xt],(s,[n])=>s.id()===n.value],"filter-type-==":[jt,[Kt],(s,[n])=>s.geometryType()===n.value],"filter-<":[jt,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d{const a=s.id(),d=n.value;return typeof a==typeof d&&a":[jt,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>y}],"filter-id->":[jt,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>d}],"filter-<=":[jt,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d<=y}],"filter-id-<=":[jt,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a<=d}],"filter->=":[jt,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>=y}],"filter-id->=":[jt,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>=d}],"filter-has":[jt,[Xt],(s,[n])=>n.value in s.properties()],"filter-has-id":[jt,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[jt,[G(Kt)],(s,[n])=>n.value.indexOf(s.geometryType())>=0],"filter-id-in":[jt,[G(Xt)],(s,[n])=>n.value.indexOf(s.id())>=0],"filter-in-small":[jt,[Kt,G(Xt)],(s,[n,a])=>a.value.indexOf(s.properties()[n.value])>=0],"filter-in-large":[jt,[Kt,G(Xt)],(s,[n,a])=>function(d,y,x,w){for(;x<=w;){const b=x+w>>1;if(y[b]===d)return!0;y[b]>d?w=b-1:x=b+1}return!1}(s.properties()[n.value],a.value,0,a.value.length-1)],all:{type:jt,overloads:[[[jt,jt],(s,[n,a])=>n.evaluate(s)&&a.evaluate(s)],[sa(jt),(s,n)=>{for(const a of n)if(!a.evaluate(s))return!1;return!0}]]},any:{type:jt,overloads:[[[jt,jt],(s,[n,a])=>n.evaluate(s)||a.evaluate(s)],[sa(jt),(s,n)=>{for(const a of n)if(a.evaluate(s))return!0;return!1}]]},"!":[jt,[jt],(s,[n])=>!n.evaluate(s)],"is-supported-script":[jt,[Kt],(s,[n])=>{const a=s.globals&&s.globals.isSupportedScript;return!a||a(n.evaluate(s))}],upcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toUpperCase()],downcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toLowerCase()],concat:[Kt,sa(Xt),(s,n)=>n.map(a=>Zl(a.evaluate(s))).join("")],"resolved-locale":[Kt,[Yi],(s,[n])=>n.evaluate(s).resolvedLocale()]});class mc{constructor(n,a){var d;this.expression=n,this._warningHistory={},this._evaluator=new ec,this._defaultValue=a?(d=a).type==="color"&&fc(d.default)?new Ar(0,0,0,0):d.type==="color"?Ar.parse(d.default)||null:d.type==="padding"?Ai.parse(d.default)||null:d.type==="variableAnchorOffsetCollection"?Xi.parse(d.default)||null:d.default===void 0?null:d.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._evaluator.globals=n,this._evaluator.feature=a,this._evaluator.featureState=d,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(n,a,d,y,x,w){this._evaluator.globals=n,this._evaluator.feature=a||null,this._evaluator.featureState=d||null,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new xn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function gc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Va}function qa(s,n){const a=new Jo(Va,eu,[],n?function(y){const x={color:Kr,string:Kt,number:Qe,enum:Kt,boolean:jt,formatted:fs,padding:ps,resolvedImage:Hn,variableAnchorOffsetCollection:he};return y.type==="array"?G(x[y.value]||Xt,y.length):x[y.type]}(n):void 0),d=a.parse(s,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?dc(new mc(d,n)):Wa(a.errors)}class Ya{constructor(n,a){this.kind=n,this._styleExpression=a,this.isStateDependent=n!=="constant"&&!Ha(a.expression)}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}}class Xa{constructor(n,a,d,y){this.kind=n,this.zoomStops=d,this._styleExpression=a,this.isStateDependent=n!=="camera"&&!Ha(a.expression),this.interpolationType=y}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}interpolationFactor(n,a,d){return this.interpolationType?yi.interpolationFactor(this.interpolationType,n,a,d):0}}function gd(s,n){const a=qa(s,n);if(a.result==="error")return a;const d=a.value.expression,y=tu(d);if(!y&&!Ga(n))return Wa([new _n("","data expressions not supported")]);const x=ru(d,["zoom"]);if(!x&&!qp(n))return Wa([new _n("","zoom expressions not supported")]);const w=nu(d);return w||x?w instanceof _n?Wa([w]):w instanceof yi&&!md(n)?Wa([new _n("",'"interpolate" expressions cannot be used with this property')]):dc(w?new Xa(y?"camera":"composite",a.value,w.labels,w instanceof yi?w.interpolation:void 0):new Ya(y?"constant":"source",a.value)):Wa([new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ka{constructor(n,a){this._parameters=n,this._specification=a,tn(this,Yp(this._parameters,this._specification))}static deserialize(n){return new Ka(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function nu(s){let n=null;if(s instanceof Po)n=nu(s.result);else if(s instanceof ic){for(const a of s.args)if(n=nu(a),n)break}else(s instanceof $a||s instanceof yi)&&s.input instanceof Ki&&s.input.name==="zoom"&&(n=s);return n instanceof _n||s.eachChild(a=>{const d=nu(a);d instanceof _n?n=d:!n&&d?n=new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&d&&n!==d&&(n=new _n("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function yc(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const n of s.slice(1))if(!yc(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const _c={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yd(s){if(s==null)return{filter:()=>!0,needGeometry:!1};yc(s)||(s=vc(s));const n=qa(s,_c);if(n.result==="error")throw new Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,d,y)=>n.value.evaluate(a,d,{},y),needGeometry:Qp(s)}}function Z_(s,n){return sn?1:0}function Qp(s){if(!Array.isArray(s))return!1;if(s[0]==="within"||s[0]==="distance")return!0;for(let n=1;n"||n==="<="||n===">="?_d(s[1],s[2],n):n==="any"?(a=s.slice(1),["any"].concat(a.map(vc))):n==="all"?["all"].concat(s.slice(1).map(vc)):n==="none"?["all"].concat(s.slice(1).map(vc).map(Wn)):n==="in"?iu(s[1],s.slice(2)):n==="!in"?Wn(iu(s[1],s.slice(2))):n==="has"?su(s[1]):n!=="!has"||Wn(su(s[1]));var a}function _d(s,n,a){switch(s){case"$type":return[`filter-type-${a}`,n];case"$id":return[`filter-id-${a}`,n];default:return[`filter-${a}`,s,n]}}function iu(s,n){if(n.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(a=>typeof a!=typeof n[0])?["filter-in-large",s,["literal",n.sort(Z_)]]:["filter-in-small",s,["literal",n]]}}function su(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Wn(s){return["!",s]}function oa(s){const n=typeof s;if(n==="number"||n==="boolean"||n==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let y="[";for(const x of s)y+=`${oa(x)},`;return`${y}]`}const a=Object.keys(s).sort();let d="{";for(let y=0;yd.maximum?[new qe(n,a,`${a} is greater than the maximum value ${d.maximum}`)]:[]}function xc(s){const n=s.valueSpec,a=pn(s.value.type);let d,y,x,w={};const b=a!=="categorical"&&s.value.property===void 0,k=!b,I=vr(s.value.stops)==="array"&&vr(s.value.stops[0])==="array"&&vr(s.value.stops[0][0])==="object",D=zi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(Z){if(a==="identity")return[new qe(Z.key,Z.value,'identity function may not have a "stops" property')];let K=[];const J=Z.value;return K=K.concat(ou({key:Z.key,value:J,valueSpec:Z.valueSpec,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,arrayElementValidator:L})),vr(J)==="array"&&J.length===0&&K.push(new qe(Z.key,J,"array must have at least one stop")),K},default:function(Z){return Z.validateSpec({key:Z.key,value:Z.value,valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec})}}});return a==="identity"&&b&&D.push(new qe(s.key,s.value,'missing required property "property"')),a==="identity"||s.value.stops||D.push(new qe(s.key,s.value,'missing required property "stops"')),a==="exponential"&&s.valueSpec.expression&&!md(s.valueSpec)&&D.push(new qe(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!Ga(s.valueSpec)?D.push(new qe(s.key,s.value,"property functions not supported")):b&&!qp(s.valueSpec)&&D.push(new qe(s.key,s.value,"zoom functions not supported"))),a!=="categorical"&&!I||s.value.property!==void 0||D.push(new qe(s.key,s.value,'"property" property is required')),D;function L(Z){let K=[];const J=Z.value,le=Z.key;if(vr(J)!=="array")return[new qe(le,J,`array expected, ${vr(J)} found`)];if(J.length!==2)return[new qe(le,J,`array length 2 expected, length ${J.length} found`)];if(I){if(vr(J[0])!=="object")return[new qe(le,J,`object expected, ${vr(J[0])} found`)];if(J[0].zoom===void 0)return[new qe(le,J,"object stop key must have zoom")];if(J[0].value===void 0)return[new qe(le,J,"object stop key must have value")];if(x&&x>pn(J[0].zoom))return[new qe(le,J[0].zoom,"stop zoom values must appear in ascending order")];pn(J[0].zoom)!==x&&(x=pn(J[0].zoom),y=void 0,w={}),K=K.concat(zi({key:`${le}[0]`,value:J[0],valueSpec:{zoom:{}},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{zoom:vd,value:j}}))}else K=K.concat(j({key:`${le}[0]`,value:J[0],valueSpec:{},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec},J));return gc(_s(J[1]))?K.concat([new qe(`${le}[1]`,J[1],"expressions are not allowed in function stops.")]):K.concat(Z.validateSpec({key:`${le}[1]`,value:J[1],valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec}))}function j(Z,K){const J=vr(Z.value),le=pn(Z.value),fe=Z.value!==null?Z.value:K;if(d){if(J!==d)return[new qe(Z.key,fe,`${J} stop domain type must match previous stop domain type ${d}`)]}else d=J;if(J!=="number"&&J!=="string"&&J!=="boolean")return[new qe(Z.key,fe,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&a!=="categorical"){let De=`number expected, ${J} found`;return Ga(n)&&a===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new qe(Z.key,fe,De)]}return a!=="categorical"||J!=="number"||isFinite(le)&&Math.floor(le)===le?a!=="categorical"&&J==="number"&&y!==void 0&&lenew qe(`${s.key}${d.key}`,s.value,d.message));const a=n.value.expression||n.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!a.outputDefined())return[new qe(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ha(a))return[new qe(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Ha(a))return[new qe(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!ru(a,["zoom","feature-state"]))return[new qe(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!tu(a))return[new qe(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lo(s){const n=s.key,a=s.value,d=s.valueSpec,y=[];return Array.isArray(d.values)?d.values.indexOf(pn(a))===-1&&y.push(new qe(n,a,`expected one of [${d.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(d.values).indexOf(pn(a))===-1&&y.push(new qe(n,a,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(a)} found`)),y}function xd(s){return yc(_s(s.value))?Ja(tn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):wc(s)}function wc(s){const n=s.value,a=s.key;if(vr(n)!=="array")return[new qe(a,n,`array expected, ${vr(n)} found`)];const d=s.styleSpec;let y,x=[];if(n.length<1)return[new qe(a,n,"filter array must have at least 1 element")];switch(x=x.concat(lo({key:`${a}[0]`,value:n[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),pn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&pn(n[1])==="$type"&&x.push(new qe(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&x.push(new qe(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(y=vr(n[1]),y!=="string"&&x.push(new qe(`${a}[1]`,n[1],`string expected, ${y} found`)));for(let w=2;w{I in a&&n.push(new qe(d,a[I],`"${I}" is prohibited for ref layers`))}),y.layers.forEach(I=>{pn(I.id)===b&&(k=I)}),k?k.ref?n.push(new qe(d,a.ref,"ref cannot reference another ref layer")):w=pn(k.type):n.push(new qe(d,a.ref,`ref layer "${b}" not found`))}else if(w!=="background")if(a.source){const k=y.sources&&y.sources[a.source],I=k&&pn(k.type);k?I==="vector"&&w==="raster"?n.push(new qe(d,a.source,`layer "${a.id}" requires a raster source`)):I!=="raster-dem"&&w==="hillshade"?n.push(new qe(d,a.source,`layer "${a.id}" requires a raster-dem source`)):I==="raster"&&w!=="raster"?n.push(new qe(d,a.source,`layer "${a.id}" requires a vector source`)):I!=="vector"||a["source-layer"]?I==="raster-dem"&&w!=="hillshade"?n.push(new qe(d,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!a.paint||!a.paint["line-gradient"]||I==="geojson"&&k.lineMetrics||n.push(new qe(d,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new qe(d,a,`layer "${a.id}" must specify a "source-layer"`)):n.push(new qe(d,a.source,`source "${a.source}" not found`))}else n.push(new qe(d,a,'missing required property "source"'));return n=n.concat(zi({key:d,value:a,valueSpec:x.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${d}.type`,value:a.type,valueSpec:x.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:a,objectKey:"type"}),filter:xd,layout:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>bd(tn({layerType:w},I))}}),paint:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>bc(tn({layerType:w},I))}})}})),n}function aa(s){const n=s.value,a=s.key,d=vr(n);return d!=="string"?[new qe(a,n,`string expected, ${d} found`)]:[]}const Sc={promoteId:function({key:s,value:n}){if(vr(n)==="string")return aa({key:s,value:n});{const a=[];for(const d in n)a.push(...aa({key:`${s}.${d}`,value:n[d]}));return a}}};function au(s){const n=s.value,a=s.key,d=s.styleSpec,y=s.style,x=s.validateSpec;if(!n.type)return[new qe(a,n,'"type" is required')];const w=pn(n.type);let b;switch(w){case"vector":case"raster":return b=zi({key:a,value:n,valueSpec:d[`source_${w.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:Sc,validateSpec:x}),b;case"raster-dem":return b=function(k){var I;const D=(I=k.sourceName)!==null&&I!==void 0?I:"",L=k.value,j=k.styleSpec,Z=j.source_raster_dem,K=k.style;let J=[];const le=vr(L);if(L===void 0)return J;if(le!=="object")return J.push(new qe("source_raster_dem",L,`object expected, ${le} found`)),J;const fe=pn(L.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],be=k.value.encoding?`"${k.value.encoding}"`:"Default";for(const Me in L)!fe&&De.includes(Me)?J.push(new qe(Me,L[Me],`In "${D}": "${Me}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):Z[Me]?J=J.concat(k.validateSpec({key:Me,value:L[Me],valueSpec:Z[Me],validateSpec:k.validateSpec,style:K,styleSpec:j})):J.push(new qe(Me,L[Me],`unknown property "${Me}"`));return J}({sourceName:a,value:n,style:s.style,styleSpec:d,validateSpec:x}),b;case"geojson":if(b=zi({key:a,value:n,valueSpec:d.source_geojson,style:y,styleSpec:d,validateSpec:x,objectElementValidators:Sc}),n.cluster)for(const k in n.clusterProperties){const[I,D]=n.clusterProperties[k],L=typeof I=="string"?[I,["accumulated"],["get",k]]:I;b.push(...Ja({key:`${a}.${k}.map`,value:D,validateSpec:x,expressionContext:"cluster-map"})),b.push(...Ja({key:`${a}.${k}.reduce`,value:L,validateSpec:x,expressionContext:"cluster-reduce"}))}return b;case"video":return zi({key:a,value:n,valueSpec:d.source_video,style:y,validateSpec:x,styleSpec:d});case"image":return zi({key:a,value:n,valueSpec:d.source_image,style:y,validateSpec:x,styleSpec:d});case"canvas":return[new qe(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return lo({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:x,styleSpec:d})}}function kd(s){const n=s.value,a=s.styleSpec,d=a.light,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new qe("light",n,`object expected, ${w} found`)]),x;for(const b in n){const k=b.match(/^(.*)-transition$/);x=x.concat(k&&d[k[1]]&&d[k[1]].transition?s.validateSpec({key:b,value:n[b],valueSpec:a.transition,validateSpec:s.validateSpec,style:y,styleSpec:a}):d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new qe(b,n[b],`unknown property "${b}"`)])}return x}function Td(s){const n=s.value,a=s.styleSpec,d=a.sky,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new qe("sky",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new qe(b,n[b],`unknown property "${b}"`)]);return w}function Ed(s){const n=s.value,a=s.styleSpec,d=a.terrain,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new qe("terrain",n,`object expected, ${w} found`)]),x;for(const b in n)x=x.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new qe(b,n[b],`unknown property "${b}"`)]);return x}function Cd(s){let n=[];const a=s.value,d=s.key;if(Array.isArray(a)){const y=[],x=[];for(const w in a)a[w].id&&y.includes(a[w].id)&&n.push(new qe(d,a,`all the sprites' ids must be unique, but ${a[w].id} is duplicated`)),y.push(a[w].id),a[w].url&&x.includes(a[w].url)&&n.push(new qe(d,a,`all the sprites' URLs must be unique, but ${a[w].url} is duplicated`)),x.push(a[w].url),n=n.concat(zi({key:`${d}[${w}]`,value:a[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return n}return aa({key:d,value:a})}const kc={"*":()=>[],array:ou,boolean:function(s){const n=s.value,a=s.key,d=vr(n);return d!=="boolean"?[new qe(a,n,`boolean expected, ${d} found`)]:[]},number:vd,color:function(s){const n=s.key,a=s.value,d=vr(a);return d!=="string"?[new qe(n,a,`color expected, ${d} found`)]:Ar.parse(String(a))?[]:[new qe(n,a,`color expected, "${a}" found`)]},constants:tm,enum:lo,filter:xd,function:xc,layer:Sd,object:zi,source:au,light:kd,sky:Td,terrain:Ed,projection:function(s){const n=s.value,a=s.styleSpec,d=a.projection,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new qe("projection",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new qe(b,n[b],`unknown property "${b}"`)]);return w},string:aa,formatted:function(s){return aa(s).length===0?[]:Ja(s)},resolvedImage:function(s){return aa(s).length===0?[]:Ja(s)},padding:function(s){const n=s.key,a=s.value;if(vr(a)==="array"){if(a.length<1||a.length>4)return[new qe(n,a,`padding requires 1 to 4 values; ${a.length} values found`)];const d={type:"number"};let y=[];for(let x=0;x[]}})),s.constants&&(a=a.concat(tm({key:"constants",value:s.constants,style:s,styleSpec:n,validateSpec:Qa}))),Id(a)}function Vs(s){return function(n){return s({...n,validateSpec:Qa})}}function Id(s){return[].concat(s).sort((n,a)=>n.line-a.line)}function vs(s){return function(...n){return Id(s.apply(this,n))}}Ji.source=vs(Vs(au)),Ji.sprite=vs(Vs(Cd)),Ji.glyphs=vs(Vs(rm)),Ji.light=vs(Vs(kd)),Ji.sky=vs(Vs(Td)),Ji.terrain=vs(Vs(Ed)),Ji.layer=vs(Vs(Sd)),Ji.filter=vs(Vs(xd)),Ji.paintProperty=vs(Vs(bc)),Ji.layoutProperty=vs(Vs(bd));const la=Ji,q_=la.light,Y_=la.sky,nm=la.paintProperty,im=la.layoutProperty;function Pd(s,n){let a=!1;if(n&&n.length)for(const d of n)s.fire(new V(new Error(d.message))),a=!0;return a}class el{constructor(n,a,d){const y=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const w=new Int32Array(this.arrayBuffer);n=w[0],this.d=(a=w[1])+2*(d=w[2]);for(let k=0;k=L[K+0]&&y>=L[K+1])?(b[Z]=!0,w.push(D[Z])):b[Z]=!1}}}}_forEachCell(n,a,d,y,x,w,b,k){const I=this._convertToCellCoord(n),D=this._convertToCellCoord(a),L=this._convertToCellCoord(d),j=this._convertToCellCoord(y);for(let Z=I;Z<=L;Z++)for(let K=D;K<=j;K++){const J=this.d*K+Z;if((!k||k(this._convertFromCellCoord(Z),this._convertFromCellCoord(K),this._convertFromCellCoord(Z+1),this._convertFromCellCoord(K+1)))&&x.call(this,n,a,d,y,J,w,b,k))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,a=3+this.cells.length+1+1;let d=0;for(let w=0;w=0)continue;const w=s[x];y[x]=Qi[a].shallow.indexOf(x)>=0?w:tl(w,n)}s instanceof Error&&(y.message=s.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(y.$name=a),y}function rl(s){if(sm(s))return s;if(Array.isArray(s))return s.map(rl);if(typeof s!="object")throw new Error("can't deserialize object of type "+typeof s);const n=Md(s)||"Object";if(!Qi[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:a}=Qi[n];if(!a)throw new Error(`can't deserialize unregistered class ${n}`);if(a.deserialize)return a.deserialize(s);const d=Object.create(a.prototype);for(const y of Object.keys(s)){if(y==="$name")continue;const x=s[y];d[y]=Qi[n].shallow.indexOf(y)>=0?x:rl(x)}return d}class Ad{constructor(){this.first=!0}update(n,a){const d=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=d,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=d,!0):(this.lastFloorZoom>d?(this.lastIntegerZoom=d+1,this.lastIntegerZoomTime=a):this.lastFloorZooms>=128&&s<=255,"Hangul Jamo":s=>s>=4352&&s<=4607,Khmer:s=>s>=6016&&s<=6143,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Katakana:s=>s>=12448&&s<=12543,Kanbun:s=>s>=12688&&s<=12703,"CJK Strokes":s=>s>=12736&&s<=12783,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"Private Use Area":s=>s>=57344&&s<=63743,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Dd(s){for(const n of s)if(Rd(n.charCodeAt(0)))return!0;return!1}function X_(s){for(const n of s)if(!nl(n.charCodeAt(0)))return!1;return!0}function zd(s){const n=s.map(a=>{try{return new RegExp(`\\p{sc=${a}}`,"u").source}catch{return null}}).filter(a=>a);return new RegExp(n.join("|"),"u")}const K_=zd(["Arab","Dupl","Mong","Ougr","Syrc"]);function nl(s){return!K_.test(String.fromCodePoint(s))}const om=zd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Rd(s){return!(s!==746&&s!==747&&(s<4352||!(ur["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ur["CJK Compatibility"](s)||ur["CJK Strokes"](s)||!(!ur["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ur["Enclosed CJK Letters and Months"](s)||ur["Ideographic Description Characters"](s)||ur.Kanbun(s)||ur.Katakana(s)&&s!==12540||!(!ur["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ur["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ur["Vertical Forms"](s)||ur["Yijing Hexagram Symbols"](s)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(s))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(s))||om.test(String.fromCodePoint(s)))))}function am(s){return!(Rd(s)||function(n){return!!(ur["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||ur["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||ur["Letterlike Symbols"](n)||ur["Number Forms"](n)||ur["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||ur["Control Pictures"](n)&&n!==9251||ur["Optical Character Recognition"](n)||ur["Enclosed Alphanumerics"](n)||ur["Geometric Shapes"](n)||ur["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||ur["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||ur["CJK Symbols and Punctuation"](n)||ur.Katakana(n)||ur["Private Use Area"](n)||ur["CJK Compatibility Forms"](n)||ur["Small Form Variants"](n)||ur["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(s))}const J_=zd(["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 Ld(s){return J_.test(String.fromCodePoint(s))}function Q_(s,n){return!(!n&&Ld(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ur.Khmer(s))}function e0(s){for(const n of s)if(Ld(n.charCodeAt(0)))return!0;return!1}const Ri=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vr{constructor(n,a){this.zoom=n,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ad,this.transition={})}isSupportedScript(n){return function(a,d){for(const y of a)if(!Q_(y.charCodeAt(0),d))return!1;return!0}(n,Ri.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,a=n-Math.floor(n),d=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*d}:{fromScale:.5,toScale:1,t:1-(1-d)*a}}}class il{constructor(n,a){this.property=n,this.value=a,this.expression=function(d,y){if(fc(d))return new Ka(d,y);if(gc(d)){const x=gd(d,y);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=d;return y.type==="color"&&typeof d=="string"?x=Ar.parse(d):y.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(d)&&(x=Xi.parse(d)):x=Ai.parse(d),{kind:"constant",evaluate:()=>x}}}(a===void 0?n.specification.default:a,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,a,d){return this.property.possiblyEvaluate(this,n,a,d)}}class Ec{constructor(n){this.property=n,this.value=new il(n,void 0)}transitioned(n,a){return new lm(this.property,this.value,a,ge({},n.transition,this.transition),n.now)}untransitioned(){return new lm(this.property,this.value,null,{},0)}}class Cc{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return it(this._values[n].value.value)}setValue(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Ec(this._values[n].property)),this._values[n].value=new il(this._values[n].property,a===null?void 0:it(a))}getTransition(n){return it(this._values[n].transition)}setTransition(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Ec(this._values[n].property)),this._values[n].transition=it(a)||void 0}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d);const y=this.getTransition(a);y!==void 0&&(n[`${a}-transition`]=y)}return n}transitioned(n,a){const d=new lu(this._properties);for(const y of Object.keys(this._values))d._values[y]=this._values[y].transitioned(n,a._values[y]);return d}untransitioned(){const n=new lu(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].untransitioned();return n}}class lm{constructor(n,a,d,y,x){this.property=n,this.value=a,this.begin=x+y.delay||0,this.end=this.begin+y.duration||0,n.specification.transition&&(y.delay||y.duration)&&(this.prior=d)}possiblyEvaluate(n,a,d){const y=n.now||0,x=this.value.possiblyEvaluate(n,a,d),w=this.prior;if(w){if(y>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(y=1)return 1;const I=k*k,D=I*k;return 4*(k<.5?D:3*(k-I)+D-.75)}(b))}}return x}}class lu{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class uu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return it(this._values[n].value)}setValue(n,a){this._values[n]=new il(this._values[n].property,a===null?void 0:it(a))}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d)}return n}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}}class Hs{constructor(n,a,d){this.property=n,this.value=a,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,a,d,y){return this.property.evaluate(this.value,this.parameters,n,a,d,y)}}class cu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class It{constructor(n){this.specification=n}possiblyEvaluate(n,a){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(a)}interpolate(n,a,d){const y=gi[this.specification.type];return y?y(n,a,d):n}}class Ut{constructor(n,a){this.specification=n,this.overrides=a}possiblyEvaluate(n,a,d,y){return new Hs(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(a,null,{},d,y)}:n.expression,a)}interpolate(n,a,d){if(n.value.kind!=="constant"||a.value.kind!=="constant")return n;if(n.value.value===void 0||a.value.value===void 0)return new Hs(this,{kind:"constant",value:void 0},n.parameters);const y=gi[this.specification.type];if(y){const x=y(n.value.value,a.value.value,d);return new Hs(this,{kind:"constant",value:x},n.parameters)}return n}evaluate(n,a,d,y,x,w){return n.kind==="constant"?n.value:n.evaluate(a,d,y,x,w)}}class Ic extends Ut{possiblyEvaluate(n,a,d,y){if(n.value===void 0)return new Hs(this,{kind:"constant",value:void 0},a);if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y),w=n.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,b=this._calculate(w,w,w,a);return new Hs(this,{kind:"constant",value:b},a)}if(n.expression.kind==="camera"){const x=this._calculate(n.expression.evaluate({zoom:a.zoom-1}),n.expression.evaluate({zoom:a.zoom}),n.expression.evaluate({zoom:a.zoom+1}),a);return new Hs(this,{kind:"constant",value:x},a)}return new Hs(this,n.expression,a)}evaluate(n,a,d,y,x,w){if(n.kind==="source"){const b=n.evaluate(a,d,y,x,w);return this._calculate(b,b,b,a)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(a.zoom)-1},d,y),n.evaluate({zoom:Math.floor(a.zoom)},d,y),n.evaluate({zoom:Math.floor(a.zoom)+1},d,y),a):n.value}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Pc{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){if(n.value!==void 0){if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y);return this._calculate(x,x,x,a)}return this._calculate(n.expression.evaluate(new Vr(Math.floor(a.zoom-1),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom+1),a)),a)}}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Od{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){return!!n.expression.evaluate(a,null,{},d,y)}interpolate(){return!1}}class v{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in n){const d=n[a];d.specification.overridable&&this.overridableProperties.push(a);const y=this.defaultPropertyValues[a]=new il(d,void 0),x=this.defaultTransitionablePropertyValues[a]=new Ec(d);this.defaultTransitioningPropertyValues[a]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",Ut),St("DataConstantProperty",It),St("CrossFadedDataDrivenProperty",Ic),St("CrossFadedProperty",Pc),St("ColorRampProperty",Od);const r="-transition";class u extends Ue{constructor(n,a){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),a.layout&&(this._unevaluatedLayout=new uu(a.layout)),a.paint)){this._transitionablePaint=new Cc(a.paint);for(const d in n.paint)this.setPaintProperty(d,n.paint[d],{validate:!1});for(const d in n.layout)this.setLayoutProperty(d,n.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new cu(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,a,d={}){a!=null&&this._validate(im,`layers.${this.id}.layout.${n}`,n,a,d)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,a):this.visibility=a)}getPaintProperty(n){return n.endsWith(r)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,a,d={}){if(a!=null&&this._validate(nm,`layers.${this.id}.paint.${n}`,n,a,d))return!1;if(n.endsWith(r))return this._transitionablePaint.setTransition(n.slice(0,-11),a||void 0),!1;{const y=this._transitionablePaint._values[n],x=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),b=y.value;this._transitionablePaint.setValue(n,a),this._handleSpecialPaintPropertyUpdate(n);const k=this._transitionablePaint._values[n].value;return k.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(n,b,k)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,a,d){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,a){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,a)}serialize(){const n={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),Ge(n,(a,d)=>!(a===void 0||d==="layout"&&!Object.keys(a).length||d==="paint"&&!Object.keys(a).length))}_validate(n,a,d,y,x={}){return(!x||x.validate!==!1)&&Pd(this,n.call(la,{key:a,layerType:this.type,objectKey:d,value:y,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const a=this.paint.get(n);if(a instanceof Hs&&Ga(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(n,a){this._structArray=n,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,a){return n._trim(),a&&(n.isTransferred=!0,a.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const a=Object.create(this.prototype);return a.arrayBuffer=n.arrayBuffer,a.length=n.length,a.capacity=n.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function S(s,n=1){let a=0,d=0;return{members:s.map(y=>{const x=p[y.type].BYTES_PER_ELEMENT,w=a=E(a,Math.max(n,x)),b=y.components||1;return d=Math.max(d,x),a+=x*b,{name:y.name,type:y.type,components:b,offset:w}}),size:E(a,Math.max(d,n)),alignment:n}}function E(s,n){return Math.ceil(s/n)*n}class C extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.int16[y+0]=a,this.int16[y+1]=d,n}}C.prototype.bytesPerElement=4,St("StructArrayLayout2i4",C);class z extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.int16[x+0]=a,this.int16[x+1]=d,this.int16[x+2]=y,n}}z.prototype.bytesPerElement=6,St("StructArrayLayout3i6",z);class F extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.int16[w+0]=a,this.int16[w+1]=d,this.int16[w+2]=y,this.int16[w+3]=x,n}}F.prototype.bytesPerElement=8,St("StructArrayLayout4i8",F);class B extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}B.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",B);class X extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=4*n,I=8*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.uint8[I+4]=y,this.uint8[I+5]=x,this.uint8[I+6]=w,this.uint8[I+7]=b,n}}X.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",X);class Q extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.float32[y+0]=a,this.float32[y+1]=d,n}}Q.prototype.bytesPerElement=8,St("StructArrayLayout2f8",Q);class re extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D){const L=this.length;return this.resize(L+1),this.emplace(L,n,a,d,y,x,w,b,k,I,D)}emplace(n,a,d,y,x,w,b,k,I,D,L){const j=10*n;return this.uint16[j+0]=a,this.uint16[j+1]=d,this.uint16[j+2]=y,this.uint16[j+3]=x,this.uint16[j+4]=w,this.uint16[j+5]=b,this.uint16[j+6]=k,this.uint16[j+7]=I,this.uint16[j+8]=D,this.uint16[j+9]=L,n}}re.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",re);class ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D,L,j){const Z=this.length;return this.resize(Z+1),this.emplace(Z,n,a,d,y,x,w,b,k,I,D,L,j)}emplace(n,a,d,y,x,w,b,k,I,D,L,j,Z){const K=12*n;return this.int16[K+0]=a,this.int16[K+1]=d,this.int16[K+2]=y,this.int16[K+3]=x,this.uint16[K+4]=w,this.uint16[K+5]=b,this.uint16[K+6]=k,this.uint16[K+7]=I,this.int16[K+8]=D,this.int16[K+9]=L,this.int16[K+10]=j,this.int16[K+11]=Z,n}}ce.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",ce);class pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.float32[x+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}pe.prototype.bytesPerElement=12,St("StructArrayLayout3f12",pe);class me extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint32[1*n+0]=a,n}}me.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",me);class we extends _{_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(n,a,d,y,x,w,b,k,I){const D=this.length;return this.resize(D+1),this.emplace(D,n,a,d,y,x,w,b,k,I)}emplace(n,a,d,y,x,w,b,k,I,D){const L=10*n,j=5*n;return this.int16[L+0]=a,this.int16[L+1]=d,this.int16[L+2]=y,this.int16[L+3]=x,this.int16[L+4]=w,this.int16[L+5]=b,this.uint32[j+3]=k,this.uint16[L+8]=I,this.uint16[L+9]=D,n}}we.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",we);class ae extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}ae.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",ae);class Ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x){const w=this.length;return this.resize(w+1),this.emplace(w,n,a,d,y,x)}emplace(n,a,d,y,x,w){const b=4*n,k=8*n;return this.float32[b+0]=a,this.float32[b+1]=d,this.float32[b+2]=y,this.int16[k+6]=x,this.int16[k+7]=w,n}}Ce.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ce);class Pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=16*n,I=4*n,D=8*n;return this.uint8[k+0]=a,this.uint8[k+1]=d,this.float32[I+1]=y,this.float32[I+2]=x,this.int16[D+6]=w,this.int16[D+7]=b,n}}Pe.prototype.bytesPerElement=16,St("StructArrayLayout2ub2f2i16",Pe);class ze extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[x+0]=a,this.uint16[x+1]=d,this.uint16[x+2]=y,n}}ze.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",ze);class Xe extends _{_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(n,a,d,y,x,w,b,k,I,D,L,j,Z,K,J,le,fe){const De=this.length;return this.resize(De+1),this.emplace(De,n,a,d,y,x,w,b,k,I,D,L,j,Z,K,J,le,fe)}emplace(n,a,d,y,x,w,b,k,I,D,L,j,Z,K,J,le,fe,De){const be=24*n,Me=12*n,Ve=48*n;return this.int16[be+0]=a,this.int16[be+1]=d,this.uint16[be+2]=y,this.uint16[be+3]=x,this.uint32[Me+2]=w,this.uint32[Me+3]=b,this.uint32[Me+4]=k,this.uint16[be+10]=I,this.uint16[be+11]=D,this.uint16[be+12]=L,this.float32[Me+7]=j,this.float32[Me+8]=Z,this.uint8[Ve+36]=K,this.uint8[Ve+37]=J,this.uint8[Ve+38]=le,this.uint32[Me+10]=fe,this.int16[be+22]=De,n}}Xe.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Xe);class st extends _{_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(n,a,d,y,x,w,b,k,I,D,L,j,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt){const bt=this.length;return this.resize(bt+1),this.emplace(bt,n,a,d,y,x,w,b,k,I,D,L,j,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt)}emplace(n,a,d,y,x,w,b,k,I,D,L,j,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt,bt){const Ye=32*n,Dt=16*n;return this.int16[Ye+0]=a,this.int16[Ye+1]=d,this.int16[Ye+2]=y,this.int16[Ye+3]=x,this.int16[Ye+4]=w,this.int16[Ye+5]=b,this.int16[Ye+6]=k,this.int16[Ye+7]=I,this.uint16[Ye+8]=D,this.uint16[Ye+9]=L,this.uint16[Ye+10]=j,this.uint16[Ye+11]=Z,this.uint16[Ye+12]=K,this.uint16[Ye+13]=J,this.uint16[Ye+14]=le,this.uint16[Ye+15]=fe,this.uint16[Ye+16]=De,this.uint16[Ye+17]=be,this.uint16[Ye+18]=Me,this.uint16[Ye+19]=Ve,this.uint16[Ye+20]=et,this.uint16[Ye+21]=xt,this.uint16[Ye+22]=Nt,this.uint32[Dt+12]=yt,this.float32[Dt+13]=pt,this.float32[Dt+14]=At,this.uint16[Ye+30]=Tt,this.uint16[Ye+31]=bt,n}}st.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",st);class gt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.float32[1*n+0]=a,n}}gt.prototype.bytesPerElement=4,St("StructArrayLayout1f4",gt);class wt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[6*n+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}wt.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",wt);class dt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=4*n;return this.uint32[2*n+0]=a,this.uint16[x+2]=d,this.uint16[x+3]=y,n}}dt.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",dt);class ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.uint16[y+0]=a,this.uint16[y+1]=d,n}}ct.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",ct);class Pt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint16[1*n+0]=a,n}}Pt.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Pt);class qt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.float32[w+0]=a,this.float32[w+1]=d,this.float32[w+2]=y,this.float32[w+3]=x,n}}qt.prototype.bytesPerElement=16,St("StructArrayLayout4f16",qt);class ft extends m{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 A(this.anchorPointX,this.anchorPointY)}}ft.prototype.size=20;class _t extends we{get(n){return new ft(this,n)}}St("CollisionBoxArray",_t);class Gt extends m{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Gt.prototype.size=48;class Hr extends Xe{get(n){return new Gt(this,n)}}St("PlacedSymbolArray",Hr);class tr extends m{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(n){this._structArray.uint32[this._pos4+12]=n}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]}}tr.prototype.size=64;class ar extends st{get(n){return new tr(this,n)}}St("SymbolInstanceArray",ar);class Wr extends gt{getoffsetX(n){return this.float32[1*n+0]}}St("GlyphOffsetArray",Wr);class Gn extends z{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}St("SymbolLineVertexArray",Gn);class xs extends m{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]}}xs.prototype.size=12;class Gr extends wt{get(n){return new xs(this,n)}}St("TextAnchorOffsetArray",Gr);class _i extends m{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]}}_i.prototype.size=8;class ii extends dt{get(n){return new _i(this,n)}}St("FeatureIndexArray",ii);class Zn extends C{}class si extends C{}class Ws extends C{}class sl extends B{}class Mc extends X{}class ol extends Q{}class es extends re{}class Ac extends ce{}class Fd extends pe{}class ts extends me{}class rs extends ae{}class Ao extends Pe{}class ws extends ze{}class Nn extends ct{}const qn=S([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=qn;class cr{constructor(n=[]){this.segments=n}prepareSegment(n,a,d,y){let x=this.segments[this.segments.length-1];return n>cr.MAX_VERTEX_ARRAY_LENGTH&&je(`Max vertices per segment is ${cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!x||x.vertexLength+n>cr.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==y)&&(x={vertexOffset:a.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},y!==void 0&&(x.sortKey=y),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const n of this.segments)for(const a in n.vaos)n.vaos[a].destroy()}static simpleSegment(n,a,d,y){return new cr([{vertexOffset:n,primitiveOffset:a,vertexLength:d,primitiveLength:y,vaos:{},sortKey:0}])}}function ua(s,n){return 256*(s=oe(Math.floor(s),0,255))+oe(Math.floor(n),0,255)}cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",cr);const al=S([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ll={exports:{}},um={exports:{}};um.exports=function(s,n){var a,d,y,x,w,b,k,I;for(d=s.length-(a=3&s.length),y=n,w=3432918353,b=461845907,I=0;I>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(k=0,a){case 3:k^=(255&s.charCodeAt(I+2))<<16;case 2:k^=(255&s.charCodeAt(I+1))<<8;case 1:y^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(I)))*w+(((k>>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295}return y^=s.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var t0=um.exports,cm={exports:{}};cm.exports=function(s,n){for(var a,d=s.length,y=n^d,x=0;d>=4;)a=1540483477*(65535&(a=255&s.charCodeAt(x)|(255&s.charCodeAt(++x))<<8|(255&s.charCodeAt(++x))<<16|(255&s.charCodeAt(++x))<<24))+((1540483477*(a>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),d-=4,++x;switch(d){case 3:y^=(255&s.charCodeAt(x+2))<<16;case 2:y^=(255&s.charCodeAt(x+1))<<8;case 1:y=1540483477*(65535&(y^=255&s.charCodeAt(x)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var Do=t0,hm=cm.exports;ll.exports=Do,ll.exports.murmur3=Do,ll.exports.murmur2=hm;var Dc=T(ll.exports);class hu{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,a,d,y){this.ids.push(zc(n)),this.positions.push(a,d,y)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=zc(n);let d=0,y=this.ids.length-1;for(;d>1;this.ids[w]>=a?y=w:d=w+1}const x=[];for(;this.ids[d]===a;)x.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return x}static serialize(n,a){const d=new Float64Array(n.ids),y=new Uint32Array(n.positions);return Rc(d,y,0,d.length-1),a&&a.push(d.buffer,y.buffer),{ids:d,positions:y}}static deserialize(n){const a=new hu;return a.ids=n.ids,a.positions=n.positions,a.indexed=!0,a}}function zc(s){const n=+s;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:Dc(String(s))}function Rc(s,n,a,d){for(;a>1];let x=a-1,w=d+1;for(;;){do x++;while(s[x]y);if(x>=w)break;ul(s,x,w),ul(n,3*x,3*w),ul(n,3*x+1,3*w+1),ul(n,3*x+2,3*w+2)}w-a`u_${y}`),this.type=d}setUniform(n,a,d){n.set(d.constantOr(this.value))}getBinding(n,a,d){return this.type==="color"?new _b(n,a):new dm(n,a)}}class Lc{constructor(n,a){this.uniformNames=a.map(d=>`u_${d}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=n.tlbr}setUniform(n,a,d,y){const x=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&n.set(x)}getBinding(n,a,d){return d.substr(0,9)==="u_pattern"?new yb(n,a):new dm(n,a)}}class ca{constructor(n,a,d,y){this.expression=n,this.type=d,this.maxValue=0,this.paintVertexAttributes=a.map(x=>({name:`a_${x}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(n,a,d,y,x){const w=this.paintVertexArray.length,b=this.expression.evaluate(new Vr(0),a,{},y,[],x);this.paintVertexArray.resize(n),this._setPaintValue(w,n,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:0},d,y);this._setPaintValue(n,a,x)}_setPaintValue(n,a,d){if(this.type==="color"){const y=r0(d);for(let x=n;x`u_${b}_t`),this.type=d,this.useIntegerZoom=y,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(n,a,d,y,x){const w=this.expression.evaluate(new Vr(this.zoom),a,{},y,[],x),b=this.expression.evaluate(new Vr(this.zoom+1),a,{},y,[],x),k=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(k,n,w,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:this.zoom},d,y),w=this.expression.evaluate({zoom:this.zoom+1},d,y);this._setPaintValue(n,a,x,w)}_setPaintValue(n,a,d,y){if(this.type==="color"){const x=r0(d),w=r0(y);for(let b=n;b`#define HAS_UNIFORM_${y}`))}return n}getBinderAttributes(){const n=[];for(const a in this.binders){const d=this.binders[a];if(d instanceof ca||d instanceof uo)for(let y=0;y!0){this.programConfigurations={};for(const y of n)this.programConfigurations[y.id]=new vb(y,a,d);this.needsUpload=!1,this._featureMap=new hu,this._bufferOffset=0}populatePaintArrays(n,a,d,y,x,w){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,a,y,x,w);a.id!==void 0&&this._featureMap.add(a.id,d,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,a,d,y){for(const x of d)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(n,this._featureMap,a,x,y)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function kA(s,n){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]}function xb(s,n,a){const d={color:{source:Q,composite:qt},number:{source:gt,composite:Q}},y=function(x){return{"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es}}[x]}(s);return y&&y[a]||d[n][a]}St("ConstantBinder",Bd),St("CrossFadedConstantBinder",Lc),St("SourceExpressionBinder",ca),St("CrossFadedCompositeBinder",cl),St("CompositeExpressionBinder",uo),St("ProgramConfiguration",vb,{omit:["_buffers"]}),St("ProgramConfigurationSet",fu);const Cn=8192,n0=Math.pow(2,14)-1,wb=-n0-1;function pu(s){const n=Cn/s.extent,a=s.loadGeometry();for(let d=0;dw.x+1||kw.y+1)&&je("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function mu(s,n){return{type:s.type,id:s.id,properties:s.properties,geometry:n?pu(s):[]}}function fm(s,n,a,d,y){s.emplaceBack(2*n+(d+1)/2,2*a+(y+1)/2)}class i0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new si,this.indexArray=new ws,this.segments=new cr,this.programConfigurations=new fu(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){const y=this.layers[0],x=[];let w=null,b=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),b=!w.isConstant());for(const{feature:k,id:I,index:D,sourceLayerIndex:L}of n){const j=this.layers[0]._featureFilter.needGeometry,Z=mu(k,j);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),Z,d))continue;const K=b?w.evaluate(Z,{},d):void 0,J={id:I,properties:k.properties,type:k.type,sourceLayerIndex:L,index:D,geometry:j?Z.geometry:pu(k),patterns:{},sortKey:K};x.push(J)}b&&x.sort((k,I)=>k.sortKey-I.sortKey);for(const k of x){const{geometry:I,index:D,sourceLayerIndex:L}=k,j=n[D].feature;this.addFeature(k,I,D,d),a.featureIndex.insert(j,I,D,L,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Li),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,a,d,y){for(const x of a)for(const w of x){const b=w.x,k=w.y;if(b<0||b>=Cn||k<0||k>=Cn)continue;const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),D=I.vertexLength;fm(this.layoutVertexArray,b,k,-1,-1),fm(this.layoutVertexArray,b,k,1,-1),fm(this.layoutVertexArray,b,k,1,1),fm(this.layoutVertexArray,b,k,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,{},y)}}function bb(s,n){for(let a=0;a1){if(s0(s,n))return!0;for(let d=0;d1?a:a.sub(n)._mult(y)._add(n))}function Tb(s,n){let a,d,y,x=!1;for(let w=0;wn.y!=y.y>n.y&&n.x<(y.x-d.x)*(n.y-d.y)/(y.y-d.y)+d.x&&(x=!x)}return x}function Oc(s,n){let a=!1;for(let d=0,y=s.length-1;dn.y!=w.y>n.y&&n.x<(w.x-x.x)*(n.y-x.y)/(w.y-x.y)+x.x&&(a=!a)}return a}function IA(s,n,a){const d=a[0],y=a[2];if(s.xy.x&&n.x>y.x||s.yy.y&&n.y>y.y)return!1;const x=H(s,n,a[0]);return x!==H(s,n,a[1])||x!==H(s,n,a[2])||x!==H(s,n,a[3])}function Nd(s,n,a){const d=n.paint.get(s).value;return d.kind==="constant"?d.value:a.programConfigurations.get(n.id).getMaxValue(s)}function pm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mm(s,n,a,d,y){if(!n[0]&&!n[1])return s;const x=A.convert(n)._mult(y);a==="viewport"&&x._rotate(-d);const w=[];for(let b=0;bPb(le,J))}(I,k),Z=L?D*b:D;for(const K of y)for(const J of K){const le=L?J:Pb(J,k);let fe=Z;const De=gm([],[J.x,J.y,0,1],k);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=De[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=w.cameraToCenterDistance/De[3]),TA(j,le,fe))return!0}return!1}}function Pb(s,n){const a=gm([],[s.x,s.y,0,1],n);return new A(a[0]/a[3],a[1]/a[3])}class Mb extends i0{}let Ab;St("HeatmapBucket",Mb,{omit:["layers"]});var DA={get paint(){return Ab=Ab||new v({"heatmap-radius":new Ut(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ut(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new It(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Od(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new It(ie.paint_heatmap["heatmap-opacity"])})}};function l0(s,{width:n,height:a},d,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==n*a*d)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${n*a*d}`)}else y=new Uint8Array(n*a*d);return s.width=n,s.height=a,s.data=y,s}function Db(s,{width:n,height:a},d){if(n===s.width&&a===s.height)return;const y=l0({},{width:n,height:a},d);u0(s,y,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,n),height:Math.min(s.height,a)},d),s.width=n,s.height=a,s.data=y.data}function u0(s,n,a,d,y,x){if(y.width===0||y.height===0)return n;if(y.width>s.width||y.height>s.height||a.x>s.width-y.width||a.y>s.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>n.width||y.height>n.height||d.x>n.width-y.width||d.y>n.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,b=n.data;if(w===b)throw new Error("srcData equals dstData, so image is already copied");for(let k=0;k{n[s.evaluationKey]=k;const I=s.expression.evaluate(n);y.data[w+b+0]=Math.floor(255*I.r/I.a),y.data[w+b+1]=Math.floor(255*I.g/I.a),y.data[w+b+2]=Math.floor(255*I.b/I.a),y.data[w+b+3]=Math.floor(255*I.a)};if(s.clips)for(let w=0,b=0;w80*a){b=1/0,k=1/0;let D=-1/0,L=-1/0;for(let j=a;jD&&(D=Z),K>L&&(L=K)}I=Math.max(D-b,L-k),I=I!==0?32767/I:0}return Ud(x,w,a,b,k,I,0),w}function Ob(s,n,a,d,y){let x;if(y===function(w,b,k,I){let D=0;for(let L=b,j=k-I;L0)for(let w=n;w=n;w-=d)x=Nb(w/d|0,s[w],s[w+1],x);return x&&ym(x,x.next)&&(Hd(x),x=x.next),x}function gu(s,n){if(!s)return s;n||(n=s);let a,d=s;do if(a=!1,d.steiner||!ym(d,d.next)&&wn(d.prev,d,d.next)!==0)d=d.next;else{if(Hd(d),d=n=d.prev,d===d.next)break;a=!0}while(a||d!==n);return n}function Ud(s,n,a,d,y,x,w){if(!s)return;!w&&x&&function(k,I,D,L){let j=k;do j.z===0&&(j.z=h0(j.x,j.y,I,D,L)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==k);j.prevZ.nextZ=null,j.prevZ=null,function(Z){let K,J=1;do{let le,fe=Z;Z=null;let De=null;for(K=0;fe;){K++;let be=fe,Me=0;for(let et=0;et0||Ve>0&&be;)Me!==0&&(Ve===0||!be||fe.z<=be.z)?(le=fe,fe=fe.nextZ,Me--):(le=be,be=be.nextZ,Ve--),De?De.nextZ=le:Z=le,le.prevZ=De,De=le;fe=be}De.nextZ=null,J*=2}while(K>1)}(j)}(s,d,y,x);let b=s;for(;s.prev!==s.next;){const k=s.prev,I=s.next;if(x?NA(s,d,y,x):BA(s))n.push(k.i,s.i,I.i),Hd(s),s=I.next,b=I.next;else if((s=I)===b){w?w===1?Ud(s=$A(gu(s),n),n,a,d,y,x,2):w===2&&jA(s,n,a,d,y,x):Ud(gu(s),n,a,d,y,x,1);break}}}function BA(s){const n=s.prev,a=s,d=s.next;if(wn(n,a,d)>=0)return!1;const y=n.x,x=a.x,w=d.x,b=n.y,k=a.y,I=d.y,D=yx?y>w?y:w:x>w?x:w,Z=b>k?b>I?b:I:k>I?k:I;let K=d.next;for(;K!==n;){if(K.x>=D&&K.x<=j&&K.y>=L&&K.y<=Z&&Bc(y,b,x,k,w,I,K.x,K.y)&&wn(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function NA(s,n,a,d){const y=s.prev,x=s,w=s.next;if(wn(y,x,w)>=0)return!1;const b=y.x,k=x.x,I=w.x,D=y.y,L=x.y,j=w.y,Z=bk?b>I?b:I:k>I?k:I,le=D>L?D>j?D:j:L>j?L:j,fe=h0(Z,K,n,a,d),De=h0(J,le,n,a,d);let be=s.prevZ,Me=s.nextZ;for(;be&&be.z>=fe&&Me&&Me.z<=De;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Bc(b,D,k,L,I,j,be.x,be.y)&&wn(be.prev,be,be.next)>=0||(be=be.prevZ,Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Bc(b,D,k,L,I,j,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0))return!1;Me=Me.nextZ}for(;be&&be.z>=fe;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Bc(b,D,k,L,I,j,be.x,be.y)&&wn(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Me&&Me.z<=De;){if(Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Bc(b,D,k,L,I,j,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0)return!1;Me=Me.nextZ}return!0}function $A(s,n){let a=s;do{const d=a.prev,y=a.next.next;!ym(d,y)&&Fb(d,a,a.next,y)&&Vd(d,y)&&Vd(y,d)&&(n.push(d.i,a.i,y.i),Hd(a),Hd(a.next),a=s=y),a=a.next}while(a!==s);return gu(a)}function jA(s,n,a,d,y,x){let w=s;do{let b=w.next.next;for(;b!==w.prev;){if(w.i!==b.i&&GA(w,b)){let k=Bb(w,b);return w=gu(w,w.next),k=gu(k,k.next),Ud(w,n,a,d,y,x,0),void Ud(k,n,a,d,y,x,0)}b=b.next}w=w.next}while(w!==s)}function UA(s,n){return s.x-n.x}function VA(s,n){const a=function(y,x){let w=x;const b=y.x,k=y.y;let I,D=-1/0;do{if(k<=w.y&&k>=w.next.y&&w.next.y!==w.y){const J=w.x+(k-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(J<=b&&J>D&&(D=J,I=w.x=w.x&&w.x>=j&&b!==w.x&&Bc(kI.x||w.x===I.x&&HA(I,w)))&&(I=w,K=J)}w=w.next}while(w!==L);return I}(s,n);if(!a)return n;const d=Bb(a,s);return gu(d,d.next),gu(a,a.next)}function HA(s,n){return wn(s.prev,s,n.prev)<0&&wn(n.next,s,s.next)<0}function h0(s,n,a,d,y){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-a)*y|0)|s<<8))|s<<4))|s<<2))|s<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-d)*y|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function WA(s){let n=s,a=s;do(n.x=(s-w)*(x-b)&&(s-w)*(d-b)>=(a-w)*(n-b)&&(a-w)*(x-b)>=(y-w)*(d-b)}function GA(s,n){return s.next.i!==n.i&&s.prev.i!==n.i&&!function(a,d){let y=a;do{if(y.i!==a.i&&y.next.i!==a.i&&y.i!==d.i&&y.next.i!==d.i&&Fb(y,y.next,a,d))return!0;y=y.next}while(y!==a);return!1}(s,n)&&(Vd(s,n)&&Vd(n,s)&&function(a,d){let y=a,x=!1;const w=(a.x+d.x)/2,b=(a.y+d.y)/2;do y.y>b!=y.next.y>b&&y.next.y!==y.y&&w<(y.next.x-y.x)*(b-y.y)/(y.next.y-y.y)+y.x&&(x=!x),y=y.next;while(y!==a);return x}(s,n)&&(wn(s.prev,s,n.prev)||wn(s,n.prev,n))||ym(s,n)&&wn(s.prev,s,s.next)>0&&wn(n.prev,n,n.next)>0)}function wn(s,n,a){return(n.y-s.y)*(a.x-n.x)-(n.x-s.x)*(a.y-n.y)}function ym(s,n){return s.x===n.x&&s.y===n.y}function Fb(s,n,a,d){const y=vm(wn(s,n,a)),x=vm(wn(s,n,d)),w=vm(wn(a,d,s)),b=vm(wn(a,d,n));return y!==x&&w!==b||!(y!==0||!_m(s,a,n))||!(x!==0||!_m(s,d,n))||!(w!==0||!_m(a,s,d))||!(b!==0||!_m(a,n,d))}function _m(s,n,a){return n.x<=Math.max(s.x,a.x)&&n.x>=Math.min(s.x,a.x)&&n.y<=Math.max(s.y,a.y)&&n.y>=Math.min(s.y,a.y)}function vm(s){return s>0?1:s<0?-1:0}function Vd(s,n){return wn(s.prev,s,s.next)<0?wn(s,n,s.next)>=0&&wn(s,s.prev,n)>=0:wn(s,n,s.prev)<0||wn(s,s.next,n)<0}function Bb(s,n){const a=d0(s.i,s.x,s.y),d=d0(n.i,n.x,n.y),y=s.next,x=n.prev;return s.next=n,n.prev=s,a.next=y,y.prev=a,d.next=a,a.prev=d,x.next=d,d.prev=x,d}function Nb(s,n,a,d){const y=d0(s,n,a);return d?(y.next=d.next,y.prev=d,d.next.prev=y,d.next=y):(y.prev=y,y.next=y),y}function Hd(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function d0(s,n,a){return{i:s,x:n,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function f0(s,n,a){const d=a.patternDependencies;let y=!1;for(const x of n){const w=x.paint.get(`${s}-pattern`);w.isConstant()||(y=!0);const b=w.constantOr(null);b&&(y=!0,d[b.to]=!0,d[b.from]=!0)}return y}function p0(s,n,a,d,y){const x=y.patternDependencies;for(const w of n){const b=w.paint.get(`${s}-pattern`).value;if(b.kind!=="constant"){let k=b.evaluate({zoom:d-1},a,{},y.availableImages),I=b.evaluate({zoom:d},a,{},y.availableImages),D=b.evaluate({zoom:d+1},a,{},y.availableImages);k=k&&k.name?k.name:k,I=I&&I.name?I.name:I,D=D&&D.name?D.name:D,x[k]=!0,x[I]=!0,x[D]=!0,a.patterns[w.id]={min:k,mid:I,max:D}}}return a}class m0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new ws,this.indexArray2=new Nn,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.segments2=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("fill",this.layers,a);const y=this.layers[0].layout.get("fill-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,j=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),j,d))continue;const Z=x?y.evaluate(j,{},d,a.availableImages):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?j.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,FA),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,a,d,y,x){for(const w of lc(a,500)){let b=0;for(const Z of w)b+=Z.length;const k=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),I=k.vertexLength,D=[],L=[];for(const Z of w){if(Z.length===0)continue;Z!==w[0]&&L.push(D.length/2);const K=this.segments2.prepareSegment(Z.length,this.layoutVertexArray,this.indexArray2),J=K.vertexLength;this.layoutVertexArray.emplaceBack(Z[0].x,Z[0].y),this.indexArray2.emplaceBack(J+Z.length-1,J),D.push(Z[0].x),D.push(Z[0].y);for(let le=1;le>3}if(y--,d===1||d===2)x+=s.readSVarint(),w+=s.readSVarint(),d===1&&(n&&b.push(n),n=[]),n.push(new JA(x,w));else{if(d!==7)throw new Error("unknown command "+d);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Nc.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var n=s.readVarint()+s.pos,a=1,d=0,y=0,x=0,w=1/0,b=-1/0,k=1/0,I=-1/0;s.pos>3}if(d--,a===1||a===2)(y+=s.readSVarint())b&&(b=y),(x+=s.readSVarint())I&&(I=x);else if(a!==7)throw new Error("unknown command "+a)}return[w,k,b,I]},Nc.prototype.toGeoJSON=function(s,n,a){var d,y,x=this.extent*Math.pow(2,a),w=this.extent*s,b=this.extent*n,k=this.loadGeometry(),I=Nc.types[this.type];function D(Z){for(var K=0;K>3;y=w===1?d.readString():w===2?d.readFloat():w===3?d.readDouble():w===4?d.readVarint64():w===5?d.readVarint():w===6?d.readSVarint():w===7?d.readBoolean():null}return y}(a))}Hb.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var n=this._pbf.readVarint()+this._pbf.pos;return new t3(this._pbf,n,this.extent,this._keys,this._values)};var n3=Vb;function i3(s,n,a){if(s===3){var d=new n3(a,a.readVarint()+a.pos);d.length&&(n[d.name]=d)}}hl.VectorTile=function(s,n){this.layers=s.readFields(i3,{},n)},hl.VectorTileFeature=Ub,hl.VectorTileLayer=Vb;const s3=hl.VectorTileFeature.types,g0=Math.pow(2,13);function Wd(s,n,a,d,y,x,w,b){s.emplaceBack(n,a,2*Math.floor(d*g0)+w,y*g0*2,x*g0*2,Math.round(b))}class y0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new sl,this.centroidVertexArray=new Zn,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.features=[],this.hasPattern=f0("fill-extrusion",this.layers,a);for(const{feature:y,id:x,index:w,sourceLayerIndex:b}of n){const k=this.layers[0]._featureFilter.needGeometry,I=mu(y,k);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),I,d))continue;const D={id:x,sourceLayerIndex:b,index:w,geometry:k?I.geometry:pu(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(p0("fill-extrusion",this.layers,D,this.zoom,a)):this.addFeature(D,D.geometry,w,d,{}),a.featureIndex.insert(y,D.geometry,w,b,this.index,!0)}}addFeatures(n,a,d){for(const y of this.features){const{geometry:x}=y;this.addFeature(y,x,y.index,a,d)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,KA),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,XA.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,a,d,y,x){for(const w of lc(a,500)){const b={x:0,y:0,vertexCount:0};let k=0;for(const K of w)k+=K.length;let I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of w){if(K.length===0||a3(K))continue;let J=0;for(let le=0;le=1){const De=K[le-1];if(!o3(fe,De)){I.vertexLength+4>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=fe.sub(De)._perp()._unit(),Me=De.dist(fe);J+Me>32768&&(J=0),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,1,J),b.x+=2*fe.x,b.y+=2*fe.y,b.vertexCount+=2,J+=Me,Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,1,J),b.x+=2*De.x,b.y+=2*De.y,b.vertexCount+=2;const Ve=I.vertexLength;this.indexArray.emplaceBack(Ve,Ve+2,Ve+1),this.indexArray.emplaceBack(Ve+1,Ve+2,Ve+3),I.vertexLength+=4,I.primitiveLength+=2}}}}if(I.vertexLength+k>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),s3[n.type]!=="Polygon")continue;const D=[],L=[],j=I.vertexLength;for(const K of w)if(K.length!==0){K!==w[0]&&L.push(D.length/2);for(let J=0;JCn)||s.y===n.y&&(s.y<0||s.y>Cn)}function a3(s){return s.every(n=>n.x<0)||s.every(n=>n.x>Cn)||s.every(n=>n.y<0)||s.every(n=>n.y>Cn)}let Wb;St("FillExtrusionBucket",y0,{omit:["layers","features"]});var l3={get paint(){return Wb=Wb||new v({"fill-extrusion-opacity":new It(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ut(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ic(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ut(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ut(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new It(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class u3 extends u{constructor(n){super(n,l3)}createBucket(n){return new y0(n)}queryRadius(){return pm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,a,d,y,x,w,b,k){const I=mm(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,b),D=this.paint.get("fill-extrusion-height").evaluate(a,d),L=this.paint.get("fill-extrusion-base").evaluate(a,d),j=function(K,J,le,fe){const De=[];for(const be of K){const Me=[be.x,be.y,0,1];gm(Me,Me,J),De.push(new A(Me[0]/Me[3],Me[1]/Me[3]))}return De}(I,k),Z=function(K,J,le,fe){const De=[],be=[],Me=fe[8]*J,Ve=fe[9]*J,et=fe[10]*J,xt=fe[11]*J,Nt=fe[8]*le,yt=fe[9]*le,pt=fe[10]*le,At=fe[11]*le;for(const Tt of K){const bt=[],Ye=[];for(const Dt of Tt){const Mt=Dt.x,Zt=Dt.y,Fr=fe[0]*Mt+fe[4]*Zt+fe[12],Or=fe[1]*Mt+fe[5]*Zt+fe[13],zn=fe[2]*Mt+fe[6]*Zt+fe[14],Gs=fe[3]*Mt+fe[7]*Zt+fe[15],Xn=zn+et,Rn=Gs+xt,xi=Fr+Nt,wi=Or+yt,bi=zn+pt,mn=Gs+At,Ln=new A((Fr+Me)/Rn,(Or+Ve)/Rn);Ln.z=Xn/Rn,bt.push(Ln);const oi=new A(xi/mn,wi/mn);oi.z=bi/mn,Ye.push(oi)}De.push(bt),be.push(Ye)}return[De,be]}(y,L,D,k);return function(K,J,le){let fe=1/0;Sb(le,J)&&(fe=Gb(le,J[0]));for(let De=0;Dea.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new Mc,this.layoutVertexArray2=new ol,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("line",this.layers,a);const y=this.layers[0].layout.get("line-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,j=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),j,d))continue;const Z=x?y.evaluate(j,{},d):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?j.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("line",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,f3)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,h3),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,a,d,y,x){const w=this.layers[0].layout,b=w.get("line-join").evaluate(n,{}),k=w.get("line-cap"),I=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const L of a)this.addLine(L,n,b,k,I,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,x,y)}addLine(n,a,d,y,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe=2&&n[k-1].equals(n[k-2]);)k--;let I=0;for(;I0;if(xt&&fe>I){const At=j.dist(Z);if(At>2*D){const Tt=j.sub(j.sub(Z)._mult(D/At)._round());this.updateDistance(Z,Tt),this.addCurrentVertex(Tt,J,0,0,L),Z=Tt}}const yt=Z&&K;let pt=yt?d:b?"butt":y;if(yt&&pt==="round"&&(Vex&&(pt="bevel"),pt==="bevel"&&(Ve>2&&(pt="flipbevel"),Ve100)De=le.mult(-1);else{const At=Ve*J.add(le).mag()/J.sub(le).mag();De._perp()._mult(At*(Nt?-1:1))}this.addCurrentVertex(j,De,0,0,L),this.addCurrentVertex(j,De.mult(-1),0,0,L)}else if(pt==="bevel"||pt==="fakeround"){const At=-Math.sqrt(Ve*Ve-1),Tt=Nt?At:0,bt=Nt?0:At;if(Z&&this.addCurrentVertex(j,J,Tt,bt,L),pt==="fakeround"){const Ye=Math.round(180*et/Math.PI/20);for(let Dt=1;Dt2*D){const Tt=j.add(K.sub(j)._mult(D/At)._round());this.updateDistance(j,Tt),this.addCurrentVertex(Tt,le,0,0,L),j=Tt}}}}addCurrentVertex(n,a,d,y,x,w=!1){const b=a.y*y-a.x,k=-a.y-a.x*y;this.addHalfVertex(n,a.x+a.y*d,a.y-a.x*d,w,!1,d,x),this.addHalfVertex(n,b,k,w,!0,-y,x),this.distance>Zb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,a,d,y,x,w))}addHalfVertex({x:n,y:a},d,y,x,w,b,k){const I=.5*(this.lineClips?this.scaledDistance*(Zb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(x?1:0),(a<<1)+(w?1:0),Math.round(63*d)+128,Math.round(63*y)+128,1+(b===0?0:b<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),k.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,a){this.distance+=n.dist(a),this.updateScaledDistance()}}let qb,Yb;St("LineBucket",_0,{omit:["layers","patternFeatures"]});var Xb={get paint(){return Yb=Yb||new v({"line-opacity":new Ut(ie.paint_line["line-opacity"]),"line-color":new Ut(ie.paint_line["line-color"]),"line-translate":new It(ie.paint_line["line-translate"]),"line-translate-anchor":new It(ie.paint_line["line-translate-anchor"]),"line-width":new Ut(ie.paint_line["line-width"]),"line-gap-width":new Ut(ie.paint_line["line-gap-width"]),"line-offset":new Ut(ie.paint_line["line-offset"]),"line-blur":new Ut(ie.paint_line["line-blur"]),"line-dasharray":new Pc(ie.paint_line["line-dasharray"]),"line-pattern":new Ic(ie.paint_line["line-pattern"]),"line-gradient":new Od(ie.paint_line["line-gradient"])})},get layout(){return qb=qb||new v({"line-cap":new It(ie.layout_line["line-cap"]),"line-join":new Ut(ie.layout_line["line-join"]),"line-miter-limit":new It(ie.layout_line["line-miter-limit"]),"line-round-limit":new It(ie.layout_line["line-round-limit"]),"line-sort-key":new Ut(ie.layout_line["line-sort-key"])})}};class g3 extends Ut{possiblyEvaluate(n,a){return a=new Vr(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(n,a)}evaluate(n,a,d,y){return a=ge({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(n,a,d,y)}}let xm;class y3 extends u{constructor(n){super(n,Xb),this.gradientVersion=0,xm||(xm=new g3(Xb.paint.properties["line-width"].specification),xm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(d){return d._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof $a,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,a){super.recalculate(n,a),this.paint._values["line-floorwidth"]=xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new _0(n)}queryRadius(n){const a=n,d=Kb(Nd("line-width",this,a),Nd("line-gap-width",this,a)),y=Nd("line-offset",this,a);return d/2+Math.abs(y)+pm(this.paint.get("line-translate"))}queryIntersectsFeature(n,a,d,y,x,w,b){const k=mm(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,b),I=b/2*Kb(this.paint.get("line-width").evaluate(a,d),this.paint.get("line-gap-width").evaluate(a,d)),D=this.paint.get("line-offset").evaluate(a,d);return D&&(y=function(L,j){const Z=[];for(let K=0;K=3){for(let le=0;le0?n+2*s:s}const _3=S([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),v3=S([{name:"a_projected_pos",components:3,type:"Float32"}],4);S([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const x3=S([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);S([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Jb=S([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),w3=S([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function b3(s,n,a){return s.sections.forEach(d=>{d.text=function(y,x,w){const b=x.layout.get("text-transform").evaluate(w,{});return b==="uppercase"?y=y.toLocaleUpperCase():b==="lowercase"&&(y=y.toLocaleLowerCase()),Ri.applyArabicShaping&&(y=Ri.applyArabicShaping(y)),y}(d.text,n,a)}),s}S([{name:"triangle",components:3,type:"Uint16"}]),S([{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"}]),S([{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"}]),S([{type:"Float32",name:"offsetX"}]),S([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),S([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Pn=24,Qb=Lr,e2=function(s,n,a,d,y){var x,w,b=8*y-d-1,k=(1<>1,D=-7,L=y-1,j=-1,Z=s[n+L];for(L+=j,x=Z&(1<<-D)-1,Z>>=-D,D+=b;D>0;x=256*x+s[n+L],L+=j,D-=8);for(w=x&(1<<-D)-1,x>>=-D,D+=d;D>0;w=256*w+s[n+L],L+=j,D-=8);if(x===0)x=1-I;else{if(x===k)return w?NaN:1/0*(Z?-1:1);w+=Math.pow(2,d),x-=I}return(Z?-1:1)*w*Math.pow(2,x-d)},t2=function(s,n,a,d,y,x){var w,b,k,I=8*x-y-1,D=(1<>1,j=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,Z=0,K=1,J=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,w=D):(w=Math.floor(Math.log(n)/Math.LN2),n*(k=Math.pow(2,-w))<1&&(w--,k*=2),(n+=w+L>=1?j/k:j*Math.pow(2,1-L))*k>=2&&(w++,k/=2),w+L>=D?(b=0,w=D):w+L>=1?(b=(n*k-1)*Math.pow(2,y),w+=L):(b=n*Math.pow(2,L-1)*Math.pow(2,y),w=0));y>=8;s[a+Z]=255&b,Z+=K,b/=256,y-=8);for(w=w<0;s[a+Z]=255&w,Z+=K,w/=256,I-=8);s[a+Z-K]|=128*J};function Lr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Lr.Varint=0,Lr.Fixed64=1,Lr.Bytes=2,Lr.Fixed32=5;var v0=4294967296,r2=1/v0,n2=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ha(s){return s.type===Lr.Bytes?s.readVarint()+s.pos:s.pos+1}function $c(s,n,a){return a?4294967296*n+(s>>>0):4294967296*(n>>>0)+(s>>>0)}function i2(s,n,a){var d=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));a.realloc(d);for(var y=a.pos-1;y>=s;y--)a.buf[y+d]=a.buf[y]}function S3(s,n){for(var a=0;a>>8,s[a+2]=n>>>16,s[a+3]=n>>>24}function s2(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+(s[n+3]<<24)}Lr.prototype={destroy:function(){this.buf=null},readFields:function(s,n,a){for(a=a||this.length;this.pos>3,x=this.pos;this.type=7&d,s(y,n,this),this.pos===x&&this.skip(d)}return n},readMessage:function(s,n){return this.readFields(s,n,this.readVarint()+this.pos)},readFixed32:function(){var s=wm(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=s2(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=wm(this.buf,this.pos)+wm(this.buf,this.pos+4)*v0;return this.pos+=8,s},readSFixed64:function(){var s=wm(this.buf,this.pos)+s2(this.buf,this.pos+4)*v0;return this.pos+=8,s},readFloat:function(){var s=e2(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=e2(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var n,a,d=this.buf;return n=127&(a=d[this.pos++]),a<128?n:(n|=(127&(a=d[this.pos++]))<<7,a<128?n:(n|=(127&(a=d[this.pos++]))<<14,a<128?n:(n|=(127&(a=d[this.pos++]))<<21,a<128?n:function(y,x,w){var b,k,I=w.buf;if(b=(112&(k=I[w.pos++]))>>4,k<128||(b|=(127&(k=I[w.pos++]))<<3,k<128)||(b|=(127&(k=I[w.pos++]))<<10,k<128)||(b|=(127&(k=I[w.pos++]))<<17,k<128)||(b|=(127&(k=I[w.pos++]))<<24,k<128)||(b|=(1&(k=I[w.pos++]))<<31,k<128))return $c(y,b,x);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(a=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,n=this.pos;return this.pos=s,s-n>=12&&n2?function(a,d,y){return n2.decode(a.subarray(d,y))}(this.buf,n,s):function(a,d,y){for(var x="",w=d;w239?4:D>223?3:D>191?2:1;if(w+j>y)break;j===1?D<128&&(L=D):j===2?(192&(b=a[w+1]))==128&&(L=(31&D)<<6|63&b)<=127&&(L=null):j===3?(k=a[w+2],(192&(b=a[w+1]))==128&&(192&k)==128&&((L=(15&D)<<12|(63&b)<<6|63&k)<=2047||L>=55296&&L<=57343)&&(L=null)):j===4&&(k=a[w+2],I=a[w+3],(192&(b=a[w+1]))==128&&(192&k)==128&&(192&I)==128&&((L=(15&D)<<18|(63&b)<<12|(63&k)<<6|63&I)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,j=1):L>65535&&(L-=65536,x+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),x+=String.fromCharCode(L),w+=j}return x}(this.buf,n,s)},readBytes:function(){var s=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,s);return this.pos=s,n},readPackedVarint:function(s,n){if(this.type!==Lr.Bytes)return s.push(this.readVarint(n));var a=ha(this);for(s=s||[];this.pos127;);else if(n===Lr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===Lr.Fixed32)this.pos+=4;else{if(n!==Lr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(s,n){this.writeVarint(s<<3|n)},realloc:function(s){for(var n=this.length||16;n268435455||s<0?function(n,a){var d,y;if(n>=0?(d=n%4294967296|0,y=n/4294967296|0):(y=~(-n/4294967296),4294967295^(d=~(-n%4294967296))?d=d+1|0:(d=0,y=y+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(x,w,b){b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,b.buf[b.pos]=127&(x>>>=7)}(d,0,a),function(x,w){var b=(7&x)<<4;w.buf[w.pos++]|=b|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(y,a)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var n=this.pos;this.pos=function(d,y,x){for(var w,b,k=0;k55295&&w<57344){if(!b){w>56319||k+1===y.length?(d[x++]=239,d[x++]=191,d[x++]=189):b=w;continue}if(w<56320){d[x++]=239,d[x++]=191,d[x++]=189,b=w;continue}w=b-55296<<10|w-56320|65536,b=null}else b&&(d[x++]=239,d[x++]=191,d[x++]=189,b=null);w<128?d[x++]=w:(w<2048?d[x++]=w>>6|192:(w<65536?d[x++]=w>>12|224:(d[x++]=w>>18|240,d[x++]=w>>12&63|128),d[x++]=w>>6&63|128),d[x++]=63&w|128)}return x}(this.buf,s,this.pos);var a=this.pos-n;a>=128&&i2(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeFloat:function(s){this.realloc(4),t2(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),t2(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var n=s.length;this.writeVarint(n),this.realloc(n);for(var a=0;a=128&&i2(a,d,this),this.pos=a-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,n,a){this.writeTag(s,Lr.Bytes),this.writeRawMessage(n,a)},writePackedVarint:function(s,n){n.length&&this.writeMessage(s,S3,n)},writePackedSVarint:function(s,n){n.length&&this.writeMessage(s,k3,n)},writePackedBoolean:function(s,n){n.length&&this.writeMessage(s,C3,n)},writePackedFloat:function(s,n){n.length&&this.writeMessage(s,T3,n)},writePackedDouble:function(s,n){n.length&&this.writeMessage(s,E3,n)},writePackedFixed32:function(s,n){n.length&&this.writeMessage(s,I3,n)},writePackedSFixed32:function(s,n){n.length&&this.writeMessage(s,P3,n)},writePackedFixed64:function(s,n){n.length&&this.writeMessage(s,M3,n)},writePackedSFixed64:function(s,n){n.length&&this.writeMessage(s,A3,n)},writeBytesField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeBytes(n)},writeFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeVarint(n)},writeSVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeSVarint(n)},writeStringField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeString(n)},writeFloatField:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFloat(n)},writeDoubleField:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeDouble(n)},writeBooleanField:function(s,n){this.writeVarintField(s,!!n)}};var x0=T(Qb);const w0=3;function D3(s,n,a){s===1&&a.readMessage(z3,n)}function z3(s,n,a){if(s===3){const{id:d,bitmap:y,width:x,height:w,left:b,top:k,advance:I}=a.readMessage(R3,{});n.push({id:d,bitmap:new jd({width:x+2*w0,height:w+2*w0},y),metrics:{width:x,height:w,left:b,top:k,advance:I}})}}function R3(s,n,a){s===1?n.id=a.readVarint():s===2?n.bitmap=a.readBytes():s===3?n.width=a.readVarint():s===4?n.height=a.readVarint():s===5?n.left=a.readSVarint():s===6?n.top=a.readSVarint():s===7&&(n.advance=a.readVarint())}const o2=w0;function a2(s){let n=0,a=0;for(const w of s)n+=w.w*w.h,a=Math.max(a,w.w);s.sort((w,b)=>b.h-w.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),a),h:1/0}];let y=0,x=0;for(const w of s)for(let b=d.length-1;b>=0;b--){const k=d[b];if(!(w.w>k.w||w.h>k.h)){if(w.x=k.x,w.y=k.y,x=Math.max(x,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===k.w&&w.h===k.h){const I=d.pop();b=0&&d>=n&&Sm[this.text.charCodeAt(d)];d--)a--;this.text=this.text.substring(n,a),this.sectionIndex=this.sectionIndex.slice(n,a)}substring(n,a){const d=new Uc;return d.text=this.text.substring(n,a),d.sectionIndex=this.sectionIndex.slice(n,a),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,a)=>Math.max(n,this.sections[a].scale),0)}addTextSection(n,a){this.text+=n.text,this.sections.push(Yd.forText(n.scale,n.fontStack||a));const d=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bm(s,n,a,d,y,x,w,b,k,I,D,L,j,Z,K){const J=Uc.fromFeature(s,y);let le;L===g.ah.vertical&&J.verticalizePunctuation();const{processBidirectionalText:fe,processStyledBidirectionalText:De}=Ri;if(fe&&J.sections.length===1){le=[];const Ve=fe(J.toString(),S0(J,I,x,n,d,Z));for(const et of Ve){const xt=new Uc;xt.text=et,xt.sections=J.sections;for(let Nt=0;Nt0&&da>Jn&&(Jn=da)}else{const Ts=xt[xr.fontStack],$n=Ts&&Ts[Zr];if($n&&$n.rect)Gc=$n.rect,nn=$n.metrics;else{const da=et[xr.fontStack],tf=da&&da[Zr];if(!tf)continue;nn=tf.metrics}ns=(Ln-xr.scale)*Pn}Zs?(Ve.verticalizable=!0,Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Gc}),Zt+=Lo*xr.scale+Ye):(Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Gc}),Zt+=nn.advance*xr.scale+Ye)}Si.length!==0&&(Or=Math.max(Zt-Ye,Or),B3(Si,0,Si.length-1,Gs,Jn)),Zt=0;const ks=pt*Ln+Jn;Kn.lineOffset=Math.max(Jn,oi),Fr+=ks,zn=Math.max(ks,zn),++Xn}var Rn;const xi=Fr-qd,{horizontalAlign:wi,verticalAlign:bi}=k0(At);(function(mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr){const $r=(Ln-oi)*Si;let Zr=0;Zr=Jn!==ks?-Fi*Kn-qd:(-Kn*xr+.5)*ks;for(const ns of mn)for(const nn of ns.positionedGlyphs)nn.x+=$r,nn.y+=Zr})(Ve.positionedLines,Gs,wi,bi,Or,zn,pt,xi,yt.length),Ve.top+=-bi*xi,Ve.bottom=Ve.top+xi,Ve.left+=-wi*Or,Ve.right=Ve.left+Or}(Me,n,a,d,le,w,b,k,L,I,j,K),!function(Ve){for(const et of Ve)if(et.positionedGlyphs.length!==0)return!1;return!0}(be)&&Me}const Sm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},L3={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},O3={40:!0};function u2(s,n,a,d,y,x){if(n.imageName){const w=d[n.imageName];return w?w.displaySize[0]*n.scale*Pn/x+y:0}{const w=a[n.fontStack],b=w&&w[s];return b?b.metrics.advance*n.scale+y:0}}function c2(s,n,a,d){const y=Math.pow(s-n,2);return d?s=0;let I=0;for(let L=0;LI){const D=Math.ceil(x/I);y*=D/w,w=D}return{x1:d,y1:y,x2:d+x,y2:y+w}}function p2(s,n,a,d,y,x){const w=s.image;let b;if(w.content){const le=w.content,fe=w.pixelRatio||1;b=[le[0]/fe,le[1]/fe,w.displaySize[0]-le[2]/fe,w.displaySize[1]-le[3]/fe]}const k=n.left*x,I=n.right*x;let D,L,j,Z;a==="width"||a==="both"?(Z=y[0]+k-d[3],L=y[0]+I+d[1]):(Z=y[0]+(k+I-w.displaySize[0])/2,L=Z+w.displaySize[0]);const K=n.top*x,J=n.bottom*x;return a==="height"||a==="both"?(D=y[1]+K-d[0],j=y[1]+J+d[2]):(D=y[1]+(K+J-w.displaySize[1])/2,j=D+w.displaySize[1]),{image:w,top:D,right:L,bottom:j,left:Z,collisionPadding:b}}const Xd=255,zo=128,fl=Xd*zo;function m2(s,n){const{expression:a}=n;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new Vr(s+1))};if(a.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:y}=a;let x=0;for(;xw.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a0([]),this.placementViewportMatrix=a0([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=m2(this.zoom,a["text-size"]),this.iconSizeData=m2(this.zoom,a["icon-size"]);const d=this.layers[0].layout,y=d.get("symbol-sort-key"),x=d.get("symbol-z-order");this.canOverlap=T0(d,"text-overlap","text-allow-overlap")!=="never"||T0(d,"icon-overlap","icon-allow-overlap")!=="never"||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,d.get("symbol-placement")==="point"&&(this.writingModes=d.get("text-writing-mode").map(w=>g.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=n.sourceID}createArrays(){this.text=new C0(new fu(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new C0(new fu(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new Wr,this.lineVertexArray=new Gn,this.symbolInstances=new ar,this.textAnchorOffsets=new Gr}calculateGlyphDependencies(n,a,d,y,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,L=x.get("symbol-sort-key");if(this.features=[],!I&&!D)return;const j=a.iconDependencies,Z=a.glyphDependencies,K=a.availableImages,J=new Vr(this.zoom);for(const{feature:le,id:fe,index:De,sourceLayerIndex:be}of n){const Me=y._featureFilter.needGeometry,Ve=mu(le,Me);if(!y._featureFilter.filter(J,Ve,d))continue;let et,xt;if(Me||(Ve.geometry=pu(le)),I){const yt=y.getValueAndResolveTokens("text-field",Ve,d,K),pt=Mi.factory(yt),At=this.hasRTLText=this.hasRTLText||U3(pt);(!At||Ri.getRTLTextPluginStatus()==="unavailable"||At&&Ri.isParsed())&&(et=b3(pt,y,Ve))}if(D){const yt=y.getValueAndResolveTokens("icon-image",Ve,d,K);xt=yt instanceof Di?yt:Di.fromString(yt)}if(!et&&!xt)continue;const Nt=this.sortFeaturesByKey?L.evaluate(Ve,{},d):void 0;if(this.features.push({id:fe,text:et,icon:xt,index:De,sourceLayerIndex:be,geometry:Ve.geometry,properties:le.properties,type:$3[le.type],sortKey:Nt}),xt&&(j[xt.name]=!0),et){const yt=w.evaluate(Ve,{},d).join(","),pt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(g.ah.vertical)>=0;for(const At of et.sections)if(At.image)j[At.image.name]=!0;else{const Tt=Dd(et.toString()),bt=At.fontStack||yt,Ye=Z[bt]=Z[bt]||{};this.calculateGlyphDependencies(At.text,Ye,pt,this.allowVerticalPlacement,Tt)}}}x.get("symbol-placement")==="line"&&(this.features=function(le){const fe={},De={},be=[];let Me=0;function Ve(yt){be.push(le[yt]),Me++}function et(yt,pt,At){const Tt=De[yt];return delete De[yt],De[pt]=Tt,be[Tt].geometry[0].pop(),be[Tt].geometry[0]=be[Tt].geometry[0].concat(At[0]),Tt}function xt(yt,pt,At){const Tt=fe[pt];return delete fe[pt],fe[yt]=Tt,be[Tt].geometry[0].shift(),be[Tt].geometry[0]=At[0].concat(be[Tt].geometry[0]),Tt}function Nt(yt,pt,At){const Tt=At?pt[0][pt[0].length-1]:pt[0][0];return`${yt}:${Tt.x}:${Tt.y}`}for(let yt=0;ytyt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,fe)=>le.sortKey-fe.sortKey)}update(n,a,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,a,this.layers,d),this.icon.programConfigurations.updatePaintArrays(n,a,this.layers,d))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,a){const d=this.lineVertexArray.length;if(n.segment!==void 0){let y=n.dist(a[n.segment+1]),x=n.dist(a[n.segment]);const w={};for(let b=n.segment+1;b=0;b--)w[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:x},b>0&&(x+=a[b-1].dist(a[b]));for(let b=0;b0}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(n,a){const d=n.placedSymbolArray.get(a),y=d.vertexStartIndex+4*d.numGlyphs;for(let x=d.vertexStartIndex;xy[b]-y[k]||x[k]-x[b]),w}addToSortKeyRanges(n,a){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===a?d.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const d=this.symbolInstances.get(a);this.featureSortOrder.push(d.featureIndex),[d.rightJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.leftJustifiedTextSymbolIndex].forEach((y,x,w)=>{y>=0&&w.indexOf(y)===x&&this.addIndicesForPlacedSymbol(this.text,y)}),d.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,d.verticalPlacedTextSymbolIndex),d.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.placedIconSymbolIndex),d.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let g2,y2;St("SymbolBucket",Vc,{omit:["layers","collisionBoxArray","features","compareText"]}),Vc.MAX_GLYPHS=65535,Vc.addDynamicAttributes=E0;var P0={get paint(){return y2=y2||new v({"icon-opacity":new Ut(ie.paint_symbol["icon-opacity"]),"icon-color":new Ut(ie.paint_symbol["icon-color"]),"icon-halo-color":new Ut(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ut(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ut(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new It(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new It(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ut(ie.paint_symbol["text-opacity"]),"text-color":new Ut(ie.paint_symbol["text-color"],{runtimeType:Kr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new Ut(ie.paint_symbol["text-halo-color"]),"text-halo-width":new Ut(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Ut(ie.paint_symbol["text-halo-blur"]),"text-translate":new It(ie.paint_symbol["text-translate"]),"text-translate-anchor":new It(ie.paint_symbol["text-translate-anchor"])})},get layout(){return g2=g2||new v({"symbol-placement":new It(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new It(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new It(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ut(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new It(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new It(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new It(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new It(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new It(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new It(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ut(ie.layout_symbol["icon-size"]),"icon-text-fit":new It(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new It(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ut(ie.layout_symbol["icon-image"]),"icon-rotate":new Ut(ie.layout_symbol["icon-rotate"]),"icon-padding":new Ut(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new It(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Ut(ie.layout_symbol["icon-offset"]),"icon-anchor":new Ut(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new It(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new It(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new It(ie.layout_symbol["text-rotation-alignment"]),"text-field":new Ut(ie.layout_symbol["text-field"]),"text-font":new Ut(ie.layout_symbol["text-font"]),"text-size":new Ut(ie.layout_symbol["text-size"]),"text-max-width":new Ut(ie.layout_symbol["text-max-width"]),"text-line-height":new It(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Ut(ie.layout_symbol["text-letter-spacing"]),"text-justify":new Ut(ie.layout_symbol["text-justify"]),"text-radial-offset":new Ut(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new It(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ut(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ut(ie.layout_symbol["text-anchor"]),"text-max-angle":new It(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new It(ie.layout_symbol["text-writing-mode"]),"text-rotate":new Ut(ie.layout_symbol["text-rotate"]),"text-padding":new It(ie.layout_symbol["text-padding"]),"text-keep-upright":new It(ie.layout_symbol["text-keep-upright"]),"text-transform":new Ut(ie.layout_symbol["text-transform"]),"text-offset":new Ut(ie.layout_symbol["text-offset"]),"text-allow-overlap":new It(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new It(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new It(ie.layout_symbol["text-ignore-placement"]),"text-optional":new It(ie.layout_symbol["text-optional"])})}};class _2{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:pi,this.defaultValue=n}evaluate(n){if(n.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(n.formattedSection))return a.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",_2,{omit:["defaultValue"]});class Tm extends u{constructor(n){super(n,P0)}recalculate(n,a){if(super.recalculate(n,a),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"){const d=this.layout.get("text-writing-mode");if(d){const y=[];for(const x of d)y.indexOf(x)<0&&y.push(x);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,a,d,y){const x=this.layout.get(n).evaluate(a,{},d,y),w=this._unevaluatedLayout._values[n];return w.isDataDriven()||gc(w.value)||!x?x:function(b,k){return k.replace(/{([^{}]+)}/g,(I,D)=>b&&D in b?String(b[D]):"")}(a.properties,x)}createBucket(n){return new Vc(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of P0.paint.overridableProperties){if(!Tm.hasPaintOverride(this.layout,n))continue;const a=this.paint.get(n),d=new _2(a),y=new mc(d,a.property.specification);let x=null;x=a.value.kind==="constant"||a.value.kind==="source"?new Ya("source",y):new Xa("composite",y,a.value.zoomStops),this.paint._values[n]=new Hs(a.property,x,a.parameters)}}_handleOverridablePaintPropertyUpdate(n,a,d){return!(!this.layout||a.isDataDriven()||d.isDataDriven())&&Tm.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,a){const d=n.get("text-field"),y=P0.paint.properties[a];let x=!1;const w=b=>{for(const k of b)if(y.overrides&&y.overrides.hasOverride(k))return void(x=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Mi)w(d.value.value.sections);else if(d.value.kind==="source"){const b=I=>{x||(I instanceof ms&&En(I.value)===fs?w(I.value.sections):I instanceof oc?w(I.sections):I.eachChild(b))},k=d.value;k._styleExpression&&b(k._styleExpression.expression)}return x}}let v2;var V3={get paint(){return v2=v2||new v({"background-color":new It(ie.paint_background["background-color"]),"background-pattern":new Pc(ie.paint_background["background-pattern"]),"background-opacity":new It(ie.paint_background["background-opacity"])})}};class H3 extends u{constructor(n){super(n,V3)}}let x2;var W3={get paint(){return x2=x2||new v({"raster-opacity":new It(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new It(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new It(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new It(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new It(ie.paint_raster["raster-saturation"]),"raster-contrast":new It(ie.paint_raster["raster-contrast"]),"raster-resampling":new It(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new It(ie.paint_raster["raster-fade-duration"])})}};class G3 extends u{constructor(n){super(n,W3)}}class Z3 extends u{constructor(n){super(n,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=n}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 q3{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const M0=63710088e-1;class pl{constructor(n,a){if(isNaN(n)||isNaN(a))throw new Error(`Invalid LngLat object: (${n}, ${a})`);if(this.lng=+n,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pl(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const a=Math.PI/180,d=this.lat*a,y=n.lat*a,x=Math.sin(d)*Math.sin(y)+Math.cos(d)*Math.cos(y)*Math.cos((n.lng-this.lng)*a);return M0*Math.acos(Math.min(x,1))}static convert(n){if(n instanceof pl)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new pl(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new pl(Number("lng"in n?n.lng:n.lon),Number(n.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const w2=2*Math.PI*M0;function b2(s){return w2*Math.cos(s*Math.PI/180)}function S2(s){return(180+s)/360}function k2(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function T2(s,n){return s/b2(n)}function A0(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Kd{constructor(n,a,d=0){this.x=+n,this.y=+a,this.z=+d}static fromLngLat(n,a=0){const d=pl.convert(n);return new Kd(S2(d.lng),k2(d.lat),T2(a,d.lat))}toLngLat(){return new pl(360*this.x-180,A0(this.y))}toAltitude(){return this.z*b2(A0(this.y))}meterInMercatorCoordinateUnits(){return 1/w2*(n=A0(this.y),1/Math.cos(n*Math.PI/180));var n}}function E2(s,n,a){var d=2*Math.PI*6378137/256/Math.pow(2,a);return[s*d-2*Math.PI*6378137/2,n*d-2*Math.PI*6378137/2]}class D0{constructor(n,a,d){if(!function(y,x,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||x<0||x>=Math.pow(2,y))}(n,a,d))throw new Error(`x=${a}, y=${d}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=a,this.y=d,this.key=Jd(0,n,n,a,d)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,a,d){const y=(w=this.y,b=this.z,k=E2(256*(x=this.x),256*(w=Math.pow(2,b)-w-1),b),I=E2(256*(x+1),256*(w+1),b),k[0]+","+k[1]+","+I[0]+","+I[1]);var x,w,b,k,I;const D=function(L,j,Z){let K,J="";for(let le=L;le>0;le--)K=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,y)}isChildOf(n){const a=this.z-n.z;return a>0&&n.x===this.x>>a&&n.y===this.y>>a}getTilePoint(n){const a=Math.pow(2,this.z);return new A((n.x*a-this.x)*Cn,(n.y*a-this.y)*Cn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class C2{constructor(n,a){this.wrap=n,this.canonical=a,this.key=Jd(n,a.z,a.z,a.x,a.y)}}class Ss{constructor(n,a,d,y,x){if(n= z; overscaledZ = ${n}; z = ${d}`);this.overscaledZ=n,this.wrap=a,this.canonical=new D0(d,+y,+x),this.key=Jd(a,n,d,y,x)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-n;return n>this.canonical.z?new Ss(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(n,this.wrap,n,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(n,a){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const d=this.canonical.z-n;return n>this.canonical.z?Jd(this.wrap*+a,n,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+a,n,n,this.canonical.x>>d,this.canonical.y>>d)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const a=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>a&&n.canonical.y===this.canonical.y>>a}children(n){if(this.overscaledZ>=n)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,d=2*this.canonical.x,y=2*this.canonical.y;return[new Ss(a,this.wrap,a,d,y),new Ss(a,this.wrap,a,d+1,y),new Ss(a,this.wrap,a,d,y+1),new Ss(a,this.wrap,a,d+1,y+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(n+1)}unpack(n,a,d){return n*this.redFactor+a*this.greenFactor+d*this.blueFactor-this.baseShift}getPixels(){return new bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,a,d){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let y=a*this.dim,x=a*this.dim+this.dim,w=d*this.dim,b=d*this.dim+this.dim;switch(a){case-1:y=x-1;break;case 1:x=y+1}switch(d){case-1:w=b-1;break;case 1:b=w+1}const k=-a*this.dim,I=-d*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class M2{constructor(n,a,d,y,x){this.type="Feature",this._vectorTileFeature=n,n._z=a,n._x=d,n._y=y,this.properties=n.properties,this.id=x}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(n[a]=this[a]);return n}}class A2{constructor(n,a){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new el(Cn,16,0),this.grid3D=new el(Cn,16,0),this.featureIndexArray=new ii,this.promoteId=a}insert(n,a,d,y,x,w){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,y,x);const k=w?this.grid3D:this.grid;for(let I=0;I=0&&L[3]>=0&&k.insert(b,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new hl.VectorTile(new x0(this.rawTileData)).layers,this.sourceLayerCoder=new P2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,a,d,y){this.loadVTLayers();const x=n.params||{},w=Cn/n.tileSize/n.scale,b=yd(x.filter),k=n.queryGeometry,I=n.queryPadding*w,D=z2(k),L=this.grid.query(D.minX-I,D.minY-I,D.maxX+I,D.maxY+I),j=z2(n.cameraQueryGeometry),Z=this.grid3D.query(j.minX-I,j.minY-I,j.maxX+I,j.maxY+I,(le,fe,De,be)=>function(Me,Ve,et,xt,Nt){for(const pt of Me)if(Ve<=pt.x&&et<=pt.y&&xt>=pt.x&&Nt>=pt.y)return!0;const yt=[new A(Ve,et),new A(Ve,Nt),new A(xt,Nt),new A(xt,et)];if(Me.length>2){for(const pt of yt)if(Oc(Me,pt))return!0}for(let pt=0;pt(be||(be=pu(Me)),Ve.queryIntersectsFeature(k,Me,et,be,this.z,n.transform,w,n.pixelPosMatrix)))}return K}loadMatchingFeature(n,a,d,y,x,w,b,k,I,D,L){const j=this.bucketLayerIDs[a];if(w&&!function(le,fe){for(let De=0;De=0)return!0;return!1}(w,j))return;const Z=this.sourceLayerCoder.decode(d),K=this.vtLayers[Z].feature(y);if(x.needGeometry){const le=mu(K,!0);if(!x.filter(new Vr(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!x.filter(new Vr(this.tileID.overscaledZ),K))return;const J=this.getId(K,Z);for(let le=0;le{const b=n instanceof cu?n.get(w):null;return b&&b.evaluate?b.evaluate(a,d,y):b})}function z2(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return{minX:n,minY:a,maxX:d,maxY:y}}function Y3(s,n){return n-s}function R2(s,n,a,d,y){const x=[];for(let w=0;w=d&&L.x>=d||(D.x>=d?D=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round():L.x>=d&&(L=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round()),D.y>=y&&L.y>=y||(D.y>=y?D=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round():L.y>=y&&(L=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round()),k&&D.equals(k[k.length-1])||(k=[D],x.push(k)),k.push(L)))))}}return x}St("FeatureIndex",A2,{omit:["rawTileData","sourceLayerCoder"]});class ml extends A{constructor(n,a,d,y){super(n,a),this.angle=d,y!==void 0&&(this.segment=y)}clone(){return new ml(this.x,this.y,this.angle,this.segment)}}function L2(s,n,a,d,y){if(n.segment===void 0||a===0)return!0;let x=n,w=n.segment+1,b=0;for(;b>-a/2;){if(w--,w<0)return!1;b-=s[w].dist(x),x=s[w]}b+=s[w].dist(s[w+1]),w++;const k=[];let I=0;for(;bd;)I-=k.shift().angleDelta;if(I>y)return!1;w++,b+=D.dist(L)}return!0}function O2(s){let n=0;for(let a=0;aI){const K=(I-k)/Z,J=gi.number(L.x,j.x,K),le=gi.number(L.y,j.y,K),fe=new ml(J,le,j.angleTo(L),D);return fe._round(),!w||L2(s,fe,b,w,n)?fe:void 0}k+=Z}}function K3(s,n,a,d,y,x,w,b,k){const I=F2(d,x,w),D=B2(d,y),L=D*w,j=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return n-L=0&&Me=0&&Ve=0&&j+I<=D){const et=new ml(Me,Ve,De,K);et._round(),d&&!L2(s,et,x,d,y)||Z.push(et)}}L+=fe}return b||Z.length||w||(Z=N2(s,L/2,a,d,y,x,w,!0,k)),Z}St("Anchor",ml);const Hc=Oi;function $2(s,n,a,d){const y=[],x=s.image,w=x.pixelRatio,b=x.paddedRect.w-2*Hc,k=x.paddedRect.h-2*Hc;let I={x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};const D=x.stretchX||[[0,b]],L=x.stretchY||[[0,k]],j=(Ye,Dt)=>Ye+Dt[1]-Dt[0],Z=D.reduce(j,0),K=L.reduce(j,0),J=b-Z,le=k-K;let fe=0,De=Z,be=0,Me=K,Ve=0,et=J,xt=0,Nt=le;if(x.content&&d){const Ye=x.content,Dt=Ye[2]-Ye[0],Mt=Ye[3]-Ye[1];(x.textFitWidth||x.textFitHeight)&&(I=f2(s)),fe=Em(D,0,Ye[0]),be=Em(L,0,Ye[1]),De=Em(D,Ye[0],Ye[2]),Me=Em(L,Ye[1],Ye[3]),Ve=Ye[0]-fe,xt=Ye[1]-be,et=Dt-De,Nt=Mt-Me}const yt=I.x1,pt=I.y1,At=I.x2-yt,Tt=I.y2-pt,bt=(Ye,Dt,Mt,Zt)=>{const Fr=Cm(Ye.stretch-fe,De,At,yt),Or=Im(Ye.fixed-Ve,et,Ye.stretch,Z),zn=Cm(Dt.stretch-be,Me,Tt,pt),Gs=Im(Dt.fixed-xt,Nt,Dt.stretch,K),Xn=Cm(Mt.stretch-fe,De,At,yt),Rn=Im(Mt.fixed-Ve,et,Mt.stretch,Z),xi=Cm(Zt.stretch-be,Me,Tt,pt),wi=Im(Zt.fixed-xt,Nt,Zt.stretch,K),bi=new A(Fr,zn),mn=new A(Xn,zn),Ln=new A(Xn,xi),oi=new A(Fr,xi),Kn=new A(Or/w,Gs/w),Si=new A(Rn/w,wi/w),Jn=n*Math.PI/180;if(Jn){const xr=Math.sin(Jn),$r=Math.cos(Jn),Zr=[$r,-xr,xr,$r];bi._matMult(Zr),mn._matMult(Zr),oi._matMult(Zr),Ln._matMult(Zr)}const ks=Ye.stretch+Ye.fixed,Fi=Dt.stretch+Dt.fixed;return{tl:bi,tr:mn,bl:oi,br:Ln,tex:{x:x.paddedRect.x+Hc+ks,y:x.paddedRect.y+Hc+Fi,w:Mt.stretch+Mt.fixed-ks,h:Zt.stretch+Zt.fixed-Fi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Kn,pixelOffsetBR:Si,minFontScaleX:et/w/At,minFontScaleY:Nt/w/Tt,isSDF:a}};if(d&&(x.stretchX||x.stretchY)){const Ye=j2(D,J,Z),Dt=j2(L,le,K);for(let Mt=0;Mt0&&(J=Math.max(10,J),this.circleDiameter=J)}else{const j=!((L=w.image)===null||L===void 0)&&L.content&&(w.image.textFitWidth||w.image.textFitHeight)?f2(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};j.y1=j.y1*b-k[0],j.y2=j.y2*b+k[2],j.x1=j.x1*b-k[3],j.x2=j.x2*b+k[1];const Z=w.collisionPadding;if(Z&&(j.x1-=Z[0]*b,j.y1-=Z[1]*b,j.x2+=Z[2]*b,j.y2+=Z[3]*b),D){const K=new A(j.x1,j.y1),J=new A(j.x2,j.y1),le=new A(j.x1,j.y2),fe=new A(j.x2,j.y2),De=D*Math.PI/180;K._rotate(De),J._rotate(De),le._rotate(De),fe._rotate(De),j.x1=Math.min(K.x,J.x,le.x,fe.x),j.x2=Math.max(K.x,J.x,le.x,fe.x),j.y1=Math.min(K.y,J.y,le.y,fe.y),j.y2=Math.max(K.y,J.y,le.y,fe.y)}n.emplaceBack(a.x,a.y,j.x1,j.y1,j.x2,j.y2,d,y,x)}this.boxEndIndex=n.length}}class J3{constructor(n=[],a=(d,y)=>dy?1:0){if(this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],a=this.data.pop();return--this.length>0&&(this.data[0]=a,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:a,compare:d}=this,y=a[n];for(;n>0;){const x=n-1>>1,w=a[x];if(d(y,w)>=0)break;a[n]=w,n=x}a[n]=y}_down(n){const{data:a,compare:d}=this,y=this.length>>1,x=a[n];for(;n=0)break;a[n]=a[w],n=w}a[n]=x}}function Q3(s,n=1,a=!1){let d=1/0,y=1/0,x=-1/0,w=-1/0;const b=s[0];for(let Z=0;Zx)&&(x=K.x),(!Z||K.y>w)&&(w=K.y)}const k=Math.min(x-d,w-y);let I=k/2;const D=new J3([],eD);if(k===0)return new A(d,y);for(let Z=d;ZL.d||!L.d)&&(L=Z,a&&console.log("found best %d after %d probes",Math.round(1e4*Z.d)/1e4,j)),Z.max-L.d<=n||(I=Z.h/2,D.push(new Wc(Z.p.x-I,Z.p.y-I,I,s)),D.push(new Wc(Z.p.x+I,Z.p.y-I,I,s)),D.push(new Wc(Z.p.x-I,Z.p.y+I,I,s)),D.push(new Wc(Z.p.x+I,Z.p.y+I,I,s)),j+=4)}return a&&(console.log(`num probes: ${j}`),console.log(`best distance: ${L.d}`)),L.p}function eD(s,n){return n.max-s.max}function Wc(s,n,a,d){this.p=new A(s,n),this.h=a,this.d=function(y,x){let w=!1,b=1/0;for(let k=0;ky.y!=K.y>y.y&&y.x<(K.x-Z.x)*(y.y-Z.y)/(K.y-Z.y)+Z.x&&(w=!w),b=Math.min(b,kb(y,Z,K))}}return(w?1:-1)*Math.sqrt(b)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}var Yn;g.aq=void 0,(Yn=g.aq||(g.aq={}))[Yn.center=1]="center",Yn[Yn.left=2]="left",Yn[Yn.right=3]="right",Yn[Yn.top=4]="top",Yn[Yn.bottom=5]="bottom",Yn[Yn["top-left"]=6]="top-left",Yn[Yn["top-right"]=7]="top-right",Yn[Yn["bottom-left"]=8]="bottom-left",Yn[Yn["bottom-right"]=9]="bottom-right";const gl=7,z0=Number.POSITIVE_INFINITY;function U2(s,n){return n[1]!==z0?function(a,d,y){let x=0,w=0;switch(d=Math.abs(d),y=Math.abs(y),a){case"top-right":case"top-left":case"top":w=y-gl;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+gl}switch(a){case"top-right":case"bottom-right":case"right":x=-d;break;case"top-left":case"bottom-left":case"left":x=d}return[x,w]}(s,n[0],n[1]):function(a,d){let y=0,x=0;d<0&&(d=0);const w=d/Math.SQRT2;switch(a){case"top-right":case"top-left":x=w-gl;break;case"bottom-right":case"bottom-left":x=-w+gl;break;case"bottom":x=-d+gl;break;case"top":x=d-gl}switch(a){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=d;break;case"right":y=-d}return[y,x]}(s,n[0])}function V2(s,n,a){var d;const y=s.layout,x=(d=y.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(n,{},a);if(x){const b=x.values,k=[];for(let I=0;Ij*Pn);D.startsWith("top")?L[1]-=gl:D.startsWith("bottom")&&(L[1]+=gl),k[I+1]=L}return new Xi(k)}const w=y.get("text-variable-anchor");if(w){let b;b=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(n,{},a)*Pn,z0]:y.get("text-offset").evaluate(n,{},a).map(I=>I*Pn);const k=[];for(const I of w)k.push(I,U2(I,b));return new Xi(k)}return null}function R0(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tD(s,n,a,d,y,x,w,b,k,I,D){let L=x.textMaxSize.evaluate(n,{});L===void 0&&(L=w);const j=s.layers[0].layout,Z=j.get("icon-offset").evaluate(n,{},D),K=W2(a.horizontal),J=w/24,le=s.tilePixelRatio*J,fe=s.tilePixelRatio*L/24,De=s.tilePixelRatio*b,be=s.tilePixelRatio*j.get("symbol-spacing"),Me=j.get("text-padding")*s.tilePixelRatio,Ve=function(Ye,Dt,Mt,Zt=1){const Fr=Ye.get("icon-padding").evaluate(Dt,{},Mt),Or=Fr&&Fr.values;return[Or[0]*Zt,Or[1]*Zt,Or[2]*Zt,Or[3]*Zt]}(j,n,D,s.tilePixelRatio),et=j.get("text-max-angle")/180*Math.PI,xt=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",Nt=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",yt=j.get("symbol-placement"),pt=be/2,At=j.get("icon-text-fit");let Tt;d&&At!=="none"&&(s.allowVerticalPlacement&&a.vertical&&(Tt=p2(d,a.vertical,At,j.get("icon-text-fit-padding"),Z,J)),K&&(d=p2(d,K,At,j.get("icon-text-fit-padding"),Z,J)));const bt=(Ye,Dt)=>{Dt.x<0||Dt.x>=Cn||Dt.y<0||Dt.y>=Cn||function(Mt,Zt,Fr,Or,zn,Gs,Xn,Rn,xi,wi,bi,mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr,$r,Zr,ns,nn,Gc){const Ro=Mt.addToLineVertexArray(Zt,Fr);let Lo,Zs,Ts,$n,da=0,tf=0,Y2=0,X2=0,U0=-1,V0=-1;const fa={};let K2=Dc("");if(Mt.allowVerticalPlacement&&Or.vertical){const ai=Rn.layout.get("text-rotate").evaluate($r,{},nn)+90;Ts=new Pm(xi,Zt,wi,bi,mn,Or.vertical,Ln,oi,Kn,ai),Xn&&($n=new Pm(xi,Zt,wi,bi,mn,Xn,Jn,ks,Kn,ai))}if(zn){const ai=Rn.layout.get("icon-rotate").evaluate($r,{}),Es=Rn.layout.get("icon-text-fit")!=="none",yu=$2(zn,ai,ns,Es),ho=Xn?$2(Xn,ai,ns,Es):void 0;Zs=new Pm(xi,Zt,wi,bi,mn,zn,Jn,ks,!1,ai),da=4*yu.length;const _u=Mt.iconSizeData;let Oo=null;_u.kind==="source"?(Oo=[zo*Rn.layout.get("icon-size").evaluate($r,{})],Oo[0]>fl&&je(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)):_u.kind==="composite"&&(Oo=[zo*Zr.compositeIconSizes[0].evaluate($r,{},nn),zo*Zr.compositeIconSizes[1].evaluate($r,{},nn)],(Oo[0]>fl||Oo[1]>fl)&&je(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,yu,Oo,xr,Fi,$r,g.ah.none,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),U0=Mt.icon.placedSymbolArray.length-1,ho&&(tf=4*ho.length,Mt.addSymbols(Mt.icon,ho,Oo,xr,Fi,$r,g.ah.vertical,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),V0=Mt.icon.placedSymbolArray.length-1)}const J2=Object.keys(Or.horizontal);for(const ai of J2){const Es=Or.horizontal[ai];if(!Lo){K2=Dc(Es.text);const ho=Rn.layout.get("text-rotate").evaluate($r,{},nn);Lo=new Pm(xi,Zt,wi,bi,mn,Es,Ln,oi,Kn,ho)}const yu=Es.positionedLines.length===1;if(Y2+=H2(Mt,Zt,Es,Gs,Rn,Kn,$r,Si,Ro,Or.vertical?g.ah.horizontal:g.ah.horizontalOnly,yu?J2:[ai],fa,U0,Zr,nn),yu)break}Or.vertical&&(X2+=H2(Mt,Zt,Or.vertical,Gs,Rn,Kn,$r,Si,Ro,g.ah.vertical,["vertical"],fa,V0,Zr,nn));const iD=Lo?Lo.boxStartIndex:Mt.collisionBoxArray.length,sD=Lo?Lo.boxEndIndex:Mt.collisionBoxArray.length,oD=Ts?Ts.boxStartIndex:Mt.collisionBoxArray.length,aD=Ts?Ts.boxEndIndex:Mt.collisionBoxArray.length,lD=Zs?Zs.boxStartIndex:Mt.collisionBoxArray.length,uD=Zs?Zs.boxEndIndex:Mt.collisionBoxArray.length,cD=$n?$n.boxStartIndex:Mt.collisionBoxArray.length,hD=$n?$n.boxEndIndex:Mt.collisionBoxArray.length;let co=-1;const Am=(ai,Es)=>ai&&ai.circleDiameter?Math.max(ai.circleDiameter,Es):Es;co=Am(Lo,co),co=Am(Ts,co),co=Am(Zs,co),co=Am($n,co);const Q2=co>-1?1:0;Q2&&(co*=Gc/Pn),Mt.glyphOffsetArray.length>=Vc.MAX_GLYPHS&&je("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$r.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,$r.sortKey);const dD=V2(Rn,$r,nn),[fD,pD]=function(ai,Es){const yu=ai.length,ho=Es==null?void 0:Es.values;if((ho==null?void 0:ho.length)>0)for(let _u=0;_u=0?fa.right:-1,fa.center>=0?fa.center:-1,fa.left>=0?fa.left:-1,fa.vertical||-1,U0,V0,K2,iD,sD,oD,aD,lD,uD,cD,hD,wi,Y2,X2,da,tf,Q2,0,Ln,co,fD,pD)}(s,Dt,Ye,a,d,y,Tt,s.layers[0],s.collisionBoxArray,n.index,n.sourceLayerIndex,s.index,le,[Me,Me,Me,Me],xt,k,De,Ve,Nt,Z,n,x,I,D,w)};if(yt==="line")for(const Ye of R2(n.geometry,0,0,Cn,Cn)){const Dt=K3(Ye,be,et,a.vertical||K,d,24,fe,s.overscaling,Cn);for(const Mt of Dt)K&&rD(s,K.text,pt,Mt)||bt(Ye,Mt)}else if(yt==="line-center"){for(const Ye of n.geometry)if(Ye.length>1){const Dt=X3(Ye,et,a.vertical||K,d,24,fe);Dt&&bt(Ye,Dt)}}else if(n.type==="Polygon")for(const Ye of lc(n.geometry,0)){const Dt=Q3(Ye,16);bt(Ye[0],new ml(Dt.x,Dt.y,0))}else if(n.type==="LineString")for(const Ye of n.geometry)bt(Ye,new ml(Ye[0].x,Ye[0].y,0));else if(n.type==="Point")for(const Ye of n.geometry)for(const Dt of Ye)bt([Dt],new ml(Dt.x,Dt.y,0))}function H2(s,n,a,d,y,x,w,b,k,I,D,L,j,Z,K){const J=function(De,be,Me,Ve,et,xt,Nt,yt){const pt=Ve.layout.get("text-rotate").evaluate(xt,{})*Math.PI/180,At=[];for(const Tt of be.positionedLines)for(const bt of Tt.positionedGlyphs){if(!bt.rect)continue;const Ye=bt.rect||{};let Dt=o2+1,Mt=!0,Zt=1,Fr=0;const Or=(et||yt)&&bt.vertical,zn=bt.metrics.advance*bt.scale/2;if(yt&&be.verticalizable&&(Fr=Tt.lineOffset/2-(bt.imageName?-(Pn-bt.metrics.width*bt.scale)/2:(bt.scale-1)*Pn)),bt.imageName){const xr=Nt[bt.imageName];Mt=xr.sdf,Zt=xr.pixelRatio,Dt=Oi/Zt}const Gs=et?[bt.x+zn,bt.y]:[0,0];let Xn=et?[0,0]:[bt.x+zn+Me[0],bt.y+Me[1]-Fr],Rn=[0,0];Or&&(Rn=Xn,Xn=[0,0]);const xi=bt.metrics.isDoubleResolution?2:1,wi=(bt.metrics.left-Dt)*bt.scale-zn+Xn[0],bi=(-bt.metrics.top-Dt)*bt.scale+Xn[1],mn=wi+Ye.w/xi*bt.scale/Zt,Ln=bi+Ye.h/xi*bt.scale/Zt,oi=new A(wi,bi),Kn=new A(mn,bi),Si=new A(wi,Ln),Jn=new A(mn,Ln);if(Or){const xr=new A(-zn,zn-qd),$r=-Math.PI/2,Zr=Pn/2-zn,ns=new A(5-qd-Zr,-(bt.imageName?Zr:0)),nn=new A(...Rn);oi._rotateAround($r,xr)._add(ns)._add(nn),Kn._rotateAround($r,xr)._add(ns)._add(nn),Si._rotateAround($r,xr)._add(ns)._add(nn),Jn._rotateAround($r,xr)._add(ns)._add(nn)}if(pt){const xr=Math.sin(pt),$r=Math.cos(pt),Zr=[$r,-xr,xr,$r];oi._matMult(Zr),Kn._matMult(Zr),Si._matMult(Zr),Jn._matMult(Zr)}const ks=new A(0,0),Fi=new A(0,0);At.push({tl:oi,tr:Kn,bl:Si,br:Jn,tex:Ye,writingMode:be.writingMode,glyphOffset:Gs,sectionIndex:bt.sectionIndex,isSDF:Mt,pixelOffsetTL:ks,pixelOffsetBR:Fi,minFontScaleX:0,minFontScaleY:0})}return At}(0,a,b,y,x,w,d,s.allowVerticalPlacement),le=s.textSizeData;let fe=null;le.kind==="source"?(fe=[zo*y.layout.get("text-size").evaluate(w,{})],fe[0]>fl&&je(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)):le.kind==="composite"&&(fe=[zo*Z.compositeTextSizes[0].evaluate(w,{},K),zo*Z.compositeTextSizes[1].evaluate(w,{},K)],(fe[0]>fl||fe[1]>fl)&&je(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)),s.addSymbols(s.text,J,fe,b,x,w,I,n,k.lineStartIndex,k.lineLength,j,K);for(const De of D)L[De]=s.text.placedSymbolArray.length-1;return 4*J.length}function W2(s){for(const n in s)return s[n];return null}function rD(s,n,a,d){const y=s.compareText;if(n in y){const x=y[n];for(let w=x.length-1;w>=0;w--)if(d.dist(x[w])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const x=G2[15&d];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new L0(b,w,x,n)}constructor(n,a=64,d=Float64Array,y){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=d,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const x=G2.indexOf(this.ArrayType),w=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,k=(8-b%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${d}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+w+b+k),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=n)}add(n,a){const d=this._pos>>1;return this.ids[d]=d,this.coords[this._pos++]=n,this.coords[this._pos++]=a,d}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return O0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,a,d,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:b}=this,k=[0,x.length-1,0],I=[];for(;k.length;){const D=k.pop()||0,L=k.pop()||0,j=k.pop()||0;if(L-j<=b){for(let le=j;le<=L;le++){const fe=w[2*le],De=w[2*le+1];fe>=n&&fe<=d&&De>=a&&De<=y&&I.push(x[le])}continue}const Z=j+L>>1,K=w[2*Z],J=w[2*Z+1];K>=n&&K<=d&&J>=a&&J<=y&&I.push(x[Z]),(D===0?n<=K:a<=J)&&(k.push(j),k.push(Z-1),k.push(1-D)),(D===0?d>=K:y>=J)&&(k.push(Z+1),k.push(L),k.push(1-D))}return I}within(n,a,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:x,nodeSize:w}=this,b=[0,y.length-1,0],k=[],I=d*d;for(;b.length;){const D=b.pop()||0,L=b.pop()||0,j=b.pop()||0;if(L-j<=w){for(let le=j;le<=L;le++)q2(x[2*le],x[2*le+1],n,a)<=I&&k.push(y[le]);continue}const Z=j+L>>1,K=x[2*Z],J=x[2*Z+1];q2(K,J,n,a)<=I&&k.push(y[Z]),(D===0?n-d<=K:a-d<=J)&&(b.push(j),b.push(Z-1),b.push(1-D)),(D===0?n+d>=K:a+d>=J)&&(b.push(Z+1),b.push(L),b.push(1-D))}return k}}function O0(s,n,a,d,y,x){if(y-d<=a)return;const w=d+y>>1;Z2(s,n,w,d,y,x),O0(s,n,a,d,w-1,1-x),O0(s,n,a,w+1,y,1-x)}function Z2(s,n,a,d,y,x){for(;y>d;){if(y-d>600){const I=y-d+1,D=a-d+1,L=Math.log(I),j=.5*Math.exp(2*L/3),Z=.5*Math.sqrt(L*j*(I-j)/I)*(D-I/2<0?-1:1);Z2(s,n,a,Math.max(d,Math.floor(a-D*j/I+Z)),Math.min(y,Math.floor(a+(I-D)*j/I+Z)),x)}const w=n[2*a+x];let b=d,k=y;for(Qd(s,n,d,a),n[2*y+x]>w&&Qd(s,n,d,y);bw;)k--}n[2*d+x]===w?Qd(s,n,d,k):(k++,Qd(s,n,k,y)),k<=a&&(d=k+1),a<=k&&(y=k-1)}}function Qd(s,n,a,d){F0(s,a,d),F0(n,2*a,2*d),F0(n,2*a+1,2*d+1)}function F0(s,n,a){const d=s[n];s[n]=s[a],s[a]=d}function q2(s,n,a,d){const y=s-a,x=n-d;return y*y+x*x}var B0;g.bg=void 0,(B0=g.bg||(g.bg={})).create="create",B0.load="load",B0.fullLoad="fullLoad";let Mm=null,ef=[];const N0=1e3/60,$0="loadTime",j0="fullLoadTime",nD={mark(s){performance.mark(s)},frame(s){const n=s;Mm!=null&&ef.push(n-Mm),Mm=n},clearMetrics(){Mm=null,ef=[],performance.clearMeasures($0),performance.clearMeasures(j0);for(const s in g.bg)performance.clearMarks(g.bg[s])},getPerformanceMetrics(){performance.measure($0,g.bg.create,g.bg.load),performance.measure(j0,g.bg.create,g.bg.fullLoad);const s=performance.getEntriesByName($0)[0].duration,n=performance.getEntriesByName(j0)[0].duration,a=ef.length,d=1/(ef.reduce((x,w)=>x+w,0)/a/1e3),y=ef.filter(x=>x>N0).reduce((x,w)=>x+(w-N0)/N0,0);return{loadTime:s,fullLoadTime:n,fps:d,percentDroppedFrames:y/(a+y)*100,totalFrames:a}}};g.$=class extends F{},g.A=Fc,g.B=Y_,g.C=function(s){if(vt==null){const n=s.navigator?s.navigator.userAgent:null;vt=!!s.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return vt},g.D=It,g.E=Ue,g.F=class{constructor(s,n){this.target=s,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new q3(()=>this.process()),this.subscription=function(a,d,y,x){return a.addEventListener(d,y,!1),{unsubscribe:()=>{a.removeEventListener(d,y,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=Re(self)?s:window}registerMessageHandler(s,n){this.messageHandlers[s]=n}sendAsync(s,n){return new Promise((a,d)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:a,reject:d},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const b={id:y,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const x=[],w=Object.assign(Object.assign({},s),{id:y,sourceMapId:this.mapId,origin:location.origin,data:tl(s.data,x)});this.target.postMessage(w,{transfer:x})})}receive(s){const n=s.data,a=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!=="resource://android"&&location.origin!=="resource://android"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[a];const d=this.abortControllers[a];return delete this.abortControllers[a],void(d&&d.abort())}if(Re(self)||n.mustQueue)return this.tasks[a]=n,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,n)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),n=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(s,n)}processTask(s,n){return c(this,void 0,void 0,function*(){if(n.type===""){const y=this.resolveRejects[s];return delete this.resolveRejects[s],y?void(n.error?y.reject(rl(n.error)):y.resolve(rl(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=rl(n.data),d=new AbortController;this.abortControllers[s]=d;try{const y=yield this.messageHandlers[n.type](n.sourceMapId,a,d);this.completeTask(s,null,y)}catch(y){this.completeTask(s,y)}})}completeTask(s,n,a){const d=[];delete this.abortControllers[s];const y={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?tl(n):null,data:tl(a,d)};this.target.postMessage(y,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},g.G=Jt,g.H=function(){var s=new Fc(16);return Fc!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},g.I=b0,g.J=function(s,n,a){var d,y,x,w,b,k,I,D,L,j,Z,K,J=a[0],le=a[1],fe=a[2];return n===s?(s[12]=n[0]*J+n[4]*le+n[8]*fe+n[12],s[13]=n[1]*J+n[5]*le+n[9]*fe+n[13],s[14]=n[2]*J+n[6]*le+n[10]*fe+n[14],s[15]=n[3]*J+n[7]*le+n[11]*fe+n[15]):(y=n[1],x=n[2],w=n[3],b=n[4],k=n[5],I=n[6],D=n[7],L=n[8],j=n[9],Z=n[10],K=n[11],s[0]=d=n[0],s[1]=y,s[2]=x,s[3]=w,s[4]=b,s[5]=k,s[6]=I,s[7]=D,s[8]=L,s[9]=j,s[10]=Z,s[11]=K,s[12]=d*J+b*le+L*fe+n[12],s[13]=y*J+k*le+j*fe+n[13],s[14]=x*J+I*le+Z*fe+n[14],s[15]=w*J+D*le+K*fe+n[15]),s},g.K=function(s,n,a){var d=a[0],y=a[1],x=a[2];return s[0]=n[0]*d,s[1]=n[1]*d,s[2]=n[2]*d,s[3]=n[3]*d,s[4]=n[4]*y,s[5]=n[5]*y,s[6]=n[6]*y,s[7]=n[7]*y,s[8]=n[8]*x,s[9]=n[9]*x,s[10]=n[10]*x,s[11]=n[11]*x,s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15],s},g.L=Ib,g.M=function(s,n){const a={};for(let d=0;d{const n=window.document.createElement("video");return n.muted=!0,new Promise(a=>{n.onloadstart=()=>{a(n)};for(const d of s){const y=window.document.createElement("source");_r(d)||(n.crossOrigin="Anonymous"),y.src=d,n.appendChild(y)}})},g.a4=function(){return Fe++},g.a5=_t,g.a6=Vc,g.a7=yd,g.a8=mu,g.a9=M2,g.aA=function(s){if(s.type==="custom")return new Z3(s);switch(s.type){case"background":return new H3(s);case"circle":return new AA(s);case"fill":return new qA(s);case"fill-extrusion":return new u3(s);case"heatmap":return new zA(s);case"hillshade":return new LA(s);case"line":return new y3(s);case"raster":return new G3(s);case"symbol":return new Tm(s)}},g.aB=it,g.aC=function(s,n){if(!s)return[{command:"setStyle",args:[n]}];let a=[];try{if(!Te(s.version,n.version))return[{command:"setStyle",args:[n]}];Te(s.center,n.center)||a.push({command:"setCenter",args:[n.center]}),Te(s.zoom,n.zoom)||a.push({command:"setZoom",args:[n.zoom]}),Te(s.bearing,n.bearing)||a.push({command:"setBearing",args:[n.bearing]}),Te(s.pitch,n.pitch)||a.push({command:"setPitch",args:[n.pitch]}),Te(s.sprite,n.sprite)||a.push({command:"setSprite",args:[n.sprite]}),Te(s.glyphs,n.glyphs)||a.push({command:"setGlyphs",args:[n.glyphs]}),Te(s.transition,n.transition)||a.push({command:"setTransition",args:[n.transition]}),Te(s.light,n.light)||a.push({command:"setLight",args:[n.light]}),Te(s.terrain,n.terrain)||a.push({command:"setTerrain",args:[n.terrain]}),Te(s.sky,n.sky)||a.push({command:"setSky",args:[n.sky]}),Te(s.projection,n.projection)||a.push({command:"setProjection",args:[n.projection]});const d={},y=[];(function(w,b,k,I){let D;for(D in b=b||{},w=w||{})Object.prototype.hasOwnProperty.call(w,D)&&(Object.prototype.hasOwnProperty.call(b,D)||Ne(D,k,I));for(D in b)Object.prototype.hasOwnProperty.call(b,D)&&(Object.prototype.hasOwnProperty.call(w,D)?Te(w[D],b[D])||(w[D].type==="geojson"&&b[D].type==="geojson"&&kt(w,b,D)?Ze(k,{command:"setGeoJSONSourceData",args:[D,b[D].data]}):ot(D,b,k,I)):tt(D,b,k))})(s.sources,n.sources,y,d);const x=[];s.layers&&s.layers.forEach(w=>{"source"in w&&d[w.source]?a.push({command:"removeLayer",args:[w.id]}):x.push(w)}),a=a.concat(y),function(w,b,k){b=b||[];const I=(w=w||[]).map(Bt),D=b.map(Bt),L=w.reduce(Tr,{}),j=b.reduce(Tr,{}),Z=I.slice(),K=Object.create(null);let J,le,fe,De,be;for(let Me=0,Ve=0;Me@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,d,y,x)=>{const w=y||x;return n[d]=!w||w.toLowerCase(),""}),n["max-age"]){const a=parseInt(n["max-age"],10);isNaN(a)?delete n["max-age"]:n["max-age"]=a}return n},g.ab=function(s,n){const a=[];for(const d in s)d in n||a.push(d);return a},g.ac=oe,g.ad=function(s,n,a){var d=Math.sin(a),y=Math.cos(a),x=n[0],w=n[1],b=n[2],k=n[3],I=n[4],D=n[5],L=n[6],j=n[7];return n!==s&&(s[8]=n[8],s[9]=n[9],s[10]=n[10],s[11]=n[11],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=x*y+I*d,s[1]=w*y+D*d,s[2]=b*y+L*d,s[3]=k*y+j*d,s[4]=I*y-x*d,s[5]=D*y-w*d,s[6]=L*y-b*d,s[7]=j*y-k*d,s},g.ae=function(s){var n=new Fc(16);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],n},g.af=gm,g.ag=function(s,n){let a=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:y,minZoom:x,maxZoom:w}=s,b=y?oe(yi.interpolationFactor(y,n,x,w),0,1):0;s.kind==="camera"?d=gi.number(s.minSize,s.maxSize,b):a=b}return{uSizeT:a,uSize:d}},g.ai=function(s,{uSize:n,uSizeT:a},{lowerSize:d,upperSize:y}){return s.kind==="source"?d/zo:s.kind==="composite"?gi.number(d/zo,y/zo,a):n},g.aj=E0,g.ak=function(s,n,a,d){const y=n.y-s.y,x=n.x-s.x,w=d.y-a.y,b=d.x-a.x,k=w*x-b*y;if(k===0)return null;const I=(b*(s.y-a.y)-w*(s.x-a.x))/k;return new A(s.x+I*x,s.y+I*y)},g.al=R2,g.am=bb,g.an=a0,g.ao=function(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return[n,a,d,y]},g.ap=Pn,g.ar=T0,g.as=function(s,n){var a=n[0],d=n[1],y=n[2],x=n[3],w=n[4],b=n[5],k=n[6],I=n[7],D=n[8],L=n[9],j=n[10],Z=n[11],K=n[12],J=n[13],le=n[14],fe=n[15],De=a*b-d*w,be=a*k-y*w,Me=a*I-x*w,Ve=d*k-y*b,et=d*I-x*b,xt=y*I-x*k,Nt=D*J-L*K,yt=D*le-j*K,pt=D*fe-Z*K,At=L*le-j*J,Tt=L*fe-Z*J,bt=j*fe-Z*le,Ye=De*bt-be*Tt+Me*At+Ve*pt-et*yt+xt*Nt;return Ye?(s[0]=(b*bt-k*Tt+I*At)*(Ye=1/Ye),s[1]=(y*Tt-d*bt-x*At)*Ye,s[2]=(J*xt-le*et+fe*Ve)*Ye,s[3]=(j*et-L*xt-Z*Ve)*Ye,s[4]=(k*pt-w*bt-I*yt)*Ye,s[5]=(a*bt-y*pt+x*yt)*Ye,s[6]=(le*Me-K*xt-fe*be)*Ye,s[7]=(D*xt-j*Me+Z*be)*Ye,s[8]=(w*Tt-b*pt+I*Nt)*Ye,s[9]=(d*pt-a*Tt-x*Nt)*Ye,s[10]=(K*et-J*Me+fe*De)*Ye,s[11]=(L*Me-D*et-Z*De)*Ye,s[12]=(b*yt-w*At-k*Nt)*Ye,s[13]=(a*At-d*yt+y*Nt)*Ye,s[14]=(J*be-K*Ve-le*De)*Ye,s[15]=(D*Ve-L*be+j*De)*Ye,s):null},g.at=R0,g.au=k0,g.av=L0,g.aw=function(){const s={},n=ie.$version;for(const a in ie.$root){const d=ie.$root[a];if(d.required){let y=null;y=a==="version"?n:d.type==="array"?[]:{},y!=null&&(s[a]=y)}}return s},g.ax=Ad,g.ay=Vt,g.az=function(s){s=s.slice();const n=Object.create(null);for(let a=0;a25||d<0||d>=1||a<0||a>=1)},g.bc=function(s,n){return s[0]=n[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=n[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},g.bd=class extends z{},g.be=M0,g.bf=nD,g.bh=er,g.bi=function(s,n){nt.REGISTERED_PROTOCOLS[s]=n},g.bj=function(s){delete nt.REGISTERED_PROTOCOLS[s]},g.bk=function(s,n){const a={};for(let y=0;ybt*Pn)}let yt=w?"center":a.get("text-justify").evaluate(I,{},s.canonical);const pt=a.get("symbol-placement")==="point"?a.get("text-max-width").evaluate(I,{},s.canonical)*Pn:1/0,At=()=>{s.bucket.allowVerticalPlacement&&Dd(Me)&&(K.vertical=bm(J,s.glyphMap,s.glyphPositions,s.imagePositions,D,pt,x,xt,"left",et,fe,g.ah.vertical,!0,j,L))};if(!w&&Nt){const Tt=new Set;if(yt==="auto")for(let Ye=0;Yec(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(n)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),g.e=ge,g.f=s=>new Promise((n,a)=>{const d=new Image;d.onload=()=>{n(d),URL.revokeObjectURL(d.src),d.onload=null,window.requestAnimationFrame(()=>{d.src=Be})},d.onerror=()=>a(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const y=new Blob([new Uint8Array(s)],{type:"image/png"});d.src=s.byteLength?URL.createObjectURL(y):Be}),g.g=rt,g.h=(s,n)=>Yt(ge(s,{type:"json"}),n),g.i=Re,g.j=V,g.k=Xr,g.l=(s,n)=>Yt(ge(s,{type:"arrayBuffer"}),n),g.m=Yt,g.n=function(s){return new x0(s).readFields(D3,[])},g.o=jd,g.p=a2,g.q=v,g.r=q_,g.s=_r,g.t=Pd,g.u=la,g.v=ie,g.w=je,g.x=function([s,n,a]){return n+=90,n*=Math.PI/180,a*=Math.PI/180,{x:s*Math.cos(n)*Math.sin(a),y:s*Math.sin(n)*Math.sin(a),z:s*Math.cos(a)}},g.y=gi,g.z=Vr}),h("worker",["./shared"],function(g){class c{constructor(G){this.keyCache={},G&&this.replace(G)}replace(G){this._layerConfigs={},this._layers={},this.update(G,[])}update(G,W){for(const ue of G){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=g.aA(ue);Se._featureFilter=g.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of W)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const ee=g.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of ee){const Se=ue.map($e=>this._layers[$e.id]),Ie=Se[0];if(Ie.visibility==="none")continue;const Ae=Ie.source||"";let _e=this.familiesBySource[Ae];_e||(_e=this.familiesBySource[Ae]={});const He=Ie.sourceLayer||"_geojsonTileLayer";let Je=_e[He];Je||(Je=_e[He]=[]),Je.push(Se)}}}class T{constructor(G){const W={},ee=[];for(const Ae in G){const _e=G[Ae],He=W[Ae]={};for(const Je in _e){const $e=_e[+Je];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const ut={x:0,y:0,w:$e.bitmap.width+2,h:$e.bitmap.height+2};ee.push(ut),He[Je]={rect:ut,metrics:$e.metrics}}}const{w:ue,h:Se}=g.p(ee),Ie=new g.o({width:ue||1,height:Se||1});for(const Ae in G){const _e=G[Ae];for(const He in _e){const Je=_e[+He];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const $e=W[Ae][He].rect;g.o.copy(Je.bitmap,Ie,{x:0,y:0},{x:$e.x+1,y:$e.y+1},Je.bitmap)}}this.image=Ie,this.positions=W}}g.bl("GlyphAtlas",T);class P{constructor(G){this.tileID=new g.S(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[]}parse(G,W,ee,ue){return g._(this,void 0,void 0,function*(){this.status="parsing",this.data=G,this.collisionBoxArray=new g.a5;const Se=new g.bm(Object.keys(G.layers).sort()),Ie=new g.bn(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Ae={},_e={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},He=W.familiesBySource[this.source];for(const rr in He){const Mr=G.layers[rr];if(!Mr)continue;Mr.version===1&&g.w(`Vector tile source "${this.source}" layer "${rr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Yr=Se.encode(rr),Dn=[];for(let Bn=0;Bn=ni.maxzoom||ni.visibility!=="none"&&(R(Bn,this.zoom,ee),(Ae[ni.id]=ni.createBucket({index:Ie.bucketLayerIDs.length,layers:Bn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Yr,sourceID:this.source})).populate(Dn,_e,this.tileID.canonical),Ie.bucketLayerIDs.push(Bn.map(Fa=>Fa.id)))}}const Je=g.aF(_e.glyphDependencies,rr=>Object.keys(rr).map(Number));this.inFlightDependencies.forEach(rr=>rr==null?void 0:rr.abort()),this.inFlightDependencies=[];let $e=Promise.resolve({});if(Object.keys(Je).length){const rr=new AbortController;this.inFlightDependencies.push(rr),$e=ue.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},rr)}const ut=Object.keys(_e.iconDependencies);let Rt=Promise.resolve({});if(ut.length){const rr=new AbortController;this.inFlightDependencies.push(rr),Rt=ue.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"icons"}},rr)}const Ot=Object.keys(_e.patternDependencies);let mr=Promise.resolve({});if(Ot.length){const rr=new AbortController;this.inFlightDependencies.push(rr),mr=ue.sendAsync({type:"GI",data:{icons:Ot,source:this.source,tileID:this.tileID,type:"patterns"}},rr)}const[Qt,gr,or]=yield Promise.all([$e,Rt,mr]),Tn=new T(Qt),rn=new g.bo(gr,or);for(const rr in Ae){const Mr=Ae[rr];Mr instanceof g.a6?(R(Mr.layers,this.zoom,ee),g.bp({bucket:Mr,glyphMap:Qt,glyphPositions:Tn.positions,imageMap:gr,imagePositions:rn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Mr.hasPattern&&(Mr instanceof g.bq||Mr instanceof g.br||Mr instanceof g.bs)&&(R(Mr.layers,this.zoom,ee),Mr.addFeatures(_e,this.tileID.canonical,rn.patternPositions))}return this.status="done",{buckets:Object.values(Ae).filter(rr=>!rr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tn.image,imageAtlas:rn,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?gr:null,glyphPositions:this.returnDependencies?Tn.positions:null}})}}function R(he,G,W){const ee=new g.z(G);for(const ue of he)ue.recalculate(ee,W)}class A{constructor(G,W,ee){this.actor=G,this.layerIndex=W,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(G,W){return g._(this,void 0,void 0,function*(){const ee=yield g.l(G.request,W);try{return{vectorTile:new g.bt.VectorTile(new g.bu(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch(ue){const Se=new Uint8Array(ee.data);let Ie=`Unable to parse the tile at ${G.request.url}, `;throw Ie+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.message}`,new Error(Ie)}})}loadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid,ee=!!(G&&G.request&&G.request.collectResourceTiming)&&new g.bv(G.request),ue=new P(G);this.loading[W]=ue;const Se=new AbortController;ue.abort=Se;try{const Ie=yield this.loadVectorTile(G,Se);if(delete this.loading[W],!Ie)return null;const Ae=Ie.rawData,_e={};Ie.expires&&(_e.expires=Ie.expires),Ie.cacheControl&&(_e.cacheControl=Ie.cacheControl);const He={};if(ee){const $e=ee.finish();$e&&(He.resourceTiming=JSON.parse(JSON.stringify($e)))}ue.vectorTile=Ie.vectorTile;const Je=ue.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=ue,this.fetching[W]={rawTileData:Ae,cacheControl:_e,resourceTiming:He};try{const $e=yield Je;return g.e({rawTileData:Ae.slice(0)},$e,_e,He)}finally{delete this.fetching[W]}}catch(Ie){throw delete this.loading[W],ue.status="done",this.loaded[W]=ue,Ie}})}reloadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ee=this.loaded[W];if(ee.showCollisionBoxes=G.showCollisionBoxes,ee.status==="parsing"){const ue=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[W]){const{rawTileData:Ie,cacheControl:Ae,resourceTiming:_e}=this.fetching[W];delete this.fetching[W],Se=g.e({rawTileData:Ie.slice(0)},ue,Ae,_e)}else Se=ue;return Se}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(G){return g._(this,void 0,void 0,function*(){const W=this.loading,ee=G.uid;W&&W[ee]&&W[ee].abort&&(W[ee].abort.abort(),delete W[ee])})}removeTile(G){return g._(this,void 0,void 0,function*(){this.loaded&&this.loaded[G.uid]&&delete this.loaded[G.uid]})}}class M{constructor(){this.loaded={}}loadTile(G){return g._(this,void 0,void 0,function*(){const{uid:W,encoding:ee,rawImageData:ue,redFactor:Se,greenFactor:Ie,blueFactor:Ae,baseShift:_e}=G,He=ue.width+2,Je=ue.height+2,$e=g.b(ue)?new g.R({width:He,height:Je},yield g.bw(ue,-1,-1,He,Je)):ue,ut=new g.bx(W,$e,ee,Se,Ie,Ae,_e);return this.loaded=this.loaded||{},this.loaded[W]=ut,ut})}removeTile(G){const W=this.loaded,ee=G.uid;W&&W[ee]&&delete W[ee]}}function N(he,G){if(he.length!==0){Y(he[0],G);for(var W=1;W=Math.abs(Ae)?W-_e+Ae:Ae-_e+W,W=_e}W+ee>=0!=!!G&&he.reverse()}var U=g.by(function he(G,W){var ee,ue=G&&G.type;if(ue==="FeatureCollection")for(ee=0;ee>31}function Re(he,G){for(var W=he.loadGeometry(),ee=he.type,ue=0,Se=0,Ie=W.length,Ae=0;Aehe},Le=Math.fround||(Ke=new Float32Array(1),he=>(Ke[0]=+he,Ke[0]));var Ke;const xe=3,Ee=5,mt=6;class nt{constructor(G){this.options=Object.assign(Object.create(Be),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:W,minZoom:ee,maxZoom:ue}=this.options;W&&console.time("total time");const Se=`prepare ${G.length} points`;W&&console.time(Se),this.points=G;const Ie=[];for(let _e=0;_e=ee;_e--){const He=+Date.now();Ae=this.trees[_e]=this._createTree(this._cluster(Ae,_e)),W&&console.log("z%d: %d clusters in %dms",_e,Ae.numItems,+Date.now()-He)}return W&&console.timeEnd("total time"),this}getClusters(G,W){let ee=((G[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,G[1]));let Se=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)ee=-180,Se=180;else if(ee>Se){const $e=this.getClusters([ee,ue,180,Ie],W),ut=this.getClusters([-180,ue,Se,Ie],W);return $e.concat(ut)}const Ae=this.trees[this._limitZoom(W)],_e=Ae.range(er(ee),Vt(Ie),er(Se),Vt(ue)),He=Ae.data,Je=[];for(const $e of _e){const ut=this.stride*$e;Je.push(He[ut+Ee]>1?rt(He,ut,this.clusterProps):this.points[He[ut+xe]])}return Je}getChildren(G){const W=this._getOriginId(G),ee=this._getOriginZoom(G),ue="No cluster with the specified id.",Se=this.trees[ee];if(!Se)throw new Error(ue);const Ie=Se.data;if(W*this.stride>=Ie.length)throw new Error(ue);const Ae=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),_e=Se.within(Ie[W*this.stride],Ie[W*this.stride+1],Ae),He=[];for(const Je of _e){const $e=Je*this.stride;Ie[$e+4]===G&&He.push(Ie[$e+Ee]>1?rt(Ie,$e,this.clusterProps):this.points[Ie[$e+xe]])}if(He.length===0)throw new Error(ue);return He}getLeaves(G,W,ee){const ue=[];return this._appendLeaves(ue,G,W=W||10,ee=ee||0,0),ue}getTile(G,W,ee){const ue=this.trees[this._limitZoom(G)],Se=Math.pow(2,G),{extent:Ie,radius:Ae}=this.options,_e=Ae/Ie,He=(ee-_e)/Se,Je=(ee+1+_e)/Se,$e={features:[]};return this._addTileFeatures(ue.range((W-_e)/Se,He,(W+1+_e)/Se,Je),ue.data,W,ee,Se,$e),W===0&&this._addTileFeatures(ue.range(1-_e/Se,He,1,Je),ue.data,Se,ee,Se,$e),W===Se-1&&this._addTileFeatures(ue.range(0,He,_e/Se,Je),ue.data,-1,ee,Se,$e),$e.features.length?$e:null}getClusterExpansionZoom(G){let W=this._getOriginZoom(G)-1;for(;W<=this.options.maxZoom;){const ee=this.getChildren(G);if(W++,ee.length!==1)break;G=ee[0].properties.cluster_id}return W}_appendLeaves(G,W,ee,ue,Se){const Ie=this.getChildren(W);for(const Ae of Ie){const _e=Ae.properties;if(_e&&_e.cluster?Se+_e.point_count<=ue?Se+=_e.point_count:Se=this._appendLeaves(G,_e.cluster_id,ee,ue,Se):Se1;let Je,$e,ut;if(He)Je=Jt(W,_e,this.clusterProps),$e=W[_e],ut=W[_e+1];else{const mr=this.points[W[_e+xe]];Je=mr.properties;const[Qt,gr]=mr.geometry.coordinates;$e=er(Qt),ut=Vt(gr)}const Rt={type:1,geometry:[[Math.round(this.options.extent*($e*Se-ee)),Math.round(this.options.extent*(ut*Se-ue))]],tags:Je};let Ot;Ot=He||this.options.generateId?W[_e+xe]:this.points[W[_e+xe]].id,Ot!==void 0&&(Rt.id=Ot),Ie.features.push(Rt)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,W){const{radius:ee,extent:ue,reduce:Se,minPoints:Ie}=this.options,Ae=ee/(ue*Math.pow(2,W)),_e=G.data,He=[],Je=this.stride;for(let $e=0;$e<_e.length;$e+=Je){if(_e[$e+2]<=W)continue;_e[$e+2]=W;const ut=_e[$e],Rt=_e[$e+1],Ot=G.within(_e[$e],_e[$e+1],Ae),mr=_e[$e+Ee];let Qt=mr;for(const gr of Ot){const or=gr*Je;_e[or+2]>W&&(Qt+=_e[or+Ee])}if(Qt>mr&&Qt>=Ie){let gr,or=ut*mr,Tn=Rt*mr,rn=-1;const rr=(($e/Je|0)<<5)+(W+1)+this.points.length;for(const Mr of Ot){const Yr=Mr*Je;if(_e[Yr+2]<=W)continue;_e[Yr+2]=W;const Dn=_e[Yr+Ee];or+=_e[Yr]*Dn,Tn+=_e[Yr+1]*Dn,_e[Yr+4]=rr,Se&&(gr||(gr=this._map(_e,$e,!0),rn=this.clusterProps.length,this.clusterProps.push(gr)),Se(gr,this._map(_e,Yr)))}_e[$e+4]=rr,He.push(or/Qt,Tn/Qt,1/0,rr,-1,Qt),Se&&He.push(rn)}else{for(let gr=0;gr1)for(const gr of Ot){const or=gr*Je;if(!(_e[or+2]<=W)){_e[or+2]=W;for(let Tn=0;Tn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,W,ee){if(G[W+Ee]>1){const Ie=this.clusterProps[G[W+mt]];return ee?Object.assign({},Ie):Ie}const ue=this.points[G[W+xe]].properties,Se=this.options.map(ue);return ee&&Se===ue?Object.assign({},Se):Se}}function rt(he,G,W){return{type:"Feature",id:he[G+xe],properties:Jt(he,G,W),geometry:{type:"Point",coordinates:[(ee=he[G],360*(ee-.5)),Yt(he[G+1])]}};var ee}function Jt(he,G,W){const ee=he[G+Ee],ue=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,Se=he[G+mt],Ie=Se===-1?{}:Object.assign({},W[Se]);return Object.assign(Ie,{cluster:!0,cluster_id:he[G+xe],point_count:ee,point_count_abbreviated:ue})}function er(he){return he/360+.5}function Vt(he){const G=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return W<0?0:W>1?1:W}function Yt(he){const G=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function _r(he,G,W,ee){let ue=ee;const Se=G+(W-G>>1);let Ie,Ae=W-G;const _e=he[G],He=he[G+1],Je=he[W],$e=he[W+1];for(let ut=G+3;utue)Ie=ut,ue=Rt;else if(Rt===ue){const Ot=Math.abs(ut-Se);Otee&&(Ie-G>3&&_r(he,G,Ie,ee),he[Ie+2]=ue,W-Ie>3&&_r(he,Ie,W,ee))}function fr(he,G,W,ee,ue,Se){let Ie=ue-W,Ae=Se-ee;if(Ie!==0||Ae!==0){const _e=((he-W)*Ie+(G-ee)*Ae)/(Ie*Ie+Ae*Ae);_e>1?(W=ue,ee=Se):_e>0&&(W+=Ie*_e,ee+=Ae*_e)}return Ie=he-W,Ae=G-ee,Ie*Ie+Ae*Ae}function br(he,G,W,ee){const ue={id:he??null,type:G,geometry:W,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(G==="Point"||G==="MultiPoint"||G==="LineString")Xr(ue,W);else if(G==="Polygon")Xr(ue,W[0]);else if(G==="MultiLineString")for(const Se of W)Xr(ue,Se);else if(G==="MultiPolygon")for(const Se of W)Xr(ue,Se[0]);return ue}function Xr(he,G){for(let W=0;W0&&(Ie+=ee?(ue*Je-He*Se)/2:Math.sqrt(Math.pow(He-ue,2)+Math.pow(Je-Se,2))),ue=He,Se=Je}const Ae=G.length-3;G[2]=1,_r(G,0,Ae,W),G[Ae+2]=1,G.size=Math.abs(Ie),G.start=0,G.end=G.size}function de(he,G,W,ee){for(let ue=0;ue1?1:W}function Ze(he,G,W,ee,ue,Se,Ie,Ae){if(ee/=G,Se>=(W/=G)&&Ie=ee)return null;const _e=[];for(const He of he){const Je=He.geometry;let $e=He.type;const ut=ue===0?He.minX:He.minY,Rt=ue===0?He.maxX:He.maxY;if(ut>=W&&Rt=ee)continue;let Ot=[];if($e==="Point"||$e==="MultiPoint")tt(Je,Ot,W,ee,ue);else if($e==="LineString")Ne(Je,Ot,W,ee,ue,!1,Ae.lineMetrics);else if($e==="MultiLineString")kt(Je,Ot,W,ee,ue,!1);else if($e==="Polygon")kt(Je,Ot,W,ee,ue,!0);else if($e==="MultiPolygon")for(const mr of Je){const Qt=[];kt(mr,Qt,W,ee,ue,!0),Qt.length&&Ot.push(Qt)}if(Ot.length){if(Ae.lineMetrics&&$e==="LineString"){for(const mr of Ot)_e.push(br(He.id,$e,mr,He.tags));continue}$e!=="LineString"&&$e!=="MultiLineString"||(Ot.length===1?($e="LineString",Ot=Ot[0]):$e="MultiLineString"),$e!=="Point"&&$e!=="MultiPoint"||($e=Ot.length===3?"Point":"MultiPoint"),_e.push(br(He.id,$e,Ot,He.tags))}}return _e.length?_e:null}function tt(he,G,W,ee,ue){for(let Se=0;Se=W&&Ie<=ee&&at(G,he[Se],he[Se+1],he[Se+2])}}function Ne(he,G,W,ee,ue,Se,Ie){let Ae=ot(he);const _e=ue===0?Bt:Tr;let He,Je,$e=he.start;for(let Qt=0;QtW&&(Je=_e(Ae,gr,or,rn,rr,W),Ie&&(Ae.start=$e+He*Je)):Mr>ee?Yr=W&&(Je=_e(Ae,gr,or,rn,rr,W),Dn=!0),Yr>ee&&Mr<=ee&&(Je=_e(Ae,gr,or,rn,rr,ee),Dn=!0),!Se&&Dn&&(Ie&&(Ae.end=$e+He*Je),G.push(Ae),Ae=ot(he)),Ie&&($e+=He)}let ut=he.length-3;const Rt=he[ut],Ot=he[ut+1],mr=ue===0?Rt:Ot;mr>=W&&mr<=ee&&at(Ae,Rt,Ot,he[ut+2]),ut=Ae.length-3,Se&&ut>=3&&(Ae[ut]!==Ae[0]||Ae[ut+1]!==Ae[1])&&at(Ae,Ae[0],Ae[1],Ae[2]),Ae.length&&G.push(Ae)}function ot(he){const G=[];return G.size=he.size,G.start=he.start,G.end=he.end,G}function kt(he,G,W,ee,ue,Se){for(const Ie of he)Ne(Ie,G,W,ee,ue,Se,!1)}function at(he,G,W,ee){he.push(G,W,ee)}function Bt(he,G,W,ee,ue,Se){const Ie=(Se-G)/(ee-G);return at(he,Se,W+(ue-W)*Ie,1),Ie}function Tr(he,G,W,ee,ue,Se){const Ie=(Se-W)/(ue-W);return at(he,G+(ee-G)*Ie,Se,1),Ie}function qe(he,G){const W=[];for(let ee=0;ee0&&G.size<(ue?Ie:ee))return void(W.numPoints+=G.length/3);const Ae=[];for(let _e=0;_eIe)&&(W.numSimplified++,Ae.push(G[_e],G[_e+1])),W.numPoints++;ue&&function(_e,He){let Je=0;for(let $e=0,ut=_e.length,Rt=ut-2;$e0===He)for(let $e=0,ut=_e.length;$e24)throw new Error("maxZoom should be in the 0-24 range");if(W.promoteId&&W.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=function(Se,Ie){const Ae=[];if(Se.type==="FeatureCollection")for(let _e=0;_e1&&console.time("creation"),Rt=this.tiles[ut]=pi(G,W,ee,ue,He),this.tileCoords.push({z:W,x:ee,y:ue}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W,ee,ue,Rt.numFeatures,Rt.numPoints,Rt.numSimplified),console.timeEnd("creation"));const Dn=`z${W}`;this.stats[Dn]=(this.stats[Dn]||0)+1,this.total++}if(Rt.source=G,Se==null){if(W===He.indexMaxZoom||Rt.numPoints<=He.indexMaxPoints)continue}else{if(W===He.maxZoom||W===Se)continue;if(Se!=null){const Dn=Se-W;if(ee!==Ie>>Dn||ue!==Ae>>Dn)continue}}if(Rt.source=null,G.length===0)continue;Je>1&&console.time("clipping");const Ot=.5*He.buffer/He.extent,mr=.5-Ot,Qt=.5+Ot,gr=1+Ot;let or=null,Tn=null,rn=null,rr=null,Mr=Ze(G,$e,ee-Ot,ee+Qt,0,Rt.minX,Rt.maxX,He),Yr=Ze(G,$e,ee+mr,ee+gr,0,Rt.minX,Rt.maxX,He);G=null,Mr&&(or=Ze(Mr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),Tn=Ze(Mr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Mr=null),Yr&&(rn=Ze(Yr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),rr=Ze(Yr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Yr=null),Je>1&&console.timeEnd("clipping"),_e.push(or||[],W+1,2*ee,2*ue),_e.push(Tn||[],W+1,2*ee,2*ue+1),_e.push(rn||[],W+1,2*ee+1,2*ue),_e.push(rr||[],W+1,2*ee+1,2*ue+1)}}getTile(G,W,ee){G=+G,W=+W,ee=+ee;const ue=this.options,{extent:Se,debug:Ie}=ue;if(G<0||G>24)return null;const Ae=1<1&&console.log("drilling down to z%d-%d-%d",G,W,ee);let He,Je=G,$e=W,ut=ee;for(;!He&&Je>0;)Je--,$e>>=1,ut>>=1,He=this.tiles[mi(Je,$e,ut)];return He&&He.source?(Ie>1&&(console.log("found parent tile z%d-%d-%d",Je,$e,ut),console.time("drilling down")),this.splitTile(He.source,Je,$e,ut,G,W,ee),Ie>1&&console.timeEnd("drilling down"),this.tiles[_e]?_n(this.tiles[_e],Se):null):null}}function mi(he,G,W){return 32*((1<{$e.properties=Rt;const Ot={};for(const mr of ut)Ot[mr]=_e[mr].evaluate(Je,$e);return Ot},Ie.reduce=(Rt,Ot)=>{$e.properties=Ot;for(const mr of ut)Je.accumulated=Rt[mr],Rt[mr]=He[mr].evaluate(Je,$e)},Ie}(G)).load((yield this._pendingData).features):(ue=yield this._pendingData,new Kr(ue,G.geojsonVtOptions)),this.loaded={};const Se={};if(ee){const Ie=ee.finish();Ie&&(Se.resourceTiming={},Se.resourceTiming[G.source]=JSON.parse(JSON.stringify(Ie)))}return Se}catch(Se){if(delete this._pendingRequest,g.bB(Se))return{abandoned:!0};throw Se}var ue})}getData(){return g._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(G){const W=this.loaded;return W&&W[G.uid]?super.reloadTile(G):this.loadTile(G)}loadAndProcessGeoJSON(G,W){return g._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(G,W);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(U(ee,!0),G.filter){const ue=g.bC(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(Ie=>`${Ie.key}: ${Ie.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(Ie=>ue.value.evaluate({zoom:0},Ie))}}return ee})}loadGeoJSON(G,W){return g._(this,void 0,void 0,function*(){const{promoteId:ee}=G;if(G.request){const ue=yield g.h(G.request,W);return this._dataUpdateable=Yi(ue.data,ee)?fs(ue.data,ee):void 0,ue.data}if(typeof G.data=="string")try{const ue=JSON.parse(G.data);return this._dataUpdateable=Yi(ue,ee)?fs(ue,ee):void 0,ue}catch{throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`)}if(!G.dataDiff)throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${G.source}`);return function(ue,Se,Ie){var Ae,_e,He,Je;if(Se.removeAll&&ue.clear(),Se.remove)for(const $e of Se.remove)ue.delete($e);if(Se.add)for(const $e of Se.add){const ut=Xt($e,Ie);ut!=null&&ue.set(ut,$e)}if(Se.update)for(const $e of Se.update){let ut=ue.get($e.id);if(ut==null)continue;const Rt=!$e.removeAllProperties&&(((Ae=$e.removeProperties)===null||Ae===void 0?void 0:Ae.length)>0||((_e=$e.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if(($e.newGeometry||$e.removeAllProperties||Rt)&&(ut=Object.assign({},ut),ue.set($e.id,ut),Rt&&(ut.properties=Object.assign({},ut.properties))),$e.newGeometry&&(ut.geometry=$e.newGeometry),$e.removeAllProperties)ut.properties={};else if(((He=$e.removeProperties)===null||He===void 0?void 0:He.length)>0)for(const Ot of $e.removeProperties)Object.prototype.hasOwnProperty.call(ut.properties,Ot)&&delete ut.properties[Ot];if(((Je=$e.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Ot,value:mr}of $e.addOrUpdateProperties)ut.properties[Ot]=mr}}(this._dataUpdateable,G.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(G){return g._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(G){return this._geoJSONIndex.getClusterExpansionZoom(G.clusterId)}getClusterChildren(G){return this._geoJSONIndex.getChildren(G.clusterId)}getClusterLeaves(G){return this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset)}}class Hn{constructor(G){this.self=G,this.actor=new g.F(G),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,ee)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=ee},this.self.addProtocol=g.bi,this.self.removeProtocol=g.bj,this.self.registerRTLTextPlugin=W=>{if(g.bD.isParsed())throw new Error("RTL text plugin already registered.");g.bD.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,ee)=>this._getDEMWorkerSource(W,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(W,ee)=>g._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(W,ee)=>g._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][ee.type]||!this.workerSources[W][ee.type][ee.source])return;const ue=this.workerSources[W][ee.type][ee.source];delete this.workerSources[W][ee.type][ee.source],ue.removeSource!==void 0&&ue.removeSource(ee)})),this.actor.registerMessageHandler("RM",W=>g._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,ee)=>g._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(W,ee)=>this._syncRTLPluginState(W,ee)),this.actor.registerMessageHandler("IS",(W,ee)=>g._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(W,ee)=>this._setImages(W,ee)),this.actor.registerMessageHandler("UL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(ee)}))}_setImages(G,W){return g._(this,void 0,void 0,function*(){this.availableImages[G]=W;for(const ee in this.workerSources[G]){const ue=this.workerSources[G][ee];for(const Se in ue)ue[Se].availableImages=W}})}_syncRTLPluginState(G,W){return g._(this,void 0,void 0,function*(){if(g.bD.isParsed())return g.bD.getState();if(W.pluginStatus!=="loading")return g.bD.setState(W),W;const ee=W.pluginURL;if(this.self.importScripts(ee),g.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:ee};return g.bD.setState(ue),ue}throw g.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(G){let W=this.availableImages[G];return W||(W=[]),W}_getLayerIndex(G){let W=this.layerIndexes[G];return W||(W=this.layerIndexes[G]=new c),W}_getWorkerSource(G,W,ee){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][W]||(this.workerSources[G][W]={}),!this.workerSources[G][W][ee]){const ue={sendAsync:(Se,Ie)=>(Se.targetMapId=G,this.actor.sendAsync(Se,Ie))};switch(W){case"vector":this.workerSources[G][W][ee]=new A(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;case"geojson":this.workerSources[G][W][ee]=new ps(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;default:this.workerSources[G][W][ee]=new this.externalWorkerSourceTypes[W](ue,this._getLayerIndex(G),this._getAvailableImages(G))}}return this.workerSources[G][W][ee]}_getDEMWorkerSource(G,W){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][W]||(this.demWorkerSources[G][W]=new M),this.demWorkerSources[G][W]}}return g.i(self)&&(self.worker=new Hn(self)),Hn}),h("index",["exports","./shared"],function(g,c){var T="4.7.1";let P,R;const A={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((r,u)=>{const p=requestAnimationFrame(r);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),u(c.c())})}),getImageData(v,r=0){return this.getImageCanvasContext(v).getImageData(-r,-r,v.width+2*r,v.height+2*r)},getImageCanvasContext(v){const r=window.document.createElement("canvas"),u=r.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return r.width=v.width,r.height=v.height,u.drawImage(v,0,0,v.width,v.height),u},resolveURL:v=>(P||(P=document.createElement("a")),P.href=v,P.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class M{static testProp(r){if(!M.docStyle)return r[0];for(let u=0;u{window.removeEventListener("click",M.suppressClickInternal,!0)},0)}static getScale(r){const u=r.getBoundingClientRect();return{x:u.width/r.offsetWidth||1,y:u.height/r.offsetHeight||1,boundingClientRect:u}}static getPoint(r,u,p){const m=u.boundingClientRect;return new c.P((p.clientX-m.left)/u.x-r.clientLeft,(p.clientY-m.top)/u.y-r.clientTop)}static mousePos(r,u){const p=M.getScale(r);return M.getPoint(r,p,u)}static touchPos(r,u){const p=[],m=M.getScale(r);for(let _=0;_{Y&&$(Y),Y=null,O=!0},U.onerror=()=>{te=!0,Y=null},U.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let r,u,p,m;v.resetRequestQueue=()=>{r=[],u=0,p=0,m={}},v.addThrottleControl=C=>{const z=p++;return m[z]=C,z},v.removeThrottleControl=C=>{delete m[C],S()},v.getImage=(C,z,F=!0)=>new Promise((B,X)=>{N.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),r.push({abortController:z,requestParameters:C,supportImageRefresh:F,state:"queued",onError:Q=>{X(Q)},onSuccess:Q=>{B(Q)}}),S()});const _=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:z,supportImageRefresh:F,onError:B,onSuccess:X,abortController:Q}=C,re=F===!1&&!c.i(self)&&!c.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((me,we)=>me&&we==="accept",!0));u++;const ce=re?E(z,Q):c.m(z,Q);try{const me=yield ce;delete C.abortController,C.state="completed",me.data instanceof HTMLImageElement||c.b(me.data)?X(me):me.data&&X({data:yield(pe=me.data,typeof createImageBitmap=="function"?c.d(pe):c.f(pe)),cacheControl:me.cacheControl,expires:me.expires})}catch(me){delete C.abortController,B(me)}finally{u--,S()}var pe}),S=()=>{const C=(()=>{for(const z of Object.keys(m))if(m[z]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=u;z0;z++){const F=r.shift();F.abortController.signal.aborted?z--:_(F)}},E=(C,z)=>new Promise((F,B)=>{const X=new Image,Q=C.url,re=C.credentials;re&&re==="include"?X.crossOrigin="use-credentials":(re&&re==="same-origin"||!c.s(Q))&&(X.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{X.src="",B(c.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,F({data:X})},X.onerror=()=>{X.onerror=X.onload=null,z.signal.aborted||B(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."))},X.src=Q})}(q||(q={})),q.resetRequestQueue();class ne{constructor(r){this._transformRequestFn=r}transformRequest(r,u){return this._transformRequestFn&&this._transformRequestFn(r,u)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function oe(v){var r=new c.A(3);return r[0]=v[0],r[1]=v[1],r[2]=v[2],r}var ke,ge=function(v,r,u){return v[0]=r[0]-u[0],v[1]=r[1]-u[1],v[2]=r[2]-u[2],v};ke=new c.A(3),c.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Fe=function(v){var r=v[0],u=v[1];return r*r+u*u};function Oe(v){const r=[];if(typeof v=="string")r.push({id:"default",url:v});else if(v&&v.length>0){const u=[];for(const{id:p,url:m}of v){const _=`${p}${m}`;u.indexOf(_)===-1&&(u.push(_),r.push({id:p,url:m}))}}return r}function Ge(v,r,u){const p=v.split("?");return p[0]+=`${r}${u}`,p.join("?")}(function(){var v=new c.A(2);c.A!=Float32Array&&(v[0]=0,v[1]=0)})();class it{constructor(r,u,p,m){this.context=r,this.format=p,this.texture=r.gl.createTexture(),this.update(u,m)}update(r,u,p){const{width:m,height:_}=r,S=!(this.size&&this.size[0]===m&&this.size[1]===_||p),{context:E}=this,{gl:C}=E;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),S)this.size=[m,_],r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,r):C.texImage2D(C.TEXTURE_2D,0,this.format,m,_,0,this.format,C.UNSIGNED_BYTE,r.data);else{const{x:z,y:F}=p||{x:0,y:0};r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texSubImage2D(C.TEXTURE_2D,0,z,F,C.RGBA,C.UNSIGNED_BYTE,r):C.texSubImage2D(C.TEXTURE_2D,0,z,F,m,_,C.RGBA,C.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(r,u,p){const{context:m}=this,{gl:_}=m;_.bindTexture(_.TEXTURE_2D,this.texture),p!==_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=_.LINEAR),r!==this.filter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,r),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,p||r),this.filter=r),u!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,u),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}function ve(v){const{userImage:r}=v;return!!(r&&r.render&&r.render())&&(v.data.replace(new Uint8Array(r.data.buffer)),!0)}class je extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(r){if(this.loaded!==r&&(this.loaded=r,r)){for(const{ids:u,promiseResolve:p}of this.requestors)p(this._getImagesForIds(u));this.requestors=[]}}getImage(r){const u=this.images[r];if(u&&!u.data&&u.spriteData){const p=u.spriteData;u.data=new c.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),u.spriteData=null}return u}addImage(r,u){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);this._validate(r,u)&&(this.images[r]=u)}_validate(r,u){let p=!0;const m=u.data||u.spriteData;return this._validateStretch(u.stretchX,m&&m.width)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchX" value`))),p=!1),this._validateStretch(u.stretchY,m&&m.height)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchY" value`))),p=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "content" value`))),p=!1),p}_validateStretch(r,u){if(!r)return!0;let p=0;for(const m of r){if(m[0]{let m=!0;if(!this.isLoaded())for(const _ of r)this.images[_]||(m=!1);this.isLoaded()||m?u(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:u})})}_getImagesForIds(r){const u={};for(const p of r){let m=this.getImage(p);m||(this.fire(new c.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?u[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:c.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 u}getPixelSize(){const{width:r,height:u}=this.atlasImage;return{width:r,height:u}}getPattern(r){const u=this.patterns[r],p=this.getImage(r);if(!p)return null;if(u&&u.position.version===p.version)return u.position;if(u)u.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},_=new c.I(m,p);this.patterns[r]={bin:m,position:_}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const u=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(r,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const _ in this.patterns)r.push(this.patterns[_].bin);const{w:u,h:p}=c.p(r),m=this.atlasImage;m.resize({width:u||1,height:p||1});for(const _ in this.patterns){const{bin:S}=this.patterns[_],E=S.x+1,C=S.y+1,z=this.getImage(_).data,F=z.width,B=z.height;c.R.copy(z,m,{x:0,y:0},{x:E,y:C},{width:F,height:B}),c.R.copy(z,m,{x:0,y:B-1},{x:E,y:C-1},{width:F,height:1}),c.R.copy(z,m,{x:0,y:0},{x:E,y:C+B},{width:F,height:1}),c.R.copy(z,m,{x:F-1,y:0},{x:E-1,y:C},{width:1,height:B}),c.R.copy(z,m,{x:0,y:0},{x:E+F,y:C},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const u of r){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const p=this.getImage(u);p||c.w(`Image with ID: "${u}" was not found`),ve(p)&&this.updateImage(u,p)}}}const H=1e20;function Re(v,r,u,p,m,_,S,E,C){for(let z=r;z-1);C++,_[C]=E,S[C]=z,S[C+1]=H}for(let E=0,C=0;E65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[_])return{stack:r,id:u,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[_]){const E=ye.loadGlyphRange(r,_,this.url,this.requestManager);p.requests[_]=E}const S=yield p.requests[_];for(const E in S)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S[+E]);return p.ranges[_]=!0,{stack:r,id:u,glyph:S[u]||null}})}_doesCharSupportLocalGlyph(r){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(r))}_tinySDF(r,u,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let _=r.tinySDF;if(!_){let E="400";/bold/i.test(u)?E="900":/medium/i.test(u)?E="500":/light/i.test(u)&&(E="200"),_=r.tinySDF=new ye.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:E})}const S=_.draw(String.fromCharCode(p));return{id:p,bitmap:new c.o({width:S.width||60,height:S.height||60},S.data),metrics:{width:S.glyphWidth/2||24,height:S.glyphHeight/2||24,left:S.glyphLeft/2+.5||0,top:S.glyphTop/2-27.5||-8,advance:S.glyphAdvance/2||24,isDoubleResolution:!0}}}}ye.loadGlyphRange=function(v,r,u,p){return c._(this,void 0,void 0,function*(){const m=256*r,_=m+255,S=p.transformRequest(u.replace("{fontstack}",v).replace("{range}",`${m}-${_}`),"Glyphs"),E=yield c.l(S,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${r}, ${m}-${_}`);const C={};for(const z of c.n(E.data))C[z.id]=z;return C})},ye.TinySDF=class{constructor({fontSize:v=24,buffer:r=3,radius:u=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:_="normal",fontStyle:S="normal"}={}){this.buffer=r,this.cutoff=p,this.radius=u;const E=this.size=v+4*r,C=this._createCanvas(E),z=this.ctx=C.getContext("2d",{willReadFrequently:!0});z.font=`${S} ${_} ${v}px ${m}`,z.textBaseline="alphabetic",z.textAlign="left",z.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(v){const r=document.createElement("canvas");return r.width=r.height=v,r}draw(v){const{width:r,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:_}=this.ctx.measureText(v),S=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-m))),C=Math.min(this.size-this.buffer,S+Math.ceil(p)),z=E+2*this.buffer,F=C+2*this.buffer,B=Math.max(z*F,0),X=new Uint8ClampedArray(B),Q={data:X,width:z,height:F,glyphWidth:E,glyphHeight:C,glyphTop:S,glyphLeft:0,glyphAdvance:r};if(E===0||C===0)return Q;const{ctx:re,buffer:ce,gridInner:pe,gridOuter:me}=this;re.clearRect(ce,ce,E,C),re.fillText(v,ce,ce+S);const we=re.getImageData(ce,ce,E,C);me.fill(H,0,B),pe.fill(0,0,B);for(let ae=0;ae0?Xe*Xe:0,pe[ze]=Xe<0?Xe*Xe:0}}Re(me,0,0,z,F,z,this.f,this.v,this.z),Re(pe,ce,ce,E,C,z,this.f,this.v,this.z);for(let ae=0;ae1&&(C=r[++E]);const F=Math.abs(z-C.left),B=Math.abs(z-C.right),X=Math.min(F,B);let Q;const re=_/p*(m+1);if(C.isDash){const ce=m-Math.abs(re);Q=Math.sqrt(X*X+ce*ce)}else Q=m-Math.sqrt(X*X+re*re);this.data[S+z]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(r){for(let E=r.length-1;E>=0;--E){const C=r[E],z=r[E+1];C.zeroLength?r.splice(E,1):z&&z.isDash===C.isDash&&(z.left=C.left,r.splice(E,1))}const u=r[0],p=r[r.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const m=this.width*this.nextRow;let _=0,S=r[_];for(let E=0;E1&&(S=r[++_]);const C=Math.abs(E-S.left),z=Math.abs(E-S.right),F=Math.min(C,z);this.data[m+E]=Math.max(0,Math.min(255,(S.isDash?F:-F)+128))}}addDash(r,u){const p=u?7:0,m=2*p+1;if(this.nextRow+m>this.height)return c.w("LineAtlas out of space"),null;let _=0;for(let E=0;E{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[nt]}numActive(){return Object.keys(this.active).length}}const Jt=Math.floor(A.hardwareConcurrency/2);let er,Vt;function Yt(){return er||(er=new rt),er}rt.workerCount=c.C(globalThis)?Math.max(Math.min(Jt,3),1):1;class _r{constructor(r,u){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=u;const p=this.workerPool.acquire(u);for(let m=0;m{u.remove()}),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,u){for(const p of this.actors)p.registerMessageHandler(r,u)}}function fr(){return Vt||(Vt=new _r(Yt(),c.G),Vt.registerMessageHandler("GR",(v,r,u)=>c.m(r,u))),Vt}function br(v,r){const u=c.H();return c.J(u,u,[1,1,0]),c.K(u,u,[.5*v.width,.5*v.height,1]),c.L(u,u,v.calculatePosMatrix(r.toUnwrapped()))}function Xr(v,r,u,p,m,_){const S=function(B,X,Q){if(B)for(const re of B){const ce=X[re];if(ce&&ce.source===Q&&ce.type==="fill-extrusion")return!0}else for(const re in X){const ce=X[re];if(ce.source===Q&&ce.type==="fill-extrusion")return!0}return!1}(m&&m.layers,r,v.id),E=_.maxPitchScaleFactor(),C=v.tilesIn(p,E,S);C.sort(V);const z=[];for(const B of C)z.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(r,u,v._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,m,_,E,br(v.transform,B.tileID))});const F=function(B){const X={},Q={};for(const re of B){const ce=re.queryResults,pe=re.wrappedTileID,me=Q[pe]=Q[pe]||{};for(const we in ce){const ae=ce[we],Ce=me[we]=me[we]||{},Pe=X[we]=X[we]||[];for(const ze of ae)Ce[ze.featureIndex]||(Ce[ze.featureIndex]=!0,Pe.push(ze))}}return X}(z);for(const B in F)F[B].forEach(X=>{const Q=X.feature,re=v.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=re});return F}function V(v,r){const u=v.tileID,p=r.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}function Ue(v,r,u){return c._(this,void 0,void 0,function*(){let p=v;if(v.url?p=(yield c.h(r.transformRequest(v.url,"Source"),u)).data:yield A.frameAsync(u),!p)return null;const m=c.M(c.e(p,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(_=>_.id)),m})}class ie{constructor(r,u){r&&(u?this.setSouthWest(r).setNorthEast(u):Array.isArray(r)&&(r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1])))}setNorthEast(r){return this._ne=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}setSouthWest(r){return this._sw=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}extend(r){const u=this._sw,p=this._ne;let m,_;if(r instanceof c.N)m=r,_=r;else{if(!(r instanceof ie))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(ie.convert(r)):this.extend(c.N.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(c.N.convert(r)):this;if(m=r._sw,_=r._ne,!m||!_)return this}return u||p?(u.lng=Math.min(m.lng,u.lng),u.lat=Math.min(m.lat,u.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new c.N(m.lng,m.lat),this._ne=new c.N(_.lng,_.lat)),this}getCenter(){return new c.N((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 c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(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(r){const{lng:u,lat:p}=c.N.convert(r);let m=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(r){return r instanceof ie?r:r&&new ie(r)}static fromLngLat(r,u=0){const p=360*u/40075017,m=p/Math.cos(Math.PI/180*r.lat);return new ie(new c.N(r.lng-m,r.lat-p),new c.N(r.lng+m,r.lat+p))}adjustAntiMeridian(){const r=new c.N(this._sw.lng,this._sw.lat),u=new c.N(this._ne.lng,this._ne.lat);return new ie(r,r.lng>u.lng?new c.N(u.lng+360,u.lat):u)}}class de{constructor(r,u,p){this.bounds=ie.convert(this.validateBounds(r)),this.minzoom=u||0,this.maxzoom=p||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const u=Math.pow(2,r.z),p=Math.floor(c.O(this.bounds.getWest())*u),m=Math.floor(c.Q(this.bounds.getNorth())*u),_=Math.ceil(c.O(this.bounds.getEast())*u),S=Math.ceil(c.Q(this.bounds.getSouth())*u);return r.x>=p&&r.x<_&&r.y>=m&&r.y{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(u,"Tile"),uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(r.actor&&r.state!=="expired"){if(r.state==="loading")return new Promise((_,S)=>{r.reloadPromise={resolve:_,reject:S}})}else r.actor=this.dispatcher.getActor(),m="LT";r.abortController=new AbortController;try{const _=yield r.actor.sendAsync({type:m,data:p},r.abortController);if(delete r.abortController,r.aborted)return;this._afterTileLoadWorkerResponse(r,_)}catch(_){if(delete r.abortController,r.aborted)return;if(_&&_.status!==404)throw _;this._afterTileLoadWorkerResponse(r,null)}})}_afterTileLoadWorkerResponse(r,u){if(u&&u.resourceTiming&&(r.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&r.setExpiryData(u),r.loadVectorData(u,this.map.painter),r.reloadPromise){const p=r.reloadPromise;r.reloadPromise=null,this.loadTile(r).then(p.resolve).catch(p.reject)}}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.actor&&(yield r.actor.sendAsync({type:"AT",data:{uid:r.uid,type:this.type,source:this.id}}))})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),r.actor&&(yield r.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Te extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},u),c.e(this,c.M(u,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield Ue(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(c.e(this,r),r.bounds&&(this.tileBounds=new de(r.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new c.j(r))}})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(r){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),r(),this.load()}setTiles(r){return this.setSourceProperty(()=>{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}serialize(){return c.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const p=yield q.getImage(this.map._requestManager.transformRequest(u,"Tile"),r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&r.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,_=m.gl,S=p.data;r.texture=this.map.painter.getTileTexture(S.width),r.texture?r.texture.update(S,{useMipmap:!0}):(r.texture=new it(m,S,_.RGBA,{useMipmap:!0}),r.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST)),r.state="loaded"}}catch(p){if(delete r.abortController,r.aborted)r.state="unloaded";else if(p)throw r.state="errored",p}})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController)})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.texture&&this.map.painter.saveTileTexture(r.texture)})}hasTransition(){return!1}}class Ze extends Te{constructor(r,u,p,m){super(r,u,p,m),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(u,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const m=yield q.getImage(p,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(m&&m.data){const _=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&r.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const S=c.b(_)&&c.U()?_:yield this.readImageNow(_),E={type:this.type,uid:r.uid,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!r.actor||r.state==="expired"){r.actor=this.dispatcher.getActor();const C=yield r.actor.sendAsync({type:"LDT",data:E});r.dem=C,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(m){if(delete r.abortController,r.aborted)r.state="unloaded";else if(m)throw r.state="errored",m}})}readImageNow(r){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const u=r.width+2,p=r.height+2;try{return new c.R({width:u,height:p},yield c.W(r,-1,-1,u,p))}catch{}}return A.getImageData(r,1)})}_getNeighboringTiles(r){const u=r.canonical,p=Math.pow(2,u.z),m=(u.x-1+p)%p,_=u.x===0?r.wrap-1:r.wrap,S=(u.x+1+p)%p,E=u.x+1===p?r.wrap+1:r.wrap,C={};return C[new c.S(r.overscaledZ,_,u.z,m,u.y).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y).key]={backfilled:!1},u.y>0&&(C[new c.S(r.overscaledZ,_,u.z,m,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,r.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(_,{resourceTiming:m}),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.actor?"RT":"LT";r.actor=this.actor;const p={type:this.type,uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};r.abortController=new AbortController;const m=yield this.actor.sendAsync({type:u,data:p},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(m,this.map.painter,u==="RT")})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.aborted=!0})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:r.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 c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ne=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ot extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=u}load(r){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const u=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,r&&(this.coordinates=r),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;const u=r.map(c.Z.fromLngLat);this.tileID=function(m){let _=1/0,S=1/0,E=-1/0,C=-1/0;for(const X of m)_=Math.min(_,X.x),S=Math.min(S,X.y),E=Math.max(E,X.x),C=Math.max(C,X.y);const z=Math.max(E-_,C-S),F=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),B=Math.pow(2,F);return new c.a1(F,Math.floor((_+E)/2*B),Math.floor((S+C)/2*B))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,c.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,c.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(r,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(r){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class kt extends ot{constructor(r,u,p,m){super(r,u,p,m),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const u of r.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a3(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const u=this.video.seekable;ru.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(r){this.map||(this.map=r,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new it(r,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("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 at extends ot{constructor(r,u,p,m){super(r,u,p,m),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(S=>typeof S!="number"))||this.fire(new c.j(new c.a2(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${r}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${r}`,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 c.j(new c.a2(`sources.${r}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return c._(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 c.j(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(r){this.map=r,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(u,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const _ in this.tiles){const S=this.tiles[_];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,m=!0)}m&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const r of[this.canvas.width,this.canvas.height])if(isNaN(r)||r<=0)return!0;return!1}}const Bt={},Tr=v=>{switch(v){case"geojson":return tt;case"image":return ot;case"raster":return Te;case"raster-dem":return Ze;case"vector":return se;case"video":return kt;case"canvas":return at}return Bt[v]},qe="RTLPluginLoaded";class tn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=fr()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return c._(this,arguments,void 0,function*(u,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=A.resolveURL(u),!this.url)throw new Error(`requested url ${u} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(qe))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _n=null;function vn(){return _n||(_n=new tn),_n}class pi{constructor(r,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=c.a4(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(r){const u=r+this.timeAdded;u_.getLayer(z)).filter(Boolean);if(C.length!==0){E.layers=C,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(z=>C.filter(F=>F.id===z)[0]));for(const z of C)S[z.id]=E}}return S}(r.buckets,u.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6){if(this.hasSymbolBuckets=!0,!p)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6&&_.hasRTLText){this.hasRTLText=!0,vn().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const _=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(m).queryRadius(_))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(r){return this.buckets[r.id]}upload(r){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(r)}const u=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(r,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(r,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,u,p,m,_,S,E,C,z,F){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:_,scale:S,tileSize:this.tileSize,pixelPosMatrix:F,transform:C,params:E,queryPadding:this.queryPadding*z},r,u,p):{}}querySourceFeatures(r,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),_=u&&u.sourceLayer?u.sourceLayer:"",S=m._geojsonTileLayer||m[_];if(!S)return;const E=c.a7(u&&u.filter),{z:C,x:z,y:F}=this.tileID.canonical,B={z:C,x:z,y:F};for(let X=0;Xp)m=!1;else if(u)if(this.expirationTime{this.remove(r,_)},p)),this.data[m].push(_),this.order.push(m),this.order.length>this.max){const S=this._getAndRemoveByKey(this.order[0]);S&&this.onRemove(S)}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){const u=this.data[r].shift();return u.timeout&&clearTimeout(u.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),u.value}getByKey(r){const u=this.data[r];return u?u[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,u){if(!this.has(r))return this;const p=r.wrapped().key,m=u===void 0?0:this.data[p].indexOf(u),_=this.data[p][m];return this.data[p].splice(m,1),_.timeout&&clearTimeout(_.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(_.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(r){const u=[];for(const p in this.data)for(const m of this.data[p])r(m.value)||u.push(m);for(const p of u)this.remove(p.value.tileID,p)}}class Kt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,u,p){const m=String(u);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][m]=this.stateChanges[r][m]||{},c.e(this.stateChanges[r][m],p),this.deletedStates[r]===null){this.deletedStates[r]={};for(const _ in this.state[r])_!==m&&(this.deletedStates[r][_]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][m]===null){this.deletedStates[r][m]={};for(const _ in this.state[r][m])p[_]||(this.deletedStates[r][m][_]=null)}else for(const _ in p)this.deletedStates[r]&&this.deletedStates[r][m]&&this.deletedStates[r][m][_]===null&&delete this.deletedStates[r][m][_]}removeFeatureState(r,u,p){if(this.deletedStates[r]===null)return;const m=String(u);if(this.deletedStates[r]=this.deletedStates[r]||{},p&&u!==void 0)this.deletedStates[r][m]!==null&&(this.deletedStates[r][m]=this.deletedStates[r][m]||{},this.deletedStates[r][m][p]=null);else if(u!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][m])for(p in this.deletedStates[r][m]={},this.stateChanges[r][m])this.deletedStates[r][m][p]=null;else this.deletedStates[r][m]=null;else this.deletedStates[r]=null}getState(r,u){const p=String(u),m=c.e({},(this.state[r]||{})[p],(this.stateChanges[r]||{})[p]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const _=this.deletedStates[r][u];if(_===null)return{};for(const S in _)delete m[S]}return m}initializeTileState(r,u){r.setFeatureState(this.state,u)}coalesceChanges(r,u){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const _={};for(const S in this.stateChanges[m])this.state[m][S]||(this.state[m][S]={}),c.e(this.state[m][S],this.stateChanges[m][S]),_[S]=this.state[m][S];p[m]=_}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const _={};if(this.deletedStates[m]===null)for(const S in this.state[m])_[S]={},this.state[m][S]={};else for(const S in this.deletedStates[m]){if(this.deletedStates[m][S]===null)this.state[m][S]={};else for(const E of Object.keys(this.deletedStates[m][S]))delete this.state[m][S][E];_[S]=this.state[m][S]}p[m]=p[m]||{},c.e(p[m],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in r)r[m].setFeatureState(p,u)}}class jt extends c.E{constructor(r,u,p){super(),this.id=r,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,_,S,E)=>{const C=new(Tr(_.type))(m,_,S,E);if(C.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${C.id}`);return C})(r,u,p,this),this._tiles={},this._cache=new Qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Kt,this._didEmitContent=!1,this._updated=!1}onAdd(r){this.map=r,this._maxTileCacheSize=r?r._maxTileCacheSize:null,this._maxTileCacheZoomLevels=r?r._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(r)}onRemove(r){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(r)}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(const r in this._tiles){const u=this._tiles[r];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(r,u,p){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,u,p)}catch(m){r.state="errored",m.status!==404?this._source.fire(new c.j(m,{tile:r})):this.update(this.transform,this.terrain)}})}_unloadTile(r){this._source.unloadTile&&this._source.unloadTile(r)}_abortTile(r){this._source.abortTile&&this._source.abortTile(r),this._source.fire(new c.k("dataabort",{tile:r,coord:r.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const p=this._tiles[u];p.upload(r),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(Kr).map(r=>r.key)}getRenderableIds(r){const u=[];for(const p in this._tiles)this._isIdRenderable(p,r)&&u.push(this._tiles[p]);return r?u.sort((p,m)=>{const _=p.tileID,S=m.tileID,E=new c.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),C=new c.P(S.canonical.x,S.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-S.overscaledZ||C.y-E.y||C.x-E.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Kr).map(p=>p.key)}hasRenderableParent(r){const u=this.findLoadedParent(r,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(r,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(u||!this._tiles[r].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}}_reloadTile(r,u){return c._(this,void 0,void 0,function*(){const p=this._tiles[r];p&&(p.state!=="loading"&&(p.state=u),yield this._loadTile(p,r,u))})}_tileLoaded(r,u,p){r.timeAdded=A.now(),p==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(u,r),this.getSource().type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),r.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:r,coord:r.tileID}))}_backfillDEM(r){const u=this.getRenderableIds();for(let m=0;m1||(Math.abs(S)>1&&(Math.abs(S+C)===1?S+=C:Math.abs(S-C)===1&&(S-=C)),_.dem&&m.dem&&(m.dem.backfillBorder(_.dem,S,E),m.neighboringTiles&&m.neighboringTiles[z]&&(m.neighboringTiles[z].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,u,p,m){for(const _ in this._tiles){let S=this._tiles[_];if(m[_]||!S.hasData()||S.tileID.overscaledZ<=u||S.tileID.overscaledZ>p)continue;let E=S.tileID;for(;S&&S.tileID.overscaledZ>u+1;){const z=S.tileID.scaledTo(S.tileID.overscaledZ-1);S=this._tiles[z.key],S&&S.hasData()&&(E=z)}let C=E;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),r[C.key]){m[E.key]=E;break}}}findLoadedParent(r,u){if(r.key in this._loadedParentTiles){const p=this._loadedParentTiles[r.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=r.overscaledZ-1;p>=u;p--){const m=r.scaledTo(p),_=this._getLoadedTile(m);if(_)return _}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const u=this._tiles[r.key];return u&&u.hasData()?u:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const u=Math.ceil(r.width/this._source.tileSize)+1,p=Math.ceil(r.height/this._source.tileSize)+1,m=Math.floor(u*p*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(_)}handleWrapJump(r){const u=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,u){const p={};for(const m in this._tiles){const _=this._tiles[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+u),p[_.tileID.key]=_}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(r,u,p,m,_,S){const E={},C={},z=Object.keys(r),F=A.now();for(const B of z){const X=r[B],Q=this._tiles[B];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=F)continue;const re=this.findLoadedParent(X,u),ce=this.findLoadedSibling(X),pe=re||ce||null;pe&&(this._addTile(pe.tileID),E[pe.tileID.key]=pe.tileID),C[B]=X}this._retainLoadedChildren(C,m,p,r);for(const B in E)r[B]||(this._coveredTiles[B]=!0,r[B]=E[B]);if(S){const B={},X={};for(const Q of _)this._tiles[Q.key].hasData()?B[Q.key]=Q:X[Q.key]=Q;for(const Q in X){const re=X[Q].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(B[re[0].key]=r[re[0].key]=re[0],B[re[1].key]=r[re[1].key]=re[1],B[re[2].key]=r[re[2].key]=re[2],B[re[3].key]=r[re[3].key]=re[3],delete X[Q])}for(const Q in X){const re=X[Q],ce=this.findLoadedParent(re,this._source.minzoom),pe=this.findLoadedSibling(re),me=ce||pe||null;if(me){B[me.tileID.key]=r[me.tileID.key]=me.tileID;for(const we in B)B[we].isChildOf(me.tileID)&&delete B[we]}}for(const Q in this._tiles)B[Q]||(this._coveredTiles[Q]=!0)}}update(r,u){if(!this._sourceLoaded||this._paused)return;let p;this.transform=r,this.terrain=u,this.updateCacheSize(r),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(F=>new c.S(F.canonical.z,F.wrap,F.canonical.z,F.canonical.x,F.canonical.y)):(p=r.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(p=p.filter(F=>this._source.hasTile(F)))):p=[];const m=r.coveringZoomLevel(this._source),_=Math.max(m-jt.maxOverzooming,this._source.minzoom),S=Math.max(m+jt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const F={};for(const B of p)if(B.canonical.z>this._source.minzoom){const X=B.scaledTo(B.canonical.z-1);F[X.key]=X;const Q=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));F[Q.key]=Q}p=p.concat(Object.values(F))}const E=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(p,m);mi(this._source.type)&&this._updateCoveredAndRetainedTiles(C,_,S,m,p,u);for(const F in C)this._tiles[F].clearFadeHold();const z=c.ab(this._tiles,C);for(const F of z){const B=this._tiles[F];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(F)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,u){var p;const m={},_={},S=Math.max(u-jt.maxOverzooming,this._source.minzoom),E=Math.max(u+jt.maxUnderzooming,this._source.minzoom),C={};for(const z of r){const F=this._addTile(z);m[z.key]=z,F.hasData()||uthis._source.maxzoom){const X=z.children(this._source.maxzoom)[0],Q=this.getTile(X);if(Q&&Q.hasData()){m[X.key]=X;continue}}else{const X=z.children(this._source.maxzoom);if(m[X[0].key]&&m[X[1].key]&&m[X[2].key]&&m[X[3].key])continue}let B=F.wasRequested();for(let X=z.overscaledZ-1;X>=S;--X){const Q=z.scaledTo(X);if(_[Q.key])break;if(_[Q.key]=!0,F=this.getTile(Q),!F&&B&&(F=this._addTile(Q)),F){const re=F.hasData();if((re||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||B)&&(m[Q.key]=Q),B=F.wasRequested(),re)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const u=[];let p,m=this._tiles[r].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}u.push(m.key);const _=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(_),p)break;m=_}for(const _ of u)this._loadedParentTiles[_]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const u=this._tiles[r].tileID,p=this._getLoadedTile(u);this._loadedSiblingTiles[u.key]=p}}_addTile(r){let u=this._tiles[r.key];if(u)return u;u=this._cache.getAndRemove(r),u&&(this._setTileReloadTimer(r.key,u),u.tileID=r,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,u)));const p=u;return u||(u=new pi(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(u,r.key,u.state)),u.uses++,this._tiles[r.key]=u,p||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(r,u){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const p=u.getExpiryTimeout();p&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},p))}_removeTile(r){const u=this._tiles[r];u&&(u.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(r){const u=r.sourceDataType;r.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(r);this._cache.reset()}tilesIn(r,u,p){const m=[],_=this.transform;if(!_)return m;const S=p?_.getCameraQueryGeometry(r):r,E=r.map(re=>_.pointCoordinate(re,this.terrain)),C=S.map(re=>_.pointCoordinate(re,this.terrain)),z=this.getIds();let F=1/0,B=1/0,X=-1/0,Q=-1/0;for(const re of C)F=Math.min(F,re.x),B=Math.min(B,re.y),X=Math.max(X,re.x),Q=Math.max(Q,re.y);for(let re=0;re=0&&ae[1].y+we>=0){const Ce=E.map(ze=>pe.getTilePoint(ze)),Pe=C.map(ze=>pe.getTilePoint(ze));m.push({tile:ce,tileID:pe,queryGeometry:Ce,cameraQueryGeometry:Pe,scale:me})}}return m}getVisibleCoordinates(r){const u=this.getRenderableIds(r).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(mi(this._source.type)){const r=A.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=r)return!0}return!1}setFeatureState(r,u,p){this._state.updateState(r=r||"_geojsonTileLayer",u,p)}removeFeatureState(r,u,p){this._state.removeFeatureState(r=r||"_geojsonTileLayer",u,p)}getFeatureState(r,u){return this._state.getState(r=r||"_geojsonTileLayer",u)}setDependencies(r,u,p){const m=this._tiles[r];m&&m.setDependencies(u,p)}reloadTilesForDependencies(r,u){for(const p in this._tiles)this._tiles[p].hasDependency(r,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(r,u))}}function Kr(v,r){const u=Math.abs(2*v.wrap)-+(v.wrap<0),p=Math.abs(2*r.wrap)-+(r.wrap<0);return v.overscaledZ-r.overscaledZ||p-u||r.canonical.y-v.canonical.y||r.canonical.x-v.canonical.x}function mi(v){return v==="raster"||v==="image"||v==="video"}jt.maxOverzooming=10,jt.maxUnderzooming=3;class Xt{constructor(r,u){this.reset(r,u)}reset(r,u){this.points=r||[],this._distances=[0];for(let p=1;p0?(m-S)/E:0;return this.points[_].mult(1-C).add(this.points[u].mult(C))}}function Yi(v,r){let u=!0;return v==="always"||v!=="never"&&r!=="never"||(u=!1),u}class fs{constructor(r,u,p){const m=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(r/p),this.yCellCount=Math.ceil(u/p);for(let S=0;Sthis.width||m<0||u>this.height)return[];const C=[];if(r<=0&&u<=0&&this.width<=p&&this.height<=m){if(_)return[{key:null,x1:r,y1:u,x2:p,y2:m}];for(let z=0;z0}hitTestCircle(r,u,p,m,_){const S=r-p,E=r+p,C=u-p,z=u+p;if(E<0||S>this.width||z<0||C>this.height)return!1;const F=[];return this._forEachCell(S,C,E,z,this._queryCellCircle,F,{hitTest:!0,overlapMode:m,circle:{x:r,y:u,radius:p},seenUids:{box:{},circle:{}}},_),F.length>0}_queryCell(r,u,p,m,_,S,E,C){const{seenUids:z,hitTest:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!z.box[ce]){z.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(r<=re[pe+2]&&u<=re[pe+3]&&p>=re[pe+0]&&m>=re[pe+1]&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))&&(S.push({key:me,x1:re[pe],y1:re[pe+1],x2:re[pe+2],y2:re[pe+3]}),F))return!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!z.circle[ce]){z.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circleAndRectCollide(re[pe],re[pe+1],re[pe+2],r,u,p,m)&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))){const we=re[pe],ae=re[pe+1],Ce=re[pe+2];if(S.push({key:me,x1:we-Ce,y1:ae-Ce,x2:we+Ce,y2:ae+Ce}),F)return!0}}}return!1}_queryCellCircle(r,u,p,m,_,S,E,C){const{circle:z,seenUids:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!F.box[ce]){F.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(this._circleAndRectCollide(z.x,z.y,z.radius,re[pe+0],re[pe+1],re[pe+2],re[pe+3])&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!F.circle[ce]){F.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circlesCollide(re[pe],re[pe+1],re[pe+2],z.x,z.y,z.radius)&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}}_forEachCell(r,u,p,m,_,S,E,C){const z=this._convertToXCellCoord(r),F=this._convertToYCellCoord(u),B=this._convertToXCellCoord(p),X=this._convertToYCellCoord(m);for(let Q=z;Q<=B;Q++)for(let re=F;re<=X;re++)if(_.call(this,r,u,p,m,this.xCellCount*re+Q,S,E,C))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,u,p,m,_,S){const E=m-r,C=_-u,z=p+S;return z*z>E*E+C*C}_circleAndRectCollide(r,u,p,m,_,S,E){const C=(S-m)/2,z=Math.abs(r-(m+C));if(z>C+p)return!1;const F=(E-_)/2,B=Math.abs(u-(_+F));if(B>F+p)return!1;if(z<=C||B<=F)return!0;const X=z-C,Q=B-F;return X*X+Q*Q<=p*p}}function ps(v,r,u,p,m){const _=c.H();return r?(c.K(_,_,[1/m,1/m,1]),u||c.ad(_,_,p.angle)):c.L(_,p.labelPlaneMatrix,v),_}function Hn(v,r,u,p,m){if(r){const _=c.ae(v);return c.K(_,_,[m,m,1]),u||c.ad(_,_,-p.angle),_}return p.glCoordMatrix}function he(v,r,u,p){let m;p?(m=[v,r,p(v,r),1],c.af(m,m,u)):(m=[v,r,0,1],mr(m,m,u));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}function G(v,r){return .5+v/r*.5}function W(v,r){return v.x>=-r[0]&&v.x<=r[0]&&v.y>=-r[1]&&v.y<=r[1]}function ee(v,r,u,p,m,_,S,E,C,z,F,B,X,Q,re){const ce=p?v.textSizeData:v.iconSizeData,pe=c.ag(ce,u.transform.zoom),me=[256/u.width*2+1,256/u.height*2+1],we=p?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;we.clear();const ae=v.lineVertexArray,Ce=p?v.text.placedSymbolArray:v.icon.placedSymbolArray,Pe=u.transform.width/u.transform.height;let ze=!1;for(let Xe=0;XeMath.abs(u.x-r.x)*p?{useVertical:!0}:(v===c.ah.vertical?r.yu.x)?{needsFlipping:!0}:null}function Ie(v,r,u,p,m,_,S,E,C,z,F){const B=u/24,X=r.lineOffsetX*B,Q=r.lineOffsetY*B;let re;if(r.numGlyphs>1){const ce=r.glyphStartIndex+r.numGlyphs,pe=r.lineStartIndex,me=r.lineStartIndex+r.lineLength,we=ue(B,E,X,Q,p,r,F,v);if(!we)return{notEnoughRoom:!0};const ae=he(we.first.point.x,we.first.point.y,S,v.getElevation).point,Ce=he(we.last.point.x,we.last.point.y,S,v.getElevation).point;if(m&&!p){const Pe=Se(r.writingMode,ae,Ce,z);if(Pe)return Pe}re=[we.first];for(let Pe=r.glyphStartIndex+1;Pe0?ae.point:function(ze,Xe,st,gt,wt,dt){return Ae(ze,Xe,st,1,wt,dt)}(v.tileAnchorPoint,we,pe,0,_,v),Pe=Se(r.writingMode,pe,Ce,z);if(Pe)return Pe}const ce=ut(B*E.getoffsetX(r.glyphStartIndex),X,Q,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,v,F);if(!ce||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};re=[ce]}for(const ce of re)c.aj(C,ce.point,ce.angle);return{}}function Ae(v,r,u,p,m,_){const S=v.add(v.sub(r)._unit()),E=m!==void 0?he(S.x,S.y,m,_.getElevation).point:He(S.x,S.y,_).point,C=u.sub(E);return u.add(C._mult(p/C.mag()))}function _e(v,r,u){const p=r.projectionCache;if(p.projections[v])return p.projections[v];const m=new c.P(r.lineVertexArray.getx(v),r.lineVertexArray.gety(v)),_=He(m.x,m.y,r);if(_.signedDistanceFromCamera>0)return p.projections[v]=_.point,p.anyProjectionOccluded=p.anyProjectionOccluded||_.isOccluded,_.point;const S=v-u.direction;return function(E,C,z,F,B){return Ae(E,C,z,F,void 0,B)}(u.distanceFromAnchor===0?r.tileAnchorPoint:new c.P(r.lineVertexArray.getx(S),r.lineVertexArray.gety(S)),m,u.previousVertex,u.absOffsetX-u.distanceFromAnchor+1,r)}function He(v,r,u){const p=v+u.translation[0],m=r+u.translation[1];let _;return!u.pitchWithMap&&u.projection.useSpecialProjectionForSymbols?(_=u.projection.projectTileCoordinates(p,m,u.unwrappedTileID,u.getElevation),_.point.x=(.5*_.point.x+.5)*u.width,_.point.y=(.5*-_.point.y+.5)*u.height):(_=he(p,m,u.labelPlaneMatrix,u.getElevation),_.isOccluded=!1),_}function Je(v,r,u){return v._unit()._perp()._mult(r*u)}function $e(v,r,u,p,m,_,S,E,C){if(E.projectionCache.offsets[v])return E.projectionCache.offsets[v];const z=u.add(r);if(v+C.direction=m)return E.projectionCache.offsets[v]=z,z;const F=_e(v+C.direction,E,C),B=Je(F.sub(u),S,C.direction),X=u.add(B),Q=F.add(B);return E.projectionCache.offsets[v]=c.ak(_,z,X,Q)||z,E.projectionCache.offsets[v]}function ut(v,r,u,p,m,_,S,E,C){const z=p?v-r:v+r;let F=z>0?1:-1,B=0;p&&(F*=-1,B=Math.PI),F<0&&(B+=Math.PI);let X,Q=F>0?_+m:_+m+1;E.projectionCache.cachedAnchorPoint?X=E.projectionCache.cachedAnchorPoint:(X=He(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=X);let re,ce,pe=X,me=X,we=0,ae=0;const Ce=Math.abs(z),Pe=[];let ze;for(;we+ae<=Ce;){if(Q+=F,Q<_||Q>=S)return null;we+=ae,me=pe,ce=re;const gt={absOffsetX:Ce,direction:F,distanceFromAnchor:we,previousVertex:me};if(pe=_e(Q,E,gt),u===0)Pe.push(me),ze=pe.sub(me);else{let wt;const dt=pe.sub(me);wt=dt.mag()===0?Je(_e(Q+F,E,gt).sub(pe),u,F):Je(dt,u,F),ce||(ce=me.add(wt)),re=$e(Q,wt,pe,_,S,ce,u,E,gt),Pe.push(ce),ze=re.sub(ce)}ae=ze.mag()}const Xe=ze._mult((Ce-we)/ae)._add(ce||me),st=B+Math.atan2(pe.y-me.y,pe.x-me.x);return Pe.push(Xe),{point:Xe,angle:C?st:0,path:Pe}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ot(v,r){for(let u=0;u=1;tr--)_t.push(qt.path[tr]);for(let tr=1;trar.signedDistanceFromCamera<=0)?[]:tr.map(ar=>ar.point)}let Hr=[];if(_t.length>0){const tr=_t[0].clone(),ar=_t[0].clone();for(let Wr=1;Wr<_t.length;Wr++)tr.x=Math.min(tr.x,_t[Wr].x),tr.y=Math.min(tr.y,_t[Wr].y),ar.x=Math.max(ar.x,_t[Wr].x),ar.y=Math.max(ar.y,_t[Wr].y);Hr=tr.x>=dt.x&&ar.x<=ct.x&&tr.y>=dt.y&&ar.y<=ct.y?[_t]:ar.xct.x||ar.yct.y?[]:c.al([_t],dt.x,dt.y,ct.x,ct.y)}for(const tr of Hr){Pt.reset(tr,.25*wt);let ar=0;ar=Pt.length<=.5*wt?1:Math.ceil(Pt.paddedLength/Gt)+1;for(let Wr=0;Wrhe(m.x,m.y,p,u.getElevation))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const u=[];let p=1/0,m=1/0,_=-1/0,S=-1/0;for(const F of r){const B=new c.P(F.x+Qt,F.y+Qt);p=Math.min(p,B.x),m=Math.min(m,B.y),_=Math.max(_,B.x),S=Math.max(S,B.y),u.push(B)}const E=this.grid.query(p,m,_,S).concat(this.ignoredGrid.query(p,m,_,S)),C={},z={};for(const F of E){const B=F.key;if(C[B.bucketInstanceId]===void 0&&(C[B.bucketInstanceId]={}),C[B.bucketInstanceId][B.featureIndex])continue;const X=[new c.P(F.x1,F.y1),new c.P(F.x2,F.y1),new c.P(F.x2,F.y2),new c.P(F.x1,F.y2)];c.am(u,X)&&(C[B.bucketInstanceId][B.featureIndex]=!0,z[B.bucketInstanceId]===void 0&&(z[B.bucketInstanceId]=[]),z[B.bucketInstanceId].push(B.featureIndex))}return z}insertCollisionBox(r,u,p,m,_,S){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,u,p,m,_,S){const E=p?this.ignoredGrid:this.grid,C={bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u};for(let z=0;z=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(r,u,p,m){return p>=0&&r=0&&uthis.projectAndGetPerspectiveRatio(p,wt.x,wt.y,m,z));st=gt.some(wt=>!wt.isOccluded),Xe=gt.map(wt=>wt.point)}else st=!0;return{box:c.ao(Xe),allPointsOccluded:!st}}}function or(v,r,u){return r*(c.X/(v.tileSize*Math.pow(2,u-v.tileID.overscaledZ)))}class Tn{constructor(r,u,p,m){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?u:-u))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class rn{constructor(r,u,p,m,_){this.text=new Tn(r?r.text:null,u,p,_),this.icon=new Tn(r?r.icon:null,u,m,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rr{constructor(r,u,p){this.text=r,this.icon=u,this.skipFade=p}}class Mr{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class Yr{constructor(r,u,p,m,_){this.bucketInstanceId=r,this.featureIndex=u,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=_}}class Dn{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const u=++this.maxGroupID;this.collisionGroups[r]={ID:u,predicate:p=>p.collisionGroupID===u}}return this.collisionGroups[r]}}function Bn(v,r,u,p,m){const{horizontalAlign:_,verticalAlign:S}=c.au(v);return new c.P(-(_-.5)*r+p[0]*m,-(S-.5)*u+p[1]*m)}class ni{constructor(r,u,p,m,_,S){this.transform=r.clone(),this.terrain=p,this.collisionIndex=new gr(this.transform,u),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Dn(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const u=this.terrain;return u?(p,m)=>u.getElevation(r,p,m):null}getBucketParts(r,u,p,m){const _=p.getBucket(u),S=p.latestFeatureIndex;if(!_||!S||u.id!==_.layerIds[0])return;const E=p.collisionBoxArray,C=_.layers[0].layout,z=_.layers[0].paint,F=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),B=p.tileSize/c.X,X=p.tileID.toUnwrapped(),Q=this.transform.calculatePosMatrix(X),re=C.get("text-pitch-alignment")==="map",ce=C.get("text-rotation-alignment")==="map",pe=or(p,1,this.transform.zoom),me=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),we=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),ae=ps(Q,re,ce,this.transform,pe);let Ce=null;if(re){const ze=Hn(Q,re,ce,this.transform,pe);Ce=c.L([],this.transform.labelPlaneMatrix,ze)}this.retainedQueryData[_.bucketInstanceId]=new Yr(_.bucketInstanceId,S,_.sourceLayerIndex,_.index,p.tileID);const Pe={bucket:_,layout:C,translationText:me,translationIcon:we,posMatrix:Q,unwrappedTileID:X,textLabelPlaneMatrix:ae,labelToScreenMatrix:Ce,scale:F,textPixelRatio:B,holdingForFade:p.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:c.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(m)for(const ze of _.sortKeyRanges){const{sortKey:Xe,symbolInstanceStart:st,symbolInstanceEnd:gt}=ze;r.push({sortKey:Xe,symbolInstanceStart:st,symbolInstanceEnd:gt,parameters:Pe})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(r,u,p,m,_,S,E,C,z,F,B,X,Q,re,ce,pe,me,we,ae){const Ce=c.aq[r.textAnchor],Pe=[r.textOffset0,r.textOffset1],ze=Bn(Ce,p,m,Pe,_),Xe=this.collisionIndex.placeCollisionBox(u,X,C,z,F,E,S,pe,B.predicate,ae,ze);if((!we||this.collisionIndex.placeCollisionBox(we,X,C,z,F,E,S,me,B.predicate,ae,ze).placeable)&&Xe.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(st=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Pe,width:p,height:m,anchor:Ce,textBoxScale:_,prevAnchor:st},this.markUsedJustification(re,Ce,Q,ce),re.allowVerticalPlacement&&(this.markUsedOrientation(re,ce,Q),this.placedOrientations[Q.crossTileID]=ce),{shift:ze,placedGlyphBoxes:Xe}}}placeLayerBucketPart(r,u,p){const{bucket:m,layout:_,translationText:S,translationIcon:E,posMatrix:C,unwrappedTileID:z,textLabelPlaneMatrix:F,labelToScreenMatrix:B,textPixelRatio:X,holdingForFade:Q,collisionBoxArray:re,partiallyEvaluatedTextSize:ce,collisionGroup:pe}=r.parameters,me=_.get("text-optional"),we=_.get("icon-optional"),ae=c.ar(_,"text-overlap","text-allow-overlap"),Ce=ae==="always",Pe=c.ar(_,"icon-overlap","icon-allow-overlap"),ze=Pe==="always",Xe=_.get("text-rotation-alignment")==="map",st=_.get("text-pitch-alignment")==="map",gt=_.get("icon-text-fit")!=="none",wt=_.get("symbol-z-order")==="viewport-y",dt=Ce&&(ze||!m.hasIconData()||we),ct=ze&&(Ce||!m.hasTextData()||me);!m.collisionArrays&&re&&m.deserializeCollisionBoxes(re);const Pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),qt=(ft,_t,Gt)=>{var Hr,tr;if(u[ft.crossTileID])return;if(Q)return void(this.placements[ft.crossTileID]=new rr(!1,!1,!1));let ar=!1,Wr=!1,Gn=!0,xs=null,Gr={box:null,placeable:!1,offscreen:null},_i={box:null,placeable:!1,offscreen:null},ii=null,Zn=null,si=null,Ws=0,sl=0,Mc=0;_t.textFeatureIndex?Ws=_t.textFeatureIndex:ft.useRuntimeCollisionCircles&&(Ws=ft.featureIndex),_t.verticalTextFeatureIndex&&(sl=_t.verticalTextFeatureIndex);const ol=_t.textBox;if(ol){const ts=Nn=>{let qn=c.ah.horizontal;if(m.allowVerticalPlacement&&!Nn&&this.prevPlacement){const Li=this.prevPlacement.placedOrientations[ft.crossTileID];Li&&(this.placedOrientations[ft.crossTileID]=Li,qn=Li,this.markUsedOrientation(m,qn,ft))}return qn},rs=(Nn,qn)=>{if(m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&_t.verticalTextBox){for(const Li of m.writingModes)if(Li===c.ah.vertical?(Gr=qn(),_i=Gr):Gr=Nn(),Gr&&Gr.placeable)break}else Gr=Nn()},Ao=ft.textAnchorOffsetStartIndex,ws=ft.textAnchorOffsetEndIndex;if(ws===Ao){const Nn=(qn,Li)=>{const cr=this.collisionIndex.placeCollisionBox(qn,ae,X,C,z,st,Xe,S,pe.predicate,Pt);return cr&&cr.placeable&&(this.markUsedOrientation(m,Li,ft),this.placedOrientations[ft.crossTileID]=Li),cr};rs(()=>Nn(ol,c.ah.horizontal),()=>{const qn=_t.verticalTextBox;return m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&qn?Nn(qn,c.ah.vertical):{box:null,offscreen:null}}),ts(Gr&&Gr.placeable)}else{let Nn=c.aq[(tr=(Hr=this.prevPlacement)===null||Hr===void 0?void 0:Hr.variableOffsets[ft.crossTileID])===null||tr===void 0?void 0:tr.anchor];const qn=(cr,ua,al)=>{const ll=cr.x2-cr.x1,um=cr.y2-cr.y1,t0=ft.textBoxScale,cm=gt&&Pe==="never"?ua:null;let Do=null,hm=ae==="never"?1:2,Dc="never";Nn&&hm++;for(let hu=0;huqn(ol,_t.iconBox,c.ah.horizontal),()=>{const cr=_t.verticalTextBox;return m.allowVerticalPlacement&&(!Gr||!Gr.placeable)&&ft.numVerticalGlyphVertices>0&&cr?qn(cr,_t.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Gr&&(ar=Gr.placeable,Gn=Gr.offscreen);const Li=ts(Gr&&Gr.placeable);if(!ar&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[ft.crossTileID];cr&&(this.variableOffsets[ft.crossTileID]=cr,this.markUsedJustification(m,cr.anchor,ft,Li))}}}if(ii=Gr,ar=ii&&ii.placeable,Gn=ii&&ii.offscreen,ft.useRuntimeCollisionCircles){const ts=m.text.placedSymbolArray.get(ft.centerJustifiedTextSymbolIndex),rs=c.ai(m.textSizeData,ce,ts),Ao=_.get("text-padding");Zn=this.collisionIndex.placeCollisionCircles(ae,ts,m.lineVertexArray,m.glyphOffsetArray,rs,C,z,F,B,p,st,pe.predicate,ft.collisionCircleDiameter,Ao,S,Pt),Zn.circles.length&&Zn.collisionDetected&&!p&&c.w("Collisions detected, but collision boxes are not shown"),ar=Ce||Zn.circles.length>0&&!Zn.collisionDetected,Gn=Gn&&Zn.offscreen}if(_t.iconFeatureIndex&&(Mc=_t.iconFeatureIndex),_t.iconBox){const ts=rs=>this.collisionIndex.placeCollisionBox(rs,Pe,X,C,z,st,Xe,E,pe.predicate,Pt,gt&&xs?xs:void 0);_i&&_i.placeable&&_t.verticalIconBox?(si=ts(_t.verticalIconBox),Wr=si.placeable):(si=ts(_t.iconBox),Wr=si.placeable),Gn=Gn&&si.offscreen}const es=me||ft.numHorizontalGlyphVertices===0&&ft.numVerticalGlyphVertices===0,Ac=we||ft.numIconVertices===0;es||Ac?Ac?es||(Wr=Wr&&ar):ar=Wr&&ar:Wr=ar=Wr&&ar;const Fd=Wr&&si.placeable;if(ar&&ii.placeable&&this.collisionIndex.insertCollisionBox(ii.box,ae,_.get("text-ignore-placement"),m.bucketInstanceId,_i&&_i.placeable&&sl?sl:Ws,pe.ID),Fd&&this.collisionIndex.insertCollisionBox(si.box,Pe,_.get("icon-ignore-placement"),m.bucketInstanceId,Mc,pe.ID),Zn&&ar&&this.collisionIndex.insertCollisionCircles(Zn.circles,ae,_.get("text-ignore-placement"),m.bucketInstanceId,Ws,pe.ID),p&&this.storeCollisionData(m.bucketInstanceId,Gt,_t,ii,si,Zn),ft.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ft.crossTileID]=new rr(ar||dt,Wr||ct,Gn||m.justReloaded),u[ft.crossTileID]=!0};if(wt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ft=m.getSortedSymbolIndexes(this.transform.angle);for(let _t=ft.length-1;_t>=0;--_t){const Gt=ft[_t];qt(m.symbolInstances.get(Gt),m.collisionArrays[Gt],Gt)}}else for(let ft=r.symbolInstanceStart;ft=0&&(r.text.placedSymbolArray.get(E).crossTileID=_>=0&&E!==_?0:p.crossTileID)}markUsedOrientation(r,u,p){const m=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,_=u===c.ah.vertical?u:0,S=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const E of S)r.text.placedSymbolArray.get(E).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const m=u?u.symbolFadeChange(r):1,_=u?u.opacities:{},S=u?u.variableOffsets:{},E=u?u.placedOrientations:{};for(const C in this.placements){const z=this.placements[C],F=_[C];F?(this.opacities[C]=new rn(F,m,z.text,z.icon),p=p||z.text!==F.text.placed||z.icon!==F.icon.placed):(this.opacities[C]=new rn(null,m,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const C in _){const z=_[C];if(!this.opacities[C]){const F=new rn(z,m,!1,!1);F.isHidden()||(this.opacities[C]=F,p=p||z.text.placed||z.icon.placed)}}for(const C in S)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=S[C]);for(const C in E)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=E[C]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:r)}updateLayerOpacities(r,u){const p={};for(const m of u){const _=m.getBucket(r);_&&m.latestFeatureIndex&&r.id===_.layerIds[0]&&this.updateBucketOpacities(_,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(r,u,p,m){r.hasTextData()&&(r.text.opacityVertexArray.clear(),r.text.hasVisibleVertices=!1),r.hasIconData()&&(r.icon.opacityVertexArray.clear(),r.icon.hasVisibleVertices=!1),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const _=r.layers[0],S=_.layout,E=new rn(null,0,!1,!1,!0),C=S.get("text-allow-overlap"),z=S.get("icon-allow-overlap"),F=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=S.get("text-rotation-alignment")==="map",X=S.get("text-pitch-alignment")==="map",Q=S.get("icon-text-fit")!=="none",re=new rn(null,0,C&&(z||!r.hasIconData()||S.get("icon-optional")),z&&(C||!r.hasTextData()||S.get("text-optional")),!0);!r.collisionArrays&&m&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(m);const ce=(me,we,ae)=>{for(let Ce=0;Ce0,st=this.placedOrientations[we.crossTileID],gt=st===c.ah.vertical,wt=st===c.ah.horizontal||st===c.ah.horizontalOnly;if(ae>0||Ce>0){const ct=Di(ze.text);ce(r.text,ae,gt?Ba:ct),ce(r.text,Ce,wt?Ba:ct);const Pt=ze.text.isHidden();[we.rightJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(r.text.placedSymbolArray.get(_t).hidden=Pt||gt?1:0)}),we.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).hidden=Pt||wt?1:0);const qt=this.variableOffsets[we.crossTileID];qt&&this.markUsedJustification(r,qt.anchor,we,st);const ft=this.placedOrientations[we.crossTileID];ft&&(this.markUsedJustification(r,"left",we,ft),this.markUsedOrientation(r,ft,we))}if(Xe){const ct=Di(ze.icon),Pt=!(Q&&we.verticalPlacedIconSymbolIndex&>);we.placedIconSymbolIndex>=0&&(ce(r.icon,we.numIconVertices,Pt?ct:Ba),r.icon.placedSymbolArray.get(we.placedIconSymbolIndex).hidden=ze.icon.isHidden()),we.verticalPlacedIconSymbolIndex>=0&&(ce(r.icon,we.numVerticalIconVertices,Pt?Ba:ct),r.icon.placedSymbolArray.get(we.verticalPlacedIconSymbolIndex).hidden=ze.icon.isHidden())}const dt=pe&&pe.has(me)?pe.get(me):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ct=r.collisionArrays[me];if(ct){let Pt=new c.P(0,0);if(ct.textBox||ct.verticalTextBox){let qt=!0;if(F){const ft=this.variableOffsets[Pe];ft?(Pt=Bn(ft.anchor,ft.width,ft.height,ft.textOffset,ft.textBoxScale),B&&Pt._rotate(X?this.transform.angle:-this.transform.angle)):qt=!1}if(ct.textBox||ct.verticalTextBox){let ft;ct.textBox&&(ft=gt),ct.verticalTextBox&&(ft=wt),Fa(r.textCollisionBox.collisionVertexArray,ze.text.placed,!qt||ft,dt.text,Pt.x,Pt.y)}}if(ct.iconBox||ct.verticalIconBox){const qt=!!(!wt&&ct.verticalIconBox);let ft;ct.iconBox&&(ft=qt),ct.verticalIconBox&&(ft=!qt),Fa(r.iconCollisionBox.collisionVertexArray,ze.icon.placed,ft,dt.icon,Q?Pt.x:0,Q?Pt.y:0)}}}}if(r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.text.opacityVertexArray.length!==r.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${r.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${r.text.layoutVertexArray.length}) / 4`);if(r.icon.opacityVertexArray.length!==r.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${r.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${r.icon.layoutVertexArray.length}) / 4`);if(r.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=me.invProjMatrix,r.placementViewportMatrix=me.viewportMatrix,r.collisionCircleArray=me.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function Fa(v,r,u,p,m,_){p&&p.length!==0||(p=[0,0,0,0]);const S=p[0]-Qt,E=p[1]-Qt,C=p[2]-Qt,z=p[3]-Qt;v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,z),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,z)}const Ar=Math.pow(2,25),qh=Math.pow(2,24),Yh=Math.pow(2,17),Mi=Math.pow(2,16),Ai=Math.pow(2,9),P_=Math.pow(2,8),Xi=Math.pow(2,1);function Di(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const r=v.placed?1:0,u=Math.floor(127*v.opacity);return u*Ar+r*qh+u*Yh+r*Mi+u*Ai+r*P_+u*Xi+r}const Ba=0;function Ko(){return{isOccluded:(v,r,u)=>!1,getPitchedTextCorrection:(v,r,u)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,r,u,p){throw new Error("Not implemented.")},translatePosition:(v,r,u,p)=>function(m,_,S,E,C=!1){if(!S[0]&&!S[1])return[0,0];const z=C?E==="map"?m.angle:0:E==="viewport"?-m.angle:0;if(z){const F=Math.sin(z),B=Math.cos(z);S=[S[0]*B-S[1]*F,S[0]*F+S[1]*B]}return[C?S[0]:or(_,S[0],m.zoom),C?S[1]:or(_,S[1],m.zoom)]}(v,r,u,p),getCircleRadiusCorrection:v=>1}}class En{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&!r.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(r,u,p,m,_){const S=this._bucketParts;for(;this._currentTileIndexE.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&A.now()-m>2;for(;this._currentPlacementIndex>=0;){const S=u[r[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(S.type==="symbol"&&(!S.minzoom||S.minzoom<=E)&&(!S.maxzoom||S.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new En(S)),this._inProgressLayer.continuePlacement(p[S.source],this.placement,this._showCollisionBoxes,S,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const ms=512/c.X/2;class xn{constructor(r,u,p){this.tileID=r,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let _=0;_({x:Math.floor(C.anchorX*ms),y:Math.floor(C.anchorY*ms)})),crossTileIDs:S.map(C=>C.crossTileID)};if(E.positions.length>128){const C=new c.av(E.positions.length,16,Uint16Array);for(const{x:z,y:F}of E.positions)C.add(z,F);C.finish(),delete E.positions,E.index=C}this._symbolsByKey[_]=E}}getScaledCoordinates(r,u){const{x:p,y:m,z:_}=this.tileID.canonical,{x:S,y:E,z:C}=u.canonical,z=ms/Math.pow(2,C-_),F=(E*c.X+r.anchorY)*z,B=m*c.X*ms;return{x:Math.floor((S*c.X+r.anchorX)*z-p*c.X*ms),y:Math.floor(F-B)}}findMatches(r,u,p){const m=this.tileID.canonical.zr)}}class Qu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const u=Math.round((r-this.lng)/360);if(u!==0)for(const p in this.indexes){const m=this.indexes[p],_={};for(const S in m){const E=m[S];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+u),_[E.tileID.key]=E}this.indexes[p]=_}this.lng=r}addBucket(r,u,p){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let _=0;_r.overscaledZ)for(const E in S){const C=S[E];C.tileID.isChildOf(r)&&C.findMatches(u.symbolInstances,r,m)}else{const E=S[r.scaledTo(Number(_)).key];E&&E.findMatches(u.symbolInstances,r,m)}}for(let _=0;_{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}const ys=(v,r)=>c.t(v,r&&r.filter(u=>u.identifier!=="source.canvas")),M_=c.aw();class ec extends c.E{constructor(r,u={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=r,this.dispatcher=new _r(Yt(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new je,this.imageManager.setEventedParent(this),this.glyphManager=new ye(r._requestManager,u.localIdeographFontFamily),this.lineAtlas=new mt(256,512),this.crossTileSymbolIndex=new Xh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ay()),vn().on(qe,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const _=m.getSource();if(_&&_.vectorLayerIds)for(const S in this._layers){const E=this._layers[S];E.source===_.id&&this._validateLayer(E)}})}loadURL(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const m=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;c.h(m,this._loadStyleRequest).then(S=>{this._loadStyleRequest=null,this._load(S.data,u,p)}).catch(S=>{this._loadStyleRequest=null,S&&!_.signal.aborted&&this.fire(new c.j(S))})}loadJSON(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(r,u,p)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(M_,{validate:!1})}_load(r,u,p){var m;const _=u.transformStyle?u.transformStyle(p,r):r;if(!u.validate||!ys(this,c.u(_))){this._loaded=!0,this.stylesheet=_;for(const S in _.sources)this.addSource(S,_.sources[S],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new Ke(this.stylesheet.light),this.sky=new Ee(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const r=c.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of r){const p=c.aA(u);p.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=p}}_loadSprite(r,u=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,S,E,C){return c._(this,void 0,void 0,function*(){const z=Oe(_),F=E>1?"@2x":"",B={},X={};for(const{id:Q,url:re}of z){const ce=S.transformRequest(Ge(re,F,".json"),"SpriteJSON");B[Q]=c.h(ce,C);const pe=S.transformRequest(Ge(re,F,".png"),"SpriteImage");X[Q]=q.getImage(pe,C)}return yield Promise.all([...Object.values(B),...Object.values(X)]),function(Q,re){return c._(this,void 0,void 0,function*(){const ce={};for(const pe in Q){ce[pe]={};const me=A.getImageCanvasContext((yield re[pe]).data),we=(yield Q[pe]).data;for(const ae in we){const{width:Ce,height:Pe,x:ze,y:Xe,sdf:st,pixelRatio:gt,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt}=we[ae];ce[pe][ae]={data:null,pixelRatio:gt,sdf:st,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt,spriteData:{width:Ce,height:Pe,x:ze,y:Xe,context:me}}}}return ce})}(B,X)})}(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const S in _){this._spritesImagesIds[S]=[];const E=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter(C=>!(C in _)):[];for(const C of E)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in _[S]){const z=S==="default"?C:`${S}:${C}`;this._spritesImagesIds[S].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,_[S][C],!1):this.imageManager.addImage(z,_[S][C]),u&&(this._changedImages[z]=!0)}}}).catch(_=>{this._spriteRequest=null,m=_,this.fire(new c.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(r){const u=this.sourceCaches[r.source];if(!u)return;const p=r.sourceLayer;if(!p)return;const m=u.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new c.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${r.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,u=!1){const p=this._serializedAllLayers();if(!r||r.length===0)return Object.values(u?c.aB(p):p);const m=[];for(const _ of r)if(p[_]){const S=u?c.aB(p[_]):p[_];m.push(S)}return m}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const u=Object.keys(this._layers);for(const p of u){const m=this._layers[p];m.type!=="custom"&&(r[p]=m.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(r){if(!this._loaded)return;const u=this._changed;if(u){const m=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(m.length||_.length)&&this._updateWorkerLayers(m,_);for(const S in this._updatedSources){const E=this._updatedSources[S];if(E==="reload")this._reloadSource(S);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);this._clearSource(S)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const S in this._updatedPaintProps)this._layers[S].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const _=this.sourceCaches[m];p[m]=_.used,_.used=!1}for(const m of this._order){const _=this._layers[m];_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const m in p){const _=this.sourceCaches[m];!!p[m]!=!!_.used&&_.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,u={}){var p;this._checkLoaded();const m=this.serialize();if(r=u.transformStyle?u.transformStyle(m,r):r,((p=u.validate)===null||p===void 0||p)&&ys(this,c.u(r)))return!1;(r=c.aB(r)).layers=c.az(r.layers);const _=c.aC(m,r),S=this._getOperationsToPerform(_);if(S.unimplemented.length>0)throw new Error(`Unimplemented: ${S.unimplemented.join(", ")}.`);if(S.operations.length===0)return!1;for(const E of S.operations)E();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const u=[],p=[];for(const m of r)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":u.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":u.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":u.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":u.push(()=>{});break;default:p.push(m.command)}return{operations:u,unimplemented:p}}addImage(r,u){if(this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,u),this._afterImageUpdated(r)}updateImage(r,u){this.imageManager.updateImage(r,u)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" does not exist.`)));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,u,p={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.u.source,`sources.${r}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const m=this.sourceCaches[r]=new jt(r,u,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:r})),m.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new c.j(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));const u=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,u){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error(`There is no source with this ID=${r}`);const p=this.sourceCaches[r].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(u),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,u,p={}){this._checkLoaded();const m=r.id;if(this.getLayer(m))return void this.fire(new c.j(new Error(`Layer "${m}" already exists on this map.`)));let _;if(r.type==="custom"){if(ys(this,c.aD(r)))return;_=c.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(m,r.source),r=c.aB(r),r=c.e(r,{source:m})),this._validate(c.u.layer,`layers.${m}`,r,{arrayIndex:-1},p))return;_=c.aA(r),this._validateLayer(_),_.setEventedParent(this,{layer:{id:m}})}const S=u?this._order.indexOf(u):this._order.length;if(u&&S===-1)this.fire(new c.j(new Error(`Cannot add layer "${m}" before non-existing layer "${u}".`)));else{if(this._order.splice(S,0,m),this._layerOrderChanged=!0,this._layers[m]=_,this._removedLayers[m]&&_.source&&_.type!=="custom"){const E=this._removedLayers[m];delete this._removedLayers[m],E.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(r,u){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new c.j(new Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===u)return;const p=this._order.indexOf(r);this._order.splice(p,1);const m=u?this._order.indexOf(u):this._order.length;u&&m===-1?this.fire(new c.j(new Error(`Cannot move layer "${r}" before non-existing layer "${u}".`))):(this._order.splice(m,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const u=this._layers[r];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${r}".`)));u.setEventedParent(null);const p=this._order.indexOf(r);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=u,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],u.onRemove&&u.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,u,p){this._checkLoaded();const m=this.getLayer(r);m?m.minzoom===u&&m.maxzoom===p||(u!=null&&(m.minzoom=u),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,u,p={}){this._checkLoaded();const m=this.getLayer(r);if(m){if(!c.aE(m.filter,u))return u==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(c.u.filter,`layers.${m.id}.filter`,u,null,p)||(m.filter=c.aB(u),this._updateLayer(m)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${r}".`)))}getFilter(r){return c.aB(this.getLayer(r).filter)}setLayoutProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getLayoutProperty(u),p)||(_.setLayoutProperty(u,p,m),this._updateLayer(_)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,u){const p=this.getLayer(r);if(p)return p.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getPaintProperty(u),p)||(_.setPaintProperty(u,p,m)&&this._updateLayer(_),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getPaintProperty(r,u){return this.getLayer(r).getPaintProperty(u)}setFeatureState(r,u){this._checkLoaded();const p=r.source,m=r.sourceLayer,_=this.sourceCaches[p];if(_===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const S=_.getSource().type;S==="geojson"&&m?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||m?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(m,r.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,u){this._checkLoaded();const p=r.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const _=m.getSource().type,S=_==="vector"?r.sourceLayer:void 0;_!=="vector"||S?u&&typeof r.id!="string"&&typeof r.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(S,r.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const u=r.source,p=r.sourceLayer,m=this.sourceCaches[u];if(m!==void 0)return m.getSource().type!=="vector"||p?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,r.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const r=c.aF(this.sourceCaches,_=>_.serialize()),u=this._serializeByIds(this._order,!0),p=this.map.getTerrain()||void 0,m=this.stylesheet;return c.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:r,layers:u,terrain:p},_=>_!==void 0)}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){const u=S=>this._layers[S].type==="fill-extrusion",p={},m=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E)){p[E]=S;for(const C of r){const z=C[E];if(z)for(const F of z)m.push(F)}}}m.sort((S,E)=>E.intersectionZ-S.intersectionZ);const _=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E))for(let C=m.length-1;C>=0;C--){const z=m[C].feature;if(p[z.layer.id]{const st=me.featureSortOrder;if(st){const gt=st.indexOf(ze.featureIndex);return st.indexOf(Xe.featureIndex)-gt}return Xe.featureIndex-ze.featureIndex});for(const ze of Pe)Ce.push(ze)}}for(const me in re)re[me].forEach(we=>{const ae=we.feature,Ce=z[E[me].source].getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=Ce});return re}(this._layers,S,this.sourceCaches,r,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(r,u){u&&u.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[r];return p?function(m,_){const S=m.getRenderableIds().map(z=>m.getTileByID(z)),E=[],C={};for(let z=0;zX.getTileByID(Q)).sort((Q,re)=>re.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(re.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(F,C[F.source],r.center.lng);S=S||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(A.now(),r.zoom))&&(this.pauseablePlacement=new Zl(r,this.map.terrain,this._order,_,u,p,m,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(A.now()),E=!0),S&&this.pauseablePlacement.placement.setStale()),E||S)for(const z of this._order){const F=this._layers[z];F.type==="symbol"&&this.placement.updateLayerOpacities(F,C[F.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(A.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,u.icons),p})}getGlyphs(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(u.stacks),m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,u={}){this._checkLoaded(),r&&this._validate(c.u.glyphs,"glyphs",r,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,u,p={},m){this._checkLoaded();const _=[{id:r,url:u}],S=[...Oe(this.stylesheet.sprite),..._];this._validate(c.u.sprite,"sprite",S,null,p)||(this.stylesheet.sprite=S,this._loadSprite(_,!0,m))}removeSprite(r){this._checkLoaded();const u=Oe(this.stylesheet.sprite);if(u.find(p=>p.id===r)){if(this._spritesImagesIds[r])for(const p of this._spritesImagesIds[r])this.imageManager.removeImage(p),this._changedImages[p]=!0;u.splice(u.findIndex(p=>p.id===r),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${r}" doesn't exists on this map.`)))}getSprite(){return Oe(this.stylesheet.sprite)}setSprite(r,u={},p){this._checkLoaded(),r&&this._validate(c.u.sprite,"sprite",r,null,u)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,p):(this._unloadSprite(),p&&p(null)))}}var Jo=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Po={prelude:Sr(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -815,7 +815,7 @@ uniform ${F} ${B} u_${X}; #endif `}),staticAttributes:p,staticUniforms:S}}class Kh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(r,u,p,m,_,S,E,C,z){this.context=r;let F=this.boundPaintVertexBuffers.length!==m.length;for(let B=0;!F&&B({u_matrix:v,u_texture:0,u_ele_delta:r,u_fog_matrix:u,u_fog_color:p?p.properties.get("fog-color"):c.aM.white,u_fog_ground_blend:p?p.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?p.calculateFogBlendOpacity(m):0,u_horizon_color:p?p.properties.get("horizon-color"):c.aM.white,u_horizon_fog_blend:p?p.properties.get("horizon-fog-blend"):1});function Na(v){const r=[];for(let u=0;u({u_depth:new c.aH(ze,Ye.u_depth),u_terrain:new c.aH(ze,Ye.u_terrain),u_terrain_dim:new c.aI(ze,Ye.u_terrain_dim),u_terrain_matrix:new c.aJ(ze,Ye.u_terrain_matrix),u_terrain_unpack:new c.aK(ze,Ye.u_terrain_unpack),u_terrain_exaggeration:new c.aI(ze,Ye.u_terrain_exaggeration)}))(r,Pe),this.binderUniforms=p?p.getUniforms(r,Pe):[]}draw(r,u,p,m,_,S,E,C,z,F,B,X,Q,re,ce,pe,me,we){const ae=r.gl;if(this.failedToCreate)return;if(r.program.set(this.program),r.setDepthMode(p),r.setStencilMode(m),r.setColorMode(_),r.setCullFace(S),C){r.activeTexture.set(ae.TEXTURE2),ae.bindTexture(ae.TEXTURE_2D,C.depthTexture),r.activeTexture.set(ae.TEXTURE3),ae.bindTexture(ae.TEXTURE_2D,C.texture);for(const Pe in this.terrainUniforms)this.terrainUniforms[Pe].set(C[Pe])}for(const Pe in this.fixedUniforms)this.fixedUniforms[Pe].set(E[Pe]);ce&&ce.setUniforms(r,this.binderUniforms,Q,{zoom:re});let Ce=0;switch(u){case ae.LINES:Ce=2;break;case ae.TRIANGLES:Ce=3;break;case ae.LINE_STRIP:Ce=1}for(const Pe of X.get()){const ze=Pe.vaos||(Pe.vaos={});(ze[z]||(ze[z]=new Kh)).bind(r,this,F,ce?ce.getPaintVertexBuffers():[],B,Pe.vertexOffset,pe,me,we),ae.drawElements(u,Pe.primitiveLength*Ce,ae.UNSIGNED_SHORT,Pe.primitiveOffset*Ce*2)}}}function ec(v,r,u){const p=1/or(u,1,r.transform.tileZoom),m=Math.pow(2,u.tileID.overscaledZ),_=u.tileSize*Math.pow(2,r.transform.tileZoom)/m,S=_*(u.tileID.canonical.x+u.tileID.wrap*m),E=_*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[p,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[S>>16,E>>16],u_pixel_coord_lower:[65535&S,65535&E]}}const ql=(v,r,u,p)=>{const m=r.style.light,_=m.properties.get("position"),S=[_.x,_.y,_.z],E=function(){var z=new c.A(9);return c.A!=Float32Array&&(z[1]=0,z[2]=0,z[3]=0,z[5]=0,z[6]=0,z[7]=0),z[0]=1,z[4]=1,z[8]=1,z}();m.properties.get("anchor")==="viewport"&&function(z,F){var B=Math.sin(F),X=Math.cos(F);z[0]=X,z[1]=B,z[2]=0,z[3]=-B,z[4]=X,z[5]=0,z[6]=0,z[7]=0,z[8]=1}(E,-r.transform.angle),function(z,F,B){var X=F[0],Q=F[1],re=F[2];z[0]=X*B[0]+Q*B[3]+re*B[6],z[1]=X*B[1]+Q*B[4]+re*B[7],z[2]=X*B[2]+Q*B[5]+re*B[8]}(S,S,E);const C=m.properties.get("color");return{u_matrix:v,u_lightpos:S,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:p}},tc=(v,r,u,p,m,_,S)=>c.e(ql(v,r,u,p),ec(_,r,S),{u_height_factor:-Math.pow(2,m.overscaledZ)/S.tileSize/8}),$a=v=>({u_matrix:v}),Mp=(v,r,u,p)=>c.e($a(v),ec(u,r,p)),A_=(v,r)=>({u_matrix:v,u_world:r}),Ap=(v,r,u,p,m)=>c.e(Mp(v,r,u,p),{u_world:m}),D_=(v,r,u,p)=>{const m=v.transform;let _,S;if(p.paint.get("circle-pitch-alignment")==="map"){const E=or(u,1,m.zoom);_=!0,S=[E,E]}else _=!1,S=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(r.posMatrix,u,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+_,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:S}},Qo=(v,r,u)=>({u_matrix:v,u_inv_matrix:r,u_camera_to_center_distance:u.cameraToCenterDistance,u_viewport_size:[u.width,u.height]}),Yl=(v,r,u=1)=>({u_matrix:v,u_color:r,u_overlay:0,u_overlay_scale:u}),gi=v=>({u_matrix:v}),yi=(v,r,u,p)=>({u_matrix:v,u_extrude_scale:or(r,1,u),u_intensity:p}),rc=(v,r,u,p)=>{const m=c.H();c.aP(m,0,v.width,v.height,0,0,1);const _=v.context.gl;return{u_matrix:m,u_world:[_.drawingBufferWidth,_.drawingBufferHeight],u_image:u,u_color_ramp:p,u_opacity:r.paint.get("heatmap-opacity")}};function nc(v,r){const u=Math.pow(2,r.canonical.z),p=r.canonical.y;return[new c.Z(0,p/u).toLngLat().lat,new c.Z(0,(p+1)/u).toLngLat().lat]}const ic=(v,r,u,p)=>{const m=v.transform;return{u_matrix:Rp(v,r,u,p),u_ratio:1/or(r,1,m.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Dp=(v,r,u,p,m)=>c.e(ic(v,r,u,m),{u_image:0,u_image_height:p}),Ua=(v,r,u,p,m)=>{const _=v.transform,S=zp(r,_);return{u_matrix:Rp(v,r,u,m),u_texsize:r.imageAtlasTexture.size,u_ratio:1/or(r,1,_.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[S,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/_.pixelsToGLUnits[0],1/_.pixelsToGLUnits[1]]}},z_=(v,r,u,p,m,_)=>{const S=v.lineAtlas,E=zp(r,v.transform),C=u.layout.get("line-cap")==="round",z=S.getDash(p.from,C),F=S.getDash(p.to,C),B=z.width*m.fromScale,X=F.width*m.toScale;return c.e(ic(v,r,u,_),{u_patternscale_a:[E/B,-z.height/2],u_patternscale_b:[E/X,-F.height/2],u_sdfgamma:S.width/(256*Math.min(B,X)*v.pixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:F.y,u_mix:m.t})};function zp(v,r){return 1/or(v,1,r.tileZoom)}function Rp(v,r,u,p){return v.translatePosMatrix(p?p.posMatrix:r.tileID.posMatrix,r,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const R_=(v,r,u,p,m)=>{return{u_matrix:v,u_tl_parent:r,u_scale_parent:u,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(S=m.paint.get("raster-saturation"),S>0?1-1/(1.001-S):-S),u_contrast_factor:(_=m.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:L_(m.paint.get("raster-hue-rotate"))};var _,S};function L_(v){v*=Math.PI/180;const r=Math.sin(v),u=Math.cos(v);return[(2*u+1)/3,(-Math.sqrt(3)*r-u+1)/3,(Math.sqrt(3)*r-u+1)/3]}const Lp=(v,r,u,p,m,_,S,E,C,z,F,B,X,Q)=>{const re=S.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:re.cameraToCenterDistance,u_pitch:re.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:re.width/re.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:E,u_label_plane_matrix:C,u_coord_matrix:z,u_is_text:+B,u_pitch_with_map:+p,u_is_along_line:m,u_is_variable_anchor:_,u_texsize:X,u_texture:0,u_translation:F,u_pitched_scale:Q}},Xl=(v,r,u,p,m,_,S,E,C,z,F,B,X,Q,re)=>{const ce=S.transform;return c.e(Lp(v,r,u,p,m,_,S,E,C,z,F,B,X,re),{u_gamma_scale:p?Math.cos(ce._pitch)*ce.cameraToCenterDistance:1,u_device_pixel_ratio:S.pixelRatio,u_is_halo:+Q})},ed=(v,r,u,p,m,_,S,E,C,z,F,B,X,Q)=>c.e(Xl(v,r,u,p,m,_,S,E,C,z,F,!0,B,!0,Q),{u_texsize_icon:X,u_texture_icon:1}),sc=(v,r,u)=>({u_matrix:v,u_opacity:r,u_color:u}),td=(v,r,u,p,m,_)=>c.e(function(S,E,C,z){const F=C.imageManager.getPattern(S.from.toString()),B=C.imageManager.getPattern(S.to.toString()),{width:X,height:Q}=C.imageManager.getPixelSize(),re=Math.pow(2,z.tileID.overscaledZ),ce=z.tileSize*Math.pow(2,C.transform.tileZoom)/re,pe=ce*(z.tileID.canonical.x+z.tileID.wrap*re),me=ce*z.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:F.tl,u_pattern_br_a:F.br,u_pattern_tl_b:B.tl,u_pattern_br_b:B.br,u_texsize:[X,Q],u_mix:E.t,u_pattern_size_a:F.displaySize,u_pattern_size_b:B.displaySize,u_scale_a:E.fromScale,u_scale_b:E.toScale,u_tile_units_to_pixels:1/or(z,1,C.transform.tileZoom),u_pixel_coord_upper:[pe>>16,me>>16],u_pixel_coord_lower:[65535&pe,65535&me]}}(p,_,u,m),{u_matrix:v,u_opacity:r}),rd={fillExtrusion:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_lightpos:new c.aN(v,r.u_lightpos),u_lightintensity:new c.aI(v,r.u_lightintensity),u_lightcolor:new c.aN(v,r.u_lightcolor),u_vertical_gradient:new c.aI(v,r.u_vertical_gradient),u_opacity:new c.aI(v,r.u_opacity)}),fillExtrusionPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_lightpos:new c.aN(v,r.u_lightpos),u_lightintensity:new c.aI(v,r.u_lightintensity),u_lightcolor:new c.aN(v,r.u_lightcolor),u_vertical_gradient:new c.aI(v,r.u_vertical_gradient),u_height_factor:new c.aI(v,r.u_height_factor),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade),u_opacity:new c.aI(v,r.u_opacity)}),fill:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix)}),fillPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),fillOutline:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world)}),fillOutlinePattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),circle:(v,r)=>({u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_scale_with_map:new c.aH(v,r.u_scale_with_map),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_extrude_scale:new c.aO(v,r.u_extrude_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_matrix:new c.aJ(v,r.u_matrix)}),collisionBox:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_pixel_extrude_scale:new c.aO(v,r.u_pixel_extrude_scale)}),collisionCircle:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_inv_matrix:new c.aJ(v,r.u_inv_matrix),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_viewport_size:new c.aO(v,r.u_viewport_size)}),debug:(v,r)=>({u_color:new c.aL(v,r.u_color),u_matrix:new c.aJ(v,r.u_matrix),u_overlay:new c.aH(v,r.u_overlay),u_overlay_scale:new c.aI(v,r.u_overlay_scale)}),clippingMask:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix)}),heatmap:(v,r)=>({u_extrude_scale:new c.aI(v,r.u_extrude_scale),u_intensity:new c.aI(v,r.u_intensity),u_matrix:new c.aJ(v,r.u_matrix)}),heatmapTexture:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world),u_image:new c.aH(v,r.u_image),u_color_ramp:new c.aH(v,r.u_color_ramp),u_opacity:new c.aI(v,r.u_opacity)}),hillshade:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_latrange:new c.aO(v,r.u_latrange),u_light:new c.aO(v,r.u_light),u_shadow:new c.aL(v,r.u_shadow),u_highlight:new c.aL(v,r.u_highlight),u_accent:new c.aL(v,r.u_accent)}),hillshadePrepare:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_dimension:new c.aO(v,r.u_dimension),u_zoom:new c.aI(v,r.u_zoom),u_unpack:new c.aK(v,r.u_unpack)}),line:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels)}),lineGradient:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_image:new c.aH(v,r.u_image),u_image_height:new c.aI(v,r.u_image_height)}),linePattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texsize:new c.aO(v,r.u_texsize),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_image:new c.aH(v,r.u_image),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),lineSDF:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_patternscale_a:new c.aO(v,r.u_patternscale_a),u_patternscale_b:new c.aO(v,r.u_patternscale_b),u_sdfgamma:new c.aI(v,r.u_sdfgamma),u_image:new c.aH(v,r.u_image),u_tex_y_a:new c.aI(v,r.u_tex_y_a),u_tex_y_b:new c.aI(v,r.u_tex_y_b),u_mix:new c.aI(v,r.u_mix)}),raster:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_tl_parent:new c.aO(v,r.u_tl_parent),u_scale_parent:new c.aI(v,r.u_scale_parent),u_buffer_scale:new c.aI(v,r.u_buffer_scale),u_fade_t:new c.aI(v,r.u_fade_t),u_opacity:new c.aI(v,r.u_opacity),u_image0:new c.aH(v,r.u_image0),u_image1:new c.aH(v,r.u_image1),u_brightness_low:new c.aI(v,r.u_brightness_low),u_brightness_high:new c.aI(v,r.u_brightness_high),u_saturation_factor:new c.aI(v,r.u_saturation_factor),u_contrast_factor:new c.aI(v,r.u_contrast_factor),u_spin_weights:new c.aN(v,r.u_spin_weights)}),symbolIcon:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texture:new c.aH(v,r.u_texture),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),symbolSDF:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texture:new c.aH(v,r.u_texture),u_gamma_scale:new c.aI(v,r.u_gamma_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_is_halo:new c.aH(v,r.u_is_halo),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),symbolTextAndIcon:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texsize_icon:new c.aO(v,r.u_texsize_icon),u_texture:new c.aH(v,r.u_texture),u_texture_icon:new c.aH(v,r.u_texture_icon),u_gamma_scale:new c.aI(v,r.u_gamma_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_is_halo:new c.aH(v,r.u_is_halo),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),background:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_opacity:new c.aI(v,r.u_opacity),u_color:new c.aL(v,r.u_color)}),backgroundPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_opacity:new c.aI(v,r.u_opacity),u_image:new c.aH(v,r.u_image),u_pattern_tl_a:new c.aO(v,r.u_pattern_tl_a),u_pattern_br_a:new c.aO(v,r.u_pattern_br_a),u_pattern_tl_b:new c.aO(v,r.u_pattern_tl_b),u_pattern_br_b:new c.aO(v,r.u_pattern_br_b),u_texsize:new c.aO(v,r.u_texsize),u_mix:new c.aI(v,r.u_mix),u_pattern_size_a:new c.aO(v,r.u_pattern_size_a),u_pattern_size_b:new c.aO(v,r.u_pattern_size_b),u_scale_a:new c.aI(v,r.u_scale_a),u_scale_b:new c.aI(v,r.u_scale_b),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aI(v,r.u_tile_units_to_pixels)}),terrain:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texture:new c.aH(v,r.u_texture),u_ele_delta:new c.aI(v,r.u_ele_delta),u_fog_matrix:new c.aJ(v,r.u_fog_matrix),u_fog_color:new c.aL(v,r.u_fog_color),u_fog_ground_blend:new c.aI(v,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aI(v,r.u_fog_ground_blend_opacity),u_horizon_color:new c.aL(v,r.u_horizon_color),u_horizon_fog_blend:new c.aI(v,r.u_horizon_fog_blend)}),terrainDepth:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ele_delta:new c.aI(v,r.u_ele_delta)}),terrainCoords:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texture:new c.aH(v,r.u_texture),u_terrain_coords_id:new c.aI(v,r.u_terrain_coords_id),u_ele_delta:new c.aI(v,r.u_ele_delta)}),sky:(v,r)=>({u_sky_color:new c.aL(v,r.u_sky_color),u_horizon_color:new c.aL(v,r.u_horizon_color),u_horizon:new c.aI(v,r.u_horizon),u_sky_horizon_blend:new c.aI(v,r.u_sky_horizon_blend)})};class js{constructor(r,u,p){this.context=r;const m=r.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const O_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class nd{constructor(r,u,p,m){this.length=u.length,this.attributes=p,this.itemSize=u.bytesPerElement,this.dynamicDraw=m,this.context=r;const _=r.gl;this.buffer=_.createBuffer(),r.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){if(r.length!==this.length)throw new Error(`Length of new data is ${r.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,u){for(let p=0;p0){const ze=c.H();c.aQ(ze,ae.placementInvProjMatrix,v.transform.glCoordMatrix),c.aQ(ze,ze,ae.placementViewportMatrix),C.push({circleArray:Pe,circleOffset:F,transform:we.posMatrix,invTransform:ze,coord:we}),z+=Pe.length/4,F=z}Ce&&E.draw(_,S.LINES,ir.disabled,Nr.disabled,v.colorModeForRenderPass(),Rr.disabled,{u_matrix:we.posMatrix,u_pixel_extrude_scale:[1/(B=v.transform).width,1/B.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(we),u.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,null,v.transform.zoom,null,null,Ce.collisionVertexBuffer)}var B;if(!m||!C.length)return;const X=v.useProgram("collisionCircle"),Q=new c.aR;Q.resize(4*z),Q._trim();let re=0;for(const me of C)for(let we=0;we=0&&(me[ae.associatedIconIndex]={shiftedAnchor:Gt,angle:Hr})}else Ot(ae.numGlyphs,ce)}if(z){pe.clear();const we=v.icon.placedSymbolArray;for(let ae=0;aev.style.map.terrain.getElevation(dt,al,ll):null,ua=u.layout.get("text-rotation-alignment")==="map";ee(Pt,dt.posMatrix,v,m,sl,ol,me,z,ua,ce,dt.toUnwrapped(),re.width,re.height,es,cr)}const ts=dt.posMatrix,rs=m&&st||Fd,Ao=we||rs?Ql:sl,ws=Pc,Nn=_t&&u.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let qn;qn=_t?Pt.iconsInText?ed(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,Gn,ii,wt):Xl(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,m,Gn,!0,wt):Lp(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,m,Gn,wt);const Li={program:tr,buffers:qt,uniformValues:qn,atlasTexture:xs,atlasTextureIcon:Zn,atlasInterpolation:Gr,atlasInterpolationIcon:_i,isSDF:_t,hasHalo:Nn};if(Pe&&Pt.canOverlap){ze=!0;const cr=qt.segments.get();for(const ua of cr)gt.push({segments:new c.a0([ua]),sortKey:ua.sortKey,state:Li,terrainData:Wr})}else gt.push({segments:qt.segments,sortKey:0,state:Li,terrainData:Wr})}ze&>.sort((dt,ct)=>dt.sortKey-ct.sortKey);for(const dt of gt){const ct=dt.state;if(X.activeTexture.set(Q.TEXTURE0),ct.atlasTexture.bind(ct.atlasInterpolation,Q.CLAMP_TO_EDGE),ct.atlasTextureIcon&&(X.activeTexture.set(Q.TEXTURE1),ct.atlasTextureIcon&&ct.atlasTextureIcon.bind(ct.atlasInterpolationIcon,Q.CLAMP_TO_EDGE)),ct.isSDF){const Pt=ct.uniformValues;ct.hasHalo&&(Pt.u_is_halo=1,fd(ct.buffers,dt.segments,u,v,ct.program,Ye,F,B,Pt,dt.terrainData)),Pt.u_is_halo=0}fd(ct.buffers,dt.segments,u,v,ct.program,Ye,F,B,ct.uniformValues,dt.terrainData)}}function fd(v,r,u,p,m,_,S,E,C,z){const F=p.context;m.draw(F,F.gl.TRIANGLES,_,S,E,Rr.disabled,C,z,u.id,v.layoutVertexBuffer,v.indexBuffer,r,u.paint,p.transform.zoom,v.programConfigurations.get(u.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function pd(v,r,u,p){const m=v.context,_=m.gl,S=Nr.disabled,E=new fn([_.ONE,_.ONE],c.aM.transparent,[!0,!0,!0,!0]),C=r.getBucket(u);if(!C)return;const z=p.key;let F=u.heatmapFbos.get(z);F||(F=eu(m,r.tileSize,r.tileSize),u.heatmapFbos.set(z,F)),m.bindFramebuffer.set(F.framebuffer),m.viewport.set([0,0,r.tileSize,r.tileSize]),m.clear({color:c.aM.transparent});const B=C.programConfigurations.get(u.id),X=v.useProgram("heatmap",B),Q=v.style.map.terrain.getTerrainData(p);X.draw(m,_.TRIANGLES,ir.disabled,S,E,Rr.disabled,yi(p.posMatrix,r,v.transform.zoom,u.paint.get("heatmap-intensity")),Q,u.id,C.layoutVertexBuffer,C.indexBuffer,C.segments,u.paint,v.transform.zoom,B)}function sa(v,r,u){const p=v.context,m=p.gl;p.setColorMode(v.colorModeForRenderPass());const _=tu(p,r),S=u.key,E=r.heatmapFbos.get(S);E&&(p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,E.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),_.bind(m.LINEAR,m.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(p,m.TRIANGLES,ir.disabled,Nr.disabled,v.colorModeForRenderPass(),Rr.disabled,rc(v,r,0,1),null,r.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,r.paint,v.transform.zoom),E.destroy(),r.heatmapFbos.delete(S))}function eu(v,r,u){var p,m;const _=v.gl,S=_.createTexture();_.bindTexture(_.TEXTURE_2D,S),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR);const E=(p=v.HALF_FLOAT)!==null&&p!==void 0?p:_.UNSIGNED_BYTE,C=(m=v.RGBA16F)!==null&&m!==void 0?m:_.RGBA;_.texImage2D(_.TEXTURE_2D,0,C,r,u,0,_.RGBA,E,null);const z=v.createFramebuffer(r,u,!1,!1);return z.colorAttachment.set(S),z}function tu(v,r){return r.colorRampTexture||(r.colorRampTexture=new it(v,r.colorRamp,v.gl.RGBA)),r.colorRampTexture}function Ha(v,r,u,p,m){if(!u||!p||!p.imageAtlas)return;const _=p.imageAtlas.patternPositions;let S=_[u.to.toString()],E=_[u.from.toString()];if(!S&&E&&(S=E),!E&&S&&(E=S),!S||!E){const C=m.getPaintProperty(r);S=_[C],E=_[C]}S&&E&&v.setConstantPatternPositions(S,E)}function ru(v,r,u,p,m,_,S){const E=v.context.gl,C="fill-pattern",z=u.paint.get(C),F=z&&z.constantOr(1),B=u.getCrossfadeParameters();let X,Q,re,ce,pe;S?(Q=F&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",X=E.LINES):(Q=F?"fillPattern":"fill",X=E.TRIANGLES);const me=z.constantOr(null);for(const we of p){const ae=r.getTile(we);if(F&&!ae.patternsLoaded())continue;const Ce=ae.getBucket(u);if(!Ce)continue;const Pe=Ce.programConfigurations.get(u.id),ze=v.useProgram(Q,Pe),Ye=v.style.map.terrain&&v.style.map.terrain.getTerrainData(we);F&&(v.context.activeTexture.set(E.TEXTURE0),ae.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),Pe.updatePaintBuffers(B)),Ha(Pe,C,me,ae,u);const st=Ye?we:null,gt=v.translatePosMatrix(st?st.posMatrix:we.posMatrix,ae,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(S){ce=Ce.indexBuffer2,pe=Ce.segments2;const wt=[E.drawingBufferWidth,E.drawingBufferHeight];re=Q==="fillOutlinePattern"&&F?Ap(gt,v,B,ae,wt):A_(gt,wt)}else ce=Ce.indexBuffer,pe=Ce.segments,re=F?Mp(gt,v,B,ae):$a(gt);ze.draw(v.context,X,m,v.stencilModeForClipping(we),_,Rr.disabled,re,Ye,u.id,Ce.layoutVertexBuffer,ce,pe,u.paint,v.transform.zoom,Pe)}}function hc(v,r,u,p,m,_,S){const E=v.context,C=E.gl,z="fill-extrusion-pattern",F=u.paint.get(z),B=F.constantOr(1),X=u.getCrossfadeParameters(),Q=u.paint.get("fill-extrusion-opacity"),re=F.constantOr(null);for(const ce of p){const pe=r.getTile(ce),me=pe.getBucket(u);if(!me)continue;const we=v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce),ae=me.programConfigurations.get(u.id),Ce=v.useProgram(B?"fillExtrusionPattern":"fillExtrusion",ae);B&&(v.context.activeTexture.set(C.TEXTURE0),pe.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ae.updatePaintBuffers(X)),Ha(ae,z,re,pe,u);const Pe=v.translatePosMatrix(ce.posMatrix,pe,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),ze=u.paint.get("fill-extrusion-vertical-gradient"),Ye=B?tc(Pe,v,ze,Q,ce,X,pe):ql(Pe,v,ze,Q);Ce.draw(E,E.gl.TRIANGLES,m,_,S,Rr.backCCW,Ye,we,u.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,u.paint,v.transform.zoom,ae,v.style.map.terrain&&me.centroidVertexBuffer)}}function Wa(v,r,u,p,m,_,S){const E=v.context,C=E.gl,z=u.fbo;if(!z)return;const F=v.useProgram("hillshade"),B=v.style.map.terrain&&v.style.map.terrain.getTerrainData(r);E.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,z.colorAttachment.get()),F.draw(E,C.TRIANGLES,m,_,S,Rr.disabled,((X,Q,re,ce)=>{const pe=re.paint.get("hillshade-shadow-color"),me=re.paint.get("hillshade-highlight-color"),we=re.paint.get("hillshade-accent-color");let ae=re.paint.get("hillshade-illumination-direction")*(Math.PI/180);re.paint.get("hillshade-illumination-anchor")==="viewport"&&(ae-=X.transform.angle);const Ce=!X.options.moving;return{u_matrix:ce?ce.posMatrix:X.transform.calculatePosMatrix(Q.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:nc(0,Q.tileID),u_light:[re.paint.get("hillshade-exaggeration"),ae],u_shadow:pe,u_highlight:me,u_accent:we}})(v,u,p,B?r:null),B,p.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Ga(v,r,u,p,m,_){const S=v.context,E=S.gl,C=r.dem;if(C&&C.data){const z=C.dim,F=C.stride,B=C.getPixels();if(S.activeTexture.set(E.TEXTURE1),S.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||v.getTileTexture(F),r.demTexture){const Q=r.demTexture;Q.update(B,{premultiply:!1}),Q.bind(E.NEAREST,E.CLAMP_TO_EDGE)}else r.demTexture=new it(S,B,E.RGBA,{premultiply:!1}),r.demTexture.bind(E.NEAREST,E.CLAMP_TO_EDGE);S.activeTexture.set(E.TEXTURE0);let X=r.fbo;if(!X){const Q=new it(S,{width:z,height:z,data:null},E.RGBA);Q.bind(E.LINEAR,E.CLAMP_TO_EDGE),X=r.fbo=S.createFramebuffer(z,z,!0,!1),X.colorAttachment.set(Q.texture)}S.bindFramebuffer.set(X.framebuffer),S.viewport.set([0,0,z,z]),v.useProgram("hillshadePrepare").draw(S,E.TRIANGLES,p,m,_,Rr.disabled,((Q,re)=>{const ce=re.stride,pe=c.H();return c.aP(pe,0,c.X,-c.X,0,0,1),c.J(pe,pe,[0,-c.X,0]),{u_matrix:pe,u_image:1,u_dimension:[ce,ce],u_zoom:Q.overscaledZ,u_unpack:re.getUnpackVector()}})(r.tileID,C),null,u.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function qp(v,r,u,p,m,_){const S=p.paint.get("raster-fade-duration");if(!_&&S>0){const E=A.now(),C=(E-v.timeAdded)/S,z=r?(E-r.timeAdded)/S:-1,F=u.getSource(),B=m.coveringZoomLevel({tileSize:F.tileSize,roundZoom:F.roundZoom}),X=!r||Math.abs(r.tileID.overscaledZ-B)>Math.abs(v.tileID.overscaledZ-B),Q=X&&v.refreshedUponExpiration?1:c.ac(X?C:1-z,0,1);return v.refreshedUponExpiration&&C>=1&&(v.refreshedUponExpiration=!1),r?{opacity:1,mix:1-Q}:{opacity:Q,mix:0}}return{opacity:1,mix:0}}const md=new c.aM(1,0,0,1),vr=new c.aM(0,1,0,1),dc=new c.aM(0,0,1,1),G_=new c.aM(1,0,1,1),Yp=new c.aM(0,1,1,1);function Za(v,r,u,p){fc(v,0,r+u/2,v.transform.width,u,p)}function Xp(v,r,u,p){fc(v,r-u/2,0,u,v.transform.height,p)}function fc(v,r,u,p,m,_){const S=v.context,E=S.gl;E.enable(E.SCISSOR_TEST),E.scissor(r*v.pixelRatio,u*v.pixelRatio,p*v.pixelRatio,m*v.pixelRatio),S.clear({color:_}),E.disable(E.SCISSOR_TEST)}function Kp(v,r,u){const p=v.context,m=p.gl,_=u.posMatrix,S=v.useProgram("debug"),E=ir.disabled,C=Nr.disabled,z=v.colorModeForRenderPass(),F="$debug",B=v.style.map.terrain&&v.style.map.terrain.getTerrainData(u);p.activeTexture.set(m.TEXTURE0);const X=r.getTileByID(u.key).latestRawTileData,Q=Math.floor((X&&X.byteLength||0)/1024),re=r.getTile(u).tileSize,ce=512/Math.min(re,512)*(u.overscaledZ/v.transform.zoom)*.5;let pe=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(pe+=` => ${u.overscaledZ}`),function(me,we){me.initDebugOverlayCanvas();const ae=me.debugOverlayCanvas,Ce=me.context.gl,Pe=me.debugOverlayCanvas.getContext("2d");Pe.clearRect(0,0,ae.width,ae.height),Pe.shadowColor="white",Pe.shadowBlur=2,Pe.lineWidth=1.5,Pe.strokeStyle="white",Pe.textBaseline="top",Pe.font="bold 36px Open Sans, sans-serif",Pe.fillText(we,5,5),Pe.strokeText(we,5,5),me.debugOverlayTexture.update(ae),me.debugOverlayTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE)}(v,`${pe} ${Q}kB`),S.draw(p,m.TRIANGLES,E,C,fn.alphaBlended,Rr.disabled,Yl(_,c.aM.transparent,ce),null,F,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),S.draw(p,m.LINE_STRIP,E,C,z,Rr.disabled,Yl(_,c.aM.red),B,F,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function Jp(v,r,u){const p=v.context,m=p.gl,_=v.colorModeForRenderPass(),S=new ir(m.LEQUAL,ir.ReadWrite,v.depthRangeFor3D),E=v.useProgram("terrain"),C=r.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,v.width,v.height]);for(const z of u){const F=v.renderToTexture.getTexture(z),B=r.getTerrainData(z.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,F.texture);const X=v.transform.calculatePosMatrix(z.tileID.toUnwrapped()),Q=r.getMeshFrameDelta(v.transform.zoom),re=v.transform.calculateFogMatrix(z.tileID.toUnwrapped()),ce=Jh(X,Q,re,v.style.sky,v.transform.pitch);E.draw(p,m.TRIANGLES,S,Nr.disabled,_,Rr.backCCW,ce,B,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class pc{constructor(r,u,p){this.vertexBuffer=r,this.indexBuffer=u,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class mc{constructor(r,u){this.context=new W_(r),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ut.maxUnderzooming+Ut.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xh}resize(r,u,p){if(this.width=Math.floor(r*p),this.height=Math.floor(u*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const r=this.context,u=new c.aX;u.emplaceBack(0,0),u.emplaceBack(c.X,0),u.emplaceBack(0,c.X),u.emplaceBack(c.X,c.X),this.tileExtentBuffer=r.createVertexBuffer(u,Jo.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const p=new c.aX;p.emplaceBack(0,0),p.emplaceBack(c.X,0),p.emplaceBack(0,c.X),p.emplaceBack(c.X,c.X),this.debugBuffer=r.createVertexBuffer(p,Jo.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const m=new c.$;m.emplaceBack(0,0,0,0),m.emplaceBack(c.X,0,c.X,0),m.emplaceBack(0,c.X,0,c.X),m.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=r.createVertexBuffer(m,Ne.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const _=new c.aX;_.emplaceBack(0,0),_.emplaceBack(1,0),_.emplaceBack(0,1),_.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(_,Jo.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const S=new c.aZ;S.emplaceBack(0),S.emplaceBack(1),S.emplaceBack(3),S.emplaceBack(2),S.emplaceBack(0),this.tileBorderIndexBuffer=r.createIndexBuffer(S);const E=new c.aY;E.emplaceBack(0,1,2),E.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(E);const C=this.context.gl;this.stencilClearMode=new Nr({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const r=this.context,u=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=c.H();c.aP(p,0,this.width,this.height,0,0,1),c.K(p,p,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(r,u.TRIANGLES,ir.disabled,this.stencilClearMode,fn.disabled,Rr.disabled,gi(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(r,u){if(this.currentStencilSource===r.source||!r.isTileClipped()||!u||!u.length)return;this.currentStencilSource=r.source;const p=this.context,m=p.gl;this.nextStencilID+u.length>256&&this.clearStencil(),p.setColorMode(fn.disabled),p.setDepthMode(ir.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const S of u){const E=this._tileClippingMaskIDs[S.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(S);_.draw(p,m.TRIANGLES,ir.disabled,new Nr({func:m.ALWAYS,mask:0},E,255,m.KEEP,m.KEEP,m.REPLACE),fn.disabled,Rr.disabled,gi(S.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,u=this.context.gl;return new Nr({func:u.NOTEQUAL,mask:255},r,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(r){const u=this.context.gl;return new Nr({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(r){const u=this.context.gl,p=r.sort((S,E)=>E.overscaledZ-S.overscaledZ),m=p[p.length-1].overscaledZ,_=p[0].overscaledZ-m+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const S={};for(let E=0;E<_;E++)S[E+m]=new Nr({func:u.GEQUAL,mask:255},E+this.nextStencilID,255,u.KEEP,u.KEEP,u.REPLACE);return this.nextStencilID+=_,[S,p]}return[{[m]:Nr.disabled},p]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new fn([r.CONSTANT_COLOR,r.ONE],new c.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?fn.unblended:fn.alphaBlended}depthModeForSublayer(r,u,p){if(!this.opaquePassEnabledForLayer())return ir.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new ir(p||this.context.gl.LEQUAL,u,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer({u_sky_color:me.properties.get("sky-color"),u_horizon_color:me.properties.get("horizon-color"),u_horizon:(we.height/2+we.getHorizon())*ae,u_sky_horizon_blend:me.properties.get("sky-horizon-blend")*we.height/2*ae}))(z,C.style.map.transform,C.pixelRatio),Q=new ir(B.LEQUAL,ir.ReadWrite,[0,1]),re=Nr.disabled,ce=C.colorModeForRenderPass(),pe=C.useProgram("sky");if(!z.mesh){const me=new c.aX;me.emplaceBack(-1,-1),me.emplaceBack(1,-1),me.emplaceBack(1,1),me.emplaceBack(-1,1);const we=new c.aY;we.emplaceBack(0,1,2),we.emplaceBack(0,2,3),z.mesh=new pc(F.createVertexBuffer(me,Jo.members),F.createIndexBuffer(we),c.a0.simpleSegment(0,0,me.length,we.length))}pe.draw(F,B.TRIANGLES,Q,re,ce,Rr.disabled,X,void 0,"sky",z.mesh.vertexBuffer,z.mesh.indexBuffer,z.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=u.showOverdrawInspector,this.depthRangeFor3D=[0,1-(r._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const C=this.style._layers[p[this.currentLayer]],z=m[C.source],F=_[C.source];this._renderTileClippingMasks(C,F),this.renderLayer(this,z,C,F)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerpe.source&&!pe.isHidden(F)?[z.sourceCaches[pe.source]]:[]),Q=X.filter(pe=>pe.getSource().type==="vector"),re=X.filter(pe=>pe.getSource().type!=="vector"),ce=pe=>{(!B||B.getSource().maxzoomce(pe)),B||re.forEach(pe=>ce(pe)),B}(this.style,this.transform.zoom);C&&function(z,F,B){for(let X=0;X0),m&&(c.b0(u,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,S){const E=_.context,C=E.gl,z=fn.unblended,F=new ir(C.LEQUAL,ir.ReadWrite,[0,1]),B=S.getTerrainMesh(),X=S.sourceCache.getRenderableTiles(),Q=_.useProgram("terrainDepth");E.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),E.clear({color:c.aM.transparent,depth:1});for(const re of X){const ce=S.getTerrainData(re.tileID),pe={u_matrix:_.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};Q.draw(E,C.TRIANGLES,F,Nr.disabled,z,Rr.backCCW,pe,ce,"terrain",B.vertexBuffer,B.indexBuffer,B.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,S){const E=_.context,C=E.gl,z=fn.unblended,F=new ir(C.LEQUAL,ir.ReadWrite,[0,1]),B=S.getTerrainMesh(),X=S.getCoordsTexture(),Q=S.sourceCache.getRenderableTiles(),re=_.useProgram("terrainCoords");E.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),E.clear({color:c.aM.transparent,depth:1}),S.coordsIndex=[];for(const ce of Q){const pe=S.getTerrainData(ce.tileID);E.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,X.texture);const me={u_matrix:_.transform.calculatePosMatrix(ce.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};re.draw(E,C.TRIANGLES,F,Nr.disabled,z,Rr.backCCW,me,pe,"terrain",B.vertexBuffer,B.indexBuffer,B.segments),S.coordsIndex.push(ce.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(r,u,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(_,S,E,C,z){if(_.renderPass!=="translucent")return;const F=Nr.disabled,B=_.colorModeForRenderPass();(E._unevaluatedLayout.hasValue("text-variable-anchor")||E._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(X,Q,re,ce,pe,me,we,ae,Ce){const Pe=Q.transform,ze=Ko(),Ye=pe==="map",st=me==="map";for(const gt of X){const wt=ce.getTile(gt),dt=wt.getBucket(re);if(!dt||!dt.text||!dt.text.segments.get().length)continue;const ct=c.ag(dt.textSizeData,Pe.zoom),Pt=or(wt,1,Q.transform.zoom),qt=ps(gt.posMatrix,st,Ye,Q.transform,Pt),ft=re.layout.get("icon-text-fit")!=="none"&&dt.hasIconData();if(ct){const _t=Math.pow(2,Pe.zoom-wt.tileID.overscaledZ),Gt=Q.style.map.terrain?(tr,ar)=>Q.style.map.terrain.getElevation(gt,tr,ar):null,Hr=ze.translatePosition(Pe,wt,we,ae);Va(dt,Ye,st,Ce,Pe,qt,gt.posMatrix,_t,ct,ft,ze,Hr,gt.toUnwrapped(),Gt)}}}(C,_,E,S,E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),z),E.paint.get("icon-opacity").constantOr(1)!==0&&dd(_,S,E,C,!1,E.paint.get("icon-translate"),E.paint.get("icon-translate-anchor"),E.layout.get("icon-rotation-alignment"),E.layout.get("icon-pitch-alignment"),E.layout.get("icon-keep-upright"),F,B),E.paint.get("text-opacity").constantOr(1)!==0&&dd(_,S,E,C,!0,E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.layout.get("text-keep-upright"),F,B),S.map.showCollisionBoxes&&(Jl(_,S,E,C,!0),Jl(_,S,E,C,!1))})(r,u,p,m,this.style.placement.variableOffsets);break;case"circle":(function(_,S,E,C){if(_.renderPass!=="translucent")return;const z=E.paint.get("circle-opacity"),F=E.paint.get("circle-stroke-width"),B=E.paint.get("circle-stroke-opacity"),X=!E.layout.get("circle-sort-key").isConstant();if(z.constantOr(1)===0&&(F.constantOr(1)===0||B.constantOr(1)===0))return;const Q=_.context,re=Q.gl,ce=_.depthModeForSublayer(0,ir.ReadOnly),pe=Nr.disabled,me=_.colorModeForRenderPass(),we=[];for(let ae=0;aeae.sortKey-Ce.sortKey);for(const ae of we){const{programConfiguration:Ce,program:Pe,layoutVertexBuffer:ze,indexBuffer:Ye,uniformValues:st,terrainData:gt}=ae.state;Pe.draw(Q,re.TRIANGLES,ce,pe,me,Rr.disabled,st,gt,E.id,ze,Ye,ae.segments,E.paint,_.transform.zoom,Ce)}})(r,u,p,m);break;case"heatmap":(function(_,S,E,C){if(E.paint.get("heatmap-opacity")===0)return;const z=_.context;if(_.style.map.terrain){for(const F of C){const B=S.getTile(F);S.hasRenderableParent(F)||(_.renderPass==="offscreen"?pd(_,B,E,F):_.renderPass==="translucent"&&sa(_,E,F))}z.viewport.set([0,0,_.width,_.height])}else _.renderPass==="offscreen"?function(F,B,X,Q){const re=F.context,ce=re.gl,pe=Nr.disabled,me=new fn([ce.ONE,ce.ONE],c.aM.transparent,[!0,!0,!0,!0]);(function(we,ae,Ce){const Pe=we.gl;we.activeTexture.set(Pe.TEXTURE1),we.viewport.set([0,0,ae.width/4,ae.height/4]);let ze=Ce.heatmapFbos.get(c.aU);ze?(Pe.bindTexture(Pe.TEXTURE_2D,ze.colorAttachment.get()),we.bindFramebuffer.set(ze.framebuffer)):(ze=eu(we,ae.width/4,ae.height/4),Ce.heatmapFbos.set(c.aU,ze))})(re,F,X),re.clear({color:c.aM.transparent});for(let we=0;we20&&F.texParameterf(F.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax);const dt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(we),ct=dt?we:null,Pt=ct?ct.posMatrix:_.transform.calculatePosMatrix(we.toUnwrapped(),me),qt=R_(Pt,gt||[0,0],st||1,Ye,E);B instanceof ot?X.draw(z,F.TRIANGLES,ae,Nr.disabled,Q,Rr.disabled,qt,dt,E.id,B.boundsBuffer,_.quadTriangleIndexBuffer,B.boundsSegments):X.draw(z,F.TRIANGLES,ae,re[we.overscaledZ],Q,Rr.disabled,qt,dt,E.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(r,u,p,m);break;case"background":(function(_,S,E,C){const z=E.paint.get("background-color"),F=E.paint.get("background-opacity");if(F===0)return;const B=_.context,X=B.gl,Q=_.transform,re=Q.tileSize,ce=E.paint.get("background-pattern");if(_.isPatternMissing(ce))return;const pe=!ce&&z.a===1&&F===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==pe)return;const me=Nr.disabled,we=_.depthModeForSublayer(0,pe==="opaque"?ir.ReadWrite:ir.ReadOnly),ae=_.colorModeForRenderPass(),Ce=_.useProgram(ce?"backgroundPattern":"background"),Pe=C||Q.coveringTiles({tileSize:re,terrain:_.style.map.terrain});ce&&(B.activeTexture.set(X.TEXTURE0),_.imageManager.bind(_.context));const ze=E.getCrossfadeParameters();for(const Ye of Pe){const st=C?Ye.posMatrix:_.transform.calculatePosMatrix(Ye.toUnwrapped()),gt=ce?td(st,F,_,ce,{tileID:Ye,tileSize:re},ze):sc(st,F,z),wt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Ye);Ce.draw(B,X.TRIANGLES,we,me,ae,Rr.disabled,gt,wt,E.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(r,0,p,m);break;case"custom":(function(_,S,E){const C=_.context,z=E.implementation;if(_.renderPass==="offscreen"){const F=z.prerender;F&&(_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),F.call(z,C.gl,_.transform.customLayerMatrix()),C.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),C.setStencilMode(Nr.disabled);const F=z.renderingMode==="3d"?new ir(_.context.gl.LEQUAL,ir.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,ir.ReadOnly);C.setDepthMode(F),z.render(C.gl,_.transform.customLayerMatrix(),{farZ:_.transform.farZ,nearZ:_.transform.nearZ,fov:_.transform._fov,modelViewProjectionMatrix:_.transform.modelViewProjectionMatrix,projectionMatrix:_.transform.projectionMatrix}),C.setDirty(),_.setBaseState(),C.bindFramebuffer.set(null)}})(r,0,p)}}translatePosMatrix(r,u,p,m,_){if(!p[0]&&!p[1])return r;const S=_?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(S){const z=Math.sin(S),F=Math.cos(S);p=[p[0]*F-p[1]*z,p[0]*z+p[1]*F]}const E=[_?p[0]:or(u,p[0],this.transform.zoom),_?p[1]:or(u,p[1],this.transform.zoom),0],C=new Float32Array(16);return c.J(C,r,E),C}saveTileTexture(r){const u=this._tileTextures[r.size[0]];u?u.push(r):this._tileTextures[r.size[0]]=[r]}getTileTexture(r){const u=this._tileTextures[r];return u&&u.length>0?u.pop():null}isPatternMissing(r){if(!r)return!1;if(!r.from||!r.to)return!0;const u=this.imageManager.getPattern(r.from.toString()),p=this.imageManager.getPattern(r.to.toString());return!u||!p}useProgram(r,u){this.cache=this.cache||{};const p=r+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Qh(this.context,Po[r],u,rd[r],this._showOverdrawInspector,this.style.map.terrain)),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(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new it(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:r,drawingBufferHeight:u}=this.context.gl;return this.width!==r||this.height!==u}}class qa{constructor(r,u){this.points=r,this.planes=u}static fromInvProjectionMatrix(r,u,p){const m=Math.pow(2,p),_=[[-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(E=>{const C=1/(E=c.af([],E,r))[3]/u*m;return c.b1(E,E,[C,C,1/E[3],C])}),S=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const C=function(X,Q){var re=Q[0],ce=Q[1],pe=Q[2],me=re*re+ce*ce+pe*pe;return me>0&&(me=1/Math.sqrt(me)),X[0]=Q[0]*me,X[1]=Q[1]*me,X[2]=Q[2]*me,X}([],function(X,Q,re){var ce=Q[0],pe=Q[1],me=Q[2],we=re[0],ae=re[1],Ce=re[2];return X[0]=pe*Ce-me*ae,X[1]=me*we-ce*Ce,X[2]=ce*ae-pe*we,X}([],ge([],_[E[0]],_[E[1]]),ge([],_[E[2]],_[E[1]]))),z=-((F=C)[0]*(B=_[E[1]])[0]+F[1]*B[1]+F[2]*B[2]);var F,B;return C.concat(z)});return new qa(_,S)}}class Ya{constructor(r,u){this.min=r,this.max=u,this.center=function(p,m,_){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,_){return p[0]=m[0]+_[0],p[1]=m[1]+_[1],p[2]=m[2]+_[2],p}([],this.min,this.max))}quadrant(r){const u=[r%2==0,r<2],p=oe(this.min),m=oe(this.max);for(let _=0;_=0&&S++;if(S===0)return 0;S!==u.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let _=Number.MAX_VALUE,S=-Number.MAX_VALUE;for(let E=0;Ethis.max[m]-this.min[m])return 0}return 1}}class Xa{constructor(r=0,u=0,p=0,m=0){if(isNaN(r)||r<0||isNaN(u)||u<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=u,this.left=p,this.right=m}interpolate(r,u,p){return u.top!=null&&r.top!=null&&(this.top=c.y.number(r.top,u.top,p)),u.bottom!=null&&r.bottom!=null&&(this.bottom=c.y.number(r.bottom,u.bottom,p)),u.left!=null&&r.left!=null&&(this.left=c.y.number(r.left,u.left,p)),u.right!=null&&r.right!=null&&(this.right=c.y.number(r.right,u.right,p)),this}getCenter(r,u){const p=c.ac((this.left+r-this.right)/2,0,r),m=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(p,m)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Xa(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const gd=85.051129;class Ka{constructor(r,u,p,m,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=r||0,this._maxZoom=u||22,this._minPitch=p??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Xa,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const r=new Ka(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return r.apply(this),r}apply(r){this.tileSize=r.tileSize,this.latRange=r.latRange,this.lngRange=r.lngRange,this.width=r.width,this.height=r.height,this._center=r._center,this._elevation=r._elevation,this.minElevationForCurrentTile=r.minElevationForCurrentTile,this.zoom=r.zoom,this.angle=r.angle,this._fov=r._fov,this._pitch=r._pitch,this._unmodified=r._unmodified,this._edgeInsets=r._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(r){const u=-c.b3(r,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var p=new c.A(4);return c.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,m,_){var S=m[0],E=m[1],C=m[2],z=m[3],F=Math.sin(_),B=Math.cos(_);p[0]=S*B+C*F,p[1]=E*B+z*F,p[2]=S*-F+C*B,p[3]=E*-F+z*B}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const u=c.ac(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=r/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(r){const u=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(r){r!==this._elevation&&(this._elevation=r,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,u,p){this._unmodified=!1,this._edgeInsets.interpolate(r,u,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const u=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(r){const u=[new c.b4(0,r)];if(this._renderWorldCopies){const p=this.pointCoordinate(new c.P(0,0)),m=this.pointCoordinate(new c.P(this.width,0)),_=this.pointCoordinate(new c.P(this.width,this.height)),S=this.pointCoordinate(new c.P(0,this.height)),E=Math.floor(Math.min(p.x,m.x,_.x,S.x)),C=Math.floor(Math.max(p.x,m.x,_.x,S.x)),z=1;for(let F=E-z;F<=C+z;F++)F!==0&&u.push(new c.b4(F,r))}return u}coveringTiles(r){var u,p;let m=this.coveringZoomLevel(r);const _=m;if(r.minzoom!==void 0&&mr.maxzoom&&(m=r.maxzoom);const S=this.pointCoordinate(this.getCameraPoint()),E=c.Z.fromLngLat(this.center),C=Math.pow(2,m),z=[C*S.x,C*S.y,0],F=[C*E.x,C*E.y,0],B=qa.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let X=r.minzoom||0;!r.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(X=m);const Q=r.terrain?2/Math.min(this.tileSize,r.tileSize)*this.tileSize:3,re=ae=>({aabb:new Ya([ae*C,0,0],[(ae+1)*C,C,0]),zoom:0,x:0,y:0,wrap:ae,fullyVisible:!1}),ce=[],pe=[],me=m,we=r.reparseOverscaled?_:m;if(this._renderWorldCopies)for(let ae=1;ae<=3;ae++)ce.push(re(-ae)),ce.push(re(ae));for(ce.push(re(0));ce.length>0;){const ae=ce.pop(),Ce=ae.x,Pe=ae.y;let ze=ae.fullyVisible;if(!ze){const dt=ae.aabb.intersects(B);if(dt===0)continue;ze=dt===2}const Ye=r.terrain?z:F,st=ae.aabb.distanceX(Ye),gt=ae.aabb.distanceY(Ye),wt=Math.max(Math.abs(st),Math.abs(gt));if(ae.zoom===me||wt>Q+(1<=X){const dt=me-ae.zoom,ct=z[0]-.5-(Ce<>1),qt=ae.zoom+1;let ft=ae.aabb.quadrant(dt);if(r.terrain){const _t=new c.S(qt,ae.wrap,qt,ct,Pt),Gt=r.terrain.getMinMaxElevation(_t),Hr=(u=Gt.minElevation)!==null&&u!==void 0?u:this.elevation,tr=(p=Gt.maxElevation)!==null&&p!==void 0?p:this.elevation;ft=new Ya([ft.min[0],ft.min[1],Hr],[ft.max[0],ft.max[1],tr])}ce.push({aabb:ft,zoom:qt,x:ct,y:Pt,wrap:ae.wrap,fullyVisible:ze})}}return pe.sort((ae,Ce)=>ae.distanceSq-Ce.distanceSq).map(ae=>ae.tileID)}resize(r,u){this.width=r,this.height=u,this.pixelsToGLUnits=[2/r,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const u=c.ac(r.lat,-85.051129,gd);return new c.P(c.O(r.lng)*this.worldSize,c.Q(u)*this.worldSize)}unproject(r){return new c.Z(r.x/this.worldSize,r.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(r){const u=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,r),_=r.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-_))return;const S=p+u-_,E=Math.cos(this._pitch)*this.cameraToCenterDistance/S/c.b5(1,m.lat),C=this.scaleZoom(E/this.tileSize);this._elevation=_,this._center=m,this.zoom=C}setLocationAtPoint(r,u){const p=this.pointCoordinate(u),m=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(r),S=new c.Z(_.x-(p.x-m.x),_.y-(p.y-m.y));this.center=this.coordinateLocation(S),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(r,u){return u?this.coordinatePoint(this.locationCoordinate(r),u.getElevationForLngLatZoom(r,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(r))}pointLocation(r,u){return this.coordinateLocation(this.pointCoordinate(r,u))}locationCoordinate(r){return c.Z.fromLngLat(r)}coordinateLocation(r){return r&&r.toLngLat()}pointCoordinate(r,u){if(u){const X=u.pointCoordinate(r);if(X!=null)return X}const p=[r.x,r.y,0,1],m=[r.x,r.y,1,1];c.af(p,p,this.pixelMatrixInverse),c.af(m,m,this.pixelMatrixInverse);const _=p[3],S=m[3],E=p[1]/_,C=m[1]/S,z=p[2]/_,F=m[2]/S,B=z===F?0:(0-z)/(F-z);return new c.Z(c.y.number(p[0]/_,m[0]/S,B)/this.worldSize,c.y.number(E,C,B)/this.worldSize)}coordinatePoint(r,u=0,p=this.pixelMatrix){const m=[r.x*this.worldSize,r.y*this.worldSize,u,1];return c.af(m,m,p),new c.P(m[0]/m[3],m[1]/m[3])}getBounds(){const r=Math.max(0,this.height/2-this.getHorizon());return new ie().extend(this.pointLocation(new c.P(0,r))).extend(this.pointLocation(new c.P(this.width,r))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ie([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(r){r?(this.lngRange=[r.getWest(),r.getEast()],this.latRange=[r.getSouth(),r.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,gd])}calculateTileMatrix(r){const u=r.canonical,p=this.worldSize/this.zoomScale(u.z),m=u.x+Math.pow(2,u.z)*r.wrap,_=c.an(new Float64Array(16));return c.J(_,_,[m*p,u.y*p,0]),c.K(_,_,[p/c.X,p/c.X,1]),_}calculatePosMatrix(r,u=!1){const p=r.key,m=u?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const _=this.calculateTileMatrix(r);return c.L(_,u?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),m[p]=new Float32Array(_),m[p]}calculateFogMatrix(r){const u=r.key,p=this._fogMatrixCache;if(p[u])return p[u];const m=this.calculateTileMatrix(r);return c.L(m,this.fogMatrix,m),p[u]=new Float32Array(m),p[u]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(r,u){u=c.ac(+u,this.minZoom,this.maxZoom);const p={center:new c.N(r.lng,r.lat),zoom:u};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ae=179.9999999999;m=[-ae,ae]}const _=this.tileSize*this.zoomScale(p.zoom);let S=0,E=_,C=0,z=_,F=0,B=0;const{x:X,y:Q}=this.size;if(this.latRange){const ae=this.latRange;S=c.Q(ae[1])*_,E=c.Q(ae[0])*_,E-SE&&(me=E-ae)}if(m){const ae=(C+z)/2;let Ce=re;this._renderWorldCopies&&(Ce=c.b3(re,ae-_/2,ae+_/2));const Pe=X/2;Ce-Pez&&(pe=z-Pe)}if(pe!==void 0||me!==void 0){const ae=new c.P(pe??re,me??ce);p.center=this.unproject.call({worldSize:_},ae).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this._unmodified,{center:u,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=p,this._unmodified=r,this._constraining=!1}_calcMatrices(){if(!this.height)return;const r=this.centerOffset,u=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let m=c.an(new Float64Array(16));c.K(m,m,[this.width/2,-this.height/2,1]),c.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=c.an(new Float64Array(16)),c.K(m,m,[1,-1,1]),c.J(m,m,[-1,-1,0]),c.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),S=Math.min(this.elevation,this.minElevationForCurrentTile),E=_-S*this._pixelPerMeter/Math.cos(this._pitch),C=S<0?E:_,z=Math.PI/2+this._pitch,F=this._fov*(.5+r.y/this.height),B=Math.sin(F)*C/Math.sin(c.ac(Math.PI-z-F,.01,Math.PI-.01)),X=this.getHorizon(),Q=2*Math.atan(X/this.cameraToCenterDistance)*(.5+r.y/(2*X)),re=Math.sin(Q)*C/Math.sin(c.ac(Math.PI-z-Q,.01,Math.PI-.01)),ce=Math.min(B,re);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ce+C),this.nearZ=this.height/50,m=new Float64Array(16),c.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-r.x/this.width,m[9]=2*r.y/this.height,this.projectionMatrix=c.ae(m),c.K(m,m,[1,-1,1]),c.J(m,m,[0,0,-this.cameraToCenterDistance]),c.b7(m,m,this._pitch),c.ad(m,m,this.angle),c.J(m,m,[-u,-p,0]),this.mercatorMatrix=c.K([],m,[this.worldSize,this.worldSize,this.worldSize]),c.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,m),c.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=c.as([],m),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,_,this.farZ),this.fogMatrix[8]=2*-r.x/this.width,this.fogMatrix[9]=2*r.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ad(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-u,-p,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,m);const pe=this.width%2/2,me=this.height%2/2,we=Math.cos(this.angle),ae=Math.sin(this.angle),Ce=u-Math.round(u)+we*pe+ae*me,Pe=p-Math.round(p)+we*me+ae*pe,ze=new Float64Array(m);if(c.J(ze,ze,[Ce>.5?Ce-1:Ce,Pe>.5?Pe-1:Pe,0]),this.alignedModelViewProjectionMatrix=ze,m=c.as(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const r=this.pointCoordinate(new c.P(0,0)),u=[r.x*this.worldSize,r.y*this.worldSize,0,1];return c.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,r))}getCameraQueryGeometry(r){const u=this.getCameraPoint();if(r.length===1)return[r[0],u];{let p=u.x,m=u.y,_=u.x,S=u.y;for(const E of r)p=Math.min(p,E.x),m=Math.min(m,E.y),_=Math.max(_,E.x),S=Math.max(S,E.y);return[new c.P(p,m),new c.P(_,m),new c.P(_,S),new c.P(p,S),new c.P(p,m)]}}lngLatToCameraDepth(r,u){const p=this.locationCoordinate(r),m=[p.x*this.worldSize,p.y*this.worldSize,u,1];return c.af(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function nu(v,r){let u,p=!1,m=null,_=null;const S=()=>{m=null,p&&(v.apply(_,u),m=setTimeout(S,r),p=!1)};return(...E)=>(p=!0,_=this,u=E,m||S(),m)}class gc{constructor(r){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let p;return u.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:p,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,u)},this._removeHash=()=>{const u=this._getCurrentHash();if(u.length===0)return;const p=u.join("/");let m=p;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${p}`);let _=window.location.hash.replace(m,"");_.startsWith("#&")?_=_.slice(0,1)+_.slice(2):_==="#"&&(_="");let S=window.location.href.replace(/(#.+)?$/,_);S=S.replace("&&","&"),window.history.replaceState(window.history.state,null,S)},this._updateHash=nu(this._updateHashUnthrottled,300),this._hashName=r&&encodeURIComponent(r)}addTo(r){return this._map=r,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(r){const u=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,m),S=Math.round(u.lng*_)/_,E=Math.round(u.lat*_)/_,C=this._map.getBearing(),z=this._map.getPitch();let F="";if(F+=r?`/${S}/${E}/${p}`:`${p}/${E}/${S}`,(C||z)&&(F+="/"+Math.round(10*C)/10),z&&(F+=`/${Math.round(z)}`),this._hashName){const B=this._hashName;let X=!1;const Q=window.location.hash.slice(1).split("&").map(re=>{const ce=re.split("=")[0];return ce===B?(X=!0,`${ce}=${F}`):re}).filter(re=>re);return X||Q.push(`${B}=${F}`),`#${Q.join("&")}`}return`#${F}`}}const yc={linearity:.3,easing:c.b8(0,0,.3,1)},yd=c.e({deceleration:2500,maxSpeed:1400},yc),Z_=c.e({deceleration:20,maxSpeed:1400},yc),Qp=c.e({deceleration:1e3,maxSpeed:360},yc),_c=c.e({deceleration:1e3,maxSpeed:90},yc);class _d{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:A.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,u=A.now();for(;r.length>0&&u-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)u.zoom+=_.zoomDelta||0,u.bearing+=_.bearingDelta||0,u.pitch+=_.pitchDelta||0,_.panDelta&&u.pan._add(_.panDelta),_.around&&(u.around=_.around),_.pinchAround&&(u.pinchAround=_.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(u.pan.mag()){const _=su(u.pan.mag(),p,c.e({},yd,r||{}));m.offset=u.pan.mult(_.amount/u.pan.mag()),m.center=this._map.transform.center,iu(m,_)}if(u.zoom){const _=su(u.zoom,p,Z_);m.zoom=this._map.transform.zoom+_.amount,iu(m,_)}if(u.bearing){const _=su(u.bearing,p,Qp);m.bearing=this._map.transform.bearing+c.ac(_.amount,-179,179),iu(m,_)}if(u.pitch){const _=su(u.pitch,p,_c);m.pitch=this._map.transform.pitch+_.amount,iu(m,_)}if(m.zoom||m.bearing){const _=u.pinchAround===void 0?u.around:u.pinchAround;m.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),c.e(m,{noMoveStart:!0})}}function iu(v,r){(!v.duration||v.durationu.unproject(C)),E=_.reduce((C,z,F,B)=>C.add(z.div(B.length)),new c.P(0,0));super(r,{points:_,point:E,lngLats:S,lngLat:u.unproject(E),originalEvent:p}),this._defaultPrevented=!1}}class em extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,u,p){super(r,{originalEvent:p}),this._defaultPrevented=!1}}class tm{constructor(r,u){this._map=r,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(r){return this._firePreventable(new em(r.type,this._map,r))}mousedown(r,u){return this._mousedownPos=u,this._firePreventable(new Wn(r.type,this._map,r))}mouseup(r){this._map.fire(new Wn(r.type,this._map,r))}click(r,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Wn(r.type,this._map,r))}dblclick(r){return this._firePreventable(new Wn(r.type,this._map,r))}mouseover(r){this._map.fire(new Wn(r.type,this._map,r))}mouseout(r){this._map.fire(new Wn(r.type,this._map,r))}touchstart(r){return this._firePreventable(new oa(r.type,this._map,r))}touchmove(r){this._map.fire(new oa(r.type,this._map,r))}touchend(r){this._map.fire(new oa(r.type,this._map,r))}touchcancel(r){this._map.fire(new oa(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pn{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(r){this._map.fire(new Wn(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Wn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._ignoreContextMenu||this._map.fire(new Wn(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _s{constructor(r){this._map=r}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(r){return this.transform.pointLocation(c.P.convert(r),this._map.terrain)}}class zi{constructor(r,u){this._map=r,this._tr=new _s(r),this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,u){this.isEnabled()&&r.shiftKey&&r.button===0&&(M.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(r,u){if(!this._active)return;const p=u;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)_.fitScreenCoordinates(p,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",r)}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(M.remove(this._box),this._box=null),M.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,u){return this._map.fire(new c.k(r,{originalEvent:u}))}}function ou(v,r){if(v.length!==r.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${r.length}`);const u={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=r.timeStamp),p.length===this.numTouches&&(this.centroid=function(m){const _=new c.P(0,0);for(const S of m)_._add(S);return _.div(m.length)}(u),this.touches=ou(p,u)))}touchmove(r,u,p){if(this.aborted||!this.centroid)return;const m=ou(p,u);for(const _ in this.touches){const S=m[_];(!S||S.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(r,u,p){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class vc{constructor(r){this.singleTap=new vd(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(r,u,p){this.singleTap.touchstart(r,u,p)}touchmove(r,u,p){this.singleTap.touchmove(r,u,p)}touchend(r,u,p){const m=this.singleTap.touchend(r,u,p);if(m){const _=r.timeStamp-this.lastTime<500,S=!this.lastTap||this.lastTap.dist(m)<30;if(_&&S||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Ja{constructor(r){this._tr=new _s(r),this._zoomIn=new vc({numTouches:1,numTaps:2}),this._zoomOut=new vc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,u,p){this._zoomIn.touchstart(r,u,p),this._zoomOut.touchstart(r,u,p)}touchmove(r,u,p){this._zoomIn.touchmove(r,u,p),this._zoomOut.touchmove(r,u,p)}touchend(r,u,p){const m=this._zoomIn.touchend(r,u,p),_=this._zoomOut.touchend(r,u,p),S=this._tr;return m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:S.zoom+1,around:S.unproject(m)},{originalEvent:r})}):_?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:S.zoom-1,around:S.unproject(_)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lo{constructor(r){this._enabled=!!r.enable,this._moveStateManager=r.moveStateManager,this._clickTolerance=r.clickTolerance||1,this._moveFunction=r.move,this._activateOnStart=!!r.activateOnStart,r.assignEvents(this),this.reset()}reset(r){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(r)}_move(...r){const u=this._moveFunction(...r);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(r,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(r)&&(this._moveStateManager.startMove(r),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(r,u){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(r.preventDefault(),!this._moveStateManager.isValidMoveEvent(r))return void this.reset(r);const m=u.length?u[0]:u;return!this._moved&&m.dist(p){v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=r=>{r.preventDefault()}},bd=({enable:v,clickTolerance:r,bearingDegreesPerPixelMoved:u=.8})=>{const p=new xc({checkCorrectEvent:m=>M.mouseButton(m)===0&&m.ctrlKey||M.mouseButton(m)===2});return new lo({clickTolerance:r,move:(m,_)=>({bearingDelta:(_.x-m.x)*u}),moveStateManager:p,enable:v,assignEvents:wc})},Sd=({enable:v,clickTolerance:r,pitchDegreesPerPixelMoved:u=-.5})=>{const p=new xc({checkCorrectEvent:m=>M.mouseButton(m)===0&&m.ctrlKey||M.mouseButton(m)===2});return new lo({clickTolerance:r,move:(m,_)=>({pitchDelta:(_.y-m.y)*u}),moveStateManager:p,enable:v,assignEvents:wc})};class aa{constructor(r,u){this._clickTolerance=r.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(r){return r<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(r,u,p){return this._calculateTransform(r,u,p)}touchmove(r,u,p){if(this._active){if(!this._shouldBePrevented(p.length))return r.preventDefault(),this._calculateTransform(r,u,p);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",r)}}touchend(r,u,p){this._calculateTransform(r,u,p),this._active&&this._shouldBePrevented(p.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,u,p){p.length>0&&(this._active=!0);const m=ou(p,u),_=new c.P(0,0),S=new c.P(0,0);let E=0;for(const z in m){const F=m[z],B=this._touches[z];B&&(_._add(F),S._add(F.sub(B)),E++,m[z]=F)}if(this._touches=m,this._shouldBePrevented(E)||!S.mag())return;const C=S.div(E);return this._sum._add(C),this._sum.mag()Math.abs(v.x)}class Qa extends bc{constructor(r){super(),this._currentTouchCount=0,this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,u,p){super.touchstart(r,u,p),this._currentTouchCount=p.length}_start(r){this._lastPoints=r,Sc(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,u,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=r[0].sub(this._lastPoints[0]),_=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,_,p.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(r,u,p){if(this._valid!==void 0)return this._valid;const m=r.mag()>=2,_=u.mag()>=2;if(!m&&!_)return;if(!m||!_)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const S=r.y>0==u.y>0;return Sc(r)&&Sc(u)&&S}}const rm={panStep:100,bearingStep:15,pitchStep:10};class Ji{constructor(r){this._tr=new _s(r);const u=rm;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let u=0,p=0,m=0,_=0,S=0;switch(r.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:r.shiftKey?p=-1:(r.preventDefault(),_=-1);break;case 39:r.shiftKey?p=1:(r.preventDefault(),_=1);break;case 38:r.shiftKey?m=1:(r.preventDefault(),S=-1);break;case 40:r.shiftKey?m=-1:(r.preventDefault(),S=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:E=>{const C=this._tr;E.easeTo({duration:300,easeId:"keyboardHandler",easing:Vs,zoom:u?Math.round(C.zoom)+u*(r.shiftKey?2:1):C.zoom,bearing:C.bearing+p*this._bearingStep,pitch:C.pitch+m*this._pitchStep,offset:[-_*this._panStep,-S*this._panStep],center:C.center},{originalEvent:r})}}}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 Vs(v){return v*(2-v)}const Id=4.000244140625;class vs{constructor(r,u){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=r,this._tr=new _s(r),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(r){return!!this._map.cooperativeGestures.isEnabled()&&!(r.ctrlKey||this._map.cooperativeGestures.isBypassed(r))}wheel(r){if(!this.isEnabled())return;if(this._shouldBePrevented(r))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",r);let u=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const p=A.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,u!==0&&u%Id==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(m*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),r.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=r,this._delta-=u,this._active||this._start(r)),r.preventDefault()}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=M.mousePos(this._map.getCanvas(),r),p=this._tr;this._around=u.y>p.transform.height/2-p.transform.getHorizon()?c.N.convert(this._aroundCenter?p.center:p.unproject(u)):c.N.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Id?this._wheelZoomRate:this._defaultZoomRate;let z=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&z!==0&&(z=1/z);const F=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(F*z))),this._type==="wheel"&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:r.zoom,p=this._startZoom,m=this._easing;let _,S=!1;const E=A.now()-this._lastWheelEventTime;if(this._type==="wheel"&&p&&m&&E){const C=Math.min(E/200,1),z=m(C);_=c.y.number(p,u,z),C<1?this._frameId||(this._frameId=!0):S=!0}else _=u,S=!0;return this._active=!0,S&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!S,zoomDelta:_-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let u=c.b9;if(this._prevEase){const p=this._prevEase,m=(A.now()-p.start)/p.duration,_=p.easing(m+.01)-p.easing(m),S=.27/Math.sqrt(_*_+1e-4)*.01,E=Math.sqrt(.0729-S*S);u=c.b8(S,E,.25,1)}return this._prevEase={start:A.now(),duration:r,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class la{constructor(r,u){this._clickZoom=r,this._tapZoom=u}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 q_{constructor(r){this._tr=new _s(r),this.reset()}reset(){this._active=!1}dblclick(r,u){return r.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(r.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Y_{constructor(){this._tap=new vc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(r,u,p){if(!this._swipePoint)if(this._tapTime){const m=u[0],_=r.timeStamp-this._tapTime<500,S=this._tapPoint.dist(m)<30;_&&S?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(r,u,p)}touchmove(r,u,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=u[0],_=m.y-this._swipePoint.y;return this._swipePoint=m,r.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(r,u,p)}touchend(r,u,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(r,u,p);m&&(this._tapTime=r.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nm{constructor(r,u,p){this._el=r,this._mousePan=u,this._touchPan=p}enable(r){this._inertiaOptions=r||{},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 im{constructor(r,u,p){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=u,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Pd{constructor(r,u,p,m){this._el=r,this._touchZoom=u,this._touchRotate=p,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class el{constructor(r,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=r,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const r=this._map.getCanvasContainer();r.classList.add("maplibregl-cooperative-gestures"),this._container=M.create("div","maplibregl-cooperative-gesture-screen",r);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=u,this._container.appendChild(m);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=p,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(M.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(r){return r[this._bypassKey]}notifyGestureBlocked(r,u){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:r,originalEvent:u})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Qi=v=>v.zoom||v.drag||v.pitch||v.rotate;class St extends c.k{}function kc(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Md{constructor(r,u){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,_)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const S=m.type==="renderFrame"?void 0:m,E={needsRenderFrame:!1},C={},z={},F=m.touches,B=F?this._getMapTouches(F):void 0,X=B?M.touchPos(this._map.getCanvas(),B):M.mousePos(this._map.getCanvas(),m);for(const{handlerName:ce,handler:pe,allowed:me}of this._handlers){if(!pe.isEnabled())continue;let we;this._blockedByActive(z,me,ce)?pe.reset():pe[_||m.type]&&(we=pe[_||m.type](m,X,B),this.mergeHandlerResult(E,C,we,ce,S),we&&we.needsRenderFrame&&this._triggerRenderFrame()),(we||pe.isActive())&&(z[ce]=pe)}const Q={};for(const ce in this._previousActiveHandlers)z[ce]||(Q[ce]=S);this._previousActiveHandlers=z,(Object.keys(Q).length||kc(E))&&(this._changes.push([E,C,Q]),this._triggerRenderFrame()),(Object.keys(z).length||kc(E))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:re}=E;re&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],re(this._map))},this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _d(r),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,_,S]of this._listeners)M.addEventListener(m,_,m===document?this.handleWindowEvent:this.handleEvent,S)}destroy(){for(const[r,u,p]of this._listeners)M.removeEventListener(r,u,r===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(r){const u=this._map,p=u.getCanvasContainer();this._add("mapEvent",new tm(u,r));const m=u.boxZoom=new zi(u,r);this._add("boxZoom",m),r.interactive&&r.boxZoom&&m.enable();const _=u.cooperativeGestures=new el(u,r.cooperativeGestures);this._add("cooperativeGestures",_),r.cooperativeGestures&&_.enable();const S=new Ja(u),E=new q_(u);u.doubleClickZoom=new la(E,S),this._add("tapZoom",S),this._add("clickZoom",E),r.interactive&&r.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Y_;this._add("tapDragZoom",C);const z=u.touchPitch=new Qa(u);this._add("touchPitch",z),r.interactive&&r.touchPitch&&u.touchPitch.enable(r.touchPitch);const F=bd(r),B=Sd(r);u.dragRotate=new im(r,F,B),this._add("mouseRotate",F,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]),r.interactive&&r.dragRotate&&u.dragRotate.enable();const X=(({enable:we,clickTolerance:ae})=>{const Ce=new xc({checkCorrectEvent:Pe=>M.mouseButton(Pe)===0&&!Pe.ctrlKey});return new lo({clickTolerance:ae,move:(Pe,ze)=>({around:ze,panDelta:ze.sub(Pe)}),activateOnStart:!0,moveStateManager:Ce,enable:we,assignEvents:wc})})(r),Q=new aa(r,u);u.dragPan=new nm(p,X,Q),this._add("mousePan",X),this._add("touchPan",Q,["touchZoom","touchRotate"]),r.interactive&&r.dragPan&&u.dragPan.enable(r.dragPan);const re=new Cd,ce=new Td;u.touchZoomRotate=new Pd(p,ce,re,C),this._add("touchRotate",re,["touchPan","touchZoom"]),this._add("touchZoom",ce,["touchPan","touchRotate"]),r.interactive&&r.touchZoomRotate&&u.touchZoomRotate.enable(r.touchZoomRotate);const pe=u.scrollZoom=new vs(u,()=>this._triggerRenderFrame());this._add("scrollZoom",pe,["mousePan"]),r.interactive&&r.scrollZoom&&u.scrollZoom.enable(r.scrollZoom);const me=u.keyboard=new Ji(u);this._add("keyboard",me),r.interactive&&r.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new pn(u))}_add(r,u,p){this._handlers.push({handlerName:r,handler:u,allowed:p}),this._handlersById[r]=u}stop(r){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[]}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Qi(this._eventsInProgress)||this.isZooming()}_blockedByActive(r,u,p){for(const m in r)if(m!==p&&(!u||u.indexOf(m)<0))return!0;return!1}_getMapTouches(r){const u=[];for(const p of r)this._el.contains(p.target)&&u.push(p);return u}mergeHandlerResult(r,u,p,m,_){if(!p)return;c.e(r,p);const S={handlerName:m,originalEvent:p.originalEvent||_};p.zoomDelta!==void 0&&(u.zoom=S),p.panDelta!==void 0&&(u.drag=S),p.pitchDelta!==void 0&&(u.pitch=S),p.bearingDelta!==void 0&&(u.rotate=S)}_applyChanges(){const r={},u={},p={};for(const[m,_,S]of this._changes)m.panDelta&&(r.panDelta=(r.panDelta||new c.P(0,0))._add(m.panDelta)),m.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(r.around=m.around),m.pinchAround!==void 0&&(r.pinchAround=m.pinchAround),m.noInertia&&(r.noInertia=m.noInertia),c.e(u,_),c.e(p,S);this._updateMapTransform(r,u,p),this._changes=[]}_updateMapTransform(r,u,p){const m=this._map,_=m._getTransformForUpdate(),S=m.terrain;if(!(kc(r)||S&&this._terrainMovement))return this._fireEvents(u,p,!0);let{panDelta:E,zoomDelta:C,bearingDelta:z,pitchDelta:F,around:B,pinchAround:X}=r;X!==void 0&&(B=X),m._stop(!0),B=B||m.transform.centerPoint;const Q=_.pointLocation(E?B.sub(E):B);z&&(_.bearing+=z),F&&(_.pitch+=F),C&&(_.zoom+=C),S?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(E)):_.setLocationAtPoint(Q,B):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(Q,B)):_.setLocationAtPoint(Q,B),m._applyUpdatedTransform(_),this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(u,p,!0)}_fireEvents(r,u,p){const m=Qi(this._eventsInProgress),_=Qi(r),S={};for(const B in r){const{originalEvent:X}=r[B];this._eventsInProgress[B]||(S[`${B}start`]=X),this._eventsInProgress[B]=r[B]}!m&&_&&this._fireEvent("movestart",_.originalEvent);for(const B in S)this._fireEvent(B,S[B]);_&&this._fireEvent("move",_.originalEvent);for(const B in r){const{originalEvent:X}=r[B];this._fireEvent(B,X)}const E={};let C;for(const B in this._eventsInProgress){const{handlerName:X,originalEvent:Q}=this._eventsInProgress[B];this._handlersById[X].isActive()||(delete this._eventsInProgress[B],C=u[X]||Q,E[`${B}end`]=C)}for(const B in E)this._fireEvent(B,E[B]);const z=Qi(this._eventsInProgress),F=(m||_)&&!z;if(F&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const B=this._map._getTransformForUpdate();B.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(B)}if(p&&F){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),X=Q=>Q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new St("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class sm extends c.E{constructor(r,u){super(),this._renderFrameCallback=()=>{const p=Math.min((A.now()-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=r,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(r,u){return this.jumpTo({center:r},u)}panBy(r,u,p){return r=c.P.convert(r).mult(-1),this.panTo(this.transform.center,c.e({offset:r},u),p)}panTo(r,u,p){return this.easeTo(c.e({center:r},u),p)}getZoom(){return this.transform.zoom}setZoom(r,u){return this.jumpTo({zoom:r},u),this}zoomTo(r,u,p){return this.easeTo(c.e({zoom:r},u),p)}zoomIn(r,u){return this.zoomTo(this.getZoom()+1,r,u),this}zoomOut(r,u){return this.zoomTo(this.getZoom()-1,r,u),this}getBearing(){return this.transform.bearing}setBearing(r,u){return this.jumpTo({bearing:r},u),this}getPadding(){return this.transform.padding}setPadding(r,u){return this.jumpTo({padding:r},u),this}rotateTo(r,u,p){return this.easeTo(c.e({bearing:r},u),p)}resetNorth(r,u){return this.rotateTo(0,c.e({duration:1e3},r),u),this}resetNorthPitch(r,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},r),u),this}snapToNorth(r,u){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=c.y.number(_,pe,Ye)),this._rotating&&(m.bearing=c.y.number(S,z,Ye)),this._pitching&&(m.pitch=c.y.number(E,F,Ye)),this._padding&&(m.interpolatePadding(C,B,Ye),Q=m.centerPoint.add(X)),this.terrain&&!r.freezeElevation&&this._updateElevation(Ye),Ce)m.setLocationAtPoint(Ce,Pe);else{const st=m.zoomScale(m.zoom-_),gt=pe>_?Math.min(2,ae):Math.max(.5,ae),wt=Math.pow(gt,1-Ye),dt=m.unproject(me.add(we.mult(Ye*wt)).mult(st));m.setLocationAtPoint(m.renderWorldCopies?dt.wrap():dt,Q)}this._applyUpdatedTransform(m),this._fireMoveEvents(u)},Ye=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(u,Ye)},r),this}_prepareEase(r,u,p={}){this._moving=!0,u||p.moving||this.fire(new c.k("movestart",r)),this._zooming&&!p.zooming&&this.fire(new c.k("zoomstart",r)),this._rotating&&!p.rotating&&this.fire(new c.k("rotatestart",r)),this._pitching&&!p.pitching&&this.fire(new c.k("pitchstart",r))}_prepareElevation(r){this._elevationCenter=r,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(r){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(r<1&&u!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=r*(p-(u-(p*r+this._elevationStart))/(1-r)),this._elevationTarget=u}this.transform.elevation=c.y.number(this._elevationStart,this._elevationTarget,r)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(r){const u=r.getCameraPosition(),p=this.terrain.getElevationForLngLatZoom(u.lngLat,r.zoom);if(u.altitudethis._elevateCameraIfInsideTerrain(m)),this.transformCameraUpdate&&u.push(m=>this.transformCameraUpdate(m)),!u.length)return;const p=r.clone();for(const m of u){const _=p.clone(),{center:S,zoom:E,pitch:C,bearing:z,elevation:F}=m(_);S&&(_.center=S),E!==void 0&&(_.zoom=E),C!==void 0&&(_.pitch=C),z!==void 0&&(_.bearing=z),F!==void 0&&(_.elevation=F),p.apply(_)}this.transform.apply(p)}_fireMoveEvents(r){this.fire(new c.k("move",r)),this._zooming&&this.fire(new c.k("zoom",r)),this._rotating&&this.fire(new c.k("rotate",r)),this._pitching&&this.fire(new c.k("pitch",r))}_afterEase(r,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const p=this._zooming,m=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new c.k("zoomend",r)),m&&this.fire(new c.k("rotateend",r)),_&&this.fire(new c.k("pitchend",r)),this.fire(new c.k("moveend",r))}flyTo(r,u){var p;if(!r.essential&&A.prefersReducedMotion){const _t=c.M(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(_t,u)}this.stop(),r=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},r);const m=this._getTransformForUpdate(),_=m.zoom,S=m.bearing,E=m.pitch,C=m.padding,z="bearing"in r?this._normalizeBearing(r.bearing,S):S,F="pitch"in r?+r.pitch:E,B="padding"in r?r.padding:m.padding,X=c.P.convert(r.offset);let Q=m.centerPoint.add(X);const re=m.pointLocation(Q),{center:ce,zoom:pe}=m.getConstrained(c.N.convert(r.center||re),(p=r.zoom)!==null&&p!==void 0?p:_);this._normalizeCenter(ce,m);const me=m.zoomScale(pe-_),we=m.project(re),ae=m.project(ce).sub(we);let Ce=r.curve;const Pe=Math.max(m.width,m.height),ze=Pe/me,Ye=ae.mag();if("minZoom"in r){const _t=c.ac(Math.min(r.minZoom,_,pe),m.minZoom,m.maxZoom),Gt=Pe/m.zoomScale(_t-_);Ce=Math.sqrt(Gt/Ye*2)}const st=Ce*Ce;function gt(_t){const Gt=(ze*ze-Pe*Pe+(_t?-1:1)*st*st*Ye*Ye)/(2*(_t?ze:Pe)*st*Ye);return Math.log(Math.sqrt(Gt*Gt+1)-Gt)}function wt(_t){return(Math.exp(_t)-Math.exp(-_t))/2}function dt(_t){return(Math.exp(_t)+Math.exp(-_t))/2}const ct=gt(!1);let Pt=function(_t){return dt(ct)/dt(ct+Ce*_t)},qt=function(_t){return Pe*((dt(ct)*(wt(Gt=ct+Ce*_t)/dt(Gt))-wt(ct))/st)/Ye;var Gt},ft=(gt(!0)-ct)/Ce;if(Math.abs(Ye)<1e-6||!isFinite(ft)){if(Math.abs(Pe-ze)<1e-6)return this.easeTo(r,u);const _t=ze0,Pt=Gt=>Math.exp(_t*Ce*Gt)}return r.duration="duration"in r?+r.duration:1e3*ft/("screenSpeed"in r?+r.screenSpeed/Ce:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=S!==z,this._pitching=F!==E,this._padding=!m.isPaddingEqual(B),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(ce),this._ease(_t=>{const Gt=_t*ft,Hr=1/Pt(Gt);m.zoom=_t===1?pe:_+m.scaleZoom(Hr),this._rotating&&(m.bearing=c.y.number(S,z,_t)),this._pitching&&(m.pitch=c.y.number(E,F,_t)),this._padding&&(m.interpolatePadding(C,B,_t),Q=m.centerPoint.add(X)),this.terrain&&!r.freezeElevation&&this._updateElevation(_t);const tr=_t===1?ce:m.unproject(we.add(ae.mult(qt(Gt))).mult(Hr));m.setLocationAtPoint(m.renderWorldCopies?tr.wrap():tr,Q),this._applyUpdatedTransform(m),this._fireMoveEvents(u)},()=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(u)},r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,u){var p;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,u)}return r||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(r,u,p){p.animate===!1||p.duration===0?(r(1),u()):(this._easeStart=A.now(),this._easeOptions=p,this._onEaseFrame=r,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(r,u){r=c.b3(r,-180,180);const p=Math.abs(r-u);return Math.abs(r-360-u)180?-360:p<-180?360:0}queryTerrainElevation(r){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(r),this.transform.tileZoom)-this.transform.elevation:null}}const tl={compact:!0,customAttribution:'MapLibre'};class rl{constructor(r=tl){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=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.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=r}getDefaultPosition(){return"bottom-right"}onAdd(r){return this._map=r,this._compact=this.options.compact,this._container=M.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=M.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=M.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(){M.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(r,u){const p=this._map._getUIString(`AttributionControl.${u}`);r.title=p,r.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let r=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=r.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&r.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const u=this._map.style.sourceCaches;for(const m in u){const _=u[m];if(_.used||_.usedForTerrain){const S=_.getSource();S.attribution&&r.indexOf(S.attribution)<0&&r.push(S.attribution)}}r=r.filter(m=>String(m).trim()),r.sort((m,_)=>m.length-_.length),r=r.filter((m,_)=>{for(let S=_+1;S=0)return!1;return!0});const p=r.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,r.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ad{constructor(r={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const p=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=r}getDefaultPosition(){return"bottom-left"}onAdd(r){this._map=r,this._compact=this.options&&this.options.compact,this._container=M.create("div","maplibregl-ctrl");const u=M.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){M.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ur{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const u=++this._id;return this._queue.push({callback:r,id:u,cancelled:!1}),u}remove(r){const u=this._currentlyRunning,p=u?this._queue.concat(u):this._queue;for(const m of p)if(m.id===r)return void(m.cancelled=!0)}run(r=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const p of u)if(!p.cancelled&&(p.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Dd=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class X_ extends c.E{constructor(r){super(),this.sourceCache=r,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,r.usedForTerrain=!0,r.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(r,u){this.sourceCache.update(r,u),this._renderableTilesKeys=[];const p={};for(const m of r.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),c.aP(m.posMatrix,0,c.X,0,c.X,0,1),this._tiles[m.key]=new pi(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(r){for(const u in this._tiles){const p=this._tiles[u];(!r||p.tileID.equals(r)||p.tileID.isChildOf(r)||r.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(r=>this.getTileByID(r))}getTileByID(r){return this._tiles[r]}getTerrainCoords(r){const u={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16),c.aP(_.posMatrix,0,c.X,0,c.X,0,1),u[p]=_}else if(m.canonical.isChildOf(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=m.canonical.z-r.canonical.z,E=m.canonical.x-(m.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,z,0,z,0,1),c.J(_.posMatrix,_.posMatrix,[-E*z,-C*z,0]),u[p]=_}else if(r.canonical.isChildOf(m.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=r.canonical.z-m.canonical.z,E=r.canonical.x-(r.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,c.X,0,c.X,0,1),c.J(_.posMatrix,_.posMatrix,[E*z,C*z,0]),c.K(_.posMatrix,_.posMatrix,[1/2**S,1/2**S,0]),u[p]=_}}return u}getSourceTile(r,u){const p=this.sourceCache._source;let m=r.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(r.scaledTo(m--).key);return _}tilesAfterTime(r=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=r)}}class zd{constructor(r,u,p){this.painter=r,this.sourceCache=new X_(u),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(r,u,p,m=c.X){var _;if(!(u>=0&&u=0&&pr.canonical.z&&(r.canonical.z>=m?_=r.canonical.z-m:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const S=r.canonical.x-(r.canonical.x>>_<<_),E=r.canonical.y-(r.canonical.y>>_<<_),C=c.bc(new Float64Array(16),[1/(c.X<<_),1/(c.X<<_),0]);c.J(C,C,[S*c.X,E*c.X,0]),this._demMatrixCache[r.key]={matrix:C,coord:r}}return{u_depth:2,u_terrain:3,u_terrain_dim:u&&u.dem&&u.dem.dim||1,u_terrain_matrix:p?this._demMatrixCache[r.key].matrix:this._emptyDemMatrix,u_terrain_unpack:u&&u.dem&&u.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(u&&u.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:u}}getFramebuffer(r){const u=this.painter,p=u.width/devicePixelRatio,m=u.height/devicePixelRatio;return!this._fbo||this._fbo.width===p&&this._fbo.height===m||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new it(u.context,{width:p,height:m,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new it(u.context,{width:p,height:m,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=u.context.createFramebuffer(p,m,!0,!1),this._fbo.depthAttachment.set(u.context.createRenderbuffer(u.context.gl.DEPTH_COMPONENT16,p,m))),this._fbo.colorAttachment.set(r==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const r=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const u=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,S=0;_>8<<4|_>>8,u[S+3]=0;const p=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),m=new it(r,p,r.gl.RGBA,{premultiply:!1});return m.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(r){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),p=this.painter.context,m=p.gl,_=Math.round(r.x*this.painter.pixelRatio/devicePixelRatio),S=Math.round(r.y*this.painter.pixelRatio/devicePixelRatio),E=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(_,E-S-1,1,1,m.RGBA,m.UNSIGNED_BYTE,u),p.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),z=u[1]+((15&u[2])<<8),F=this.coordsIndex[255-u[3]],B=F&&this.sourceCache.getTileByID(F);if(!B)return null;const X=this._coordsTextureSize,Q=(1<r.id!==u),this._recentlyUsed.push(r.id)}stampObject(r){r.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const r=this._createObject(this._objects.length);return this._objects.push(r),r}freeObject(r){r.inUse=!1}freeAllObjects(){for(const r of this._objects)this.freeObject(r)}isFull(){return!(this._objects.length!r.inUse)===!1}}const nl={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class om{constructor(r,u){this.painter=r,this.terrain=u,this.pool=new K_(r.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(r){return this.pool.getObjectForId(r.rtt[this._stacks.length-1].id).texture}prepareForRender(r,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=r._order.filter(p=>!r._layers[p].isHidden(u)),this._coordsDescendingInv={};for(const p in r.sourceCaches){this._coordsDescendingInv[p]={};const m=r.sourceCaches[p].getVisibleCoordinates();for(const _ of m){const S=this.terrain.sourceCache.getTerrainCoords(_);for(const E in S)this._coordsDescendingInv[p][E]||(this._coordsDescendingInv[p][E]=[]),this._coordsDescendingInv[p][E].push(S[E])}}this._coordsDescendingInvStr={};for(const p of r._order){const m=r._layers[p],_=m.source;if(nl[m.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const S in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][S]=this._coordsDescendingInv[_][S].map(E=>E.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[m][p.tileID.key];_&&_!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(r){if(r.isHidden(this.painter.transform.zoom))return!1;const u=r.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===r.id;if(nl[u]&&(this._prevType&&nl[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(r.id),!m))return!0;if(nl[this._prevType]||nl[u]&&m){this._prevType=u;const _=this._stacks.length-1,S=this._stacks[_]||[];for(const E of this._renderableTiles){if(this.pool.isFull()&&(Jp(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(E),E.rtt[_]){const z=this.pool.getObjectForId(E.rtt[_].id);if(z.stamp===E.rtt[_].stamp){this.pool.useObject(z);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),E.rtt[_]={id:C.id,stamp:C.stamp},p.context.bindFramebuffer.set(C.fbo.framebuffer),p.context.clear({color:c.aM.transparent,stencil:0}),p.currentStencilSource=void 0;for(let z=0;z{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},Q_={showCompass:!0,showZoom:!0,visualizePitch:!1};class e0{constructor(r,u,p=!1){this.mousedown=S=>{this.startMouse(c.e({},S,{ctrlKey:!0,preventDefault:()=>S.preventDefault()}),M.mousePos(this.element,S)),M.addEventListener(window,"mousemove",this.mousemove),M.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=S=>{this.moveMouse(S,M.mousePos(this.element,S))},this.mouseup=S=>{this.mouseRotate.dragEnd(S),this.mousePitch&&this.mousePitch.dragEnd(S),this.offTemp()},this.touchstart=S=>{S.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=M.touchPos(this.element,S.targetTouches)[0],this.startTouch(S,this._startPos),M.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.addEventListener(window,"touchend",this.touchend))},this.touchmove=S=>{S.targetTouches.length!==1?this.reset():(this._lastPos=M.touchPos(this.element,S.targetTouches)[0],this.moveTouch(S,this._lastPos))},this.touchend=S=>{S.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=r.dragRotate._mouseRotate.getClickTolerance(),_=r.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=bd({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:S,clickTolerance:E,bearingDegreesPerPixelMoved:C=.8})=>{const z=new wd;return new lo({clickTolerance:E,move:(F,B)=>({bearingDelta:(B.x-F.x)*C}),moveStateManager:z,enable:S,assignEvents:Ld})})({clickTolerance:m,enable:!0}),this.map=r,p&&(this.mousePitch=Sd({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:S,clickTolerance:E,pitchDegreesPerPixelMoved:C=-.5})=>{const z=new wd;return new lo({clickTolerance:E,move:(F,B)=>({pitchDelta:(B.y-F.y)*C}),moveStateManager:z,enable:S,assignEvents:Ld})})({clickTolerance:_,enable:!0})),M.addEventListener(u,"mousedown",this.mousedown),M.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),M.addEventListener(u,"touchcancel",this.reset)}startMouse(r,u){this.mouseRotate.dragStart(r,u),this.mousePitch&&this.mousePitch.dragStart(r,u),M.disableDrag()}startTouch(r,u){this.touchRotate.dragStart(r,u),this.touchPitch&&this.touchPitch.dragStart(r,u),M.disableDrag()}moveMouse(r,u){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(r,u)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(r,u)||{};_&&p.setPitch(p.getPitch()+_)}}moveTouch(r,u){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(r,u)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(r,u)||{};_&&p.setPitch(p.getPitch()+_)}}off(){const r=this.element;M.removeEventListener(r,"mousedown",this.mousedown),M.removeEventListener(r,"touchstart",this.touchstart,{passive:!1}),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend),M.removeEventListener(r,"touchcancel",this.reset),this.offTemp()}offTemp(){M.enableDrag(),M.removeEventListener(window,"mousemove",this.mousemove),M.removeEventListener(window,"mouseup",this.mouseup),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend)}}let Ri;function Vr(v,r,u){const p=new c.N(v.lng,v.lat);if(v=new c.N(v.lng,v.lat),r){const m=new c.N(v.lng-360,v.lat),_=new c.N(v.lng+360,v.lat),S=u.locationPoint(v).distSqr(r);u.locationPoint(m).distSqr(r)180;){const m=u.locationPoint(v);if(m.x>=0&&m.y>=0&&m.x<=u.width&&m.y<=u.height)break;v.lng>u.center.lng?v.lng-=360:v.lng+=360}return v.lng!==p.lng&&u.locationPoint(v).y>u.height/2-u.getHorizon()?v:p}const il={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 Tc(v,r,u){const p=v.classList;for(const m in il)p.remove(`maplibregl-${u}-anchor-${m}`);p.add(`maplibregl-${u}-anchor-${r}`)}class Ec extends c.E{constructor(r){if(super(),this._onKeyPress=u=>{const p=u.code,m=u.charCode||u.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=u=>{const p=u.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=u=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vr(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let S="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?S="rotateX(0deg)":this._pitchAlignment==="map"&&(S=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||u&&u.type!=="moveend"||(this._pos=this._pos.round()),M.setTransform(this._element,`${il[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${S} ${_}`),A.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=u.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 c.k("dragstart"))),this.fire(new c.k("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 c.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.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=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._subpixelPositioning=r&&r.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment!=="auto"?r.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(r==null?void 0:r.opacity,r==null?void 0:r.opacityWhenCovered),r&&r.element)this._element=r.element,this._offset=c.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=M.create("div");const u=M.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${p}px`),u.setAttributeNS(null,"width",`${m}px`),u.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const _=M.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const S=M.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill-rule","nonzero");const E=M.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(3.0, 29.0)"),E.setAttributeNS(null,"fill","#000000");const 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(const me of C){const we=M.createNS("http://www.w3.org/2000/svg","ellipse");we.setAttributeNS(null,"opacity","0.04"),we.setAttributeNS(null,"cx","10.5"),we.setAttributeNS(null,"cy","5.80029008"),we.setAttributeNS(null,"rx",me.rx),we.setAttributeNS(null,"ry",me.ry),E.appendChild(we)}const z=M.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);const F=M.createNS("http://www.w3.org/2000/svg","path");F.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(F);const B=M.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"opacity","0.25"),B.setAttributeNS(null,"fill","#000000");const X=M.createNS("http://www.w3.org/2000/svg","path");X.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"),B.appendChild(X);const Q=M.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Q.setAttributeNS(null,"fill","#FFFFFF");const re=M.createNS("http://www.w3.org/2000/svg","g");re.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ce=M.createNS("http://www.w3.org/2000/svg","circle");ce.setAttributeNS(null,"fill","#000000"),ce.setAttributeNS(null,"opacity","0.25"),ce.setAttributeNS(null,"cx","5.5"),ce.setAttributeNS(null,"cy","5.5"),ce.setAttributeNS(null,"r","5.4999962");const pe=M.createNS("http://www.w3.org/2000/svg","circle");pe.setAttributeNS(null,"fill","#FFFFFF"),pe.setAttributeNS(null,"cx","5.5"),pe.setAttributeNS(null,"cy","5.5"),pe.setAttributeNS(null,"r","5.4999962"),re.appendChild(ce),re.appendChild(pe),S.appendChild(E),S.appendChild(z),S.appendChild(B),S.appendChild(Q),S.appendChild(re),u.appendChild(S),u.setAttributeNS(null,"height",p*this._scale+"px"),u.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(r&&r.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),Tc(this._element,this._anchor,"marker"),r&&r.className)for(const u of r.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(r){return this.remove(),this._map=r,this._element.setAttribute("aria-label",r._getUIString("Marker.Title")),r.getCanvasContainer().appendChild(this._element),r.on("move",this._update),r.on("moveend",this._update),r.on("terrain",this._update),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("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),M.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=c.N.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const m=Math.abs(13.5)/Math.SQRT2;r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(r){return this._subpixelPositioning=r,this}getPopup(){return this._popup}togglePopup(){const r=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:r?(r.isOpen()?r.remove():(r.setLngLat(this._lngLat),r.addTo(this._map)),this):this}_updateOpacity(r=!1){var u,p;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(r)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),S=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,S)-_<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/m.transform._pixelPerMeter,C=Math.sin(m.getPitch()*Math.PI/180)*E,z=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),F=m.transform.lngLatToCameraDepth(this._lngLat,S+C)-z>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&F&&this._popup.remove(),this._element.style.opacity=F?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(r){return this._offset=c.P.convert(r),this._update(),this}addClassName(r){this._element.classList.add(r)}removeClassName(r){this._element.classList.remove(r)}toggleClassName(r){return this._element.classList.toggle(r)}setDraggable(r){return this._draggable=!!r,this._map&&(r?(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(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r&&r!=="auto"?r:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(r,u){return r===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),r!==void 0&&(this._opacity=r),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const lm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let lu=0,uu=!1;const Hs={maxWidth:100,unit:"metric"};function cu(v,r,u){const p=u&&u.maxWidth||100,m=v._container.clientHeight/2,_=v.unproject([0,m]),S=v.unproject([p,m]),E=_.distanceTo(S);if(u&&u.unit==="imperial"){const C=3.2808*E;C>5280?It(r,p,C/5280,v._getUIString("ScaleControl.Miles")):It(r,p,C,v._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?It(r,p,E/1852,v._getUIString("ScaleControl.NauticalMiles")):E>=1e3?It(r,p,E/1e3,v._getUIString("ScaleControl.Kilometers")):It(r,p,E,v._getUIString("ScaleControl.Meters"))}function It(v,r,u,p){const m=function(_){const S=Math.pow(10,`${Math.floor(_)}`.length-1);let E=_/S;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:E>=1?1:function(C){const z=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*z)/z}(E),S*E}(u);v.style.width=r*(m/u)+"px",v.innerHTML=`${m} ${p}`}const jt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Cc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ic(v){if(v){if(typeof v=="number"){const r=Math.round(Math.abs(v)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,v),"top-left":new c.P(r,r),"top-right":new c.P(-r,r),bottom:new c.P(0,-v),"bottom-left":new c.P(r,-r),"bottom-right":new c.P(-r,-r),left:new c.P(v,0),right:new c.P(-v,0)}}if(v instanceof c.P||Array.isArray(v)){const r=c.P.convert(v);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:c.P.convert(v.center||[0,0]),top:c.P.convert(v.top||[0,0]),"top-left":c.P.convert(v["top-left"]||[0,0]),"top-right":c.P.convert(v["top-right"]||[0,0]),bottom:c.P.convert(v.bottom||[0,0]),"bottom-left":c.P.convert(v["bottom-left"]||[0,0]),"bottom-right":c.P.convert(v["bottom-right"]||[0,0]),left:c.P.convert(v.left||[0,0]),right:c.P.convert(v.right||[0,0])}}return Ic(new c.P(0,0))}const Od=T;g.AJAXError=c.bh,g.Evented=c.E,g.LngLat=c.N,g.MercatorCoordinate=c.Z,g.Point=c.P,g.addProtocol=c.bi,g.config=c.a,g.removeProtocol=c.bj,g.AttributionControl=rl,g.BoxZoomHandler=zi,g.CanvasSource=at,g.CooperativeGesturesHandler=el,g.DoubleClickZoomHandler=la,g.DragPanHandler=nm,g.DragRotateHandler=im,g.EdgeInsets=Xa,g.FullscreenControl=class extends c.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var r;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((r=u==null?void 0:u.shadowRoot)===null||r===void 0)&&r.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:c.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(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){M.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=M.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);M.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},g.GeoJSONSource=tt,g.GeolocateControl=class extends c.E{constructor(v){super(),this._onSuccess=r=>{if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,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(r),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",r)),this._finish()}},this._updateCamera=r=>{const u=new c.N(r.coords.longitude,r.coords.latitude),p=r.coords.accuracy,m=this._map.getBearing(),_=c.e({bearing:m},this.options.fitBoundsOptions),S=ie.fromLngLat(u,p);this._map.fitBounds(S,_,{geolocateSource:!0})},this._updateMarker=r=>{if(r){const u=new c.N(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=r=>{if(this._map){if(this.options.trackUserLocation)if(r.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;const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&uu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",r)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=M.create("button","maplibregl-ctrl-geolocate",this._container),M.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=r=>{if(this._map){if(r===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=M.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ec({element:this._dotElement}),this._circleElement=M.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ec({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},lm,v)}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(r=!1){if(Ri!==void 0&&!r)return Ri;if(window.navigator.permissions===void 0)return Ri=!!window.navigator.geolocation,Ri;try{Ri=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ri=!!window.navigator.geolocation}return Ri})}().then(r=>this._finishSetupUI(r)),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(),M.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,lu=0,uu=!1}_isOutOfMapMaxBounds(v){const r=this._map.getMaxBounds(),u=v.coords;return r&&(u.longituder.getEast()||u.latituder.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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),r=v.getSouthEast(),u=v.getNorthEast(),p=r.distanceTo(u),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":lu--,uu=!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 c.k("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 c.k("trackuserlocationstart")),this.fire(new c.k("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 v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),lu++,lu>1?(v={maximumAge:6e5,timeout:0},uu=!0):(v=this.options.positionOptions,uu=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}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)}},g.Hash=gc,g.ImageSource=ot,g.KeyboardHandler=Ji,g.LngLatBounds=ie,g.LogoControl=Ad,g.Map=class extends sm{constructor(v){c.bf.mark(c.bg.create);const r=Object.assign(Object.assign({},J_),v);if(r.minZoom!=null&&r.maxZoom!=null&&r.minZoom>r.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(r.minPitch!=null&&r.maxPitch!=null&&r.minPitch>r.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(r.minPitch!=null&&r.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(r.maxPitch!=null&&r.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ka(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),{bearingSnap:r.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ur,this._controls=[],this._mapId=c.a4(),this._contextLost=u=>{u.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:u}))},this._contextRestored=u=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:u}))},this._onMapScroll=u=>{if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=r.preserveDrawingBuffer===!0,this._antialias=r.antialias===!0,this._trackResize=r.trackResize===!0,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles===!0,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=r.crossSourceCollisions===!0,this._collectResourceTiming=r.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Rd),r.locale),this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this.transformCameraUpdate=r.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=r.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=q.addThrottleControl(()=>this.isMoving()),this._requestManager=new ne(r.transformRequest),typeof r.container=="string"){if(this._container=document.getElementById(r.container),!this._container)throw new Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let u=!1;const p=nu(m=>{this._trackResize&&!this._removed&&(this.resize(m),this.redraw())},50);this._resizeObserver=new ResizeObserver(m=>{u?p(m):u=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Md(this,r),this._hash=r.hash&&new gc(typeof r.hash=="string"&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,c.e({},r.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new rl(typeof r.attributionControl=="boolean"?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new Ad,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new c.k(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new c.k(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new c.k("sourcedataabort",u))})}_getMapId(){return this._mapId}addControl(v,r){if(r===void 0&&(r=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=v.onAdd(this);this._controls.push(v);const p=this._controlPositions[r];return r.indexOf("bottom")!==-1?p.insertBefore(u,p.firstChild):p.appendChild(u),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(v);return r>-1&&this._controls.splice(r,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,r,u,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,r,u,p)}resize(v){var r;const u=this._containerDimensions(),p=u[0],m=u[1],_=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,_),this.painter.resize(p,m,_),this.painter.overLimit()){const E=this.painter.context.gl;this._maxCanvasSize=[E.drawingBufferWidth,E.drawingBufferHeight];const C=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,C),this.painter.resize(p,m,C)}this.transform.resize(p,m),(r=this._requestedCameraState)===null||r===void 0||r.resize(p,m);const S=!this._moving;return S&&(this.stop(),this.fire(new c.k("movestart",v)).fire(new c.k("move",v))),this.fire(new c.k("resize",v)),S&&this.fire(new c.k("moveend",v)),this}_getClampedPixelRatio(v,r){const{0:u,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),_=v*m,S=r*m;return Math.min(_>u?u/_:1,S>p?p/S:1)*m}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(ie.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(c.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(c.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,r,u){if(v==="mouseenter"||v==="mouseover"){let p=!1;return{layers:r,listener:u,delegates:{mousemove:_=>{const S=r.filter(C=>this.getLayer(C)),E=S.length!==0?this.queryRenderedFeatures(_.point,{layers:S}):[];E.length?p||(p=!0,u.call(this,new Wn(v,this,_.originalEvent,{features:E}))):p=!1},mouseout:()=>{p=!1}}}}if(v==="mouseleave"||v==="mouseout"){let p=!1;return{layers:r,listener:u,delegates:{mousemove:S=>{const E=r.filter(C=>this.getLayer(C));(E.length!==0?this.queryRenderedFeatures(S.point,{layers:E}):[]).length?p=!0:p&&(p=!1,u.call(this,new Wn(v,this,S.originalEvent)))},mouseout:S=>{p&&(p=!1,u.call(this,new Wn(v,this,S.originalEvent)))}}}}{const p=m=>{const _=r.filter(E=>this.getLayer(E)),S=_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[];S.length&&(m.features=S,u.call(this,m),delete m.features)};return{layers:r,listener:u,delegates:{[v]:p}}}}_saveDelegatedListener(v,r){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(r)}_removeDelegatedListener(v,r,u){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const p=this._delegatedListeners[v];for(let m=0;mr.includes(S))){for(const S in _.delegates)this.off(S,_.delegates[S]);return void p.splice(m,1)}}}on(v,r,u){if(u===void 0)return super.on(v,r);const p=this._createDelegatedListener(v,typeof r=="string"?[r]:r,u);this._saveDelegatedListener(v,p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(v,r,u){if(u===void 0)return super.once(v,r);const p=typeof r=="string"?[r]:r,m=this._createDelegatedListener(v,p,u);for(const _ in m.delegates){const S=m.delegates[_];m.delegates[_]=(...E)=>{this._removeDelegatedListener(v,p,u),S(...E)}}this._saveDelegatedListener(v,m);for(const _ in m.delegates)this.once(_,m.delegates[_]);return this}off(v,r,u){return u===void 0?super.off(v,r):(this._removeDelegatedListener(v,typeof r=="string"?[r]:r,u),this)}queryRenderedFeatures(v,r){if(!this.style)return[];let u;const p=v instanceof c.P||Array.isArray(v),m=p?v:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(p?{}:v)||{},m instanceof c.P||typeof m[0]=="number")u=[c.P.convert(m)];else{const _=c.P.convert(m[0]),S=c.P.convert(m[1]);u=[_,new c.P(S.x,_.y),S,new c.P(_.x,S.y),_]}return this.style.queryRenderedFeatures(u,r,this.transform)}querySourceFeatures(v,r){return this.style.querySourceFeatures(v,r)}setStyle(v,r){return(r=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(v,r))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const r=this._locale[v];if(r==null)throw new Error(`Missing UI string '${v}'`);return r}_updateStyle(v,r){if(r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,r));const u=this.style&&r.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new Qu(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,r,u):this.style.loadJSON(v,r,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Qu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,r){if(typeof v=="string"){const u=this._requestManager.transformRequest(v,"Style");c.h(u,new AbortController).then(p=>{this._updateDiff(p.data,r)}).catch(p=>{p&&this.fire(new c.j(p))})}else typeof v=="object"&&this._updateDiff(v,r)}_updateDiff(v,r){try{this.style.setState(v,r)&&this._update(!0)}catch(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(v,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(v,r){return this._lazyInitEmptyStyle(),this.style.addSource(v,r),this._update(!0)}isSourceLoaded(v){const r=this.style&&this.style.sourceCaches[v];if(r!==void 0)return r.loaded();this.fire(new c.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const r=this.style.sourceCaches[v.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&r.reload();for(const u in this.style._layers){const p=this.style._layers[u];p.type==="hillshade"&&p.source===v.source&&c.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.")}this.terrain=new zd(this.painter,r,v),this.painter.renderToTexture=new om(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(u.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:v})),this}getTerrain(){var v,r;return(r=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&r!==void 0?r:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const r in v){const u=v[r]._tiles;for(const p in u){const m=u[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,r,u={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:z}=u;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||c.b(r))){if(r.width===void 0||r.height===void 0)return this.fire(new c.j(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`")));{const{width:F,height:B,data:X}=r,Q=r;return this.style.addImage(v,{data:new c.R({width:F,height:B},new Uint8Array(X)),pixelRatio:p,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:z,sdf:m,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,v),this}}{const{width:F,height:B,data:X}=A.getImageData(r);this.style.addImage(v,{data:new c.R({width:F,height:B},X),pixelRatio:p,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:z,sdf:m,version:0})}}updateImage(v,r){const u=this.style.getImage(v);if(!u)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=r instanceof HTMLImageElement||c.b(r)?A.getImageData(r):r,{width:m,height:_,data:S}=p;if(m===void 0||_===void 0)return this.fire(new c.j(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(m!==u.data.width||_!==u.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const E=!(r instanceof HTMLImageElement||c.b(r));return u.data.replace(S,E),this.style.updateImage(v,u),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return q.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,r){return this._lazyInitEmptyStyle(),this.style.addLayer(v,r),this._update(!0)}moveLayer(v,r){return this.style.moveLayer(v,r),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,r,u){return this.style.setLayerZoomRange(v,r,u),this._update(!0)}setFilter(v,r,u={}){return this.style.setFilter(v,r,u),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,r,u,p={}){return this.style.setPaintProperty(v,r,u,p),this._update(!0)}getPaintProperty(v,r){return this.style.getPaintProperty(v,r)}setLayoutProperty(v,r,u,p={}){return this.style.setLayoutProperty(v,r,u,p),this._update(!0)}getLayoutProperty(v,r){return this.style.getLayoutProperty(v,r)}setGlyphs(v,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,r,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,r,u,p=>{p||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,r,u=>{u||this._update(!0)}),this}setLight(v,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,r){return this.style.setFeatureState(v,r),this._update()}removeFeatureState(v,r){return this.style.removeFeatureState(v,r),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,r=0;return this._container&&(v=this._container.clientWidth||400,r=this._container.clientHeight||300),[v,r]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const r=this._canvasContainer=M.create("div","maplibregl-canvas-container",v);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=M.create("canvas","maplibregl-canvas",r),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");const u=this._containerDimensions(),p=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],p);const m=this._controlContainer=M.create("div","maplibregl-control-container",v),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(S=>{_[S]=M.create("div",`maplibregl-ctrl-${S} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,r,u){this._canvas.width=Math.floor(u*v),this._canvas.height=Math.floor(u*r),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${r}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let r=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{r={requestedAttributes:v},p&&(r.statusMessage=p.statusMessage,r.type=p.type)},{once:!0});const u=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!u){const p="Failed to initialize WebGL";throw r?(r.message=p,new Error(JSON.stringify(r))):new Error(p)}this.painter=new mc(u,this.transform),N.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=A.now();this.style.zoomHistory.update(m,_);const S=new c.z(m,{now:_,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),E=S.crossFadingFactor();E===1&&E===this._crossFadingFactor||(u=!0,this._crossFadingFactor=E),this.style.update(S)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bf.mark(c.bg.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,c.bf.mark(c.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const u of this._controls)u.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),q.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r!=null&&r.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),M.remove(this._canvasContainer),M.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bf.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(v=>{c.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return am}getCameraTargetElevation(){return this.transform.elevation}},g.MapMouseEvent=Wn,g.MapTouchEvent=oa,g.MapWheelEvent=em,g.Marker=Ec,g.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const r=this._map.getZoom(),u=r===this._map.getMaxZoom(),p=r===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=r},this._setButtonTitle=(r,u)=>{const p=this._map._getUIString(`NavigationControl.${u}`);r.title=p,r.setAttribute("aria-label",p)},this.options=c.e({},Q_,v),this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),M.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),M.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=M.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new e0(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){M.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(v,r){const u=M.create("button",v,this._container);return u.type="button",u.addEventListener("click",r),u}},g.Popup=class extends c.E{constructor(v){super(),this.remove=()=>(this._content&&M.remove(this._content),this._container&&(M.remove(this._container),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("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=r=>{this._update(r.point)},this._onMouseMove=r=>{this._update(r.point)},this._onDrag=r=>{this._update(r.point)},this._update=r=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=M.create("div","maplibregl-popup",this._map.getContainer()),this._tip=M.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const E of this.options.className.split(" "))this._container.classList.add(E);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Vr(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!r)return;const p=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const _=Ic(this.options.offset);if(!m){const E=this._container.offsetWidth,C=this._container.offsetHeight;let z;z=p.y+_.bottom.ythis._map.transform.height-C?["bottom"]:[],p.xthis._map.transform.width-E/2&&z.push("right"),m=z.length===0?"bottom":z.join("-")}let S=p.add(_[m]);this.options.subpixelPositioning||(S=S.round()),M.setTransform(this._container,`${il[m]} translate(${S.x}px,${S.y}px)`),Tc(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(jt),v)}addTo(v){return this._map&&this.remove(),this._map=v,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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=c.N.convert(v),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),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._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const r=document.createDocumentFragment(),u=document.createElement("body");let p;for(u.innerHTML=v;p=u.firstChild,p;)r.appendChild(p);return this.setDOMContent(r)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=M.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=M.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Cc);v&&v.focus()}},g.RasterDEMTileSource=Ge,g.RasterTileSource=Te,g.ScaleControl=class{constructor(v){this._onMove=()=>{cu(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,cu(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hs),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){M.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},g.ScrollZoomHandler=vs,g.Style=Qu,g.TerrainControl=class{constructor(v){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=v}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=M.create("button","maplibregl-ctrl-terrain",this._container),M.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(){M.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},g.TwoFingersTouchPitchHandler=Qa,g.TwoFingersTouchRotateHandler=Cd,g.TwoFingersTouchZoomHandler=Td,g.TwoFingersTouchZoomRotateHandler=Pd,g.VectorTileSource=se,g.VideoSource=kt,g.addSourceType=(v,r)=>c._(void 0,void 0,void 0,function*(){if(Tr(v))throw new Error(`A source type called "${v}" already exists.`);((u,p)=>{Bt[u]=p})(v,r)}),g.clearPrewarmedResources=function(){const v=er;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(nt),er=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()"))},g.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},g.getRTLTextPluginStatus=function(){return vn().getRTLTextPluginStatus()},g.getVersion=function(){return Od},g.getWorkerCount=function(){return rt.workerCount},g.getWorkerUrl=function(){return c.a.WORKER_URL},g.importScriptInWorkers=function(v){return fr().broadcast("IS",v)},g.prewarm=function(){Yt().acquire(nt)},g.setMaxParallelImageRequests=function(v){c.a.MAX_PARALLEL_IMAGE_REQUESTS=v},g.setRTLTextPlugin=function(v,r){return vn().setRTLTextPlugin(v,r)},g.setWorkerCount=function(v){rt.workerCount=v},g.setWorkerUrl=function(v){c.a.WORKER_URL=v}});var f=i;return f})})(gP);var D4=gP.exports;const _P=dp(D4),z4={version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:"© OpenStreetMap Contributors",maxzoom:19}},layers:[{id:"osm",type:"raster",source:"osm"}]};var Uh={};/** +`),ae=E.createShader(E.FRAGMENT_SHADER);if(E.isContextLost())return void(this.failedToCreate=!0);if(E.shaderSource(ae,me),E.compileShader(ae),!E.getShaderParameter(ae,E.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${E.getShaderInfoLog(ae)}`);E.attachShader(this.program,ae);const Ce=E.createShader(E.VERTEX_SHADER);if(E.isContextLost())return void(this.failedToCreate=!0);if(E.shaderSource(Ce,we),E.compileShader(Ce),!E.getShaderParameter(Ce,E.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${E.getShaderInfoLog(Ce)}`);E.attachShader(this.program,Ce),this.attributes={};const Pe={};this.numAttributes=F.length;for(let ze=0;ze({u_depth:new c.aH(ze,Xe.u_depth),u_terrain:new c.aH(ze,Xe.u_terrain),u_terrain_dim:new c.aI(ze,Xe.u_terrain_dim),u_terrain_matrix:new c.aJ(ze,Xe.u_terrain_matrix),u_terrain_unpack:new c.aK(ze,Xe.u_terrain_unpack),u_terrain_exaggeration:new c.aI(ze,Xe.u_terrain_exaggeration)}))(r,Pe),this.binderUniforms=p?p.getUniforms(r,Pe):[]}draw(r,u,p,m,_,S,E,C,z,F,B,X,Q,re,ce,pe,me,we){const ae=r.gl;if(this.failedToCreate)return;if(r.program.set(this.program),r.setDepthMode(p),r.setStencilMode(m),r.setColorMode(_),r.setCullFace(S),C){r.activeTexture.set(ae.TEXTURE2),ae.bindTexture(ae.TEXTURE_2D,C.depthTexture),r.activeTexture.set(ae.TEXTURE3),ae.bindTexture(ae.TEXTURE_2D,C.texture);for(const Pe in this.terrainUniforms)this.terrainUniforms[Pe].set(C[Pe])}for(const Pe in this.fixedUniforms)this.fixedUniforms[Pe].set(E[Pe]);ce&&ce.setUniforms(r,this.binderUniforms,Q,{zoom:re});let Ce=0;switch(u){case ae.LINES:Ce=2;break;case ae.TRIANGLES:Ce=3;break;case ae.LINE_STRIP:Ce=1}for(const Pe of X.get()){const ze=Pe.vaos||(Pe.vaos={});(ze[z]||(ze[z]=new Kh)).bind(r,this,F,ce?ce.getPaintVertexBuffers():[],B,Pe.vertexOffset,pe,me,we),ae.drawElements(u,Pe.primitiveLength*Ce,ae.UNSIGNED_SHORT,Pe.primitiveOffset*Ce*2)}}}function tc(v,r,u){const p=1/or(u,1,r.transform.tileZoom),m=Math.pow(2,u.tileID.overscaledZ),_=u.tileSize*Math.pow(2,r.transform.tileZoom)/m,S=_*(u.tileID.canonical.x+u.tileID.wrap*m),E=_*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[p,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[S>>16,E>>16],u_pixel_coord_lower:[65535&S,65535&E]}}const ql=(v,r,u,p)=>{const m=r.style.light,_=m.properties.get("position"),S=[_.x,_.y,_.z],E=function(){var z=new c.A(9);return c.A!=Float32Array&&(z[1]=0,z[2]=0,z[3]=0,z[5]=0,z[6]=0,z[7]=0),z[0]=1,z[4]=1,z[8]=1,z}();m.properties.get("anchor")==="viewport"&&function(z,F){var B=Math.sin(F),X=Math.cos(F);z[0]=X,z[1]=B,z[2]=0,z[3]=-B,z[4]=X,z[5]=0,z[6]=0,z[7]=0,z[8]=1}(E,-r.transform.angle),function(z,F,B){var X=F[0],Q=F[1],re=F[2];z[0]=X*B[0]+Q*B[3]+re*B[6],z[1]=X*B[1]+Q*B[4]+re*B[7],z[2]=X*B[2]+Q*B[5]+re*B[8]}(S,S,E);const C=m.properties.get("color");return{u_matrix:v,u_lightpos:S,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:p}},rc=(v,r,u,p,m,_,S)=>c.e(ql(v,r,u,p),tc(_,r,S),{u_height_factor:-Math.pow(2,m.overscaledZ)/S.tileSize/8}),$a=v=>({u_matrix:v}),Mp=(v,r,u,p)=>c.e($a(v),tc(u,r,p)),A_=(v,r)=>({u_matrix:v,u_world:r}),Ap=(v,r,u,p,m)=>c.e(Mp(v,r,u,p),{u_world:m}),D_=(v,r,u,p)=>{const m=v.transform;let _,S;if(p.paint.get("circle-pitch-alignment")==="map"){const E=or(u,1,m.zoom);_=!0,S=[E,E]}else _=!1,S=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(r.posMatrix,u,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+_,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:S}},Qo=(v,r,u)=>({u_matrix:v,u_inv_matrix:r,u_camera_to_center_distance:u.cameraToCenterDistance,u_viewport_size:[u.width,u.height]}),Yl=(v,r,u=1)=>({u_matrix:v,u_color:r,u_overlay:0,u_overlay_scale:u}),gi=v=>({u_matrix:v}),yi=(v,r,u,p)=>({u_matrix:v,u_extrude_scale:or(r,1,u),u_intensity:p}),nc=(v,r,u,p)=>{const m=c.H();c.aP(m,0,v.width,v.height,0,0,1);const _=v.context.gl;return{u_matrix:m,u_world:[_.drawingBufferWidth,_.drawingBufferHeight],u_image:u,u_color_ramp:p,u_opacity:r.paint.get("heatmap-opacity")}};function ic(v,r){const u=Math.pow(2,r.canonical.z),p=r.canonical.y;return[new c.Z(0,p/u).toLngLat().lat,new c.Z(0,(p+1)/u).toLngLat().lat]}const sc=(v,r,u,p)=>{const m=v.transform;return{u_matrix:Rp(v,r,u,p),u_ratio:1/or(r,1,m.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Dp=(v,r,u,p,m)=>c.e(sc(v,r,u,m),{u_image:0,u_image_height:p}),ja=(v,r,u,p,m)=>{const _=v.transform,S=zp(r,_);return{u_matrix:Rp(v,r,u,m),u_texsize:r.imageAtlasTexture.size,u_ratio:1/or(r,1,_.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[S,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/_.pixelsToGLUnits[0],1/_.pixelsToGLUnits[1]]}},z_=(v,r,u,p,m,_)=>{const S=v.lineAtlas,E=zp(r,v.transform),C=u.layout.get("line-cap")==="round",z=S.getDash(p.from,C),F=S.getDash(p.to,C),B=z.width*m.fromScale,X=F.width*m.toScale;return c.e(sc(v,r,u,_),{u_patternscale_a:[E/B,-z.height/2],u_patternscale_b:[E/X,-F.height/2],u_sdfgamma:S.width/(256*Math.min(B,X)*v.pixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:F.y,u_mix:m.t})};function zp(v,r){return 1/or(v,1,r.tileZoom)}function Rp(v,r,u,p){return v.translatePosMatrix(p?p.posMatrix:r.tileID.posMatrix,r,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const R_=(v,r,u,p,m)=>{return{u_matrix:v,u_tl_parent:r,u_scale_parent:u,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(S=m.paint.get("raster-saturation"),S>0?1-1/(1.001-S):-S),u_contrast_factor:(_=m.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:L_(m.paint.get("raster-hue-rotate"))};var _,S};function L_(v){v*=Math.PI/180;const r=Math.sin(v),u=Math.cos(v);return[(2*u+1)/3,(-Math.sqrt(3)*r-u+1)/3,(Math.sqrt(3)*r-u+1)/3]}const Lp=(v,r,u,p,m,_,S,E,C,z,F,B,X,Q)=>{const re=S.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:re.cameraToCenterDistance,u_pitch:re.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:re.width/re.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:E,u_label_plane_matrix:C,u_coord_matrix:z,u_is_text:+B,u_pitch_with_map:+p,u_is_along_line:m,u_is_variable_anchor:_,u_texsize:X,u_texture:0,u_translation:F,u_pitched_scale:Q}},Xl=(v,r,u,p,m,_,S,E,C,z,F,B,X,Q,re)=>{const ce=S.transform;return c.e(Lp(v,r,u,p,m,_,S,E,C,z,F,B,X,re),{u_gamma_scale:p?Math.cos(ce._pitch)*ce.cameraToCenterDistance:1,u_device_pixel_ratio:S.pixelRatio,u_is_halo:+Q})},ed=(v,r,u,p,m,_,S,E,C,z,F,B,X,Q)=>c.e(Xl(v,r,u,p,m,_,S,E,C,z,F,!0,B,!0,Q),{u_texsize_icon:X,u_texture_icon:1}),oc=(v,r,u)=>({u_matrix:v,u_opacity:r,u_color:u}),td=(v,r,u,p,m,_)=>c.e(function(S,E,C,z){const F=C.imageManager.getPattern(S.from.toString()),B=C.imageManager.getPattern(S.to.toString()),{width:X,height:Q}=C.imageManager.getPixelSize(),re=Math.pow(2,z.tileID.overscaledZ),ce=z.tileSize*Math.pow(2,C.transform.tileZoom)/re,pe=ce*(z.tileID.canonical.x+z.tileID.wrap*re),me=ce*z.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:F.tl,u_pattern_br_a:F.br,u_pattern_tl_b:B.tl,u_pattern_br_b:B.br,u_texsize:[X,Q],u_mix:E.t,u_pattern_size_a:F.displaySize,u_pattern_size_b:B.displaySize,u_scale_a:E.fromScale,u_scale_b:E.toScale,u_tile_units_to_pixels:1/or(z,1,C.transform.tileZoom),u_pixel_coord_upper:[pe>>16,me>>16],u_pixel_coord_lower:[65535&pe,65535&me]}}(p,_,u,m),{u_matrix:v,u_opacity:r}),rd={fillExtrusion:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_lightpos:new c.aN(v,r.u_lightpos),u_lightintensity:new c.aI(v,r.u_lightintensity),u_lightcolor:new c.aN(v,r.u_lightcolor),u_vertical_gradient:new c.aI(v,r.u_vertical_gradient),u_opacity:new c.aI(v,r.u_opacity)}),fillExtrusionPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_lightpos:new c.aN(v,r.u_lightpos),u_lightintensity:new c.aI(v,r.u_lightintensity),u_lightcolor:new c.aN(v,r.u_lightcolor),u_vertical_gradient:new c.aI(v,r.u_vertical_gradient),u_height_factor:new c.aI(v,r.u_height_factor),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade),u_opacity:new c.aI(v,r.u_opacity)}),fill:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix)}),fillPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),fillOutline:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world)}),fillOutlinePattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),circle:(v,r)=>({u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_scale_with_map:new c.aH(v,r.u_scale_with_map),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_extrude_scale:new c.aO(v,r.u_extrude_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_matrix:new c.aJ(v,r.u_matrix)}),collisionBox:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_pixel_extrude_scale:new c.aO(v,r.u_pixel_extrude_scale)}),collisionCircle:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_inv_matrix:new c.aJ(v,r.u_inv_matrix),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_viewport_size:new c.aO(v,r.u_viewport_size)}),debug:(v,r)=>({u_color:new c.aL(v,r.u_color),u_matrix:new c.aJ(v,r.u_matrix),u_overlay:new c.aH(v,r.u_overlay),u_overlay_scale:new c.aI(v,r.u_overlay_scale)}),clippingMask:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix)}),heatmap:(v,r)=>({u_extrude_scale:new c.aI(v,r.u_extrude_scale),u_intensity:new c.aI(v,r.u_intensity),u_matrix:new c.aJ(v,r.u_matrix)}),heatmapTexture:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world),u_image:new c.aH(v,r.u_image),u_color_ramp:new c.aH(v,r.u_color_ramp),u_opacity:new c.aI(v,r.u_opacity)}),hillshade:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_latrange:new c.aO(v,r.u_latrange),u_light:new c.aO(v,r.u_light),u_shadow:new c.aL(v,r.u_shadow),u_highlight:new c.aL(v,r.u_highlight),u_accent:new c.aL(v,r.u_accent)}),hillshadePrepare:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_dimension:new c.aO(v,r.u_dimension),u_zoom:new c.aI(v,r.u_zoom),u_unpack:new c.aK(v,r.u_unpack)}),line:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels)}),lineGradient:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_image:new c.aH(v,r.u_image),u_image_height:new c.aI(v,r.u_image_height)}),linePattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texsize:new c.aO(v,r.u_texsize),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_image:new c.aH(v,r.u_image),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),lineSDF:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_patternscale_a:new c.aO(v,r.u_patternscale_a),u_patternscale_b:new c.aO(v,r.u_patternscale_b),u_sdfgamma:new c.aI(v,r.u_sdfgamma),u_image:new c.aH(v,r.u_image),u_tex_y_a:new c.aI(v,r.u_tex_y_a),u_tex_y_b:new c.aI(v,r.u_tex_y_b),u_mix:new c.aI(v,r.u_mix)}),raster:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_tl_parent:new c.aO(v,r.u_tl_parent),u_scale_parent:new c.aI(v,r.u_scale_parent),u_buffer_scale:new c.aI(v,r.u_buffer_scale),u_fade_t:new c.aI(v,r.u_fade_t),u_opacity:new c.aI(v,r.u_opacity),u_image0:new c.aH(v,r.u_image0),u_image1:new c.aH(v,r.u_image1),u_brightness_low:new c.aI(v,r.u_brightness_low),u_brightness_high:new c.aI(v,r.u_brightness_high),u_saturation_factor:new c.aI(v,r.u_saturation_factor),u_contrast_factor:new c.aI(v,r.u_contrast_factor),u_spin_weights:new c.aN(v,r.u_spin_weights)}),symbolIcon:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texture:new c.aH(v,r.u_texture),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),symbolSDF:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texture:new c.aH(v,r.u_texture),u_gamma_scale:new c.aI(v,r.u_gamma_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_is_halo:new c.aH(v,r.u_is_halo),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),symbolTextAndIcon:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texsize_icon:new c.aO(v,r.u_texsize_icon),u_texture:new c.aH(v,r.u_texture),u_texture_icon:new c.aH(v,r.u_texture_icon),u_gamma_scale:new c.aI(v,r.u_gamma_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_is_halo:new c.aH(v,r.u_is_halo),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),background:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_opacity:new c.aI(v,r.u_opacity),u_color:new c.aL(v,r.u_color)}),backgroundPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_opacity:new c.aI(v,r.u_opacity),u_image:new c.aH(v,r.u_image),u_pattern_tl_a:new c.aO(v,r.u_pattern_tl_a),u_pattern_br_a:new c.aO(v,r.u_pattern_br_a),u_pattern_tl_b:new c.aO(v,r.u_pattern_tl_b),u_pattern_br_b:new c.aO(v,r.u_pattern_br_b),u_texsize:new c.aO(v,r.u_texsize),u_mix:new c.aI(v,r.u_mix),u_pattern_size_a:new c.aO(v,r.u_pattern_size_a),u_pattern_size_b:new c.aO(v,r.u_pattern_size_b),u_scale_a:new c.aI(v,r.u_scale_a),u_scale_b:new c.aI(v,r.u_scale_b),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aI(v,r.u_tile_units_to_pixels)}),terrain:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texture:new c.aH(v,r.u_texture),u_ele_delta:new c.aI(v,r.u_ele_delta),u_fog_matrix:new c.aJ(v,r.u_fog_matrix),u_fog_color:new c.aL(v,r.u_fog_color),u_fog_ground_blend:new c.aI(v,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aI(v,r.u_fog_ground_blend_opacity),u_horizon_color:new c.aL(v,r.u_horizon_color),u_horizon_fog_blend:new c.aI(v,r.u_horizon_fog_blend)}),terrainDepth:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ele_delta:new c.aI(v,r.u_ele_delta)}),terrainCoords:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texture:new c.aH(v,r.u_texture),u_terrain_coords_id:new c.aI(v,r.u_terrain_coords_id),u_ele_delta:new c.aI(v,r.u_ele_delta)}),sky:(v,r)=>({u_sky_color:new c.aL(v,r.u_sky_color),u_horizon_color:new c.aL(v,r.u_horizon_color),u_horizon:new c.aI(v,r.u_horizon),u_sky_horizon_blend:new c.aI(v,r.u_sky_horizon_blend)})};class Us{constructor(r,u,p){this.context=r;const m=r.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const O_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class nd{constructor(r,u,p,m){this.length=u.length,this.attributes=p,this.itemSize=u.bytesPerElement,this.dynamicDraw=m,this.context=r;const _=r.gl;this.buffer=_.createBuffer(),r.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){if(r.length!==this.length)throw new Error(`Length of new data is ${r.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,u){for(let p=0;p0){const ze=c.H();c.aQ(ze,ae.placementInvProjMatrix,v.transform.glCoordMatrix),c.aQ(ze,ze,ae.placementViewportMatrix),C.push({circleArray:Pe,circleOffset:F,transform:we.posMatrix,invTransform:ze,coord:we}),z+=Pe.length/4,F=z}Ce&&E.draw(_,S.LINES,ir.disabled,Nr.disabled,v.colorModeForRenderPass(),Rr.disabled,{u_matrix:we.posMatrix,u_pixel_extrude_scale:[1/(B=v.transform).width,1/B.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(we),u.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,null,v.transform.zoom,null,null,Ce.collisionVertexBuffer)}var B;if(!m||!C.length)return;const X=v.useProgram("collisionCircle"),Q=new c.aR;Q.resize(4*z),Q._trim();let re=0;for(const me of C)for(let we=0;we=0&&(me[ae.associatedIconIndex]={shiftedAnchor:Gt,angle:Hr})}else Ot(ae.numGlyphs,ce)}if(z){pe.clear();const we=v.icon.placedSymbolArray;for(let ae=0;aev.style.map.terrain.getElevation(dt,al,ll):null,ua=u.layout.get("text-rotation-alignment")==="map";ee(Pt,dt.posMatrix,v,m,sl,ol,me,z,ua,ce,dt.toUnwrapped(),re.width,re.height,es,cr)}const ts=dt.posMatrix,rs=m&&st||Fd,Ao=we||rs?Ql:sl,ws=Mc,Nn=_t&&u.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let qn;qn=_t?Pt.iconsInText?ed(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,Gn,ii,wt):Xl(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,m,Gn,!0,wt):Lp(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,m,Gn,wt);const Li={program:tr,buffers:qt,uniformValues:qn,atlasTexture:xs,atlasTextureIcon:Zn,atlasInterpolation:Gr,atlasInterpolationIcon:_i,isSDF:_t,hasHalo:Nn};if(Pe&&Pt.canOverlap){ze=!0;const cr=qt.segments.get();for(const ua of cr)gt.push({segments:new c.a0([ua]),sortKey:ua.sortKey,state:Li,terrainData:Wr})}else gt.push({segments:qt.segments,sortKey:0,state:Li,terrainData:Wr})}ze&>.sort((dt,ct)=>dt.sortKey-ct.sortKey);for(const dt of gt){const ct=dt.state;if(X.activeTexture.set(Q.TEXTURE0),ct.atlasTexture.bind(ct.atlasInterpolation,Q.CLAMP_TO_EDGE),ct.atlasTextureIcon&&(X.activeTexture.set(Q.TEXTURE1),ct.atlasTextureIcon&&ct.atlasTextureIcon.bind(ct.atlasInterpolationIcon,Q.CLAMP_TO_EDGE)),ct.isSDF){const Pt=ct.uniformValues;ct.hasHalo&&(Pt.u_is_halo=1,fd(ct.buffers,dt.segments,u,v,ct.program,Xe,F,B,Pt,dt.terrainData)),Pt.u_is_halo=0}fd(ct.buffers,dt.segments,u,v,ct.program,Xe,F,B,ct.uniformValues,dt.terrainData)}}function fd(v,r,u,p,m,_,S,E,C,z){const F=p.context;m.draw(F,F.gl.TRIANGLES,_,S,E,Rr.disabled,C,z,u.id,v.layoutVertexBuffer,v.indexBuffer,r,u.paint,p.transform.zoom,v.programConfigurations.get(u.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function pd(v,r,u,p){const m=v.context,_=m.gl,S=Nr.disabled,E=new fn([_.ONE,_.ONE],c.aM.transparent,[!0,!0,!0,!0]),C=r.getBucket(u);if(!C)return;const z=p.key;let F=u.heatmapFbos.get(z);F||(F=eu(m,r.tileSize,r.tileSize),u.heatmapFbos.set(z,F)),m.bindFramebuffer.set(F.framebuffer),m.viewport.set([0,0,r.tileSize,r.tileSize]),m.clear({color:c.aM.transparent});const B=C.programConfigurations.get(u.id),X=v.useProgram("heatmap",B),Q=v.style.map.terrain.getTerrainData(p);X.draw(m,_.TRIANGLES,ir.disabled,S,E,Rr.disabled,yi(p.posMatrix,r,v.transform.zoom,u.paint.get("heatmap-intensity")),Q,u.id,C.layoutVertexBuffer,C.indexBuffer,C.segments,u.paint,v.transform.zoom,B)}function sa(v,r,u){const p=v.context,m=p.gl;p.setColorMode(v.colorModeForRenderPass());const _=tu(p,r),S=u.key,E=r.heatmapFbos.get(S);E&&(p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,E.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),_.bind(m.LINEAR,m.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(p,m.TRIANGLES,ir.disabled,Nr.disabled,v.colorModeForRenderPass(),Rr.disabled,nc(v,r,0,1),null,r.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,r.paint,v.transform.zoom),E.destroy(),r.heatmapFbos.delete(S))}function eu(v,r,u){var p,m;const _=v.gl,S=_.createTexture();_.bindTexture(_.TEXTURE_2D,S),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR);const E=(p=v.HALF_FLOAT)!==null&&p!==void 0?p:_.UNSIGNED_BYTE,C=(m=v.RGBA16F)!==null&&m!==void 0?m:_.RGBA;_.texImage2D(_.TEXTURE_2D,0,C,r,u,0,_.RGBA,E,null);const z=v.createFramebuffer(r,u,!1,!1);return z.colorAttachment.set(S),z}function tu(v,r){return r.colorRampTexture||(r.colorRampTexture=new it(v,r.colorRamp,v.gl.RGBA)),r.colorRampTexture}function Ha(v,r,u,p,m){if(!u||!p||!p.imageAtlas)return;const _=p.imageAtlas.patternPositions;let S=_[u.to.toString()],E=_[u.from.toString()];if(!S&&E&&(S=E),!E&&S&&(E=S),!S||!E){const C=m.getPaintProperty(r);S=_[C],E=_[C]}S&&E&&v.setConstantPatternPositions(S,E)}function ru(v,r,u,p,m,_,S){const E=v.context.gl,C="fill-pattern",z=u.paint.get(C),F=z&&z.constantOr(1),B=u.getCrossfadeParameters();let X,Q,re,ce,pe;S?(Q=F&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",X=E.LINES):(Q=F?"fillPattern":"fill",X=E.TRIANGLES);const me=z.constantOr(null);for(const we of p){const ae=r.getTile(we);if(F&&!ae.patternsLoaded())continue;const Ce=ae.getBucket(u);if(!Ce)continue;const Pe=Ce.programConfigurations.get(u.id),ze=v.useProgram(Q,Pe),Xe=v.style.map.terrain&&v.style.map.terrain.getTerrainData(we);F&&(v.context.activeTexture.set(E.TEXTURE0),ae.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),Pe.updatePaintBuffers(B)),Ha(Pe,C,me,ae,u);const st=Xe?we:null,gt=v.translatePosMatrix(st?st.posMatrix:we.posMatrix,ae,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(S){ce=Ce.indexBuffer2,pe=Ce.segments2;const wt=[E.drawingBufferWidth,E.drawingBufferHeight];re=Q==="fillOutlinePattern"&&F?Ap(gt,v,B,ae,wt):A_(gt,wt)}else ce=Ce.indexBuffer,pe=Ce.segments,re=F?Mp(gt,v,B,ae):$a(gt);ze.draw(v.context,X,m,v.stencilModeForClipping(we),_,Rr.disabled,re,Xe,u.id,Ce.layoutVertexBuffer,ce,pe,u.paint,v.transform.zoom,Pe)}}function dc(v,r,u,p,m,_,S){const E=v.context,C=E.gl,z="fill-extrusion-pattern",F=u.paint.get(z),B=F.constantOr(1),X=u.getCrossfadeParameters(),Q=u.paint.get("fill-extrusion-opacity"),re=F.constantOr(null);for(const ce of p){const pe=r.getTile(ce),me=pe.getBucket(u);if(!me)continue;const we=v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce),ae=me.programConfigurations.get(u.id),Ce=v.useProgram(B?"fillExtrusionPattern":"fillExtrusion",ae);B&&(v.context.activeTexture.set(C.TEXTURE0),pe.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ae.updatePaintBuffers(X)),Ha(ae,z,re,pe,u);const Pe=v.translatePosMatrix(ce.posMatrix,pe,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),ze=u.paint.get("fill-extrusion-vertical-gradient"),Xe=B?rc(Pe,v,ze,Q,ce,X,pe):ql(Pe,v,ze,Q);Ce.draw(E,E.gl.TRIANGLES,m,_,S,Rr.backCCW,Xe,we,u.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,u.paint,v.transform.zoom,ae,v.style.map.terrain&&me.centroidVertexBuffer)}}function Wa(v,r,u,p,m,_,S){const E=v.context,C=E.gl,z=u.fbo;if(!z)return;const F=v.useProgram("hillshade"),B=v.style.map.terrain&&v.style.map.terrain.getTerrainData(r);E.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,z.colorAttachment.get()),F.draw(E,C.TRIANGLES,m,_,S,Rr.disabled,((X,Q,re,ce)=>{const pe=re.paint.get("hillshade-shadow-color"),me=re.paint.get("hillshade-highlight-color"),we=re.paint.get("hillshade-accent-color");let ae=re.paint.get("hillshade-illumination-direction")*(Math.PI/180);re.paint.get("hillshade-illumination-anchor")==="viewport"&&(ae-=X.transform.angle);const Ce=!X.options.moving;return{u_matrix:ce?ce.posMatrix:X.transform.calculatePosMatrix(Q.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:ic(0,Q.tileID),u_light:[re.paint.get("hillshade-exaggeration"),ae],u_shadow:pe,u_highlight:me,u_accent:we}})(v,u,p,B?r:null),B,p.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Ga(v,r,u,p,m,_){const S=v.context,E=S.gl,C=r.dem;if(C&&C.data){const z=C.dim,F=C.stride,B=C.getPixels();if(S.activeTexture.set(E.TEXTURE1),S.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||v.getTileTexture(F),r.demTexture){const Q=r.demTexture;Q.update(B,{premultiply:!1}),Q.bind(E.NEAREST,E.CLAMP_TO_EDGE)}else r.demTexture=new it(S,B,E.RGBA,{premultiply:!1}),r.demTexture.bind(E.NEAREST,E.CLAMP_TO_EDGE);S.activeTexture.set(E.TEXTURE0);let X=r.fbo;if(!X){const Q=new it(S,{width:z,height:z,data:null},E.RGBA);Q.bind(E.LINEAR,E.CLAMP_TO_EDGE),X=r.fbo=S.createFramebuffer(z,z,!0,!1),X.colorAttachment.set(Q.texture)}S.bindFramebuffer.set(X.framebuffer),S.viewport.set([0,0,z,z]),v.useProgram("hillshadePrepare").draw(S,E.TRIANGLES,p,m,_,Rr.disabled,((Q,re)=>{const ce=re.stride,pe=c.H();return c.aP(pe,0,c.X,-c.X,0,0,1),c.J(pe,pe,[0,-c.X,0]),{u_matrix:pe,u_image:1,u_dimension:[ce,ce],u_zoom:Q.overscaledZ,u_unpack:re.getUnpackVector()}})(r.tileID,C),null,u.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function qp(v,r,u,p,m,_){const S=p.paint.get("raster-fade-duration");if(!_&&S>0){const E=A.now(),C=(E-v.timeAdded)/S,z=r?(E-r.timeAdded)/S:-1,F=u.getSource(),B=m.coveringZoomLevel({tileSize:F.tileSize,roundZoom:F.roundZoom}),X=!r||Math.abs(r.tileID.overscaledZ-B)>Math.abs(v.tileID.overscaledZ-B),Q=X&&v.refreshedUponExpiration?1:c.ac(X?C:1-z,0,1);return v.refreshedUponExpiration&&C>=1&&(v.refreshedUponExpiration=!1),r?{opacity:1,mix:1-Q}:{opacity:Q,mix:0}}return{opacity:1,mix:0}}const md=new c.aM(1,0,0,1),vr=new c.aM(0,1,0,1),fc=new c.aM(0,0,1,1),G_=new c.aM(1,0,1,1),Yp=new c.aM(0,1,1,1);function Za(v,r,u,p){pc(v,0,r+u/2,v.transform.width,u,p)}function Xp(v,r,u,p){pc(v,r-u/2,0,u,v.transform.height,p)}function pc(v,r,u,p,m,_){const S=v.context,E=S.gl;E.enable(E.SCISSOR_TEST),E.scissor(r*v.pixelRatio,u*v.pixelRatio,p*v.pixelRatio,m*v.pixelRatio),S.clear({color:_}),E.disable(E.SCISSOR_TEST)}function Kp(v,r,u){const p=v.context,m=p.gl,_=u.posMatrix,S=v.useProgram("debug"),E=ir.disabled,C=Nr.disabled,z=v.colorModeForRenderPass(),F="$debug",B=v.style.map.terrain&&v.style.map.terrain.getTerrainData(u);p.activeTexture.set(m.TEXTURE0);const X=r.getTileByID(u.key).latestRawTileData,Q=Math.floor((X&&X.byteLength||0)/1024),re=r.getTile(u).tileSize,ce=512/Math.min(re,512)*(u.overscaledZ/v.transform.zoom)*.5;let pe=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(pe+=` => ${u.overscaledZ}`),function(me,we){me.initDebugOverlayCanvas();const ae=me.debugOverlayCanvas,Ce=me.context.gl,Pe=me.debugOverlayCanvas.getContext("2d");Pe.clearRect(0,0,ae.width,ae.height),Pe.shadowColor="white",Pe.shadowBlur=2,Pe.lineWidth=1.5,Pe.strokeStyle="white",Pe.textBaseline="top",Pe.font="bold 36px Open Sans, sans-serif",Pe.fillText(we,5,5),Pe.strokeText(we,5,5),me.debugOverlayTexture.update(ae),me.debugOverlayTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE)}(v,`${pe} ${Q}kB`),S.draw(p,m.TRIANGLES,E,C,fn.alphaBlended,Rr.disabled,Yl(_,c.aM.transparent,ce),null,F,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),S.draw(p,m.LINE_STRIP,E,C,z,Rr.disabled,Yl(_,c.aM.red),B,F,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function Jp(v,r,u){const p=v.context,m=p.gl,_=v.colorModeForRenderPass(),S=new ir(m.LEQUAL,ir.ReadWrite,v.depthRangeFor3D),E=v.useProgram("terrain"),C=r.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,v.width,v.height]);for(const z of u){const F=v.renderToTexture.getTexture(z),B=r.getTerrainData(z.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,F.texture);const X=v.transform.calculatePosMatrix(z.tileID.toUnwrapped()),Q=r.getMeshFrameDelta(v.transform.zoom),re=v.transform.calculateFogMatrix(z.tileID.toUnwrapped()),ce=Jh(X,Q,re,v.style.sky,v.transform.pitch);E.draw(p,m.TRIANGLES,S,Nr.disabled,_,Rr.backCCW,ce,B,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class mc{constructor(r,u,p){this.vertexBuffer=r,this.indexBuffer=u,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class gc{constructor(r,u){this.context=new W_(r),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=jt.maxUnderzooming+jt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xh}resize(r,u,p){if(this.width=Math.floor(r*p),this.height=Math.floor(u*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const r=this.context,u=new c.aX;u.emplaceBack(0,0),u.emplaceBack(c.X,0),u.emplaceBack(0,c.X),u.emplaceBack(c.X,c.X),this.tileExtentBuffer=r.createVertexBuffer(u,Jo.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const p=new c.aX;p.emplaceBack(0,0),p.emplaceBack(c.X,0),p.emplaceBack(0,c.X),p.emplaceBack(c.X,c.X),this.debugBuffer=r.createVertexBuffer(p,Jo.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const m=new c.$;m.emplaceBack(0,0,0,0),m.emplaceBack(c.X,0,c.X,0),m.emplaceBack(0,c.X,0,c.X),m.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=r.createVertexBuffer(m,Ne.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const _=new c.aX;_.emplaceBack(0,0),_.emplaceBack(1,0),_.emplaceBack(0,1),_.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(_,Jo.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const S=new c.aZ;S.emplaceBack(0),S.emplaceBack(1),S.emplaceBack(3),S.emplaceBack(2),S.emplaceBack(0),this.tileBorderIndexBuffer=r.createIndexBuffer(S);const E=new c.aY;E.emplaceBack(0,1,2),E.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(E);const C=this.context.gl;this.stencilClearMode=new Nr({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const r=this.context,u=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=c.H();c.aP(p,0,this.width,this.height,0,0,1),c.K(p,p,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(r,u.TRIANGLES,ir.disabled,this.stencilClearMode,fn.disabled,Rr.disabled,gi(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(r,u){if(this.currentStencilSource===r.source||!r.isTileClipped()||!u||!u.length)return;this.currentStencilSource=r.source;const p=this.context,m=p.gl;this.nextStencilID+u.length>256&&this.clearStencil(),p.setColorMode(fn.disabled),p.setDepthMode(ir.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const S of u){const E=this._tileClippingMaskIDs[S.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(S);_.draw(p,m.TRIANGLES,ir.disabled,new Nr({func:m.ALWAYS,mask:0},E,255,m.KEEP,m.KEEP,m.REPLACE),fn.disabled,Rr.disabled,gi(S.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,u=this.context.gl;return new Nr({func:u.NOTEQUAL,mask:255},r,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(r){const u=this.context.gl;return new Nr({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(r){const u=this.context.gl,p=r.sort((S,E)=>E.overscaledZ-S.overscaledZ),m=p[p.length-1].overscaledZ,_=p[0].overscaledZ-m+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const S={};for(let E=0;E<_;E++)S[E+m]=new Nr({func:u.GEQUAL,mask:255},E+this.nextStencilID,255,u.KEEP,u.KEEP,u.REPLACE);return this.nextStencilID+=_,[S,p]}return[{[m]:Nr.disabled},p]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new fn([r.CONSTANT_COLOR,r.ONE],new c.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?fn.unblended:fn.alphaBlended}depthModeForSublayer(r,u,p){if(!this.opaquePassEnabledForLayer())return ir.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new ir(p||this.context.gl.LEQUAL,u,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer({u_sky_color:me.properties.get("sky-color"),u_horizon_color:me.properties.get("horizon-color"),u_horizon:(we.height/2+we.getHorizon())*ae,u_sky_horizon_blend:me.properties.get("sky-horizon-blend")*we.height/2*ae}))(z,C.style.map.transform,C.pixelRatio),Q=new ir(B.LEQUAL,ir.ReadWrite,[0,1]),re=Nr.disabled,ce=C.colorModeForRenderPass(),pe=C.useProgram("sky");if(!z.mesh){const me=new c.aX;me.emplaceBack(-1,-1),me.emplaceBack(1,-1),me.emplaceBack(1,1),me.emplaceBack(-1,1);const we=new c.aY;we.emplaceBack(0,1,2),we.emplaceBack(0,2,3),z.mesh=new mc(F.createVertexBuffer(me,Jo.members),F.createIndexBuffer(we),c.a0.simpleSegment(0,0,me.length,we.length))}pe.draw(F,B.TRIANGLES,Q,re,ce,Rr.disabled,X,void 0,"sky",z.mesh.vertexBuffer,z.mesh.indexBuffer,z.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=u.showOverdrawInspector,this.depthRangeFor3D=[0,1-(r._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const C=this.style._layers[p[this.currentLayer]],z=m[C.source],F=_[C.source];this._renderTileClippingMasks(C,F),this.renderLayer(this,z,C,F)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerpe.source&&!pe.isHidden(F)?[z.sourceCaches[pe.source]]:[]),Q=X.filter(pe=>pe.getSource().type==="vector"),re=X.filter(pe=>pe.getSource().type!=="vector"),ce=pe=>{(!B||B.getSource().maxzoomce(pe)),B||re.forEach(pe=>ce(pe)),B}(this.style,this.transform.zoom);C&&function(z,F,B){for(let X=0;X0),m&&(c.b0(u,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,S){const E=_.context,C=E.gl,z=fn.unblended,F=new ir(C.LEQUAL,ir.ReadWrite,[0,1]),B=S.getTerrainMesh(),X=S.sourceCache.getRenderableTiles(),Q=_.useProgram("terrainDepth");E.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),E.clear({color:c.aM.transparent,depth:1});for(const re of X){const ce=S.getTerrainData(re.tileID),pe={u_matrix:_.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};Q.draw(E,C.TRIANGLES,F,Nr.disabled,z,Rr.backCCW,pe,ce,"terrain",B.vertexBuffer,B.indexBuffer,B.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,S){const E=_.context,C=E.gl,z=fn.unblended,F=new ir(C.LEQUAL,ir.ReadWrite,[0,1]),B=S.getTerrainMesh(),X=S.getCoordsTexture(),Q=S.sourceCache.getRenderableTiles(),re=_.useProgram("terrainCoords");E.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),E.clear({color:c.aM.transparent,depth:1}),S.coordsIndex=[];for(const ce of Q){const pe=S.getTerrainData(ce.tileID);E.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,X.texture);const me={u_matrix:_.transform.calculatePosMatrix(ce.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};re.draw(E,C.TRIANGLES,F,Nr.disabled,z,Rr.backCCW,me,pe,"terrain",B.vertexBuffer,B.indexBuffer,B.segments),S.coordsIndex.push(ce.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(r,u,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(_,S,E,C,z){if(_.renderPass!=="translucent")return;const F=Nr.disabled,B=_.colorModeForRenderPass();(E._unevaluatedLayout.hasValue("text-variable-anchor")||E._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(X,Q,re,ce,pe,me,we,ae,Ce){const Pe=Q.transform,ze=Ko(),Xe=pe==="map",st=me==="map";for(const gt of X){const wt=ce.getTile(gt),dt=wt.getBucket(re);if(!dt||!dt.text||!dt.text.segments.get().length)continue;const ct=c.ag(dt.textSizeData,Pe.zoom),Pt=or(wt,1,Q.transform.zoom),qt=ps(gt.posMatrix,st,Xe,Q.transform,Pt),ft=re.layout.get("icon-text-fit")!=="none"&&dt.hasIconData();if(ct){const _t=Math.pow(2,Pe.zoom-wt.tileID.overscaledZ),Gt=Q.style.map.terrain?(tr,ar)=>Q.style.map.terrain.getElevation(gt,tr,ar):null,Hr=ze.translatePosition(Pe,wt,we,ae);Va(dt,Xe,st,Ce,Pe,qt,gt.posMatrix,_t,ct,ft,ze,Hr,gt.toUnwrapped(),Gt)}}}(C,_,E,S,E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),z),E.paint.get("icon-opacity").constantOr(1)!==0&&dd(_,S,E,C,!1,E.paint.get("icon-translate"),E.paint.get("icon-translate-anchor"),E.layout.get("icon-rotation-alignment"),E.layout.get("icon-pitch-alignment"),E.layout.get("icon-keep-upright"),F,B),E.paint.get("text-opacity").constantOr(1)!==0&&dd(_,S,E,C,!0,E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.layout.get("text-keep-upright"),F,B),S.map.showCollisionBoxes&&(Jl(_,S,E,C,!0),Jl(_,S,E,C,!1))})(r,u,p,m,this.style.placement.variableOffsets);break;case"circle":(function(_,S,E,C){if(_.renderPass!=="translucent")return;const z=E.paint.get("circle-opacity"),F=E.paint.get("circle-stroke-width"),B=E.paint.get("circle-stroke-opacity"),X=!E.layout.get("circle-sort-key").isConstant();if(z.constantOr(1)===0&&(F.constantOr(1)===0||B.constantOr(1)===0))return;const Q=_.context,re=Q.gl,ce=_.depthModeForSublayer(0,ir.ReadOnly),pe=Nr.disabled,me=_.colorModeForRenderPass(),we=[];for(let ae=0;aeae.sortKey-Ce.sortKey);for(const ae of we){const{programConfiguration:Ce,program:Pe,layoutVertexBuffer:ze,indexBuffer:Xe,uniformValues:st,terrainData:gt}=ae.state;Pe.draw(Q,re.TRIANGLES,ce,pe,me,Rr.disabled,st,gt,E.id,ze,Xe,ae.segments,E.paint,_.transform.zoom,Ce)}})(r,u,p,m);break;case"heatmap":(function(_,S,E,C){if(E.paint.get("heatmap-opacity")===0)return;const z=_.context;if(_.style.map.terrain){for(const F of C){const B=S.getTile(F);S.hasRenderableParent(F)||(_.renderPass==="offscreen"?pd(_,B,E,F):_.renderPass==="translucent"&&sa(_,E,F))}z.viewport.set([0,0,_.width,_.height])}else _.renderPass==="offscreen"?function(F,B,X,Q){const re=F.context,ce=re.gl,pe=Nr.disabled,me=new fn([ce.ONE,ce.ONE],c.aM.transparent,[!0,!0,!0,!0]);(function(we,ae,Ce){const Pe=we.gl;we.activeTexture.set(Pe.TEXTURE1),we.viewport.set([0,0,ae.width/4,ae.height/4]);let ze=Ce.heatmapFbos.get(c.aU);ze?(Pe.bindTexture(Pe.TEXTURE_2D,ze.colorAttachment.get()),we.bindFramebuffer.set(ze.framebuffer)):(ze=eu(we,ae.width/4,ae.height/4),Ce.heatmapFbos.set(c.aU,ze))})(re,F,X),re.clear({color:c.aM.transparent});for(let we=0;we20&&F.texParameterf(F.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax);const dt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(we),ct=dt?we:null,Pt=ct?ct.posMatrix:_.transform.calculatePosMatrix(we.toUnwrapped(),me),qt=R_(Pt,gt||[0,0],st||1,Xe,E);B instanceof ot?X.draw(z,F.TRIANGLES,ae,Nr.disabled,Q,Rr.disabled,qt,dt,E.id,B.boundsBuffer,_.quadTriangleIndexBuffer,B.boundsSegments):X.draw(z,F.TRIANGLES,ae,re[we.overscaledZ],Q,Rr.disabled,qt,dt,E.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(r,u,p,m);break;case"background":(function(_,S,E,C){const z=E.paint.get("background-color"),F=E.paint.get("background-opacity");if(F===0)return;const B=_.context,X=B.gl,Q=_.transform,re=Q.tileSize,ce=E.paint.get("background-pattern");if(_.isPatternMissing(ce))return;const pe=!ce&&z.a===1&&F===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==pe)return;const me=Nr.disabled,we=_.depthModeForSublayer(0,pe==="opaque"?ir.ReadWrite:ir.ReadOnly),ae=_.colorModeForRenderPass(),Ce=_.useProgram(ce?"backgroundPattern":"background"),Pe=C||Q.coveringTiles({tileSize:re,terrain:_.style.map.terrain});ce&&(B.activeTexture.set(X.TEXTURE0),_.imageManager.bind(_.context));const ze=E.getCrossfadeParameters();for(const Xe of Pe){const st=C?Xe.posMatrix:_.transform.calculatePosMatrix(Xe.toUnwrapped()),gt=ce?td(st,F,_,ce,{tileID:Xe,tileSize:re},ze):oc(st,F,z),wt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Xe);Ce.draw(B,X.TRIANGLES,we,me,ae,Rr.disabled,gt,wt,E.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(r,0,p,m);break;case"custom":(function(_,S,E){const C=_.context,z=E.implementation;if(_.renderPass==="offscreen"){const F=z.prerender;F&&(_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),F.call(z,C.gl,_.transform.customLayerMatrix()),C.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),C.setStencilMode(Nr.disabled);const F=z.renderingMode==="3d"?new ir(_.context.gl.LEQUAL,ir.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,ir.ReadOnly);C.setDepthMode(F),z.render(C.gl,_.transform.customLayerMatrix(),{farZ:_.transform.farZ,nearZ:_.transform.nearZ,fov:_.transform._fov,modelViewProjectionMatrix:_.transform.modelViewProjectionMatrix,projectionMatrix:_.transform.projectionMatrix}),C.setDirty(),_.setBaseState(),C.bindFramebuffer.set(null)}})(r,0,p)}}translatePosMatrix(r,u,p,m,_){if(!p[0]&&!p[1])return r;const S=_?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(S){const z=Math.sin(S),F=Math.cos(S);p=[p[0]*F-p[1]*z,p[0]*z+p[1]*F]}const E=[_?p[0]:or(u,p[0],this.transform.zoom),_?p[1]:or(u,p[1],this.transform.zoom),0],C=new Float32Array(16);return c.J(C,r,E),C}saveTileTexture(r){const u=this._tileTextures[r.size[0]];u?u.push(r):this._tileTextures[r.size[0]]=[r]}getTileTexture(r){const u=this._tileTextures[r];return u&&u.length>0?u.pop():null}isPatternMissing(r){if(!r)return!1;if(!r.from||!r.to)return!0;const u=this.imageManager.getPattern(r.from.toString()),p=this.imageManager.getPattern(r.to.toString());return!u||!p}useProgram(r,u){this.cache=this.cache||{};const p=r+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Qh(this.context,Po[r],u,rd[r],this._showOverdrawInspector,this.style.map.terrain)),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(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new it(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:r,drawingBufferHeight:u}=this.context.gl;return this.width!==r||this.height!==u}}class qa{constructor(r,u){this.points=r,this.planes=u}static fromInvProjectionMatrix(r,u,p){const m=Math.pow(2,p),_=[[-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(E=>{const C=1/(E=c.af([],E,r))[3]/u*m;return c.b1(E,E,[C,C,1/E[3],C])}),S=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const C=function(X,Q){var re=Q[0],ce=Q[1],pe=Q[2],me=re*re+ce*ce+pe*pe;return me>0&&(me=1/Math.sqrt(me)),X[0]=Q[0]*me,X[1]=Q[1]*me,X[2]=Q[2]*me,X}([],function(X,Q,re){var ce=Q[0],pe=Q[1],me=Q[2],we=re[0],ae=re[1],Ce=re[2];return X[0]=pe*Ce-me*ae,X[1]=me*we-ce*Ce,X[2]=ce*ae-pe*we,X}([],ge([],_[E[0]],_[E[1]]),ge([],_[E[2]],_[E[1]]))),z=-((F=C)[0]*(B=_[E[1]])[0]+F[1]*B[1]+F[2]*B[2]);var F,B;return C.concat(z)});return new qa(_,S)}}class Ya{constructor(r,u){this.min=r,this.max=u,this.center=function(p,m,_){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,_){return p[0]=m[0]+_[0],p[1]=m[1]+_[1],p[2]=m[2]+_[2],p}([],this.min,this.max))}quadrant(r){const u=[r%2==0,r<2],p=oe(this.min),m=oe(this.max);for(let _=0;_=0&&S++;if(S===0)return 0;S!==u.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let _=Number.MAX_VALUE,S=-Number.MAX_VALUE;for(let E=0;Ethis.max[m]-this.min[m])return 0}return 1}}class Xa{constructor(r=0,u=0,p=0,m=0){if(isNaN(r)||r<0||isNaN(u)||u<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=u,this.left=p,this.right=m}interpolate(r,u,p){return u.top!=null&&r.top!=null&&(this.top=c.y.number(r.top,u.top,p)),u.bottom!=null&&r.bottom!=null&&(this.bottom=c.y.number(r.bottom,u.bottom,p)),u.left!=null&&r.left!=null&&(this.left=c.y.number(r.left,u.left,p)),u.right!=null&&r.right!=null&&(this.right=c.y.number(r.right,u.right,p)),this}getCenter(r,u){const p=c.ac((this.left+r-this.right)/2,0,r),m=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(p,m)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Xa(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const gd=85.051129;class Ka{constructor(r,u,p,m,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=r||0,this._maxZoom=u||22,this._minPitch=p??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Xa,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const r=new Ka(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return r.apply(this),r}apply(r){this.tileSize=r.tileSize,this.latRange=r.latRange,this.lngRange=r.lngRange,this.width=r.width,this.height=r.height,this._center=r._center,this._elevation=r._elevation,this.minElevationForCurrentTile=r.minElevationForCurrentTile,this.zoom=r.zoom,this.angle=r.angle,this._fov=r._fov,this._pitch=r._pitch,this._unmodified=r._unmodified,this._edgeInsets=r._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(r){const u=-c.b3(r,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var p=new c.A(4);return c.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,m,_){var S=m[0],E=m[1],C=m[2],z=m[3],F=Math.sin(_),B=Math.cos(_);p[0]=S*B+C*F,p[1]=E*B+z*F,p[2]=S*-F+C*B,p[3]=E*-F+z*B}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const u=c.ac(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=r/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(r){const u=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(r){r!==this._elevation&&(this._elevation=r,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,u,p){this._unmodified=!1,this._edgeInsets.interpolate(r,u,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const u=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(r){const u=[new c.b4(0,r)];if(this._renderWorldCopies){const p=this.pointCoordinate(new c.P(0,0)),m=this.pointCoordinate(new c.P(this.width,0)),_=this.pointCoordinate(new c.P(this.width,this.height)),S=this.pointCoordinate(new c.P(0,this.height)),E=Math.floor(Math.min(p.x,m.x,_.x,S.x)),C=Math.floor(Math.max(p.x,m.x,_.x,S.x)),z=1;for(let F=E-z;F<=C+z;F++)F!==0&&u.push(new c.b4(F,r))}return u}coveringTiles(r){var u,p;let m=this.coveringZoomLevel(r);const _=m;if(r.minzoom!==void 0&&mr.maxzoom&&(m=r.maxzoom);const S=this.pointCoordinate(this.getCameraPoint()),E=c.Z.fromLngLat(this.center),C=Math.pow(2,m),z=[C*S.x,C*S.y,0],F=[C*E.x,C*E.y,0],B=qa.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let X=r.minzoom||0;!r.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(X=m);const Q=r.terrain?2/Math.min(this.tileSize,r.tileSize)*this.tileSize:3,re=ae=>({aabb:new Ya([ae*C,0,0],[(ae+1)*C,C,0]),zoom:0,x:0,y:0,wrap:ae,fullyVisible:!1}),ce=[],pe=[],me=m,we=r.reparseOverscaled?_:m;if(this._renderWorldCopies)for(let ae=1;ae<=3;ae++)ce.push(re(-ae)),ce.push(re(ae));for(ce.push(re(0));ce.length>0;){const ae=ce.pop(),Ce=ae.x,Pe=ae.y;let ze=ae.fullyVisible;if(!ze){const dt=ae.aabb.intersects(B);if(dt===0)continue;ze=dt===2}const Xe=r.terrain?z:F,st=ae.aabb.distanceX(Xe),gt=ae.aabb.distanceY(Xe),wt=Math.max(Math.abs(st),Math.abs(gt));if(ae.zoom===me||wt>Q+(1<=X){const dt=me-ae.zoom,ct=z[0]-.5-(Ce<>1),qt=ae.zoom+1;let ft=ae.aabb.quadrant(dt);if(r.terrain){const _t=new c.S(qt,ae.wrap,qt,ct,Pt),Gt=r.terrain.getMinMaxElevation(_t),Hr=(u=Gt.minElevation)!==null&&u!==void 0?u:this.elevation,tr=(p=Gt.maxElevation)!==null&&p!==void 0?p:this.elevation;ft=new Ya([ft.min[0],ft.min[1],Hr],[ft.max[0],ft.max[1],tr])}ce.push({aabb:ft,zoom:qt,x:ct,y:Pt,wrap:ae.wrap,fullyVisible:ze})}}return pe.sort((ae,Ce)=>ae.distanceSq-Ce.distanceSq).map(ae=>ae.tileID)}resize(r,u){this.width=r,this.height=u,this.pixelsToGLUnits=[2/r,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const u=c.ac(r.lat,-85.051129,gd);return new c.P(c.O(r.lng)*this.worldSize,c.Q(u)*this.worldSize)}unproject(r){return new c.Z(r.x/this.worldSize,r.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(r){const u=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,r),_=r.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-_))return;const S=p+u-_,E=Math.cos(this._pitch)*this.cameraToCenterDistance/S/c.b5(1,m.lat),C=this.scaleZoom(E/this.tileSize);this._elevation=_,this._center=m,this.zoom=C}setLocationAtPoint(r,u){const p=this.pointCoordinate(u),m=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(r),S=new c.Z(_.x-(p.x-m.x),_.y-(p.y-m.y));this.center=this.coordinateLocation(S),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(r,u){return u?this.coordinatePoint(this.locationCoordinate(r),u.getElevationForLngLatZoom(r,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(r))}pointLocation(r,u){return this.coordinateLocation(this.pointCoordinate(r,u))}locationCoordinate(r){return c.Z.fromLngLat(r)}coordinateLocation(r){return r&&r.toLngLat()}pointCoordinate(r,u){if(u){const X=u.pointCoordinate(r);if(X!=null)return X}const p=[r.x,r.y,0,1],m=[r.x,r.y,1,1];c.af(p,p,this.pixelMatrixInverse),c.af(m,m,this.pixelMatrixInverse);const _=p[3],S=m[3],E=p[1]/_,C=m[1]/S,z=p[2]/_,F=m[2]/S,B=z===F?0:(0-z)/(F-z);return new c.Z(c.y.number(p[0]/_,m[0]/S,B)/this.worldSize,c.y.number(E,C,B)/this.worldSize)}coordinatePoint(r,u=0,p=this.pixelMatrix){const m=[r.x*this.worldSize,r.y*this.worldSize,u,1];return c.af(m,m,p),new c.P(m[0]/m[3],m[1]/m[3])}getBounds(){const r=Math.max(0,this.height/2-this.getHorizon());return new ie().extend(this.pointLocation(new c.P(0,r))).extend(this.pointLocation(new c.P(this.width,r))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ie([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(r){r?(this.lngRange=[r.getWest(),r.getEast()],this.latRange=[r.getSouth(),r.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,gd])}calculateTileMatrix(r){const u=r.canonical,p=this.worldSize/this.zoomScale(u.z),m=u.x+Math.pow(2,u.z)*r.wrap,_=c.an(new Float64Array(16));return c.J(_,_,[m*p,u.y*p,0]),c.K(_,_,[p/c.X,p/c.X,1]),_}calculatePosMatrix(r,u=!1){const p=r.key,m=u?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const _=this.calculateTileMatrix(r);return c.L(_,u?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),m[p]=new Float32Array(_),m[p]}calculateFogMatrix(r){const u=r.key,p=this._fogMatrixCache;if(p[u])return p[u];const m=this.calculateTileMatrix(r);return c.L(m,this.fogMatrix,m),p[u]=new Float32Array(m),p[u]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(r,u){u=c.ac(+u,this.minZoom,this.maxZoom);const p={center:new c.N(r.lng,r.lat),zoom:u};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ae=179.9999999999;m=[-ae,ae]}const _=this.tileSize*this.zoomScale(p.zoom);let S=0,E=_,C=0,z=_,F=0,B=0;const{x:X,y:Q}=this.size;if(this.latRange){const ae=this.latRange;S=c.Q(ae[1])*_,E=c.Q(ae[0])*_,E-SE&&(me=E-ae)}if(m){const ae=(C+z)/2;let Ce=re;this._renderWorldCopies&&(Ce=c.b3(re,ae-_/2,ae+_/2));const Pe=X/2;Ce-Pez&&(pe=z-Pe)}if(pe!==void 0||me!==void 0){const ae=new c.P(pe??re,me??ce);p.center=this.unproject.call({worldSize:_},ae).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this._unmodified,{center:u,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=p,this._unmodified=r,this._constraining=!1}_calcMatrices(){if(!this.height)return;const r=this.centerOffset,u=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let m=c.an(new Float64Array(16));c.K(m,m,[this.width/2,-this.height/2,1]),c.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=c.an(new Float64Array(16)),c.K(m,m,[1,-1,1]),c.J(m,m,[-1,-1,0]),c.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),S=Math.min(this.elevation,this.minElevationForCurrentTile),E=_-S*this._pixelPerMeter/Math.cos(this._pitch),C=S<0?E:_,z=Math.PI/2+this._pitch,F=this._fov*(.5+r.y/this.height),B=Math.sin(F)*C/Math.sin(c.ac(Math.PI-z-F,.01,Math.PI-.01)),X=this.getHorizon(),Q=2*Math.atan(X/this.cameraToCenterDistance)*(.5+r.y/(2*X)),re=Math.sin(Q)*C/Math.sin(c.ac(Math.PI-z-Q,.01,Math.PI-.01)),ce=Math.min(B,re);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ce+C),this.nearZ=this.height/50,m=new Float64Array(16),c.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-r.x/this.width,m[9]=2*r.y/this.height,this.projectionMatrix=c.ae(m),c.K(m,m,[1,-1,1]),c.J(m,m,[0,0,-this.cameraToCenterDistance]),c.b7(m,m,this._pitch),c.ad(m,m,this.angle),c.J(m,m,[-u,-p,0]),this.mercatorMatrix=c.K([],m,[this.worldSize,this.worldSize,this.worldSize]),c.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,m),c.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=c.as([],m),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,_,this.farZ),this.fogMatrix[8]=2*-r.x/this.width,this.fogMatrix[9]=2*r.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ad(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-u,-p,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,m);const pe=this.width%2/2,me=this.height%2/2,we=Math.cos(this.angle),ae=Math.sin(this.angle),Ce=u-Math.round(u)+we*pe+ae*me,Pe=p-Math.round(p)+we*me+ae*pe,ze=new Float64Array(m);if(c.J(ze,ze,[Ce>.5?Ce-1:Ce,Pe>.5?Pe-1:Pe,0]),this.alignedModelViewProjectionMatrix=ze,m=c.as(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const r=this.pointCoordinate(new c.P(0,0)),u=[r.x*this.worldSize,r.y*this.worldSize,0,1];return c.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,r))}getCameraQueryGeometry(r){const u=this.getCameraPoint();if(r.length===1)return[r[0],u];{let p=u.x,m=u.y,_=u.x,S=u.y;for(const E of r)p=Math.min(p,E.x),m=Math.min(m,E.y),_=Math.max(_,E.x),S=Math.max(S,E.y);return[new c.P(p,m),new c.P(_,m),new c.P(_,S),new c.P(p,S),new c.P(p,m)]}}lngLatToCameraDepth(r,u){const p=this.locationCoordinate(r),m=[p.x*this.worldSize,p.y*this.worldSize,u,1];return c.af(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function nu(v,r){let u,p=!1,m=null,_=null;const S=()=>{m=null,p&&(v.apply(_,u),m=setTimeout(S,r),p=!1)};return(...E)=>(p=!0,_=this,u=E,m||S(),m)}class yc{constructor(r){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let p;return u.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:p,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,u)},this._removeHash=()=>{const u=this._getCurrentHash();if(u.length===0)return;const p=u.join("/");let m=p;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${p}`);let _=window.location.hash.replace(m,"");_.startsWith("#&")?_=_.slice(0,1)+_.slice(2):_==="#"&&(_="");let S=window.location.href.replace(/(#.+)?$/,_);S=S.replace("&&","&"),window.history.replaceState(window.history.state,null,S)},this._updateHash=nu(this._updateHashUnthrottled,300),this._hashName=r&&encodeURIComponent(r)}addTo(r){return this._map=r,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(r){const u=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,m),S=Math.round(u.lng*_)/_,E=Math.round(u.lat*_)/_,C=this._map.getBearing(),z=this._map.getPitch();let F="";if(F+=r?`/${S}/${E}/${p}`:`${p}/${E}/${S}`,(C||z)&&(F+="/"+Math.round(10*C)/10),z&&(F+=`/${Math.round(z)}`),this._hashName){const B=this._hashName;let X=!1;const Q=window.location.hash.slice(1).split("&").map(re=>{const ce=re.split("=")[0];return ce===B?(X=!0,`${ce}=${F}`):re}).filter(re=>re);return X||Q.push(`${B}=${F}`),`#${Q.join("&")}`}return`#${F}`}}const _c={linearity:.3,easing:c.b8(0,0,.3,1)},yd=c.e({deceleration:2500,maxSpeed:1400},_c),Z_=c.e({deceleration:20,maxSpeed:1400},_c),Qp=c.e({deceleration:1e3,maxSpeed:360},_c),vc=c.e({deceleration:1e3,maxSpeed:90},_c);class _d{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:A.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,u=A.now();for(;r.length>0&&u-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)u.zoom+=_.zoomDelta||0,u.bearing+=_.bearingDelta||0,u.pitch+=_.pitchDelta||0,_.panDelta&&u.pan._add(_.panDelta),_.around&&(u.around=_.around),_.pinchAround&&(u.pinchAround=_.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(u.pan.mag()){const _=su(u.pan.mag(),p,c.e({},yd,r||{}));m.offset=u.pan.mult(_.amount/u.pan.mag()),m.center=this._map.transform.center,iu(m,_)}if(u.zoom){const _=su(u.zoom,p,Z_);m.zoom=this._map.transform.zoom+_.amount,iu(m,_)}if(u.bearing){const _=su(u.bearing,p,Qp);m.bearing=this._map.transform.bearing+c.ac(_.amount,-179,179),iu(m,_)}if(u.pitch){const _=su(u.pitch,p,vc);m.pitch=this._map.transform.pitch+_.amount,iu(m,_)}if(m.zoom||m.bearing){const _=u.pinchAround===void 0?u.around:u.pinchAround;m.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),c.e(m,{noMoveStart:!0})}}function iu(v,r){(!v.duration||v.durationu.unproject(C)),E=_.reduce((C,z,F,B)=>C.add(z.div(B.length)),new c.P(0,0));super(r,{points:_,point:E,lngLats:S,lngLat:u.unproject(E),originalEvent:p}),this._defaultPrevented=!1}}class em extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,u,p){super(r,{originalEvent:p}),this._defaultPrevented=!1}}class tm{constructor(r,u){this._map=r,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(r){return this._firePreventable(new em(r.type,this._map,r))}mousedown(r,u){return this._mousedownPos=u,this._firePreventable(new Wn(r.type,this._map,r))}mouseup(r){this._map.fire(new Wn(r.type,this._map,r))}click(r,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Wn(r.type,this._map,r))}dblclick(r){return this._firePreventable(new Wn(r.type,this._map,r))}mouseover(r){this._map.fire(new Wn(r.type,this._map,r))}mouseout(r){this._map.fire(new Wn(r.type,this._map,r))}touchstart(r){return this._firePreventable(new oa(r.type,this._map,r))}touchmove(r){this._map.fire(new oa(r.type,this._map,r))}touchend(r){this._map.fire(new oa(r.type,this._map,r))}touchcancel(r){this._map.fire(new oa(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pn{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(r){this._map.fire(new Wn(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Wn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._ignoreContextMenu||this._map.fire(new Wn(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _s{constructor(r){this._map=r}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(r){return this.transform.pointLocation(c.P.convert(r),this._map.terrain)}}class zi{constructor(r,u){this._map=r,this._tr=new _s(r),this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,u){this.isEnabled()&&r.shiftKey&&r.button===0&&(M.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(r,u){if(!this._active)return;const p=u;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)_.fitScreenCoordinates(p,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",r)}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(M.remove(this._box),this._box=null),M.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,u){return this._map.fire(new c.k(r,{originalEvent:u}))}}function ou(v,r){if(v.length!==r.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${r.length}`);const u={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=r.timeStamp),p.length===this.numTouches&&(this.centroid=function(m){const _=new c.P(0,0);for(const S of m)_._add(S);return _.div(m.length)}(u),this.touches=ou(p,u)))}touchmove(r,u,p){if(this.aborted||!this.centroid)return;const m=ou(p,u);for(const _ in this.touches){const S=m[_];(!S||S.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(r,u,p){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class xc{constructor(r){this.singleTap=new vd(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(r,u,p){this.singleTap.touchstart(r,u,p)}touchmove(r,u,p){this.singleTap.touchmove(r,u,p)}touchend(r,u,p){const m=this.singleTap.touchend(r,u,p);if(m){const _=r.timeStamp-this.lastTime<500,S=!this.lastTap||this.lastTap.dist(m)<30;if(_&&S||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Ja{constructor(r){this._tr=new _s(r),this._zoomIn=new xc({numTouches:1,numTaps:2}),this._zoomOut=new xc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,u,p){this._zoomIn.touchstart(r,u,p),this._zoomOut.touchstart(r,u,p)}touchmove(r,u,p){this._zoomIn.touchmove(r,u,p),this._zoomOut.touchmove(r,u,p)}touchend(r,u,p){const m=this._zoomIn.touchend(r,u,p),_=this._zoomOut.touchend(r,u,p),S=this._tr;return m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:S.zoom+1,around:S.unproject(m)},{originalEvent:r})}):_?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:S.zoom-1,around:S.unproject(_)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lo{constructor(r){this._enabled=!!r.enable,this._moveStateManager=r.moveStateManager,this._clickTolerance=r.clickTolerance||1,this._moveFunction=r.move,this._activateOnStart=!!r.activateOnStart,r.assignEvents(this),this.reset()}reset(r){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(r)}_move(...r){const u=this._moveFunction(...r);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(r,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(r)&&(this._moveStateManager.startMove(r),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(r,u){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(r.preventDefault(),!this._moveStateManager.isValidMoveEvent(r))return void this.reset(r);const m=u.length?u[0]:u;return!this._moved&&m.dist(p){v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=r=>{r.preventDefault()}},bd=({enable:v,clickTolerance:r,bearingDegreesPerPixelMoved:u=.8})=>{const p=new wc({checkCorrectEvent:m=>M.mouseButton(m)===0&&m.ctrlKey||M.mouseButton(m)===2});return new lo({clickTolerance:r,move:(m,_)=>({bearingDelta:(_.x-m.x)*u}),moveStateManager:p,enable:v,assignEvents:bc})},Sd=({enable:v,clickTolerance:r,pitchDegreesPerPixelMoved:u=-.5})=>{const p=new wc({checkCorrectEvent:m=>M.mouseButton(m)===0&&m.ctrlKey||M.mouseButton(m)===2});return new lo({clickTolerance:r,move:(m,_)=>({pitchDelta:(_.y-m.y)*u}),moveStateManager:p,enable:v,assignEvents:bc})};class aa{constructor(r,u){this._clickTolerance=r.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(r){return r<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(r,u,p){return this._calculateTransform(r,u,p)}touchmove(r,u,p){if(this._active){if(!this._shouldBePrevented(p.length))return r.preventDefault(),this._calculateTransform(r,u,p);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",r)}}touchend(r,u,p){this._calculateTransform(r,u,p),this._active&&this._shouldBePrevented(p.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,u,p){p.length>0&&(this._active=!0);const m=ou(p,u),_=new c.P(0,0),S=new c.P(0,0);let E=0;for(const z in m){const F=m[z],B=this._touches[z];B&&(_._add(F),S._add(F.sub(B)),E++,m[z]=F)}if(this._touches=m,this._shouldBePrevented(E)||!S.mag())return;const C=S.div(E);return this._sum._add(C),this._sum.mag()Math.abs(v.x)}class Qa extends Sc{constructor(r){super(),this._currentTouchCount=0,this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,u,p){super.touchstart(r,u,p),this._currentTouchCount=p.length}_start(r){this._lastPoints=r,kc(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,u,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=r[0].sub(this._lastPoints[0]),_=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,_,p.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(r,u,p){if(this._valid!==void 0)return this._valid;const m=r.mag()>=2,_=u.mag()>=2;if(!m&&!_)return;if(!m||!_)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const S=r.y>0==u.y>0;return kc(r)&&kc(u)&&S}}const rm={panStep:100,bearingStep:15,pitchStep:10};class Ji{constructor(r){this._tr=new _s(r);const u=rm;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let u=0,p=0,m=0,_=0,S=0;switch(r.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:r.shiftKey?p=-1:(r.preventDefault(),_=-1);break;case 39:r.shiftKey?p=1:(r.preventDefault(),_=1);break;case 38:r.shiftKey?m=1:(r.preventDefault(),S=-1);break;case 40:r.shiftKey?m=-1:(r.preventDefault(),S=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:E=>{const C=this._tr;E.easeTo({duration:300,easeId:"keyboardHandler",easing:Vs,zoom:u?Math.round(C.zoom)+u*(r.shiftKey?2:1):C.zoom,bearing:C.bearing+p*this._bearingStep,pitch:C.pitch+m*this._pitchStep,offset:[-_*this._panStep,-S*this._panStep],center:C.center},{originalEvent:r})}}}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 Vs(v){return v*(2-v)}const Id=4.000244140625;class vs{constructor(r,u){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=r,this._tr=new _s(r),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(r){return!!this._map.cooperativeGestures.isEnabled()&&!(r.ctrlKey||this._map.cooperativeGestures.isBypassed(r))}wheel(r){if(!this.isEnabled())return;if(this._shouldBePrevented(r))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",r);let u=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const p=A.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,u!==0&&u%Id==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(m*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),r.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=r,this._delta-=u,this._active||this._start(r)),r.preventDefault()}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=M.mousePos(this._map.getCanvas(),r),p=this._tr;this._around=u.y>p.transform.height/2-p.transform.getHorizon()?c.N.convert(this._aroundCenter?p.center:p.unproject(u)):c.N.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Id?this._wheelZoomRate:this._defaultZoomRate;let z=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&z!==0&&(z=1/z);const F=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(F*z))),this._type==="wheel"&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:r.zoom,p=this._startZoom,m=this._easing;let _,S=!1;const E=A.now()-this._lastWheelEventTime;if(this._type==="wheel"&&p&&m&&E){const C=Math.min(E/200,1),z=m(C);_=c.y.number(p,u,z),C<1?this._frameId||(this._frameId=!0):S=!0}else _=u,S=!0;return this._active=!0,S&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!S,zoomDelta:_-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let u=c.b9;if(this._prevEase){const p=this._prevEase,m=(A.now()-p.start)/p.duration,_=p.easing(m+.01)-p.easing(m),S=.27/Math.sqrt(_*_+1e-4)*.01,E=Math.sqrt(.0729-S*S);u=c.b8(S,E,.25,1)}return this._prevEase={start:A.now(),duration:r,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class la{constructor(r,u){this._clickZoom=r,this._tapZoom=u}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 q_{constructor(r){this._tr=new _s(r),this.reset()}reset(){this._active=!1}dblclick(r,u){return r.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(r.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Y_{constructor(){this._tap=new xc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(r,u,p){if(!this._swipePoint)if(this._tapTime){const m=u[0],_=r.timeStamp-this._tapTime<500,S=this._tapPoint.dist(m)<30;_&&S?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(r,u,p)}touchmove(r,u,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=u[0],_=m.y-this._swipePoint.y;return this._swipePoint=m,r.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(r,u,p)}touchend(r,u,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(r,u,p);m&&(this._tapTime=r.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nm{constructor(r,u,p){this._el=r,this._mousePan=u,this._touchPan=p}enable(r){this._inertiaOptions=r||{},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 im{constructor(r,u,p){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=u,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Pd{constructor(r,u,p,m){this._el=r,this._touchZoom=u,this._touchRotate=p,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class el{constructor(r,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=r,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const r=this._map.getCanvasContainer();r.classList.add("maplibregl-cooperative-gestures"),this._container=M.create("div","maplibregl-cooperative-gesture-screen",r);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=u,this._container.appendChild(m);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=p,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(M.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(r){return r[this._bypassKey]}notifyGestureBlocked(r,u){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:r,originalEvent:u})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Qi=v=>v.zoom||v.drag||v.pitch||v.rotate;class St extends c.k{}function Tc(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Md{constructor(r,u){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,_)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const S=m.type==="renderFrame"?void 0:m,E={needsRenderFrame:!1},C={},z={},F=m.touches,B=F?this._getMapTouches(F):void 0,X=B?M.touchPos(this._map.getCanvas(),B):M.mousePos(this._map.getCanvas(),m);for(const{handlerName:ce,handler:pe,allowed:me}of this._handlers){if(!pe.isEnabled())continue;let we;this._blockedByActive(z,me,ce)?pe.reset():pe[_||m.type]&&(we=pe[_||m.type](m,X,B),this.mergeHandlerResult(E,C,we,ce,S),we&&we.needsRenderFrame&&this._triggerRenderFrame()),(we||pe.isActive())&&(z[ce]=pe)}const Q={};for(const ce in this._previousActiveHandlers)z[ce]||(Q[ce]=S);this._previousActiveHandlers=z,(Object.keys(Q).length||Tc(E))&&(this._changes.push([E,C,Q]),this._triggerRenderFrame()),(Object.keys(z).length||Tc(E))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:re}=E;re&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],re(this._map))},this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _d(r),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,_,S]of this._listeners)M.addEventListener(m,_,m===document?this.handleWindowEvent:this.handleEvent,S)}destroy(){for(const[r,u,p]of this._listeners)M.removeEventListener(r,u,r===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(r){const u=this._map,p=u.getCanvasContainer();this._add("mapEvent",new tm(u,r));const m=u.boxZoom=new zi(u,r);this._add("boxZoom",m),r.interactive&&r.boxZoom&&m.enable();const _=u.cooperativeGestures=new el(u,r.cooperativeGestures);this._add("cooperativeGestures",_),r.cooperativeGestures&&_.enable();const S=new Ja(u),E=new q_(u);u.doubleClickZoom=new la(E,S),this._add("tapZoom",S),this._add("clickZoom",E),r.interactive&&r.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Y_;this._add("tapDragZoom",C);const z=u.touchPitch=new Qa(u);this._add("touchPitch",z),r.interactive&&r.touchPitch&&u.touchPitch.enable(r.touchPitch);const F=bd(r),B=Sd(r);u.dragRotate=new im(r,F,B),this._add("mouseRotate",F,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]),r.interactive&&r.dragRotate&&u.dragRotate.enable();const X=(({enable:we,clickTolerance:ae})=>{const Ce=new wc({checkCorrectEvent:Pe=>M.mouseButton(Pe)===0&&!Pe.ctrlKey});return new lo({clickTolerance:ae,move:(Pe,ze)=>({around:ze,panDelta:ze.sub(Pe)}),activateOnStart:!0,moveStateManager:Ce,enable:we,assignEvents:bc})})(r),Q=new aa(r,u);u.dragPan=new nm(p,X,Q),this._add("mousePan",X),this._add("touchPan",Q,["touchZoom","touchRotate"]),r.interactive&&r.dragPan&&u.dragPan.enable(r.dragPan);const re=new Cd,ce=new Td;u.touchZoomRotate=new Pd(p,ce,re,C),this._add("touchRotate",re,["touchPan","touchZoom"]),this._add("touchZoom",ce,["touchPan","touchRotate"]),r.interactive&&r.touchZoomRotate&&u.touchZoomRotate.enable(r.touchZoomRotate);const pe=u.scrollZoom=new vs(u,()=>this._triggerRenderFrame());this._add("scrollZoom",pe,["mousePan"]),r.interactive&&r.scrollZoom&&u.scrollZoom.enable(r.scrollZoom);const me=u.keyboard=new Ji(u);this._add("keyboard",me),r.interactive&&r.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new pn(u))}_add(r,u,p){this._handlers.push({handlerName:r,handler:u,allowed:p}),this._handlersById[r]=u}stop(r){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[]}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Qi(this._eventsInProgress)||this.isZooming()}_blockedByActive(r,u,p){for(const m in r)if(m!==p&&(!u||u.indexOf(m)<0))return!0;return!1}_getMapTouches(r){const u=[];for(const p of r)this._el.contains(p.target)&&u.push(p);return u}mergeHandlerResult(r,u,p,m,_){if(!p)return;c.e(r,p);const S={handlerName:m,originalEvent:p.originalEvent||_};p.zoomDelta!==void 0&&(u.zoom=S),p.panDelta!==void 0&&(u.drag=S),p.pitchDelta!==void 0&&(u.pitch=S),p.bearingDelta!==void 0&&(u.rotate=S)}_applyChanges(){const r={},u={},p={};for(const[m,_,S]of this._changes)m.panDelta&&(r.panDelta=(r.panDelta||new c.P(0,0))._add(m.panDelta)),m.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(r.around=m.around),m.pinchAround!==void 0&&(r.pinchAround=m.pinchAround),m.noInertia&&(r.noInertia=m.noInertia),c.e(u,_),c.e(p,S);this._updateMapTransform(r,u,p),this._changes=[]}_updateMapTransform(r,u,p){const m=this._map,_=m._getTransformForUpdate(),S=m.terrain;if(!(Tc(r)||S&&this._terrainMovement))return this._fireEvents(u,p,!0);let{panDelta:E,zoomDelta:C,bearingDelta:z,pitchDelta:F,around:B,pinchAround:X}=r;X!==void 0&&(B=X),m._stop(!0),B=B||m.transform.centerPoint;const Q=_.pointLocation(E?B.sub(E):B);z&&(_.bearing+=z),F&&(_.pitch+=F),C&&(_.zoom+=C),S?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(E)):_.setLocationAtPoint(Q,B):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(Q,B)):_.setLocationAtPoint(Q,B),m._applyUpdatedTransform(_),this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(u,p,!0)}_fireEvents(r,u,p){const m=Qi(this._eventsInProgress),_=Qi(r),S={};for(const B in r){const{originalEvent:X}=r[B];this._eventsInProgress[B]||(S[`${B}start`]=X),this._eventsInProgress[B]=r[B]}!m&&_&&this._fireEvent("movestart",_.originalEvent);for(const B in S)this._fireEvent(B,S[B]);_&&this._fireEvent("move",_.originalEvent);for(const B in r){const{originalEvent:X}=r[B];this._fireEvent(B,X)}const E={};let C;for(const B in this._eventsInProgress){const{handlerName:X,originalEvent:Q}=this._eventsInProgress[B];this._handlersById[X].isActive()||(delete this._eventsInProgress[B],C=u[X]||Q,E[`${B}end`]=C)}for(const B in E)this._fireEvent(B,E[B]);const z=Qi(this._eventsInProgress),F=(m||_)&&!z;if(F&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const B=this._map._getTransformForUpdate();B.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(B)}if(p&&F){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),X=Q=>Q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new St("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class sm extends c.E{constructor(r,u){super(),this._renderFrameCallback=()=>{const p=Math.min((A.now()-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=r,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(r,u){return this.jumpTo({center:r},u)}panBy(r,u,p){return r=c.P.convert(r).mult(-1),this.panTo(this.transform.center,c.e({offset:r},u),p)}panTo(r,u,p){return this.easeTo(c.e({center:r},u),p)}getZoom(){return this.transform.zoom}setZoom(r,u){return this.jumpTo({zoom:r},u),this}zoomTo(r,u,p){return this.easeTo(c.e({zoom:r},u),p)}zoomIn(r,u){return this.zoomTo(this.getZoom()+1,r,u),this}zoomOut(r,u){return this.zoomTo(this.getZoom()-1,r,u),this}getBearing(){return this.transform.bearing}setBearing(r,u){return this.jumpTo({bearing:r},u),this}getPadding(){return this.transform.padding}setPadding(r,u){return this.jumpTo({padding:r},u),this}rotateTo(r,u,p){return this.easeTo(c.e({bearing:r},u),p)}resetNorth(r,u){return this.rotateTo(0,c.e({duration:1e3},r),u),this}resetNorthPitch(r,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},r),u),this}snapToNorth(r,u){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=c.y.number(_,pe,Xe)),this._rotating&&(m.bearing=c.y.number(S,z,Xe)),this._pitching&&(m.pitch=c.y.number(E,F,Xe)),this._padding&&(m.interpolatePadding(C,B,Xe),Q=m.centerPoint.add(X)),this.terrain&&!r.freezeElevation&&this._updateElevation(Xe),Ce)m.setLocationAtPoint(Ce,Pe);else{const st=m.zoomScale(m.zoom-_),gt=pe>_?Math.min(2,ae):Math.max(.5,ae),wt=Math.pow(gt,1-Xe),dt=m.unproject(me.add(we.mult(Xe*wt)).mult(st));m.setLocationAtPoint(m.renderWorldCopies?dt.wrap():dt,Q)}this._applyUpdatedTransform(m),this._fireMoveEvents(u)},Xe=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(u,Xe)},r),this}_prepareEase(r,u,p={}){this._moving=!0,u||p.moving||this.fire(new c.k("movestart",r)),this._zooming&&!p.zooming&&this.fire(new c.k("zoomstart",r)),this._rotating&&!p.rotating&&this.fire(new c.k("rotatestart",r)),this._pitching&&!p.pitching&&this.fire(new c.k("pitchstart",r))}_prepareElevation(r){this._elevationCenter=r,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(r){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(r<1&&u!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=r*(p-(u-(p*r+this._elevationStart))/(1-r)),this._elevationTarget=u}this.transform.elevation=c.y.number(this._elevationStart,this._elevationTarget,r)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(r){const u=r.getCameraPosition(),p=this.terrain.getElevationForLngLatZoom(u.lngLat,r.zoom);if(u.altitudethis._elevateCameraIfInsideTerrain(m)),this.transformCameraUpdate&&u.push(m=>this.transformCameraUpdate(m)),!u.length)return;const p=r.clone();for(const m of u){const _=p.clone(),{center:S,zoom:E,pitch:C,bearing:z,elevation:F}=m(_);S&&(_.center=S),E!==void 0&&(_.zoom=E),C!==void 0&&(_.pitch=C),z!==void 0&&(_.bearing=z),F!==void 0&&(_.elevation=F),p.apply(_)}this.transform.apply(p)}_fireMoveEvents(r){this.fire(new c.k("move",r)),this._zooming&&this.fire(new c.k("zoom",r)),this._rotating&&this.fire(new c.k("rotate",r)),this._pitching&&this.fire(new c.k("pitch",r))}_afterEase(r,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const p=this._zooming,m=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new c.k("zoomend",r)),m&&this.fire(new c.k("rotateend",r)),_&&this.fire(new c.k("pitchend",r)),this.fire(new c.k("moveend",r))}flyTo(r,u){var p;if(!r.essential&&A.prefersReducedMotion){const _t=c.M(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(_t,u)}this.stop(),r=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},r);const m=this._getTransformForUpdate(),_=m.zoom,S=m.bearing,E=m.pitch,C=m.padding,z="bearing"in r?this._normalizeBearing(r.bearing,S):S,F="pitch"in r?+r.pitch:E,B="padding"in r?r.padding:m.padding,X=c.P.convert(r.offset);let Q=m.centerPoint.add(X);const re=m.pointLocation(Q),{center:ce,zoom:pe}=m.getConstrained(c.N.convert(r.center||re),(p=r.zoom)!==null&&p!==void 0?p:_);this._normalizeCenter(ce,m);const me=m.zoomScale(pe-_),we=m.project(re),ae=m.project(ce).sub(we);let Ce=r.curve;const Pe=Math.max(m.width,m.height),ze=Pe/me,Xe=ae.mag();if("minZoom"in r){const _t=c.ac(Math.min(r.minZoom,_,pe),m.minZoom,m.maxZoom),Gt=Pe/m.zoomScale(_t-_);Ce=Math.sqrt(Gt/Xe*2)}const st=Ce*Ce;function gt(_t){const Gt=(ze*ze-Pe*Pe+(_t?-1:1)*st*st*Xe*Xe)/(2*(_t?ze:Pe)*st*Xe);return Math.log(Math.sqrt(Gt*Gt+1)-Gt)}function wt(_t){return(Math.exp(_t)-Math.exp(-_t))/2}function dt(_t){return(Math.exp(_t)+Math.exp(-_t))/2}const ct=gt(!1);let Pt=function(_t){return dt(ct)/dt(ct+Ce*_t)},qt=function(_t){return Pe*((dt(ct)*(wt(Gt=ct+Ce*_t)/dt(Gt))-wt(ct))/st)/Xe;var Gt},ft=(gt(!0)-ct)/Ce;if(Math.abs(Xe)<1e-6||!isFinite(ft)){if(Math.abs(Pe-ze)<1e-6)return this.easeTo(r,u);const _t=ze0,Pt=Gt=>Math.exp(_t*Ce*Gt)}return r.duration="duration"in r?+r.duration:1e3*ft/("screenSpeed"in r?+r.screenSpeed/Ce:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=S!==z,this._pitching=F!==E,this._padding=!m.isPaddingEqual(B),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(ce),this._ease(_t=>{const Gt=_t*ft,Hr=1/Pt(Gt);m.zoom=_t===1?pe:_+m.scaleZoom(Hr),this._rotating&&(m.bearing=c.y.number(S,z,_t)),this._pitching&&(m.pitch=c.y.number(E,F,_t)),this._padding&&(m.interpolatePadding(C,B,_t),Q=m.centerPoint.add(X)),this.terrain&&!r.freezeElevation&&this._updateElevation(_t);const tr=_t===1?ce:m.unproject(we.add(ae.mult(qt(Gt))).mult(Hr));m.setLocationAtPoint(m.renderWorldCopies?tr.wrap():tr,Q),this._applyUpdatedTransform(m),this._fireMoveEvents(u)},()=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(u)},r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,u){var p;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,u)}return r||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(r,u,p){p.animate===!1||p.duration===0?(r(1),u()):(this._easeStart=A.now(),this._easeOptions=p,this._onEaseFrame=r,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(r,u){r=c.b3(r,-180,180);const p=Math.abs(r-u);return Math.abs(r-360-u)180?-360:p<-180?360:0}queryTerrainElevation(r){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(r),this.transform.tileZoom)-this.transform.elevation:null}}const tl={compact:!0,customAttribution:'MapLibre'};class rl{constructor(r=tl){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=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.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=r}getDefaultPosition(){return"bottom-right"}onAdd(r){return this._map=r,this._compact=this.options.compact,this._container=M.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=M.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=M.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(){M.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(r,u){const p=this._map._getUIString(`AttributionControl.${u}`);r.title=p,r.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let r=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=r.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&r.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const u=this._map.style.sourceCaches;for(const m in u){const _=u[m];if(_.used||_.usedForTerrain){const S=_.getSource();S.attribution&&r.indexOf(S.attribution)<0&&r.push(S.attribution)}}r=r.filter(m=>String(m).trim()),r.sort((m,_)=>m.length-_.length),r=r.filter((m,_)=>{for(let S=_+1;S=0)return!1;return!0});const p=r.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,r.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ad{constructor(r={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const p=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=r}getDefaultPosition(){return"bottom-left"}onAdd(r){this._map=r,this._compact=this.options&&this.options.compact,this._container=M.create("div","maplibregl-ctrl");const u=M.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){M.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ur{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const u=++this._id;return this._queue.push({callback:r,id:u,cancelled:!1}),u}remove(r){const u=this._currentlyRunning,p=u?this._queue.concat(u):this._queue;for(const m of p)if(m.id===r)return void(m.cancelled=!0)}run(r=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const p of u)if(!p.cancelled&&(p.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Dd=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class X_ extends c.E{constructor(r){super(),this.sourceCache=r,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,r.usedForTerrain=!0,r.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(r,u){this.sourceCache.update(r,u),this._renderableTilesKeys=[];const p={};for(const m of r.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),c.aP(m.posMatrix,0,c.X,0,c.X,0,1),this._tiles[m.key]=new pi(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(r){for(const u in this._tiles){const p=this._tiles[u];(!r||p.tileID.equals(r)||p.tileID.isChildOf(r)||r.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(r=>this.getTileByID(r))}getTileByID(r){return this._tiles[r]}getTerrainCoords(r){const u={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16),c.aP(_.posMatrix,0,c.X,0,c.X,0,1),u[p]=_}else if(m.canonical.isChildOf(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=m.canonical.z-r.canonical.z,E=m.canonical.x-(m.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,z,0,z,0,1),c.J(_.posMatrix,_.posMatrix,[-E*z,-C*z,0]),u[p]=_}else if(r.canonical.isChildOf(m.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=r.canonical.z-m.canonical.z,E=r.canonical.x-(r.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,c.X,0,c.X,0,1),c.J(_.posMatrix,_.posMatrix,[E*z,C*z,0]),c.K(_.posMatrix,_.posMatrix,[1/2**S,1/2**S,0]),u[p]=_}}return u}getSourceTile(r,u){const p=this.sourceCache._source;let m=r.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(r.scaledTo(m--).key);return _}tilesAfterTime(r=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=r)}}class zd{constructor(r,u,p){this.painter=r,this.sourceCache=new X_(u),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(r,u,p,m=c.X){var _;if(!(u>=0&&u=0&&pr.canonical.z&&(r.canonical.z>=m?_=r.canonical.z-m:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const S=r.canonical.x-(r.canonical.x>>_<<_),E=r.canonical.y-(r.canonical.y>>_<<_),C=c.bc(new Float64Array(16),[1/(c.X<<_),1/(c.X<<_),0]);c.J(C,C,[S*c.X,E*c.X,0]),this._demMatrixCache[r.key]={matrix:C,coord:r}}return{u_depth:2,u_terrain:3,u_terrain_dim:u&&u.dem&&u.dem.dim||1,u_terrain_matrix:p?this._demMatrixCache[r.key].matrix:this._emptyDemMatrix,u_terrain_unpack:u&&u.dem&&u.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(u&&u.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:u}}getFramebuffer(r){const u=this.painter,p=u.width/devicePixelRatio,m=u.height/devicePixelRatio;return!this._fbo||this._fbo.width===p&&this._fbo.height===m||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new it(u.context,{width:p,height:m,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new it(u.context,{width:p,height:m,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=u.context.createFramebuffer(p,m,!0,!1),this._fbo.depthAttachment.set(u.context.createRenderbuffer(u.context.gl.DEPTH_COMPONENT16,p,m))),this._fbo.colorAttachment.set(r==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const r=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const u=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,S=0;_>8<<4|_>>8,u[S+3]=0;const p=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),m=new it(r,p,r.gl.RGBA,{premultiply:!1});return m.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(r){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),p=this.painter.context,m=p.gl,_=Math.round(r.x*this.painter.pixelRatio/devicePixelRatio),S=Math.round(r.y*this.painter.pixelRatio/devicePixelRatio),E=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(_,E-S-1,1,1,m.RGBA,m.UNSIGNED_BYTE,u),p.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),z=u[1]+((15&u[2])<<8),F=this.coordsIndex[255-u[3]],B=F&&this.sourceCache.getTileByID(F);if(!B)return null;const X=this._coordsTextureSize,Q=(1<r.id!==u),this._recentlyUsed.push(r.id)}stampObject(r){r.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const r=this._createObject(this._objects.length);return this._objects.push(r),r}freeObject(r){r.inUse=!1}freeAllObjects(){for(const r of this._objects)this.freeObject(r)}isFull(){return!(this._objects.length!r.inUse)===!1}}const nl={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class om{constructor(r,u){this.painter=r,this.terrain=u,this.pool=new K_(r.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(r){return this.pool.getObjectForId(r.rtt[this._stacks.length-1].id).texture}prepareForRender(r,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=r._order.filter(p=>!r._layers[p].isHidden(u)),this._coordsDescendingInv={};for(const p in r.sourceCaches){this._coordsDescendingInv[p]={};const m=r.sourceCaches[p].getVisibleCoordinates();for(const _ of m){const S=this.terrain.sourceCache.getTerrainCoords(_);for(const E in S)this._coordsDescendingInv[p][E]||(this._coordsDescendingInv[p][E]=[]),this._coordsDescendingInv[p][E].push(S[E])}}this._coordsDescendingInvStr={};for(const p of r._order){const m=r._layers[p],_=m.source;if(nl[m.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const S in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][S]=this._coordsDescendingInv[_][S].map(E=>E.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[m][p.tileID.key];_&&_!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(r){if(r.isHidden(this.painter.transform.zoom))return!1;const u=r.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===r.id;if(nl[u]&&(this._prevType&&nl[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(r.id),!m))return!0;if(nl[this._prevType]||nl[u]&&m){this._prevType=u;const _=this._stacks.length-1,S=this._stacks[_]||[];for(const E of this._renderableTiles){if(this.pool.isFull()&&(Jp(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(E),E.rtt[_]){const z=this.pool.getObjectForId(E.rtt[_].id);if(z.stamp===E.rtt[_].stamp){this.pool.useObject(z);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),E.rtt[_]={id:C.id,stamp:C.stamp},p.context.bindFramebuffer.set(C.fbo.framebuffer),p.context.clear({color:c.aM.transparent,stencil:0}),p.currentStencilSource=void 0;for(let z=0;z{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},Q_={showCompass:!0,showZoom:!0,visualizePitch:!1};class e0{constructor(r,u,p=!1){this.mousedown=S=>{this.startMouse(c.e({},S,{ctrlKey:!0,preventDefault:()=>S.preventDefault()}),M.mousePos(this.element,S)),M.addEventListener(window,"mousemove",this.mousemove),M.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=S=>{this.moveMouse(S,M.mousePos(this.element,S))},this.mouseup=S=>{this.mouseRotate.dragEnd(S),this.mousePitch&&this.mousePitch.dragEnd(S),this.offTemp()},this.touchstart=S=>{S.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=M.touchPos(this.element,S.targetTouches)[0],this.startTouch(S,this._startPos),M.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.addEventListener(window,"touchend",this.touchend))},this.touchmove=S=>{S.targetTouches.length!==1?this.reset():(this._lastPos=M.touchPos(this.element,S.targetTouches)[0],this.moveTouch(S,this._lastPos))},this.touchend=S=>{S.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=r.dragRotate._mouseRotate.getClickTolerance(),_=r.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=bd({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:S,clickTolerance:E,bearingDegreesPerPixelMoved:C=.8})=>{const z=new wd;return new lo({clickTolerance:E,move:(F,B)=>({bearingDelta:(B.x-F.x)*C}),moveStateManager:z,enable:S,assignEvents:Ld})})({clickTolerance:m,enable:!0}),this.map=r,p&&(this.mousePitch=Sd({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:S,clickTolerance:E,pitchDegreesPerPixelMoved:C=-.5})=>{const z=new wd;return new lo({clickTolerance:E,move:(F,B)=>({pitchDelta:(B.y-F.y)*C}),moveStateManager:z,enable:S,assignEvents:Ld})})({clickTolerance:_,enable:!0})),M.addEventListener(u,"mousedown",this.mousedown),M.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),M.addEventListener(u,"touchcancel",this.reset)}startMouse(r,u){this.mouseRotate.dragStart(r,u),this.mousePitch&&this.mousePitch.dragStart(r,u),M.disableDrag()}startTouch(r,u){this.touchRotate.dragStart(r,u),this.touchPitch&&this.touchPitch.dragStart(r,u),M.disableDrag()}moveMouse(r,u){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(r,u)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(r,u)||{};_&&p.setPitch(p.getPitch()+_)}}moveTouch(r,u){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(r,u)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(r,u)||{};_&&p.setPitch(p.getPitch()+_)}}off(){const r=this.element;M.removeEventListener(r,"mousedown",this.mousedown),M.removeEventListener(r,"touchstart",this.touchstart,{passive:!1}),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend),M.removeEventListener(r,"touchcancel",this.reset),this.offTemp()}offTemp(){M.enableDrag(),M.removeEventListener(window,"mousemove",this.mousemove),M.removeEventListener(window,"mouseup",this.mouseup),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend)}}let Ri;function Vr(v,r,u){const p=new c.N(v.lng,v.lat);if(v=new c.N(v.lng,v.lat),r){const m=new c.N(v.lng-360,v.lat),_=new c.N(v.lng+360,v.lat),S=u.locationPoint(v).distSqr(r);u.locationPoint(m).distSqr(r)180;){const m=u.locationPoint(v);if(m.x>=0&&m.y>=0&&m.x<=u.width&&m.y<=u.height)break;v.lng>u.center.lng?v.lng-=360:v.lng+=360}return v.lng!==p.lng&&u.locationPoint(v).y>u.height/2-u.getHorizon()?v:p}const il={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 Ec(v,r,u){const p=v.classList;for(const m in il)p.remove(`maplibregl-${u}-anchor-${m}`);p.add(`maplibregl-${u}-anchor-${r}`)}class Cc extends c.E{constructor(r){if(super(),this._onKeyPress=u=>{const p=u.code,m=u.charCode||u.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=u=>{const p=u.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=u=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vr(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let S="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?S="rotateX(0deg)":this._pitchAlignment==="map"&&(S=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||u&&u.type!=="moveend"||(this._pos=this._pos.round()),M.setTransform(this._element,`${il[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${S} ${_}`),A.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=u.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 c.k("dragstart"))),this.fire(new c.k("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 c.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.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=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._subpixelPositioning=r&&r.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment!=="auto"?r.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(r==null?void 0:r.opacity,r==null?void 0:r.opacityWhenCovered),r&&r.element)this._element=r.element,this._offset=c.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=M.create("div");const u=M.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${p}px`),u.setAttributeNS(null,"width",`${m}px`),u.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const _=M.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const S=M.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill-rule","nonzero");const E=M.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(3.0, 29.0)"),E.setAttributeNS(null,"fill","#000000");const 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(const me of C){const we=M.createNS("http://www.w3.org/2000/svg","ellipse");we.setAttributeNS(null,"opacity","0.04"),we.setAttributeNS(null,"cx","10.5"),we.setAttributeNS(null,"cy","5.80029008"),we.setAttributeNS(null,"rx",me.rx),we.setAttributeNS(null,"ry",me.ry),E.appendChild(we)}const z=M.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);const F=M.createNS("http://www.w3.org/2000/svg","path");F.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(F);const B=M.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"opacity","0.25"),B.setAttributeNS(null,"fill","#000000");const X=M.createNS("http://www.w3.org/2000/svg","path");X.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"),B.appendChild(X);const Q=M.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Q.setAttributeNS(null,"fill","#FFFFFF");const re=M.createNS("http://www.w3.org/2000/svg","g");re.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ce=M.createNS("http://www.w3.org/2000/svg","circle");ce.setAttributeNS(null,"fill","#000000"),ce.setAttributeNS(null,"opacity","0.25"),ce.setAttributeNS(null,"cx","5.5"),ce.setAttributeNS(null,"cy","5.5"),ce.setAttributeNS(null,"r","5.4999962");const pe=M.createNS("http://www.w3.org/2000/svg","circle");pe.setAttributeNS(null,"fill","#FFFFFF"),pe.setAttributeNS(null,"cx","5.5"),pe.setAttributeNS(null,"cy","5.5"),pe.setAttributeNS(null,"r","5.4999962"),re.appendChild(ce),re.appendChild(pe),S.appendChild(E),S.appendChild(z),S.appendChild(B),S.appendChild(Q),S.appendChild(re),u.appendChild(S),u.setAttributeNS(null,"height",p*this._scale+"px"),u.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(r&&r.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),Ec(this._element,this._anchor,"marker"),r&&r.className)for(const u of r.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(r){return this.remove(),this._map=r,this._element.setAttribute("aria-label",r._getUIString("Marker.Title")),r.getCanvasContainer().appendChild(this._element),r.on("move",this._update),r.on("moveend",this._update),r.on("terrain",this._update),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("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),M.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=c.N.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const m=Math.abs(13.5)/Math.SQRT2;r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(r){return this._subpixelPositioning=r,this}getPopup(){return this._popup}togglePopup(){const r=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:r?(r.isOpen()?r.remove():(r.setLngLat(this._lngLat),r.addTo(this._map)),this):this}_updateOpacity(r=!1){var u,p;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(r)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),S=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,S)-_<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/m.transform._pixelPerMeter,C=Math.sin(m.getPitch()*Math.PI/180)*E,z=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),F=m.transform.lngLatToCameraDepth(this._lngLat,S+C)-z>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&F&&this._popup.remove(),this._element.style.opacity=F?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(r){return this._offset=c.P.convert(r),this._update(),this}addClassName(r){this._element.classList.add(r)}removeClassName(r){this._element.classList.remove(r)}toggleClassName(r){return this._element.classList.toggle(r)}setDraggable(r){return this._draggable=!!r,this._map&&(r?(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(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r&&r!=="auto"?r:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(r,u){return r===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),r!==void 0&&(this._opacity=r),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const lm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let lu=0,uu=!1;const Hs={maxWidth:100,unit:"metric"};function cu(v,r,u){const p=u&&u.maxWidth||100,m=v._container.clientHeight/2,_=v.unproject([0,m]),S=v.unproject([p,m]),E=_.distanceTo(S);if(u&&u.unit==="imperial"){const C=3.2808*E;C>5280?It(r,p,C/5280,v._getUIString("ScaleControl.Miles")):It(r,p,C,v._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?It(r,p,E/1852,v._getUIString("ScaleControl.NauticalMiles")):E>=1e3?It(r,p,E/1e3,v._getUIString("ScaleControl.Kilometers")):It(r,p,E,v._getUIString("ScaleControl.Meters"))}function It(v,r,u,p){const m=function(_){const S=Math.pow(10,`${Math.floor(_)}`.length-1);let E=_/S;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:E>=1?1:function(C){const z=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*z)/z}(E),S*E}(u);v.style.width=r*(m/u)+"px",v.innerHTML=`${m} ${p}`}const Ut={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ic=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pc(v){if(v){if(typeof v=="number"){const r=Math.round(Math.abs(v)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,v),"top-left":new c.P(r,r),"top-right":new c.P(-r,r),bottom:new c.P(0,-v),"bottom-left":new c.P(r,-r),"bottom-right":new c.P(-r,-r),left:new c.P(v,0),right:new c.P(-v,0)}}if(v instanceof c.P||Array.isArray(v)){const r=c.P.convert(v);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:c.P.convert(v.center||[0,0]),top:c.P.convert(v.top||[0,0]),"top-left":c.P.convert(v["top-left"]||[0,0]),"top-right":c.P.convert(v["top-right"]||[0,0]),bottom:c.P.convert(v.bottom||[0,0]),"bottom-left":c.P.convert(v["bottom-left"]||[0,0]),"bottom-right":c.P.convert(v["bottom-right"]||[0,0]),left:c.P.convert(v.left||[0,0]),right:c.P.convert(v.right||[0,0])}}return Pc(new c.P(0,0))}const Od=T;g.AJAXError=c.bh,g.Evented=c.E,g.LngLat=c.N,g.MercatorCoordinate=c.Z,g.Point=c.P,g.addProtocol=c.bi,g.config=c.a,g.removeProtocol=c.bj,g.AttributionControl=rl,g.BoxZoomHandler=zi,g.CanvasSource=at,g.CooperativeGesturesHandler=el,g.DoubleClickZoomHandler=la,g.DragPanHandler=nm,g.DragRotateHandler=im,g.EdgeInsets=Xa,g.FullscreenControl=class extends c.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var r;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((r=u==null?void 0:u.shadowRoot)===null||r===void 0)&&r.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:c.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(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){M.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=M.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);M.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},g.GeoJSONSource=tt,g.GeolocateControl=class extends c.E{constructor(v){super(),this._onSuccess=r=>{if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,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(r),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",r)),this._finish()}},this._updateCamera=r=>{const u=new c.N(r.coords.longitude,r.coords.latitude),p=r.coords.accuracy,m=this._map.getBearing(),_=c.e({bearing:m},this.options.fitBoundsOptions),S=ie.fromLngLat(u,p);this._map.fitBounds(S,_,{geolocateSource:!0})},this._updateMarker=r=>{if(r){const u=new c.N(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=r=>{if(this._map){if(this.options.trackUserLocation)if(r.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;const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&uu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",r)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=M.create("button","maplibregl-ctrl-geolocate",this._container),M.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=r=>{if(this._map){if(r===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=M.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Cc({element:this._dotElement}),this._circleElement=M.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Cc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},lm,v)}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(r=!1){if(Ri!==void 0&&!r)return Ri;if(window.navigator.permissions===void 0)return Ri=!!window.navigator.geolocation,Ri;try{Ri=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ri=!!window.navigator.geolocation}return Ri})}().then(r=>this._finishSetupUI(r)),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(),M.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,lu=0,uu=!1}_isOutOfMapMaxBounds(v){const r=this._map.getMaxBounds(),u=v.coords;return r&&(u.longituder.getEast()||u.latituder.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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),r=v.getSouthEast(),u=v.getNorthEast(),p=r.distanceTo(u),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":lu--,uu=!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 c.k("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 c.k("trackuserlocationstart")),this.fire(new c.k("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 v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),lu++,lu>1?(v={maximumAge:6e5,timeout:0},uu=!0):(v=this.options.positionOptions,uu=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}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)}},g.Hash=yc,g.ImageSource=ot,g.KeyboardHandler=Ji,g.LngLatBounds=ie,g.LogoControl=Ad,g.Map=class extends sm{constructor(v){c.bf.mark(c.bg.create);const r=Object.assign(Object.assign({},J_),v);if(r.minZoom!=null&&r.maxZoom!=null&&r.minZoom>r.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(r.minPitch!=null&&r.maxPitch!=null&&r.minPitch>r.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(r.minPitch!=null&&r.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(r.maxPitch!=null&&r.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ka(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),{bearingSnap:r.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ur,this._controls=[],this._mapId=c.a4(),this._contextLost=u=>{u.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:u}))},this._contextRestored=u=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:u}))},this._onMapScroll=u=>{if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=r.preserveDrawingBuffer===!0,this._antialias=r.antialias===!0,this._trackResize=r.trackResize===!0,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles===!0,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=r.crossSourceCollisions===!0,this._collectResourceTiming=r.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Rd),r.locale),this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this.transformCameraUpdate=r.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=r.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=q.addThrottleControl(()=>this.isMoving()),this._requestManager=new ne(r.transformRequest),typeof r.container=="string"){if(this._container=document.getElementById(r.container),!this._container)throw new Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let u=!1;const p=nu(m=>{this._trackResize&&!this._removed&&(this.resize(m),this.redraw())},50);this._resizeObserver=new ResizeObserver(m=>{u?p(m):u=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Md(this,r),this._hash=r.hash&&new yc(typeof r.hash=="string"&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,c.e({},r.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new rl(typeof r.attributionControl=="boolean"?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new Ad,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new c.k(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new c.k(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new c.k("sourcedataabort",u))})}_getMapId(){return this._mapId}addControl(v,r){if(r===void 0&&(r=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=v.onAdd(this);this._controls.push(v);const p=this._controlPositions[r];return r.indexOf("bottom")!==-1?p.insertBefore(u,p.firstChild):p.appendChild(u),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(v);return r>-1&&this._controls.splice(r,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,r,u,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,r,u,p)}resize(v){var r;const u=this._containerDimensions(),p=u[0],m=u[1],_=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,_),this.painter.resize(p,m,_),this.painter.overLimit()){const E=this.painter.context.gl;this._maxCanvasSize=[E.drawingBufferWidth,E.drawingBufferHeight];const C=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,C),this.painter.resize(p,m,C)}this.transform.resize(p,m),(r=this._requestedCameraState)===null||r===void 0||r.resize(p,m);const S=!this._moving;return S&&(this.stop(),this.fire(new c.k("movestart",v)).fire(new c.k("move",v))),this.fire(new c.k("resize",v)),S&&this.fire(new c.k("moveend",v)),this}_getClampedPixelRatio(v,r){const{0:u,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),_=v*m,S=r*m;return Math.min(_>u?u/_:1,S>p?p/S:1)*m}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(ie.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(c.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(c.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,r,u){if(v==="mouseenter"||v==="mouseover"){let p=!1;return{layers:r,listener:u,delegates:{mousemove:_=>{const S=r.filter(C=>this.getLayer(C)),E=S.length!==0?this.queryRenderedFeatures(_.point,{layers:S}):[];E.length?p||(p=!0,u.call(this,new Wn(v,this,_.originalEvent,{features:E}))):p=!1},mouseout:()=>{p=!1}}}}if(v==="mouseleave"||v==="mouseout"){let p=!1;return{layers:r,listener:u,delegates:{mousemove:S=>{const E=r.filter(C=>this.getLayer(C));(E.length!==0?this.queryRenderedFeatures(S.point,{layers:E}):[]).length?p=!0:p&&(p=!1,u.call(this,new Wn(v,this,S.originalEvent)))},mouseout:S=>{p&&(p=!1,u.call(this,new Wn(v,this,S.originalEvent)))}}}}{const p=m=>{const _=r.filter(E=>this.getLayer(E)),S=_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[];S.length&&(m.features=S,u.call(this,m),delete m.features)};return{layers:r,listener:u,delegates:{[v]:p}}}}_saveDelegatedListener(v,r){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(r)}_removeDelegatedListener(v,r,u){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const p=this._delegatedListeners[v];for(let m=0;mr.includes(S))){for(const S in _.delegates)this.off(S,_.delegates[S]);return void p.splice(m,1)}}}on(v,r,u){if(u===void 0)return super.on(v,r);const p=this._createDelegatedListener(v,typeof r=="string"?[r]:r,u);this._saveDelegatedListener(v,p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(v,r,u){if(u===void 0)return super.once(v,r);const p=typeof r=="string"?[r]:r,m=this._createDelegatedListener(v,p,u);for(const _ in m.delegates){const S=m.delegates[_];m.delegates[_]=(...E)=>{this._removeDelegatedListener(v,p,u),S(...E)}}this._saveDelegatedListener(v,m);for(const _ in m.delegates)this.once(_,m.delegates[_]);return this}off(v,r,u){return u===void 0?super.off(v,r):(this._removeDelegatedListener(v,typeof r=="string"?[r]:r,u),this)}queryRenderedFeatures(v,r){if(!this.style)return[];let u;const p=v instanceof c.P||Array.isArray(v),m=p?v:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(p?{}:v)||{},m instanceof c.P||typeof m[0]=="number")u=[c.P.convert(m)];else{const _=c.P.convert(m[0]),S=c.P.convert(m[1]);u=[_,new c.P(S.x,_.y),S,new c.P(_.x,S.y),_]}return this.style.queryRenderedFeatures(u,r,this.transform)}querySourceFeatures(v,r){return this.style.querySourceFeatures(v,r)}setStyle(v,r){return(r=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(v,r))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const r=this._locale[v];if(r==null)throw new Error(`Missing UI string '${v}'`);return r}_updateStyle(v,r){if(r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,r));const u=this.style&&r.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new ec(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,r,u):this.style.loadJSON(v,r,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ec(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,r){if(typeof v=="string"){const u=this._requestManager.transformRequest(v,"Style");c.h(u,new AbortController).then(p=>{this._updateDiff(p.data,r)}).catch(p=>{p&&this.fire(new c.j(p))})}else typeof v=="object"&&this._updateDiff(v,r)}_updateDiff(v,r){try{this.style.setState(v,r)&&this._update(!0)}catch(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(v,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(v,r){return this._lazyInitEmptyStyle(),this.style.addSource(v,r),this._update(!0)}isSourceLoaded(v){const r=this.style&&this.style.sourceCaches[v];if(r!==void 0)return r.loaded();this.fire(new c.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const r=this.style.sourceCaches[v.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&r.reload();for(const u in this.style._layers){const p=this.style._layers[u];p.type==="hillshade"&&p.source===v.source&&c.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.")}this.terrain=new zd(this.painter,r,v),this.painter.renderToTexture=new om(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(u.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:v})),this}getTerrain(){var v,r;return(r=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&r!==void 0?r:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const r in v){const u=v[r]._tiles;for(const p in u){const m=u[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,r,u={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:z}=u;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||c.b(r))){if(r.width===void 0||r.height===void 0)return this.fire(new c.j(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`")));{const{width:F,height:B,data:X}=r,Q=r;return this.style.addImage(v,{data:new c.R({width:F,height:B},new Uint8Array(X)),pixelRatio:p,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:z,sdf:m,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,v),this}}{const{width:F,height:B,data:X}=A.getImageData(r);this.style.addImage(v,{data:new c.R({width:F,height:B},X),pixelRatio:p,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:z,sdf:m,version:0})}}updateImage(v,r){const u=this.style.getImage(v);if(!u)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=r instanceof HTMLImageElement||c.b(r)?A.getImageData(r):r,{width:m,height:_,data:S}=p;if(m===void 0||_===void 0)return this.fire(new c.j(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(m!==u.data.width||_!==u.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const E=!(r instanceof HTMLImageElement||c.b(r));return u.data.replace(S,E),this.style.updateImage(v,u),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return q.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,r){return this._lazyInitEmptyStyle(),this.style.addLayer(v,r),this._update(!0)}moveLayer(v,r){return this.style.moveLayer(v,r),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,r,u){return this.style.setLayerZoomRange(v,r,u),this._update(!0)}setFilter(v,r,u={}){return this.style.setFilter(v,r,u),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,r,u,p={}){return this.style.setPaintProperty(v,r,u,p),this._update(!0)}getPaintProperty(v,r){return this.style.getPaintProperty(v,r)}setLayoutProperty(v,r,u,p={}){return this.style.setLayoutProperty(v,r,u,p),this._update(!0)}getLayoutProperty(v,r){return this.style.getLayoutProperty(v,r)}setGlyphs(v,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,r,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,r,u,p=>{p||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,r,u=>{u||this._update(!0)}),this}setLight(v,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,r){return this.style.setFeatureState(v,r),this._update()}removeFeatureState(v,r){return this.style.removeFeatureState(v,r),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,r=0;return this._container&&(v=this._container.clientWidth||400,r=this._container.clientHeight||300),[v,r]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const r=this._canvasContainer=M.create("div","maplibregl-canvas-container",v);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=M.create("canvas","maplibregl-canvas",r),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");const u=this._containerDimensions(),p=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],p);const m=this._controlContainer=M.create("div","maplibregl-control-container",v),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(S=>{_[S]=M.create("div",`maplibregl-ctrl-${S} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,r,u){this._canvas.width=Math.floor(u*v),this._canvas.height=Math.floor(u*r),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${r}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let r=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{r={requestedAttributes:v},p&&(r.statusMessage=p.statusMessage,r.type=p.type)},{once:!0});const u=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!u){const p="Failed to initialize WebGL";throw r?(r.message=p,new Error(JSON.stringify(r))):new Error(p)}this.painter=new gc(u,this.transform),N.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=A.now();this.style.zoomHistory.update(m,_);const S=new c.z(m,{now:_,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),E=S.crossFadingFactor();E===1&&E===this._crossFadingFactor||(u=!0,this._crossFadingFactor=E),this.style.update(S)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bf.mark(c.bg.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,c.bf.mark(c.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const u of this._controls)u.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),q.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r!=null&&r.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),M.remove(this._canvasContainer),M.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bf.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(v=>{c.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return am}getCameraTargetElevation(){return this.transform.elevation}},g.MapMouseEvent=Wn,g.MapTouchEvent=oa,g.MapWheelEvent=em,g.Marker=Cc,g.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const r=this._map.getZoom(),u=r===this._map.getMaxZoom(),p=r===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=r},this._setButtonTitle=(r,u)=>{const p=this._map._getUIString(`NavigationControl.${u}`);r.title=p,r.setAttribute("aria-label",p)},this.options=c.e({},Q_,v),this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),M.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),M.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=M.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new e0(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){M.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(v,r){const u=M.create("button",v,this._container);return u.type="button",u.addEventListener("click",r),u}},g.Popup=class extends c.E{constructor(v){super(),this.remove=()=>(this._content&&M.remove(this._content),this._container&&(M.remove(this._container),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("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=r=>{this._update(r.point)},this._onMouseMove=r=>{this._update(r.point)},this._onDrag=r=>{this._update(r.point)},this._update=r=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=M.create("div","maplibregl-popup",this._map.getContainer()),this._tip=M.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const E of this.options.className.split(" "))this._container.classList.add(E);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Vr(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!r)return;const p=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const _=Pc(this.options.offset);if(!m){const E=this._container.offsetWidth,C=this._container.offsetHeight;let z;z=p.y+_.bottom.ythis._map.transform.height-C?["bottom"]:[],p.xthis._map.transform.width-E/2&&z.push("right"),m=z.length===0?"bottom":z.join("-")}let S=p.add(_[m]);this.options.subpixelPositioning||(S=S.round()),M.setTransform(this._container,`${il[m]} translate(${S.x}px,${S.y}px)`),Ec(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Ut),v)}addTo(v){return this._map&&this.remove(),this._map=v,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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=c.N.convert(v),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),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._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const r=document.createDocumentFragment(),u=document.createElement("body");let p;for(u.innerHTML=v;p=u.firstChild,p;)r.appendChild(p);return this.setDOMContent(r)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=M.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=M.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Ic);v&&v.focus()}},g.RasterDEMTileSource=Ze,g.RasterTileSource=Te,g.ScaleControl=class{constructor(v){this._onMove=()=>{cu(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,cu(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hs),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){M.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},g.ScrollZoomHandler=vs,g.Style=ec,g.TerrainControl=class{constructor(v){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=v}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=M.create("button","maplibregl-ctrl-terrain",this._container),M.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(){M.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},g.TwoFingersTouchPitchHandler=Qa,g.TwoFingersTouchRotateHandler=Cd,g.TwoFingersTouchZoomHandler=Td,g.TwoFingersTouchZoomRotateHandler=Pd,g.VectorTileSource=se,g.VideoSource=kt,g.addSourceType=(v,r)=>c._(void 0,void 0,void 0,function*(){if(Tr(v))throw new Error(`A source type called "${v}" already exists.`);((u,p)=>{Bt[u]=p})(v,r)}),g.clearPrewarmedResources=function(){const v=er;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(nt),er=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()"))},g.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},g.getRTLTextPluginStatus=function(){return vn().getRTLTextPluginStatus()},g.getVersion=function(){return Od},g.getWorkerCount=function(){return rt.workerCount},g.getWorkerUrl=function(){return c.a.WORKER_URL},g.importScriptInWorkers=function(v){return fr().broadcast("IS",v)},g.prewarm=function(){Yt().acquire(nt)},g.setMaxParallelImageRequests=function(v){c.a.MAX_PARALLEL_IMAGE_REQUESTS=v},g.setRTLTextPlugin=function(v,r){return vn().setRTLTextPlugin(v,r)},g.setWorkerCount=function(v){rt.workerCount=v},g.setWorkerUrl=function(v){c.a.WORKER_URL=v}});var f=i;return f})})(yP);var D4=yP.exports;const vP=dp(D4),z4={version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:"© OpenStreetMap Contributors",maxzoom:19}},layers:[{id:"osm",type:"raster",source:"osm"}]};var jh={};/** * @license React * react-dom-server-legacy.browser.production.min.js * @@ -823,13 +823,13 @@ uniform ${F} ${B} u_${X}; * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var vP=Ht;function sr(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i