@mapvx/web-components 0.0.29 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/base-floor-selector-CE7cLn0s.cjs +2 -0
- package/dist/cjs/class-map-eCOKIRN0.cjs +12 -0
- package/dist/cjs/{compact-floor-selector-CM85VieL.cjs → compact-floor-selector-Bz6YDGPj.cjs} +4 -4
- package/dist/cjs/{consume-57OpMeCx.cjs → consume-BwFNwTeY.cjs} +3 -3
- package/dist/cjs/custom-map-2cHS_139.cjs +97 -0
- package/dist/cjs/floor-selector-C_EtfxAQ.cjs +15 -0
- package/dist/cjs/lazy-load-CQfPqI_4.cjs +56 -0
- package/dist/cjs/map-view-with-modal.cjs +1 -2
- package/dist/cjs/qr-modal-Cv_LW0Xb.cjs +16 -0
- package/dist/cjs/{route-options-EkTBrOWM.cjs → route-options-Cl_LAr4B.cjs} +2 -2
- package/dist/cjs/route-view-totems.cjs +3 -3
- package/dist/cjs/styles-Bt354u5n.cjs +2 -0
- package/dist/es/assets/accessibility-D3Vyfstu.js +2 -0
- package/dist/es/assets/back_arrow-B3RltzaY.js +2 -0
- package/dist/es/assets/{compact-floor-selector-DbMwoA34.js → compact-floor-selector-CfnqUycd.js} +12 -105
- package/dist/es/assets/components-DaeCLpLi.js +234 -0
- package/dist/es/assets/icon-destination-point-DEI58b8w.js +2 -0
- package/dist/es/assets/icon-origin-point-GS06gE2l.js +2 -0
- package/dist/es/assets/map-view-with-modal-D8l3YXwn.js +77 -0
- package/dist/es/assets/repeat_icon-DN4_p9eh.js +2 -0
- package/dist/es/assets/route-view-totems-Cr0VC9Fu.js +71 -0
- package/dist/es/assets/styles-BByP6ECU.js +2 -0
- package/dist/es/assets/utils-BxV274fg.js +2 -0
- package/dist/es/assets/walking-BggsSG4g.js +2 -0
- package/dist/es/index.js +1 -2
- package/dist/es/route-view-totems.js +1 -2
- package/dist/iife/map-view-with-modal.js +28 -34
- package/dist/iife/route-view-totems.js +75 -80
- package/package.json +58 -42
- package/dist/cjs/base-floor-selector--o9_09ZI.cjs +0 -2
- package/dist/cjs/class-map-BSlQmGw8.cjs +0 -12
- package/dist/cjs/custom-map-DRJdhNz0.cjs +0 -97
- package/dist/cjs/floor-selector-BwhllcLc.cjs +0 -15
- package/dist/cjs/lazy-load-CqAzFOsw.cjs +0 -61
- package/dist/cjs/maplibre-gl-BNL6ASmq.cjs +0 -2
- package/dist/cjs/qr-modal-LH9N2Lki.cjs +0 -16
- package/dist/components/custom-map.d.ts +0 -13
- package/dist/components/custom-map.js +0 -64
- package/dist/components/floor-selector.d.ts +0 -6
- package/dist/components/floor-selector.js +0 -40
- package/dist/components/qr-modal.d.ts +0 -7
- package/dist/components/qr-modal.js +0 -69
- package/dist/components/route-options.d.ts +0 -6
- package/dist/components/route-options.js +0 -51
- package/dist/components/zoom-controls.d.ts +0 -6
- package/dist/components/zoom-controls.js +0 -40
- package/dist/es/assets/accessibility-Cnj-vwGM.js +0 -4
- package/dist/es/assets/back_arrow-B4vxoqtW.js +0 -4
- package/dist/es/assets/components-DW6Fj5ug.js +0 -3854
- package/dist/es/assets/icon-destination-point-DY-ha1KN.js +0 -4
- package/dist/es/assets/icon-origin-point-v4_9Pmls.js +0 -4
- package/dist/es/assets/map-view-with-modal-C76m0zr6.js +0 -325
- package/dist/es/assets/maplibre-gl-BKzNcqp_.js +0 -4
- package/dist/es/assets/repeat_icon-CY61-fSZ.js +0 -4
- package/dist/es/assets/route-view-totems-CRCPdxwQ.js +0 -469
- package/dist/es/assets/utils-D7tfdubm.js +0 -13046
- package/dist/es/assets/walking-BmgeFukv.js +0 -4
- package/dist/route-view-totems.d.ts +0 -16
- package/dist/route-view-totems.js +0 -58
- package/dist/utils/styles.d.ts +0 -2
- package/dist/utils/styles.js +0 -5
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2019 Google LLC
|
|
5
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let n=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const r=this.t;if(e&&void 0===t){const e=void 0!==r&&1===r.length;e&&(t=i.get(r)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&i.set(r,t))}return t}toString(){return this.cssText}};const o=t=>new n("string"==typeof t?t:t+"",void 0,r),a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return o(e)})(t):t
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2017 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/,{is:s,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:d}=Object,p=globalThis,f=p.trustedTypes,m=f?f.emptyScript:"",g=p.reactiveElementPolyfillSupport,_=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},v=(t,e)=>!s(t,e),b={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:v};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(t,r,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){const{get:i,set:n}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=i?.call(this);n?.call(this,e),this.requestUpdate(t,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const t=d(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const t=this.properties,e=[...u(t),...h(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const t=this._$Eu(e,r);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((r,i)=>{if(e)r.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of i){const i=document.createElement("style"),n=t.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,r.appendChild(i)}})(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(void 0!==i&&!0===r.reflect){const n=(void 0!==r.converter?.toAttribute?r.converter:y).toAttribute(e,r.type);this._$Em=t,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){const r=this.constructor,i=r._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=r.getPropertyOptions(i),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=i,this[i]=n.fromAttribute(e,t.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){const i=this.constructor,n=this[t];if(r??=i.getPropertyOptions(t),!((r.hasChanged??v)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},o){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,r,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[_("elementProperties")]=new Map,x[_("finalized")]=new Map,g?.({ReactiveElement:x}),(p.reactiveElementVersions??=[]).push("2.1.0");
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2017 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
const w=globalThis,S=w.trustedTypes,T=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,I="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,P="?"+E,k=`<${P}>`,C=document,A=()=>C.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,R=Array.isArray,L="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,O=/>/g,F=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),N=/'/g,B=/"/g,j=/^(?:script|style|textarea|title)$/i,U=(t=>(e,...r)=>({_$litType$:t,strings:e,values:r}))(1),V=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),$=new WeakMap,q=C.createTreeWalker(C,129);function Z(t,e){if(!R(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const W=(t,e)=>{const r=t.length-1,i=[];let n,o=2===e?"<svg>":3===e?"<math>":"",a=D;for(let s=0;s<r;s++){const e=t[s];let r,l,c=-1,u=0;for(;u<e.length&&(a.lastIndex=u,l=a.exec(e),null!==l);)u=a.lastIndex,a===D?"!--"===l[1]?a=z:void 0!==l[1]?a=O:void 0!==l[2]?(j.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=F):void 0!==l[3]&&(a=F):a===F?">"===l[0]?(a=n??D,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,r=l[1],a=void 0===l[3]?F:'"'===l[3]?B:N):a===B||a===N?a=F:a===z||a===O?a=D:(a=F,n=void 0);const h=a===F&&t[s+1].startsWith("/>")?" ":"";o+=a===D?e+k:c>=0?(i.push(r),e.slice(0,c)+I+e.slice(c)+E+h):e+E+(-2===c?s:h)}return[Z(t,o+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class H{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,o=0;const a=t.length-1,s=this.parts,[l,c]=W(t,e);if(this.el=H.createElement(l,r),q.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=q.nextNode())&&s.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(I)){const e=c[o++],r=i.getAttribute(t).split(E),a=/([.?@])?(.*)/.exec(e);s.push({type:1,index:n,name:a[2],strings:r,ctor:"."===a[1]?Q:"?"===a[1]?tt:"@"===a[1]?et:K}),i.removeAttribute(t)}else t.startsWith(E)&&(s.push({type:6,index:n}),i.removeAttribute(t));if(j.test(i.tagName)){const t=i.textContent.split(E),e=t.length-1;if(e>0){i.textContent=S?S.emptyScript:"";for(let r=0;r<e;r++)i.append(t[r],A()),q.nextNode(),s.push({type:2,index:++n});i.append(t[e],A())}}}else if(8===i.nodeType)if(i.data===P)s.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf(E,t+1));)s.push({type:7,index:n}),t+=E.length-1}n++}}static createElement(t,e){const r=C.createElement("template");return r.innerHTML=t,r}}function X(t,e,r=t,i){if(e===V)return e;let n=void 0!==i?r._$Co?.[i]:r._$Cl;const o=M(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,r,i)),void 0!==i?(r._$Co??=[])[i]=n:r._$Cl=n),void 0!==n&&(e=X(t,n._$AS(t,e.values),n,i)),e}class J{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??C).importNode(e,!0);q.currentNode=i;let n=q.nextNode(),o=0,a=0,s=r[0];for(;void 0!==s;){if(o===s.index){let e;2===s.type?e=new Y(n,n.nextSibling,this,t):1===s.type?e=new s.ctor(n,s.name,s.strings,this,t):6===s.type&&(e=new rt(n,this,t)),this._$AV.push(e),s=r[++a]}o!==s?.index&&(n=q.nextNode(),o++)}return q.currentNode=C,i}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=G,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),M(t)?t===G||null==t||""===t?(this._$AH!==G&&this._$AR(),this._$AH=G):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>R(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==G&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,i="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=H.createElement(Z(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new J(i,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=$.get(t.strings);return void 0===e&&$.set(t.strings,e=new H(t)),e}k(t){R(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of t)i===e.length?e.push(r=new Y(this.O(A()),this.O(A()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class K{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=G,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=G}_$AI(t,e=this,r,i){const n=this.strings;let o=!1;if(void 0===n)t=X(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==V,o&&(this._$AH=t);else{const i=t;let a,s;for(t=n[0],a=0;a<n.length-1;a++)s=X(this,i[r+a],e,a),s===V&&(s=this._$AH[a]),o||=!M(s)||s!==this._$AH[a],s===G?t=G:t!==G&&(t+=(s??"")+n[a+1]),this._$AH[a]=s}o&&!i&&this.j(t)}j(t){t===G?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===G?void 0:t}}class tt extends K{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==G)}}class et extends K{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=X(this,t,e,0)??G)===V)return;const r=this._$AH,i=t===G&&r!==G||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==G&&(r===G||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class rt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const it=w.litHtmlPolyfillSupport;it?.(H,Y),(w.litHtmlVersions??=[]).push("3.3.0");const nt=globalThis;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/let ot=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const i=r?.renderBefore??e;let n=i._$litPart$;if(void 0===n){const t=r?.renderBefore??null;i._$litPart$=n=new Y(e.insertBefore(A(),t),t,void 0,r??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};ot._$litElement$=!0,ot.finalized=!0,nt.litElementHydrateSupport?.({LitElement:ot});const at=nt.litElementPolyfillSupport;at?.({LitElement:ot}),(nt.litElementVersions??=[]).push("4.2.0");
|
|
23
|
-
/**
|
|
24
|
-
* @license
|
|
25
|
-
* Copyright 2017 Google LLC
|
|
26
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/
|
|
28
|
-
const st={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:v},lt=(t=st,e,r)=>{const{kind:i,metadata:n}=r;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),o.set(r.name,t),"accessor"===i){const{name:i}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(i,n,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=r;return function(r){const n=this[i];e.call(this,r),this.requestUpdate(i,n,t)}}throw Error("Unsupported decorator location: "+i)};
|
|
29
|
-
/**
|
|
30
|
-
* @license
|
|
31
|
-
* Copyright 2017 Google LLC
|
|
32
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* @license
|
|
36
|
-
* Copyright 2021 Google LLC
|
|
37
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
-
*/
|
|
39
|
-
let ct=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};
|
|
40
|
-
/**
|
|
41
|
-
* @license
|
|
42
|
-
* Copyright 2021 Google LLC
|
|
43
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* @license
|
|
47
|
-
* Copyright 2021 Google LLC
|
|
48
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
-
*/
|
|
50
|
-
class ut{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[t,{disposer:e}]of this.subscriptions)t(this.o,e)},void 0!==t&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}}
|
|
51
|
-
/**
|
|
52
|
-
* @license
|
|
53
|
-
* Copyright 2021 Google LLC
|
|
54
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
-
*/class ht extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}}class dt extends ut{constructor(t,e,r){super(void 0!==e.context?e.initialValue:r),this.onContextRequest=t=>{if(t.context!==this.context)return;const e=t.contextTarget??t.composedPath()[0];e!==this.host&&(t.stopPropagation(),this.addCallback(t.callback,e,t.subscribe))},this.onProviderRequest=t=>{if(t.context!==this.context)return;if((t.contextTarget??t.composedPath()[0])===this.host)return;const e=new Set;for(const[r,{consumerHost:i}]of this.subscriptions)e.has(r)||(e.add(r),i.dispatchEvent(new ct(this.context,i,r,!0)));t.stopPropagation()},this.host=t,void 0!==e.context?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new ht(this.context,this.host))}}var pt,ft={exports:{}};var mt,gt=pt?ft.exports:(pt=1,self,mt=()=>(()=>{var t={773:function(t,e){!function(t){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}var n={SESSIONS:"sessions",EVENTS:"events",VIEWS:"views",SCROLLS:"scrolls",CLICKS:"clicks",FORMS:"forms",CRASHES:"crashes",ATTRIBUTION:"attribution",USERS:"users",STAR_RATING:"star-rating",LOCATION:"location",APM:"apm",FEEDBACK:"feedback",REMOTE_CONFIG:"remote-config"},o={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},a=Object.values(o),s={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},l={DEVELOPER_SUPPLIED:0,SDK_GENERATED:1,TEMPORARY_ID:2,URL_PROVIDED:3},c={BEAT_INTERVAL:500,QUEUE_SIZE:1e3,FAIL_TIMEOUT_AMOUNT:60,INACTIVITY_TIME:20,SESSION_UPDATE:60,MAX_EVENT_BATCH:100,SESSION_COOKIE_TIMEOUT:30,MAX_KEY_LENGTH:128,MAX_VALUE_SIZE:256,MAX_SEGMENTATION_VALUES:100,MAX_BREADCRUMB_COUNT:100,MAX_STACKTRACE_LINES_PER_THREAD:30,MAX_STACKTRACE_LINE_LENGTH:200},u={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js",CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},h=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"}),d="23.12.6",p="javascript_native_web",f=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,m="undefined"!=typeof window,g=globalThis.Countly||{};function _(t){var e=[];if(void 0!==t.options)for(var r=0;r<t.options.length;r++)t.options[r].selected&&e.push(t.options[r].value);return e.join(", ")}function y(){var t="xxxxxxxx";return(t=b(t,"[x]"))+Date.now().toString()}function v(){var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";return t=b(t,"[xy]")}function b(t,e){var r=(new Date).getTime(),i=new RegExp(e,"g");return t.replace(i,(function(t){var e=(r+16*Math.random())%16|0;return("x"===t?e:3&e|8).toString(16)}))}function x(){return Math.floor((new Date).getTime()/1e3)}var w=0;function S(){var t=(new Date).getTime();return w>=t?w++:w=t,w}function T(t,e,r){if(e&&Object.keys(e).length){if(void 0!==e[t])return e[t]}else if(void 0!==g[t])return g[t];return r}function I(t,e,r){for(var i in g.i)g.i[i].tracking_crashes&&g.i[i].recordError(t,e,r)}function E(t){var e=[];for(var r in t)e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")}function P(t){return"string"==typeof t&&"/"===t.substring(t.length-1)?t.substring(0,t.length-1):t}function k(t,e){for(var r,i={},n=0,o=e.length;n<o;n++)void 0!==t[r=e[n]]&&(i[r]=t[r]);return i}function C(t,e,r){if(r){for(var i,n=0,o=r.length;n<o;n++)void 0!==e[i=r[n]]&&(t[i]=e[i]);return t}}function A(t,e,r,i,n,o){var a={};if(t){if(Object.keys(t).length>i){var s={},l=0;for(var c in t)l<i&&(s[c]=t[c],l++);t=s}for(var u in t){var h=M(u,e,n,o),d=M(t[u],r,n,o);a[h]=d}}return a}function M(t,e,r,i){var n=t;return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&t.length>e&&(n=t.substring(0,e),i(s.DEBUG,r+", Key: [ "+t+" ] is longer than accepted length. It will be truncated.")),n}function R(t,e){for(e=e.toUpperCase();t;){if(t.nodeName.toUpperCase()===e)return t;t=t.parentElement}}function L(t,e,r){m&&(null!=t?void 0!==t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent("on"+e,r):H()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+e+"] event to nonexisting element"))}function D(t){return t?void 0!==t.target?t.target:t.srcElement:window.event.srcElement}function z(t){if(t)return t;var e=navigator.userAgent;return e||(e=O()),e}function O(t){if(t)return t;var e="";return navigator.userAgentData&&(e=navigator.userAgentData.brands.map((function(t){return t.brand+":"+t.version})).join(),e+=navigator.userAgentData.mobile?" mobi ":" ",e+=navigator.userAgentData.platform),e}function F(t){var e;if(t)e=t;else{if(navigator.userAgentData&&navigator.userAgentData.mobile)return"phone";e=z()}e=e.toLowerCase();var r="desktop",i=/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/;return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(e)?r="tablet":i.test(e)&&(r="phone"),r}function N(t){var e=/(CountlySiteBot|nuhk|Googlebot|GoogleSecurityScanner|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO|contxbot|PingdomBot|BingPreview|HeadlessChrome|Lighthouse)/;if(t)return e.test(t);var r=e.test(z()),i=e.test(O());return r||i}function B(t){return void 0===t.pageY&&"number"==typeof t.clientX&&document.documentElement&&(t.pageX=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t.pageY=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),t}function j(){var t=document;return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function U(){var t=document;return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function V(){var t=document;return Math.min(Math.min(t.body.clientHeight,t.documentElement.clientHeight),Math.min(t.body.offsetHeight,t.documentElement.offsetHeight),window.innerHeight)}function G(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function $(t,e,r,i,n,o){var a,s=document.createElement(t);s.setAttribute(e,r),s.setAttribute(i,n);var l=function(){a||o(),a=!0};o&&(s.onreadystatechange=l,s.onload=l),document.getElementsByTagName("head")[0].appendChild(s)}function q(t,e){$("script","type","text/javascript","src",t,e)}function Z(t,e){$("link","rel","stylesheet","href",t,e)}function W(){if(m){var t=document.getElementById("cly-loader");if(!t){var e="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}",r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),r.appendChild(i),(t=document.createElement("div")).setAttribute("id","cly-loader"),document.body.onload=function(){if(g.showLoaderProtection)H()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(t)}catch(ht){H()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+ht)}}}t.style.display="block"}}function H(){return!(!g||!g.debug||"undefined"==typeof console)}function X(){if(m){g.showLoaderProtection=!0;var t=document.getElementById("cly-loader");t&&(t.style.display="none")}}var J=i((function t(i){r(this,t);var u,b=this,w=!g.i,$=!1,J="/i",Y="/o/sdk",K=T("interval",i,c.BEAT_INTERVAL),Q=T("queue_size",i,c.QUEUE_SIZE),tt=[],et=[],rt={},it=[],nt={},ot=T("ignore_referrers",i,[]),at=null,st=!0,lt=0,ct=null,ut=0,dt=0,pt=0,ft=T("fail_timeout",i,c.FAIL_TIMEOUT_AMOUNT),mt=T("inactivity_time",i,c.INACTIVITY_TIME),gt=0,_t=T("session_update",i,c.SESSION_UPDATE),yt=T("max_events",i,c.MAX_EVENT_BATCH),vt=T("max_logs",i,null),bt=T("use_session_cookie",i,!0),xt=T("session_cookie_timeout",i,c.SESSION_COOKIE_TIMEOUT),wt=!0,St=!1,Tt=T("offline_mode",i,!1),It={},Et=!0,Pt=x(),kt=!0,Ct=null,At=l.SDK_GENERATED,Mt=!1,Rt=0,Lt=!1,Dt=null,zt=null,Ot=null,Ft=T("sdk_name",i,p),Nt=T("sdk_version",i,d);try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(ht){ce(s.ERROR,"Local storage test failed, Halting local storage support: "+ht),kt=!1}for(var Bt,jt={},Ut=0;Ut<g.features.length;Ut++)jt[g.features[Ut]]={};this.initialize=function(){if(this.serialize=T("serialize",i,g.serialize),this.deserialize=T("deserialize",i,g.deserialize),this.getViewName=T("getViewName",i,g.getViewName),this.getViewUrl=T("getViewUrl",i,g.getViewUrl),this.getSearchQuery=T("getSearchQuery",i,g.getSearchQuery),this.DeviceIdType=g.DeviceIdType,this.namespace=T("namespace",i,""),this.clearStoredId=T("clear_stored_id",i,!1),this.app_key=T("app_key",i,null),this.onload=T("onload",i,[]),this.utm=T("utm",i,{source:!0,medium:!0,campaign:!0,term:!0,content:!0}),this.ignore_prefetch=T("ignore_prefetch",i,!0),this.rcAutoOptinAb=T("rc_automatic_optin_for_ab",i,!0),this.useExplicitRcApi=T("use_explicit_rc_api",i,!1),this.debug=T("debug",i,!1),this.test_mode=T("test_mode",i,!1),this.test_mode_eq=T("test_mode_eq",i,!1),this.metrics=T("metrics",i,{}),this.headers=T("headers",i,{}),this.url=P(T("url",i,"")),this.app_version=T("app_version",i,"0.0"),this.country_code=T("country_code",i,null),this.city=T("city",i,null),this.ip_address=T("ip_address",i,null),this.ignore_bots=T("ignore_bots",i,!0),this.force_post=T("force_post",i,!1),this.remote_config=T("remote_config",i,!1),this.ignore_visitor=T("ignore_visitor",i,!1),this.require_consent=T("require_consent",i,!1),this.track_domains=m?T("track_domains",i,!0):void 0,this.storage=T("storage",i,"default"),this.enableOrientationTracking=m?T("enable_orientation_tracking",i,!0):void 0,this.maxKeyLength=T("max_key_length",i,c.MAX_KEY_LENGTH),this.maxValueSize=T("max_value_size",i,c.MAX_VALUE_SIZE),this.maxSegmentationValues=T("max_segmentation_values",i,c.MAX_SEGMENTATION_VALUES),this.maxBreadcrumbCount=T("max_breadcrumb_count",i,null),this.maxStackTraceLinesPerThread=T("max_stack_trace_lines_per_thread",i,c.MAX_STACKTRACE_LINES_PER_THREAD),this.maxStackTraceLineLength=T("max_stack_trace_line_length",i,c.MAX_STACKTRACE_LINE_LENGTH),this.heatmapWhitelist=T("heatmap_whitelist",i,[]),b.hcErrorCount=Te(h.errorCount)||0,b.hcWarningCount=Te(h.warningCount)||0,b.hcStatusCode=Te(h.statusCode)||-1,b.hcErrorMessage=Te(h.errorMessage)||"",vt&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=vt,ce(s.WARNING,"initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!")):vt||this.maxBreadcrumbCount||(this.maxBreadcrumbCount=100),"cookie"===this.storage&&(kt=!1),this.rcAutoOptinAb||this.useExplicitRcApi||(ce(s.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),this.useExplicitRcApi=!0),Array.isArray(ot)||(ot=[]),""===this.url&&(ce(s.ERROR,"initialize, Please provide server URL"),this.ignore_visitor=!0),Te("cly_ignore")&&(this.ignore_visitor=!0),Pe(),tt=Te("cly_queue")||[],et=Te("cly_event")||[],rt=Te("cly_remote_configs")||{},this.clearStoredId&&(Te("cly_id")&&!_&&(this.device_id=Te("cly_id"),ce(s.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),(At=Te("cly_id_type"))||(ce(s.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),At=l.DEVELOPER_SUPPLIED),Ht(),this.device_id=void 0,At=l.SDK_GENERATED),ce(s.INFO,"initialize, Clearing the device ID storage"),Ee("cly_id"),Ee("cly_id_type"),Ee("cly_session")),Wt(),m)if(window.name&&0===window.name.indexOf("cly:"))try{this.passed_data=JSON.parse(window.name.replace("cly:",""))}catch(x){ce(s.ERROR,"initialize, Could not parse name: "+window.name+", error: "+x)}else if(location.hash&&0===location.hash.indexOf("#cly:"))try{this.passed_data=JSON.parse(location.hash.replace("#cly:",""))}catch(x){ce(s.ERROR,"initialize, Could not parse hash: "+location.hash+", error: "+x)}if((this.passed_data&&this.passed_data.app_key&&this.passed_data.app_key===this.app_key||this.passed_data&&!this.passed_data.app_key&&w)&&this.passed_data.token&&this.passed_data.purpose){this.passed_data.token!==Te("cly_old_token")&&(ye(this.passed_data.token),Ie("cly_old_token",this.passed_data.token));var t=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),t=this.heatmapWhitelist.map((function(t){return P(t)}))):t=[this.url],t.includes(this.passed_data.url)&&"heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,W(),q(this.passed_data.url+"/views/heatmap.js",X))}if(this.ignore_visitor)ce(s.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{ce(s.DEBUG,Ft===p&&Nt===d?"initialize, SDK name:["+Ft+"], version:["+Nt+"]":"initialize, SDK name:["+Ft+"], version:["+Nt+"], default name:["+p+"] and default version:["+d+"]"),ce(s.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]"),ce(s.DEBUG,"initialize, device_id:["+T("device_id",i,void 0)+"]"),ce(s.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{ce(s.DEBUG,"initialize, metric override:["+JSON.stringify(this.metrics)+"]"),ce(s.DEBUG,"initialize, header override:["+JSON.stringify(this.headers)+"]"),ce(s.DEBUG,"initialize, number of onload callbacks provided:["+this.onload.length+"]"),ce(s.DEBUG,"initialize, utm tags:["+JSON.stringify(this.utm)+"]"),ot&&ce(s.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(ot)+"]")}catch(ht){ce(s.ERROR,"initialize, Could not stringify some config object values")}ce(s.DEBUG,"initialize, app_version:["+this.app_version+"]"),ce(s.DEBUG,"initialize, provided location info; country_code:["+this.country_code+"], city:["+this.city+"], ip_address:["+this.ip_address+"]"),""!==this.namespace&&ce(s.DEBUG,"initialize, namespace given:["+this.namespace+"]"),this.clearStoredId&&ce(s.DEBUG,"initialize, clearStoredId flag set to:["+this.clearStoredId+"]"),this.ignore_prefetch&&ce(s.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+this.ignore_prefetch+"]"),this.test_mode&&ce(s.WARNING,"initialize, test_mode:["+this.test_mode+"], request queue won't be processed"),this.test_mode_eq&&ce(s.WARNING,"initialize, test_mode_eq:["+this.test_mode_eq+"], event queue won't be processed"),this.heatmapWhitelist&&ce(s.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(this.heatmapWhitelist)+"], these domains will be whitelisted"),"default"!==this.storage&&ce(s.DEBUG,"initialize, storage is set to:["+this.storage+"]"),this.ignore_bots&&ce(s.DEBUG,"initialize, ignore traffic from bots :["+this.ignore_bots+"]"),this.force_post&&ce(s.DEBUG,"initialize, forced post method for all requests:["+this.force_post+"]"),this.remote_config&&ce(s.DEBUG,"initialize, remote_config callback provided:["+!!this.remote_config+"]"),"boolean"==typeof this.rcAutoOptinAb&&ce(s.DEBUG,"initialize, automatic RC optin is enabled:["+this.rcAutoOptinAb+"]"),this.useExplicitRcApi||ce(s.WARNING,"initialize, will use legacy RC API. Consider enabling new API during init with use_explicit_rc_api flag"),this.track_domains&&ce(s.DEBUG,"initialize, tracking domain info:["+this.track_domains+"]"),this.enableOrientationTracking&&ce(s.DEBUG,"initialize, enableOrientationTracking:["+this.enableOrientationTracking+"]"),bt||ce(s.WARNING,"initialize, use_session_cookie is enabled:["+bt+"]"),Tt&&ce(s.DEBUG,"initialize, offline_mode:["+Tt+"], user info won't be send to the servers"),Tt&&ce(s.DEBUG,"initialize, stored remote configs:["+JSON.stringify(rt)+"]"),ce(s.DEBUG,"initialize, 'getViewName' callback override provided:["+(this.getViewName!==g.getViewName)+"]"),ce(s.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+(this.getSearchQuery!==g.getSearchQuery)+"]"),this.maxKeyLength!==c.MAX_KEY_LENGTH&&ce(s.DEBUG,"initialize, maxKeyLength set to:["+this.maxKeyLength+"] characters"),this.maxValueSize!==c.MAX_VALUE_SIZE&&ce(s.DEBUG,"initialize, maxValueSize set to:["+this.maxValueSize+"] characters"),this.maxSegmentationValues!==c.MAX_SEGMENTATION_VALUES&&ce(s.DEBUG,"initialize, maxSegmentationValues set to:["+this.maxSegmentationValues+"] key/value pairs"),this.maxBreadcrumbCount!==c.MAX_BREADCRUMB_COUNT&&ce(s.DEBUG,"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries"),this.maxStackTraceLinesPerThread!==c.MAX_STACKTRACE_LINES_PER_THREAD&&ce(s.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+this.maxStackTraceLinesPerThread+"] lines"),this.maxStackTraceLineLength!==c.MAX_STACKTRACE_LINE_LENGTH&&ce(s.DEBUG,"initialize, maxStackTraceLineLength set to:["+this.maxStackTraceLineLength+"] characters"),K!==c.BEAT_INTERVAL&&ce(s.DEBUG,"initialize, interval for heartbeats set to:["+K+"] milliseconds"),Q!==c.QUEUE_SIZE&&ce(s.DEBUG,"initialize, queue_size set to:["+Q+"] items max"),ft!==c.FAIL_TIMEOUT_AMOUNT&&ce(s.DEBUG,"initialize, fail_timeout set to:["+ft+"] seconds of wait time after a failed connection to server"),mt!==c.INACTIVITY_TIME&&ce(s.DEBUG,"initialize, inactivity_time set to:["+mt+"] minutes to consider a user as inactive after no observable action"),_t!==c.SESSION_UPDATE&&ce(s.DEBUG,"initialize, session_update set to:["+_t+"] seconds to check if extending a session is needed while the user is active"),yt!==c.MAX_EVENT_BATCH&&ce(s.DEBUG,"initialize, max_events set to:["+yt+"] events to send in one batch"),vt&&ce(s.WARNING,"initialize, max_logs set to:["+vt+"] breadcrumbs to store for crash logs max, deprecated "),xt!==c.SESSION_COOKIE_TIMEOUT&&ce(s.DEBUG,"initialize, session_cookie_timeout set to:["+xt+"] minutes to expire a cookies session");var e=null,r=b.getSearchQuery(),n=!1,o={};if(r){0===r.indexOf("?")&&(r=r.substring(1));for(var a=r.split("&"),u=0;u<a.length;u++){var f=a[u].split("=");"cly_id"===f[0]?Ie("cly_cmp_id",f[1]):"cly_uid"===f[0]?Ie("cly_cmp_uid",f[1]):"cly_device_id"===f[0]?e=f[1]:0===(f[0]+"").indexOf("utm_")&&this.utm[f[0].replace("utm_","")]&&(o[f[0].replace("utm_","")]=f[1],n=!0)}}var _="[CLY]_temp_id"===Te("cly_id"),y=T("device_id",i,void 0);if("number"==typeof y&&(y=y.toString()),Te("cly_id")&&!_?(this.device_id=Te("cly_id"),ce(s.INFO,"initialize, Set the stored device ID"),(At=Te("cly_id_type"))||(ce(s.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),At=l.DEVELOPER_SUPPLIED)):null!==e?(ce(s.INFO,"initialize, Device ID set by URL"),this.device_id=e,At=l.URL_PROVIDED):y?(ce(s.INFO,"initialize, Device ID set by developer"),this.device_id=y,i&&Object.keys(i).length?void 0!==i.device_id&&(At=l.DEVELOPER_SUPPLIED):void 0!==g.device_id&&(At=l.DEVELOPER_SUPPLIED)):Tt||_?(this.device_id="[CLY]_temp_id",At=l.TEMPORARY_ID,Tt&&_?ce(s.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):Tt&&!_?ce(s.INFO,"initialize, Temp ID set, entering offline mode"):(Tt=!0,ce(s.INFO,"initialize, Temp ID set, enabling offline mode"))):(ce(s.INFO,"initialize, Generating the device ID"),this.device_id=T("device_id",i,ne()),i&&Object.keys(i).length?void 0!==i.device_id&&(At=l.DEVELOPER_SUPPLIED):void 0!==g.device_id&&(At=l.DEVELOPER_SUPPLIED)),Ie("cly_id",this.device_id),Ie("cly_id_type",At),n){for(var v in Ot={},this.utm)o[v]?(this.userData.set("utm_"+v,o[v]),Ot[v]=o[v]):this.userData.unset("utm_"+v);this.userData.save()}Jt(),setTimeout((function(){g.noHeartBeat?ce(s.WARNING,"initialize, Heartbeat disabled. This is for testing purposes only!"):re(),b.remote_config&&b.fetch_remote_config(b.remote_config)}),1),m&&document.documentElement.setAttribute("data-countly-useragent",z()),ke.sendInstantHCRequest(),ce(s.INFO,"initialize, Countly initialized")}},this.halt=function(){ce(s.WARNING,"halt, Resetting Countly"),g.i=void 0,g.q=[],g.noHeartBeat=void 0,w=!g.i,$=!1,J="/i",Y="/o/sdk",K=500,Q=1e3,tt=[],et=[],rt={},it=[],nt={},ot=[],at=null,st=!0,lt=0,ct=null,ut=0,dt=0,pt=0,ft=60,mt=20,gt=0,_t=60,yt=100,vt=null,bt=!0,xt=30,wt=!0,St=!1,Tt=!1,It={},Et=!0,Pt=x(),kt=!0,Ct=null,At=l.SDK_GENERATED,Mt=!1,Rt=0,Lt=!1,Dt=null,zt=null,Ot=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(ht){ce(s.ERROR,"halt, Local storage test failed, will fallback to cookies"),kt=!1}g.features=[n.SESSIONS,n.EVENTS,n.VIEWS,n.SCROLLS,n.CLICKS,n.FORMS,n.CRASHES,n.ATTRIBUTION,n.USERS,n.STAR_RATING,n.LOCATION,n.APM,n.FEEDBACK,n.REMOTE_CONFIG],jt={};for(var t=0;t<g.features.length;t++)jt[g.features[t]]={};b.app_key=void 0,b.device_id=void 0,b.onload=void 0,b.utm=void 0,b.ignore_prefetch=void 0,b.debug=void 0,b.test_mode=void 0,b.test_mode_eq=void 0,b.metrics=void 0,b.headers=void 0,b.url=void 0,b.app_version=void 0,b.country_code=void 0,b.city=void 0,b.ip_address=void 0,b.ignore_bots=void 0,b.force_post=void 0,b.rcAutoOptinAb=void 0,b.useExplicitRcApi=void 0,b.remote_config=void 0,b.ignore_visitor=void 0,b.require_consent=void 0,b.track_domains=void 0,b.storage=void 0,b.enableOrientationTracking=void 0,b.maxKeyLength=void 0,b.maxValueSize=void 0,b.maxSegmentationValues=void 0,b.maxBreadcrumbCount=void 0,b.maxStackTraceLinesPerThread=void 0,b.maxStackTraceLineLength=void 0},this.group_features=function(t){if(ce(s.INFO,"group_features, Grouping features"),t)for(var e in t)jt[e]?ce(s.WARNING,"group_features, Feature name ["+e+"] is already reserved"):"string"==typeof t[e]?jt[e]={features:[t[e]]}:t[e]&&Array.isArray(t[e])&&t[e].length?jt[e]={features:t[e]}:ce(s.ERROR,"group_features, Incorrect feature list for ["+e+"] value: ["+t[e]+"]");else ce(s.ERROR,"group_features, Incorrect features:["+t+"]")},this.check_consent=function(t){return ce(s.INFO,"check_consent, Checking if consent is given for specific feature:["+t+"]"),this.require_consent?jt[t]?!(!jt[t]||!jt[t].optin):(ce(s.ERROR,"check_consent, No feature available for ["+t+"]"),!1):(ce(s.INFO,"check_consent, require_consent is off, no consent is necessary"),!0)},this.get_device_id_type=function(){var t;switch(ce(s.INFO,"check_device_id_type, Retrieving the current device id type.["+At+"]"),At){case l.SDK_GENERATED:t=b.DeviceIdType.SDK_GENERATED;break;case l.URL_PROVIDED:case l.DEVELOPER_SUPPLIED:t=b.DeviceIdType.DEVELOPER_SUPPLIED;break;case l.TEMPORARY_ID:t=b.DeviceIdType.TEMPORARY_ID;break;default:t=-1}return t},this.get_device_id=function(){return ce(s.INFO,"get_device_id, Retrieving the device id: ["+b.device_id+"]"),b.device_id},this.check_any_consent=function(){if(ce(s.INFO,"check_any_consent, Checking if any consent is given"),!this.require_consent)return ce(s.INFO,"check_any_consent, require_consent is off, no consent is necessary"),!0;for(var t in jt)if(jt[t]&&jt[t].optin)return!0;return ce(s.INFO,"check_any_consent, No consents given"),!1},this.add_consent=function(t){if(ce(s.INFO,"add_consent, Adding consent for ["+t+"]"),Array.isArray(t))for(var e=0;e<t.length;e++)this.add_consent(t[e]);else jt[t]?jt[t].features?(jt[t].optin=!0,this.add_consent(jt[t].features)):!0!==jt[t].optin&&(jt[t].optin=!0,Vt(),setTimeout((function(){t===n.SESSIONS&&It.begin_session?(b.begin_session.apply(b,It.begin_session),It.begin_session=null):t===n.VIEWS&&It.track_pageview&&(ct=null,b.track_pageview.apply(b,It.track_pageview),It.track_pageview=null)}),1)):ce(s.ERROR,"add_consent, No feature available for ["+t+"]")},this.remove_consent=function(t){ce(s.INFO,"remove_consent, Removing consent for ["+t+"]"),this.remove_consent_internal(t,!0)},this.remove_consent_internal=function(t,e){if(e=e||!1,Array.isArray(t))for(var r=0;r<t.length;r++)this.remove_consent_internal(t[r],e);else jt[t]?jt[t].features?this.remove_consent_internal(jt[t].features,e):(jt[t].optin=!1,e&&!1!==jt[t].optin&&Vt()):ce(s.WARNING,"remove_consent, No feature available for ["+t+"]")};var Vt=function(){Bt&&(clearTimeout(Bt),Bt=null),Bt=setTimeout((function(){for(var t={},e=0;e<g.features.length;e++)!0===jt[g.features[e]].optin?t[g.features[e]]=!0:t[g.features[e]]=!1;ee({consent:JSON.stringify(t)}),ce(s.DEBUG,"Consent update request has been sent to the queue.")}),1e3)};function Gt(t,e){if(b.ignore_visitor)ce(s.ERROR,"Adding event failed. Possible bot or user opt out");else if(t.key){t.count||(t.count=1),a.includes(t.key)||(t.key=M(t.key,b.maxKeyLength,"add_cly_event",ce)),t.segmentation=A(t.segmentation,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"add_cly_event",ce);var r=k(t,["key","count","sum","dur","segmentation"]);r.timestamp=S();var i=new Date;r.hour=i.getHours(),r.dow=i.getDay(),r.id=e||y(),r.key===o.VIEW?r.pvid=zt||"":r.cvid=Dt||"",et.push(r),Ie("cly_event",et),ce(s.INFO,"With event ID: ["+r.id+"], successfully adding the last event:",r)}else ce(s.ERROR,"Adding event failed. Event must have a key property")}this.enable_offline_mode=function(){ce(s.INFO,"enable_offline_mode, Enabling offline mode"),this.remove_consent_internal(g.features,!1),Tt=!0,this.device_id="[CLY]_temp_id",b.device_id=this.device_id,At=l.TEMPORARY_ID},this.disable_offline_mode=function(t){if(Tt){ce(s.INFO,"disable_offline_mode, Disabling offline mode"),Tt=!1,t&&this.device_id!==t?(this.device_id=t,b.device_id=this.device_id,At=l.DEVELOPER_SUPPLIED,Ie("cly_id",this.device_id),Ie("cly_id_type",l.DEVELOPER_SUPPLIED),ce(s.INFO,"disable_offline_mode, Changing id to: "+this.device_id)):(this.device_id=ne(),"[CLY]_temp_id"===this.device_id&&(this.device_id=v()),b.device_id=this.device_id,this.device_id!==Te("cly_id")&&(Ie("cly_id",this.device_id),Ie("cly_id_type",l.SDK_GENERATED)));var e=!1;if(tt.length>0)for(var r=0;r<tt.length;r++)"[CLY]_temp_id"===tt[r].device_id&&(tt[r].device_id=this.device_id,e=!0);e&&Ie("cly_queue",tt,!0)}else ce(s.WARNING,"disable_offline_mode, Countly was not in offline mode.")},this.begin_session=function(t,e){if(ce(s.INFO,"begin_session, Starting the session. There was an ongoing session: ["+$+"]"),t&&ce(s.INFO,"begin_session, Heartbeats are disabled"),e&&ce(s.INFO,"begin_session, Session starts irrespective of session cookie"),this.check_consent(n.SESSIONS)){if(!$){this.enableOrientationTracking&&(this.report_orientation(),L(window,"resize",(function(){b.report_orientation()}))),u=x(),$=!0,st=!t;var r=Te("cly_session");if(ce(s.VERBOSE,"begin_session, Session state, forced: ["+e+"], useSessionCookie: ["+bt+"], seconds to expire: ["+(r-u)+"], expired: ["+(parseInt(r)<=x())+"] "),e||!bt||!r||parseInt(r)<=x()){ce(s.INFO,"begin_session, Session started"),null===Ct&&(Ct=!0);var i={begin_session:1};i.metrics=JSON.stringify(se()),ee(i)}Ie("cly_session",x()+60*xt)}}else It.begin_session=arguments},this.session_duration=function(t){ce(s.INFO,"session_duration, Reporting session duration"),this.check_consent(n.SESSIONS)&&$&&(ce(s.INFO,"session_duration, Session extended: ",t),ee({session_duration:t}),Qt())},this.end_session=function(t,e){ce(s.INFO,"end_session, Ending the current session. There was an on going session:["+$+"]"),this.check_consent(n.SESSIONS)&&$&&(t=t||x()-u,Yt(),!bt||e?(ce(s.INFO,"end_session, Session ended"),ee({end_session:1,session_duration:t})):this.session_duration(t),$=!1)},this.change_id=function(t,e){if(ce(s.INFO,"change_id, Changing the ID"),e&&ce(s.INFO,"change_id, Will merge the IDs"),t&&"string"==typeof t&&0!==t.length){if(Tt)return ce(s.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),void this.disable_offline_mode(t);if(this.device_id!=t){e||(ie(),Ht(),this.end_session(null,!0),nt={},this.remove_consent_internal(g.features,!1));var r=this.device_id;this.device_id=t,b.device_id=this.device_id,At=l.DEVELOPER_SUPPLIED,Ie("cly_id",this.device_id),Ie("cly_id_type",l.DEVELOPER_SUPPLIED),ce(s.INFO,"change_id, Changing ID from:["+r+"] to ["+t+"]"),e?ee({old_device_id:r}):this.begin_session(!st,!0),this.remote_config&&(Ie("cly_remote_configs",rt={}),this.fetch_remote_config(this.remote_config))}}else ce(s.ERROR,"change_id, The provided ID: ["+t+"] is not a valid ID")},this.add_event=function(t){ce(s.INFO,"add_event, Adding event: ",t);var e=!1;switch(t.key){case o.NPS:case o.SURVEY:e=this.check_consent(n.FEEDBACK);break;case o.STAR_RATING:e=this.check_consent(n.STAR_RATING);break;case o.VIEW:e=this.check_consent(n.VIEWS);break;case o.ORIENTATION:e=this.check_consent(n.USERS);break;case o.ACTION:e=this.check_consent(n.CLICKS)||this.check_consent(n.SCROLLS);break;default:e=this.check_consent(n.EVENTS)}e&&Gt(t)},this.start_event=function(t){t&&"string"==typeof t?(ce(s.INFO,"start_event, Starting timed event with key: ["+t+"]"),t=M(t,b.maxKeyLength,"start_event",ce),nt[t]?ce(s.WARNING,"start_event, Timed event with key: ["+t+"] already started"):nt[t]=x()):ce(s.WARNING,"start_event, you have to provide a valid string key instead of: ["+t+"]")},this.cancel_event=function(t){return t&&"string"==typeof t?(ce(s.INFO,"cancel_event, Canceling timed event with key: ["+t+"]"),t=M(t,b.maxKeyLength,"cancel_event",ce),nt[t]?(delete nt[t],ce(s.INFO,"cancel_event, Timed event with key: ["+t+"] is canceled"),!0):(ce(s.WARNING,"cancel_event, Timed event with key: ["+t+"] was not found"),!1)):(ce(s.WARNING,"cancel_event, you have to provide a valid string key instead of: ["+t+"]"),!1)},this.end_event=function(t){t?(ce(s.INFO,"end_event, Ending timed event"),"string"==typeof t&&(t={key:t=M(t,b.maxKeyLength,"end_event",ce)}),t.key?nt[t.key]?(t.dur=x()-nt[t.key],this.add_event(t),delete nt[t.key]):ce(s.ERROR,"end_event, Timed event with key: ["+t.key+"] was not started"):ce(s.ERROR,"end_event, Timed event must have a key property")):ce(s.WARNING,"end_event, you have to provide a valid string key or event object instead of: ["+t+"]")},this.report_orientation=function(t){ce(s.INFO,"report_orientation, Reporting orientation"),this.check_consent(n.USERS)&&Gt({key:o.ORIENTATION,segmentation:{mode:t||G()}})},this.report_conversion=function(t,e){ce(s.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!"),this.recordDirectAttribution(t,e)},this.recordDirectAttribution=function(t,e){ce(s.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+t+"] and the user ID: ["+e+"]"),this.check_consent(n.ATTRIBUTION)&&(t=t||Te("cly_cmp_id")||"cly_organic",ee((e=e||Te("cly_cmp_uid"))?{campaign_id:t,campaign_user:e}:{campaign_id:t}))},this.user_details=function(t){if(ce(s.INFO,"user_details, Trying to add user details: ",t),this.check_consent(n.USERS)){ie(),Ht(),ce(s.INFO,"user_details, flushed the event queue"),t.name=M(t.name,b.maxValueSize,"user_details",ce),t.username=M(t.username,b.maxValueSize,"user_details",ce),t.email=M(t.email,b.maxValueSize,"user_details",ce),t.organization=M(t.organization,b.maxValueSize,"user_details",ce),t.phone=M(t.phone,b.maxValueSize,"user_details",ce),t.picture=M(t.picture,4096,"user_details",ce),t.gender=M(t.gender,b.maxValueSize,"user_details",ce),t.byear=M(t.byear,b.maxValueSize,"user_details",ce),t.custom=A(t.custom,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"user_details",ce);var e=["name","username","email","organization","phone","picture","gender","byear","custom"];ee({user_details:JSON.stringify(k(t,e))})}};var $t={},qt=function(t,e,r){b.check_consent(n.USERS)&&($t[t]||($t[t]={}),"$push"===r||"$pull"===r||"$addToSet"===r?($t[t][r]||($t[t][r]=[]),$t[t][r].push(e)):$t[t][r]=e)};function Zt(t,e,r,i,o){ce(s.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var a,l={method:"rc",av:b.app_version};t&&(l.keys=JSON.stringify(t)),e&&(l.omit_keys=JSON.stringify(e)),"legacy"===i&&(l.method="fetch_remote_config"),0===r&&(l.oi=0),1===r&&(l.oi=1),"function"==typeof o&&(a=o),b.check_consent(n.SESSIONS)&&(l.metrics=JSON.stringify(se())),b.check_consent(n.REMOTE_CONFIG)?(te(l),ue("fetch_remote_config_explicit",b.url+Y,l,(function(t,e,r){if(!t){try{var i=JSON.parse(r);if(l.keys||l.omit_keys)for(var n in i)rt[n]=i[n];else rt=i;Ie("cly_remote_configs",rt)}catch(o){ce(s.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+o)}a&&(ce(s.INFO,"fetch_remote_config_explicit, Callback function is provided"),a(t,rt))}}),!0)):(ce(s.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),a&&a(new Error("Remote config requires explicit consent"),rt))}function Wt(){ce(s.INFO,"checkIgnore, Checking if user or visit should be ignored"),b.ignore_prefetch&&m&&void 0!==document.visibilityState&&"prerender"===document.visibilityState&&(b.ignore_visitor=!0,ce(s.DEBUG,"checkIgnore, Ignoring visit due to prerendering")),b.ignore_bots&&N()&&(b.ignore_visitor=!0,ce(s.DEBUG,"checkIgnore, Ignoring visit due to bot"))}function Ht(){et.length>0&&(ce(s.DEBUG,"Flushing events"),ee({events:JSON.stringify(et)}),Ie("cly_event",et=[]))}function Xt(t,e){if(m)if(document.getElementById("countly-feedback-sticker-"+t._id))ce(s.ERROR,"Widget with same ID exists");else try{var r=document.createElement("div");r.className="countly-iframe-wrapper",r.id="countly-iframe-wrapper-"+t._id;var i=document.createElement("span");i.className="countly-feedback-close-icon",i.id="countly-feedback-close-icon-"+t._id,i.innerText="x";var n=document.createElement("iframe");if(n.name="countly-feedback-iframe",n.id="countly-feedback-iframe",n.src=b.url+"/feedback?widget_id="+t._id+"&app_key="+b.app_key+"&device_id="+b.device_id+"&sdk_version="+Nt,document.body.appendChild(r),r.appendChild(i),r.appendChild(n),L(document.getElementById("countly-feedback-close-icon-"+t._id),"click",(function(){document.getElementById("countly-iframe-wrapper-"+t._id).style.display="none",document.getElementById("cfbg").style.display="none"})),e){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.id="feedback-sticker-svg",o.setAttribute("aria-hidden","true"),o.setAttribute("data-prefix","far"),o.setAttribute("data-icon","grin"),o.setAttribute("class","svg-inline--fa fa-grin fa-w-16"),o.setAttribute("role","img"),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("viewBox","0 0 496 512");var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.id="smileyPathInStickerSvg",a.setAttribute("fill","white"),a.setAttribute("d","M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm105.6-151.4c-25.9 8.3-64.4 13.1-105.6 13.1s-79.6-4.8-105.6-13.1c-9.9-3.1-19.4 5.4-17.7 15.3 7.9 47.1 71.3 80 123.3 80s115.3-32.9 123.3-80c1.6-9.8-7.7-18.4-17.7-15.3zM168 240c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z");var l=document.createElement("span");l.innerText=t.trigger_button_text;var c=document.createElement("div");c.style.color=t.trigger_font_color.length<7?"#"+t.trigger_font_color:t.trigger_font_color,c.style.backgroundColor=t.trigger_bg_color.length<7?"#"+t.trigger_bg_color:t.trigger_bg_color,c.className="countly-feedback-sticker "+t.trigger_position+"-"+t.trigger_size,c.id="countly-feedback-sticker-"+t._id,o.appendChild(a),c.appendChild(o),c.appendChild(l),document.body.appendChild(c);var u=document.getElementById("smileyPathInStickerSvg");u&&(u.style.fill=t.trigger_font_color.length<7?"#"+t.trigger_font_color:t.trigger_font_color),L(document.getElementById("countly-feedback-sticker-"+t._id),"click",(function(){document.getElementById("countly-iframe-wrapper-"+t._id).style.display="block",document.getElementById("cfbg").style.display="block"}))}else document.getElementById("countly-iframe-wrapper-"+t._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(ht){ce(s.ERROR,"Somethings went wrong while element injecting process: "+ht)}else ce(s.WARNING,"processWidget, window object is not available. Not processing widget.")}function Jt(){var t;if(void 0!==b.onload&&b.onload.length>0){for(t=0;t<b.onload.length;t++)"function"==typeof b.onload[t]&&b.onload[t](b);b.onload=[]}}function Yt(){if(ct){var t={name:ct};b.check_consent(n.VIEWS)&&(Gt({key:o.VIEW,dur:Et?x()-ut:dt,segmentation:t},Dt),ct=null)}}function Kt(){return ct}function Qt(){if(bt){var t=Te("cly_session");(!t||parseInt(t)<=x())&&($=!1,b.begin_session(!st)),Ie("cly_session",x()+60*xt)}}function te(t){t.app_key=b.app_key,t.device_id=b.device_id,t.sdk_name=Ft,t.sdk_version=Nt,t.t=At,t.av=b.app_version;var e=ae();if(t.metrics){var r=JSON.parse(t.metrics);r._ua||(r._ua=e,t.metrics=JSON.stringify(r))}else t.metrics=JSON.stringify({_ua:e});b.check_consent(n.LOCATION)?(b.country_code&&(t.country_code=b.country_code),b.city&&(t.city=b.city),null!==b.ip_address&&(t.ip_address=b.ip_address)):t.location="",t.timestamp=S();var i=new Date;t.hour=i.getHours(),t.dow=i.getDay()}function ee(t){b.ignore_visitor?ce(s.WARNING,"User is opt_out will ignore the request: "+t):b.app_key&&b.device_id?(te(t),tt.length>Q&&tt.shift(),tt.push(t),Ie("cly_queue",tt,!0)):ce(s.ERROR,"app_key or device_id is missing ",b.app_key,b.device_id)}function re(){if(Jt(),b.ignore_visitor)return St=!1,void ce(s.WARNING,"User opt_out, no heartbeat");if(St=!0,w&&void 0!==g.q&&g.q.length>0&&ie(),$&&st&&Et){var t=x();t-u>_t&&(b.session_duration(t-u),u=t,b.hcErrorCount>0&&Ie(h.errorCount,b.hcErrorCount),b.hcWarningCount>0&&Ie(h.warningCount,b.hcWarningCount))}if(et.length>0&&!b.test_mode_eq){if(et.length<=yt)ee({events:JSON.stringify(et)}),et=[];else{var e=et.splice(0,yt);ee({events:JSON.stringify(e)})}Ie("cly_event",et)}if(!Tt&&tt.length>0&&wt&&x()>pt){wt=!1;var r=tt[0];r.rr=tt.length,ce(s.DEBUG,"Processing request",r),Ie("cly_queue",tt,!0),b.test_mode||ue("send_request_queue",b.url+J,r,(function(t,e){t?pt=x()+ft:tt.shift(),Ie("cly_queue",tt,!0),wt=!0}),!1)}setTimeout(re,K)}function ie(){if(void 0!==g&&void 0!==g.i){var t=g.q;g.q=[];for(var e=0;e<t.length;e++){var r=t[e];if(ce(s.DEBUG,"Processing queued calls:"+r),"function"==typeof r)r();else if(Array.isArray(r)&&r.length>0){var i=b,n=0;try{g.i[r[n]]&&(i=g.i[r[n]],n++)}catch(a){ce(s.DEBUG,"No instance found for the provided key while processing async queue"),g.q.push(r);continue}if("function"==typeof i[r[n]])i[r[n]].apply(i,r.slice(n+1));else if(0===r[n].indexOf("userData.")){var o=r[n].replace("userData.","");"function"==typeof i.userData[o]&&i.userData[o].apply(i,r.slice(n+1))}else"function"==typeof g[r[n]]&&g[r[n]].apply(g,r.slice(n+1))}}}else ce(s.DEBUG,"Countly is not finished initialization yet, will process the queue after initialization is done")}function ne(){var t=Te("cly_id");return t?(At=Te("cly_id_type"),t):v()}function oe(t){return/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-4[0-9a-fA-F]{3}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(t)}function ae(){return b.metrics._ua||z()}function se(){var t=JSON.parse(JSON.stringify(b.metrics||{}));if(t._app_version=t._app_version||b.app_version,t._ua=t._ua||z(),m&&screen.width){var e=screen.width?parseInt(screen.width):0,r=screen.height?parseInt(screen.height):0;if(0!==e&&0!==r){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)e=Math.round(e*window.devicePixelRatio),r=Math.round(r*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var i=e;e=r,r=i}t._resolution=t._resolution||e+"x"+r}}m&&window.devicePixelRatio&&(t._density=t._density||window.devicePixelRatio);var n=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;return void 0!==n&&(t._locale=t._locale||n),le()&&(t._store=t._store||document.referrer),ce(s.DEBUG,"Got metrics",t),t}function le(t){if(!m)return!1;var e=t||document.referrer,r=!1;if(void 0===e||0===e.length)ce(s.DEBUG,"Invalid referrer:["+e+"], ignoring.");else{var i=f.exec(e);if(i)if(i[11])if(i[11]===window.location.hostname)ce(s.DEBUG,"Referrer is current host:["+e+"], ignoring.");else if(ot&&ot.length){r=!0;for(var n=0;n<ot.length;n++)if(e.indexOf(ot[n])>=0){ce(s.DEBUG,"Referrer in ignore list:["+e+"], ignoring."),r=!1;break}}else ce(s.DEBUG,"Valid referrer:["+e+"]"),r=!0;else ce(s.DEBUG,"No path found in referrer:["+e+"], ignoring.");else ce(s.DEBUG,"Referrer is corrupt:["+e+"], ignoring.")}return r}function ce(t,r){if(b.debug&&"undefined"!=typeof console){arguments[2]&&"object"===e(arguments[2])&&(arguments[2]=JSON.stringify(arguments[2])),w||(r="["+b.app_key+"] "+r),t||(t=s.DEBUG);for(var i="",n=2;n<arguments.length;n++)i+=arguments[n];var o=t+"[Countly] "+r+i;t===s.ERROR?(console.error(o),ke.incrementErrorCount()):t===s.WARNING?(console.warn(o),ke.incrementWarningCount()):t===s.INFO?console.info(o):t===s.VERBOSE?console.log(o):console.debug(o)}}function ue(t,e,r,i,n){m?he(t,e,r,i,n):de(t,e,r,i,n)}function he(t,e,r,i,n){n=n||!1;try{ce(s.DEBUG,"Sending XML HTTP request");var o=new XMLHttpRequest,a=E(r=r||{}),l="GET";for(var c in(b.force_post||a.length>=2e3)&&(l="POST"),"GET"===l?o.open("GET",e+"?"+a,!0):(o.open("POST",e,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded")),b.headers)o.setRequestHeader(c,b.headers[c]);o.onreadystatechange=function(){4===this.readyState&&(ce(s.DEBUG,t+" HTTP request completed with status code: ["+this.status+"] and response: ["+this.responseText+"]"),(n?fe(this.status,this.responseText):pe(this.status,this.responseText))?"function"==typeof i&&i(!1,r,this.responseText):(ce(s.ERROR,t+" Invalid response from server"),"send_request_queue"===t&&ke.saveRequestCounters(this.status,this.responseText),"function"==typeof i&&i(!0,r,this.status,this.responseText)))},"GET"===l?o.send():o.send(a)}catch(ht){ce(s.ERROR,t+" Something went wrong while making an XML HTTP request: "+ht),"function"==typeof i&&i(!0,r)}}function de(t,e,r,i,n){var o;n=n||!1;try{ce(s.DEBUG,"Sending Fetch request");var a="GET",l={"Content-type":"application/x-www-form-urlencoded"},c=null;for(var u in r=r||{},b.force_post||E(r).length>=2e3?(a="POST",c=E(r)):e+="?"+E(r),b.headers)l[u]=b.headers[u];fetch(e,{method:a,headers:l,body:c}).then((function(t){return(o=t).text()})).then((function(e){ce(s.DEBUG,t+" Fetch request completed wit status code: ["+o.status+"] and response: ["+e+"]"),(n?fe(o.status,e):pe(o.status,e))?"function"==typeof i&&i(!1,r,e):(ce(s.ERROR,t+" Invalid response from server"),"send_request_queue"===t&&ke.saveRequestCounters(o.status,e),"function"==typeof i&&i(!0,r,o.status,e))})).catch((function(e){ce(s.ERROR,t+" Failed Fetch request: "+e),"function"==typeof i&&i(!0,r)}))}catch(ht){ce(s.ERROR,t+" Something went wrong with the Fetch request attempt: "+ht),"function"==typeof i&&i(!0,r)}}function pe(t,e){if(!(t>=200&&t<300))return ce(s.ERROR,"Http response status code:["+t+"] is not within the expected range"),!1;try{var r=JSON.parse(e);return"[object Object]"!==Object.prototype.toString.call(r)?(ce(s.ERROR,"Http response is not JSON Object"),!1):!!r.result}catch(ht){return ce(s.ERROR,"Http response is not JSON: "+ht),!1}}function fe(t,e){if(!(t>=200&&t<300))return ce(s.ERROR,"Http response status code:["+t+"] is not within the expected range"),!1;try{var r=JSON.parse(e);return!("[object Object]"!==Object.prototype.toString.call(r)&&!Array.isArray(r)&&(ce(s.ERROR,"Http response is not JSON Object nor JSON Array"),1))}catch(ht){return ce(s.ERROR,"Http response is not JSON: "+ht),!1}}function me(){m?Rt=Math.max(Rt,window.scrollY,document.body.scrollTop,document.documentElement.scrollTop):ce(s.WARNING,"processScroll, window object is not available. Not processing scroll.")}function ge(){if(m){if(Mt){Mt=!1;var t=j(),e=U(),r=V();if(b.check_consent(n.SCROLLS)){var i={type:"scroll",y:Rt+r,width:e,height:t,view:b.getViewUrl()};i=A(i,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"processScrollView",ce),b.track_domains&&(i.domain=window.location.hostname),Gt({key:o.ACTION,segmentation:i})}}}else ce(s.WARNING,"processScrollView, window object is not available. Not processing scroll view.")}function _e(){return At}function ye(t){Ie("cly_token",t)}function ve(){var t=Te("cly_token");return Ee("cly_token"),t}function be(){return et}function xe(){return tt}function we(t){for(var e=t+"=",r=document.cookie.split(";"),i=0,n=r.length;i<n;i++){for(var o=r[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(e))return o.substring(e.length,o.length)}return null}function Se(t,e,r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3);var n="; expires="+i.toGMTString();document.cookie=t+"="+e+n+"; path=/"}function Te(t,r,i){var n;if("none"!==b.storage&&("object"===e(b.storage)||m))return i||(t=b.app_key+"/"+t,b.namespace&&(t=P(b.namespace)+"/"+t)),"object"===e(b.storage)&&"function"==typeof b.storage.getItem?(n=b.storage.getItem(t),t.endsWith("cly_id")?n:b.deserialize(n)):(void 0===r&&(r=kt),r?n=localStorage.getItem(t):"localstorage"!==b.storage&&(n=we(t)),t.endsWith("cly_id")?n:b.deserialize(n));ce(s.DEBUG,"Storage is disabled. Value with key: ["+t+"] won't be retrieved")}function Ie(t,r,i,n){if("none"===b.storage||"object"!==e(b.storage)&&!m)ce(s.DEBUG,"Storage is disabled. Value with key: "+t+" won't be stored");else if(n||(t=b.app_key+"/"+t,b.namespace&&(t=P(b.namespace)+"/"+t)),null!=r){if("object"===e(b.storage)&&"function"==typeof b.storage.setItem)return void b.storage.setItem(t,r);void 0===i&&(i=kt),r=b.serialize(r),i?localStorage.setItem(t,r):"localstorage"!==b.storage&&Se(t,r,30)}}function Ee(t,r,i){"none"===b.storage||"object"!==e(b.storage)&&!m?ce(s.DEBUG,"Storage is disabled. Value with key: "+t+" won't be removed"):(i||(t=b.app_key+"/"+t,b.namespace&&(t=P(b.namespace)+"/"+t)),"object"!==e(b.storage)||"function"!=typeof b.storage.removeItem?(void 0===r&&(r=kt),r?localStorage.removeItem(t):"localstorage"!==b.storage&&Se(t,"",-1)):b.storage.removeItem(t))}function Pe(){if(Te(b.namespace+"cly_id",!1,!0)){Ie("cly_id",Te(b.namespace+"cly_id",!1,!0)),Ie("cly_id_type",Te(b.namespace+"cly_id_type",!1,!0)),Ie("cly_event",Te(b.namespace+"cly_event",!1,!0)),Ie("cly_session",Te(b.namespace+"cly_session",!1,!0));var t=Te(b.namespace+"cly_queue",!1,!0);Array.isArray(t)&&Ie("cly_queue",t=t.filter((function(t){return t.app_key===b.app_key}))),Te(b.namespace+"cly_cmp_id",!1,!0)&&(Ie("cly_cmp_id",Te(b.namespace+"cly_cmp_id",!1,!0)),Ie("cly_cmp_uid",Te(b.namespace+"cly_cmp_uid",!1,!0))),Te(b.namespace+"cly_ignore",!1,!0)&&Ie("cly_ignore",Te(b.namespace+"cly_ignore",!1,!0)),Ee("cly_id",!1,!0),Ee("cly_id_type",!1,!0),Ee("cly_event",!1,!0),Ee("cly_session",!1,!0),Ee("cly_queue",!1,!0),Ee("cly_cmp_id",!1,!0),Ee("cly_cmp_uid",!1,!0),Ee("cly_ignore",!1,!0)}}this.userData={set:function(t,e){ce(s.INFO,"[userData] set, Setting user's custom property value: ["+e+"] under the key: ["+t+"]"),t=M(t,b.maxKeyLength,"userData set",ce),e=M(e,b.maxValueSize,"userData set",ce),$t[t]=e},unset:function(t){ce(s.INFO,"[userData] unset, Resetting user's custom property with key: ["+t+"] "),$t[t]=""},set_once:function(t,e){ce(s.INFO,"[userData] set_once, Setting user's unique custom property value: ["+e+"] under the key: ["+t+"] "),t=M(t,b.maxKeyLength,"userData set_once",ce),e=M(e,b.maxValueSize,"userData set_once",ce),qt(t,e,"$setOnce")},increment:function(t){ce(s.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+t+"] by one"),t=M(t,b.maxKeyLength,"userData increment",ce),qt(t,1,"$inc")},increment_by:function(t,e){ce(s.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+t+"] by: ["+e+"]"),t=M(t,b.maxKeyLength,"userData increment_by",ce),e=M(e,b.maxValueSize,"userData increment_by",ce),qt(t,e,"$inc")},multiply:function(t,e){ce(s.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+t+"] by: ["+e+"]"),t=M(t,b.maxKeyLength,"userData multiply",ce),e=M(e,b.maxValueSize,"userData multiply",ce),qt(t,e,"$mul")},max:function(t,e){ce(s.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+e+"] under the key: ["+t+"]"),t=M(t,b.maxKeyLength,"userData max",ce),e=M(e,b.maxValueSize,"userData max",ce),qt(t,e,"$max")},min:function(t,e){ce(s.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+e+"] under the key: ["+t+"]"),t=M(t,b.maxKeyLength,"userData min",ce),e=M(e,b.maxValueSize,"userData min",ce),qt(t,e,"$min")},push:function(t,e){ce(s.INFO,"[userData] push, Pushing a value: ["+e+"] under the key: ["+t+"] to user's custom property array"),t=M(t,b.maxKeyLength,"userData push",ce),e=M(e,b.maxValueSize,"userData push",ce),qt(t,e,"$push")},push_unique:function(t,e){ce(s.INFO,"[userData] push_unique, Pushing a unique value: ["+e+"] under the key: ["+t+"] to user's custom property array"),t=M(t,b.maxKeyLength,"userData push_unique",ce),e=M(e,b.maxValueSize,"userData push_unique",ce),qt(t,e,"$addToSet")},pull:function(t,e){ce(s.INFO,"[userData] pull, Removing the value: ["+e+"] under the key: ["+t+"] from user's custom property array"),qt(t,e,"$pull")},save:function(){ce(s.INFO,"[userData] save, Saving changes to user's custom property"),b.check_consent(n.USERS)&&(ie(),Ht(),ce(s.INFO,"user_details, flushed the event queue"),ee({user_details:JSON.stringify({custom:$t})})),$t={}}},this.report_trace=function(t){if(ce(s.INFO,"report_trace, Reporting performance trace"),this.check_consent(n.APM)){for(var e=["type","name","stz","etz","apm_metrics","apm_attr"],r=0;r<e.length;r++)if("apm_attr"!==e[r]&&void 0===t[e[r]])return void ce(s.WARNING,"report_trace, APM trace don't have the property: "+e[r]);t.name=M(t.name,b.maxKeyLength,"report_trace",ce),t.app_metrics=A(t.app_metrics,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"report_trace",ce);var i=k(t,e);i.timestamp=t.stz;var o=new Date;i.hour=o.getHours(),i.dow=o.getDay(),ee({apm:JSON.stringify(i)}),ce(s.INFO,"report_trace, Successfully adding APM trace: ",i)}},this.track_errors=function(t){m?(ce(s.INFO,"track_errors, Started tracking errors"),g.i[this.app_key].tracking_crashes=!0,window.cly_crashes||(window.cly_crashes=!0,at=t,window.onerror=function t(e,r,i,n,o){if(null!=o)I(o,!1);else{var a="";void 0!==e&&(a+=e+"\n"),void 0!==r&&(a+="at "+r),void 0!==i&&(a+=":"+i),void 0!==(n=n||window.event&&window.event.errorCharacter)&&(a+=":"+n),a+="\n";try{for(var l=[],c=t.caller;c;)l.push(c.name),c=c.caller;a+=l.join("\n")}catch(u){ce(s.ERROR,"track_errors, Call stack generation experienced a problem: "+u)}I(a,!1)}},window.addEventListener("unhandledrejection",(function(t){I(new Error("Unhandled rejection (reason: "+(t.reason&&t.reason.stack?t.reason.stack:t.reason)+")."),!0)})))):ce(s.WARNING,"track_errors, window object is not available. Not tracking errors.")},this.log_error=function(t,e){ce(s.INFO,"log_error, Logging errors"),this.recordError(t,!0,e)},this.add_log=function(t){if(ce(s.INFO,"add_log, Adding a new log of breadcrumbs: [ "+t+" ]"),this.check_consent(n.CRASHES)){for(t=M(t,b.maxValueSize,"add_log",ce);it.length>=b.maxBreadcrumbCount;)it.shift(),ce(s.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");it.push(t)}},this.fetch_remote_config=function(t,e,r){var i=null,n=null,o=null;if(t&&(r||"function"!=typeof t?Array.isArray(t)&&(i=t):o=t),e&&(r||"function"!=typeof e?Array.isArray(e)&&(n=e):o=e),o||"function"!=typeof r||(o=r),this.useExplicitRcApi)return ce(s.INFO,"fetch_remote_config, Fetching remote config"),void Zt(i,n,this.rcAutoOptinAb?1:0,null,o);ce(s.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),Zt(i,n,null,"legacy",o)},this.enrollUserToAb=function(t){if(ce(s.INFO,"enrollUserToAb, Providing AB test keys to opt in for"),t&&Array.isArray(t)&&0!==t.length){var e={method:"ab",keys:JSON.stringify(t),av:b.app_version};te(e),ue("enrollUserToAb",this.url+Y,e,(function(t,e,r){if(!t)try{var i=JSON.parse(r);ce(s.DEBUG,"enrollUserToAb, Parsed the response's result: ["+i.result+"]")}catch(n){ce(s.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+n)}}),!0)}else ce(s.ERROR,"enrollUserToAb, No keys provided")},this.get_remote_config=function(t){return ce(s.INFO,"get_remote_config, Getting remote config from storage"),void 0!==t?rt[t]:rt},this.stop_time=function(){ce(s.INFO,"stop_time, Stopping tracking duration"),Et&&(Et=!1,lt=x()-u,dt=x()-ut)},this.start_time=function(){ce(s.INFO,"start_time, Starting tracking duration"),Et||(Et=!0,u=x()-lt,ut=x()-dt,dt=0,Qt())},this.track_sessions=function(){if(m){ce(s.INFO,"track_session, Starting tracking user session"),this.begin_session(),this.start_time(),L(window,"beforeunload",(function(){ie(),Ht(),b.end_session()}));var t="hidden";L(window,"focus",e),L(window,"blur",e),L(window,"pageshow",e),L(window,"pagehide",e),"onfocusin"in document&&(L(window,"focusin",e),L(window,"focusout",e)),t in document?document.addEventListener("visibilitychange",e):"mozHidden"in document?(t="mozHidden",document.addEventListener("mozvisibilitychange",e)):"webkitHidden"in document?(t="webkitHidden",document.addEventListener("webkitvisibilitychange",e)):"msHidden"in document&&(t="msHidden",document.addEventListener("msvisibilitychange",e)),L(window,"mousemove",r),L(window,"click",r),L(window,"keydown",r),L(window,"scroll",r),setInterval((function(){++gt>=mt&&b.stop_time()}),6e4)}else ce(s.WARNING,"track_sessions, window object is not available. Not tracking sessions.");function e(){document[t]||!document.hasFocus()?b.stop_time():b.start_time()}function r(){gt>=mt&&b.start_time(),gt=0}},this.track_pageview=function(t,e,r){if(m||t)if(ce(s.INFO,"track_pageview, Tracking page views"),ce(s.VERBOSE,"track_pageview, last view is:["+ct+"], current view ID is:["+Dt+"], previous view ID is:["+zt+"]"),ct&&Lt&&(ce(s.DEBUG,"track_pageview, Scroll registry triggered"),ge(),Mt=!0,Rt=0),Yt(),zt=Dt,Dt=y(),(t=M(t,b.maxKeyLength,"track_pageview",ce))&&Array.isArray(t)&&(e=t,t=null),t||(t=this.getViewName()),void 0!==t&&""!==t)if(null!==t){if(e&&e.length)for(var i=0;i<e.length;i++)try{if(new RegExp(e[i]).test(t))return void ce(s.INFO,"track_pageview, Ignoring the page: "+t)}catch(d){ce(s.ERROR,"track_pageview, Problem with finding ignore list item: "+e[i]+", error: "+d)}ct=t,ut=x(),ce(s.VERBOSE,"track_pageview, last view is assigned:["+ct+"], current view ID is:["+Dt+"], previous view ID is:["+zt+"]");var a={name:t,visit:1,view:b.getViewUrl()};if(a=A(a,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"track_pageview",ce),this.track_domains&&(a.domain=window.location.hostname),bt)if($)Ct&&(Ct=!1,a.start=1);else{var l=Te("cly_session");(!l||parseInt(l)<=x())&&(Ct=!1,a.start=1)}else if(m&&void 0!==document.referrer&&document.referrer.length){var c=f.exec(document.referrer);c&&c[11]&&c[11]!==window.location.hostname&&(a.start=1)}if(Ot&&Object.keys(Ot).length)for(var u in ce(s.INFO,"track_pageview, Adding fresh utm tags to segmentation:["+JSON.stringify(Ot)+"]"),Ot)void 0===a["utm_"+u]&&(a["utm_"+u]=Ot[u]);if(m&&le()&&(ce(s.INFO,"track_pageview, Adding referrer to segmentation:["+document.referrer+"]"),a.referrer=document.referrer),r)for(var h in r=A(r,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"track_pageview",ce))void 0===a[h]&&(a[h]=r[h]);this.check_consent(n.VIEWS)?Gt({key:o.VIEW,segmentation:a},Dt):It.track_pageview=arguments}else ce(s.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else ce(s.ERROR,"track_pageview, No page name to track (it is either undefined or empty string). No page view can be tracked.");else ce(s.WARNING,"track_pageview, window object is not available. Not tracking page views is page is not provided.")},this.track_view=function(t,e,r){ce(s.INFO,"track_view, Initiating tracking page views"),this.track_pageview(t,e,r)},this.track_clicks=function(t){if(m){ce(s.INFO,"track_clicks, Starting to track clicks"),t&&ce(s.INFO,"track_clicks, Tracking the specified children:["+t+"]"),t=t||document;var e=!0;L(t,"click",r)}else ce(s.WARNING,"track_clicks, window object is not available. Not tracking clicks.");function r(t){if(e){if(e=!1,B(t),void 0!==t.pageX&&void 0!==t.pageY){var r=j(),i=U();if(b.check_consent(n.CLICKS)){var a={type:"click",x:t.pageX,y:t.pageY,width:i,height:r,view:b.getViewUrl()};a=A(a,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"processClick",ce),b.track_domains&&(a.domain=window.location.hostname),Gt({key:o.ACTION,segmentation:a})}}setTimeout((function(){e=!0}),1e3)}}},this.track_scrolls=function(t){m?(ce(s.INFO,"track_scrolls, Starting to track scrolls"),t&&ce(s.INFO,"track_scrolls, Tracking the specified children"),t=t||window,Mt=!0,Lt=!0,L(t,"scroll",me),L(t,"beforeunload",ge)):ce(s.WARNING,"track_scrolls, window object is not available. Not tracking scrolls.")},this.track_links=function(t){function e(t){var e=R(D(t),"a");e&&(B(t),b.check_consent(n.CLICKS)&&Gt({key:"linkClick",segmentation:{href:e.href,text:e.innerText,id:e.id,view:b.getViewUrl()}}))}m?(ce(s.INFO,"track_links, Starting to track clicks to links"),t&&ce(s.INFO,"track_links, Tracking the specified children"),L(t=t||document,"click",e)):ce(s.WARNING,"track_links, window object is not available. Not tracking links.")},this.track_forms=function(t,e){function r(t){return t.name||t.id||t.type||t.nodeName}function i(t){var i,o=D(t),a={id:o.attributes.id&&o.attributes.id.nodeValue,name:o.attributes.name&&o.attributes.name.nodeValue,action:o.attributes.action&&o.attributes.action.nodeValue,method:o.attributes.method&&o.attributes.method.nodeValue,view:b.getViewUrl()};if(void 0!==o.elements){for(var s=0;s<o.elements.length;s++)(i=o.elements[s])&&"password"!==i.type&&-1===i.className.indexOf("cly_user_ignore")&&(void 0===a["input:"+r(i)]&&(a["input:"+r(i)]=[]),"select"===i.nodeName.toLowerCase()?void 0!==i.multiple?a["input:"+r(i)].push(_(i)):a["input:"+r(i)].push(i.options[i.selectedIndex].value):"input"===i.nodeName.toLowerCase()?void 0!==i.type?"checkbox"===i.type.toLowerCase()||"radio"===i.type.toLowerCase()?i.checked&&a["input:"+r(i)].push(i.value):("hidden"!==i.type.toLowerCase()||e)&&a["input:"+r(i)].push(i.value):a["input:"+r(i)].push(i.value):("textarea"===i.nodeName.toLowerCase()||void 0!==i.value)&&a["input:"+r(i)].push(i.value));for(var l in a)a[l]&&"function"==typeof a[l].join&&(a[l]=a[l].join(", "))}b.check_consent(n.FORMS)&&Gt({key:"formSubmit",segmentation:a})}m?(ce(s.INFO,"track_forms, Starting to track form submissions. DOM object provided:["+!!t+"] Tracking hidden inputs :["+!!e+"]"),L(t=t||document,"submit",i)):ce(s.WARNING,"track_forms, window object is not available. Not tracking forms.")},this.collect_from_forms=function(t,e){function r(r){var i,n=D(r),o={},a=!1;if(void 0!==n.elements){var l,c,u={},h=t.getElementsByTagName("LABEL");for(l=0;l<h.length;l++)h[l].htmlFor&&""!==h[l].htmlFor&&(u[h[l].htmlFor]=h[l].innerText||h[l].textContent||h[l].innerHTML);for(l=0;l<n.elements.length;l++)if((i=n.elements[l])&&"password"!==i.type&&-1===i.className.indexOf("cly_user_ignore")){var d="";if("select"===i.nodeName.toLowerCase()?d=void 0!==i.multiple?_(i):i.options[i.selectedIndex].value:"input"===i.nodeName.toLowerCase()?(void 0===i.type||"checkbox"!==i.type.toLowerCase()&&"radio"!==i.type.toLowerCase()||i.checked)&&(d=i.value):("textarea"===i.nodeName.toLowerCase()||void 0!==i.value)&&(d=i.value),i.className&&-1!==i.className.indexOf("cly_user_")){var p=i.className.split(" ");for(c=0;c<p.length;c++)if(0===p[c].indexOf("cly_user_")){o[p[c].replace("cly_user_","")]=d,a=!0;break}}else i.type&&"email"===i.type.toLowerCase()||i.name&&-1!==i.name.toLowerCase().indexOf("email")||i.id&&-1!==i.id.toLowerCase().indexOf("email")||i.id&&u[i.id]&&-1!==u[i.id].toLowerCase().indexOf("email")||/[^@\s]+@[^@\s]+\.[^@\s]+/.test(d)?(o.email||(o.email=d),a=!0):i.name&&-1!==i.name.toLowerCase().indexOf("username")||i.id&&-1!==i.id.toLowerCase().indexOf("username")||i.id&&u[i.id]&&-1!==u[i.id].toLowerCase().indexOf("username")?(o.username||(o.username=d),a=!0):i.name&&(-1!==i.name.toLowerCase().indexOf("tel")||-1!==i.name.toLowerCase().indexOf("phone")||-1!==i.name.toLowerCase().indexOf("number"))||i.id&&(-1!==i.id.toLowerCase().indexOf("tel")||-1!==i.id.toLowerCase().indexOf("phone")||-1!==i.id.toLowerCase().indexOf("number"))||i.id&&u[i.id]&&(-1!==u[i.id].toLowerCase().indexOf("tel")||-1!==u[i.id].toLowerCase().indexOf("phone")||-1!==u[i.id].toLowerCase().indexOf("number"))?(o.phone||(o.phone=d),a=!0):i.name&&(-1!==i.name.toLowerCase().indexOf("org")||-1!==i.name.toLowerCase().indexOf("company"))||i.id&&(-1!==i.id.toLowerCase().indexOf("org")||-1!==i.id.toLowerCase().indexOf("company"))||i.id&&u[i.id]&&(-1!==u[i.id].toLowerCase().indexOf("org")||-1!==u[i.id].toLowerCase().indexOf("company"))?(o.organization||(o.organization=d),a=!0):(i.name&&-1!==i.name.toLowerCase().indexOf("name")||i.id&&-1!==i.id.toLowerCase().indexOf("name")||i.id&&u[i.id]&&-1!==u[i.id].toLowerCase().indexOf("name"))&&(o.name||(o.name=""),o.name+=d+" ",a=!0)}}a&&(ce(s.INFO,"collect_from_forms, Gathered user data",o),e?b.user_details({custom:o}):b.user_details(o))}m?(ce(s.INFO,"collect_from_forms, Starting to collect possible user data. DOM object provided:["+!!t+"] Submitting custom user property:["+!!e+"]"),L(t=t||document,"submit",r)):ce(s.WARNING,"collect_from_forms, window object is not available. Not collecting from forms.")},this.collect_from_facebook=function(t){m?"undefined"!=typeof FB&&FB&&FB.api?(ce(s.INFO,"collect_from_facebook, Starting to collect possible user data"),FB.api("/me",(function(e){var r={};if(e.name&&(r.name=e.name),e.email&&(r.email=e.email),"male"===e.gender?r.gender="M":"female"===e.gender&&(r.gender="F"),e.birthday){var i=e.birthday.split("/").pop();i&&4===i.length&&(r.byear=i)}if(e.work&&e.work[0]&&e.work[0].employer&&e.work[0].employer.name&&(r.organization=e.work[0].employer.name),t)for(var n in r.custom={},t){for(var o=t[n].split("."),a=e,s=0;s<o.length&&void 0!==(a=a[o[s]]);s++);void 0!==a&&(r.custom[n]=a)}b.user_details(r)}))):ce(s.ERROR,"collect_from_facebook, Facebook SDK is not available"):ce(s.WARNING,"collect_from_facebook, window object is not available. Not collecting from Facebook.")},this.opt_out=function(){ce(s.INFO,"opt_out, Opting out the user"),this.ignore_visitor=!0,Ie("cly_ignore",!0)},this.opt_in=function(){ce(s.INFO,"opt_in, Opting in the user"),Ie("cly_ignore",!1),this.ignore_visitor=!1,Wt(),this.ignore_visitor||St||re()},this.report_feedback=function(t){ce(s.WARNING,"report_feedback, Deprecated function call! Use 'recordRatingWidgetWithID' or 'reportFeedbackWidgetManually' in place of this call. Call will be redirected to 'recordRatingWidgetWithID' now!"),this.recordRatingWidgetWithID(t)},this.recordRatingWidgetWithID=function(t){if(ce(s.INFO,"recordRatingWidgetWithID, Providing information about user with ID: [ "+t.widget_id+" ]"),this.check_consent(n.STAR_RATING))if(t.widget_id)if(t.rating){var e=["widget_id","contactMe","platform","app_version","rating","email","comment"],r={key:o.STAR_RATING,count:1,segmentation:{}};r.segmentation=k(t,e),r.segmentation.app_version||(r.segmentation.app_version=this.metrics._app_version||this.app_version),r.segmentation.rating>5?(ce(s.WARNING,"recordRatingWidgetWithID, You have entered a rating higher than 5. Changing it back to 5 now."),r.segmentation.rating=5):r.segmentation.rating<1&&(ce(s.WARNING,"recordRatingWidgetWithID, You have entered a rating lower than 1. Changing it back to 1 now."),r.segmentation.rating=1),ce(s.INFO,"recordRatingWidgetWithID, Reporting Rating Widget: ",r),Gt(r)}else ce(s.ERROR,"recordRatingWidgetWithID, Rating Widget must contain rating property");else ce(s.ERROR,"recordRatingWidgetWithID, Rating Widget must contain widget_id property")},this.reportFeedbackWidgetManually=function(t,e,r){if(this.check_consent(n.FEEDBACK))if(t&&e)if(t._id)if(Tt)ce(s.ERROR,"reportFeedbackWidgetManually, Feedback Widgets can not be reported in offline mode");else{ce(s.INFO,"reportFeedbackWidgetManually, Providing information about user with, provided result of the widget with ID: [ "+t._id+" ] and type: ["+t.type+"]");var i,a=[],l=t.type;if("nps"===l){if(r){if(!r.rating)return void ce(s.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");r.rating=Math.round(r.rating),r.rating>10?(ce(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 10. Changing it back to 10 now."),r.rating=10):r.rating<0&&(ce(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 0. Changing it back to 0 now."),r.rating=0),a=["rating","comment"]}i=o.NPS}else if("survey"===l){if(r){if(Object.keys(r).length<1)return void ce(s.ERROR,"reportFeedbackWidgetManually, Widget should have answers to be reported");a=Object.keys(r)}i=o.SURVEY}else{if("rating"!==l)return void ce(s.ERROR,"reportFeedbackWidgetManually, Widget has an unacceptable type");if(r){if(!r.rating)return void ce(s.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");r.rating=Math.round(r.rating),r.rating>5?(ce(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 5. Changing it back to 5 now."),r.rating=5):r.rating<1&&(ce(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 1. Changing it back to 1 now."),r.rating=1),a=["rating","comment","email","contactMe"]}i=o.STAR_RATING}var c={key:i,count:1,segmentation:{widget_id:t._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};null===r?c.segmentation.closed=1:c.segmentation=C(c.segmentation,r,a),ce(s.INFO,"reportFeedbackWidgetManually, Reporting "+l+": ",c),Gt(c)}else ce(s.ERROR,"reportFeedbackWidgetManually, Feedback Widgets must contain _id property");else ce(s.ERROR,"reportFeedbackWidgetManually, Widget data and/or Widget object not provided. Aborting.")},this.show_feedback_popup=function(t){m?(ce(s.WARNING,"show_feedback_popup, Deprecated function call! Use 'presentRatingWidgetWithID' in place of this call. Call will be redirected now!"),this.presentRatingWidgetWithID(t)):ce(s.WARNING,"show_feedback_popup, window object is not available. Not showing feedback popup.")},this.presentRatingWidgetWithID=function(t){m?(ce(s.INFO,"presentRatingWidgetWithID, Showing rating widget popup for the widget with ID: [ "+t+" ]"),this.check_consent(n.STAR_RATING)&&(Tt?ce(s.ERROR,"presentRatingWidgetWithID, Cannot show ratingWidget popup in offline mode"):ue("presentRatingWidgetWithID,",this.url+"/o/feedback/widget",{widget_id:t,av:b.app_version},(function(t,e,r){if(!t)try{Xt(JSON.parse(r),!1)}catch(i){ce(s.ERROR,"presentRatingWidgetWithID, JSON parse failed: "+i)}}),!0))):ce(s.WARNING,"presentRatingWidgetWithID, window object is not available. Not showing rating widget popup.")},this.initialize_feedback_popups=function(t){m?(ce(s.WARNING,"initialize_feedback_popups, Deprecated function call! Use 'initializeRatingWidgets' in place of this call. Call will be redirected now!"),this.initializeRatingWidgets(t)):ce(s.WARNING,"initialize_feedback_popups, window object is not available. Not initializing feedback popups.")},this.initializeRatingWidgets=function(t){if(m){if(ce(s.INFO,"initializeRatingWidgets, Initializing rating widget with provided widget IDs:[ "+t+"]"),this.check_consent(n.STAR_RATING)){t||(t=Te("cly_fb_widgets"));for(var e=document.getElementsByClassName("countly-feedback-sticker");e.length>0;)e[0].remove();ue("initializeRatingWidgets,",this.url+"/o/feedback/multiple-widgets-by-id",{widgets:JSON.stringify(t),av:b.app_version},(function(t,e,r){if(!t)try{for(var i=JSON.parse(r),n=0;n<i.length;n++)if("true"===i[n].is_active&&i[n].target_devices[F()])if("string"==typeof i[n].hide_sticker&&(i[n].hide_sticker="true"===i[n].hide_sticker),"all"!==i[n].target_page||i[n].hide_sticker)for(var o=i[n].target_pages,a=0;a<o.length;a++){var l=o[a].substr(0,o[a].length-1)===window.location.pathname.substr(0,o[a].length-1),c=o[a]===window.location.pathname;(o[a].includes("*")&&l||c)&&!i[n].hide_sticker&&Xt(i[n],!0)}else Xt(i[n],!0)}catch(u){ce(s.ERROR,"initializeRatingWidgets, JSON parse error: "+u)}}),!0)}}else ce(s.WARNING,"initializeRatingWidgets, window object is not available. Not initializing rating widgets.")},this.enable_feedback=function(t){m?(ce(s.WARNING,"enable_feedback, Deprecated function call! Use 'enableRatingWidgets' in place of this call. Call will be redirected now!"),this.enableRatingWidgets(t)):ce(s.WARNING,"enable_feedback, window object is not available. Not enabling feedback.")},this.enableRatingWidgets=function(t){if(m){if(ce(s.INFO,"enableRatingWidgets, Enabling rating widget with params:",t),this.check_consent(n.STAR_RATING))if(Tt)ce(s.ERROR,"enableRatingWidgets, Cannot enable rating widgets in offline mode");else{Ie("cly_fb_widgets",t.popups||t.widgets),Z(this.url+"/star-rating/stylesheets/countly-feedback-web.css");var e=t.popups||t.widgets;e.length>0?(document.body.insertAdjacentHTML("beforeend",'<div id="cfbg"></div>'),this.initializeRatingWidgets(e)):ce(s.ERROR,"enableRatingWidgets, You should provide at least one widget id as param. Read documentation for more detail. https://resources.count.ly/plugins/feedback")}}else ce(s.WARNING,"enableRatingWidgets, window object is not available. Not enabling rating widgets.")},this.get_available_feedback_widgets=function(t){ce(s.INFO,"get_available_feedback_widgets, Getting the feedback list, callback function is provided:["+!!t+"]"),this.check_consent(n.FEEDBACK)?Tt?ce(s.ERROR,"get_available_feedback_widgets, Cannot enable feedback widgets in offline mode."):ue("get_available_feedback_widgets,",this.url+Y,{method:n.FEEDBACK,device_id:this.device_id,app_key:this.app_key,av:b.app_version},(function(e,r,i){if(e)t&&t(null,e);else try{var n=JSON.parse(i).result||[];t&&t(n,null)}catch(o){ce(s.ERROR,"get_available_feedback_widgets, Error while parsing feedback widgets list: "+o),t&&t(null,o)}}),!1):t&&t(null,new Error("Consent for feedback not provided."))},this.getFeedbackWidgetData=function(t,e){if(t.type)if(ce(s.INFO,"getFeedbackWidgetData, Retrieving data for: ["+JSON.stringify(t)+"], callback function is provided:["+!!e+"]"),this.check_consent(n.FEEDBACK))if(Tt)ce(s.ERROR,"getFeedbackWidgetData, Cannot enable feedback widgets in offline mode.");else{var r=this.url,i={widget_id:t._id,shown:1,sdk_version:Nt,sdk_name:Ft,platform:this.platform,app_version:this.app_version};if("nps"===t.type)r+="/o/surveys/nps/widget";else if("survey"===t.type)r+="/o/surveys/survey/widget";else{if("rating"!==t.type)return void ce(s.ERROR,"getFeedbackWidgetData, Unknown type info: ["+t.type+"]");r+="/o/surveys/rating/widget"}ue("getFeedbackWidgetData,",r,i,o,!0)}else e&&e(null,new Error("Consent for feedback not provided."));else ce(s.ERROR,"getFeedbackWidgetData, Expected the provided widget object to have a type but got: ["+JSON.stringify(t)+"], aborting.");function o(t,r,i){if(t)e&&e(null,t);else try{var n=JSON.parse(i);e&&e(n,null)}catch(o){ce(s.ERROR,"getFeedbackWidgetData, Error while parsing feedback widgets list: "+o),e&&e(null,o)}}},this.present_feedback_widget=function(t,r,i,o){if(m){if(ce(s.INFO,"present_feedback_widget, Presenting the feedback widget by appending to the element with ID: [ "+r+" ] and className: [ "+i+" ]"),this.check_consent(n.FEEDBACK))if(t&&"object"===e(t)&&!Array.isArray(t)){ce(s.INFO,"present_feedback_widget, Adding segmentation to feedback widgets:["+JSON.stringify(o)+"]"),o&&"object"===e(o)&&0!==Object.keys(o).length||(ce(s.DEBUG,"present_feedback_widget, Segmentation is not an object or empty"),o=null);try{var a=this.url;if("nps"===t.type)ce(s.DEBUG,"present_feedback_widget, Widget type: nps."),a+="/feedback/nps";else if("survey"===t.type)ce(s.DEBUG,"present_feedback_widget, Widget type: survey."),a+="/feedback/survey";else{if("rating"!==t.type)return void ce(s.ERROR,"present_feedback_widget, Feedback widget only accepts nps, rating and survey types.");ce(s.DEBUG,"present_feedback_widget, Widget type: rating."),a+="/feedback/rating"}var l,c=window.origin||window.location.origin;if("rating"===t.type?(ce(s.DEBUG,"present_feedback_widget, Loading css for rating widget."),l="ratings",Z(this.url+"/star-rating/stylesheets/countly-feedback-web.css")):(ce(s.DEBUG,"present_feedback_widget, Loading css for survey or nps."),Z(this.url+"/surveys/stylesheets/countly-surveys.css"),l="surveys"),a+="?widget_id="+t._id,a+="&app_key="+this.app_key,a+="&device_id="+this.device_id,a+="&sdk_name="+Ft,a+="&platform="+this.platform,a+="&app_version="+this.app_version,a+="&sdk_version="+Nt,o){var u={};u.sg=o,a+="&custom="+JSON.stringify(u)}a+="&origin="+c,a+="&widget_v=web";var h=document.createElement("iframe");h.src=a,h.name="countly-"+l+"-iframe",h.id="countly-"+l+"-iframe";var d=!1;h.onload=function(){d&&(document.getElementById("countly-"+l+"-wrapper-"+t._id).style.display="none",document.getElementById("csbg").style.display="none"),d=!0,ce(s.DEBUG,"present_feedback_widget, Loaded iframe.")};for(var p=document.getElementById("csbg");p;)p.remove(),p=document.getElementById("csbg"),ce(s.DEBUG,"present_feedback_widget, Removing past overlay.");for(var f=document.getElementsByClassName("countly-"+l+"-wrapper"),g=0;g<f.length;g++)f[g].remove(),ce(s.DEBUG,"present_feedback_widget, Removed a wrapper.");(f=document.createElement("div")).className="countly-"+l+"-wrapper",f.id="countly-"+l+"-wrapper-"+t._id,"survey"===t.type&&(f.className=f.className+" "+t.appearance.position);var _=document.body,y=!1;if(r&&(document.getElementById(r)?(_=document.getElementById(r),y=!0):ce(s.ERROR,"present_feedback_widget, Provided ID not found.")),y||i&&(document.getElementsByClassName(i)[0]?_=document.getElementsByClassName(i)[0]:ce(s.ERROR,"present_feedback_widget, Provided class not found.")),_.insertAdjacentHTML("beforeend",'<div id="csbg"></div>'),_.appendChild(f),"rating"===t.type){var v=document.createElement("div");v.className="countly-ratings-overlay",v.id="countly-ratings-overlay-"+t._id,f.appendChild(v),ce(s.DEBUG,"present_feedback_widget, appended the rating overlay to wrapper"),L(document.getElementById("countly-ratings-overlay-"+t._id),"click",(function(){document.getElementById("countly-ratings-wrapper-"+t._id).style.display="none"}))}if(f.appendChild(h),ce(s.DEBUG,"present_feedback_widget, Appended the iframe"),L(window,"message",(function(e){var r={};try{r=JSON.parse(e.data),ce(s.DEBUG,"present_feedback_widget, Parsed response message "+r)}catch(i){ce(s.ERROR,"present_feedback_widget, Error while parsing message body "+i)}r.close?(document.getElementById("countly-"+l+"-wrapper-"+t._id).style.display="none",document.getElementById("csbg").style.display="none"):ce(s.DEBUG,"present_feedback_widget, Closing signal not sent yet")})),"survey"===t.type){var b=!1;switch(t.showPolicy){case"afterPageLoad":"complete"===document.readyState?b||(b=!0,w(t)):L(document,"readystatechange",(function(e){"complete"===e.target.readyState&&(b||(b=!0,w(t)))}));break;case"afterConstantDelay":setTimeout((function(){b||(b=!0,w(t))}),1e4);break;case"onAbandon":"complete"===document.readyState?L(document,"mouseleave",(function(){b||(b=!0,w(t))})):L(document,"readystatechange",(function(e){"complete"===e.target.readyState&&L(document,"mouseleave",(function(){b||(b=!0,w(t))}))}));break;case"onScrollHalfwayDown":L(window,"scroll",(function(){b||Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)>=j()/2&&(b=!0,w(t))}));break;default:b||(b=!0,w(t))}}else if("nps"===t.type)document.getElementById("countly-"+l+"-wrapper-"+t._id).style.display="block",document.getElementById("csbg").style.display="block";else if("rating"===t.type){var x=!1;"complete"===document.readyState?x||(x=!0,S(t)):L(document,"readystatechange",(function(e){"complete"===e.target.readyState&&(x||(x=!0,S(t)))}))}}catch(ht){ce(s.ERROR,"present_feedback_widget, Something went wrong while presenting the widget: "+ht)}}else ce(s.ERROR,"present_feedback_widget, Please provide at least one feedback widget object.")}else ce(s.WARNING,"present_feedback_widget, window object is not available. Not presenting feedback widget.");function w(t){document.getElementById("countly-surveys-wrapper-"+t._id).style.display="block",document.getElementById("csbg").style.display="block"}function S(t){if(!t.appearance.hideS){ce(s.DEBUG,"present_feedback_widget, handling the sticker as it was not set to hidden");var e=document.createElement("div");e.innerText=t.appearance.text,e.style.color=t.appearance.text_color.length<7?"#"+t.appearance.text_color:t.appearance.text_color,e.style.backgroundColor=t.appearance.bg_color.length<7?"#"+t.appearance.bg_color:t.appearance.bg_color,e.className="countly-feedback-sticker "+t.appearance.position+"-"+t.appearance.size,e.id="countly-feedback-sticker-"+t._id,document.body.appendChild(e),L(document.getElementById("countly-feedback-sticker-"+t._id),"click",(function(){document.getElementById("countly-ratings-wrapper-"+t._id).style.display="flex",document.getElementById("csbg").style.display="block"}))}L(document.getElementById("countly-feedback-close-icon-"+t._id),"click",(function(){document.getElementById("countly-ratings-wrapper-"+t._id).style.display="none",document.getElementById("csbg").style.display="none"}))}},this.recordError=function(t,r,i){if(ce(s.INFO,"recordError, Recording error"),this.check_consent(n.CRASHES)&&t){i=i||at;var o="";if("object"===e(t)?void 0!==t.stack?o=t.stack:(void 0!==t.name&&(o+=t.name+":"),void 0!==t.message&&(o+=t.message+"\n"),void 0!==t.fileName&&(o+="in "+t.fileName+"\n"),void 0!==t.lineNumber&&(o+="on "+t.lineNumber),void 0!==t.columnNumber&&(o+=":"+t.columnNumber)):o=t+"",o.length>b.maxStackTraceLineLength*b.maxStackTraceLinesPerThread){ce(s.DEBUG,"record_error, Error stack is too long will be truncated");var a=o.split("\n");a.length>b.maxStackTraceLinesPerThread&&(a=a.splice(0,b.maxStackTraceLinesPerThread));for(var l=0,c=a.length;l<c;l++)a[l].length>b.maxStackTraceLineLength&&(a[l]=a[l].substring(0,b.maxStackTraceLineLength));o=a.join("\n")}r=!!r;var u=se(),h={_resolution:u._resolution,_error:o,_app_version:u._app_version,_run:x()-Pt,_not_os_specific:!0,_javascript:!0},d=navigator.battery||navigator.webkitBattery||navigator.mozBattery||navigator.msBattery;d&&(h._bat=Math.floor(100*d.level)),void 0!==navigator.onLine&&(h._online=!!navigator.onLine),m&&(h._background=!document.hasFocus()),it.length>0&&(h._logs=it.join("\n")),it=[],h._nonfatal=r,h._view=this.getViewName(),void 0!==i&&(i=A(i,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"record_error",ce),h._custom=i);try{var p=document.createElement("canvas").getContext("experimental-webgl");h._opengl=p.getParameter(p.VERSION)}catch(g){ce(s.ERROR,"Could not get the experimental-webgl context: "+g)}var f={};f.crash=JSON.stringify(h),f.metrics=JSON.stringify({_ua:u._ua}),ee(f)}},this.onStorageChange=function(t,e){switch(ce(s.DEBUG,"onStorageChange, Applying storage changes for key:",t),ce(s.DEBUG,"onStorageChange, Applying storage changes for value:",e),t){case"cly_queue":tt=b.deserialize(e||"[]");break;case"cly_event":et=b.deserialize(e||"[]");break;case"cly_remote_configs":rt=b.deserialize(e||"{}");break;case"cly_ignore":b.ignore_visitor=b.deserialize(e);break;case"cly_id":b.device_id=e;break;case"cly_id_type":At=b.deserialize(e)}},this._internals={store:Ie,getDocWidth:U,getDocHeight:j,getViewportHeight:V,get_page_coord:B,get_event_target:D,add_event_listener:L,createNewObjectFromProperties:k,truncateObject:A,truncateSingleValue:M,stripTrailingSlash:P,prepareParams:E,sendXmlHttpRequest:he,isResponseValid:pe,getInternalDeviceIdType:_e,getMsTimestamp:S,getTimestamp:x,isResponseValidBroad:fe,secureRandom:y,log:ce,checkIfLoggingIsOn:H,getMetrics:se,getUA:ae,prepareRequest:te,generateUUID:v,sendEventsForced:Ht,isUUID:oe,isReferrerUsable:le,getId:ne,heartBeat:re,toRequestQueue:ee,reportViewDuration:Yt,loadJS:q,loadCSS:Z,getLastView:Kt,setToken:ye,getToken:ve,showLoader:W,hideLoader:X,setValueInStorage:Ie,getValueFromStorage:Te,removeValueFromStorage:Ee,add_cly_events:Gt,processScrollView:ge,processScroll:me,currentUserAgentString:z,currentUserAgentDataString:O,userAgentDeviceDetection:F,userAgentSearchBotDetection:N,getRequestQueue:xe,getEventQueue:be,sendFetchRequest:de,processAsyncQueue:ie,makeNetworkRequest:ue,clearQueue:function(){tt=[],Ie("cly_queue",[]),et=[],Ie("cly_event",[])},getLocalQueues:function(){return{eventQ:et,requestQ:tt}}};var ke={};function Ce(){b.hcErrorCount++}function Ae(){b.hcWarningCount++}function Me(){b.hcErrorCount=0,b.hcWarningCount=0,b.hcStatusCode=-1,b.hcErrorMessage=""}function Re(t,e){b.hcStatusCode=t,b.hcErrorMessage=e,Ie(h.statusCode,b.hcStatusCode),Ie(h.errorMessage,b.hcErrorMessage)}function Le(){ke.resetCounters(),Ie(h.errorCount,b.hcErrorCount),Ie(h.warningCount,b.hcWarningCount),Ie(h.statusCode,b.hcStatusCode),Ie(h.errorMessage,b.hcErrorMessage)}function De(){var t=M(b.hcErrorMessage,1e3,"healthCheck",ce),e={el:b.hcErrorCount,wl:b.hcWarningCount,sc:b.hcStatusCode,em:JSON.stringify(t)},r={hc:JSON.stringify(e),metrics:JSON.stringify({_app_version:b.app_version})};te(r),ue("[healthCheck]",b.url+J,r,(function(t){t||ke.resetAndSaveCounters()}),!0)}ke.sendInstantHCRequest=De,ke.resetAndSaveCounters=Le,ke.incrementErrorCount=Ce,ke.incrementWarningCount=Ae,ke.resetCounters=Me,ke.saveRequestCounters=Re,this.initialize()})),Y=!0;function K(t){var e=document.createElement("script"),r=document.createElement("script");e.async=!0,r.async=!0,e.src=g.customSourceBoomerang||u.BOOMERANG_SRC,r.src=g.customSourceCountlyBoomerang||u.CLY_BOOMERANG_SRC,document.getElementsByTagName("head")[0].appendChild(e),document.getElementsByTagName("head")[0].appendChild(r);var i=!1,n=!1;e.onload=function(){i=!0},r.onload=function(){n=!0};var o=0,a=50,s=1500,l=setInterval((function(){if(o+=a,i&&n||o>=s){if(g.debug){var e="BoomerangJS loaded:["+i+"], countly_boomerang loaded:["+n+"].";i&&n?(e="[DEBUG] "+e,console.log(e)):(e="[WARNING] "+e+" Initializing without APM.",console.warn(e))}g.init(t),clearInterval(l)}}),a)}g.features=[n.APM,n.ATTRIBUTION,n.CLICKS,n.CRASHES,n.EVENTS,n.FEEDBACK,n.FORMS,n.LOCATION,n.REMOTE_CONFIG,n.SCROLLS,n.SESSIONS,n.STAR_RATING,n.USERS,n.VIEWS],g.q=g.q||[],g.onload=g.onload||[],g.CountlyClass=J,g.init=function(t){if(t=t||{},g.loadAPMScriptsAsync&&Y)return Y=!1,void K(t);var e=t.app_key||g.app_key;if(!g.i||!g.i[e]){var r=new J(t);if(!g.i)for(var i in g.i={},r)g[i]=r[i];g.i[e]=r}return g.i[e]},g.serialize=function(t){return"object"===e(t)&&(t=JSON.stringify(t)),t},g.deserialize=function(t){if(""===t)return t;try{t=JSON.parse(t)}catch(ht){H()&&console.warn("[WARNING] [Countly] deserialize, Could not parse the file:["+t+"], error: "+ht)}return t},g.getViewName=function(){return m?window.location.pathname:"web_worker"},g.getViewUrl=function(){return m?window.location.pathname:"web_worker"},g.getSearchQuery=function(){if(m)return window.location.search},g.DeviceIdType={DEVELOPER_SUPPLIED:l.DEVELOPER_SUPPLIED,SDK_GENERATED:l.SDK_GENERATED,TEMPORARY_ID:l.TEMPORARY_ID},m&&window.addEventListener("storage",(function(t){var e=(t.key+"").split("/"),r=e.pop(),i=e.pop();g.i&&g.i[i]&&g.i[i].onStorageChange(r,t.newValue)})),t.default=g,Object.defineProperty(t,"__esModule",{value:!0})}(e)},738:function(t){!function(e,r){t.exports=r()}(0,(()=>{return t={276:function(){!function(t){t.console||(t.console={});for(var e,r,i=t.console,n=function(){},o=["memory"],a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=o.pop();)i[e]||(i[e]={});for(;r=a.pop();)i[r]||(i[r]=n)}("undefined"==typeof window?this:window)},180:function(t,e,r){var i,n,o;n=[r(124)],void 0===(o="function"==typeof(i=function(t){var e=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(t){return!!t.match(r)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var r=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),i=r.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(r=i?r.replace(i[0],""):r).split(/\s+/).slice(1),o=this.extractLocation(i?i[1]:n.pop()),a=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(o[0])>-1?void 0:o[0];return new t({functionName:a,fileName:s,lineNumber:o[1],columnNumber:o[2],source:e})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(t){return!t.match(i)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t({functionName:e});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(r),n=i&&i[1]?i[1]:void 0,o=this.extractLocation(e.replace(r,""));return new t({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e})}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[],o=2,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new t({fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera10:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[],o=0,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new t({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera11:function(r){return r.stack.split("\n").filter((function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this).map((function(e){var r,i=e.split("@"),n=this.extractLocation(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;o.match(/\(([^)]*)\)/)&&(r=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new t({functionName:a,args:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e})}),this)}}})?i.apply(e,n):i)||(t.exports=o)},124:function(t,e){var r,i;void 0===(i="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t){return t.charAt(0).toUpperCase()+t.substring(1)}function r(t){return function(){return this[t]}}var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=i.concat(n,o,["args"],["evalOrigin"]);function s(t){if(t)for(var r=0;r<a.length;r++)void 0!==t[a[r]]&&this["set"+e(a[r])](t[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof s)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:i?i+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},s.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),i=t.substring(0,e),n=t.substring(e+1,r).split(","),o=t.substring(r+1);if(0===o.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),l=a[1],c=a[2],u=a[3];return new s({functionName:i,args:n||void 0,fileName:l,lineNumber:c||void 0,columnNumber:u||void 0})};for(var l=0;l<i.length;l++)s.prototype["get"+e(i[l])]=r(i[l]),s.prototype["set"+e(i[l])]=function(t){return function(e){this[t]=Boolean(e)}}(i[l]);for(var c=0;c<n.length;c++)s.prototype["get"+e(n[c])]=r(n[c]),s.prototype["set"+e(n[c])]=function(e){return function(r){if(!t(r))throw new TypeError(e+" must be a Number");this[e]=Number(r)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+e(o[u])]=r(o[u]),s.prototype["set"+e(o[u])]=function(t){return function(e){this[t]=String(e)}}(o[u]);return s})?r.apply(e,[]):r)||(t.exports=i)},815:(t,e,r)=>{var i=r(702),n=r(817),o={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443};function a(t,e,r,i,n){this.options=t,this.transport=e,this.url=r,this.truncation=i,this.jsonBackup=n,this.accessToken=t.accessToken,this.transportOptions=s(t,r)}function s(t,e){return n.getTransportFromOptions(t,o,e)}a.prototype.postItem=function(t,e){var r=n.transportOptions(this.transportOptions,"POST"),i=n.buildPayload(this.accessToken,t,this.jsonBackup),o=this;setTimeout((function(){o.transport.post(o.accessToken,r,i,e)}),0)},a.prototype.buildJsonPayload=function(t,e){var r,o=n.buildPayload(this.accessToken,t,this.jsonBackup);return(r=this.truncation?this.truncation.truncate(o):i.stringify(o)).error?(e&&e(r.error),null):r.value},a.prototype.postJsonPayload=function(t,e){var r=n.transportOptions(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,t,e)},a.prototype.configure=function(t){var e=this.oldOptions;return this.options=i.merge(e,t),this.transportOptions=s(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this},t.exports=a},817:(t,e,r)=>{var i=r(702);t.exports={buildPayload:function(t,e,r){if(!i.isType(e.context,"string")){var n=i.stringify(e.context,r);n.error?e.context="Error: could not serialize 'context'":e.context=n.value||"",e.context.length>255&&(e.context=e.context.substr(0,255))}return{access_token:t,data:e}},getTransportFromOptions:function(t,e,r){var i=e.hostname,n=e.protocol,o=e.port,a=e.path,s=e.search,l=t.timeout,c=function(t){var e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=t.defaultTransport||"xhr";return void 0===e.fetch&&(r="xhr"),void 0===e.XMLHttpRequest&&(r="fetch"),r}(t),u=t.proxy;if(t.endpoint){var h=r.parse(t.endpoint);i=h.hostname,n=h.protocol,o=h.port,a=h.pathname,s=h.search}return{timeout:l,hostname:i,protocol:n,port:o,path:a,search:s,proxy:u,transport:c}},transportOptions:function(t,e){var r=t.protocol||"https:",i=t.port||("http:"===r?80:"https:"===r?443:void 0),n=t.hostname,o=t.path,a=t.timeout,s=t.transport;return t.search&&(o+=t.search),t.proxy&&(o=r+"//"+n+o,n=t.proxy.host||t.proxy.hostname,i=t.proxy.port,r=t.proxy.protocol||r),{timeout:a,protocol:r,hostname:n,path:o,port:i,method:e,transport:s}},appendPathToPath:function(t,e){var r=/\/$/.test(t),i=/^\//.test(e);return r&&i?e=e.substring(1):r||i||(e="/"+e),t+e}}},409:(t,e,r)=>{var i=r(343),n="undefined"!=typeof window&&window._rollbarConfig,o=n&&n.globalAlias||"Rollbar",a="undefined"!=typeof window&&window[o]&&"function"==typeof window[o].shimId&&void 0!==window[o].shimId();if("undefined"==typeof window||window._rollbarStartTime||(window._rollbarStartTime=(new Date).getTime()),!a&&n){var s=new i(n);window[o]=s}else"undefined"!=typeof window?(window.rollbar=i,window._rollbarDidLoad=!0):"undefined"!=typeof self&&(self.rollbar=i,self._rollbarDidLoad=!0);t.exports=i},403:(t,e,r)=>{var i=r(562),n=r(702),o=r(815),a=r(802),s=r(349),l=r(477),c=r(509),u=r(860),h=r(417),d=r(172),p=r(61),f=r(303);function m(t,e){this.options=n.handleOptions(w,t,null,a),this.options._configuredOptions=t;var r=this.components.telemeter,s=this.components.instrumenter,f=this.components.polyfillJSON;this.wrapGlobals=this.components.wrapGlobals,this.scrub=this.components.scrub;var m=this.components.truncation,g=new l(m),_=new o(this.options,g,c,m);r&&(this.telemeter=new r(this.options)),this.client=e||new i(this.options,_,a,this.telemeter,"browser");var y=v(),b="undefined"!=typeof document&&document;this.isChrome=y.chrome&&y.chrome.runtime,this.anonymousErrorsPending=0,function(t,e,r){t.addTransform(u.handleDomException).addTransform(u.handleItemWithError).addTransform(u.ensureItemHasSomethingToSay).addTransform(u.addBaseInfo).addTransform(u.addRequestInfo(r)).addTransform(u.addClientInfo(r)).addTransform(u.addPluginInfo(r)).addTransform(u.addBody).addTransform(h.addMessageWithError).addTransform(h.addTelemetryData).addTransform(h.addConfigToPayload).addTransform(u.addScrubber(e.scrub)).addTransform(h.addPayloadOptions).addTransform(h.userTransform(a)).addTransform(h.addConfiguredOptions).addTransform(h.addDiagnosticKeys).addTransform(h.itemToPayload)}(this.client.notifier,this,y),this.client.queue.addPredicate(p.checkLevel).addPredicate(d.checkIgnore).addPredicate(p.userCheckIgnore(a)).addPredicate(p.urlIsNotBlockListed(a)).addPredicate(p.urlIsSafeListed(a)).addPredicate(p.messageIsIgnored(a)),this.setupUnhandledCapture(),s&&(this.instrumenter=new s(this.options,this.client.telemeter,this,y,b),this.instrumenter.instrument()),n.setupJSON(f),this.rollbar=this}var g=null;function _(t){var e="Rollbar is not initialized";a.error(e),t&&t(new Error(e))}function y(t){for(var e=0,r=t.length;e<r;++e)if(n.isFunction(t[e]))return t[e]}function v(){return"undefined"!=typeof window&&window||"undefined"!=typeof self&&self}m.init=function(t,e){return g?g.global(t).configure(t):g=new m(t,e)},m.prototype.components={},m.setComponents=function(t){m.prototype.components=t},m.prototype.global=function(t){return this.client.global(t),this},m.global=function(t){if(g)return g.global(t);_()},m.prototype.configure=function(t,e){var r=this.options,i={};return e&&(i={payload:e}),this.options=n.handleOptions(r,t,i,a),this.options._configuredOptions=n.handleOptions(r._configuredOptions,t,i),this.client.configure(this.options,e),this.instrumenter&&this.instrumenter.configure(this.options),this.setupUnhandledCapture(),this},m.configure=function(t,e){if(g)return g.configure(t,e);_()},m.prototype.lastError=function(){return this.client.lastError},m.lastError=function(){if(g)return g.lastError();_()},m.prototype.log=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.log(t),{uuid:e}},m.log=function(){if(g)return g.log.apply(g,arguments);_(y(arguments))},m.prototype.debug=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.debug(t),{uuid:e}},m.debug=function(){if(g)return g.debug.apply(g,arguments);_(y(arguments))},m.prototype.info=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.info(t),{uuid:e}},m.info=function(){if(g)return g.info.apply(g,arguments);_(y(arguments))},m.prototype.warn=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warn(t),{uuid:e}},m.warn=function(){if(g)return g.warn.apply(g,arguments);_(y(arguments))},m.prototype.warning=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warning(t),{uuid:e}},m.warning=function(){if(g)return g.warning.apply(g,arguments);_(y(arguments))},m.prototype.error=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.error(t),{uuid:e}},m.error=function(){if(g)return g.error.apply(g,arguments);_(y(arguments))},m.prototype.critical=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.critical(t),{uuid:e}},m.critical=function(){if(g)return g.critical.apply(g,arguments);_(y(arguments))},m.prototype.buildJsonPayload=function(t){return this.client.buildJsonPayload(t)},m.buildJsonPayload=function(){if(g)return g.buildJsonPayload.apply(g,arguments);_()},m.prototype.sendJsonPayload=function(t){return this.client.sendJsonPayload(t)},m.sendJsonPayload=function(){if(g)return g.sendJsonPayload.apply(g,arguments);_()},m.prototype.setupUnhandledCapture=function(){var t=v();this.unhandledExceptionsInitialized||(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(s.captureUncaughtExceptions(t,this),this.wrapGlobals&&this.options.wrapGlobalEventHandlers&&this.wrapGlobals(t,this),this.unhandledExceptionsInitialized=!0),this.unhandledRejectionsInitialized||(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&(s.captureUnhandledRejections(t,this),this.unhandledRejectionsInitialized=!0)},m.prototype.handleUncaughtException=function(t,e,r,i,o,a){if(this.options.captureUncaught||this.options.handleUncaughtExceptions){if(this.options.inspectAnonymousErrors&&this.isChrome&&null===o&&""===e)return"anonymous";var s,l=n.makeUnhandledStackInfo(t,e,r,i,o,"onerror","uncaught exception",f);n.isError(o)?(s=this._createItem([t,o,a]))._unhandledStackInfo=l:n.isError(e)?(s=this._createItem([t,e,a]))._unhandledStackInfo=l:(s=this._createItem([t,a])).stackInfo=l,s.level=this.options.uncaughtErrorLevel,s._isUncaught=!0,this.client.log(s)}},m.prototype.handleAnonymousErrors=function(){if(this.options.inspectAnonymousErrors&&this.isChrome){var t=this;try{Error.prepareStackTrace=function(e,r){if(t.options.inspectAnonymousErrors&&t.anonymousErrorsPending){if(t.anonymousErrorsPending-=1,!e)return;e._isAnonymous=!0,t.handleUncaughtException(e.message,null,null,null,e)}return e.stack}}catch(t){this.options.inspectAnonymousErrors=!1,this.error("anonymous error handler failed",t)}}},m.prototype.handleUnhandledRejection=function(t,e){if(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections){var r="unhandled rejection was null or undefined!";if(t)if(t.message)r=t.message;else{var i=n.stringify(t);i.value&&(r=i.value)}var o,a=t&&t._rollbarContext||e&&e._rollbarContext;n.isError(t)?o=this._createItem([r,t,a]):(o=this._createItem([r,t,a])).stackInfo=n.makeUnhandledStackInfo(r,"",0,0,null,"unhandledrejection","",f),o.level=this.options.uncaughtErrorLevel,o._isUncaught=!0,o._originalArgs=o._originalArgs||[],o._originalArgs.push(e),this.client.log(o)}},m.prototype.wrap=function(t,e,r){try{var i;if(i=n.isFunction(e)?e:function(){return e||{}},!n.isFunction(t))return t;if(t._isWrap)return t;if(!t._rollbar_wrapped&&(t._rollbar_wrapped=function(){r&&n.isFunction(r)&&r.apply(this,arguments);try{return t.apply(this,arguments)}catch(r){var e=r;throw e&&window._rollbarWrappedError!==e&&(n.isType(e,"string")&&(e=new String(e)),e._rollbarContext=i()||{},e._rollbarContext._wrappedSource=t.toString(),window._rollbarWrappedError=e),e}},t._rollbar_wrapped._isWrap=!0,t.hasOwnProperty))for(var o in t)t.hasOwnProperty(o)&&"_rollbar_wrapped"!==o&&(t._rollbar_wrapped[o]=t[o]);return t._rollbar_wrapped}catch(e){return t}},m.wrap=function(t,e){if(g)return g.wrap(t,e);_()},m.prototype.captureEvent=function(){var t=n.createTelemetryEvent(arguments);return this.client.captureEvent(t.type,t.metadata,t.level)},m.captureEvent=function(){if(g)return g.captureEvent.apply(g,arguments);_()},m.prototype.captureDomContentLoaded=function(t,e){return e||(e=new Date),this.client.captureDomContentLoaded(e)},m.prototype.captureLoad=function(t,e){return e||(e=new Date),this.client.captureLoad(e)},m.prototype.loadFull=function(){a.info("Unexpected Rollbar.loadFull() called on a Notifier instance. This can happen when Rollbar is loaded multiple times.")},m.prototype._createItem=function(t){return n.createItem(t,a,this)};var b=r(948),x=r(677),w={version:b.version,scrubFields:x.scrubFields,logLevel:b.logLevel,reportLevel:b.reportLevel,uncaughtErrorLevel:b.uncaughtErrorLevel,endpoint:b.endpoint,verbose:!1,enabled:!0,transmit:!0,sendConfig:!1,includeItemsInTelemetry:!0,captureIp:!0,inspectAnonymousErrors:!0,ignoreDuplicateErrors:!0,wrapGlobalEventHandlers:!1};t.exports=m},677:t=>{t.exports={scrubFields:["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken","cc-number","card number","cardnumber","cardnum","ccnum","ccnumber","cc num","creditcardnumber","credit card number","newcreditcardnumber","new credit card","creditcardno","credit card no","card#","card #","cc-csc","cvc","cvc2","cvv2","ccv2","security code","card verification","name on credit card","name on card","nameoncard","cardholder","card holder","name des karteninhabers","ccname","card type","cardtype","cc type","cctype","payment type","expiration date","expirationdate","expdate","cc-exp","ccmonth","ccyear"]}},616:t=>{var e={ieVersion:function(){var t;if("undefined"==typeof document)return t;for(var e=3,r=document.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="\x3c!--[if gt IE "+ ++e+"]><i></i><![endif]--\x3e",i[0];);return e>4?e:t}};t.exports=e},300:t=>{function e(t){return(t.getAttribute("type")||"").toLowerCase()}function r(t){if(!t||!t.tagName)return"";var e=[t.tagName];t.id&&e.push("#"+t.id),t.classes&&e.push("."+t.classes.join("."));for(var r=0;r<t.attributes.length;r++)e.push("["+t.attributes[r].key+'="'+t.attributes[r].value+'"]');return e.join("")}function i(t){if(!t||!t.tagName)return null;var e,r,i,n,o={};o.tagName=t.tagName.toLowerCase(),t.id&&(o.id=t.id),(e=t.className)&&"string"==typeof e&&(o.classes=e.split(/\s+/));var a=["type","name","title","alt"];for(o.attributes=[],n=0;n<a.length;n++)r=a[n],(i=t.getAttribute(r))&&o.attributes.push({key:r,value:i});return o}t.exports={describeElement:i,descriptionToString:r,elementArrayToString:function(t){for(var e,i,n=[],o=0,a=t.length-1;a>=0;a--){if(e=r(t[a]),i=o+3*n.length+e.length,a<t.length-1&&i>=83){n.unshift("...");break}n.unshift(e),o+=e.length}return n.join(" > ")},treeToArray:function(t){for(var e,r=[],n=0;t&&n<5&&"html"!==(e=i(t)).tagName;n++)r.unshift(e),t=t.parentNode;return r},getElementFromEvent:function(t,e){return t.target?t.target:e&&e.elementFromPoint?e.elementFromPoint(t.clientX,t.clientY):void 0},isDescribedElement:function(t,r,i){if(t.tagName.toLowerCase()!==r.toLowerCase())return!1;if(!i)return!0;t=e(t);for(var n=0;n<i.length;n++)if(i[n]===t)return!0;return!1},getElementType:e}},349:t=>{t.exports={captureUncaughtExceptions:function(t,e,r){if(t){var i;if("function"==typeof e._rollbarOldOnError)i=e._rollbarOldOnError;else if(t.onerror){for(i=t.onerror;i._rollbarOldOnError;)i=i._rollbarOldOnError;e._rollbarOldOnError=i}e.handleAnonymousErrors();var n=function(){var r=Array.prototype.slice.call(arguments,0);!function(t,e,r,i){t._rollbarWrappedError&&(i[4]||(i[4]=t._rollbarWrappedError),i[5]||(i[5]=t._rollbarWrappedError._rollbarContext),t._rollbarWrappedError=null);var n=e.handleUncaughtException.apply(e,i);r&&r.apply(t,i),"anonymous"===n&&(e.anonymousErrorsPending+=1)}(t,e,i,r)};r&&(n._rollbarOldOnError=i),t.onerror=n}},captureUnhandledRejections:function(t,e,r){if(t){"function"==typeof t._rollbarURH&&t._rollbarURH.belongsToShim&&t.removeEventListener("unhandledrejection",t._rollbarURH);var i=function(t){var r,i,n;try{r=t.reason}catch(t){r=void 0}try{i=t.promise}catch(t){i="[unhandledrejection] error getting `promise` from event"}try{n=t.detail,!r&&n&&(r=n.reason,i=n.promise)}catch(t){}r||(r="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(r,i)};i.belongsToShim=r,t._rollbarURH=i,t.addEventListener("unhandledrejection",i)}}}},802:(t,e,r)=>{r(276);var i=r(616),n=r(702);t.exports={error:function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("Rollbar:"),i.ieVersion()<=8?console.error(n.formatArgsAsString(t)):console.error.apply(console,t)},info:function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("Rollbar:"),i.ieVersion()<=8?console.info(n.formatArgsAsString(t)):console.info.apply(console,t)},log:function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("Rollbar:"),i.ieVersion()<=8?console.log(n.formatArgsAsString(t)):console.log.apply(console,t)}}},172:(t,e,r)=>{var i=r(702);t.exports={checkIgnore:function(t,e){return!i.get(e,"plugins.jquery.ignoreAjaxErrors")||!i.get(t,"body.message.extra.isAjax")}}},343:(t,e,r)=>{var i=r(403),n=r(773),o=r(568),a=r(876),s=r(965),l=r(369),c=r(473);i.setComponents({telemeter:n,instrumenter:o,polyfillJSON:a,wrapGlobals:s,scrub:l,truncation:c}),t.exports=i},568:(t,e,r)=>{var i=r(702),n=r(650),o=r(297),a=r(369),s=r(509),l=r(300),c={network:!0,networkResponseHeaders:!1,networkResponseBody:!1,networkRequestHeaders:!1,networkRequestBody:!1,networkErrorOnHttp5xx:!1,networkErrorOnHttp4xx:!1,networkErrorOnHttp0:!1,log:!0,dom:!0,navigation:!0,connectivity:!0,contentSecurityPolicy:!0,errorOnContentSecurityPolicy:!1};function u(t,e){for(var r;t[e].length;)(r=t[e].shift())[0][r[1]]=r[2]}function h(t,e,r,n,o){this.options=t;var a=t.autoInstrument;!1===t.enabled||!1===a?this.autoInstrument={}:(i.isType(a,"object")||(a=c),this.autoInstrument=i.merge(c,a)),this.scrubTelemetryInputs=!!t.scrubTelemetryInputs,this.telemetryScrubber=t.telemetryScrubber,this.defaultValueScrubber=function(t){for(var e=[],r=0;r<t.length;++r)e.push(new RegExp(t[r],"i"));return function(t){var r=function(t){if(!t||!t.attributes)return null;for(var e=t.attributes,r=0;r<e.length;++r)if("name"===e[r].key)return e[r].value;return null}(t);if(!r)return!1;for(var i=0;i<e.length;++i)if(e[i].test(r))return!0;return!1}}(t.scrubFields),this.telemeter=e,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this._window=n||{},this._document=o||{},this.replacements={network:[],log:[],navigation:[],connectivity:[]},this.eventRemovers={dom:[],connectivity:[],contentsecuritypolicy:[]},this._location=this._window.location,this._lastHref=this._location&&this._location.href}function d(t){return"undefined"!=typeof URL&&t instanceof URL}h.prototype.configure=function(t){this.options=i.merge(this.options,t);var e=t.autoInstrument,r=i.merge(this.autoInstrument);!1===t.enabled||!1===e?this.autoInstrument={}:(i.isType(e,"object")||(e=c),this.autoInstrument=i.merge(c,e)),this.instrument(r),void 0!==t.scrubTelemetryInputs&&(this.scrubTelemetryInputs=!!t.scrubTelemetryInputs),void 0!==t.telemetryScrubber&&(this.telemetryScrubber=t.telemetryScrubber)},h.prototype.instrument=function(t){!this.autoInstrument.network||t&&t.network?!this.autoInstrument.network&&t&&t.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||t&&t.log?!this.autoInstrument.log&&t&&t.log&&this.deinstrumentConsole():this.instrumentConsole(),!this.autoInstrument.dom||t&&t.dom?!this.autoInstrument.dom&&t&&t.dom&&this.deinstrumentDom():this.instrumentDom(),!this.autoInstrument.navigation||t&&t.navigation?!this.autoInstrument.navigation&&t&&t.navigation&&this.deinstrumentNavigation():this.instrumentNavigation(),!this.autoInstrument.connectivity||t&&t.connectivity?!this.autoInstrument.connectivity&&t&&t.connectivity&&this.deinstrumentConnectivity():this.instrumentConnectivity(),!this.autoInstrument.contentSecurityPolicy||t&&t.contentSecurityPolicy?!this.autoInstrument.contentSecurityPolicy&&t&&t.contentSecurityPolicy&&this.deinstrumentContentSecurityPolicy():this.instrumentContentSecurityPolicy()},h.prototype.deinstrumentNetwork=function(){u(this.replacements,"network")},h.prototype.instrumentNetwork=function(){var t=this;function e(e,r){e in r&&i.isFunction(r[e])&&o(r,e,(function(e){return t.rollbar.wrap(e)}))}if("XMLHttpRequest"in this._window){var r=this._window.XMLHttpRequest.prototype;o(r,"open",(function(t){return function(e,r){var n=d(r);return(i.isType(r,"string")||n)&&(r=n?r.toString():r,this.__rollbar_xhr?(this.__rollbar_xhr.method=e,this.__rollbar_xhr.url=r,this.__rollbar_xhr.status_code=null,this.__rollbar_xhr.start_time_ms=i.now(),this.__rollbar_xhr.end_time_ms=null):this.__rollbar_xhr={method:e,url:r,status_code:null,start_time_ms:i.now(),end_time_ms:null}),t.apply(this,arguments)}}),this.replacements,"network"),o(r,"setRequestHeader",(function(e){return function(r,n){return this.__rollbar_xhr||(this.__rollbar_xhr={}),i.isType(r,"string")&&i.isType(n,"string")&&(t.autoInstrument.networkRequestHeaders&&(this.__rollbar_xhr.request_headers||(this.__rollbar_xhr.request_headers={}),this.__rollbar_xhr.request_headers[r]=n),"content-type"===r.toLowerCase()&&(this.__rollbar_xhr.request_content_type=n)),e.apply(this,arguments)}}),this.replacements,"network"),o(r,"send",(function(r){return function(n){var a=this;function s(){if(a.__rollbar_xhr&&(null===a.__rollbar_xhr.status_code&&(a.__rollbar_xhr.status_code=0,t.autoInstrument.networkRequestBody&&(a.__rollbar_xhr.request=n),a.__rollbar_event=t.captureNetwork(a.__rollbar_xhr,"xhr",void 0)),a.readyState<2&&(a.__rollbar_xhr.start_time_ms=i.now()),a.readyState>3)){a.__rollbar_xhr.end_time_ms=i.now();var e=null;if(a.__rollbar_xhr.response_content_type=a.getResponseHeader("Content-Type"),t.autoInstrument.networkResponseHeaders){var r=t.autoInstrument.networkResponseHeaders;e={};try{var o,s;if(!0===r){var l=a.getAllResponseHeaders();if(l){var c,u,h=l.trim().split(/[\r\n]+/);for(s=0;s<h.length;s++)o=(c=h[s].split(": ")).shift(),u=c.join(": "),e[o]=u}}else for(s=0;s<r.length;s++)e[o=r[s]]=a.getResponseHeader(o)}catch(t){}}var d=null;if(t.autoInstrument.networkResponseBody)try{d=a.responseText}catch(t){}var p=null;(d||e)&&(p={},d&&(t.isJsonContentType(a.__rollbar_xhr.response_content_type)?p.body=t.scrubJson(d):p.body=d),e&&(p.headers=e)),p&&(a.__rollbar_xhr.response=p);try{var f=a.status;f=1223===f?204:f,a.__rollbar_xhr.status_code=f,a.__rollbar_event.level=t.telemeter.levelFromStatus(f),t.errorOnHttpStatus(a.__rollbar_xhr)}catch(t){}}}return e("onload",a),e("onerror",a),e("onprogress",a),"onreadystatechange"in a&&i.isFunction(a.onreadystatechange)?o(a,"onreadystatechange",(function(e){return t.rollbar.wrap(e,void 0,s)})):a.onreadystatechange=s,a.__rollbar_xhr&&t.trackHttpErrors()&&(a.__rollbar_xhr.stack=(new Error).stack),r.apply(this,arguments)}}),this.replacements,"network")}"fetch"in this._window&&o(this._window,"fetch",(function(e){return function(r,o){for(var a=new Array(arguments.length),s=0,l=a.length;s<l;s++)a[s]=arguments[s];var c,u=a[0],h="GET",p=d(u);i.isType(u,"string")||p?c=p?u.toString():u:u&&(c=u.url,u.method&&(h=u.method)),a[1]&&a[1].method&&(h=a[1].method);var f={method:h,url:c,status_code:null,start_time_ms:i.now(),end_time_ms:null};if(a[1]&&a[1].headers){var m=n(a[1].headers);f.request_content_type=m.get("Content-Type"),t.autoInstrument.networkRequestHeaders&&(f.request_headers=t.fetchHeaders(m,t.autoInstrument.networkRequestHeaders))}return t.autoInstrument.networkRequestBody&&(a[1]&&a[1].body?f.request=a[1].body:a[0]&&!i.isType(a[0],"string")&&a[0].body&&(f.request=a[0].body)),t.captureNetwork(f,"fetch",void 0),t.trackHttpErrors()&&(f.stack=(new Error).stack),e.apply(this,a).then((function(e){f.end_time_ms=i.now(),f.status_code=e.status,f.response_content_type=e.headers.get("Content-Type");var r=null;t.autoInstrument.networkResponseHeaders&&(r=t.fetchHeaders(e.headers,t.autoInstrument.networkResponseHeaders));var n=null;return t.autoInstrument.networkResponseBody&&"function"==typeof e.text&&(n=e.clone().text()),(r||n)&&(f.response={},n&&("function"==typeof n.then?n.then((function(e){e&&t.isJsonContentType(f.response_content_type)?f.response.body=t.scrubJson(e):f.response.body=e})):f.response.body=n),r&&(f.response.headers=r)),t.errorOnHttpStatus(f),e}))}}),this.replacements,"network")},h.prototype.captureNetwork=function(t,e,r){return t.request&&this.isJsonContentType(t.request_content_type)&&(t.request=this.scrubJson(t.request)),this.telemeter.captureNetwork(t,e,r)},h.prototype.isJsonContentType=function(t){return!!(t&&i.isType(t,"string")&&t.toLowerCase().includes("json"))},h.prototype.scrubJson=function(t){return JSON.stringify(a(JSON.parse(t),this.options.scrubFields))},h.prototype.fetchHeaders=function(t,e){var r={};try{var i;if(!0===e){if("function"==typeof t.entries)for(var n=t.entries(),o=n.next();!o.done;)r[o.value[0]]=o.value[1],o=n.next()}else for(i=0;i<e.length;i++){var a=e[i];r[a]=t.get(a)}}catch(t){}return r},h.prototype.trackHttpErrors=function(){return this.autoInstrument.networkErrorOnHttp5xx||this.autoInstrument.networkErrorOnHttp4xx||this.autoInstrument.networkErrorOnHttp0},h.prototype.errorOnHttpStatus=function(t){var e=t.status_code;if(e>=500&&this.autoInstrument.networkErrorOnHttp5xx||e>=400&&this.autoInstrument.networkErrorOnHttp4xx||0===e&&this.autoInstrument.networkErrorOnHttp0){var r=new Error("HTTP request failed with Status "+e);r.stack=t.stack,this.rollbar.error(r,{skipFrames:1})}},h.prototype.deinstrumentConsole=function(){if("console"in this._window&&this._window.console.log)for(var t;this.replacements.log.length;)t=this.replacements.log.shift(),this._window.console[t[0]]=t[1]},h.prototype.instrumentConsole=function(){if("console"in this._window&&this._window.console.log){var t=this,e=this._window.console,r=["debug","info","warn","error","log"];try{for(var n=0,o=r.length;n<o;n++)a(r[n])}catch(t){this.diagnostic.instrumentConsole={error:t.message}}}function a(r){var n=e[r],o=e,a="warn"===r?"warning":r;e[r]=function(){var e=Array.prototype.slice.call(arguments),r=i.formatArgsAsString(e);t.telemeter.captureLog(r,a),n&&Function.prototype.apply.call(n,o,e)},t.replacements.log.push([r,n])}},h.prototype.deinstrumentDom=function(){("addEventListener"in this._window||"attachEvent"in this._window)&&this.removeListeners("dom")},h.prototype.instrumentDom=function(){if("addEventListener"in this._window||"attachEvent"in this._window){var t=this.handleClick.bind(this),e=this.handleBlur.bind(this);this.addListener("dom",this._window,"click","onclick",t,!0),this.addListener("dom",this._window,"blur","onfocusout",e,!0)}},h.prototype.handleClick=function(t){try{var e=l.getElementFromEvent(t,this._document),r=e&&e.tagName,i=l.isDescribedElement(e,"a")||l.isDescribedElement(e,"button");r&&(i||l.isDescribedElement(e,"input",["button","submit"]))?this.captureDomEvent("click",e):l.isDescribedElement(e,"input",["checkbox","radio"])&&this.captureDomEvent("input",e,e.value,e.checked)}catch(t){}},h.prototype.handleBlur=function(t){try{var e=l.getElementFromEvent(t,this._document);e&&e.tagName&&(l.isDescribedElement(e,"textarea")?this.captureDomEvent("input",e,e.value):l.isDescribedElement(e,"select")&&e.options&&e.options.length?this.handleSelectInputChanged(e):l.isDescribedElement(e,"input")&&!l.isDescribedElement(e,"input",["button","submit","hidden","checkbox","radio"])&&this.captureDomEvent("input",e,e.value))}catch(t){}},h.prototype.handleSelectInputChanged=function(t){if(t.multiple)for(var e=0;e<t.options.length;e++)t.options[e].selected&&this.captureDomEvent("input",t,t.options[e].value);else t.selectedIndex>=0&&t.options[t.selectedIndex]&&this.captureDomEvent("input",t,t.options[t.selectedIndex].value)},h.prototype.captureDomEvent=function(t,e,r,i){if(void 0!==r)if(this.scrubTelemetryInputs||"password"===l.getElementType(e))r="[scrubbed]";else{var n=l.describeElement(e);this.telemetryScrubber?this.telemetryScrubber(n)&&(r="[scrubbed]"):this.defaultValueScrubber(n)&&(r="[scrubbed]")}var o=l.elementArrayToString(l.treeToArray(e));this.telemeter.captureDom(t,o,r,i)},h.prototype.deinstrumentNavigation=function(){var t=this._window.chrome;!(t&&t.app&&t.app.runtime)&&this._window.history&&this._window.history.pushState&&u(this.replacements,"navigation")},h.prototype.instrumentNavigation=function(){var t=this._window.chrome;if(!(t&&t.app&&t.app.runtime)&&this._window.history&&this._window.history.pushState){var e=this;o(this._window,"onpopstate",(function(t){return function(){var r=e._location.href;e.handleUrlChange(e._lastHref,r),t&&t.apply(this,arguments)}}),this.replacements,"navigation"),o(this._window.history,"pushState",(function(t){return function(){var r=arguments.length>2?arguments[2]:void 0;return r&&e.handleUrlChange(e._lastHref,r+""),t.apply(this,arguments)}}),this.replacements,"navigation")}},h.prototype.handleUrlChange=function(t,e){var r=s.parse(this._location.href),i=s.parse(e),n=s.parse(t);this._lastHref=e,r.protocol===i.protocol&&r.host===i.host&&(e=i.path+(i.hash||"")),r.protocol===n.protocol&&r.host===n.host&&(t=n.path+(n.hash||"")),this.telemeter.captureNavigation(t,e)},h.prototype.deinstrumentConnectivity=function(){("addEventListener"in this._window||"body"in this._document)&&(this._window.addEventListener?this.removeListeners("connectivity"):u(this.replacements,"connectivity"))},h.prototype.instrumentConnectivity=function(){if("addEventListener"in this._window||"body"in this._document)if(this._window.addEventListener)this.addListener("connectivity",this._window,"online",void 0,function(){this.telemeter.captureConnectivityChange("online")}.bind(this),!0),this.addListener("connectivity",this._window,"offline",void 0,function(){this.telemeter.captureConnectivityChange("offline")}.bind(this),!0);else{var t=this;o(this._document.body,"ononline",(function(e){return function(){t.telemeter.captureConnectivityChange("online"),e&&e.apply(this,arguments)}}),this.replacements,"connectivity"),o(this._document.body,"onoffline",(function(e){return function(){t.telemeter.captureConnectivityChange("offline"),e&&e.apply(this,arguments)}}),this.replacements,"connectivity")}},h.prototype.handleCspEvent=function(t){var e="Security Policy Violation: blockedURI: "+t.blockedURI+", violatedDirective: "+t.violatedDirective+", effectiveDirective: "+t.effectiveDirective+", ";t.sourceFile&&(e+="location: "+t.sourceFile+", line: "+t.lineNumber+", col: "+t.columnNumber+", "),e+="originalPolicy: "+t.originalPolicy,this.telemeter.captureLog(e,"error"),this.handleCspError(e)},h.prototype.handleCspError=function(t){this.autoInstrument.errorOnContentSecurityPolicy&&this.rollbar.error(t)},h.prototype.deinstrumentContentSecurityPolicy=function(){"addEventListener"in this._document&&this.removeListeners("contentsecuritypolicy")},h.prototype.instrumentContentSecurityPolicy=function(){if("addEventListener"in this._document){var t=this.handleCspEvent.bind(this);this.addListener("contentsecuritypolicy",this._document,"securitypolicyviolation",null,t,!1)}},h.prototype.addListener=function(t,e,r,i,n,o){e.addEventListener?(e.addEventListener(r,n,o),this.eventRemovers[t].push((function(){e.removeEventListener(r,n,o)}))):i&&(e.attachEvent(i,n),this.eventRemovers[t].push((function(){e.detachEvent(i,n)})))},h.prototype.removeListeners=function(t){for(;this.eventRemovers[t].length;)this.eventRemovers[t].shift()()},t.exports=h},860:(t,e,r)=>{var i=r(702),n=r(303),o=r(802);function a(t,e,r){var n=t.message,o=t.custom;n||(n="Item sent with null or missing arguments.");var a={body:n};o&&(a.extra=i.merge(o)),i.set(t,"data.body",{message:a}),r(null,t)}function s(t){var e=t.stackInfo.stack;return e&&0===e.length&&t._unhandledStackInfo&&t._unhandledStackInfo.stack&&(e=t._unhandledStackInfo.stack),e}function l(t,e,r){var o=t&&t.data.description,a=t&&t.custom,l=s(t),u=n.guessErrorClass(e.message),h={exception:{class:c(e,u[0],r),message:u[1]}};if(o&&(h.exception.description=o),l){var d,p,f,m,g,_,y,v;for(0===l.length&&(h.exception.stack=e.rawStack,h.exception.raw=String(e.rawException)),h.frames=[],y=0;y<l.length;++y)p={filename:(d=l[y]).url?i.sanitizeUrl(d.url):"(unknown)",lineno:d.line||null,method:d.func&&"?"!==d.func?d.func:"[anonymous]",colno:d.column},r.sendFrameUrl&&(p.url=d.url),p.method&&p.method.endsWith&&p.method.endsWith("_rollbar_wrapped")||(f=m=g=null,(_=d.context?d.context.length:0)&&(v=Math.floor(_/2),m=d.context.slice(0,v),f=d.context[v],g=d.context.slice(v)),f&&(p.code=f),(m||g)&&(p.context={},m&&m.length&&(p.context.pre=m),g&&g.length&&(p.context.post=g)),d.args&&(p.args=d.args),h.frames.push(p));h.frames.reverse(),a&&(h.extra=i.merge(a))}return h}function c(t,e,r){return t.name?t.name:r.guessErrorClass?e:"(unknown)"}t.exports={handleDomException:function(t,e,r){if(t.err&&"DOMException"===n.Stack(t.err).name){var i=new Error;i.name=t.err.name,i.message=t.err.message,i.stack=t.err.stack,i.nested=t.err,t.err=i}r(null,t)},handleItemWithError:function(t,e,r){if(t.data=t.data||{},t.err)try{t.stackInfo=t.err._savedStackTrace||n.parse(t.err,t.skipFrames),e.addErrorContext&&function(t){var e=[],r=t.err;for(e.push(r);r.nested||r.cause;)r=r.nested||r.cause,e.push(r);i.addErrorContext(t,e)}(t)}catch(e){o.error("Error while parsing the error object.",e);try{t.message=t.err.message||t.err.description||t.message||String(t.err)}catch(e){t.message=String(t.err)||String(e)}delete t.err}r(null,t)},ensureItemHasSomethingToSay:function(t,e,r){t.message||t.stackInfo||t.custom||r(new Error("No message, stack info, or custom data"),null),r(null,t)},addBaseInfo:function(t,e,r){var n=e.payload&&e.payload.environment||e.environment;t.data=i.merge(t.data,{environment:n,level:t.level,endpoint:e.endpoint,platform:"browser",framework:"browser-js",language:"javascript",server:{},uuid:t.uuid,notifier:{name:"rollbar-browser-js",version:e.version},custom:t.custom}),r(null,t)},addRequestInfo:function(t){return function(e,r,n){var o={};t&&t.location&&(o.url=t.location.href,o.query_string=t.location.search);var a="$remote_ip";r.captureIp?!0!==r.captureIp&&(a+="_anonymize"):a=null,a&&(o.user_ip=a),Object.keys(o).length>0&&i.set(e,"data.request",o),n(null,e)}},addClientInfo:function(t){return function(e,r,n){if(!t)return n(null,e);var o=t.navigator||{},a=t.screen||{};i.set(e,"data.client",{runtime_ms:e.timestamp-t._rollbarStartTime,timestamp:Math.round(e.timestamp/1e3),javascript:{browser:o.userAgent,language:o.language,cookie_enabled:o.cookieEnabled,screen:{width:a.width,height:a.height}}}),n(null,e)}},addPluginInfo:function(t){return function(e,r,n){if(!t||!t.navigator)return n(null,e);for(var o,a=[],s=t.navigator.plugins||[],l=0,c=s.length;l<c;++l)o=s[l],a.push({name:o.name,description:o.description});i.set(e,"data.client.javascript.plugins",a),n(null,e)}},addBody:function(t,e,r){t.stackInfo?t.stackInfo.traceChain?function(t,e,r){for(var n=t.stackInfo.traceChain,o=[],a=n.length,s=0;s<a;s++){var c=l(t,n[s],e);o.push(c)}i.set(t,"data.body",{trace_chain:o}),r(null,t)}(t,e,r):function(t,e,r){if(s(t)){var o=l(t,t.stackInfo,e);i.set(t,"data.body",{trace:o}),r(null,t)}else{var u=t.stackInfo,h=n.guessErrorClass(u.message),d=c(u,h[0],e),p=h[1];t.message=d+": "+p,a(t,0,r)}}(t,e,r):a(t,0,r)},addScrubber:function(t){return function(e,r,i){if(t){var n=r.scrubFields||[],o=r.scrubPaths||[];e.data=t(e.data,n,o)}i(null,e)}}}},477:(t,e,r)=>{var i=r(702),n=r(656),o=r(86);function a(t){this.truncation=t}a.prototype.get=function(t,e,r,n,o){n&&i.isFunction(n)||(n=function(){}),i.addParamsAndAccessTokenToPath(t,e,r);var a=i.formatUrl(e);this._makeZoneRequest(t,a,"GET",null,n,o,e.timeout,e.transport)},a.prototype.post=function(t,e,r,n,o){if(n&&i.isFunction(n)||(n=function(){}),!r)return n(new Error("Cannot send empty request"));var a;if((a=this.truncation?this.truncation.truncate(r):i.stringify(r)).error)return n(a.error);var s=a.value,l=i.formatUrl(e);this._makeZoneRequest(t,l,"POST",s,n,o,e.timeout,e.transport)},a.prototype.postJsonPayload=function(t,e,r,n,o){n&&i.isFunction(n)||(n=function(){});var a=i.formatUrl(e);this._makeZoneRequest(t,a,"POST",r,n,o,e.timeout,e.transport)},a.prototype._makeZoneRequest=function(){var t="undefined"!=typeof window&&window||void 0!==n&&n,e=t&&t.Zone&&t.Zone.current,r=Array.prototype.slice.call(arguments);if(e&&"angular"===e._name){var i=e._parent,n=this;i.run((function(){n._makeRequest.apply(void 0,r)}))}else this._makeRequest.apply(void 0,r)},a.prototype._makeRequest=function(t,e,r,i,a,s,l,c){if("undefined"!=typeof RollbarProxy)return function(t,e){(new RollbarProxy).sendJsonPayload(t,(function(t){}),(function(t){e(new Error(t))}))}(i,a);"fetch"===c?n(t,e,r,i,a,l):o(t,e,r,i,a,s,l)},t.exports=a},656:(t,e,r)=>{var i=r(802),n=r(702);t.exports=function(t,e,r,o,a,s){var l,c;n.isFiniteNumber(s)&&(l=new AbortController,c=setTimeout((function(){l.abort()}),s)),fetch(e,{method:r,headers:{"Content-Type":"application/json","X-Rollbar-Access-Token":t,signal:l&&l.signal},body:o}).then((function(t){return c&&clearTimeout(c),t.json()})).then((function(t){a(null,t)})).catch((function(t){i.error(t.message),a(t)}))}},86:(t,e,r)=>{var i=r(702),n=r(802);function o(t,e){var r=new Error(t);return r.code=e||"ENOTFOUND",r}t.exports=function(t,e,r,a,s,l,c){var u;if(!(u=l?l():function(){var t,e,r=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],i=r.length;for(e=0;e<i;e++)try{t=r[e]();break}catch(t){}return t}()))return s(new Error("No way to send a request"));try{try{var h=function(){try{if(h&&4===u.readyState){h=void 0;var t=i.jsonParse(u.responseText);if((a=u)&&a.status&&200===a.status)return void s(t.error,t.value);if(function(t){return t&&i.isType(t.status,"number")&&t.status>=400&&t.status<600}(u)){if(403===u.status){var e=t.value&&t.value.message;n.error(e)}s(new Error(String(u.status)))}else s(o("XHR response had no status code (likely connection failure)"))}}catch(t){var r;r=t&&t.stack?t:new Error(t),s(r)}var a};u.open(r,e,!0),u.setRequestHeader&&(u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("X-Rollbar-Access-Token",t)),i.isFiniteNumber(c)&&(u.timeout=c),u.onreadystatechange=h,u.send(a)}catch(t){if("undefined"!=typeof XDomainRequest){if(!window||!window.location)return s(new Error("No window available during request, unknown environment"));"http:"===window.location.href.substring(0,5)&&"https"===e.substring(0,5)&&(e="http"+e.substring(5));var d=new XDomainRequest;d.onprogress=function(){},d.ontimeout=function(){s(o("Request timed out","ETIMEDOUT"))},d.onerror=function(){s(new Error("Error during request"))},d.onload=function(){var t=i.jsonParse(d.responseText);s(t.error,t.value)},d.open(r,e,!0),d.send(a)}else s(new Error("Cannot find a method to transport a request"))}}catch(t){s(t)}}},509:t=>{t.exports={parse:function(t){var e,r,i={protocol:null,auth:null,host:null,path:null,hash:null,href:t,hostname:null,port:null,pathname:null,search:null,query:null};if(-1!==(e=t.indexOf("//"))?(i.protocol=t.substring(0,e),r=e+2):r=0,-1!==(e=t.indexOf("@",r))&&(i.auth=t.substring(r,e),r=e+1),-1===(e=t.indexOf("/",r))){if(-1===(e=t.indexOf("?",r)))return-1===(e=t.indexOf("#",r))?i.host=t.substring(r):(i.host=t.substring(r,e),i.hash=t.substring(e)),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),i;i.host=t.substring(r,e),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=e}else i.host=t.substring(r,e),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=e;if(-1===(e=t.indexOf("#",r))?i.path=t.substring(r):(i.path=t.substring(r,e),i.hash=t.substring(e)),i.path){var n=i.path.split("?");i.pathname=n[0],i.query=n[1],i.search=i.query?"?"+i.query:null}return i}}},965:t=>{function e(t,e,r){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var i=e.addEventListener;i._rollbarOldAdd&&i.belongsToShim;)i=i._rollbarOldAdd;var n=function(e,r,n){i.call(this,e,t.wrap(r),n)};n._rollbarOldAdd=i,n.belongsToShim=r,e.addEventListener=n;for(var o=e.removeEventListener;o._rollbarOldRemove&&o.belongsToShim;)o=o._rollbarOldRemove;var a=function(t,e,r){o.call(this,t,e&&e._rollbar_wrapped||e,r)};a._rollbarOldRemove=o,a.belongsToShim=r,e.removeEventListener=a}}t.exports=function(t,r,i){if(t){var n,o,a="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(n=0;n<a.length;++n)t[o=a[n]]&&t[o].prototype&&e(r,t[o].prototype,i)}}},948:t=>{t.exports={version:"2.26.4",endpoint:"api.rollbar.com/api/1/item/",logLevel:"debug",reportLevel:"debug",uncaughtErrorLevel:"error",maxItems:0,itemsPerMin:60}},303:(t,e,r)=>{var i=r(180),n=new RegExp("^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ");function o(t){var e={};return e._stackFrame=t,e.url=t.fileName,e.line=t.lineNumber,e.func=t.functionName,e.column=t.columnNumber,e.args=t.args,e.context=null,e}function a(t,e){return{stack:function(){var r=[];e=e||0;try{r=i.parse(t)}catch(t){r=[]}for(var n=[],a=e;a<r.length;a++)n.push(new o(r[a]));return n}(),message:t.message,name:(r=t,n=r.name&&r.name.length&&r.name,a=r.constructor.name&&r.constructor.name.length&&r.constructor.name,n&&a?"Error"===n?a:n:n||a),rawStack:t.stack,rawException:t};var r,n,a}t.exports={guessFunctionName:function(){return"?"},guessErrorClass:function(t){if(!t||!t.match)return["Unknown error. There was no error message to display.",""];var e=t.match(n),r="(unknown)";return e&&(r=e[e.length-1],t=(t=t.replace((e[e.length-2]||"")+r+":","")).replace(/(^[\s]+|[\s]+$)/g,"")),[r,t]},gatherContext:function(){return null},parse:function(t,e){var r=t;if(r.nested||r.cause){for(var i=[];r;)i.push(new a(r,e)),r=r.nested||r.cause,e=0;return i[0].traceChain=i,i[0]}return new a(r,e)},Stack:a,Frame:o}},420:t=>{var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var i,n=e.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(i in t);return void 0===i||e.call(t,i)};t.exports=function t(){var e,r,n,o,a,s={},l=null,c=arguments.length;for(e=0;e<c;e++)if(null!=(l=arguments[e]))for(a in l)r=s[a],s!==(n=l[a])&&(n&&i(n)?(o=r&&i(r)?r:{},s[a]=t(o,n)):void 0!==n&&(s[a]=n));return s}},314:(t,e,r)=>{var i=r(702);function n(t,e){this.queue=t,this.options=e,this.transforms=[],this.diagnostic={}}n.prototype.configure=function(t){this.queue&&this.queue.configure(t);var e=this.options;return this.options=i.merge(e,t),this},n.prototype.addTransform=function(t){return i.isFunction(t)&&this.transforms.push(t),this},n.prototype.log=function(t,e){if(e&&i.isFunction(e)||(e=function(){}),!this.options.enabled)return e(new Error("Rollbar is not enabled"));this.queue.addPendingItem(t);var r=t.err;this._applyTransforms(t,function(i,n){if(i)return this.queue.removePendingItem(t),e(i,null);this.queue.addItem(n,e,r,t)}.bind(this))},n.prototype._applyTransforms=function(t,e){var r=-1,i=this.transforms.length,n=this.transforms,o=this.options,a=function(t,s){t?e(t,null):++r!==i?n[r](s,o,a):e(null,s)};a(null,t)},t.exports=n},61:(t,e,r)=>{var i=r(702);function n(t,e,r){if(!t)return!r;var n,o,a=t.frames;if(!a||0===a.length)return!r;for(var s=e.length,l=a.length,c=0;c<l;c++){if(n=a[c].filename,!i.isType(n,"string"))return!r;for(var u=0;u<s;u++)if(o=e[u],new RegExp(o).test(n))return!0}return!1}function o(t,e,r,o){var a,s,l=!1;"blocklist"===r&&(l=!0);try{if(a=l?e.hostBlockList:e.hostSafeList,s=i.get(t,"body.trace_chain")||[i.get(t,"body.trace")],!a||0===a.length)return!l;if(0===s.length||!s[0])return!l;for(var c=s.length,u=0;u<c;u++)if(n(s[u],a,l))return!0}catch(t){l?e.hostBlockList=null:e.hostSafeList=null;var h=l?"hostBlockList":"hostSafeList";return o.error("Error while reading your configuration's "+h+" option. Removing custom "+h+".",t),!l}return!1}t.exports={checkLevel:function(t,e){var r=t.level,n=i.LEVELS[r]||0,o=e.reportLevel;return!(n<(i.LEVELS[o]||0))},userCheckIgnore:function(t){return function(e,r){var n=!!e._isUncaught;delete e._isUncaught;var o=e._originalArgs;delete e._originalArgs;try{i.isFunction(r.onSendCallback)&&r.onSendCallback(n,o,e)}catch(e){r.onSendCallback=null,t.error("Error while calling onSendCallback, removing",e)}try{if(i.isFunction(r.checkIgnore)&&r.checkIgnore(n,o,e))return!1}catch(e){r.checkIgnore=null,t.error("Error while calling custom checkIgnore(), removing",e)}return!0}},urlIsNotBlockListed:function(t){return function(e,r){return!o(e,r,"blocklist",t)}},urlIsSafeListed:function(t){return function(e,r){return o(e,r,"safelist",t)}},messageIsIgnored:function(t){return function(e,r){var n,o,a,s,l,c;try{if(!(a=r.ignoredMessages)||0===a.length)return!0;if(c=function(t){var e=t.body,r=[];if(e.trace_chain)for(var n=e.trace_chain,o=0;o<n.length;o++){var a=n[o];r.push(i.get(a,"exception.message"))}return e.trace&&r.push(i.get(e,"trace.exception.message")),e.message&&r.push(i.get(e,"message.body")),r}(e),0===c.length)return!0;for(s=a.length,n=0;n<s;n++)for(l=new RegExp(a[n],"gi"),o=0;o<c.length;o++)if(l.test(c[o]))return!1}catch(e){r.ignoredMessages=null,t.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}}},358:(t,e,r)=>{var i=r(702);function n(t,e,r,i){this.rateLimiter=t,this.api=e,this.logger=r,this.options=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}n.prototype.configure=function(t){this.api&&this.api.configure(t);var e=this.options;return this.options=i.merge(e,t),this},n.prototype.addPredicate=function(t){return i.isFunction(t)&&this.predicates.push(t),this},n.prototype.addPendingItem=function(t){this.pendingItems.push(t)},n.prototype.removePendingItem=function(t){var e=this.pendingItems.indexOf(t);-1!==e&&this.pendingItems.splice(e,1)},n.prototype.addItem=function(t,e,r,n){e&&i.isFunction(e)||(e=function(){});var o=this._applyPredicates(t);if(o.stop)return this.removePendingItem(n),void e(o.err);if(this._maybeLog(t,r),this.removePendingItem(n),this.options.transmit){this.pendingRequests.push(t);try{this._makeApiRequest(t,function(r,i){this._dequeuePendingRequest(t),e(r,i)}.bind(this))}catch(r){this._dequeuePendingRequest(t),e(r)}}else e(new Error("Transmit disabled"))},n.prototype.wait=function(t){i.isFunction(t)&&(this.waitCallback=t,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){this._maybeCallWait()}.bind(this),500)))},n.prototype._applyPredicates=function(t){for(var e=null,r=0,i=this.predicates.length;r<i;r++)if(!(e=this.predicates[r](t,this.options))||void 0!==e.err)return{stop:!0,err:e.err};return{stop:!1,err:null}},n.prototype._makeApiRequest=function(t,e){var r=this.rateLimiter.shouldSend(t);r.shouldSend?this.api.postItem(t,function(r,i){r?this._maybeRetry(r,t,e):e(r,i)}.bind(this)):r.error?e(r.error):this.api.postItem(r.payload,e)};var o=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"];n.prototype._maybeRetry=function(t,e,r){var n=!1;if(this.options.retryInterval){for(var a=0,s=o.length;a<s;a++)if(t.code===o[a]){n=!0;break}n&&i.isFiniteNumber(this.options.maxRetries)&&(e.retries=e.retries?e.retries+1:1,e.retries>this.options.maxRetries&&(n=!1))}n?this._retryApiRequest(e,r):r(t)},n.prototype._retryApiRequest=function(t,e){this.retryQueue.push({item:t,callback:e}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;this.retryQueue.length;){var t=this.retryQueue.shift();this._makeApiRequest(t.item,t.callback)}}.bind(this),this.options.retryInterval))},n.prototype._dequeuePendingRequest=function(t){var e=this.pendingRequests.indexOf(t);-1!==e&&(this.pendingRequests.splice(e,1),this._maybeCallWait())},n.prototype._maybeLog=function(t,e){if(this.logger&&this.options.verbose){var r=e;if(r=(r=r||i.get(t,"body.trace.exception.message"))||i.get(t,"body.trace_chain.0.exception.message"))return void this.logger.error(r);(r=i.get(t,"body.message.body"))&&this.logger.log(r)}},n.prototype._maybeCallWait=function(){return!(!i.isFunction(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))},t.exports=n},790:(t,e,r)=>{var i=r(702);function n(t){this.startTime=i.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(t)}function o(t,e,r){return!t.ignoreRateLimit&&e>=1&&r>e}function a(t,e,r,i,n,o,a){var s=null;return r&&(r=new Error(r)),r||i||(s=function(t,e,r,i,n){var o={body:{message:{body:n?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",extra:{maxItems:r,itemsPerMinute:i}}},language:"javascript",environment:e.environment||e.payload&&e.payload.environment,notifier:{version:e.notifier&&e.notifier.version||e.version}};return"browser"===t?(o.platform="browser",o.framework="browser-js",o.notifier.name="rollbar-browser-js"):"server"===t?(o.framework=e.framework||"node-js",o.notifier.name=e.notifier.name):"react-native"===t&&(o.framework=e.framework||"react-native",o.notifier.name=e.notifier.name),o}(t,e,n,o,a)),{error:r,shouldSend:i,payload:s}}n.globalSettings={startTime:i.now(),maxItems:void 0,itemsPerMinute:void 0},n.prototype.configureGlobal=function(t){void 0!==t.startTime&&(n.globalSettings.startTime=t.startTime),void 0!==t.maxItems&&(n.globalSettings.maxItems=t.maxItems),void 0!==t.itemsPerMinute&&(n.globalSettings.itemsPerMinute=t.itemsPerMinute)},n.prototype.shouldSend=function(t,e){var r=(e=e||i.now())-this.startTime;(r<0||r>=6e4)&&(this.startTime=e,this.perMinCounter=0);var s=n.globalSettings.maxItems,l=n.globalSettings.itemsPerMinute;if(o(t,s,this.counter))return a(this.platform,this.platformOptions,s+" max items reached",!1);if(o(t,l,this.perMinCounter))return a(this.platform,this.platformOptions,l+" items per minute reached",!1);this.counter++,this.perMinCounter++;var c=!o(t,s,this.counter),u=c;return c=c&&!o(t,l,this.perMinCounter),a(this.platform,this.platformOptions,null,c,s,l,u)},n.prototype.setPlatformOptions=function(t,e){this.platform=t,this.platformOptions=e},t.exports=n},562:(t,e,r)=>{var i=r(790),n=r(358),o=r(314),a=r(702);function s(t,e,r,i,u){this.options=a.merge(t),this.logger=r,s.rateLimiter.configureGlobal(this.options),s.rateLimiter.setPlatformOptions(u,this.options),this.api=e,this.queue=new n(s.rateLimiter,e,r,this.options);var h=this.options.tracer||null;c(h)?(this.tracer=h,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new o(this.queue,this.options),this.telemeter=i,l(t),this.lastError=null,this.lastErrorHash="none"}function l(t){t.stackTraceLimit&&(Error.stackTraceLimit=t.stackTraceLimit)}function c(t){if(!t)return!1;if(!t.scope||"function"!=typeof t.scope)return!1;var e=t.scope();return!(!e||!e.active||"function"!=typeof e.active)}s.rateLimiter=new i({maxItems:0,itemsPerMinute:60}),s.prototype.global=function(t){return s.rateLimiter.configureGlobal(t),this},s.prototype.configure=function(t,e){var r=this.options,i={};e&&(i={payload:e}),this.options=a.merge(r,t,i);var n=this.options.tracer||null;return c(n)?(this.tracer=n,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),l(t),this.global(this.options),c(t.tracer)&&(this.tracer=t.tracer),this},s.prototype.log=function(t){var e=this._defaultLogLevel();return this._log(e,t)},s.prototype.debug=function(t){this._log("debug",t)},s.prototype.info=function(t){this._log("info",t)},s.prototype.warn=function(t){this._log("warning",t)},s.prototype.warning=function(t){this._log("warning",t)},s.prototype.error=function(t){this._log("error",t)},s.prototype.critical=function(t){this._log("critical",t)},s.prototype.wait=function(t){this.queue.wait(t)},s.prototype.captureEvent=function(t,e,r){return this.telemeter&&this.telemeter.captureEvent(t,e,r)},s.prototype.captureDomContentLoaded=function(t){return this.telemeter&&this.telemeter.captureDomContentLoaded(t)},s.prototype.captureLoad=function(t){return this.telemeter&&this.telemeter.captureLoad(t)},s.prototype.buildJsonPayload=function(t){return this.api.buildJsonPayload(t)},s.prototype.sendJsonPayload=function(t){this.api.postJsonPayload(t)},s.prototype._log=function(t,e){var r;if(e.callback&&(r=e.callback,delete e.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(e)){if(r){var i=new Error("ignored identical item");i.item=e,r(i)}}else try{this._addTracingInfo(e),e.level=e.level||t,this.telemeter&&this.telemeter._captureRollbarItem(e),e.telemetryEvents=this.telemeter&&this.telemeter.copyEvents()||[],this.notifier.log(e,r)}catch(t){r&&r(t),this.logger.error(t)}},s.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},s.prototype._sameAsLastError=function(t){if(!t._isUncaught)return!1;var e=function(t){return(t.message||"")+"::"+((t.err||{}).stack||String(t.err))}(t);return this.lastErrorHash===e||(this.lastError=t.err,this.lastErrorHash=e,!1)},s.prototype._addTracingInfo=function(t){if(this.tracer){var e=this.tracer.scope().active();if(function(t){if(!t||!t.context||"function"!=typeof t.context)return!1;var e=t.context();return!!(e&&e.toSpanId&&e.toTraceId&&"function"==typeof e.toSpanId&&"function"==typeof e.toTraceId)}(e)){e.setTag("rollbar.error_uuid",t.uuid),e.setTag("rollbar.has_error",!0),e.setTag("error",!0),e.setTag("rollbar.item_url",`https://rollbar.com/item/uuid/?uuid=${t.uuid}`),e.setTag("rollbar.occurrence_url",`https://rollbar.com/occurrence/uuid/?uuid=${t.uuid}`);var r=e.context().toSpanId(),i=e.context().toTraceId();t.custom?(t.custom.opentracing_span_id=r,t.custom.opentracing_trace_id=i):t.custom={opentracing_span_id:r,opentracing_trace_id:i}}}},t.exports=s},369:(t,e,r)=>{var i=r(702),n=r(267);function o(t,e){var r=e.split("."),n=r.length-1;try{for(var o=0;o<=n;++o)o<n?t=t[r[o]]:t[r[o]]=i.redact()}catch(t){}}t.exports=function(t,e,r){if(e=e||[],r)for(var a=0;a<r.length;++a)o(t,r[a]);var s=function(t){for(var e,r=[],i=0;i<t.length;++i)e="^\\[?(%5[bB])?"+t[i]+"\\[?(%5[bB])?\\]?(%5[dD])?$",r.push(new RegExp(e,"i"));return r}(e),l=function(t){for(var e,r=[],i=0;i<t.length;++i)e="\\[?(%5[bB])?"+t[i]+"\\[?(%5[bB])?\\]?(%5[dD])?",r.push(new RegExp("("+e+"=)([^&\\n]+)","igm"));return r}(e);function c(t,e){return e+i.redact()}return n(t,(function t(e,r,o){var a=function(t,e){var r;for(r=0;r<s.length;++r)if(s[r].test(t)){e=i.redact();break}return e}(e,r);return a===r?i.isType(r,"object")||i.isType(r,"array")?n(r,t,o):function(t){var e;if(i.isType(t,"string"))for(e=0;e<l.length;++e)t=t.replace(l[e],c);return t}(a):a}))}},773:(t,e,r)=>{var i=r(702),n=100;function o(t){this.queue=[],this.options=i.merge(t);var e=this.options.maxTelemetryEvents||n;this.maxQueueSize=Math.max(0,Math.min(e,n))}function a(t,e){return e||{error:"error",manual:"info"}[t]||"info"}o.prototype.configure=function(t){var e=this.options;this.options=i.merge(e,t);var r=this.options.maxTelemetryEvents||n,o=Math.max(0,Math.min(r,n)),a=0;this.queue.length>o&&(a=this.queue.length-o),this.maxQueueSize=o,this.queue.splice(0,a)},o.prototype.copyEvents=function(){var t=Array.prototype.slice.call(this.queue,0);if(i.isFunction(this.options.filterTelemetry))try{for(var e=t.length;e--;)this.options.filterTelemetry(t[e])&&t.splice(e,1)}catch(t){this.options.filterTelemetry=null}return t},o.prototype.capture=function(t,e,r,n,o){var s={level:a(t,r),type:t,timestamp_ms:o||i.now(),body:e,source:"client"};n&&(s.uuid=n);try{if(i.isFunction(this.options.filterTelemetry)&&this.options.filterTelemetry(s))return!1}catch(t){this.options.filterTelemetry=null}return this.push(s),s},o.prototype.captureEvent=function(t,e,r,i){return this.capture(t,e,r,i)},o.prototype.captureError=function(t,e,r,i){var n={message:t.message||String(t)};return t.stack&&(n.stack=t.stack),this.capture("error",n,e,r,i)},o.prototype.captureLog=function(t,e,r,i){return this.capture("log",{message:t},e,r,i)},o.prototype.captureNetwork=function(t,e,r,i){e=e||"xhr",t.subtype=t.subtype||e,i&&(t.request=i);var n=this.levelFromStatus(t.status_code);return this.capture("network",t,n,r)},o.prototype.levelFromStatus=function(t){return t>=200&&t<400?"info":0===t||t>=400?"error":"info"},o.prototype.captureDom=function(t,e,r,i,n){var o={subtype:t,element:e};return void 0!==r&&(o.value=r),void 0!==i&&(o.checked=i),this.capture("dom",o,"info",n)},o.prototype.captureNavigation=function(t,e,r){return this.capture("navigation",{from:t,to:e},"info",r)},o.prototype.captureDomContentLoaded=function(t){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,t&&t.getTime())},o.prototype.captureLoad=function(t){return this.capture("navigation",{subtype:"load"},"info",void 0,t&&t.getTime())},o.prototype.captureConnectivityChange=function(t,e){return this.captureNetwork({change:t},"connectivity",e)},o.prototype._captureRollbarItem=function(t){if(this.options.includeItemsInTelemetry)return t.err?this.captureError(t.err,t.level,t.uuid,t.timestamp):t.message?this.captureLog(t.message,t.level,t.uuid,t.timestamp):t.custom?this.capture("log",t.custom,t.level,t.uuid,t.timestamp):void 0},o.prototype.push=function(t){this.queue.push(t),this.queue.length>this.maxQueueSize&&this.queue.shift()},t.exports=o},417:(t,e,r)=>{var i=r(702);function n(t,e){i.isFunction(t[e])&&(t[e]=t[e].toString())}t.exports={itemToPayload:function(t,e,r){var i=t.data;t._isUncaught&&(i._isUncaught=!0),t._originalArgs&&(i._originalArgs=t._originalArgs),r(null,i)},addPayloadOptions:function(t,e,r){var n=e.payload||{};n.body&&delete n.body,t.data=i.merge(t.data,n),r(null,t)},addTelemetryData:function(t,e,r){t.telemetryEvents&&i.set(t,"data.body.telemetry",t.telemetryEvents),r(null,t)},addMessageWithError:function(t,e,r){if(t.message){var n="data.body.trace_chain.0",o=i.get(t,n);if(o||(n="data.body.trace",o=i.get(t,n)),o){if(!o.exception||!o.exception.description)return i.set(t,n+".exception.description",t.message),void r(null,t);var a=i.get(t,n+".extra")||{},s=i.merge(a,{message:t.message});i.set(t,n+".extra",s)}r(null,t)}else r(null,t)},userTransform:function(t){return function(e,r,n){var o=i.merge(e),a=null;try{i.isFunction(r.transform)&&(a=r.transform(o.data,e))}catch(i){return r.transform=null,t.error("Error while calling custom transform() function. Removing custom transform().",i),void n(null,e)}i.isPromise(a)?a.then((function(t){t&&(o.data=t),n(null,o)}),(function(t){n(t,e)})):n(null,o)}},addConfigToPayload:function(t,e,r){if(!e.sendConfig)return r(null,t);var n=i.get(t,"data.custom")||{};n._rollbarConfig=e,t.data.custom=n,r(null,t)},addConfiguredOptions:function(t,e,r){var i=e._configuredOptions;n(i,"transform"),n(i,"checkIgnore"),n(i,"onSendCallback"),delete i.accessToken,t.data.notifier.configured_options=i,r(null,t)},addDiagnosticKeys:function(t,e,r){var n=i.merge(t.notifier.client.notifier.diagnostic,t.diagnostic);if(i.get(t,"err._isAnonymous")&&(n.is_anonymous=!0),t._isUncaught&&(n.is_uncaught=t._isUncaught),t.err)try{n.raw_error={message:t.err.message,name:t.err.name,constructor_name:t.err.constructor&&t.err.constructor.name,filename:t.err.fileName,line:t.err.lineNumber,column:t.err.columnNumber,stack:t.err.stack}}catch(t){n.raw_error={failed:String(t)}}t.data.notifier.diagnostic=i.merge(t.data.notifier.diagnostic,n),r(null,t)}}},473:(t,e,r)=>{var i=r(702),n=r(267);function o(t,e){return[t,i.stringify(t,e)]}function a(t,e){var r=t.length;return r>2*e?t.slice(0,e).concat(t.slice(r-e)):t}function s(t,e,r){r=void 0===r?30:r;var n,o=t.data.body;if(o.trace_chain)for(var s=o.trace_chain,l=0;l<s.length;l++)n=a(n=s[l].frames,r),s[l].frames=n;else o.trace&&(n=a(n=o.trace.frames,r),o.trace.frames=n);return[t,i.stringify(t,e)]}function l(t,e){return e&&e.length>t?e.slice(0,t-3).concat("..."):e}function c(t,e,r){return e=n(e,(function e(r,o,a){switch(i.typeName(o)){case"string":return l(t,o);case"object":case"array":return n(o,e,a);default:return o}})),[e,i.stringify(e,r)]}function u(t){return t.exception&&(delete t.exception.description,t.exception.message=l(255,t.exception.message)),t.frames=a(t.frames,1),t}function h(t,e){var r=t.data.body;if(r.trace_chain)for(var n=r.trace_chain,o=0;o<n.length;o++)n[o]=u(n[o]);else r.trace&&(r.trace=u(r.trace));return[t,i.stringify(t,e)]}function d(t,e){return i.maxByteSize(t)>e}t.exports={truncate:function(t,e,r){r=void 0===r?524288:r;for(var i,n,a,l=[o,s,c.bind(null,1024),c.bind(null,512),c.bind(null,256),h];i=l.shift();)if(t=(n=i(t,e))[0],(a=n[1]).error||!d(a.value,r))return a;return a},raw:o,truncateFrames:s,truncateStrings:c,maybeTruncateValue:l}},702:(t,e,r)=>{var i=r(420),n={};function o(t,e){return e===a(t)}function a(t){var e=typeof t;return"object"!==e?e:t?t instanceof Error?"error":{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(t){return o(t,"function")}function l(t){var e=Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),r=RegExp("^"+e+"$");return c(t)&&r.test(t)}function c(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function u(){var t=y();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:7&r|8).toString(16)}))}var h={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function d(t,e){var r,i;try{r=n.stringify(t)}catch(n){if(e&&s(e))try{r=e(t)}catch(t){i=t}else i=n}return{error:i,value:r}}function p(t,e){return function(r,i){try{e(r,i)}catch(e){t.error(e)}}}function f(t){return function t(e,r){var i,n,s,l={};try{for(n in e)(i=e[n])&&(o(i,"object")||o(i,"array"))?r.includes(i)?l[n]="Removed circular reference: "+a(i):((s=r.slice()).push(i),l[n]=t(i,s)):l[n]=i}catch(t){l="Failed cloning custom data: "+t.message}return l}(t,[t])}var m=["log","network","dom","navigation","error","manual"],g=["critical","error","warning","info","debug"];function _(t,e){for(var r=0;r<t.length;++r)if(t[r]===e)return!0;return!1}function y(){return Date.now?+Date.now():+new Date}t.exports={addParamsAndAccessTokenToPath:function(t,e,r){(r=r||{}).access_token=t;var i,n=[];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push([i,r[i]].join("="));var o="?"+n.sort().join("&");(e=e||{}).path=e.path||"";var a,s=e.path.indexOf("?"),l=e.path.indexOf("#");-1!==s&&(-1===l||l>s)?(a=e.path,e.path=a.substring(0,s)+o+"&"+a.substring(s+1)):-1!==l?(a=e.path,e.path=a.substring(0,l)+o+a.substring(l)):e.path=e.path+o},createItem:function(t,e,r,i,n){for(var o,s,l,c,h,d,m=[],g=[],_=0,v=t.length;_<v;++_){var b=a(d=t[_]);switch(g.push(b),b){case"undefined":break;case"string":o?m.push(d):o=d;break;case"function":c=p(e,d);break;case"date":m.push(d);break;case"error":case"domexception":case"exception":s?m.push(d):s=d;break;case"object":case"array":if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}if(i&&"object"===b&&!h){for(var x=0,w=i.length;x<w;++x)if(void 0!==d[i[x]]){h=d;break}if(h)break}l?m.push(d):l=d;break;default:if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}m.push(d)}}l&&(l=f(l)),m.length>0&&(l||(l=f({})),l.extraArgs=f(m));var S={message:o,err:s,custom:l,timestamp:y(),callback:c,notifier:r,diagnostic:{},uuid:u()};return function(t,e){e&&void 0!==e.level&&(t.level=e.level,delete e.level),e&&void 0!==e.skipFrames&&(t.skipFrames=e.skipFrames,delete e.skipFrames)}(S,l),i&&h&&(S.request=h),n&&(S.lambdaContext=n),S._originalArgs=t,S.diagnostic.original_arg_types=g,S},addErrorContext:function(t,e){var r=t.data.custom||{},n=!1;try{for(var o=0;o<e.length;++o)e[o].hasOwnProperty("rollbarContext")&&(r=i(r,f(e[o].rollbarContext)),n=!0);n&&(t.data.custom=r)}catch(e){t.diagnostic.error_context="Failed: "+e.message}},createTelemetryEvent:function(t){for(var e,r,i,n,o=0,s=t.length;o<s;++o)switch(a(n=t[o])){case"string":!e&&_(m,n)?e=n:!i&&_(g,n)&&(i=n);break;case"object":r=n}return{type:e||"manual",metadata:r||{},level:i}},filterIp:function(t,e){if(t&&t.user_ip&&!0!==e){var r=t.user_ip;if(e)try{var i;if(-1!==r.indexOf("."))(i=r.split(".")).pop(),i.push("0"),r=i.join(".");else if(-1!==r.indexOf(":")){if((i=r.split(":")).length>2){var n=i.slice(0,3),o=n[2].indexOf("/");-1!==o&&(n[2]=n[2].substring(0,o)),r=n.concat("0000:0000:0000:0000:0000").join(":")}}else r=null}catch(t){r=null}else r=null;t.user_ip=r}},formatArgsAsString:function(t){var e,r,i,n=[];for(e=0,r=t.length;e<r;++e){switch(a(i=t[e])){case"object":(i=(i=d(i)).error||i.value).length>500&&(i=i.substr(0,497)+"...");break;case"null":i="null";break;case"undefined":i="undefined";break;case"symbol":i=i.toString()}n.push(i)}return n.join(" ")},formatUrl:function(t,e){if(!(e=e||t.protocol)&&t.port&&(80===t.port?e="http:":443===t.port&&(e="https:")),e=e||"https:",!t.hostname)return null;var r=e+"//"+t.hostname;return t.port&&(r=r+":"+t.port),t.path&&(r+=t.path),r},get:function(t,e){if(t){var r=e.split("."),i=t;try{for(var n=0,o=r.length;n<o;++n)i=i[r[n]]}catch(t){i=void 0}return i}},handleOptions:function(t,e,r,n){var o=i(t,e,r);return o=function(t,e){return t.hostWhiteList&&!t.hostSafeList&&(t.hostSafeList=t.hostWhiteList,t.hostWhiteList=void 0,e&&e.log("hostWhiteList is deprecated. Use hostSafeList.")),t.hostBlackList&&!t.hostBlockList&&(t.hostBlockList=t.hostBlackList,t.hostBlackList=void 0,e&&e.log("hostBlackList is deprecated. Use hostBlockList.")),t}(o,n),!e||e.overwriteScrubFields||e.scrubFields&&(o.scrubFields=(t.scrubFields||[]).concat(e.scrubFields)),o},isError:function(t){return o(t,"error")||o(t,"exception")},isFiniteNumber:function(t){return Number.isFinite(t)},isFunction:s,isIterable:function(t){var e=a(t);return"object"===e||"array"===e},isNativeFunction:l,isObject:c,isString:function(t){return"string"==typeof t||t instanceof String},isType:o,isPromise:function(t){return c(t)&&o(t.then,"function")},jsonParse:function(t){var e,r;try{e=n.parse(t)}catch(t){r=t}return{error:r,value:e}},LEVELS:{debug:0,info:1,warning:2,error:3,critical:4},makeUnhandledStackInfo:function(t,e,r,i,n,o,a,s){var l={url:e||"",line:r,column:i};l.func=s.guessFunctionName(l.url,l.line),l.context=s.gatherContext(l.url,l.line);var c="undefined"!=typeof document&&document&&document.location&&document.location.href,u="undefined"!=typeof window&&window&&window.navigator&&window.navigator.userAgent;return{mode:o,message:n?String(n):t||a,url:c,stack:[l],useragent:u}},merge:i,now:y,redact:function(){return"********"},RollbarJSON:n,sanitizeUrl:function(t){var e=function(t){if(o(t,"string")){for(var e=h,r=e.parser[e.strictMode?"strict":"loose"].exec(t),i={},n=0,a=e.key.length;n<a;++n)i[e.key[n]]=r[n]||"";return i[e.q.name]={},i[e.key[12]].replace(e.q.parser,(function(t,r,n){r&&(i[e.q.name][r]=n)})),i}}(t);return e?(""===e.anchor&&(e.source=e.source.replace("#","")),t=e.source.replace("?"+e.query,"")):"(unknown)"},set:function(t,e,r){if(t){var i=e.split("."),n=i.length;if(!(n<1))if(1!==n)try{for(var o=t[i[0]]||{},a=o,s=1;s<n-1;++s)o[i[s]]=o[i[s]]||{},o=o[i[s]];o[i[n-1]]=r,t[i[0]]=a}catch(t){return}else t[i[0]]=r}},setupJSON:function(t){s(n.stringify)&&s(n.parse)||(o(JSON,"undefined")||(t?(l(JSON.stringify)&&(n.stringify=JSON.stringify),l(JSON.parse)&&(n.parse=JSON.parse)):(s(JSON.stringify)&&(n.stringify=JSON.stringify),s(JSON.parse)&&(n.parse=JSON.parse))),s(n.stringify)&&s(n.parse)||t&&t(n))},stringify:d,maxByteSize:function(t){for(var e=0,r=t.length,i=0;i<r;i++){var n=t.charCodeAt(i);n<128?e+=1:n<2048?e+=2:n<65536&&(e+=3)}return e},typeName:a,uuid4:u}},650:t=>{function e(t){return"string"!=typeof t&&(t=String(t)),t.toLowerCase()}function r(t){this.map={},t instanceof r?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}r.prototype.append=function(t,r){t=e(t),r=function(t){return"string"!=typeof t&&(t=String(t)),t}(r);var i=this.map[t];this.map[t]=i?i+", "+r:r},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},r.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),function(t){return{next:function(){var e=t.shift();return{done:void 0===e,value:e}}}}(t)},t.exports=function(t){return"undefined"==typeof Headers?new r(t):new Headers(t)}},876:(t,e,r)=>{var i=r(708);t.exports=i},297:t=>{t.exports=function(t,e,r,i,n){var o=t[e];t[e]=r(o),i&&i[n].push([t,e,o])}},267:(t,e,r)=>{var i=r(702);t.exports=function(t,e,r){var n,o,a,s,l=i.isType(t,"object"),c=i.isType(t,"array"),u=[];if(r=r||{obj:[],mapped:[]},l){if(s=r.obj.indexOf(t),l&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(t),s=r.obj.length-1}if(l)for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&u.push(n);else if(c)for(a=0;a<t.length;++a)u.push(a);var h=l?{}:[],d=!0;for(a=0;a<u.length;++a)o=t[n=u[a]],h[n]=e(n,o,r),d=d&&h[n]===t[n];return l&&!d&&(r.mapped[s]=h),d?t:h}},708:t=>{t.exports=function(t){var e,r,i,n,o,a,s,l,c,u,h,d,p,f=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function m(t){return t<10?"0"+t:t}function g(){return this.valueOf()}function _(t){return f.lastIndex=0,f.test(t)?'"'+t.replace(f,(function(t){var e=i[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+t+'"'}function y(t,i){var o,a,s,l,c,u=e,h=i[t];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(t)),"function"==typeof n&&(h=n.call(i,t,h)),typeof h){case"string":return _(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(e+=r,c=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,o=0;o<l;o+=1)c[o]=y(o,h)||"null";return s=0===c.length?"[]":e?"[\n"+e+c.join(",\n"+e)+"\n"+u+"]":"["+c.join(",")+"]",e=u,s}if(n&&"object"==typeof n)for(l=n.length,o=0;o<l;o+=1)"string"==typeof n[o]&&(s=y(a=n[o],h))&&c.push(_(a)+(e?": ":":")+s);else for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(s=y(a,h))&&c.push(_(a)+(e?": ":":")+s);return s=0===c.length?"{}":e?"{\n"+e+c.join(",\n"+e)+"\n"+u+"}":"{"+c.join(",")+"}",e=u,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+m(this.getUTCMonth()+1)+"-"+m(this.getUTCDate())+"T"+m(this.getUTCHours())+":"+m(this.getUTCMinutes())+":"+m(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=g,Number.prototype.toJSON=g,String.prototype.toJSON=g),"function"!=typeof t.stringify&&(i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},t.stringify=function(t,i,o){var a;if(e="",r="","number"==typeof o)for(a=0;a<o;a+=1)r+=" ";else"string"==typeof o&&(r=o);if(n=i,i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON.stringify");return y("",{"":t})}),"function"!=typeof t.parse&&(t.parse=(u={"\\":"\\",'"':'"',"/":"/",t:"\t",n:"\n",r:"\r",f:"\f",b:"\b"},h={go:function(){o="ok"},firstokey:function(){l=c,o="colon"},okey:function(){l=c,o="colon"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},d={go:function(){o="ok"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},p={"{":{go:function(){a.push({state:"ok"}),s={},o="firstokey"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s={},o="firstokey"},firstavalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"},avalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"}},"}":{firstokey:function(){var t=a.pop();c=s,s=t.container,l=t.key,o=t.state},ocomma:function(){var t=a.pop();s[l]=c,c=s,s=t.container,l=t.key,o=t.state}},"[":{go:function(){a.push({state:"ok"}),s=[],o="firstavalue"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s=[],o="firstavalue"},firstavalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"},avalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"}},"]":{firstavalue:function(){var t=a.pop();c=s,s=t.container,l=t.key,o=t.state},acomma:function(){var t=a.pop();s.push(c),c=s,s=t.container,l=t.key,o=t.state}},":":{colon:function(){if(Object.hasOwnProperty.call(s,l))throw new SyntaxError("Duplicate key '"+l+'"');o="ovalue"}},",":{ocomma:function(){s[l]=c,o="okey"},acomma:function(){s.push(c),o="avalue"}},true:{go:function(){c=!0,o="ok"},ovalue:function(){c=!0,o="ocomma"},firstavalue:function(){c=!0,o="acomma"},avalue:function(){c=!0,o="acomma"}},false:{go:function(){c=!1,o="ok"},ovalue:function(){c=!1,o="ocomma"},firstavalue:function(){c=!1,o="acomma"},avalue:function(){c=!1,o="acomma"}},null:{go:function(){c=null,o="ok"},ovalue:function(){c=null,o="ocomma"},firstavalue:function(){c=null,o="acomma"},avalue:function(){c=null,o="acomma"}}},function(t,e){var r,i,n=/^[\u0020\t\n\r]*(?:([,:\[\]{}]|true|false|null)|(-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)|"((?:[^\r\n\t\\\"]|\\(?:["\\\/trnfb]|u[0-9a-fA-F]{4}))*)")/;o="go",a=[];try{for(;r=n.exec(t);)r[1]?p[r[1]][o]():r[2]?(c=+r[2],d[o]()):(i=r[3],c=i.replace(/\\(?:u(.{4})|([^u]))/g,(function(t,e,r){return e?String.fromCharCode(parseInt(e,16)):u[r]})),h[o]()),t=t.slice(r[0].length)}catch(t){o=t}if("ok"!==o||/[^\u0020\t\n\r]/.test(t))throw o instanceof SyntaxError?o:new SyntaxError("JSON");return"function"==typeof e?function t(r,i){var n,o,a=r[i];if(a&&"object"==typeof a)for(n in c)Object.prototype.hasOwnProperty.call(a,n)&&(void 0!==(o=t(a,n))?a[n]=o:delete a[n]);return e.call(r,i,a)}({"":c},""):c}))}}},e={},function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}(409);var t,e}))},443:function(t){
|
|
56
|
-
/**
|
|
57
|
-
* MapLibre GL JS
|
|
58
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.6.1/LICENSE.txt
|
|
59
|
-
*/
|
|
60
|
-
t.exports=function(){var t={},e={};function r(r,i,n){if(e[r]=n,"index"===r){var o="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",a={};return e.shared(a),e.index(t,a),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),t}}return r("shared",["exports"],(function(t){function e(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))}function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i,n;function o(){if(n)return i;function t(t,e){this.x=t,this.y=e}return n=1,i=t,t.prototype={clone:function(){return new t(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),i=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),i=Math.sin(t),n=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-i*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},t.convert=function(e){return e instanceof t?e:Array.isArray(e)?new t(e[0],e[1]):e},i}"function"==typeof SuppressedError&&SuppressedError;var a,s,l=r(o()),c=function(){if(s)return a;function t(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=i}return s=1,a=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,i=0;i<8;i++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=t,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-t)<e));i++)t>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},a}(),u=r(c);let h,d;function p(){return null==h&&(h="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),h}function f(){if(null==d&&(d=!1,p())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<t*t;i++){const r=4*i;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%t,Math.floor(i/t),1,1)}const r=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&r[e]!==e){d=!0;break}}}return d||!1}var m=1e-6,g="undefined"!=typeof Float32Array?Float32Array:Array;function _(){var t=new g(9);return g!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function y(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function v(){var t=new g(3);return g!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function b(t){return Math.hypot(t[0],t[1],t[2])}function x(t,e,r){var i=new g(3);return i[0]=t,i[1]=e,i[2]=r,i}function w(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function S(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function T(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=n*l-o*s,t[1]=o*a-i*l,t[2]=i*s-n*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var I,E=b;function P(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,t}function k(){var t=new g(4);return g!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function C(t,e,r,i){var n=.5*Math.PI/180;e*=n,r*=n,i*=n;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(r),l=Math.cos(r),c=Math.sin(i),u=Math.cos(i);return t[0]=o*l*u-a*s*c,t[1]=a*s*u+o*l*c,t[2]=a*l*c-o*s*u,t[3]=a*l*u+o*s*c,t}function A(){var t=new g(2);return g!=Float32Array&&(t[0]=0,t[1]=0),t}function M(t,e){var r=new g(2);return r[0]=t,r[1]=e,r}v(),I=new g(4),g!=Float32Array&&(I[0]=0,I[1]=0,I[2]=0,I[3]=0),v(),x(1,0,0),x(0,1,0),k(),k(),_(),A();const R=8192;function L(t,e,r){return e*(R/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function D(t,e){return(t%e+e)%e}function z(t,e,r){return t*(1-r)+e*r}function O(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function F(t,e,r,i){const n=new u(t,e,r,i);return t=>n.solve(t)}const N=F(.25,.1,.25,1);function B(t,e,r){return Math.min(r,Math.max(e,t))}function j(t,e,r){const i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function U(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let V=1;function G(t,e,r){const i={};for(const n in t)i[n]=e.call(this,t[n],n,t);return i}function $(t,e,r){const i={};for(const n in t)e.call(this,t[n],n,t)&&(i[n]=t[n]);return i}function q(t){return Array.isArray(t)?t.map(q):"object"==typeof t&&t?G(t,q):t}const Z={};function W(t){Z[t]||("undefined"!=typeof console&&console.warn(t),Z[t]=!0)}function H(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function X(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let J=null;function Y(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const K="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Q(t,r,i,n,o){return e(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const a=null==e?void 0:e.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield e.copyTo(l,function(t,e,r,i,n){const o=4*Math.max(-e,0),a=(Math.max(0,r)-r)*i*4+o,s=4*i,l=Math.max(0,e),c=Math.max(0,r);return{rect:{x:l,y:c,width:Math.min(t.width,e+i)-l,height:Math.min(t.height,r+n)-c},layout:[{offset:a,stride:s}]}}(t,r,i,n,o)),s)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}}))}let tt,et;function rt(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function it(t){return t*Math.PI/180}function nt(t){return t/Math.PI*180}const ot={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},at={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},st="AbortError";function lt(){return new Error(st)}const ct={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ut(t){return ct.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const ht="global-dispatcher";class dt extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}}const pt=()=>X(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,ft=function(t,r){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=ut(t.url);if(e)return e(t,r);if(X(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:ht},r)}if(!(/^file:/.test(i=t.url)||/^file:/.test(pt())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,r){return e(this,void 0,void 0,(function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:pt(),signal:r.signal});let i,n;"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{i=yield fetch(e)}catch(e){throw new dt(0,e.message,t.url,new Blob)}if(!i.ok){const e=yield i.blob();throw new dt(i.status,i.statusText,t.url,e)}n="arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text();const o=yield n;if(r.signal.aborted)throw lt();return{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}}))}(t,r);if(X(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:ht},r)}var i;return function(t,e){return new Promise(((r,i)=>{var n;const o=new XMLHttpRequest;o.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(o.responseType="arraybuffer");for(const e in t.headers)o.setRequestHeader(e,t.headers[e]);"json"===t.type&&(o.responseType="text",(null===(n=t.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===t.credentials,o.onerror=()=>{i(new Error(o.statusText))},o.onload=()=>{if(!e.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let e=o.response;if("json"===t.type)try{e=JSON.parse(o.response)}catch(t){return void i(t)}r({data:e,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const e=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});i(new dt(o.status,o.statusText,t.url,e))}},e.signal.addEventListener("abort",(()=>{o.abort(),i(lt())})),o.send(t.body)}))}(t,r)};function mt(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function gt(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function _t(t,e,r){if(r&&r[t]){const i=r[t].indexOf(e);-1!==i&&r[t].splice(i,1)}}class yt{constructor(t,e={}){U(this,e),this.type=t}}class vt extends yt{constructor(t,e={}){super("error",U({error:t},e))}}class bt{on(t,e){return this._listeners=this._listeners||{},gt(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return _t(t,e,this._listeners),_t(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},gt(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new yt(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const o of i)_t(r,o,this._oneTimeListeners),o.call(this,t);const n=this._eventedParent;n&&(U(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof vt&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var xt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},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:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","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"}},"layout_color-relief":{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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"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 wt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function St(t,e){const r={};for(const i in t)"ref"!==i&&(r[i]=t[i]);return wt.forEach((t=>{t in e&&(r[t]=e[t])})),r}function Tt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Tt(t[r],e[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(!Tt(t[r],e[r]))return!1;return!0}return t===e}function It(t,e){t.push(e)}function Et(t,e,r){It(r,{command:"addSource",args:[t,e[t]]})}function Pt(t,e,r){It(e,{command:"removeSource",args:[t]}),r[t]=!0}function kt(t,e,r,i){Pt(t,r,i),Et(t,e,r)}function Ct(t,e,r){let i;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!Tt(t[r][i],e[r][i]))return!1;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!Tt(t[r][i],e[r][i]))return!1;return!0}function At(t,e,r,i,n,o){t=t||{},e=e||{};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Tt(t[a],e[a])||r.push({command:o,args:[i,a,e[a],n]}));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&!Object.prototype.hasOwnProperty.call(t,a)&&(Tt(t[a],e[a])||r.push({command:o,args:[i,a,e[a],n]}))}function Mt(t){return t.id}function Rt(t,e){return t[e.id]=e,t}class Lt{constructor(t,e,r,i){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)}}function Dt(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class zt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Ot{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[r,i]of e)this.bindings[r]=i}concat(t){return new Ot(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Ft={kind:"null"},Nt={kind:"number"},Bt={kind:"string"},jt={kind:"boolean"},Ut={kind:"color"},Vt={kind:"projectionDefinition"},Gt={kind:"object"},$t={kind:"value"},qt={kind:"collator"},Zt={kind:"formatted"},Wt={kind:"padding"},Ht={kind:"colorArray"},Xt={kind:"numberArray"},Jt={kind:"resolvedImage"},Yt={kind:"variableAnchorOffsetCollection"};function Kt(t,e){return{kind:"array",itemType:t,N:e}}function Qt(t){if("array"===t.kind){const e=Qt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const te=[Ft,Nt,Bt,jt,Ut,Vt,Zt,Gt,Kt($t),Wt,Xt,Ht,Jt,Yt];function ee(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ee(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of te)if(!ee(t,e))return null}return`Expected ${Qt(t)} but found ${Qt(e)} instead.`}function re(t,e){return e.some((e=>e.kind===t.kind))}function ie(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function ne(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const oe=.96422,ae=.82521,se=4/29,le=6/29,ce=3*le*le,ue=le*le*le,he=Math.PI/180,de=180/Math.PI;function pe(t){return(t%=360)<0&&(t+=360),t}function fe([t,e,r,i]){let n,o;const a=ge((.2225045*(t=me(t))+.7168786*(e=me(e))+.0606169*(r=me(r)))/1);t===e&&e===r?n=o=a:(n=ge((.4360747*t+.3850649*e+.1430804*r)/oe),o=ge((.0139322*t+.0971045*e+.7141733*r)/ae));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function me(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ge(t){return t>ue?Math.pow(t,1/3):t/ce+se}function _e([t,e,r,i]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(r)?n:n-r/200;return n=1*ve(n),o=oe*ve(o),a=ae*ve(a),[ye(3.1338561*o-1.6168667*n-.4906146*a),ye(-.9787684*o+1.9161415*n+.033454*a),ye(.0719453*o-.2289914*n+1.4052427*a),i]}function ye(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function ve(t){return t>le?t*t*t:ce*(t-se)}const be=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function xe(t,e){return be(t,e)?t[e]:void 0}function we(t){return parseInt(t.padEnd(2,t),16)/255}function Se(t,e){return Te(e?t/100:t,0,1)}function Te(t,e,r){return Math.min(Math.max(e,t),r)}function Ie(t){return!t.some(Number.isNaN)}const Ee={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Pe(t,e,r){return t+r*(e-t)}function ke(t,e,r){return t.map(((t,i)=>Pe(t,e[i],r)))}class Ce{constructor(t,e,r,i=1,n=!0){this.r=t,this.g=e,this.b=r,this.a=i,n||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,e,r,i]))}static parse(t){if(t instanceof Ce)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=xe(Ee,t);if(e){const[t,r,i]=e;return[t/255,r/255,i/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return[we(t.slice(r,r+=e)),we(t.slice(r,r+=e)),we(t.slice(r,r+=e)),we(t.slice(r,r+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,r,i,n,o,a,s,l,c,u,h,d]=e,p=[n||" ",s||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const t=[i,a,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Te(+r/e,0,1),Te(+o/e,0,1),Te(+l/e,0,1),h?Se(+h,d):1];if(Ie(t))return t}}return}}const r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[t,e,i,n,o,a,s,l,c]=r,u=[i||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,Te(+n,0,100),Te(+a,0,100),l?Se(+l,c):1];if(Ie(t))return function([t,e,r,i]){function n(i){const n=(i+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(n-3,9-n,1))}return t=pe(t),e/=100,r/=100,[n(0),n(8),n(4),i]}(t)}}}(t);return e?new Ce(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:i}=this,n=i||1/0;return this.overwriteGetter("rgb",[t/n,e/n,r/n,i])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,r,i,n]=fe(t),o=Math.sqrt(r*r+i*i);return[Math.round(1e4*o)?pe(Math.atan2(i,r)*de):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",fe(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,i]=this.rgb;return`rgba(${[t,e,r].map((t=>Math.round(255*t))).join(",")},${i})`}static interpolate(t,e,r,i="rgb"){switch(i){case"rgb":{const[i,n,o,a]=ke(t.rgb,e.rgb,r);return new Ce(i,n,o,a,!1)}case"hcl":{const[i,n,o,a]=t.hcl,[s,l,c,u]=e.hcl;let h,d;if(isNaN(i)||isNaN(s))isNaN(i)?isNaN(s)?h=NaN:(h=s,1!==o&&0!==o||(d=l)):(h=i,1!==c&&0!==c||(d=n));else{let t=s-i;s>i&&t>180?t-=360:s<i&&i-s>180&&(t+=360),h=i+r*t}const[p,f,m,g]=function([t,e,r,i]){return t=isNaN(t)?0:t*he,_e([r,Math.cos(t)*e,Math.sin(t)*e,i])}([h,null!=d?d:Pe(n,l,r),Pe(o,c,r),Pe(a,u,r)]);return new Ce(p,f,m,g,!1)}case"lab":{const[i,n,o,a]=_e(ke(t.lab,e.lab,r));return new Ce(i,n,o,a,!1)}}}}Ce.black=new Ce(0,0,0,1),Ce.white=new Ce(1,1,1,1),Ce.transparent=new Ce(0,0,0,0),Ce.red=new Ce(1,0,0,1);class Ae{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Me=["bottom","center","top"];class Re{constructor(t,e,r,i,n,o){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=o}}class Le{constructor(t){this.sections=t}static fromString(t){return new Le([new Re(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Le?t:Le.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class De{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof De)return t;if("number"==typeof t)return new De([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new De(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new De(ke(t.values,e.values,r))}}class ze{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ze)return t;if("number"==typeof t)return new ze([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ze(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new ze(ke(t.values,e.values,r))}}class Oe{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Oe)return t;if("string"==typeof t){const e=Ce.parse(t);if(!e)return;return new Oe([e])}if(!Array.isArray(t))return;const e=[];for(const r of t){if("string"!=typeof r)return;const t=Ce.parse(r);if(!t)return;e.push(t)}return new Oe(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r,i="rgb"){const n=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)n.push(Ce.interpolate(t.values[o],e.values[o],r,i));return new Oe(n)}}class Fe extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Ne=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Be{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Be)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const r=t[e],i=t[e+1];if("string"!=typeof r||!Ne.has(r))return;if(!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new Be(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){const i=t.values,n=e.values;if(i.length!==n.length)throw new Fe(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==n[a])throw new Fe(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${i[a]}, to[${a}]: ${n[a]}`);o.push(i[a]);const[t,e]=i[a+1],[s,l]=n[a+1];o.push([Pe(t,s,r),Pe(e,l,r)])}return new Be(o)}}class je{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new je({name:t,available:!1}):null}}class Ue{constructor(t,e,r){this.from=t,this.to=e,this.transition=r}static interpolate(t,e,r){return new Ue(t,e,r)}static parse(t){return t instanceof Ue?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new Ue(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new Ue(t.from,t.to,t.transition):"string"==typeof t?new Ue(t,t,1):void 0}}function Ve(t,e,r,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,r,i]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ge(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Ue||t instanceof Ce||t instanceof Ae||t instanceof Le||t instanceof De||t instanceof ze||t instanceof Oe||t instanceof Be||t instanceof je)return!0;if(Array.isArray(t)){for(const e of t)if(!Ge(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ge(t[e]))return!1;return!0}return!1}function $e(t){if(null===t)return Ft;if("string"==typeof t)return Bt;if("boolean"==typeof t)return jt;if("number"==typeof t)return Nt;if(t instanceof Ce)return Ut;if(t instanceof Ue)return Vt;if(t instanceof Ae)return qt;if(t instanceof Le)return Zt;if(t instanceof De)return Wt;if(t instanceof ze)return Xt;if(t instanceof Oe)return Ht;if(t instanceof Be)return Yt;if(t instanceof je)return Jt;if(Array.isArray(t)){const e=t.length;let r;for(const i of t){const t=$e(i);if(r){if(r===t)continue;r=$t;break}r=t}return Kt(r||$t,e)}return Gt}function qe(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ce||t instanceof Ue||t instanceof Le||t instanceof De||t instanceof ze||t instanceof Oe||t instanceof Be||t instanceof je?t.toString():JSON.stringify(t)}class Ze{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ge(t[1]))return e.error("invalid value");const r=t[1];let i=$e(r);const n=e.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new Ze(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const We={string:Bt,number:Nt,boolean:jt,object:Gt};class He{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,i=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in We)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=We[r],i++}else n=$t;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],i++}r=Kt(n,o)}else{if(!We[n])throw new Error(`Types doesn't contain name = ${n}`);r=We[n]}const o=[];for(;i<t.length;i++){const r=e.parse(t[i],i,$t);if(!r)return null;o.push(r)}return new He(r,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!ee(this.type,$e(r)))return r;if(e===this.args.length-1)throw new Fe(`Expected value to be of type ${Qt(this.type)}, but found ${Qt($e(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Xe={"to-boolean":jt,"to-color":Ut,"to-number":Nt,"to-string":Bt};class Je{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(!Xe[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const i=Xe[r],n=[];for(let o=1;o<t.length;o++){const r=e.parse(t[o],o,$t);if(!r)return null;n.push(r)}return new Je(i,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,r;for(const i of this.args){if(e=i.evaluate(t),r=null,e instanceof Ce)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Ve(e[0],e[1],e[2],e[3]),!r))return new Ce(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Fe(r||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const r of this.args){e=r.evaluate(t);const i=De.parse(e);if(i)return i}throw new Fe(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const r of this.args){e=r.evaluate(t);const i=ze.parse(e);if(i)return i}throw new Fe(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const r of this.args){e=r.evaluate(t);const i=Oe.parse(e);if(i)return i}throw new Fe(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const r of this.args){e=r.evaluate(t);const i=Be.parse(e);if(i)return i}throw new Fe(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new Fe(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Le.fromString(qe(this.args[0].evaluate(t)));case"resolvedImage":return je.fromString(qe(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return qe(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Ye=["Unknown","Point","LineString","Polygon"];class Ke{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ye[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(t){let e=this._parseColorCache.get(t);return e||(e=Ce.parse(t),this._parseColorCache.set(t,e)),e}}class Qe{constructor(t,e,r=[],i,n=new Ot,o=[]){this.registry=t,this.path=r,this.key=r.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=i,this._isConstant=e}parse(t,e,r,i,n={}){return e?this.concat(e,r,i)._parse(t,n):this._parse(t,n)}_parse(t,e){function r(t,e,r){return"assert"===r?new He(e,[t]):"coerce"===r?new Je(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[i];if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,n=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===t.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(n.kind))i=r(i,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||"assert")}if(!(i instanceof Ze)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const e=new Ke;try{i=new Ze(i.type,i.evaluate(e))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const i="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new Qe(this.registry,this._isConstant,i,e||null,n,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new zt(r,t))}checkSubtype(t,e){const r=ee(t,e);return r&&this.error(r),r}}class tr{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;r.push([i,o])}const i=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return i?new tr(r,i):null}outputDefined(){return this.result.outputDefined()}}class er{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new er(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class rr{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Nt),i=e.parse(t[2],2,Kt(e.expectedType||$t));return r&&i?new rr(i.type.itemType,r,i):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new Fe(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new Fe(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new Fe(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ir{constructor(t,e){this.type=jt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,$t),i=e.parse(t[2],2,$t);return r&&i?re(r.type,[jt,Bt,Nt,Ft,$t])?new ir(r,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!ie(e,["boolean","string","number","null"]))throw new Fe(`Expected first argument to be of type boolean, string, number or null, but found ${Qt($e(e))} instead.`);if(!ie(r,["string","array"]))throw new Fe(`Expected second argument to be of type array or string, but found ${Qt($e(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class nr{constructor(t,e,r){this.type=Nt,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,$t),i=e.parse(t[2],2,$t);if(!r||!i)return null;if(!re(r.type,[jt,Bt,Nt,Ft,$t]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(r.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Nt);return n?new nr(r,i,n):null}return new nr(r,i)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!ie(e,["boolean","string","number","null"]))throw new Fe(`Expected first argument to be of type boolean, string, number or null, but found ${Qt($e(e))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),ie(r,["string"])){const t=r.indexOf(e,i);return-1===t?-1:[...r.slice(0,t)].length}if(ie(r,["array"]))return r.indexOf(e,i);throw new Fe(`Expected second argument to be of type array or string, but found ${Qt($e(r))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class or{constructor(t,e,r,i,n,o){this.inputType=t,this.type=e,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n={},o=[];for(let l=2;l<t.length-1;l+=2){let a=t[l];const s=t[l+1];Array.isArray(a)||(a=[a]);const c=e.concat(l);if(0===a.length)return c.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,$e(t)))return null}else r=$e(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=o.length}const u=e.parse(s,l,i);if(!u)return null;i=i||u.type,o.push(u)}const a=e.parse(t[1],1,$t);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,i);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new or(r,i,a,n,o,s):null}evaluate(t){const e=this.input.evaluate(t);return($e(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class ar{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const i=[];for(let o=1;o<t.length-1;o+=2){const n=e.parse(t[o],o,jt);if(!n)return null;const a=e.parse(t[o+1],o+1,r);if(!a)return null;i.push([n,a]),r=r||a.type}const n=e.parse(t[t.length-1],t.length-1,r);if(!n)return null;if(!r)throw new Error("Can't infer output type");return new ar(r,i,n)}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class sr{constructor(t,e,r,i){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,$t),i=e.parse(t[2],2,Nt);if(!r||!i)return null;if(!re(r.type,[Kt($t),Bt,$t]))return e.error(`Expected first argument to be of type array or string, but found ${Qt(r.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Nt);return n?new sr(r.type,r,i,n):null}return new sr(r.type,r,i)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);let i;if(this.endIndex&&(i=this.endIndex.evaluate(t)),ie(e,["string"]))return[...e].slice(r,i).join("");if(ie(e,["array"]))return e.slice(r,i);throw new Fe(`Expected first argument to be of type array or string, but found ${Qt($e(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function lr(t,e){const r=t.length-1;let i,n,o=0,a=r,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=t[s],n=t[s+1],i<=e){if(s===r||e<n)return s;o=s+1}else{if(!(i>e))throw new Fe("Input is not a number.");a=s-1}return 0}class cr{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[i,n]of r)this.labels.push(i),this.outputs.push(n)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,Nt);if(!r)return null;const i=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let o=1;o<t.length;o+=2){const r=1===o?-1/0:t[o],a=t[o+1],s=o,l=o+1;if("number"!=typeof r)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(i.length&&i[i.length-1][0]>=r)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,n);if(!c)return null;n=n||c.type,i.push([r,c])}return new cr(n,r,i)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);const n=e.length;return i>=e[n-1]?r[n-1].evaluate(t):r[lr(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ur(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hr,dr,pr=function(){if(dr)return hr;function t(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=i}return dr=1,hr=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,i=0;i<8;i++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=t,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-t)<e));i++)t>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},hr}(),fr=ur(pr);class mr{constructor(t,e,r,i,n){this.type=t,this.operator=e,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[o,a]of n)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(t,e,r,i){let n=0;if("exponential"===t.name)n=gr(e,t.base,r,i);else if("linear"===t.name)n=gr(e,1,r,i);else if("cubic-bezier"===t.name){const o=t.controlPoints;n=new fr(o[0],o[1],o[2],o[3]).solve(gr(e,1,r,i))}return n}static parse(t,e){let[r,i,n,...o]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,Nt),!n)return null;const a=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||e.expectedType==Ht?e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType):s=Ut;for(let l=0;l<o.length;l+=2){const t=o[l],r=o[l+1],i=l+3,n=l+4;if("number"!=typeof t)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=t)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=e.parse(r,n,s);if(!c)return null;s=s||c.type,a.push([t,c])}return ne(s,Nt)||ne(s,Vt)||ne(s,Ut)||ne(s,Wt)||ne(s,Xt)||ne(s,Ht)||ne(s,Yt)||ne(s,Kt(Nt))?new mr(s,r,i,n,a):e.error(`Type ${Qt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);const n=e.length;if(i>=e[n-1])return r[n-1].evaluate(t);const o=lr(e,i),a=mr.interpolationFactor(this.interpolation,i,e[o],e[o+1]),s=r[o].evaluate(t),l=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Pe(s,l,a);case"color":return Ce.interpolate(s,l,a);case"padding":return De.interpolate(s,l,a);case"colorArray":return Oe.interpolate(s,l,a);case"numberArray":return ze.interpolate(s,l,a);case"variableAnchorOffsetCollection":return Be.interpolate(s,l,a);case"array":return ke(s,l,a);case"projectionDefinition":return Ue.interpolate(s,l,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ce.interpolate(s,l,a,"hcl");case"colorArray":return Oe.interpolate(s,l,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ce.interpolate(s,l,a,"lab");case"colorArray":return Oe.interpolate(s,l,a,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function gr(t,e,r,i){const n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}const _r={color:Ce.interpolate,number:Pe,padding:De.interpolate,numberArray:ze.interpolate,colorArray:Oe.interpolate,variableAnchorOffsetCollection:Be.interpolate,array:ke};class yr{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r=null;const i=e.expectedType;i&&"value"!==i.kind&&(r=i);const n=[];for(const a of t.slice(1)){const t=e.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,n.push(t)}if(!r)throw new Error("No output type");const o=i&&n.some((t=>ee(i,t.type)));return new yr(o?$t:r,n)}evaluate(t){let e,r=null,i=0;for(const n of this.args)if(i++,r=n.evaluate(t),r&&r instanceof je&&!r.available&&(e||(e=r.name),r=null,i===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function vr(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function br(t,e,r,i){return 0===i.compare(e,r)}function xr(t,e,r){const i="=="!==t&&"!="!==t;return class n{constructor(t,e,r){this.type=jt,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let o=e.parse(t[1],1,$t);if(!o)return null;if(!vr(r,o.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${Qt(o.type)}'.`);let a=e.parse(t[2],2,$t);if(!a)return null;if(!vr(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${Qt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${Qt(o.type)}' and '${Qt(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new He(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new He(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,qt),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){const e=$e(o),r=$e(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new Fe(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=$e(o),r=$e(a);if("string"!==t.kind||"string"!==r.kind)return e(n,o,a)}return this.collator?r(n,o,a,this.collator.evaluate(n)):e(n,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const wr=xr("==",(function(t,e,r){return e===r}),br),Sr=xr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,i){return!br(0,e,r,i)})),Tr=xr("<",(function(t,e,r){return e<r}),(function(t,e,r,i){return i.compare(e,r)<0})),Ir=xr(">",(function(t,e,r){return e>r}),(function(t,e,r,i){return i.compare(e,r)>0})),Er=xr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,i){return i.compare(e,r)<=0})),Pr=xr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,i){return i.compare(e,r)>=0}));class kr{constructor(t,e,r){this.type=qt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const i=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,jt);if(!i)return null;const n=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,jt);if(!n)return null;let o=null;return r.locale&&(o=e.parse(r.locale,1,Bt),!o)?null:new kr(i,n,o)}evaluate(t){return new Ae(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Cr{constructor(t,e,r,i,n){this.type=Bt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Nt);if(!r)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let n=null;if(i.locale&&(n=e.parse(i.locale,1,Bt),!n))return null;let o=null;if(i.currency&&(o=e.parse(i.currency,1,Bt),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=e.parse(i["min-fraction-digits"],1,Nt),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=e.parse(i["max-fraction-digits"],1,Nt),!s)?null:new Cr(r,n,o,a,s)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ar{constructor(t){this.type=Zt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const i=[];let n=!1;for(let o=1;o<=t.length-1;++o){const r=t[o];if(n&&"object"==typeof r&&!Array.isArray(r)){n=!1;let t=null;if(r["font-scale"]&&(t=e.parse(r["font-scale"],1,Nt),!t))return null;let o=null;if(r["text-font"]&&(o=e.parse(r["text-font"],1,Kt(Bt)),!o))return null;let a=null;if(r["text-color"]&&(a=e.parse(r["text-color"],1,Ut),!a))return null;let s=null;if(r["vertical-align"]){if("string"==typeof r["vertical-align"]&&!Me.includes(r["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${r["vertical-align"]}' instead.`);if(s=e.parse(r["vertical-align"],1,Bt),!s)return null}const l=i[i.length-1];l.scale=t,l.font=o,l.textColor=a,l.verticalAlign=s}else{const r=e.parse(t[o],1,$t);if(!r)return null;const a=r.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,i.push({content:r,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ar(i)}evaluate(t){return new Le(this.sections.map((e=>{const r=e.content.evaluate(t);return $e(r)===Jt?new Re("",r,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Re(qe(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Mr{constructor(t){this.type=Jt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Bt);return r?new Mr(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=je.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class Rr{constructor(t){this.type=Nt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${Qt(r.type)} instead.`):new Rr(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new Fe(`Expected value to be of type string or array, but found ${Qt($e(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Lr=8192;function Dr(t,e){const r=(180+t[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(r*n*Lr),Math.round(i*n*Lr)]}function zr(t,e){const r=Math.pow(2,e.z);return[(n=(t[0]/Lr+e.x)/r,360*n-180),(i=(t[1]/Lr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,n}function Or(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Fr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Nr(t,e,r){const i=t[0]-e[0],n=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return i*a-o*n==0&&i*o<=0&&n*a<=0}function Br(t,e,r,i){return 0!=(n=[i[0]-r[0],i[1]-r[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]&&!(!qr(t,e,r,i)||!qr(r,i,t,e));var n,o}function jr(t,e,r){for(const i of r)for(let r=0;r<i.length-1;++r)if(Br(t,e,i[r],i[r+1]))return!0;return!1}function Ur(t,e,r=!1){let i=!1;for(const s of e)for(let e=0;e<s.length-1;e++){if(Nr(t,s[e],s[e+1]))return r;(o=s[e])[1]>(n=t)[1]!=(a=s[e+1])[1]>n[1]&&n[0]<(a[0]-o[0])*(n[1]-o[1])/(a[1]-o[1])+o[0]&&(i=!i)}var n,o,a;return i}function Vr(t,e){for(const r of e)if(Ur(t,r))return!0;return!1}function Gr(t,e){for(const r of t)if(!Ur(r,e))return!1;for(let r=0;r<t.length-1;++r)if(jr(t[r],t[r+1],e))return!1;return!0}function $r(t,e){for(const r of e)if(Gr(t,r))return!0;return!1}function qr(t,e,r,i){const n=i[0]-r[0],o=i[1]-r[1],a=(t[0]-r[0])*o-n*(t[1]-r[1]),s=(e[0]-r[0])*o-n*(e[1]-r[1]);return a>0&&s<0||a<0&&s>0}function Zr(t,e,r){const i=[];for(let n=0;n<t.length;n++){const o=[];for(let i=0;i<t[n].length;i++){const a=Dr(t[n][i],r);Or(e,a),o.push(a)}i.push(o)}return i}function Wr(t,e,r){const i=[];for(let n=0;n<t.length;n++){const o=Zr(t[n],e,r);i.push(o)}return i}function Hr(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){const e=.5*i;let n=t[0]-r[0]>e?-i:r[0]-t[0]>e?i:0;0===n&&(n=t[0]-r[2]>e?-i:r[2]-t[0]>e?i:0),t[0]+=n}Or(e,t)}function Xr(t,e,r,i){const n=Math.pow(2,i.z)*Lr,o=[i.x*Lr,i.y*Lr],a=[];for(const s of t)for(const t of s){const i=[t.x+o[0],t.y+o[1]];Hr(i,e,r,n),a.push(i)}return a}function Jr(t,e,r,i){const n=Math.pow(2,i.z)*Lr,o=[i.x*Lr,i.y*Lr],a=[];for(const l of t){const t=[];for(const r of l){const i=[r.x+o[0],r.y+o[1]];Or(e,i),t.push(i)}a.push(t)}if(e[2]-e[0]<=n/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const i of t)Hr(i,e,r,n)}var s;return a}class Yr{constructor(t,e){this.type=jt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ge(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const r of e.features){const{type:e,coordinates:i}=r.geometry;"Polygon"===e&&t.push(i),"MultiPolygon"===e&&t.push(...i)}if(t.length)return new Yr(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Yr(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Yr(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=Zr(e.coordinates,i,n),a=Xr(t.geometry(),r,i,n);if(!Fr(r,i))return!1;for(const t of a)if(!Ur(t,o))return!1}if("MultiPolygon"===e.type){const o=Wr(e.coordinates,i,n),a=Xr(t.geometry(),r,i,n);if(!Fr(r,i))return!1;for(const t of a)if(!Vr(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=Zr(e.coordinates,i,n),a=Jr(t.geometry(),r,i,n);if(!Fr(r,i))return!1;for(const t of a)if(!Gr(t,o))return!1}if("MultiPolygon"===e.type){const o=Wr(e.coordinates,i,n),a=Jr(t.geometry(),r,i,n);if(!Fr(r,i))return!1;for(const t of a)if(!$r(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Kr=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let i=1+(t<<1);const o=i+1;if(o<this.length&&r(e[o],e[i])<0&&(i=o),r(e[i],n)>=0)break;e[t]=e[i],t=i}e[t]=n}};function Qr(t,e,r=0,i=t.length-1,n=ei){for(;i>r;){if(i-r>600){const o=i-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Qr(t,e,Math.max(r,Math.floor(e-a*l/o+c)),Math.min(i,Math.floor(e+(o-a)*l/o+c)),n)}const o=t[e];let a=r,s=i;for(ti(t,r,e),n(t[i],o)>0&&ti(t,r,i);a<s;){for(ti(t,a,s),a++,s--;n(t[a],o)<0;)a++;for(;n(t[s],o)>0;)s--}0===n(t[r],o)?ti(t,r,s):(s++,ti(t,s,i)),s<=e&&(r=s+1),e<=s&&(i=s-1)}}function ti(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function ei(t,e){return t<e?-1:t>e?1:0}function ri(t,e){if(t.length<=1)return[t];const r=[];let i,n;for(const o of t){const t=ni(o);0!==t&&(o.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&r.push(i),i=[o]):i.push(o))}if(i&&r.push(i),e>1)for(let o=0;o<r.length;o++)r[o].length<=e||(Qr(r[o],e,1,r[o].length-1,ii),r[o]=r[o].slice(0,e));return r}function ii(t,e){return e.area-t.area}function ni(t){let e=0;for(let r,i,n=0,o=t.length,a=o-1;n<o;a=n++)r=t[n],i=t[a],e+=(i.x-r.x)*(r.y+i.y);return e}const oi=1/298.257223563,ai=oi*(2-oi),si=Math.PI/180;class li{constructor(t){const e=6378.137*si*1e3,r=Math.cos(t*si),i=1/(1-ai*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*(1-ai)}distance(t,e){const r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r,i,n,o,a=1/0;for(let s=0;s<t.length-1;s++){let l=t[s][0],c=t[s][1],u=this.wrap(t[s+1][0]-l)*this.kx,h=(t[s+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(e[0]-l)*this.kx*u+(e[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=t[s+1][0],c=t[s+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,h=(e[1]-c)*this.ky;const p=u*u+h*h;p<a&&(a=p,r=l,i=c,n=s,o=d)}return{point:[r,i],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function ci(t,e){return e[0]-t[0]}function ui(t){return t[1]-t[0]+1}function hi(t,e){return t[1]>=t[0]&&t[1]<e}function di(t,e){if(t[0]>t[1])return[null,null];const r=ui(t);if(e){if(2===r)return[t,null];const e=Math.floor(r/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===r)return[t,null];const i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function pi(t,e){if(!hi(e,t.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)Or(r,t[i]);return r}function fi(t){const e=[1/0,1/0,-1/0,-1/0];for(const r of t)for(const t of r)Or(e,t);return e}function mi(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function gi(t,e,r){if(!mi(t)||!mi(e))return NaN;let i=0,n=0;return t[2]<e[0]&&(i=e[0]-t[2]),t[0]>e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),r.distance([0,0],[i,n])}function _i(t,e,r){const i=r.pointOnLine(e,t);return r.distance(t,i.point)}function yi(t,e,r,i,n){const o=Math.min(_i(t,[r,i],n),_i(e,[r,i],n)),a=Math.min(_i(r,[t,e],n),_i(i,[t,e],n));return Math.min(o,a)}function vi(t,e,r,i,n){if(!hi(e,t.length)||!hi(i,r.length))return 1/0;let o=1/0;for(let a=e[0];a<e[1];++a){const e=t[a],s=t[a+1];for(let t=i[0];t<i[1];++t){const i=r[t],a=r[t+1];if(Br(e,s,i,a))return 0;o=Math.min(o,yi(e,s,i,a,n))}}return o}function bi(t,e,r,i,n){if(!hi(e,t.length)||!hi(i,r.length))return NaN;let o=1/0;for(let a=e[0];a<=e[1];++a)for(let e=i[0];e<=i[1];++e)if(o=Math.min(o,n.distance(t[a],r[e])),0===o)return o;return o}function xi(t,e,r){if(Ur(t,e,!0))return 0;let i=1/0;for(const n of e){const e=n[0],o=n[n.length-1];if(e!==o&&(i=Math.min(i,_i(t,[o,e],r)),0===i))return i;const a=r.pointOnLine(n,t);if(i=Math.min(i,r.distance(t,a.point)),0===i)return i}return i}function wi(t,e,r,i){if(!hi(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ur(t[o],r,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(const t of r)for(let r=0,o=t.length,s=o-1;r<o;s=r++){const o=t[s],l=t[r];if(Br(e,a,o,l))return 0;n=Math.min(n,yi(e,a,o,l,i))}}return n}function Si(t,e){for(const r of t)for(const t of r)if(Ur(t,e,!0))return!0;return!1}function Ti(t,e,r,i=1/0){const n=fi(t),o=fi(e);if(i!==1/0&&gi(n,o,r)>=i)return i;if(Fr(n,o)){if(Si(t,e))return 0}else if(Si(e,t))return 0;let a=1/0;for(const s of t)for(let t=0,i=s.length,n=i-1;t<i;n=t++){const i=s[n],o=s[t];for(const t of e)for(let e=0,n=t.length,s=n-1;e<n;s=e++){const n=t[s],l=t[e];if(Br(i,o,n,l))return 0;a=Math.min(a,yi(i,o,n,l,r))}}return a}function Ii(t,e,r,i,n,o){if(!o)return;const a=gi(pi(i,o),n,r);a<e&&t.push([a,o,[0,0]])}function Ei(t,e,r,i,n,o,a){if(!o||!a)return;const s=gi(pi(i,o),pi(n,a),r);s<e&&t.push([s,o,a])}function Pi(t,e,r,i,n=1/0){let o=Math.min(i.distance(t[0],r[0][0]),n);if(0===o)return o;const a=new Kr([[0,[0,t.length-1],[0,0]]],ci),s=fi(r);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=e?50:100;if(ui(l)<=c){if(!hi(l,t.length))return NaN;if(e){const e=wi(t,l,r,i);if(isNaN(e)||0===e)return e;o=Math.min(o,e)}else for(let e=l[0];e<=l[1];++e){const n=xi(t[e],r,i);if(o=Math.min(o,n),0===o)return 0}}else{const r=di(l,e);Ii(a,o,i,t,s,r[0]),Ii(a,o,i,t,s,r[1])}}return o}function ki(t,e,r,i,n,o=1/0){let a=Math.min(o,n.distance(t[0],r[0]));if(0===a)return a;const s=new Kr([[0,[0,t.length-1],[0,r.length-1]]],ci);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],u=e?50:100,h=i?50:100;if(ui(l)<=u&&ui(c)<=h){if(!hi(l,t.length)&&hi(c,r.length))return NaN;let o;if(e&&i)o=vi(t,l,r,c,n),a=Math.min(a,o);else if(e&&!i){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(o=_i(r[t],e,n),a=Math.min(a,o),0===a)return a}else if(!e&&i){const e=r.slice(c[0],c[1]+1);for(let r=l[0];r<=l[1];++r)if(o=_i(t[r],e,n),a=Math.min(a,o),0===a)return a}else o=bi(t,l,r,c,n),a=Math.min(a,o)}else{const o=di(l,e),u=di(c,i);Ei(s,a,n,t,r,o[0],u[0]),Ei(s,a,n,t,r,o[0],u[1]),Ei(s,a,n,t,r,o[1],u[0]),Ei(s,a,n,t,r,o[1],u[1])}}return a}function Ci(t){return"MultiPolygon"===t.type?t.coordinates.map((t=>({type:"Polygon",coordinates:t}))):"MultiLineString"===t.type?t.coordinates.map((t=>({type:"LineString",coordinates:t}))):"MultiPoint"===t.type?t.coordinates.map((t=>({type:"Point",coordinates:t}))):[t]}class Ai{constructor(t,e){this.type=Nt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ge(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Ai(e,e.features.map((t=>Ci(t.geometry))).flat());if("Feature"===e.type)return new Ai(e,Ci(e.geometry));if("type"in e&&"coordinates"in e)return new Ai(e,Ci(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=t.geometry(),i=r.flat().map((e=>zr([e.x,e.y],t.canonical)));if(0===r.length)return NaN;const n=new li(i[0][1]);let o=1/0;for(const a of e){switch(a.type){case"Point":o=Math.min(o,ki(i,!1,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,ki(i,!1,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Pi(i,!1,a.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=t.geometry(),i=r.flat().map((e=>zr([e.x,e.y],t.canonical)));if(0===r.length)return NaN;const n=new li(i[0][1]);let o=1/0;for(const a of e){switch(a.type){case"Point":o=Math.min(o,ki(i,!0,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,ki(i,!0,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Pi(i,!0,a.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const r=t.geometry();if(0===r.length||0===r[0].length)return NaN;const i=ri(r,0).map((e=>e.map((e=>e.map((e=>zr([e.x,e.y],t.canonical))))))),n=new li(i[0][0][0][1]);let o=1/0;for(const a of e)for(const t of i){switch(a.type){case"Point":o=Math.min(o,Pi([a.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,Pi(a.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,Ti(t,a.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Mi{constructor(t){this.type=$t,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=t[1];return null==r?e.error("Global state property must be defined."):"string"!=typeof r?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Mi(r)}evaluate(t){var e;const r=null===(e=t.globals)||void 0===e?void 0:e.globalState;return r&&0!==Object.keys(r).length?xe(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Ri={"==":wr,"!=":Sr,">":Ir,"<":Tr,">=":Pr,"<=":Er,array:He,at:rr,boolean:He,case:ar,coalesce:yr,collator:kr,format:Ar,image:Mr,in:ir,"index-of":nr,interpolate:mr,"interpolate-hcl":mr,"interpolate-lab":mr,length:Rr,let:tr,literal:Ze,match:or,number:He,"number-format":Cr,object:He,slice:sr,step:cr,string:He,"to-boolean":Je,"to-color":Je,"to-number":Je,"to-string":Je,var:er,within:Yr,distance:Ai,"global-state":Mi};class Li{constructor(t,e,r,i){this.name=t,this.type=e,this._evaluate=r,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const r=t[0],i=Li.definitions[r];if(!i)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let s=null;for(const[l,c]of a){s=new Qe(e.registry,Ni,e.path,null,e.scope);const i=[];let o=!1;for(let e=1;e<t.length;e++){const r=t[e],n=Array.isArray(l)?l[e-1]:l.type,a=s.parse(r,1+i.length,n);if(!a){o=!0;break}i.push(a)}if(!o)if(Array.isArray(l)&&l.length!==i.length)s.error(`Expected ${l.length} arguments, but found ${i.length} instead.`);else{for(let t=0;t<i.length;t++){const e=Array.isArray(l)?l[t]:l.type,r=i[t];s.concat(t+1).checkSubtype(e,r.type)}if(0===s.errors.length)return new Li(r,n,c,i)}}if(1===a.length)e.errors.push(...s.errors);else{const r=(a.length?a:o).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(Qt).join(", ")})`:`(${Qt(e.type)}...)`;var e})).join(" | "),i=[];for(let n=1;n<t.length;n++){const r=e.parse(t[n],1+i.length);if(!r)return null;i.push(Qt(r.type))}e.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(t,e){Li.definitions=e;for(const r in e)t[r]=Li}}function Di(t,[e,r,i,n]){e=e.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);const o=n?n.evaluate(t):1,a=Ve(e,r,i,o);if(a)throw new Fe(a);return new Ce(e/255,r/255,i/255,o,!1)}function zi(t,e){return t in e}function Oi(t,e){const r=e[t];return void 0===r?null:r}function Fi(t){return{type:t}}function Ni(t){if(t instanceof er)return Ni(t.boundExpression);if(t instanceof Li&&"error"===t.name)return!1;if(t instanceof kr)return!1;if(t instanceof Yr)return!1;if(t instanceof Ai)return!1;if(t instanceof Mi)return!1;const e=t instanceof Je||t instanceof He;let r=!0;return t.eachChild((t=>{r=e?r&&Ni(t):r&&t instanceof Ze})),!!r&&Bi(t)&&Ui(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Bi(t){if(t instanceof Li){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Yr)return!1;if(t instanceof Ai)return!1;let e=!0;return t.eachChild((t=>{e&&!Bi(t)&&(e=!1)})),e}function ji(t){if(t instanceof Li&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!ji(t)&&(e=!1)})),e}function Ui(t,e){if(t instanceof Li&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!Ui(t,e)&&(r=!1)})),r}function Vi(t){return{result:"success",value:t}}function Gi(t){return{result:"error",value:t}}function $i(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function qi(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Zi(t){return!!t.expression&&t.expression.interpolated}function Wi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Hi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&$e(t)===Gt}function Xi(t){return t}function Ji(t,e){const r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),n=t.type||(Zi(e)?"exponential":"interval"),o=function(t){switch(t.type){case"color":return Ce.parse;case"padding":return De.parse;case"numberArray":return ze.parse;case"colorArray":return Oe.parse;default:return null}}(e);if(o&&((t=Dt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],o(t[1])]))),t.default=o(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;const s=function(t){switch(t){case"exponential":return tn;case"interval":return Qi;case"categorical":return Ki;case"identity":return en;default:throw new Error(`Unknown function type "${t}"`)}}(n);let l,c;if("categorical"===n){l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}if(r){const r={},i=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],o=n[0].zoom;void 0===r[o]&&(r[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},i.push(o)),r[o].stops.push([n[0].value,n[1]])}const n=[];for(const t of i)n.push([r[t].zoom,Ji(r[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:mr.interpolationFactor.bind(void 0,o),zoomStops:n.map((t=>t[0])),evaluate:({zoom:r},i)=>tn({stops:n,base:t.base},e,r).evaluate(r,i)}}if(i){const r="exponential"===n?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:mr.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>s(t,e,r,l,c)}}return{kind:"source",evaluate(r,i){const n=i&&i.properties?i.properties[t.property]:void 0;return void 0===n?Yi(t.default,e.default):s(t,e,n,l,c)}}}function Yi(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Ki(t,e,r,i,n){return Yi(typeof r===n?i[r]:void 0,t.default,e.default)}function Qi(t,e,r){if("number"!==Wi(r))return Yi(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const n=lr(t.stops.map((t=>t[0])),r);return t.stops[n][1]}function tn(t,e,r){const i=void 0!==t.base?t.base:1;if("number"!==Wi(r))return Yi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const o=lr(t.stops.map((t=>t[0])),r),a=function(t,e,r,i){const n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(r,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],c=_r[e.type]||Xi;return"function"==typeof s.evaluate?{evaluate(...e){const r=s.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==i)return c(r,i,a,t.colorSpace)}}:c(s,l,a,t.colorSpace)}function en(t,e,r){switch(e.type){case"color":r=Ce.parse(r);break;case"formatted":r=Le.fromString(r.toString());break;case"resolvedImage":r=je.fromString(r.toString());break;case"padding":r=De.parse(r);break;case"colorArray":r=Oe.parse(r);break;case"numberArray":r=ze.parse(r);break;default:Wi(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0)}return Yi(r,t.default,e.default)}Li.register(Ri,{error:[{kind:"error"},[Bt],(t,[e])=>{throw new Fe(e.evaluate(t))}],typeof:[Bt,[$t],(t,[e])=>Qt($e(e.evaluate(t)))],"to-rgba":[Kt(Nt,4),[Ut],(t,[e])=>{const[r,i,n,o]=e.evaluate(t).rgb;return[255*r,255*i,255*n,o]}],rgb:[Ut,[Nt,Nt,Nt],Di],rgba:[Ut,[Nt,Nt,Nt,Nt],Di],has:{type:jt,overloads:[[[Bt],(t,[e])=>zi(e.evaluate(t),t.properties())],[[Bt,Gt],(t,[e,r])=>zi(e.evaluate(t),r.evaluate(t))]]},get:{type:$t,overloads:[[[Bt],(t,[e])=>Oi(e.evaluate(t),t.properties())],[[Bt,Gt],(t,[e,r])=>Oi(e.evaluate(t),r.evaluate(t))]]},"feature-state":[$t,[Bt],(t,[e])=>Oi(e.evaluate(t),t.featureState||{})],properties:[Gt,[],t=>t.properties()],"geometry-type":[Bt,[],t=>t.geometryType()],id:[$t,[],t=>t.id()],zoom:[Nt,[],t=>t.globals.zoom],"heatmap-density":[Nt,[],t=>t.globals.heatmapDensity||0],elevation:[Nt,[],t=>t.globals.elevation||0],"line-progress":[Nt,[],t=>t.globals.lineProgress||0],accumulated:[$t,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Nt,Fi(Nt),(t,e)=>{let r=0;for(const i of e)r+=i.evaluate(t);return r}],"*":[Nt,Fi(Nt),(t,e)=>{let r=1;for(const i of e)r*=i.evaluate(t);return r}],"-":{type:Nt,overloads:[[[Nt,Nt],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Nt],(t,[e])=>-e.evaluate(t)]]},"/":[Nt,[Nt,Nt],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[Nt,[Nt,Nt],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Nt,[],()=>Math.LN2],pi:[Nt,[],()=>Math.PI],e:[Nt,[],()=>Math.E],"^":[Nt,[Nt,Nt],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Nt,[Nt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Nt,[Nt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Nt,[Nt],(t,[e])=>Math.log(e.evaluate(t))],log2:[Nt,[Nt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Nt,[Nt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Nt,[Nt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Nt,[Nt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Nt,[Nt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Nt,[Nt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Nt,[Nt],(t,[e])=>Math.atan(e.evaluate(t))],min:[Nt,Fi(Nt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Nt,Fi(Nt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Nt,[Nt],(t,[e])=>Math.abs(e.evaluate(t))],round:[Nt,[Nt],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Nt,[Nt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Nt,[Nt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[jt,[Bt,$t],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[jt,[$t],(t,[e])=>t.id()===e.value],"filter-type-==":[jt,[Bt],(t,[e])=>t.geometryType()===e.value],"filter-<":[jt,[Bt,$t],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[jt,[$t],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],"filter->":[jt,[Bt,$t],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[jt,[$t],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[jt,[Bt,$t],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[jt,[$t],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[jt,[Bt,$t],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[jt,[$t],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[jt,[$t],(t,[e])=>e.value in t.properties()],"filter-has-id":[jt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[jt,[Kt(Bt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[jt,[Kt($t)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[jt,[Bt,Kt($t)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[jt,[Bt,Kt($t)],(t,[e,r])=>function(t,e,r,i){for(;r<=i;){const n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:jt,overloads:[[[jt,jt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Fi(jt),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:jt,overloads:[[[jt,jt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Fi(jt),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[jt,[jt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[jt,[Bt],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Bt,[Bt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Bt,[Bt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Bt,Fi($t),(t,e)=>e.map((e=>qe(e.evaluate(t)))).join("")],"resolved-locale":[Bt,[qt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class rn{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ke,this._defaultValue=e?function(t){if("color"===t.type&&Hi(t.default))return new Ce(0,0,0,0);switch(t.type){case"color":return Ce.parse(t.default)||null;case"padding":return De.parse(t.default)||null;case"numberArray":return ze.parse(t.default)||null;case"colorArray":return Oe.parse(t.default)||null;case"variableAnchorOffsetCollection":return Be.parse(t.default)||null;case"projectionDefinition":return Ue.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Fe(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function nn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ri}function on(t,e){const r=new Qe(Ri,Ni,[],e?function(t){const e={color:Ut,string:Bt,number:Nt,enum:Bt,boolean:jt,formatted:Zt,padding:Wt,numberArray:Xt,colorArray:Ht,projectionDefinition:Vt,resolvedImage:Jt,variableAnchorOffsetCollection:Yt};return"array"===t.type?Kt(e[t.value]||$t,t.length):e[t.type]}(e):void 0),i=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Vi(new rn(i,e)):Gi(r.errors)}class an{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!ji(e.expression),this.globalStateRefs=hn(e.expression)}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)}evaluate(t,e,r,i,n,o){return this._styleExpression.evaluate(t,e,r,i,n,o)}}class sn{constructor(t,e,r,i){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!ji(e.expression),this.globalStateRefs=hn(e.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)}evaluate(t,e,r,i,n,o){return this._styleExpression.evaluate(t,e,r,i,n,o)}interpolationFactor(t,e,r){return this.interpolationType?mr.interpolationFactor(this.interpolationType,t,e,r):0}}function ln(t,e){const r=on(t,e);if("error"===r.result)return r;const i=r.value.expression,n=Bi(i);if(!n&&!$i(e))return Gi([new zt("","data expressions not supported")]);const o=Ui(i,["zoom"]);if(!o&&!qi(e))return Gi([new zt("","zoom expressions not supported")]);const a=un(i);return a||o?a instanceof zt?Gi([a]):a instanceof mr&&!Zi(e)?Gi([new zt("",'"interpolate" expressions cannot be used with this property')]):Vi(a?new sn(n?"camera":"composite",r.value,a.labels,a instanceof mr?a.interpolation:void 0):new an(n?"constant":"source",r.value)):Gi([new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class cn{constructor(t,e){this._parameters=t,this._specification=e,Dt(this,Ji(this._parameters,this._specification))}static deserialize(t){return new cn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function un(t){let e=null;if(t instanceof tr)e=un(t.result);else if(t instanceof yr){for(const r of t.args)if(e=un(r),e)break}else(t instanceof cr||t instanceof mr)&&t.input instanceof Li&&"zoom"===t.input.name&&(e=t);return e instanceof zt||t.eachChild((t=>{const r=un(t);r instanceof zt?e=r:!e&&r?e=new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new zt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function hn(t,e=new Set){return t instanceof Mi&&e.add(t.key),t.eachChild((t=>{hn(t,e)})),e}function dn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!dn(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const pn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fn(t){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};dn(t)||(t=_n(t));const e=on(t,pn);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,r,i)=>e.value.evaluate(t,r,{},i),needGeometry:gn(t),getGlobalStateRefs:()=>hn(e.value.expression)}}function mn(t,e){return t<e?-1:t>e?1:0}function gn(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(gn(t[e]))return!0;return!1}function _n(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?yn(t[1],t[2],"=="):"!="===e?xn(yn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?yn(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(_n))):"all"===e?["all"].concat(t.slice(1).map(_n)):"none"===e?["all"].concat(t.slice(1).map(_n).map(xn)):"in"===e?vn(t[1],t.slice(2)):"!in"===e?xn(vn(t[1],t.slice(2))):"has"===e?bn(t[1]):"!has"!==e||xn(bn(t[1]));var r}function yn(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function vn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(mn)]]:["filter-in-small",t,["literal",e]]}}function bn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function xn(t){return["!",t]}function wn(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${wn(r)},`;return`${e}]`}const r=Object.keys(t).sort();let i="{";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${wn(t[r[n]])},`;return`${i}}`}function Sn(t){let e="";for(const r of wt)e+=`/${wn(t[r])}`;return e}function Tn(t){const e=t.value;return e?[new Lt(t.key,e,"constants have been deprecated as of v8")]:[]}function In(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function En(t){if(Array.isArray(t))return t.map(En);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=En(t[r]);return e}return In(t)}function Pn(t){const e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec;let l=[];const c=Wi(r);if("object"!==c)return[new Lt(e,r,`object expected, ${c} found`)];for(const u in r){const t=u.split(".")[0],c=xe(i,t)||i["*"];let h;if(xe(n,t))h=n[t];else if(xe(i,t))h=s;else if(n["*"])h=n["*"];else{if(!i["*"]){l.push(new Lt(e,r[u],`unknown property "${u}"`));continue}h=s}l=l.concat(h({key:(e?`${e}.`:e)+u,value:r[u],valueSpec:c,style:o,styleSpec:a,object:r,objectKey:u,validateSpec:s},r))}for(const u in i)n[u]||i[u].required&&void 0===i[u].default&&void 0===r[u]&&l.push(new Lt(e,r,`missing required property "${u}"`));return l}function kn(t){const e=t.value,r=t.valueSpec,i=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==Wi(e))return[new Lt(o,e,`array expected, ${Wi(e)} found`)];if(r.length&&e.length!==r.length)return[new Lt(o,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Lt(o,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let s={type:r.value,values:r.values};n.$version<7&&(s.function=r.function),"object"===Wi(r.value)&&(s=r.value);let l=[];for(let c=0;c<e.length;c++)l=l.concat(a({array:e,arrayIndex:c,value:e[c],valueSpec:s,validateSpec:t.validateSpec,style:i,styleSpec:n,key:`${o}[${c}]`}));return l}function Cn(t){const e=t.key,r=t.value,i=t.valueSpec;let n=Wi(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new Lt(e,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new Lt(e,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new Lt(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function An(t){const e=t.valueSpec,r=In(t.value.type);let i,n,o,a={};const s="categorical"!==r&&void 0===t.value.property,l=!s,c="array"===Wi(t.value.stops)&&"array"===Wi(t.value.stops[0])&&"object"===Wi(t.value.stops[0][0]),u=Pn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new Lt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const i=t.value;return e=e.concat(kn({key:t.key,value:i,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Wi(i)&&0===i.length&&e.push(new Lt(t.key,i,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&s&&u.push(new Lt(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||u.push(new Lt(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Zi(t.valueSpec)&&u.push(new Lt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!$i(t.valueSpec)?u.push(new Lt(t.key,t.value,"property functions not supported")):s&&!qi(t.valueSpec)&&u.push(new Lt(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!c||void 0!==t.value.property||u.push(new Lt(t.key,t.value,'"property" property is required')),u;function h(t){let r=[];const i=t.value,s=t.key;if("array"!==Wi(i))return[new Lt(s,i,`array expected, ${Wi(i)} found`)];if(2!==i.length)return[new Lt(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==Wi(i[0]))return[new Lt(s,i,`object expected, ${Wi(i[0])} found`)];if(void 0===i[0].zoom)return[new Lt(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Lt(s,i,"object stop key must have value")];if(o&&o>In(i[0].zoom))return[new Lt(s,i[0].zoom,"stop zoom values must appear in ascending order")];In(i[0].zoom)!==o&&(o=In(i[0].zoom),n=void 0,a={}),r=r.concat(Pn({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Cn,value:d}}))}else r=r.concat(d({key:`${s}[0]`,value:i[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},i));return nn(En(i[1]))?r.concat([new Lt(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${s}[1]`,value:i[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,o){const s=Wi(t.value),l=In(t.value),c=null!==t.value?t.value:o;if(i){if(s!==i)return[new Lt(t.key,c,`${s} stop domain type must match previous stop domain type ${i}`)]}else i=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Lt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==r){let i=`number expected, ${s} found`;return $i(e)&&void 0===r&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Lt(t.key,c,i)]}return"categorical"!==r||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===s&&void 0!==n&&l<n?[new Lt(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===r&&l in a?[new Lt(t.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Lt(t.key,c,`integer expected, found ${l}`)]}}function Mn(t){const e=("property"===t.expressionContext?ln:on)(En(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new Lt(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new Lt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!ji(r))return[new Lt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!ji(r))return[new Lt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ui(r,["zoom","feature-state"]))return[new Lt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Bi(r))return[new Lt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Rn(t){const e=t.key,r=t.value,i=Wi(r);return"string"!==i?[new Lt(e,r,`color expected, ${i} found`)]:Ce.parse(String(r))?[]:[new Lt(e,r,`color expected, "${r}" found`)]}function Ln(t){const e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(In(r))&&n.push(new Lt(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(In(r))&&n.push(new Lt(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function Dn(t){return dn(En(t.value))?Mn(Dt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):zn(t)}function zn(t){const e=t.value,r=t.key;if("array"!==Wi(e))return[new Lt(r,e,`array expected, ${Wi(e)} found`)];const i=t.styleSpec;let n,o=[];if(e.length<1)return[new Lt(r,e,"filter array must have at least 1 element")];switch(o=o.concat(Ln({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),In(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===In(e[1])&&o.push(new Lt(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new Lt(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Wi(e[1]),"string"!==n&&o.push(new Lt(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a<e.length;a++)n=Wi(e[a]),"$type"===In(e[1])?o=o.concat(Ln({key:`${r}[${a}]`,value:e[a],valueSpec:i.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Lt(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let i=1;i<e.length;i++)o=o.concat(zn({key:`${r}[${i}]`,value:e[i],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=Wi(e[1]),2!==e.length?o.push(new Lt(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Lt(`${r}[1]`,e[1],`string expected, ${n} found`))}return o}function On(t,e){const r=t.key,i=t.validateSpec,n=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return i({key:r,value:a,valueSpec:o.transition,style:n,styleSpec:o});const u=t.valueSpec||l[s];if(!u)return[new Lt(r,a,`unknown property "${s}"`)];let h;if("string"===Wi(a)&&$i(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new Lt(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&d.push(new Lt(r,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Hi(En(a))&&"identity"===In(a.type)&&d.push(new Lt(r,a,'"text-font" does not support identity functions'))),d.concat(i({key:t.key,value:a,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Fn(t){return On(t,"paint")}function Nn(t){return On(t,"layout")}function Bn(t){let e=[];const r=t.value,i=t.key,n=t.style,o=t.styleSpec;if("object"!==Wi(r))return[new Lt(i,r,`object expected, ${Wi(r)} found`)];r.type||r.ref||e.push(new Lt(i,r,'either "type" or "ref" is required'));let a=In(r.type);const s=In(r.ref);if(r.id){const o=In(r.id);for(let a=0;a<t.arrayIndex;a++){const t=n.layers[a];In(t.id)===o&&e.push(new Lt(i,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new Lt(i,r[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{In(e.id)===s&&(t=e)})),t?t.ref?e.push(new Lt(i,r.ref,"ref cannot reference another ref layer")):a=In(t.type):e.push(new Lt(i,r.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(r.source){const t=n.sources&&n.sources[r.source],o=t&&In(t.type);t?"vector"===o&&"raster"===a?e.push(new Lt(i,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a||"raster-dem"!==o&&"color-relief"===a?e.push(new Lt(i,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?e.push(new Lt(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==o||r["source-layer"]?"raster-dem"===o&&"hillshade"!==a&&"color-relief"!==a?e.push(new Lt(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new Lt(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Lt(i,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Lt(i,r.source,`source "${r.source}" not found`))}else e.push(new Lt(i,r,'missing required property "source"'));return e=e.concat(Pn({key:i,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:Dn,layout:t=>Pn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Nn(Dt({layerType:a},t))}}),paint:t=>Pn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Fn(Dt({layerType:a},t))}})}})),e}function jn(t){const e=t.value,r=t.key,i=Wi(e);return"string"!==i?[new Lt(r,e,`string expected, ${i} found`)]:[]}const Un={promoteId:function({key:t,value:e}){if("string"===Wi(e))return jn({key:t,value:e});{const r=[];for(const i in e)r.push(...jn({key:`${t}.${i}`,value:e[i]}));return r}}};function Vn(t){const e=t.value,r=t.key,i=t.styleSpec,n=t.style,o=t.validateSpec;if(!e.type)return[new Lt(r,e,'"type" is required')];const a=In(e.type);let s;switch(a){case"vector":case"raster":return s=Pn({key:r,value:e,valueSpec:i[`source_${a.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Un,validateSpec:o}),s;case"raster-dem":return s=function(t){var e;const r=null!==(e=t.sourceName)&&void 0!==e?e:"",i=t.value,n=t.styleSpec,o=n.source_raster_dem,a=t.style;let s=[];const l=Wi(i);if(void 0===i)return s;if("object"!==l)return s.push(new Lt("source_raster_dem",i,`object expected, ${l} found`)),s;const c="custom"===In(i.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const d in i)!c&&u.includes(d)?s.push(new Lt(d,i[d],`In "${r}": "${d}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[d]?s=s.concat(t.validateSpec({key:d,value:i[d],valueSpec:o[d],validateSpec:t.validateSpec,style:a,styleSpec:n})):s.push(new Lt(d,i[d],`unknown property "${d}"`));return s}({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=Pn({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:Un}),e.cluster)for(const t in e.clusterProperties){const[i,n]=e.clusterProperties[t],o="string"==typeof i?[i,["accumulated"],["get",t]]:i;s.push(...Mn({key:`${r}.${t}.map`,value:n,expressionContext:"cluster-map"})),s.push(...Mn({key:`${r}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Pn({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return Pn({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new Lt(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ln({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Gn(t){const e=t.value,r=t.styleSpec,i=r.light,n=t.style;let o=[];const a=Wi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Lt("light",e,`object expected, ${a} found`)]),o;for(const s in e){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&i[a[1]]&&i[a[1]].transition?t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r}):i[s]?t.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new Lt(s,e[s],`unknown property "${s}"`)])}return o}function $n(t){const e=t.value,r=t.styleSpec,i=r.sky,n=t.style,o=Wi(e);if(void 0===e)return[];if("object"!==o)return[new Lt("sky",e,`object expected, ${o} found`)];let a=[];for(const s in e)a=a.concat(i[s]?t.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:r}):[new Lt(s,e[s],`unknown property "${s}"`)]);return a}function qn(t){const e=t.value,r=t.styleSpec,i=r.terrain,n=t.style;let o=[];const a=Wi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Lt("terrain",e,`object expected, ${a} found`)]),o;for(const s in e)o=o.concat(i[s]?t.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new Lt(s,e[s],`unknown property "${s}"`)]);return o}function Zn(t){let e=[];const r=t.value,i=t.key;if(Array.isArray(r)){const n=[],o=[];for(const a in r)r[a].id&&n.includes(r[a].id)&&e.push(new Lt(i,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),n.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new Lt(i,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url),e=e.concat(Pn({key:`${i}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return jn({key:i,value:r})}function Wn(t){return e=t.value,Boolean(e)&&e.constructor===Object?[]:[new Lt(t.key,t.value,`object expected, ${Wi(t.value)} found`)];var e}const Hn={"*":()=>[],array:kn,boolean:function(t){const e=t.value,r=t.key,i=Wi(e);return"boolean"!==i?[new Lt(r,e,`boolean expected, ${i} found`)]:[]},number:Cn,color:Rn,constants:Tn,enum:Ln,filter:Dn,function:An,layer:Bn,object:Pn,source:Vn,light:Gn,sky:$n,terrain:qn,projection:function(t){const e=t.value,r=t.styleSpec,i=r.projection,n=t.style,o=Wi(e);if(void 0===e)return[];if("object"!==o)return[new Lt("projection",e,`object expected, ${o} found`)];let a=[];for(const s in e)a=a.concat(i[s]?t.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:r}):[new Lt(s,e[s],`unknown property "${s}"`)]);return a},projectionDefinition:function(t){const e=t.key;let r=t.value;r=r instanceof String?r.valueOf():r;const i=Wi(r);return"array"!==i||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(r)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(r)?["array","string"].includes(i)?[]:[new Lt(e,r,`projection expected, invalid type "${i}" found`)]:[new Lt(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:jn,formatted:function(t){return 0===jn(t).length?[]:Mn(t)},resolvedImage:function(t){return 0===jn(t).length?[]:Mn(t)},padding:function(t){const e=t.key,r=t.value;if("array"===Wi(r)){if(r.length<1||r.length>4)return[new Lt(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const i={type:"number"};let n=[];for(let o=0;o<r.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return n}return Cn({key:e,value:r,valueSpec:{}})},numberArray:function(t){const e=t.key,r=t.value;if("array"===Wi(r)){const i={type:"number"};if(r.length<1)return[new Lt(e,r,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<r.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return n}return Cn({key:e,value:r,valueSpec:{}})},colorArray:function(t){const e=t.key,r=t.value;if("array"===Wi(r)){if(r.length<1)return[new Lt(e,r,"array length at least 1 expected, length 0 found")];let t=[];for(let i=0;i<r.length;i++)t=t.concat(Rn({key:`${e}[${i}]`,value:r[i]}));return t}return Rn({key:e,value:r})},variableAnchorOffsetCollection:function(t){const e=t.key,r=t.value,i=Wi(r),n=t.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new Lt(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(Ln({key:`${e}[${a}]`,value:r[a],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(kn({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return o},sprite:Zn,state:Wn};function Xn(t){const e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Xn,r.expression&&Hi(In(e))?An(t):r.expression&&nn(En(e))?Mn(t):r.type&&Hn[r.type]?Hn[r.type](t):Pn(Dt({},t,{valueSpec:r.type?i[r.type]:r}))}function Jn(t){const e=t.value,r=t.key,i=jn(t);return i.length||(-1===e.indexOf("{fontstack}")&&i.push(new Lt(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new Lt(r,e,'"glyphs" url must include a "{range}" token'))),i}function Yn(t,e=xt){let r=[];return r=r.concat(Xn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xn,objectElementValidators:{glyphs:Jn,"*":()=>[]}})),t.constants&&(r=r.concat(Tn({key:"constants",value:t.constants}))),Qn(r)}function Kn(t){return function(e){return t({...e,validateSpec:Xn})}}function Qn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function to(t){return function(...e){return Qn(t.apply(this,e))}}Yn.source=to(Kn(Vn)),Yn.sprite=to(Kn(Zn)),Yn.glyphs=to(Kn(Jn)),Yn.light=to(Kn(Gn)),Yn.sky=to(Kn($n)),Yn.terrain=to(Kn(qn)),Yn.state=to(Kn(Wn)),Yn.layer=to(Kn(Bn)),Yn.filter=to(Kn(Dn)),Yn.paintProperty=to(Kn(Fn)),Yn.layoutProperty=to(Kn(Nn));const eo=Yn,ro=eo.light,io=eo.sky,no=eo.paintProperty,oo=eo.layoutProperty;function ao(t,e){let r=!1;if(e&&e.length)for(const i of e)t.fire(new vt(new Error(i.message))),r=!0;return r}class so{constructor(t,e,r){const i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(r=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],r=n[3+t+1];i.push(e===r?null:n.subarray(e,r))}const o=n[3+i.length+1];this.keys=n.subarray(n[3+i.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const n=r/e*t;this.min=-n,this.max=t+n}insert(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,i,n,o){this.cells[n].push(o)}query(t,e,r,i,n){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=i&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,r,i,this._queryCell,o,{},n),o}}_queryCell(t,e,r,i,n,o,a,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const h=l[u];if(void 0===a[h]){const l=4*h;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&r>=c[l+0]&&i>=c[l+1])?(a[h]=!0,o.push(n[h])):a[h]=!1}}}}_forEachCell(t,e,r,i,n,o,a,s){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,r,i,c,o,a,s))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;const i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let n=e;for(let o=0;o<t.length;o++){const e=t[o];i[3+o]=n,i.set(e,n),n+=e.length}return i[3+t.length]=n,i.set(this.keys,n),n+=this.keys.length,i[3+t.length+1]=n,i.set(this.bboxes,n),n+=this.bboxes.length,i.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new so(t.buffer)}}const lo={};function co(t,e,r={}){if(lo[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),lo[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}co("Object",Object),co("Set",Set),co("TransferableGridIndex",so),co("Color",Ce),co("Error",Error),co("AJAXError",dt),co("ResolvedImage",je),co("StylePropertyFunction",cn),co("StyleExpression",rn,{omit:["_evaluator"]}),co("ZoomDependentExpression",sn),co("ZoomConstantExpression",an),co("CompoundExpression",Li,{omit:["_evaluate"]});for(const xd in Ri)Ri[xd]._classRegistryKey||co(`Expression_${xd}`,Ri[xd]);function uo(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function ho(t){return t.$name||t.constructor._classRegistryKey}function po(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=ho(t);return!(!e||"Object"===e)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||uo(t)||Y(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function fo(t,e){if(po(t))return(uo(t)||Y(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const i of t)r.push(fo(i,e));return r}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const r=ho(t);if(!r)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!lo[r])throw new Error(`${r} is not registered.`);const{klass:i}=lo[r],n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(lo[r].omit.indexOf(i)>=0)continue;const o=t[i];n[i]=lo[r].shallow.indexOf(i)>=0?o:fo(o,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function mo(t){if(po(t))return t;if(Array.isArray(t))return t.map(mo);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=ho(t)||"Object";if(!lo[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=lo[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const i=Object.create(r.prototype);for(const n of Object.keys(t)){if("$name"===n)continue;const r=t[n];i[n]=lo[e].shallow.indexOf(n)>=0?r:mo(r)}return i}class go{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const _o={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function yo(t){for(const e of t)if(To(e.charCodeAt(0)))return!0;return!1}function vo(t){for(const e of t)if(!wo(e.charCodeAt(0)))return!1;return!0}function bo(t){const e=t.map((t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}})).filter((t=>t));return new RegExp(e.join("|"),"u")}const xo=bo(["Arab","Dupl","Mong","Ougr","Syrc"]);function wo(t){return!xo.test(String.fromCodePoint(t))}const So=bo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function To(t){return!(746!==t&&747!==t&&(t<4352||!(_o["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||_o["CJK Compatibility"](t)||_o["CJK Strokes"](t)||!(!_o["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_o["Enclosed CJK Letters and Months"](t)||_o["Ideographic Description Characters"](t)||_o.Kanbun(t)||_o.Katakana(t)&&12540!==t||!(!_o["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!_o["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||_o["Vertical Forms"](t)||_o["Yijing Hexagram Symbols"](t)||/\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\p{sc=Hang}/u.test(String.fromCodePoint(t))||So.test(String.fromCodePoint(t)))))}function Io(t){return!(To(t)||function(t){return!!(_o["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||_o["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||_o["Letterlike Symbols"](t)||_o["Number Forms"](t)||_o["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||_o["Control Pictures"](t)&&9251!==t||_o["Optical Character Recognition"](t)||_o["Enclosed Alphanumerics"](t)||_o["Geometric Shapes"](t)||_o["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||_o["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||_o["CJK Symbols and Punctuation"](t)||_o.Katakana(t)||_o["Private Use Area"](t)||_o["CJK Compatibility Forms"](t)||_o["Small Form Variants"](t)||_o["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}const Eo=bo(["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 Po(t){return Eo.test(String.fromCodePoint(t))}function ko(t,e){return!(!e&&Po(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||_o.Khmer(t))}function Co(t){for(const e of t)if(Po(e.charCodeAt(0)))return!0;return!1}const Ao=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Ao.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,r){return e(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;const e=t.pluginURL,i=new Promise((t=>{this.loadScriptResolve=t}));r(e);const n=new Promise((t=>setTimeout((()=>t()),this.TIMEOUT)));if(yield Promise.race([i,n]),this.isParsed()){const t={pluginStatus:"loaded",pluginURL:e};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)}))}};class Mo{constructor(t,e){this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new go,this.transition=e.transition||{},this.globalState=e.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new go,this.transition={},this.globalState={})}isSupportedScript(t){return function(t,e){for(const r of t)if(!ko(r.charCodeAt(0),e))return!1;return!0}(t,"loaded"===Ao.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Ro{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Hi(t))return new cn(t,e);if(nn(t)){const r=ln(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"color"===e.type&&"string"==typeof t?r=Ce.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"numberArray"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"colorArray"!==e.type||"string"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?r=Be.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(r=Ue.parse(t)):r=Oe.parse(t):r=ze.parse(t):r=De.parse(t),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Lo{constructor(t){this.property=t,this.value=new Ro(t,void 0)}transitioned(t,e){return new zo(this.property,this.value,e,U({},t.transition,this.transition),t.now)}untransitioned(){return new zo(this.property,this.value,null,{},0)}}class Do{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return q(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Lo(this._values[t].property)),this._values[t].value=new Ro(this._values[t].property,null===e?void 0:q(e))}getTransition(t){return q(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Lo(this._values[t].property)),this._values[t].transition=q(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const i=this.getTransition(e);void 0!==i&&(t[`${e}-transition`]=i)}return t}transitioned(t,e){const r=new Oo(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){const t=new Oo(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class zo{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),o=this.prior;if(o){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return o.possiblyEvaluate(t,e,r);{const a=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,r),n,O(a))}}return n}}class Oo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const i=new Bo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Fo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return q(this._values[t].value)}setValue(t,e){this._values[t]=new Ro(this._values[t].property,null===e?void 0:q(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const i=new Bo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}}class No{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}}class Bo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class jo{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){const i=_r[this.specification.type];return i?i(t,e,r):t}}class Uo{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,i){return new No(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new No(this,{kind:"constant",value:void 0},t.parameters);const i=_r[this.specification.type];if(i){const n=i(t.value.value,e.value.value,r);return new No(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,r,i,n,o){return"constant"===t.kind?t.value:t.evaluate(e,r,i,n,o)}}class Vo extends Uo{possiblyEvaluate(t,e,r,i){if(void 0===t.value)return new No(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},r,i),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new No(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new No(this,{kind:"constant",value:r},e)}return new No(this,t.expression,e)}evaluate(t,e,r,i,n,o){if("source"===t.kind){const a=t.evaluate(e,r,i,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Go{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Mo(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Mo(Math.floor(e.zoom),e)),t.expression.evaluate(new Mo(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class $o{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}}class qo{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const i=this.defaultPropertyValues[e]=new Ro(r,void 0),n=this.defaultTransitionablePropertyValues[e]=new Lo(r);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}}co("DataDrivenProperty",Uo),co("DataConstantProperty",jo),co("CrossFadedDataDrivenProperty",Vo),co("CrossFadedProperty",Go),co("ColorRampProperty",$o);const Zo="-transition";class Wo extends bt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=fn(t.filter)),e.layout&&(this._unevaluatedLayout=new Fo(e.layout)),e.paint)){this._transitionablePaint=new Do(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Bo(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=fn(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const e in this._unevaluatedLayout._values){const r=this._unevaluatedLayout._values[e];for(const e of r.getGlobalStateRefs())t.add(e)}for(const e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}setLayoutProperty(t,e,r={}){null!=e&&this._validate(oo,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Zo)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(no,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(Zo))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],i="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||n||i||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),$(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,i,n={}){return(!n||!1!==n.validate)&&ao(this,t.call(eo,{key:e,layerType:this.type,objectKey:r,value:i,styleSpec:xt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof No&&$i(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Ho={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Xo{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Jo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Yo(t,e=1){let r=0,i=0;return{members:t.map((t=>{const n=Ho[t.type].BYTES_PER_ELEMENT,o=r=Ko(r,Math.max(e,n)),a=t.components||1;return i=Math.max(i,n),r+=n*a,{name:t.name,type:t.type,components:a,offset:o}})),size:Ko(r,Math.max(i,e)),alignment:e}}function Ko(t,e){return Math.ceil(t/e)*e}class Qo extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,t}}Qo.prototype.bytesPerElement=4,co("StructArrayLayout2i4",Qo);class ta extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}}ta.prototype.bytesPerElement=6,co("StructArrayLayout3i6",ta);class ea extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,t}}ea.prototype.bytesPerElement=8,co("StructArrayLayout4i8",ea);class ra extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}ra.prototype.bytesPerElement=12,co("StructArrayLayout2i4i12",ra);class ia extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}ia.prototype.bytesPerElement=8,co("StructArrayLayout2i4ub8",ia);class na extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.float32[i+0]=e,this.float32[i+1]=r,t}}na.prototype.bytesPerElement=8,co("StructArrayLayout2f8",na);class oa extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,o,a,s,l,c)}emplace(t,e,r,i,n,o,a,s,l,c,u){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=i,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,t}}oa.prototype.bytesPerElement=20,co("StructArrayLayout10ui20",oa);class aa extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,r,i,n,o,a,s,l,c,u,h)}emplace(t,e,r,i,n,o,a,s,l,c,u,h,d){const p=12*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=i,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,t}}aa.prototype.bytesPerElement=24,co("StructArrayLayout4i4ui4i24",aa);class sa extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}}sa.prototype.bytesPerElement=12,co("StructArrayLayout3f12",sa);class la extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}la.prototype.bytesPerElement=4,co("StructArrayLayout1ul4",la);class ca extends Jo{_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(t,e,r,i,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,i,n,o,a,s,l)}emplace(t,e,r,i,n,o,a,s,l,c){const u=10*t,h=5*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=i,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=a,this.uint32[h+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,t}}ca.prototype.bytesPerElement=20,co("StructArrayLayout6i1ul2ui20",ca);class ua extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}ua.prototype.bytesPerElement=12,co("StructArrayLayout2i2i2i12",ua);class ha extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,i,n)}emplace(t,e,r,i,n,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.int16[s+6]=n,this.int16[s+7]=o,t}}ha.prototype.bytesPerElement=16,co("StructArrayLayout2f1f2i16",ha);class da extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=16*t,l=4*t,c=8*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=a,t}}da.prototype.bytesPerElement=16,co("StructArrayLayout2ub2f2i16",da);class pa extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}}pa.prototype.bytesPerElement=6,co("StructArrayLayout3ui6",pa);class fa extends Jo{_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(t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g)}emplace(t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_){const y=24*t,v=12*t,b=48*t;return this.int16[y+0]=e,this.int16[y+1]=r,this.uint16[y+2]=i,this.uint16[y+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=u,this.float32[v+7]=h,this.float32[v+8]=d,this.uint8[b+36]=p,this.uint8[b+37]=f,this.uint8[b+38]=m,this.uint32[v+10]=g,this.int16[y+22]=_,t}}fa.prototype.bytesPerElement=48,co("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",fa);class ma extends Jo{_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(t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,S,T,I,E,P){const k=this.length;return this.resize(k+1),this.emplace(k,t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,S,T,I,E,P)}emplace(t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,S,T,I,E,P,k){const C=32*t,A=16*t;return this.int16[C+0]=e,this.int16[C+1]=r,this.int16[C+2]=i,this.int16[C+3]=n,this.int16[C+4]=o,this.int16[C+5]=a,this.int16[C+6]=s,this.int16[C+7]=l,this.uint16[C+8]=c,this.uint16[C+9]=u,this.uint16[C+10]=h,this.uint16[C+11]=d,this.uint16[C+12]=p,this.uint16[C+13]=f,this.uint16[C+14]=m,this.uint16[C+15]=g,this.uint16[C+16]=_,this.uint16[C+17]=y,this.uint16[C+18]=v,this.uint16[C+19]=b,this.uint16[C+20]=x,this.uint16[C+21]=w,this.uint16[C+22]=S,this.uint32[A+12]=T,this.float32[A+13]=I,this.float32[A+14]=E,this.uint16[C+30]=P,this.uint16[C+31]=k,t}}ma.prototype.bytesPerElement=64,co("StructArrayLayout8i15ui1ul2f2ui64",ma);class ga extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}ga.prototype.bytesPerElement=4,co("StructArrayLayout1f4",ga);class _a extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}}_a.prototype.bytesPerElement=12,co("StructArrayLayout1ui2f12",_a);class ya extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=r,this.uint16[n+3]=i,t}}ya.prototype.bytesPerElement=8,co("StructArrayLayout1ul2ui8",ya);class va extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}}va.prototype.bytesPerElement=4,co("StructArrayLayout2ui4",va);class ba extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}ba.prototype.bytesPerElement=2,co("StructArrayLayout1ui2",ba);class xa extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,t}}xa.prototype.bytesPerElement=16,co("StructArrayLayout4f16",xa);class wa extends Xo{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 l(this.anchorPointX,this.anchorPointY)}}wa.prototype.size=20;class Sa extends ca{get(t){return new wa(this,t)}}co("CollisionBoxArray",Sa);class Ta extends Xo{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ta.prototype.size=48;class Ia extends fa{get(t){return new Ta(this,t)}}co("PlacedSymbolArray",Ia);class Ea extends Xo{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}Ea.prototype.size=64;class Pa extends ma{get(t){return new Ea(this,t)}}co("SymbolInstanceArray",Pa);class ka extends ga{getoffsetX(t){return this.float32[1*t+0]}}co("GlyphOffsetArray",ka);class Ca extends ta{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}co("SymbolLineVertexArray",Ca);class Aa extends Xo{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]}}Aa.prototype.size=12;class Ma extends _a{get(t){return new Aa(this,t)}}co("TextAnchorOffsetArray",Ma);class Ra extends Xo{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]}}Ra.prototype.size=8;class La extends ya{get(t){return new Ra(this,t)}}co("FeatureIndexArray",La);class Da extends Qo{}class za extends Qo{}class Oa extends Qo{}class Fa extends ra{}class Na extends ia{}class Ba extends na{}class ja extends oa{}class Ua extends aa{}class Va extends sa{}class Ga extends la{}class $a extends ua{}class qa extends da{}class Za extends pa{}class Wa extends va{}const Ha=Yo([{name:"a_pos",components:2,type:"Int16"}],4),{members:Xa}=Ha;class Ja{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,r,i){const n=this.segments[this.segments.length-1];return t>Ja.MAX_VERTEX_ARRAY_LENGTH&&W(`Max vertices per segment is ${Ja.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Ja.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>Ja.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i?this.createNewSegment(e,r,i):n}createNewSegment(t,e,r){const i={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(i.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(t,e,r){return this.prepareSegment(0,t,e,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,i){return new Ja([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}}function Ya(t,e){return 256*(t=B(Math.floor(t),0,255))+B(Math.floor(e),0,255)}Ja.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,co("SegmentVector",Ja);const Ka=Yo([{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 Qa,ts,es,rs={exports:{}},is={exports:{}},ns={exports:{}},os=function(){if(es)return rs.exports;es=1;var t=(Qa||(Qa=1,is.exports=function(t,e){var r,i,n,o,a,s,l,c;for(i=t.length-(r=3&t.length),n=e,a=3432918353,s=461845907,c=0;c<i;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),is.exports),e=(ts||(ts=1,ns.exports=function(t,e){for(var r,i=t.length,n=e^i,o=0;i>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),ns.exports);return rs.exports=t,rs.exports.murmur3=t,rs.exports.murmur2=e,rs.exports}(),as=r(os);class ss{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,i){this.ids.push(ls(t)),this.positions.push(e,r,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=ls(t);let r=0,i=this.ids.length-1;for(;r<i;){const t=r+i>>1;this.ids[t]>=e?i=t:r=t+1}const n=[];for(;this.ids[r]===e;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(t,e){const r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return cs(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){const e=new ss;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ls(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:as(String(t))}function cs(t,e,r,i){for(;r<i;){const n=t[r+i>>1];let o=r-1,a=i+1;for(;;){do{o++}while(t[o]<n);do{a--}while(t[a]>n);if(o>=a)break;us(t,o,a),us(e,3*o,3*a),us(e,3*o+1,3*a+1),us(e,3*o+2,3*a+2)}a-r<i-a?(cs(t,e,r,a),r=a+1):(cs(t,e,a+1,i),i=a)}}function us(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}co("FeaturePositionMap",ss);class hs{constructor(t,e){this.gl=t.gl,this.location=e}}class ds extends hs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class ps extends hs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class fs extends hs{constructor(t,e){super(t,e),this.current=Ce.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const ms=new Float32Array(16);function gs(t){return[Ya(255*t.r,255*t.g),Ya(255*t.b,255*t.a)]}class _s{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new fs(t,e):new ds(t,e)}}class ys{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,i){const n="u_pattern_to"===i?this.patternTo:"u_pattern_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,r){return"u_pattern"===r.substr(0,9)?new ps(t,e):new ds(t,e)}}class vs{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new i}populatePaintArray(t,e,r,i,n){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Mo(0),e,{},i,[],n);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,r,i){const n=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(t,e,n)}_setPaintValue(t,e,r){if("color"===this.type){const i=gs(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class bs{constructor(t,e,r,i,n,o){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,r,i,n){const o=this.expression.evaluate(new Mo(this.zoom),e,{},i,[],n),a=this.expression.evaluate(new Mo(this.zoom+1),e,{},i,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,r,i){const n=this.expression.evaluate({zoom:this.zoom},r,i),o=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(t,e,n,o)}_setPaintValue(t,e,r,i){if("color"===this.type){const n=gs(r),o=gs(i);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=B(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new ds(t,e)}}class xs{constructor(t,e,r,i,n,o){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){const i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],n)}_setPaintValues(t,e,r,i){if(!i||!r)return;const{min:n,mid:o,max:a}=r,s=i[n],l=i[o],c=i[a];if(s&&l&&c)for(let u=t;u<e;u++)this.zoomInPaintVertexArray.emplace(u,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(u,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ka.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ka.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ws{constructor(t,e,r){this.binders={},this._buffers=[];const i=[];for(const n in t.paint._values){if(!r(n))continue;const o=t.paint.get(n);if(!(o instanceof No&&$i(o.property.specification)))continue;const a=Ts(n,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[n]=h?new ys(s.value,a):new _s(s.value,a,l),i.push(`/u_${n}`);else if("source"===s.kind||h){const r=Is(n,l,"source");this.binders[n]=h?new xs(s,l,c,e,r,t.id):new vs(s,a,l,r),i.push(`/a_${n}`)}else{const t=Is(n,l,"composite");this.binders[n]=new bs(s,a,l,c,e,t),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof vs||e instanceof bs?e.maxValue:0}populatePaintArrays(t,e,r,i,n){for(const o in this.binders){const a=this.binders[o];(a instanceof vs||a instanceof bs||a instanceof xs)&&a.populatePaintArray(t,e,r,i,n)}}setConstantPatternPositions(t,e){for(const r in this.binders){const i=this.binders[r];i instanceof ys&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof vs||l instanceof bs||l instanceof xs)&&!0===l.expression.isStateDependent){const c=i.paint.get(r);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],n),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof _s||r instanceof ys)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof vs||r instanceof bs)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof xs)for(let e=0;e<Ka.members.length;e++)t.push(Ka.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof _s||r instanceof ys||r instanceof bs)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof _s||n instanceof ys||n instanceof bs)for(const o of n.uniformNames)if(e[o]){const a=n.getBinding(t,e[o],o);r.push({name:o,property:i,binding:a})}}return r}setUniforms(t,e,r,i){for(const{name:n,property:o,binding:a}of e)this.binders[o].setUniform(a,i,r.get(o),n)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof xs){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof vs||r instanceof bs)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof vs||r instanceof bs||r instanceof xs)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof vs||e instanceof bs||e instanceof xs)&&e.destroy()}}}class Ss{constructor(t,e,r=()=>!0){this.programConfigurations={};for(const i of t)this.programConfigurations[i.id]=new ws(i,e,r);this.needsUpload=!1,this._featureMap=new ss,this._bufferOffset=0}populatePaintArrays(t,e,r,i,n,o){for(const a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,i,n,o);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(const n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ts(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Is(t,e,r){const i={color:{source:na,composite:xa},number:{source:ga,composite:na}},n=function(t){return{"line-pattern":{source:ja,composite:ja},"fill-pattern":{source:ja,composite:ja},"fill-extrusion-pattern":{source:ja,composite:ja}}[t]}(t);return n&&n[r]||i[e][r]}co("ConstantBinder",_s),co("CrossFadedConstantBinder",ys),co("SourceExpressionBinder",vs),co("CrossFadedCompositeBinder",xs),co("CompositeExpressionBinder",bs),co("ProgramConfiguration",ws,{omit:["_buffers"]}),co("ProgramConfigurationSet",Ss);const Es=Math.pow(2,14)-1,Ps=-Es-1;function ks(t){const e=R/t.extent,r=t.loadGeometry();for(let i=0;i<r.length;i++){const t=r[i];for(let r=0;r<t.length;r++){const i=t[r],n=Math.round(i.x*e),o=Math.round(i.y*e);i.x=B(n,Ps,Es),i.y=B(o,Ps,Es),(n<i.x||n>i.x+1||o<i.y||o>i.y+1)&&W("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Cs(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ks(t):[]}}const As=-32768;function Ms(t,e,r,i,n){t.emplaceBack(As+8*e+i,As+8*r+n)}class Rs{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new za,this.indexArray=new Za,this.segments=new Ja,this.programConfigurations=new Ss(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){const i=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===i.type;if("circle"===i.type){const t=i;o=t.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===t.paint.get("circle-pitch-alignment")}const l=s?e.subdivisionGranularity.circle:1;for(const{feature:c,id:u,index:h,sourceLayerIndex:d}of t){const t=this.layers[0]._featureFilter.needGeometry,e=Cs(c,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),e,r))continue;const i=a?o.evaluate(e,{},r):void 0,s={id:u,properties:c.properties,type:c.type,sourceLayerIndex:d,index:h,geometry:t?e.geometry:ks(c),patterns:{},sortKey:i};n.push(s)}a&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const c of n){const{geometry:i,index:n,sourceLayerIndex:o}=c,a=t[n].feature;this.addFeature(c,i,n,r,l),e.featureIndex.insert(a,i,n,o,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Xa),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const a=o.length;for(const s of e)for(const e of s){const r=e.x,i=e.y;if(r<0||r>=R||i<0||i>=R)continue;const n=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,t.sortKey),s=n.vertexLength;for(let t=0;t<a;t++)for(let e=0;e<a;e++)Ms(this.layoutVertexArray,r,i,o[e],o[t]);for(let t=0;t<a-1;t++)for(let e=0;e<a-1;e++){const r=s+t*a+e,i=s+(t+1)*a+e;this.indexArray.emplaceBack(r,i+1,r+1),this.indexArray.emplaceBack(r,i,i+1)}n.vertexLength+=a*a,n.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},i)}}function Ls(t,e){for(let r=0;r<t.length;r++)if(Vs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Vs(t,e[r]))return!0;return!!Fs(t,e)}function Ds(t,e,r){return!!Vs(t,e)||!!Bs(e,t,r)}function zs(t,e){if(1===t.length)return Us(e,t[0]);for(let r=0;r<e.length;r++){const i=e[r];for(let e=0;e<i.length;e++)if(Vs(t,i[e]))return!0}for(let r=0;r<t.length;r++)if(Us(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Fs(t,e[r]))return!0;return!1}function Os(t,e,r){if(t.length>1){if(Fs(t,e))return!0;for(let i=0;i<e.length;i++)if(Bs(e[i],t,r))return!0}for(let i=0;i<t.length;i++)if(Bs(t[i],e,r))return!0;return!1}function Fs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1];for(let t=0;t<e.length-1;t++)if(Ns(i,n,e[t],e[t+1]))return!0}return!1}function Ns(t,e,r,i){return H(t,r,i)!==H(e,r,i)&&H(t,e,r)!==H(t,e,i)}function Bs(t,e,r){const i=r*r;if(1===e.length)return t.distSqr(e[0])<i;for(let n=1;n<e.length;n++)if(js(t,e[n-1],e[n])<i)return!0;return!1}function js(t,e,r){const i=e.distSqr(r);if(0===i)return t.distSqr(e);const n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return t.distSqr(n<0?e:n>1?r:r.sub(e)._mult(n)._add(e))}function Us(t,e){let r,i,n,o=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)i=r[t],n=r[a],i.y>e.y!=n.y>e.y&&e.x<(n.x-i.x)*(e.y-i.y)/(n.y-i.y)+i.x&&(o=!o)}return o}function Vs(t,e){let r=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){const o=t[i],a=t[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function Gs(t,e,r){const i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;const o=H(t,e,r[0]);return o!==H(t,e,r[1])||o!==H(t,e,r[2])||o!==H(t,e,r[3])}function $s(t,e,r){const i=e.paint.get(t).value;return"constant"===i.kind?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function qs(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Zs(t,e,r,i,n){if(!e[0]&&!e[1])return t;const o=l.convert(e)._mult(n);"viewport"===r&&o._rotate(-i);const a=[];for(let s=0;s<t.length;s++)a.push(t[s].sub(o));return a}let Ws,Hs;co("CircleBucket",Rs,{omit:["layers"]});var Xs={get paint(){return Hs=Hs||new qo({"circle-radius":new Uo(xt.paint_circle["circle-radius"]),"circle-color":new Uo(xt.paint_circle["circle-color"]),"circle-blur":new Uo(xt.paint_circle["circle-blur"]),"circle-opacity":new Uo(xt.paint_circle["circle-opacity"]),"circle-translate":new jo(xt.paint_circle["circle-translate"]),"circle-translate-anchor":new jo(xt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new jo(xt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new jo(xt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Uo(xt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Uo(xt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Uo(xt.paint_circle["circle-stroke-opacity"])})},get layout(){return Ws=Ws||new qo({"circle-sort-key":new Uo(xt.layout_circle["circle-sort-key"])})}};class Js extends Wo{constructor(t){super(t,Xs)}createBucket(t){return new Rs(t)}queryRadius(t){const e=t;return $s("circle-radius",this,e)+$s("circle-stroke-width",this,e)+qs(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=Zs(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),u="map"===this.paint.get("circle-pitch-alignment"),h=u?l:function(t,e,r,i){return t.map((t=>Ys(t,e,r,i)))}(l,n,a,s),d=u?c*o:c;for(const p of i)for(const t of p){const e=u?t:Ys(t,n,a,s);let r=d;const i=n.projectTileCoordinates(t.x,t.y,a,s).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=i/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=n.cameraToCenterDistance/i),Ds(h,e,r))return!0}return!1}}function Ys(t,e,r,i){const n=e.projectTileCoordinates(t.x,t.y,r,i).point;return new l((.5*n.x+.5)*e.width,(.5*-n.y+.5)*e.height)}class Ks extends Rs{}let Qs;co("HeatmapBucket",Ks,{omit:["layers"]});var tl={get paint(){return Qs=Qs||new qo({"heatmap-radius":new Uo(xt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Uo(xt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new jo(xt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new $o(xt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new jo(xt.paint_heatmap["heatmap-opacity"])})}};function el(t,{width:e,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`)}else n=new Uint8Array(e*r*i);return t.width=e,t.height=r,t.data=n,t}function rl(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;const n=el({},{width:e,height:r},i);il(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function il(t,e,r,i,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((r.y+l)*t.width+r.x)*o,u=((i.y+l)*e.width+i.x)*o;for(let t=0;t<n.width*o;t++)s[u+t]=a[c+t]}return e}class nl{constructor(t,e){el(this,t,1,e)}resize(t){rl(this,t,1)}clone(){return new nl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){il(t,e,r,i,n,1)}}class ol{constructor(t,e){el(this,t,4,e)}resize(t){rl(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new ol({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){il(t,e,r,i,n,4)}setPixel(t,e,r){const i=4*(t*this.width+e);this.data[i+0]=Math.round(255*r.r/r.a),this.data[i+1]=Math.round(255*r.g/r.a),this.data[i+2]=Math.round(255*r.b/r.a),this.data[i+3]=Math.round(255*r.a)}}function al(t){const e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new ol({width:r,height:i});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const o=(i,o,a)=>{e[t.evaluationKey]=a;const s=t.expression.evaluate(e);n.setPixel(i/4/r,o/4,s)};if(t.clips)for(let a=0,s=0;a<i;++a,s+=4*r)for(let e=0,i=0;e<r;e++,i+=4){const n=e/(r-1),{start:l,end:c}=t.clips[a];o(s,i,l*(1-n)+c*n)}else for(let a=0,s=0;a<r;a++,s+=4)o(0,s,a/(r-1));return n}co("AlphaImage",nl),co("RGBAImage",ol);const sl="big-fb";class ll extends Wo{createBucket(t){return new Ks(t)}constructor(t){super(t,tl),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=al({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(sl)&&this.heatmapFbos.delete(sl)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let cl;var ul={get paint(){return cl=cl||new qo({"hillshade-illumination-direction":new jo(xt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new jo(xt.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new jo(xt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new jo(xt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new jo(xt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new jo(xt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new jo(xt.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new jo(xt.paint_hillshade["hillshade-method"])})}};class hl extends Wo{constructor(t){super(t,ul),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values;const n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));const o=e.map(it);return{directionRadians:t.map(it),altitudeRadians:o,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}let dl;var pl={get paint(){return dl=dl||new qo({"color-relief-opacity":new jo(xt["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new $o(xt["paint_color-relief"]["color-relief-color"])})}};class fl{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)}update(t,e,r){const{width:i,height:n}=t,o=!(this.size&&this.size[0]===i&&this.size[1]===n||r),{context:a}=this,{gl:s}=a;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[i,n],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Y(t)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,i,n,0,this.format,s.UNSIGNED_BYTE,t.data);else{const{x:e,y:o}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Y(t)?s.texSubImage2D(s.TEXTURE_2D,0,e,o,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,e,o,i,n,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,e,r){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class ml{constructor(t,e,r,i=1,n=1,o=1,a=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void W(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const s=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=n,this.blueFactor=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let l=0;l<s;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(s,l)]=this.data[this._idx(s-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,s)]=this.data[this._idx(l,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let l=0;l<s;l++)for(let t=0;t<s;t++){const e=this.get(l,t);e>this.max&&(this.max=e),e<this.min&&(this.min=e)}}get(t,e){const r=new Uint8Array(this.data.buffer),i=4*this._idx(t,e);return this.unpack(r[i],r[i+1],r[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return gl(t,this.getUnpackVector())}getPixels(){return new ol({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,n=e*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:i=n-1;break;case 1:n=i+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-r*this.dim;for(let c=o;c<a;c++)for(let e=i;e<n;e++)this.data[this._idx(e,c)]=t.data[this._idx(e+s,c+l)]}}function gl(t,e){const r=e[0],i=e[1],n=e[2],o=e[3],a=Math.min(r,i,n),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/i)%256,b:Math.floor(s*a/n)%256}}co("DEMData",ml);class _l extends Wo{constructor(t){super(t,pl)}_createColorRamp(t){const e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof an&&r._styleExpression.expression instanceof mr){this.colorRampExpression=r;const t=r._styleExpression.expression;e.elevationStops=t.labels,e.colorStops=[];for(const r of e.elevationStops)e.colorStops.push(t.evaluate({globals:{elevation:r}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[Ce.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;const i={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let o=0;o<e.elevationStops.length-.5;o+=n)i.elevationStops.push(e.elevationStops[Math.round(o)]),i.colorStops.push(e.colorStops[Math.round(o)]);return W(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const i=this._createColorRamp(e),n=new ol({width:i.colorStops.length,height:1}),o=new ol({width:i.colorStops.length,height:1});for(let a=0;a<i.elevationStops.length;a++){const t=gl(i.elevationStops[a],r);o.setPixel(0,a,new Ce(t.r/255,t.g/255,t.b/255,1)),n.setPixel(0,a,i.colorStops[a])}return this.colorRampTextures={elevationTexture:new fl(t,o,t.gl.RGBA),colorTexture:new fl(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return"none"!==this.visibility&&!!this.colorRampTextures}}const yl=Yo([{name:"a_pos",components:2,type:"Int16"}],4),{members:vl}=yl;function bl(t,e,r){const i=r.patternDependencies;let n=!1;for(const o of e){const e=o.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const r=e.constantOr(null);r&&(n=!0,i[r.to]=!0,i[r.from]=!0)}return n}function xl(t,e,r,i,n){const o=n.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:i-1},r,{},n.availableImages),s=e.evaluate({zoom:i},r,{},n.availableImages),l=e.evaluate({zoom:i+1},r,{},n.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[t]=!0,o[s]=!0,o[l]=!0,r.patterns[a.id]={min:t,mid:s,max:l}}}return r}function wl(t,e,r,i,n){let o;if(n===function(t,e,r,i){let n=0;for(let o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(let a=e;a<r;a+=i)o=$l(a/i|0,t[a],t[a+1],o);else for(let a=r-i;a>=e;a-=i)o=$l(a/i|0,t[a],t[a+1],o);return o&&Nl(o,o.next)&&(ql(o),o=o.next),o}function Sl(t,e){if(!t)return t;e||(e=t);let r,i=t;do{if(r=!1,i.steiner||!Nl(i,i.next)&&0!==Fl(i.prev,i,i.next))i=i.next;else{if(ql(i),i=e=i.prev,i===i.next)break;r=!0}}while(r||i!==e);return e}function Tl(t,e,r,i,n,o,a){if(!t)return;!a&&o&&function(t,e,r,i){let n=t;do{0===n.z&&(n.z=Rl(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let e,r=1;do{let i,n=t;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let t=0;t<r&&(s++,a=a.nextZ,a);t++);let l=r;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1)}(n)}(t,i,n,o);let s=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(o?El(t,i,n,o):Il(t))e.push(l.i,t.i,c.i),ql(t),t=c.next,s=c.next;else if((t=c)===s){a?1===a?Tl(t=Pl(Sl(t),e),e,r,i,n,o,2):2===a&&kl(t,e,r,i,n,o):Tl(Sl(t),e,r,i,n,o,1);break}}}function Il(t){const e=t.prev,r=t,i=t.next;if(Fl(e,r,i)>=0)return!1;const n=e.x,o=r.x,a=i.x,s=e.y,l=r.y,c=i.y,u=Math.min(n,o,a),h=Math.min(s,l,c),d=Math.max(n,o,a),p=Math.max(s,l,c);let f=i.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&zl(n,s,o,l,a,c,f.x,f.y)&&Fl(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function El(t,e,r,i){const n=t.prev,o=t,a=t.next;if(Fl(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,u=n.y,h=o.y,d=a.y,p=Math.min(s,l,c),f=Math.min(u,h,d),m=Math.max(s,l,c),g=Math.max(u,h,d),_=Rl(p,f,e,r,i),y=Rl(m,g,e,r,i);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=_&&b&&b.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&zl(s,u,l,h,c,d,v.x,v.y)&&Fl(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&zl(s,u,l,h,c,d,b.x,b.y)&&Fl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&zl(s,u,l,h,c,d,v.x,v.y)&&Fl(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&zl(s,u,l,h,c,d,b.x,b.y)&&Fl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Pl(t,e){let r=t;do{const i=r.prev,n=r.next.next;!Nl(i,n)&&Bl(i,r,r.next,n)&&Vl(i,n)&&Vl(n,i)&&(e.push(i.i,r.i,n.i),ql(r),ql(r.next),r=t=n),r=r.next}while(r!==t);return Sl(r)}function kl(t,e,r,i,n,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Ol(a,t)){let s=Gl(a,t);return a=Sl(a,a.next),s=Sl(s,s.next),Tl(a,e,r,i,n,o,0),void Tl(s,e,r,i,n,o,0)}t=t.next}a=a.next}while(a!==t)}function Cl(t,e){let r=t.x-e.x;return 0===r&&(r=t.y-e.y,0===r)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function Al(t,e){const r=function(t,e){let r=e;const i=t.x,n=t.y;let o,a=-1/0;if(Nl(t,r))return r;do{if(Nl(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){const t=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=i&&t>a&&(a=t,o=r.x<r.next.x?r:r.next,t===i))return o}r=r.next}while(r!==e);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;r=o;do{if(i>=r.x&&r.x>=l&&i!==r.x&&Dl(n<c?i:a,n,l,c,n<c?a:i,n,r.x,r.y)){const e=Math.abs(n-r.y)/(i-r.x);Vl(r,t)&&(e<u||e===u&&(r.x>o.x||r.x===o.x&&Ml(o,r)))&&(o=r,u=e)}r=r.next}while(r!==s);return o}(t,e);if(!r)return e;const i=Gl(r,t);return Sl(i,i.next),Sl(r,r.next)}function Ml(t,e){return Fl(t.prev,t,e.prev)<0&&Fl(e.next,t,t.next)<0}function Rl(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ll(t){let e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Dl(t,e,r,i,n,o,a,s){return(n-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(i-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(n-a)*(i-s)}function zl(t,e,r,i,n,o,a,s){return!(t===a&&e===s)&&Dl(t,e,r,i,n,o,a,s)}function Ol(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Bl(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Vl(t,e)&&Vl(e,t)&&function(t,e){let r=t,i=!1;const n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(Fl(t.prev,t,e.prev)||Fl(t,e.prev,e))||Nl(t,e)&&Fl(t.prev,t,t.next)>0&&Fl(e.prev,e,e.next)>0)}function Fl(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Nl(t,e){return t.x===e.x&&t.y===e.y}function Bl(t,e,r,i){const n=Ul(Fl(t,e,r)),o=Ul(Fl(t,e,i)),a=Ul(Fl(r,i,t)),s=Ul(Fl(r,i,e));return n!==o&&a!==s||!(0!==n||!jl(t,r,e))||!(0!==o||!jl(t,i,e))||!(0!==a||!jl(r,t,i))||!(0!==s||!jl(r,e,i))}function jl(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ul(t){return t>0?1:t<0?-1:0}function Vl(t,e){return Fl(t.prev,t,t.next)<0?Fl(t,e,t.next)>=0&&Fl(t,t.prev,e)>=0:Fl(t,e,t.prev)<0||Fl(t,t.next,e)<0}function Gl(t,e){const r=Zl(t.i,t.x,t.y),i=Zl(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function $l(t,e,r,i){const n=Zl(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function ql(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Zl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Wl{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Hl{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Hl.noSubdivision=new Hl({fill:new Wl(0,0),line:new Wl(0,0),tile:new Wl(0,0),stencil:new Wl(0,0),circle:1}),co("SubdivisionGranularityExpression",Wl),co("SubdivisionGranularitySetting",Hl);const Xl=-32768,Jl=32767;class Yl{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=R/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=0|Math.round(t),i=0|Math.round(e),n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(r,i),o}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const r=[];for(let i=0;i<e.length;i+=3){const n=e[i],o=e[i+1],a=e[i+2],s=t[2*n],l=t[2*n+1];(t[2*o]-s)*(t[2*a+1]-l)-(t[2*o+1]-l)*(t[2*a]-s)>0?(r.push(n),r.push(a),r.push(o)):(r.push(n),r.push(o),r.push(a))}return r}(this._vertexBuffer,t);const e=[],r=t.length;for(let i=0;i<r;i+=3){const r=[t[i+0],t[i+1],t[i+2]],n=[this._vertexBuffer[2*t[i+0]+0],this._vertexBuffer[2*t[i+0]+1],this._vertexBuffer[2*t[i+1]+0],this._vertexBuffer[2*t[i+1]+1],this._vertexBuffer[2*t[i+2]+0],this._vertexBuffer[2*t[i+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=n[2*t],r=n[2*t+1];o=Math.min(o,e),s=Math.max(s,e),a=Math.min(a,r),l=Math.max(l,r)}if(o===s||a===l)continue;const c=Math.floor(o/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),h=Math.floor(a/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(c!==u||h!==d)for(let t=h;t<d;t++){const i=this._scanlineGenerateVertexRingForCellRow(t,n,r);tc(this._vertexBuffer,i,e)}else e.push(...r)}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){const i=t*this._granularityCellSize,n=i+this._granularityCellSize,o=[];for(let a=0;a<3;a++){const t=e[2*a],s=e[2*a+1],l=e[2*(a+1)%6],c=e[(2*(a+1)+1)%6],u=e[2*(a+2)%6],h=e[(2*(a+2)+1)%6],d=l-t,p=c-s,f=0===d,m=0===p,g=(i-s)/p,_=(n-s)/p,y=Math.min(g,_),v=Math.max(g,_);if(!m&&(y>=1||v<=0)||m&&(s<i||s>n)){c>=i&&c<=n&&o.push(r[(a+1)%3]);continue}!m&&y>0&&o.push(this._vertexToIndex(t+d*y,s+p*y));const b=t+d*Math.max(y,0),x=t+d*Math.min(v,1);f||this._generateIntraEdgeVertices(o,t,s,l,c,b,x),!m&&v<1&&o.push(this._vertexToIndex(t+d*v,s+p*v)),(m||c>=i&&c<=n)&&o.push(r[(a+1)%3]),!m&&(c<=i||c>=n)&&this._generateInterEdgeVertices(o,t,s,l,c,u,h,x,i,n)}return o}_generateIntraEdgeVertices(t,e,r,i,n,o,a){const s=i-e,l=n-r,c=0===l,u=c?Math.min(e,i):Math.min(o,a),h=c?Math.max(e,i):Math.max(o,a),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?e<i:o<a)for(let f=d;f<=p;f++){const i=f*this._granularityCellSize;t.push(this._vertexToIndex(i,r+l*(i-e)/s))}else for(let f=p;f>=d;f--){const i=f*this._granularityCellSize;t.push(this._vertexToIndex(i,r+l*(i-e)/s))}}_generateInterEdgeVertices(t,e,r,i,n,o,a,s,l,c){const u=n-r,h=o-i,d=a-n,p=(l-n)/d,f=(c-n)/d,m=Math.min(p,f),g=Math.max(p,f),_=i+h*m;let y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,b=s<_;const x=0===d;if(x&&(a===l||a===c))return;if(x||m>=1||g<=0){const t=r-a,i=o+(e-o)*Math.min((l-a)/t,(c-a)/t);y=Math.floor(Math.min(i,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(i,s)/this._granularityCellSize)-1,b=s<i}const w=u>0?c:l;if(b)for(let S=y;S<=v;S++)t.push(this._vertexToIndex(S*this._granularityCellSize,w));else for(let S=v;S>=y;S--)t.push(this._vertexToIndex(S*this._granularityCellSize,w))}_generateOutline(t){const e=[];for(const r of t){const t=Ql(r,this._granularity,!0),i=this._pointArrayToIndices(t),n=[];for(let e=1;e<i.length;e++)n.push(i[e-1]),n.push(i[e]);e.push(n)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const r=t[e+1];r===Xl&&(t[e+1]=-32767),r===Jl&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,i,n,o){i>n!=(o===Xl)?(t.push(e),t.push(r),t.push(this._vertexToIndex(i,o)),t.push(r),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(i,o))):(t.push(r),t.push(e),t.push(this._vertexToIndex(i,o)),t.push(this._vertexToIndex(n,o)),t.push(r),t.push(this._vertexToIndex(i,o)))}_fillPoles(t,e,r){const i=this._vertexBuffer,n=R,o=t.length;for(let a=2;a<o;a+=3){const o=t[a-2],s=t[a-1],l=t[a],c=i[2*o],u=i[2*o+1],h=i[2*s],d=i[2*s+1],p=i[2*l],f=i[2*l+1];e&&(0===u&&0===d&&this._generatePoleQuad(t,o,s,c,h,Xl),0===d&&0===f&&this._generatePoleQuad(t,s,l,h,p,Xl),0===f&&0===u&&this._generatePoleQuad(t,l,o,p,c,Xl)),r&&(u===n&&d===n&&this._generatePoleQuad(t,o,s,c,h,Jl),d===n&&f===n&&this._generatePoleQuad(t,s,l,h,p,Jl),f===n&&u===n&&this._generatePoleQuad(t,l,o,p,c,Jl))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:i}=function(t){const e=[],r=[];for(const i of t)if(0!==i.length){i!==t[0]&&e.push(r.length/2);for(let t=0;t<i.length;t++)r.push(i[t].x),r.push(i[t].y)}return{flattened:r,holeIndices:e}}(t);let n;this._initializeVertices(r);try{const t=function(t,e,r=2){const i=e&&e.length,n=i?e[0]*r:t.length;let o=wl(t,0,n,r,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(i&&(o=function(t,e,r,i){const n=[];for(let o=0,a=e.length;o<a;o++){const r=wl(t,e[o]*i,o<a-1?e[o+1]*i:t.length,i,!1);r===r.next&&(r.steiner=!0),n.push(Ll(r))}n.sort(Cl);for(let o=0;o<n.length;o++)r=Al(n[o],r);return r}(t,e,o,r)),t.length>80*r){s=1/0,l=1/0;let e=-1/0,i=-1/0;for(let o=r;o<n;o+=r){const r=t[o],n=t[o+1];r<s&&(s=r),n<l&&(l=n),r>e&&(e=r),n>i&&(i=n)}c=Math.max(e-s,i-l),c=0!==c?32767/c:0}return Tl(o,a,r,s,l,c,0),a}(r,i),e=this._convertIndices(r,t);n=this._subdivideTrianglesScanline(e)}catch(t){console.error(t)}let o=[];return e&&(o=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(t,e){const r=[];for(let i=0;i<e.length;i++)r.push(this._vertexToIndex(t[2*e[i]],t[2*e[i]+1]));return r}_pointArrayToIndices(t){const e=[];for(let r=0;r<t.length;r++){const i=t[r];e.push(this._vertexToIndex(i.x,i.y))}return e}}function Kl(t,e,r,i=!0){return new Yl(r,e).subdividePolygonInternal(t,i)}function Ql(t,e,r=!1){if(!t||t.length<1)return[];if(t.length<2)return[];const i=t[0],n=t[t.length-1],o=r&&(i.x!==n.x||i.y!==n.y);if(e<2)return o?[...t,t[0]]:[...t];const a=Math.floor(R/e),s=[];s.push(new l(t[0].x,t[0].y));const c=t.length,u=o?c:c-1;for(let h=0;h<u;h++){const e=t[h],r=h<c-1?t[h+1]:t[0],i=e.x,n=e.y,o=r.x,u=r.y,d=i!==o,p=n!==u;if(!d&&!p)continue;const f=o-i,m=u-n,g=Math.abs(f),_=Math.abs(m);let y=i,v=n;for(;;){const t=f>0?(Math.floor(y/a)+1)*a:(Math.ceil(y/a)-1)*a,e=m>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,r=Math.abs(y-t),i=Math.abs(v-e),n=Math.abs(y-o),c=Math.abs(v-u),h=d?r/g:Number.POSITIVE_INFINITY,b=p?i/_:Number.POSITIVE_INFINITY;if((n<=r||!d)&&(c<=i||!p))break;if(h<b&&d||!p){y=t,v+=m*h;const e=new l(y,Math.round(v));s[s.length-1].x===e.x&&s[s.length-1].y===e.y||s.push(e)}else{y+=f*b,v=e;const t=new l(Math.round(y),v);s[s.length-1].x===t.x&&s[s.length-1].y===t.y||s.push(t)}}const b=new l(o,u);s[s.length-1].x===b.x&&s[s.length-1].y===b.y||s.push(b)}return s}function tc(t,e,r){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let i=0,n=t[2*e[0]];for(let l=1;l<e.length;l++){const r=t[2*e[l]];r<n&&(n=r,i=l)}const o=e.length;let a=i,s=(a+1)%o;for(;;){const i=a-1>=0?a-1:o-1,n=(s+1)%o,l=t[2*e[i]],c=t[2*e[n]],u=t[2*e[a]],h=t[2*e[a]+1],d=t[2*e[s]+1];let p=!1;if(l<c)p=!0;else if(l>c)p=!1;else{const r=d-h,o=-(t[2*e[s]]-u),a=h<d?1:-1;((l-u)*r+(t[2*e[i]+1]-h)*o)*a>((c-u)*r+(t[2*e[n]+1]-h)*o)*a&&(p=!0)}if(p){const t=e[i],n=e[a],l=e[s];t!==n&&t!==l&&n!==l&&r.push(l,n,t),a--,a<0&&(a=o-1)}else{const t=e[n],i=e[a],l=e[s];t!==i&&t!==l&&i!==l&&r.push(l,i,t),s++,s>=o&&(s=0)}if(i===n)break}}function ec(t,e,r,i,n,o,a,s,l){const c=n.length/2,u=a&&s&&l;if(c<Ja.MAX_VERTEX_ARRAY_LENGTH){const h=e.prepareSegment(c,r,i),d=h.vertexLength;for(let t=0;t<o.length;t+=3)i.emplaceBack(d+o[t],d+o[t+1],d+o[t+2]);let p,f;h.vertexLength+=c,h.primitiveLength+=o.length/3,u&&(f=a.prepareSegment(c,r,s),p=f.vertexLength,f.vertexLength+=c);for(let e=0;e<n.length;e+=2)t(n[e],n[e+1]);if(u)for(let t=0;t<l.length;t++){const e=l[t];for(let t=1;t<e.length;t+=2)s.emplaceBack(p+e[t-1],p+e[t]);f.primitiveLength+=e.length/2}}else!function(t,e,r,i,n,o){const a=[];for(let h=0;h<i.length/2;h++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,r),u=c.vertexLength;for(let h=2;h<n.length;h+=3){const d=n[h-2],p=n[h-1],f=n[h];let m=a[d]<l,g=a[p]<l,_=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>Ja.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,r),l=s.count,m=!0,g=!0,_=!0,u=0);const y=rc(a,i,o,s,d,m,c),v=rc(a,i,o,s,p,g,c),b=rc(a,i,o,s,f,_,c);r.emplaceBack(u+y-l,u+v-l,u+b-l),c.primitiveLength++}}(e,r,i,n,o,t),u&&function(t,e,r,i,n,o){const a=[];for(let h=0;h<i.length/2;h++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,r),u=c.vertexLength;for(let h=0;h<n.length;h++){const d=n[h];for(let p=1;p<n[h].length;p+=2){const n=d[p-1],h=d[p];let f=a[n]<l,m=a[h]<l;c.vertexLength+((f?1:0)+(m?1:0))>Ja.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,r),l=s.count,f=!0,m=!0,u=0);const g=rc(a,i,o,s,n,f,c),_=rc(a,i,o,s,h,m,c);r.emplaceBack(u+g-l,u+_-l),c.primitiveLength++}}}(a,r,s,n,l,t),e.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function rc(t,e,r,i,n,o,a){if(o){const o=i.count;return r(e[2*n],e[2*n+1]),t[n]=i.count,i.count++,a.vertexLength++,o}return t[n]}class ic{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Oa,this.indexArray=new Za,this.indexArray2=new Wa,this.programConfigurations=new Ss(t.layers,t.zoom),this.segments=new Ja,this.segments2=new Ja,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=bl("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Cs(a,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),u,r))continue;const h=n?i.evaluate(u,{},r,e.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:t?u.geometry:ks(a),patterns:{},sortKey:h};o.push(d)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const a of o){const{geometry:i,index:n,sourceLayerIndex:o}=a;if(this.hasPattern){const t=xl("fill",this.layers,a,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(a,i,n,r,{},e.subdivisionGranularity);e.featureIndex.insert(t[n].feature,i,n,o,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,vl),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,r,i,n,o){for(const a of ri(e,500)){const t=Kl(a,i,o.fill.getGranularityForZoomLevel(i.z)),e=this.layoutVertexArray;ec(((t,r)=>{e.emplaceBack(t,r)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)}}let nc,oc;co("FillBucket",ic,{omit:["layers","patternFeatures"]});var ac={get paint(){return oc=oc||new qo({"fill-antialias":new jo(xt.paint_fill["fill-antialias"]),"fill-opacity":new Uo(xt.paint_fill["fill-opacity"]),"fill-color":new Uo(xt.paint_fill["fill-color"]),"fill-outline-color":new Uo(xt.paint_fill["fill-outline-color"]),"fill-translate":new jo(xt.paint_fill["fill-translate"]),"fill-translate-anchor":new jo(xt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Vo(xt.paint_fill["fill-pattern"])})},get layout(){return nc=nc||new qo({"fill-sort-key":new Uo(xt.layout_fill["fill-sort-key"])})}};class sc extends Wo{constructor(t){super(t,ac)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new ic(t)}queryRadius(){return qs(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return zs(Zs(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}}const lc=Yo([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),cc=Yo([{name:"a_centroid",components:2,type:"Int16"}],4),{members:uc}=lc;var hc,dc,pc,fc,mc,gc,_c,yc={};function vc(){if(dc)return hc;dc=1;var t=o();function e(t,e,i,n,o){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(r,this,e)}function r(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function i(t){for(var e,r,i=0,n=0,o=t.length,a=o-1;n<o;a=n++)i+=((r=t[a]).x-(e=t[n]).x)*(e.y+r.y);return i}return hc=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var r,i=e.readVarint()+e.pos,n=1,o=0,a=0,s=0,l=[];e.pos<i;){if(o<=0){var c=e.readVarint();n=7&c,o=c>>3}if(o--,1===n||2===n)a+=e.readSVarint(),s+=e.readSVarint(),1===n&&(r&&l.push(r),r=[]),r.push(new t(a,s));else{if(7!==n)throw new Error("unknown command "+n);r&&r.push(r[0].clone())}}return r&&l.push(r),l},e.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;t.pos<e;){if(i<=0){var u=t.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)(n+=t.readSVarint())<a&&(a=n),n>s&&(s=n),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,c]},e.prototype.toGeoJSON=function(t,r,n){var o,a,s=this.extent*Math.pow(2,n),l=this.extent*t,c=this.extent*r,u=this.loadGeometry(),h=e.types[this.type];function d(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+c)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(o=0;o<u.length;o++)p[o]=u[o][0];d(u=p);break;case 2:for(o=0;o<u.length;o++)d(u[o]);break;case 3:for(u=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,o=[],a=0;a<e;a++){var s=i(t[a]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(r&&o.push(r),r=[t[a]]):r.push(t[a]))}return r&&o.push(r),o}(u),o=0;o<u.length;o++)for(a=0;a<u[o].length;a++)d(u[o][a])}1===u.length?u=u[0]:h="Multi"+h;var f={type:"Feature",geometry:{type:h,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f},hc}function bc(){if(fc)return pc;fc=1;var t=vc();function e(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(r,this,e),this.length=this._features.length}function r(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var i=t.readVarint()>>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return e}(r))}return pc=e,e.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var r=this._pbf.readVarint()+this._pbf.pos;return new t(this._pbf,r,this.extent,this._keys,this._values)},pc}function xc(){return _c||(_c=1,yc.VectorTile=function(){if(gc)return mc;gc=1;var t=bc();function e(e,r,i){if(3===e){var n=new t(i,i.readVarint()+i.pos);n.length&&(r[n.name]=n)}}return mc=function(t,r){this.layers=t.readFields(e,{},r)},mc}(),yc.VectorTileFeature=vc(),yc.VectorTileLayer=bc()),yc}var wc=r(xc());const Sc=wc.VectorTileFeature.types,Tc=Math.pow(2,13);function Ic(t,e,r,i,n,o,a,s){t.emplaceBack(e,r,2*Math.floor(i*Tc)+a,n*Tc*2,o*Tc*2,Math.round(s))}class Ec{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Fa,this.centroidVertexArray=new Da,this.indexArray=new Za,this.programConfigurations=new Ss(t.layers,t.zoom),this.segments=new Ja,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.features=[],this.hasPattern=bl("fill-extrusion",this.layers,e);for(const{feature:i,id:n,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=Cs(i,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),s,r))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:t?s.geometry:ks(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(xl("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,r,{},e.subdivisionGranularity),e.featureIndex.insert(i,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,r){for(const i of this.features){const{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,uc),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,cc.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,o){for(const a of ri(e,500)){const e={x:0,y:0,sampleCount:0},r=this.layoutVertexArray.length;this.processPolygon(e,i,t,a,o);const n=this.layoutVertexArray.length-r,s=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<n;t++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)}processPolygon(t,e,r,i,n){if(i.length<1)return;if(Cc(i[0]))return;for(const u of i)0!==u.length&&Pc(t,u);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(e.z),s="Polygon"===Sc[r.type];for(const u of i){if(0===u.length)continue;if(Cc(u))continue;const t=Ql(u,a,s);this._generateSideFaces(t,o)}if(!s)return;const l=Kl(i,e,a,!1),c=this.layoutVertexArray;ec(((t,e)=>{Ic(c,t,e,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){const n=t[i],o=t[i-1];if(kc(n,o))continue;e.segment.vertexLength+4>Ja.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const a=n.sub(o)._perp()._unit(),s=o.dist(n);r+s>32768&&(r=0),Ic(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,r),Ic(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,r),r+=s,Ic(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,r),Ic(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,r);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function Pc(t,e){for(let r=0;r<e.length;r++){const i=e[r];r===e.length-1&&e[0].x===i.x&&e[0].y===i.y||(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}function kc(t,e){return t.x===e.x&&(t.x<0||t.x>R)||t.y===e.y&&(t.y<0||t.y>R)}function Cc(t){return t.every((t=>t.x<0))||t.every((t=>t.x>R))||t.every((t=>t.y<0))||t.every((t=>t.y>R))}let Ac;co("FillExtrusionBucket",Ec,{omit:["layers","features"]});var Mc={get paint(){return Ac=Ac||new qo({"fill-extrusion-opacity":new jo(xt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Uo(xt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new jo(xt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new jo(xt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Vo(xt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Uo(xt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Uo(xt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new jo(xt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Rc extends Wo{constructor(t){super(t,Mc)}createBucket(t){return new Ec(t)}queryRadius(){return qs(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,pixelPosMatrix:a}){const s=Zs(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e){const r=[];for(const i of t){const t=[i.x,i.y,0,1];P(t,t,e),r.push(new l(t[0]/t[3],t[1]/t[3]))}return r}(s,a),d=function(t,e,r,i){const n=[],o=[],a=i[8]*e,s=i[9]*e,c=i[10]*e,u=i[11]*e,h=i[8]*r,d=i[9]*r,p=i[10]*r,f=i[11]*r;for(const m of t){const t=[],e=[];for(const r of m){const n=r.x,o=r.y,m=i[0]*n+i[4]*o+i[12],g=i[1]*n+i[5]*o+i[13],_=i[2]*n+i[6]*o+i[14],y=i[3]*n+i[7]*o+i[15],v=_+c,b=y+u,x=m+h,w=g+d,S=_+p,T=y+f,I=new l((m+a)/b,(g+s)/b);I.z=v/b,t.push(I);const E=new l(x/T,w/T);E.z=S/T,e.push(E)}n.push(t),o.push(e)}return[n,o]}(i,u,c,a);return function(t,e,r){let i=1/0;zs(r,e)&&(i=Dc(r,e[0]));for(let n=0;n<e.length;n++){const o=e[n],a=t[n];for(let t=0;t<o.length-1;t++){const e=o[t],n=[e,o[t+1],a[t+1],a[t],e];Ls(r,n)&&(i=Math.min(i,Dc(r,n)))}}return i!==1/0&&i}(d[0],d[1],h)}}function Lc(t,e){return t.x*e.x+t.y*e.y}function Dc(t,e){if(1===t.length){let r=0;const i=e[r++];let n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){const o=e[r],a=t[0],s=n.sub(i),l=o.sub(i),c=a.sub(i),u=Lc(s,s),h=Lc(s,l),d=Lc(l,l),p=Lc(c,s),f=Lc(c,l),m=u*d-h*h,g=(d*p-h*f)/m,_=(u*f-h*p)/m,y=i.z*(1-g-_)+n.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const zc=Yo([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Oc}=zc,Fc=Yo([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Nc}=Fc,Bc=wc.VectorTileFeature.types,jc=Math.cos(Math.PI/180*37.5),Uc=Math.pow(2,14)/.5;class Vc{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Na,this.layoutVertexArray2=new Ba,this.indexArray=new Za,this.programConfigurations=new Ss(t.layers,t.zoom),this.segments=new Ja,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=bl("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,e=Cs(a,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),e,r))continue;const u=n?i.evaluate(e,{},r):void 0,h={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:t?e.geometry:ks(a),patterns:{},sortKey:u};o.push(h)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const a of o){const{geometry:i,index:n,sourceLayerIndex:o}=a;if(this.hasPattern){const t=xl("line",this.layers,a,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(a,i,n,r,{},e.subdivisionGranularity);e.featureIndex.insert(t[n].feature,i,n,o,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Nc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Oc),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,i,n,o){const a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),u=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const h of e)this.addLine(h,t,s,l,c,u,i,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)}addLine(t,e,r,i,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=Ql(t,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===Bc[e.type];let c=t.length;for(;c>=2&&t[c-1].equals(t[c-2]);)c--;let u=0;for(;u<c-1&&t[u].equals(t[u+1]);)u++;if(c<(l?3:2))return;"bevel"===r&&(n=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,d=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let p,f,m,g,_;this.e1=this.e2=-1,l&&(p=t[c-2],_=t[u].sub(p)._unit()._perp());for(let y=u;y<c;y++){if(m=y===c-1?l?t[u+1]:void 0:t[y+1],m&&t[y].equals(m))continue;_&&(g=_),p&&(f=p),p=t[y],_=m?m.sub(p)._unit()._perp():g,g=g||_;let e=g.add(_);0===e.x&&0===e.y||e._unit();const a=g.x*_.x+g.y*_.y,s=e.x*_.x+e.y*_.y,v=0!==s?1/s:1/0,b=2*Math.sqrt(2-2*s),x=s<jc&&f&&m,w=g.x*_.y-g.y*_.x>0;if(x&&y>u){const t=p.dist(f);if(t>2*h){const e=p.sub(p.sub(f)._mult(h/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,g,0,0,d),f=e}}const S=f&&m;let T=S?r:l?"butt":i;if(S&&"round"===T&&(v<o?T="miter":v<=2&&(T="fakeround")),"miter"===T&&v>n&&(T="bevel"),"bevel"===T&&(v>2&&(T="flipbevel"),v<n&&(T="miter")),f&&this.updateDistance(f,p),"miter"===T)e._mult(v),this.addCurrentVertex(p,e,0,0,d);else if("flipbevel"===T){if(v>100)e=_.mult(-1);else{const t=v*g.add(_).mag()/g.sub(_).mag();e._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(p,e,0,0,d),this.addCurrentVertex(p,e.mult(-1),0,0,d)}else if("bevel"===T||"fakeround"===T){const t=-Math.sqrt(v*v-1),e=w?t:0,r=w?0:t;if(f&&this.addCurrentVertex(p,g,e,r,d),"fakeround"===T){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*t*t+(.848013+a*(.215638*a-1.06021)))}const i=_.sub(g)._mult(r)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(p,i.x,i.y,!1,w,0,d)}}m&&this.addCurrentVertex(p,_,-e,-r,d)}else if("butt"===T)this.addCurrentVertex(p,e,0,0,d);else if("square"===T){const t=f?1:-1;this.addCurrentVertex(p,e,t,t,d)}else"round"===T&&(f&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,_,-1,-1,d,!0),this.addCurrentVertex(p,_,0,0,d)));if(x&&y<c-1){const t=p.dist(m);if(t>2*h){const e=p.add(m.sub(p)._mult(h/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,_,0,0,d),p=e}}}}addCurrentVertex(t,e,r,i,n,o=!1){const a=e.y*i-e.x,s=-e.y-e.x*i;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,n),this.addHalfVertex(t,a,s,o,!0,-i,n),this.distance>Uc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,o))}addHalfVertex({x:t,y:e},r,i,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Uc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),s.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let Gc,$c;co("LineBucket",Vc,{omit:["layers","patternFeatures"]});var qc={get paint(){return $c=$c||new qo({"line-opacity":new Uo(xt.paint_line["line-opacity"]),"line-color":new Uo(xt.paint_line["line-color"]),"line-translate":new jo(xt.paint_line["line-translate"]),"line-translate-anchor":new jo(xt.paint_line["line-translate-anchor"]),"line-width":new Uo(xt.paint_line["line-width"]),"line-gap-width":new Uo(xt.paint_line["line-gap-width"]),"line-offset":new Uo(xt.paint_line["line-offset"]),"line-blur":new Uo(xt.paint_line["line-blur"]),"line-dasharray":new Go(xt.paint_line["line-dasharray"]),"line-pattern":new Vo(xt.paint_line["line-pattern"]),"line-gradient":new $o(xt.paint_line["line-gradient"])})},get layout(){return Gc=Gc||new qo({"line-cap":new jo(xt.layout_line["line-cap"]),"line-join":new Uo(xt.layout_line["line-join"]),"line-miter-limit":new jo(xt.layout_line["line-miter-limit"]),"line-round-limit":new jo(xt.layout_line["line-round-limit"]),"line-sort-key":new Uo(xt.layout_line["line-sort-key"])})}};class Zc extends Uo{possiblyEvaluate(t,e){return e=new Mo(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=U({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}}let Wc;class Hc extends Wo{constructor(t){super(t,qc),this.gradientVersion=0,Wc||(Wc=new Zc(qc.paint.properties["line-width"].specification),Wc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof cr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Wc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Vc(t)}queryRadius(t){const e=t,r=Xc($s("line-width",this,e),$s("line-gap-width",this,e)),i=$s("line-offset",this,e);return r/2+Math.abs(i)+qs(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o}){const a=Zs(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),s=o/2*Xc(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(i=function(t,e){const r=[];for(let i=0;i<t.length;i++){const n=t[i],o=[];for(let t=0;t<n.length;t++){const r=n[t-1],i=n[t],a=n[t+1],s=0===t?new l(0,0):i.sub(r)._unit()._perp(),c=t===n.length-1?new l(0,0):a.sub(i)._unit()._perp(),u=s._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),o.push(u._mult(e)._add(i))}r.push(o)}return r}(i,c*o)),function(t,e,r){for(let i=0;i<e.length;i++){const n=e[i];if(t.length>=3)for(let e=0;e<n.length;e++)if(Vs(t,n[e]))return!0;if(Os(t,n,r))return!0}return!1}(a,i,s)}isTileClipped(){return!0}}function Xc(t,e){return e>0?e+2*t:t}const Jc=Yo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Yc=Yo([{name:"a_projected_pos",components:3,type:"Float32"}],4);Yo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Kc=Yo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Yo([{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 Qc=Yo([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tu=Yo([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function eu(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const i=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),Ao.applyArabicShaping&&(t=Ao.applyArabicShaping(t)),t}(t.text,e,r)})),t}Yo([{name:"triangle",components:3,type:"Uint16"}]),Yo([{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"}]),Yo([{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"}]),Yo([{type:"Float32",name:"offsetX"}]),Yo([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Yo([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const ru={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var iu,nu,ou,au=24,su={};function lu(){return iu||(iu=1,su.read=function(t,e,r,i,n){var o,a,s=8*n-i-1,l=(1<<s)-1,c=l>>1,u=-7,h=r?n-1:0,d=r?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+t[e+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=i;u>0;a=256*a+t[e+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,i),o-=c}return(p?-1:1)*a*Math.pow(2,o-i)},su.write=function(t,e,r,i,n,o){var a,s,l,c=8*o-n-1,u=(1<<c)-1,h=u>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(e*l-1)*Math.pow(2,n),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;t[r+p]=255&s,p+=f,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;t[r+p]=255&a,p+=f,a/=256,c-=8);t[r+p-f]|=128*m}),su}function cu(){if(ou)return nu;ou=1,nu=e;var t=lu();function e(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var r=4294967296,i=1/r,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function o(t){return t.type===e.Bytes?t.readVarint()+t.pos:t.pos+1}function a(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function s(t,e,r){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(i);for(var n=r.pos-1;n>=t;n--)r.buf[n+i]=r.buf[n]}function l(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function c(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function u(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function h(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function d(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function p(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function f(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function m(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function g(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function y(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function v(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}return e.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=7&i,t(n,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_(this.buf,this.pos)+_(this.buf,this.pos+4)*r;return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+v(this.buf,this.pos+4)*r;return this.pos+=8,t},readFloat:function(){var e=t.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=t.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(t){var e,r,i=this.buf;return e=127&(r=i[this.pos++]),r<128?e:(e|=(127&(r=i[this.pos++]))<<7,r<128?e:(e|=(127&(r=i[this.pos++]))<<14,r<128?e:(e|=(127&(r=i[this.pos++]))<<21,r<128?e:function(t,e,r){var i,n,o=r.buf;if(i=(112&(n=o[r.pos++]))>>4,n<128)return a(t,i,e);if(i|=(127&(n=o[r.pos++]))<<3,n<128)return a(t,i,e);if(i|=(127&(n=o[r.pos++]))<<10,n<128)return a(t,i,e);if(i|=(127&(n=o[r.pos++]))<<17,n<128)return a(t,i,e);if(i|=(127&(n=o[r.pos++]))<<24,n<128)return a(t,i,e);if(i|=(1&(n=o[r.pos++]))<<31,n<128)return a(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&n?function(t,e,r){return n.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var i="",n=e;n<r;){var o,a,s,l=t[n],c=null,u=l>239?4:l>223?3:l>191?2:1;if(n+u>r)break;1===u?l<128&&(c=l):2===u?128==(192&(o=t[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=t[n+2],128==(192&(o=t[n+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=t[n+2],s=t[n+3],128==(192&(o=t[n+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,i+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),i+=String.fromCharCode(c),n+=u}return i}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,r){if(this.type!==e.Bytes)return t.push(this.readVarint(r));var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(r));return t},readPackedSVarint:function(t){if(this.type!==e.Bytes)return t.push(this.readSVarint());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==e.Bytes)return t.push(this.readBoolean());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==e.Bytes)return t.push(this.readFloat());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==e.Bytes)return t.push(this.readDouble());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==e.Bytes)return t.push(this.readFixed32());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==e.Bytes)return t.push(this.readSFixed32());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==e.Bytes)return t.push(this.readFixed64());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==e.Bytes)return t.push(this.readSFixed64());var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readSFixed64());return t},skip:function(t){var r=7&t;if(r===e.Varint)for(;this.buf[this.pos++]>127;);else if(r===e.Bytes)this.pos=this.readVarint()+this.pos;else if(r===e.Fixed32)this.pos+=4;else{if(r!==e.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),y(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),y(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),y(this.buf,-1&t,this.pos),y(this.buf,Math.floor(t*i),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),y(this.buf,-1&t,this.pos),y(this.buf,Math.floor(t*i),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var i,n,o=0;o<e.length;o++){if((i=e.charCodeAt(o))>55295&&i<57344){if(!n){i>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=i;continue}if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=63&i|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&s(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),t.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),t.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var i=this.pos-r;i>=128&&s(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,r,i){this.writeTag(t,e.Bytes),this.writeRawMessage(r,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,u,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,g,e)},writeBytesField:function(t,r){this.writeTag(t,e.Bytes),this.writeBytes(r)},writeFixed32Field:function(t,r){this.writeTag(t,e.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(t,r){this.writeTag(t,e.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(t,r){this.writeTag(t,e.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(t,r){this.writeTag(t,e.Fixed64),this.writeSFixed64(r)},writeVarintField:function(t,r){this.writeTag(t,e.Varint),this.writeVarint(r)},writeSVarintField:function(t,r){this.writeTag(t,e.Varint),this.writeSVarint(r)},writeStringField:function(t,r){this.writeTag(t,e.Bytes),this.writeString(r)},writeFloatField:function(t,r){this.writeTag(t,e.Fixed32),this.writeFloat(r)},writeDoubleField:function(t,r){this.writeTag(t,e.Fixed64),this.writeDouble(r)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}},nu}var uu,hu=r(cu());function du(t,e,r){1===t&&r.readMessage(pu,e)}function pu(t,e,r){if(3===t){const{id:t,bitmap:i,width:n,height:o,left:a,top:s,advance:l}=r.readMessage(fu,{});e.push({id:t,bitmap:new nl({width:n+6,height:o+6},i),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function fu(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function mu(t){let e=0,r=0;for(const a of t)e+=a.w*a.h,r=Math.max(r,a.w);t.sort(((t,e)=>e.h-t.h));const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let n=0,o=0;for(const a of t)for(let t=i.length-1;t>=0;t--){const e=i[t];if(!(a.w>e.w||a.h>e.h)){if(a.x=e.x,a.y=e.y,o=Math.max(o,a.y+a.h),n=Math.max(n,a.x+a.w),a.w===e.w&&a.h===e.h){const e=i.pop();t<i.length&&(i[t]=e)}else a.h===e.h?(e.x+=a.w,e.w-=a.w):a.w===e.w?(e.y+=a.h,e.h-=a.h):(i.push({x:e.x+a.w,y:e.y,w:e.w-a.w,h:a.h}),e.y+=a.h,e.h-=a.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}class gu{constructor(t,{pixelRatio:e,version:r,stretchX:i,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=n,this.content=o,this.version=r,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class _u{constructor(t,e){const r={},i={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,r,n),this.addImages(e,i,n);const{w:o,h:a}=mu(n),s=new ol({width:o||1,height:a||1});for(const l in t){const e=t[l],i=r[l].paddedRect;ol.copy(e.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},e.data)}for(const l in e){const t=e[l],r=i[l].paddedRect,n=r.x+1,o=r.y+1,a=t.data.width,c=t.data.height;ol.copy(t.data,s,{x:0,y:0},{x:n,y:o},t.data),ol.copy(t.data,s,{x:0,y:c-1},{x:n,y:o-1},{width:a,height:1}),ol.copy(t.data,s,{x:0,y:0},{x:n,y:o+c},{width:a,height:1}),ol.copy(t.data,s,{x:a-1,y:0},{x:n-1,y:o},{width:1,height:c}),ol.copy(t.data,s,{x:0,y:0},{x:n+a,y:o},{width:1,height:c})}this.image=s,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(const i in t){const n=t[i],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),e[i]=new gu(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[i,n]=t.tl;r.update(e.data,void 0,{x:i,y:n})}}co("ImagePosition",gu),co("ImageAtlas",_u),t.an=void 0,(uu=t.an||(t.an={}))[uu.none=0]="none",uu[uu.horizontal=1]="horizontal",uu[uu.vertical=2]="vertical",uu[uu.horizontalOnly=3]="horizontalOnly";class yu{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,e,r){const i=new yu;return i.scale=t||1,i.fontStack=e,i.verticalAlign=r||"bottom",i}static forImage(t,e){const r=new yu;return r.imageName=t,r.verticalAlign=e||"bottom",r}}class vu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new vu;for(let i=0;i<t.sections.length;i++){const n=t.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let r=0;r<t.length;r++){const i=t.charCodeAt(r+1)||null,n=t.charCodeAt(r-1)||null;e+=i&&Io(i)&&!ru[t[r+1]]||n&&Io(n)&&!ru[t[r-1]]||!ru[t[r]]?t[r]:ru[t[r]]}return e}(this.text)}trim(){let t=0;for(let r=0;r<this.text.length&&xu[this.text.charCodeAt(r)];r++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&xu[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new vu;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}getMaxImageSize(t){let e=0,r=0;for(let i=0;i<this.length();i++){const n=this.getSection(i);if(n.imageName){const i=t[n.imageName];if(!i)continue;const o=i.displaySize;e=Math.max(e,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:e,maxImageHeight:r}}addTextSection(t,e){this.text+=t.text,this.sections.push(yu.forText(t.scale,t.fontStack||e,t.verticalAlign));const r=this.sections.length-1;for(let i=0;i<t.text.length;++i)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void W("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(yu.forImage(e,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):W("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bu(e,r,i,n,o,a,s,l,c,u,h,d,p,f,m){const g=vu.fromFeature(e,o);let _;d===t.an.vertical&&g.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:v}=Ao;if(y&&1===g.sections.length){_=[];const t=y(g.toString(),Cu(g,u,a,r,n,f));for(const e of t){const t=new vu;t.text=e,t.sections=g.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);_.push(t)}}else if(v){_=[];const t=v(g.text,g.sectionIndex,Cu(g,u,a,r,n,f));for(const e of t){const t=new vu;t.text=e[0],t.sectionIndex=e[1],t.sections=g.sections,_.push(t)}}else _=function(t,e){const r=[],i=t.text;let n=0;for(const o of e)r.push(t.substring(n,o)),n=o;return n<i.length&&r.push(t.substring(n,i.length)),r}(g,Cu(g,u,a,r,n,f));const b=[],x={positionedLines:b,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(t,e,r,i,n,o,a,s,l,c,u,h){let d=0,p=0,f=0,m=0;const g="right"===s?1:"left"===s?0:.5,_=au/h;let y=0;for(const x of n){x.trim();const n=x.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=a;const s=a.positionedGlyphs;let h=0;if(!x.length()){p+=o,++y;continue}const v=Mu(i,x,_);for(let o=0;o<x.length();o++){const a=x.getSection(o),f=x.getSectionIndex(o),m=x.getCharCode(o),g=Lu(l,u,m);let y;if(a.imageName){if(t.iconsInText=!0,a.scale=a.scale*_,y=zu(a,g,n,v,i),!y)continue;h=Math.max(h,y.imageOffset)}else if(y=Du(a,m,g,v,e,r),!y)continue;const{rect:b,metrics:w,baselineOffset:S}=y;s.push({glyph:m,imageName:a.imageName,x:d,y:p+S+-17,vertical:g,scale:a.scale,fontStack:a.fontStack,sectionIndex:f,metrics:w,rect:b}),g?(t.verticalizable=!0,d+=(a.imageName?w.advance:au)*a.scale+c):d+=w.advance*a.scale+c}0!==s.length&&(f=Math.max(d-c,f),Ou(s,0,s.length-1,g)),d=0,a.lineOffset=Math.max(h,(n-1)*au);const b=o*n+h;p+=b,m=Math.max(b,m),++y}const{horizontalAlign:v,verticalAlign:b}=Au(a);(function(t,e,r,i,n,o,a,s,l){const c=(e-r)*n;let u=0;u=o!==a?-s*i- -17:-i*l*a+.5*a;for(const h of t)for(const t of h.positionedGlyphs)t.x+=c,t.y+=u})(t.positionedLines,g,v,b,f,m,o,p,n.length),t.top+=-b*p,t.bottom=t.top+p,t.left+=-v*f,t.right=t.left+f}(x,r,i,n,_,s,l,c,d,u,p,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&x}const xu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},wu={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},Su={40:!0};function Tu(t,e,r,i,n,o){if(e.imageName){const t=i[e.imageName];return t?t.displaySize[0]*e.scale*au/o+n:0}{const i=r[e.fontStack],o=i&&i[t];return o?o.metrics.advance*e.scale+n:0}}function Iu(t,e,r,i){const n=Math.pow(t-e,2);return i?t<e?n/2:2*n:n+Math.abs(r)*r}function Eu(t,e,r){let i=0;return 10===t&&(i-=1e4),r&&(i+=150),40!==t&&65288!==t||(i+=50),41!==e&&65289!==e||(i+=50),i}function Pu(t,e,r,i,n,o){let a=null,s=Iu(e,r,n,o);for(const l of i){const t=Iu(e-l.x,r,n,o)+l.badness;t<=s&&(a=l,s=t)}return{index:t,x:e,priorBreak:a,badness:s}}function ku(t){return t?ku(t.priorBreak).concat(t.index):[]}function Cu(t,e,r,i,n,o){if(!t)return[];const a=[],s=function(t,e,r,i,n,o){let a=0;for(let s=0;s<t.length();s++){const r=t.getSection(s);a+=Tu(t.getCharCode(s),r,i,n,e,o)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,i,n,o),l=t.text.indexOf("")>=0;let c=0;for(let h=0;h<t.length();h++){const r=t.getSection(h),d=t.getCharCode(h);if(xu[d]||(c+=Tu(d,r,i,n,e,o)),h<t.length()-1){const e=!((u=d)<11904)&&(!!_o["CJK Compatibility Forms"](u)||!!_o["CJK Compatibility"](u)||!!_o["CJK Strokes"](u)||!!_o["CJK Symbols and Punctuation"](u)||!!_o["Enclosed CJK Letters and Months"](u)||!!_o["Halfwidth and Fullwidth Forms"](u)||!!_o["Ideographic Description Characters"](u)||!!_o["Vertical Forms"](u)||So.test(String.fromCodePoint(u)));(wu[d]||e||r.imageName||h!==t.length()-2&&Su[t.getCharCode(h+1)])&&a.push(Pu(h+1,c,s,a,Eu(d,t.getCharCode(h+1),e&&l),!1))}}var u;return ku(Pu(t.length(),c,s,a,0,!0))}function Au(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Mu(t,e,r){const i=e.getMaxScale()*au,{maxImageWidth:n,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(i,o*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:a}}function Ru(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function Lu(e,r,i){return!(e===t.an.horizontal||!r&&!To(i)||r&&(xu[i]||(n=i,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function Du(t,e,r,i,n,o){const a=o[t.fontStack],s=function(t,e,r,i){if(t&&t.rect)return t;const n=e[r.fontStack],o=n&&n[i];return o?{rect:null,metrics:o.metrics}:null}(a&&a[e],n,t,e);if(null===s)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*au;else{const e=Ru(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*au)*e}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function zu(t,e,r,i,n){const o=n[t.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:1,top:-3,advance:e?s[1]:s[0]};let c;if(e)c=i.verticalLineContentWidth-s[1]*t.scale;else{const e=Ru(t.verticalAlign);c=(i.horizontalLineContentHeight-s[1]*t.scale)*e}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(e?s[0]:s[1])*t.scale-au*r}}function Ou(t,e,r,i){if(0===i)return;const n=t[r],o=(t[r].x+n.metrics.advance*n.scale)*i;for(let a=e;a<=r;a++)t[a].x-=o}function Fu(t,e,r){const{horizontalAlign:i,verticalAlign:n}=Au(r),o=e[0]-t.displaySize[0]*i,a=e[1]-t.displaySize[1]*n;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function Nu(t){var e,r;let i=t.left,n=t.top,o=t.right-i,a=t.bottom-n;const s=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(r=t.image.textFitHeight)&&void 0!==r?r:"stretchOrShrink",c=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const t=Math.ceil(a*c);i*=t/o,o=t}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const t=Math.ceil(o/c);n*=t/a,a=t}return{x1:i,y1:n,x2:i+o,y2:n+a}}function Bu(t,e,r,i,n,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let u,h,d,p;"width"===r||"both"===r?(p=n[0]+l-i[3],h=n[0]+c+i[1]):(p=n[0]+(l+c-a.displaySize[0])/2,h=p+a.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===r||"both"===r?(u=n[1]+f-i[0],d=n[1]+m+i[2]):(u=n[1]+(f+m-a.displaySize[1])/2,d=u+a.displaySize[1]),{image:a,top:u,right:h,bottom:d,left:p,collisionPadding:s}}const ju=128,Uu=32640;function Vu(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Mo(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:i}=r;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let o=n;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[n],s=e[o];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:i}:{kind:"camera",minZoom:a,maxZoom:s,minSize:r.evaluate(new Mo(a)),maxSize:r.evaluate(new Mo(s)),interpolationType:i}}}function Gu(t,e,r){let i="never";const n=t.get(e);return n?i=n:t.get(r)&&(i="always"),i}const $u=wc.VectorTileFeature.types,qu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Zu(t,e,r,i,n,o,a,s,l,c,u,h,d){const p=s?Math.min(Uu,Math.round(s[0])):0,f=s?Math.min(Uu,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*i),Math.round(32*n),o,a,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function Wu(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Hu(t){for(const e of t.sections)if(Co(e.text))return!0;return!1}class Xu{constructor(t){this.layoutVertexArray=new Ua,this.indexArray=new Za,this.programConfigurations=t,this.segments=new Ja,this.dynamicLayoutVertexArray=new Va,this.opacityVertexArray=new Ga,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ia}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Jc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Yc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,qu,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}co("SymbolBuffers",Xu);class Ju{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Ja,this.collisionVertexArray=new qa}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Kc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}co("CollisionBuffers",Ju);class Yu{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vu(this.zoom,r["text-size"]),this.iconSizeData=Vu(this.zoom,r["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.canOverlap="never"!==Gu(i,"text-overlap","text-allow-overlap")||"never"!==Gu(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map((e=>t.an[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Xu(new Ss(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Xu(new Ss(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ka,this.lineVertexArray=new Ca,this.symbolInstances=new Pa,this.textAnchorOffsets=new Ma}calculateGlyphDependencies(t,e,r,i,n){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(r||i)&&n){const r=ru[t.charAt(o)];r&&(e[r.charCodeAt(0)]=!0)}}populate(e,r,i){const n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof Le&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const d=r.iconDependencies,p=r.glyphDependencies,f=r.availableImages,m=new Mo(this.zoom,{globalState:this.globalState});for(const{feature:g,id:_,index:y,sourceLayerIndex:v}of e){const e=n._featureFilter.needGeometry,r=Cs(g,e);if(!n._featureFilter.filter(m,r,i))continue;let s,l;if(e||(r.geometry=ks(g)),c){const t=n.getValueAndResolveTokens("text-field",r,i,f),e=Le.factory(t),o=this.hasRTLText=this.hasRTLText||Hu(e);(!o||"unavailable"===Ao.getRTLTextPluginStatus()||o&&Ao.isParsed())&&(s=eu(e,n,r))}if(u){const t=n.getValueAndResolveTokens("icon-image",r,i,f);l=t instanceof je?t:je.fromString(t)}if(!s&&!l)continue;const b=this.sortFeaturesByKey?h.evaluate(r,{},i):void 0;if(this.features.push({id:_,text:s,icon:l,index:y,sourceLayerIndex:v,geometry:r.geometry,properties:g.properties,type:$u[g.type],sortKey:b}),l&&(d[l.name]=!0),s){const e=a.evaluate(r,{},i).join(","),n="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.an.vertical)>=0;for(const t of s.sections)if(t.image)d[t.image.name]=!0;else{const r=yo(s.toString()),i=t.fontStack||e,o=p[i]=p[i]||{};this.calculateGlyphDependencies(t.text,o,n,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},r={},i=[];let n=0;function o(e){i.push(t[e]),n++}function a(t,e,n){const o=r[t];return delete r[t],r[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function s(t,r,n){const o=e[r];return delete e[r],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(t,e,r){const i=r?e[0][e[0].length-1]:e[0][0];return`${t}:${i.x}:${i.y}`}for(let c=0;c<t.length;c++){const u=t[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d){o(c);continue}const p=l(d,h),f=l(d,h,!0);if(p in r&&f in e&&r[p]!==e[f]){const t=s(p,f,h),n=a(p,f,i[t].geometry);delete e[p],delete r[f],r[l(d,i[n].geometry,!0)]=n,i[t].geometry=null}else p in r?a(p,f,h):f in e?s(p,f,h):(o(c),e[p]=n-1,r[f]=n-1)}return i.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]);const n={};for(let o=t.segment+1;o<e.length;o++)n[o]={x:e[o].x,y:e[o].y,tileUnitDistanceFromAnchor:r},o<e.length-1&&(r+=e[o+1].dist(e[o]));for(let o=t.segment||0;o>=0;o--)n[o]={x:e[o].x,y:e[o].y,tileUnitDistanceFromAnchor:i},o>0&&(i+=e[o-1].dist(e[o]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,r,i,n,o,a,s,l,c,u,h,d){const p=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*r.length,f,p,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===t.an.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let t=0;t<r.length;t++){const{tl:n,tr:o,bl:s,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:w,sectionIndex:S}=r[t],T=m.vertexLength,I=x[1];Zu(f,l.x,l.y,n.x,I+n.y,u.x,u.y,i,w,h.x,h.y,_,b),Zu(f,l.x,l.y,o.x,I+o.y,u.x+u.w,u.y,i,w,g.x,h.y,_,b),Zu(f,l.x,l.y,s.x,I+s.y,u.x,u.y+u.h,i,w,h.x,g.y,_,b),Zu(f,l.x,l.y,c.x,I+c.y,u.x+u.w,u.y+u.h,i,w,g.x,g.y,_,b),Wu(e.dynamicLayoutVertexArray,l,y),p.emplaceBack(T,T+2,T+1),p.emplaceBack(T+1,T+2,T+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),t!==r.length-1&&S===r[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,a,a.index,{},d,v&&v[S])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,u,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,h)}_addCollisionDebugVertex(t,e,r,i,n,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,r,i,n,o,a){const s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=s.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,d=a.anchorX,p=a.anchorY;this._addCollisionDebugVertex(u,h,o,d,p,new l(t,e)),this._addCollisionDebugVertex(u,h,o,d,p,new l(r,e)),this._addCollisionDebugVertex(u,h,o,d,p,new l(r,i)),this._addCollisionDebugVertex(u,h,o,d,p,new l(t,i)),s.vertexLength+=4;const f=n.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),s.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,i?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ju($a,Qc.members,Wa),this.iconCollisionBox=new Ju($a,Qc.members,Wa);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,o,a,s,l){const c={};for(let u=e;u<r;u++){const e=t.get(u);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let u=i;u<n;u++){const e=t.get(u);c.verticalTextBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.verticalTextFeatureIndex=e.featureIndex;break}for(let u=o;u<a;u++){const e=t.get(u);c.iconBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.iconFeatureIndex=e.featureIndex;break}for(let u=s;u<l;u++){const e=t.get(u);c.verticalIconBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.verticalIconFeatureIndex=e.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+4*r.numGlyphs;for(let n=r.vertexStartIndex;n<i;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),i=[],n=[],o=[];for(let a=0;a<this.symbolInstances.length;++a){o.push(a);const t=this.symbolInstances.get(a);i.push(0|Math.round(e*t.anchorX+r*t.anchorY)),n.push(t.featureIndex)}return o.sort(((t,e)=>i[t]-i[e]||n[e]-n[t])),o}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ku,Qu;co("SymbolBucket",Yu,{omit:["layers","collisionBoxArray","features","compareText"]}),Yu.MAX_GLYPHS=65535,Yu.addDynamicAttributes=Wu;var th={get paint(){return Qu=Qu||new qo({"icon-opacity":new Uo(xt.paint_symbol["icon-opacity"]),"icon-color":new Uo(xt.paint_symbol["icon-color"]),"icon-halo-color":new Uo(xt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Uo(xt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Uo(xt.paint_symbol["icon-halo-blur"]),"icon-translate":new jo(xt.paint_symbol["icon-translate"]),"icon-translate-anchor":new jo(xt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Uo(xt.paint_symbol["text-opacity"]),"text-color":new Uo(xt.paint_symbol["text-color"],{runtimeType:Ut,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Uo(xt.paint_symbol["text-halo-color"]),"text-halo-width":new Uo(xt.paint_symbol["text-halo-width"]),"text-halo-blur":new Uo(xt.paint_symbol["text-halo-blur"]),"text-translate":new jo(xt.paint_symbol["text-translate"]),"text-translate-anchor":new jo(xt.paint_symbol["text-translate-anchor"])})},get layout(){return Ku=Ku||new qo({"symbol-placement":new jo(xt.layout_symbol["symbol-placement"]),"symbol-spacing":new jo(xt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new jo(xt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Uo(xt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new jo(xt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new jo(xt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new jo(xt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new jo(xt.layout_symbol["icon-ignore-placement"]),"icon-optional":new jo(xt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new jo(xt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Uo(xt.layout_symbol["icon-size"]),"icon-text-fit":new jo(xt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new jo(xt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Uo(xt.layout_symbol["icon-image"]),"icon-rotate":new Uo(xt.layout_symbol["icon-rotate"]),"icon-padding":new Uo(xt.layout_symbol["icon-padding"]),"icon-keep-upright":new jo(xt.layout_symbol["icon-keep-upright"]),"icon-offset":new Uo(xt.layout_symbol["icon-offset"]),"icon-anchor":new Uo(xt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new jo(xt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new jo(xt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new jo(xt.layout_symbol["text-rotation-alignment"]),"text-field":new Uo(xt.layout_symbol["text-field"]),"text-font":new Uo(xt.layout_symbol["text-font"]),"text-size":new Uo(xt.layout_symbol["text-size"]),"text-max-width":new Uo(xt.layout_symbol["text-max-width"]),"text-line-height":new jo(xt.layout_symbol["text-line-height"]),"text-letter-spacing":new Uo(xt.layout_symbol["text-letter-spacing"]),"text-justify":new Uo(xt.layout_symbol["text-justify"]),"text-radial-offset":new Uo(xt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new jo(xt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Uo(xt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Uo(xt.layout_symbol["text-anchor"]),"text-max-angle":new jo(xt.layout_symbol["text-max-angle"]),"text-writing-mode":new jo(xt.layout_symbol["text-writing-mode"]),"text-rotate":new Uo(xt.layout_symbol["text-rotate"]),"text-padding":new jo(xt.layout_symbol["text-padding"]),"text-keep-upright":new jo(xt.layout_symbol["text-keep-upright"]),"text-transform":new Uo(xt.layout_symbol["text-transform"]),"text-offset":new Uo(xt.layout_symbol["text-offset"]),"text-allow-overlap":new jo(xt.layout_symbol["text-allow-overlap"]),"text-overlap":new jo(xt.layout_symbol["text-overlap"]),"text-ignore-placement":new jo(xt.layout_symbol["text-ignore-placement"]),"text-optional":new jo(xt.layout_symbol["text-optional"])})}};class eh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Ft,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}co("FormatSectionOverride",eh,{omit:["defaultValue"]});class rh extends Wo{constructor(t){super(t,th)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,i){const n=this.layout.get(t).evaluate(e,{},r,i),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||nn(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>t&&r in t?String(t[r]):""))}(e.properties,n)}createBucket(t){return new Yu(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of th.paint.overridableProperties){if(!rh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new eh(e),i=new rn(r,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new an("source",i):new sn("composite",i,e.value.zoomStops),this.paint._values[t]=new No(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&rh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),i=th.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(i.overrides&&i.overrides.hasOverride(e))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof Le)o(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{n||(e instanceof Ze&&$e(e.value)===Zt?o(e.value.sections):e instanceof Ar?o(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let ih;var nh={get paint(){return ih=ih||new qo({"background-color":new jo(xt.paint_background["background-color"]),"background-pattern":new Go(xt.paint_background["background-pattern"]),"background-opacity":new jo(xt.paint_background["background-opacity"])})}};class oh extends Wo{constructor(t){super(t,nh)}}let ah;var sh={get paint(){return ah=ah||new qo({"raster-opacity":new jo(xt.paint_raster["raster-opacity"]),"raster-hue-rotate":new jo(xt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new jo(xt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new jo(xt.paint_raster["raster-brightness-max"]),"raster-saturation":new jo(xt.paint_raster["raster-saturation"]),"raster-contrast":new jo(xt.paint_raster["raster-contrast"]),"raster-resampling":new jo(xt.paint_raster["raster-resampling"]),"raster-fade-duration":new jo(xt.paint_raster["raster-fade-duration"])})}};class lh extends Wo{constructor(t){super(t,sh)}}class ch extends Wo{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class uh{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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 hh={once:!0},dh=6371008.8;class ph{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ph(j(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,i=t.lat*e,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return dh*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof ph)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new ph(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new ph(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const fh=2*Math.PI*dh;function mh(t){return fh*Math.cos(t*Math.PI/180)}function gh(t){return(180+t)/360}function _h(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function yh(t,e){return t/mh(e)}function vh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function bh(t,e){return t*mh(vh(e))}class xh{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=ph.convert(t);return new xh(gh(r.lng),_h(r.lat),yh(e,r.lat))}toLngLat(){return new ph(360*this.x-180,vh(this.y))}toAltitude(){return bh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/fh*(t=vh(this.y),1/Math.cos(t*Math.PI/180));var t}}function wh(t,e,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}class Sh{constructor(t,e,r){if(!function(t,e,r){return!(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,r))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Eh(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const i=(o=this.y,a=this.z,s=wh(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=wh(256*(n+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,o,a,s,l;const c=function(t,e,r){let i,n="";for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new l((t.x*e-this.x)*R,(t.y*e-this.y)*R)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Th{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Eh(t,e.z,e.z,e.x,e.y)}}class Ih{constructor(t,e,r,i,n){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Sh(r,+i,+n),this.key=Eh(e,t,r,i,n)}clone(){return new Ih(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new Ih(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ih(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?Eh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Eh(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Ih(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new Ih(e,this.wrap,e,r,i),new Ih(e,this.wrap,e,r+1,i),new Ih(e,this.wrap,e,r,i+1),new Ih(e,this.wrap,e,r+1,i+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Ih(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Ih(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Th(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new xh(t.x-this.wrap,t.y))}}function Eh(t,e,r,i,n){(t*=2)<0&&(t=-1*t-1);const o=1<<r;return(o*o*t+o*n+i).toString(36)+r.toString(36)+e.toString(36)}co("CanonicalTileID",Sh),co("OverscaledTileID",Ih,{omit:["terrainRttPosMatrix32f"]});class Ph{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const e=new Ph;return e.extend(t(new l(this.minX,this.minY))),e.extend(t(new l(this.maxX,this.minY))),e.extend(t(new l(this.minX,this.maxY))),e.extend(t(new l(this.maxX,this.maxY))),e}static fromPoints(t){const e=new Ph;for(const r of t)e.extend(r);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class kh{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Ch{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=i,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Ah{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new so(R,16,0),this.grid3D=new so(R,16,0),this.featureIndexArray=new La,this.promoteId=e}insert(t,e,r,i,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);const s=o?this.grid3D:this.grid;for(let l=0;l<e.length;l++){const t=e[l],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<t.length;e++){const i=t[e];r[0]=Math.min(r[0],i.x),r[1]=Math.min(r[1],i.y),r[2]=Math.max(r[2],i.x),r[3]=Math.max(r[3],i.y)}r[0]<R&&r[1]<R&&r[2]>=0&&r[3]>=0&&s.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new wc.VectorTile(new hu(this.rawTileData)).layers,this.sourceLayerCoder=new kh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();const n=t.params,o=R/t.tileSize/t.scale,a=fn(n.filter),s=t.queryGeometry,c=t.queryPadding*o,u=Ph.fromPoints(s),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=Ph.fromPoints(t.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,((e,r,i,n)=>function(t,e,r,i,n){for(const a of t)if(e<=a.x&&r<=a.y&&i>=a.x&&n>=a.y)return!0;const o=[new l(e,r),new l(e,n),new l(i,n),new l(i,r)];if(t.length>2)for(const a of o)if(Vs(t,a))return!0;for(let a=0;a<t.length-1;a++)if(Gs(t[a],t[a+1],o))return!0;return!1}(t.cameraQueryGeometry,e-c,r-c,i+c,n+c)));for(const l of p)h.push(l);h.sort(Rh);const f={};let m;for(let l=0;l<h.length;l++){const c=h[l];if(c===m)continue;m=c;const u=this.featureIndexArray.get(c);let d=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,a,n.layers,n.availableImages,e,r,i,((e,r,i)=>(d||(d=ks(e)),r.queryIntersectsFeature({queryGeometry:s,feature:e,featureState:i,geometry:d,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))))}return f}loadMatchingFeature(t,e,r,i,n,o,a,s,l,c,u){const h=this.bucketLayerIDs[e];if(o&&!h.some((t=>o.has(t))))return;const d=this.sourceLayerCoder.decode(r),p=this.vtLayers[d].feature(i);if(n.needGeometry){const t=Cs(p,!0);if(!n.filter(new Mo(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new Mo(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let m=0;m<h.length;m++){const e=h[m];if(o&&!o.has(e))continue;const r=s[e];if(!r)continue;let n={};f&&c&&(n=c.getState(r.sourceLayer||"_geojsonTileLayer",f));const d=U({},l[e]);d.paint=Mh(d.paint,r.paint,p,n,a),d.layout=Mh(d.layout,r.layout,p,n,a);const g=!u||u(p,r,n);if(!g)continue;const _=new Ch(p,this.z,this.x,this.y,f);_.layer=d;let y=t[e];void 0===y&&(y=t[e]=[]),y.push({featureIndex:i,feature:_,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,i,n,o,a,s){const l={};this.loadVTLayers();const c=fn(n);for(const u of t)this.loadMatchingFeature(l,r,i,u,c,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){var r;let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i)),void 0===i&&(null===(r=t.properties)||void 0===r?void 0:r.cluster)&&this.promoteId&&(i=Number(t.properties.cluster_id))),i}}function Mh(t,e,r,i,n){return G(t,((t,o)=>{const a=e instanceof Bo?e.get(o):null;return a&&a.evaluate?a.evaluate(r,i,n):a}))}function Rh(t,e){return e-t}function Lh(t,e,r,i,n){const o=[];for(let a=0;a<t.length;a++){const s=t[a];let c;for(let t=0;t<s.length-1;t++){let a=s[t],u=s[t+1];a.x<e&&u.x<e||(a.x<e?a=new l(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x<e&&(u=new l(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y<r&&u.y<r||(a.y<r?a=new l(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round():u.y<r&&(u=new l(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round()),a.x>=i&&u.x>=i||(a.x>=i?a=new l(i,a.y+(i-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=i&&(u=new l(i,a.y+(i-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=n&&u.y>=n||(a.y>=n?a=new l(a.x+(n-a.y)/(u.y-a.y)*(u.x-a.x),n)._round():u.y>=n&&(u=new l(a.x+(n-a.y)/(u.y-a.y)*(u.x-a.x),n)._round()),c&&a.equals(c[c.length-1])||(c=[a],o.push(c)),c.push(u)))))}}return o}co("FeatureIndex",Ah,{omit:["rawTileData","sourceLayerCoder"]});class Dh extends l{constructor(t,e,r,i){super(t,e),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new Dh(this.x,this.y,this.angle,this.segment)}}function zh(t,e,r,i,n){if(void 0===e.segment||0===r)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;s<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let o=t[a-1].angleTo(e)-e.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>i;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=e.dist(r)}return!0}function Oh(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Fh(t,e,r){return t?.6*e*r:0}function Nh(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Bh(t,e,r,i,n,o){const a=Fh(r,n,o),s=Nh(r,i)*o;let l=0;const c=Oh(t)/2;for(let u=0;u<t.length-1;u++){const r=t[u],i=t[u+1],n=r.dist(i);if(l+n>c){const o=(c-l)/n,h=_r.number(r.x,i.x,o),d=_r.number(r.y,i.y,o),p=new Dh(h,d,i.angleTo(r),u);return p._round(),!a||zh(t,p,s,a,e)?p:void 0}l+=n}}function jh(t,e,r,i,n,o,a,s,l){const c=Fh(i,o,a),u=Nh(i,n),h=u*a,d=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Uh(t,d?e/2*s%e:(u/2+2*o)*a*s%e,e,c,r,h,d,!1,l)}function Uh(t,e,r,i,n,o,a,s,l){const c=o/2,u=Oh(t);let h=0,d=e-r,p=[];for(let f=0;f<t.length-1;f++){const e=t[f],a=t[f+1],s=e.dist(a),m=a.angleTo(e);for(;d+r<h+s;){d+=r;const g=(d-h)/s,_=_r.number(e.x,a.x,g),y=_r.number(e.y,a.y,g);if(_>=0&&_<l&&y>=0&&y<l&&d-c>=0&&d+c<=u){const e=new Dh(_,y,m,f);e._round(),i&&!zh(t,e,o,i,n)||p.push(e)}}h+=s}return s||p.length||a||(p=Uh(t,h/2,r,i,n,o,a,!0,l)),p}function Vh(t,e,r,i){const n=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2,c=o.paddedRect.h-2;let u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const h=o.stretchX||[[0,s]],d=o.stretchY||[[0,c]],p=(t,e)=>t+e[1]-e[0],f=h.reduce(p,0),m=d.reduce(p,0),g=s-f,_=c-m;let y=0,v=f,b=0,x=m,w=0,S=g,T=0,I=_;if(o.content&&i){const e=o.content,r=e[2]-e[0],i=e[3]-e[1];(o.textFitWidth||o.textFitHeight)&&(u=Nu(t)),y=Gh(h,0,e[0]),b=Gh(d,0,e[1]),v=Gh(h,e[0],e[2]),x=Gh(d,e[1],e[3]),w=e[0]-y,T=e[1]-b,S=r-v,I=i-x}const E=u.x1,P=u.y1,k=u.x2-E,C=u.y2-P,A=(t,i,n,s)=>{const c=qh(t.stretch-y,v,k,E),u=Zh(t.fixed-w,S,t.stretch,f),h=qh(i.stretch-b,x,C,P),d=Zh(i.fixed-T,I,i.stretch,m),p=qh(n.stretch-y,v,k,E),g=Zh(n.fixed-w,S,n.stretch,f),_=qh(s.stretch-b,x,C,P),A=Zh(s.fixed-T,I,s.stretch,m),M=new l(c,h),R=new l(p,h),L=new l(p,_),D=new l(c,_),z=new l(u/a,d/a),O=new l(g/a,A/a),F=e*Math.PI/180;if(F){const t=Math.sin(F),e=Math.cos(F),r=[e,-t,t,e];M._matMult(r),R._matMult(r),D._matMult(r),L._matMult(r)}const N=t.stretch+t.fixed,B=i.stretch+i.fixed;return{tl:M,tr:R,bl:D,br:L,tex:{x:o.paddedRect.x+1+N,y:o.paddedRect.y+1+B,w:n.stretch+n.fixed-N,h:s.stretch+s.fixed-B},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:O,minFontScaleX:S/a/k,minFontScaleY:I/a/C,isSDF:r}};if(i&&(o.stretchX||o.stretchY)){const t=$h(h,g,f),e=$h(d,_,m);for(let r=0;r<t.length-1;r++){const i=t[r],o=t[r+1];for(let t=0;t<e.length-1;t++)n.push(A(i,e[t],o,e[t+1]))}}else n.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:c+1}));return n}function Gh(t,e,r){let i=0;for(const n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function $h(t,e,r){const i=[{fixed:-1,stretch:0}];for(const[n,o]of t){const t=i[i.length-1];i.push({fixed:n-t.stretch,stretch:t.stretch}),i.push({fixed:n-t.stretch,stretch:t.stretch+(o-n)})}return i.push({fixed:e+1,stretch:r}),i}function qh(t,e,r,i){return t/e*r+i}function Zh(t,e,r,i){return t-e*r/i}co("Anchor",Dh);class Wh{constructor(t,e,r,i,n,o,a,s,c,u){var h;if(this.boxStartIndex=t.length,c){let t=o.top,e=o.bottom;const r=o.collisionPadding;r&&(t-=r[1],e+=r[3]);let i=e-t;i>0&&(i=Math.max(10,i),this.circleDiameter=i)}else{const c=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?Nu(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*a-s[0],c.y2=c.y2*a+s[2],c.x1=c.x1*a-s[3],c.x2=c.x2*a+s[1];const d=o.collisionPadding;if(d&&(c.x1-=d[0]*a,c.y1-=d[1]*a,c.x2+=d[2]*a,c.y2+=d[3]*a),u){const t=new l(c.x1,c.y1),e=new l(c.x2,c.y1),r=new l(c.x1,c.y2),i=new l(c.x2,c.y2),n=u*Math.PI/180;t._rotate(n),e._rotate(n),r._rotate(n),i._rotate(n),c.x1=Math.min(t.x,e.x,r.x,i.x),c.x2=Math.max(t.x,e.x,r.x,i.x),c.y1=Math.min(t.y,e.y,r.y,i.y),c.y2=Math.max(t.y,e.y,r.y,i.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,r,i,n)}this.boxEndIndex=t.length}}class Hh{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let i=1+(t<<1);const o=i+1;if(o<this.length&&r(e[o],e[i])<0&&(i=o),r(e[i],n)>=0)break;e[t]=e[i],t=i}e[t]=n}}function Xh(t,e=1,r=!1){const i=Ph.fromPoints(t[0]),n=Math.min(i.width(),i.height());let o=n/2;const a=new Hh([],Jh),{minX:s,minY:c,maxX:u,maxY:h}=i;if(0===n)return new l(s,c);for(let l=s;l<u;l+=n)for(let e=c;e<h;e+=n)a.push(new Yh(l+o,e+o,o,t));let d=function(t){let e=0,r=0,i=0;const n=t[0];for(let o=0,a=n.length,s=a-1;o<a;s=o++){const t=n[o],a=n[s],l=t.x*a.y-a.x*t.y;r+=(t.x+a.x)*l,i+=(t.y+a.y)*l,e+=3*l}return new Yh(r/e,i/e,0,t)}(t),p=a.length;for(;a.length;){const i=a.pop();(i.d>d.d||!d.d)&&(d=i,r&&console.log("found best %d after %d probes",Math.round(1e4*i.d)/1e4,p)),i.max-d.d<=e||(o=i.h/2,a.push(new Yh(i.p.x-o,i.p.y-o,o,t)),a.push(new Yh(i.p.x+o,i.p.y-o,o,t)),a.push(new Yh(i.p.x-o,i.p.y+o,o,t)),a.push(new Yh(i.p.x+o,i.p.y+o,o,t)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}function Jh(t,e){return e.max-t.max}function Yh(t,e,r,i){this.p=new l(t,e),this.h=r,this.d=function(t,e){let r=!1,i=1/0;for(let n=0;n<e.length;n++){const o=e[n];for(let e=0,n=o.length,a=n-1;e<n;a=e++){const n=o[e],s=o[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(r=!r),i=Math.min(i,js(t,n,s))}}return(r?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}var Kh;t.aD=void 0,(Kh=t.aD||(t.aD={}))[Kh.center=1]="center",Kh[Kh.left=2]="left",Kh[Kh.right=3]="right",Kh[Kh.top=4]="top",Kh[Kh.bottom=5]="bottom",Kh[Kh["top-left"]=6]="top-left",Kh[Kh["top-right"]=7]="top-right",Kh[Kh["bottom-left"]=8]="bottom-left",Kh[Kh["bottom-right"]=9]="bottom-right";const Qh=Number.POSITIVE_INFINITY;function td(t,e){return e[1]!==Qh?function(t,e,r){let i=0,n=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(t){case"top-right":case"bottom-right":case"right":i=-e;break;case"top-left":case"bottom-left":case"left":i=e}return[i,n]}(t,e[0],e[1]):function(t,e){let r=0,i=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-e;break;case"top":i=e-7}switch(t){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=e;break;case"right":r=-e}return[r,i]}(t,e[0])}function ed(t,e,r){var i;const n=t.layout,o=null===(i=n.get("text-variable-anchor-offset"))||void 0===i?void 0:i.evaluate(e,{},r);if(o){const t=o.values,e=[];for(let r=0;r<t.length;r+=2){const i=e[r]=t[r],n=t[r+1].map((t=>t*au));i.startsWith("top")?n[1]-=7:i.startsWith("bottom")&&(n[1]+=7),e[r+1]=n}return new Be(e)}const a=n.get("text-variable-anchor");if(a){let i;i=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},r)*au,Qh]:n.get("text-offset").evaluate(e,{},r).map((t=>t*au));const o=[];for(const t of a)o.push(t,td(t,i));return new Be(o)}return null}function rd(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function id(e,r,i,n,o,a,s,l,c,u,h,d){let p=a.textMaxSize.evaluate(r,{});void 0===p&&(p=s);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(r,{},h),g=od(i.horizontal),_=s/24,y=e.tilePixelRatio*_,v=e.tilePixelRatio*p/24,b=e.tilePixelRatio*l,x=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,S=function(t,e,r,i=1){const n=t.get("icon-padding").evaluate(e,{},r),o=n&&n.values;return[o[0]*i,o[1]*i,o[2]*i,o[3]*i]}(f,r,h,e.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,I="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),E="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),P=f.get("symbol-placement"),k=x/2,C=f.get("icon-text-fit");let A;n&&"none"!==C&&(e.allowVerticalPlacement&&i.vertical&&(A=Bu(n,i.vertical,C,f.get("icon-text-fit-padding"),m,_)),g&&(n=Bu(n,g,C,f.get("icon-text-fit-padding"),m,_)));const M=h?d.line.getGranularityForZoomLevel(h.z):1,L=(l,d)=>{d.x<0||d.x>=R||d.y<0||d.y>=R||function(e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,S,T,I){const E=e.addToLineVertexArray(r,i);let P,k,C,A,M=0,R=0,L=0,D=0,z=-1,O=-1;const F={};let N=as("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(x,{},T)+90;C=new Wh(c,r,u,h,d,n.vertical,p,f,m,t),s&&(A=new Wh(c,r,u,h,d,s,_,y,m,t))}if(o){const i=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),a=Vh(o,i,S,n),p=s?Vh(s,i,S,n):void 0;k=new Wh(c,r,u,h,d,o,_,y,!1,i),M=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[ju*l.layout.get("icon-size").evaluate(x,{})],m[0]>Uu&&W(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[ju*w.compositeIconSizes[0].evaluate(x,{},T),ju*w.compositeIconSizes[1].evaluate(x,{},T)],(m[0]>Uu||m[1]>Uu)&&W(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,b,v,x,t.an.none,r,E.lineStartIndex,E.lineLength,-1,T),z=e.icon.placedSymbolArray.length-1,p&&(R=4*p.length,e.addSymbols(e.icon,p,m,b,v,x,t.an.vertical,r,E.lineStartIndex,E.lineLength,-1,T),O=e.icon.placedSymbolArray.length-1)}const B=Object.keys(n.horizontal);for(const W of B){const i=n.horizontal[W];if(!P){N=as(i.text);const t=l.layout.get("text-rotate").evaluate(x,{},T);P=new Wh(c,r,u,h,d,i,p,f,m,t)}const o=1===i.positionedLines.length;if(L+=nd(e,r,i,a,l,m,x,g,E,n.vertical?t.an.horizontal:t.an.horizontalOnly,o?B:[W],F,z,w,T),o)break}n.vertical&&(D+=nd(e,r,n.vertical,a,l,m,x,g,E,t.an.vertical,["vertical"],F,O,w,T));const j=P?P.boxStartIndex:e.collisionBoxArray.length,U=P?P.boxEndIndex:e.collisionBoxArray.length,V=C?C.boxStartIndex:e.collisionBoxArray.length,G=C?C.boxEndIndex:e.collisionBoxArray.length,$=k?k.boxStartIndex:e.collisionBoxArray.length,q=k?k.boxEndIndex:e.collisionBoxArray.length,Z=A?A.boxStartIndex:e.collisionBoxArray.length,H=A?A.boxEndIndex:e.collisionBoxArray.length;let X=-1;const J=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=J(P,X),X=J(C,X),X=J(k,X),X=J(A,X);const Y=X>-1?1:0;Y&&(X*=I/au),e.glyphOffsetArray.length>=Yu.MAX_GLYPHS&&W("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey);const K=ed(l,x,T),[Q,tt]=function(e,r){const i=e.length,n=null==r?void 0:r.values;if((null==n?void 0:n.length)>0)for(let o=0;o<n.length;o+=2){const r=n[o+1];e.emplaceBack(t.aD[n[o]],r[0],r[1])}return[i,e.length]}(e.textAnchorOffsets,K);e.symbolInstances.emplaceBack(r.x,r.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,z,O,N,j,U,V,G,$,q,Z,H,u,L,D,M,R,Y,0,p,X,Q,tt)}(e,d,l,i,n,o,A,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,y,[w,w,w,w],I,c,b,S,E,m,r,a,u,h,s)};if("line"===P)for(const t of Lh(r.geometry,0,0,R,R)){const r=Ql(t,M),o=jh(r,x,T,i.vertical||g,n,24,v,e.overscaling,R);for(const t of o)g&&ad(e,g.text,k,t)||L(r,t)}else if("line-center"===P){for(const t of r.geometry)if(t.length>1){const e=Ql(t,M),r=Bh(e,T,i.vertical||g,n,24,v);r&&L(e,r)}}else if("Polygon"===r.type)for(const t of ri(r.geometry,0)){const e=Xh(t,16);L(Ql(t[0],M,!0),new Dh(e.x,e.y,0))}else if("LineString"===r.type)for(const t of r.geometry){const e=Ql(t,M);L(e,new Dh(e[0].x,e[0].y,0))}else if("Point"===r.type)for(const t of r.geometry)for(const e of t)L([e],new Dh(e.x,e.y,0))}function nd(t,e,r,i,n,o,a,s,c,u,h,d,p,f,m){const g=function(t,e,r,i,n,o,a,s){const c=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(const h of e.positionedLines)for(const t of h.positionedGlyphs){if(!t.rect)continue;const i=t.rect||{};let o=4,d=!0,p=1,f=0;const m=(n||s)&&t.vertical,g=t.metrics.advance*t.scale/2;if(s&&e.verticalizable&&(f=h.lineOffset/2-(t.imageName?-(au-t.metrics.width*t.scale)/2:(t.scale-1)*au)),t.imageName){const e=a[t.imageName];d=e.sdf,p=e.pixelRatio,o=1/p}const _=n?[t.x+g,t.y]:[0,0];let y=n?[0,0]:[t.x+g+r[0],t.y+r[1]-f],v=[0,0];m&&(v=y,y=[0,0]);const b=t.metrics.isDoubleResolution?2:1,x=(t.metrics.left-o)*t.scale-g+y[0],w=(-t.metrics.top-o)*t.scale+y[1],S=x+i.w/b*t.scale/p,T=w+i.h/b*t.scale/p,I=new l(x,w),E=new l(S,w),P=new l(x,T),k=new l(S,T);if(m){const e=new l(-g,g- -17),r=-Math.PI/2,i=12-g,n=new l(22-i,-(t.imageName?i:0)),o=new l(...v);I._rotateAround(r,e)._add(n)._add(o),E._rotateAround(r,e)._add(n)._add(o),P._rotateAround(r,e)._add(n)._add(o),k._rotateAround(r,e)._add(n)._add(o)}if(c){const t=Math.sin(c),e=Math.cos(c),r=[e,-t,t,e];I._matMult(r),E._matMult(r),P._matMult(r),k._matMult(r)}const C=new l(0,0),A=new l(0,0);u.push({tl:I,tr:E,bl:P,br:k,tex:i,writingMode:e.writingMode,glyphOffset:_,sectionIndex:t.sectionIndex,isSDF:d,pixelOffsetTL:C,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,s,n,o,a,i,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[ju*n.layout.get("text-size").evaluate(a,{})],y[0]>Uu&&W(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[ju*f.compositeTextSizes[0].evaluate(a,{},m),ju*f.compositeTextSizes[1].evaluate(a,{},m)],(y[0]>Uu||y[1]>Uu)&&W(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,y,s,o,a,u,e,c.lineStartIndex,c.lineLength,p,m);for(const l of h)d[l]=t.text.placedSymbolArray.length-1;return 4*g.length}function od(t){for(const e in t)return t[e];return null}function ad(t,e,r,i){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(i.dist(t[e])<r)return!0}else n[e]=[];return n[e].push(i),!1}const sd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ld{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=r>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const n=sd[15&r];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new ld(a,o,n,t)}constructor(t,e=64,r=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=sd.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return cd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=a){for(let a=h;a<=u;a++){const s=o[2*a],c=o[2*a+1];s>=t&&s<=r&&c>=e&&c<=i&&l.push(n[a])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=t&&p<=r&&f>=e&&f<=i&&l.push(n[d]),(0===c?t<=p:e<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?r>=p:i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:n,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=r*r;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let r=h;r<=u;r++)pd(n[2*r],n[2*r+1],t,e)<=l&&s.push(i[r]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];pd(p,f,t,e)<=l&&s.push(i[d]),(0===c?t-r<=p:e-r<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?t+r>=p:e+r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return s}}function cd(t,e,r,i,n,o){if(n-i<=r)return;const a=i+n>>1;ud(t,e,a,i,n,o),cd(t,e,r,i,a-1,1-o),cd(t,e,r,a+1,n,1-o)}function ud(t,e,r,i,n,o){for(;n>i;){if(n-i>600){const a=n-i+1,s=r-i+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);ud(t,e,r,Math.max(i,Math.floor(r-s*c/a+u)),Math.min(n,Math.floor(r+(a-s)*c/a+u)),o)}const a=e[2*r+o];let s=i,l=n;for(hd(t,e,i,r),e[2*n+o]>a&&hd(t,e,i,n);s<l;){for(hd(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*i+o]===a?hd(t,e,i,l):(l++,hd(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function hd(t,e,r,i){dd(t,r,i),dd(e,2*r,2*i),dd(e,2*r+1,2*i+1)}function dd(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function pd(t,e,r,i){const n=t-r,o=e-i;return n*n+o*o}var fd;t.cw=void 0,(fd=t.cw||(t.cw={})).create="create",fd.load="load",fd.fullLoad="fullLoad";let md=null,gd=[];const _d=1e3/60,yd="loadTime",vd="fullLoadTime",bd={mark(t){performance.mark(t)},frame(t){const e=t;null!=md&&gd.push(e-md),md=e},clearMetrics(){md=null,gd=[],performance.clearMeasures(yd),performance.clearMeasures(vd);for(const e in t.cw)performance.clearMarks(t.cw[e])},getPerformanceMetrics(){performance.measure(yd,t.cw.create,t.cw.load),performance.measure(vd,t.cw.create,t.cw.fullLoad);const e=performance.getEntriesByName(yd)[0].duration,r=performance.getEntriesByName(vd)[0].duration,i=gd.length,n=1/(gd.reduce(((t,e)=>t+e),0)/i/1e3),o=gd.filter((t=>t>_d)).reduce(((t,e)=>t+(e-_d)/_d),0);return{loadTime:e,fullLoadTime:r,fps:n,percentDroppedFrames:o/(i+o)*100,totalFrames:i}}};t.$=R,t.A=g,t.B=function([t,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(r),y:t*Math.sin(e)*Math.sin(r),z:t*Math.cos(r)}},t.C=_r,t.D=jo,t.E=bt,t.F=Mo,t.G=io,t.H=function(t){if(null==J){const e=t.navigator?t.navigator.userAgent:null;J=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return J},t.I=gu,t.J=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new uh((()=>this.process())),this.subscription=rt(this.target,"message",(t=>this.receive(t)),!1),this.globalScope=X(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise(((r,i)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=e?rt(e.signal,"abort",(()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const e={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)}),hh):null;this.resolveRejects[n]={resolve:t=>{null==o||o.unsubscribe(),r(t)},reject:t=>{null==o||o.unsubscribe(),i(t)}};const a=[],s=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:fo(t.data,a)});this.target.postMessage(s,{transfer:a})}))}receive(t){const e=t.data,r=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&"resource://android"!==e.origin&&"resource://android"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[r];const t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(X(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,r){return e(this,void 0,void 0,(function*(){if("<response>"===r.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(r.error?e.reject(mo(r.error)):e.resolve(mo(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=mo(r.data),i=new AbortController;this.abortControllers[t]=i;try{const n=yield this.messageHandlers[r.type](r.sourceMapId,e,i);this.completeTask(t,null,n)}catch(e){this.completeTask(t,e)}}))}completeTask(t,e,r){const i=[];delete this.abortControllers[t];const n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?fo(e):null,data:fo(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.K=ht,t.L=function(){var t=new g(16);return g!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.M=function(t,e,r){var i,n,o,a,s,l,c,u,h,d,p,f,m=r[0],g=r[1],_=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*_+e[12],t[13]=e[1]*m+e[5]*g+e[9]*_+e[13],t[14]=e[2]*m+e[6]*g+e[10]*_+e[14],t[15]=e[3]*m+e[7]*g+e[11]*_+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],t[0]=i=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=d,t[10]=p,t[11]=f,t[12]=i*m+s*g+h*_+e[12],t[13]=n*m+l*g+d*_+e[13],t[14]=o*m+c*g+p*_+e[14],t[15]=a*m+u*g+f*_+e[15]),t},t.N=function(t,e,r){var i=r[0],n=r[1],o=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.O=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],v=r[0],b=r[1],x=r[2],w=r[3];return t[0]=v*i+b*s+x*h+w*m,t[1]=v*n+b*l+x*d+w*g,t[2]=v*o+b*c+x*p+w*_,t[3]=v*a+b*u+x*f+w*y,t[4]=(v=r[4])*i+(b=r[5])*s+(x=r[6])*h+(w=r[7])*m,t[5]=v*n+b*l+x*d+w*g,t[6]=v*o+b*c+x*p+w*_,t[7]=v*a+b*u+x*f+w*y,t[8]=(v=r[8])*i+(b=r[9])*s+(x=r[10])*h+(w=r[11])*m,t[9]=v*n+b*l+x*d+w*g,t[10]=v*o+b*c+x*p+w*_,t[11]=v*a+b*u+x*f+w*y,t[12]=(v=r[12])*i+(b=r[13])*s+(x=r[14])*h+(w=r[15])*m,t[13]=v*n+b*l+x*d+w*g,t[14]=v*o+b*c+x*p+w*_,t[15]=v*a+b*u+x*f+w*y,t},t.P=l,t.Q=function(t,e){const r={};for(let i=0;i<e.length;i++){const n=e[i];n in t&&(r[n]=t[n])}return r},t.R=ol,t.S=ph,t.T=fl,t.U=_h,t.V=gh,t.W=p,t.X=f,t.Y=Q,t.Z=Ih,t._=e,t.a=ct,t.a$=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},t.a0=xh,t.a1=Ph,t.a2=25,t.a3=Sh,t.a4=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((r=>{e.onloadstart=()=>{r(e)};for(const i of t){const t=window.document.createElement("source");mt(i)||(e.crossOrigin="Anonymous"),t.src=i,e.appendChild(t)}}))},t.a5=Lt,t.a6=function(){return V++},t.a7=Sa,t.a8=Yu,t.a9=fn,t.aA=au,t.aB=L,t.aC=function(t,e,r,i,n=!1){if(!r[0]&&!r[1])return[0,0];const o=n?"map"===i?-t.bearingInRadians:0:"viewport"===i?t.bearingInRadians:0;if(o){const t=Math.sin(o),e=Math.cos(o);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}return[n?r[0]:L(e,r[0],t.zoom),n?r[1]:L(e,r[1],t.zoom)]},t.aE=Gu,t.aF=rd,t.aG=Au,t.aH=ld,t.aI=Yo,t.aJ=Hl,t.aK=Da,t.aL=Ja,t.aM=Za,t.aN=j,t.aO=nt,t.aP=bh,t.aQ=S,t.aR=w,t.aS=function(t){var e=new g(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.aT=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},t.aU=function(t,e){var r=e[0],i=e[1],n=e[2],o=r*r+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.aV=T,t.aW=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.aX=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},t.aY=b,t.aZ=function(t,e,r){const i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2];return 0===i?null:(-(t[0]*r[0]+t[1]*r[1]+t[2]*r[2])-r[3])/i},t.a_=E,t.aa=Cs,t.ab=Ch,t.ac=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,i,n)=>{const o=i||n;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ad=it,t.ae=function(t){return Math.pow(2,t)},t.af=y,t.ag=B,t.ah=85.051129,t.ai=yh,t.aj=function(t){return Math.log(t)/Math.LN2},t.ak=function(t){var e=t[0],r=t[1];return e*e+r*r},t.al=function(t,e){const r=[];for(const i in t)i in e||r.push(i);return r},t.am=function(t,e){let r=0,i=0;if("constant"===t.kind)i=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=t,s=n?B(mr.interpolationFactor(n,e,o,a),0,1):0;"camera"===t.kind?i=_r.number(t.minSize,t.maxSize,s):r=s}return{uSizeT:r,uSize:i}},t.ao=function(t,{uSize:e,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===t.kind?i/ju:"composite"===t.kind?_r.number(i/ju,n/ju,r):e},t.ap=function(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=r*s-i*a,v=r*l-n*a,b=r*c-o*a,x=i*l-n*s,w=i*c-o*s,S=n*c-o*l,T=u*m-h*f,I=u*g-d*f,E=u*_-p*f,P=h*g-d*m,k=h*_-p*m,C=d*_-p*g,A=y*C-v*k+b*P+x*E-w*I+S*T;return A?(t[0]=(s*C-l*k+c*P)*(A=1/A),t[1]=(n*k-i*C-o*P)*A,t[2]=(m*S-g*w+_*x)*A,t[3]=(d*w-h*S-p*x)*A,t[4]=(l*E-a*C-c*I)*A,t[5]=(r*C-n*E+o*I)*A,t[6]=(g*b-f*S-_*v)*A,t[7]=(u*S-d*b+p*v)*A,t[8]=(a*k-s*E+c*T)*A,t[9]=(i*E-r*k-o*T)*A,t[10]=(f*w-m*b+_*y)*A,t[11]=(h*b-u*w-p*y)*A,t[12]=(s*I-a*P-l*T)*A,t[13]=(r*P-i*I+n*T)*A,t[14]=(m*v-f*x-g*y)*A,t[15]=(u*x-h*v+d*y)*A,t):null},t.aq=A,t.ar=function(t){return Math.hypot(t[0],t[1])},t.as=function(t){return t[0]=0,t[1]=0,t},t.at=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},t.au=Wu,t.av=P,t.aw=function(t,e,r,i){const n=e.y-t.y,o=e.x-t.x,a=i.y-r.y,s=i.x-r.x,c=a*o-s*n;if(0===c)return null;const u=(s*(t.y-r.y)-a*(t.x-r.x))/c;return new l(t.x+u*o,t.y+u*n)},t.ax=Lh,t.ay=Ls,t.az=function(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return[e,r,i,n]},t.b=Y,t.b$=tu,t.b0=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]},t.b1=Th,t.b2=Eh,t.b3=function(t,e,r,i,n){var o,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+i)*(o=1/(i-n)),t[14]=2*n*i*o):(t[10]=-1,t[14]=-2*i),t},t.b4=function(t){var e=new g(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.b5=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],u=e[5],h=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+c*i,t[1]=a*n+u*i,t[2]=s*n+h*i,t[3]=l*n+d*i,t[4]=c*n-o*i,t[5]=u*n-a*i,t[6]=h*n-s*i,t[7]=d*n-l*i,t},t.b6=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+c*i,t[5]=a*n+u*i,t[6]=s*n+h*i,t[7]=l*n+d*i,t[8]=c*n-o*i,t[9]=u*n-a*i,t[10]=h*n-s*i,t[11]=d*n-l*i,t},t.b7=function(){const t=new Float32Array(16);return y(t),t},t.b8=function(){const t=new Float64Array(16);return y(t),t},t.b9=function(){return new Float64Array(16)},t.bA=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bB=function(t,e,r,i){const n=Math.sqrt(t*t+e*e),o=Math.sqrt(r*r+i*i);t/=n,e/=n,r/=o,i/=o;const a=Math.acos(t*r+e*i);return-e*r+t*i>0?a:-a},t.bC=function(t,e){const r=D(t,2*Math.PI),i=D(e,2*Math.PI);return Math.min(Math.abs(r-i),Math.abs(r-i+2*Math.PI),Math.abs(r-i-2*Math.PI))},t.bD=function(){const t={},e=xt.$version;for(const r in xt.$root){const i=xt.$root[r];if(i.required){let n=null;n="version"===r?e:"array"===i.type?[]:{},null!=n&&(t[r]=n)}}return t},t.bE=go,t.bF=pt,t.bG=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(!t(e[i],r[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const i in e)if(!t(e[i],r[i]))return!1;return!0}return e===r},t.bH=function(t){t=t.slice();const e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=St(t[r],e[t[r].ref]));return t},t.bI=function(t){if("custom"===t.type)return new ch(t);switch(t.type){case"background":return new oh(t);case"circle":return new Js(t);case"color-relief":return new _l(t);case"fill":return new sc(t);case"fill-extrusion":return new Rc(t);case"heatmap":return new ll(t);case"hillshade":return new hl(t);case"line":return new Hc(t);case"raster":return new lh(t);case"symbol":return new rh(t)}},t.bJ=q,t.bK=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let r=[];try{if(!Tt(t.version,e.version))return[{command:"setStyle",args:[e]}];Tt(t.center,e.center)||r.push({command:"setCenter",args:[e.center]}),Tt(t.state,e.state)||r.push({command:"setGlobalState",args:[e.state]}),Tt(t.centerAltitude,e.centerAltitude)||r.push({command:"setCenterAltitude",args:[e.centerAltitude]}),Tt(t.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),Tt(t.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),Tt(t.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),Tt(t.roll,e.roll)||r.push({command:"setRoll",args:[e.roll]}),Tt(t.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),Tt(t.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),Tt(t.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),Tt(t.light,e.light)||r.push({command:"setLight",args:[e.light]}),Tt(t.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),Tt(t.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),Tt(t.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const i={},n=[];!function(t,e,r,i){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||Pt(n,r,i));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?Tt(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&Ct(t,e,n)?It(r,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):kt(n,e,r,i)):Et(n,e,r))}(t.sources,e.sources,n,i);const o=[];t.layers&&t.layers.forEach((t=>{"source"in t&&i[t.source]?r.push({command:"removeLayer",args:[t.id]}):o.push(t)})),r=r.concat(n),function(t,e,r){e=e||[];const i=(t=t||[]).map(Mt),n=e.map(Mt),o=t.reduce(Rt,{}),a=e.reduce(Rt,{}),s=i.slice(),l=Object.create(null);let c,u,h,d,p;for(let f=0,m=0;f<i.length;f++)c=i[f],Object.prototype.hasOwnProperty.call(a,c)?m++:(It(r,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,m),1));for(let f=0,m=0;f<n.length;f++)c=n[n.length-1-f],s[s.length-1-f]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(It(r,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-m),1)):m++,d=s[s.length-f],It(r,{command:"addLayer",args:[a[c],d]}),s.splice(s.length-f,0,c),l[c]=!0);for(let f=0;f<n.length;f++)if(c=n[f],u=o[c],h=a[c],!l[c]&&!Tt(u,h))if(Tt(u.source,h.source)&&Tt(u["source-layer"],h["source-layer"])&&Tt(u.type,h.type)){for(p in At(u.layout,h.layout,r,c,null,"setLayoutProperty"),At(u.paint,h.paint,r,c,null,"setPaintProperty"),Tt(u.filter,h.filter)||It(r,{command:"setFilter",args:[c,h.filter]}),Tt(u.minzoom,h.minzoom)&&Tt(u.maxzoom,h.maxzoom)||It(r,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?At(u[p],h[p],r,c,p.slice(6),"setPaintProperty"):Tt(u[p],h[p])||It(r,{command:"setLayerProperty",args:[c,p,h[p]]}));for(p in h)Object.prototype.hasOwnProperty.call(h,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?At(u[p],h[p],r,c,p.slice(6),"setPaintProperty"):Tt(u[p],h[p])||It(r,{command:"setLayerProperty",args:[c,p,h[p]]}))}else It(r,{command:"removeLayer",args:[c]}),d=s[s.lastIndexOf(c)+1],It(r,{command:"addLayer",args:[h,d]})}(o,e.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:"setStyle",args:[e]}]}return r},t.bL=function(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},t.bM=G,t.bN=$,t.bO=class extends hs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.bP=fs,t.bQ=class extends hs{constructor(t,e){super(t,e),this.current=ms}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.bR=ps,t.bS=class extends hs{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.bT=class extends hs{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.bU=_,t.bV=function(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=-r,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.bW=function(t,e,r){var i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t},t.bX=function(t,e,r,i,n,o,a){var s=1/(e-r),l=1/(i-n),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(n+i)*l,t[14]=(a+o)*c,t[15]=1,t},t.bY=class extends hs{constructor(t,e){super(t,e),this.current=new Array}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(4*t.length);for(let r=0;r<t.length;r++)e[4*r]=t[r].r,e[4*r+1]=t[r].g,e[4*r+2]=t[r].b,e[4*r+3]=t[r].a;this.gl.uniform4fv(this.location,e)}}},t.bZ=class extends hs{constructor(t,e){super(t,e),this.current=new Array}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(t);this.gl.uniform1fv(this.location,e)}}},t.b_=class extends ha{},t.ba=function(t,e,r){const i=new Float64Array(4);return C(i,t,e-90,r),i},t.bb=function(t,e,r,i){var n,o,a,s,l,c=e[0],u=e[1],h=e[2],d=e[3],p=r[0],f=r[1],g=r[2],_=r[3];return(o=c*p+u*f+h*g+d*_)<0&&(o=-o,p=-p,f=-f,g=-g,_=-_),1-o>m?(n=Math.acos(o),a=Math.sin(n),s=Math.sin((1-i)*n)/a,l=Math.sin(i*n)/a):(s=1-i,l=i),t[0]=s*c+l*p,t[1]=s*u+l*f,t[2]=s*h+l*g,t[3]=s*d+l*_,t},t.bc=function(t){const e=new Float64Array(9);var r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v;h=(n=(i=t)[0])*(l=n+n),d=(o=i[1])*l,f=(a=i[2])*l,m=a*(c=o+o),_=(s=i[3])*l,y=s*c,v=s*(u=a+a),(r=e)[0]=1-(p=o*c)-(g=a*u),r[3]=d-v,r[6]=f+y,r[1]=d+v,r[4]=1-h-g,r[7]=m-_,r[2]=f-y,r[5]=m+_,r[8]=1-h-p;const b=nt(-Math.asin(B(e[2],-1,1)));let x,w;return Math.hypot(e[5],e[8])<.001?(x=0,w=-nt(Math.atan2(e[3],e[4]))):(x=nt(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),w=nt(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:x,pitch:b+90,bearing:w}},t.bd=function(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing},t.be=Ce,t.bf=ds,t.bg=Xl,t.bh=Jl,t.bi=Wl,t.bj=z,t.bk=O,t.bl=Ue,t.bm=function(t,e,r,i,n){return z(i,n,B((t-e)/(r-e),0,1))},t.bn=D,t.bo=function(){return new Float64Array(3)},t.bp=function(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t},t.bq=C,t.br=function(t,e,r){var i=r[0],n=r[1],o=r[2],a=e[0],s=e[1],l=e[2],c=n*l-o*s,u=o*a-i*l,h=i*s-n*a,d=n*h-o*u,p=o*c-i*h,f=i*u-n*c,m=2*r[3];return u*=m,h*=m,p*=2,f*=2,t[0]=a+(c*=m)+(d*=2),t[1]=s+u+p,t[2]=l+h+f,t},t.bs=function(t,e,r){const i=(n=[t[0],t[1],t[2],e[0],e[1],e[2],r[0],r[1],r[2]])[0]*((u=n[8])*(a=n[4])-(s=n[5])*(c=n[7]))+n[1]*(-u*(o=n[3])+s*(l=n[6]))+n[2]*(c*o-a*l);var n,o,a,s,l,c,u;if(0===i)return null;const h=T([],[e[0],e[1],e[2]],[r[0],r[1],r[2]]),d=T([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),p=T([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),f=S([],h,-t[3]);return w(f,f,S([],d,-e[3])),w(f,f,S([],p,-r[3])),S(f,f,1/i),f},t.bt=dh,t.bu=function(){return new Float64Array(4)},t.bv=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bw=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bx=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.by=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[8],u=e[9],h=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-c*i,t[1]=a*n-u*i,t[2]=s*n-h*i,t[3]=l*n-d*i,t[8]=o*i+c*n,t[9]=a*i+u*n,t[10]=s*i+h*n,t[11]=l*i+d*n,t},t.bz=function(t,e){const r=D(t,360),i=D(e,360),n=i-r,o=i>r?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},t.c=lt,t.c0=class extends pa{},t.c1=sl,t.c2=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.c3=al,t.c4=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return t[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/(a=a||1),t[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,t[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,t},t.c5=class extends ea{},t.c6=class extends ba{},t.c7=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},t.c8=function(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],g=t[13],_=t[14],y=t[15],v=e[0],b=e[1],x=e[2],w=e[3],S=e[4],T=e[5],I=e[6],E=e[7],P=e[8],k=e[9],C=e[10],A=e[11],M=e[12],R=e[13],L=e[14],D=e[15];return Math.abs(r-v)<=m*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-b)<=m*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(n-x)<=m*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-w)<=m*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-S)<=m*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(s-T)<=m*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-I)<=m*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(c-E)<=m*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(u-P)<=m*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(h-k)<=m*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(d-C)<=m*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-A)<=m*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(f-M)<=m*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(g-R)<=m*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(_-L)<=m*Math.max(1,Math.abs(_),Math.abs(L))&&Math.abs(y-D)<=m*Math.max(1,Math.abs(y),Math.abs(D))},t.c9=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.cA=function(t){delete ct.REGISTERED_PROTOCOLS[t]},t.cB=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||Sn(t[n]);e&&(e[t[n].id]=i);let o=r[i];o||(o=r[i]=[]),o.push(t[n])}const i=[];for(const n in r)i.push(r[n]);return i},t.cC=co,t.cD=kh,t.cE=Ah,t.cF=_u,t.cG=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=R/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const r=e.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,o={layoutIconSize:n["icon-size"].possiblyEvaluate(new Mo(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Mo(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Mo(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.textSizeData;o.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Mo(t),e.canonical),n["text-size"].possiblyEvaluate(new Mo(r),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;o.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Mo(t),e.canonical),n["icon-size"].possiblyEvaluate(new Mo(r),e.canonical)]}const a=i.get("text-line-height")*au,s="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),l=i.get("text-keep-upright"),c=i.get("text-size");for(const u of e.bucket.features){const n=i.get("text-font").evaluate(u,{},e.canonical).join(","),h=c.evaluate(u,{},e.canonical),d=o.layoutTextSize.evaluate(u,{},e.canonical),p=o.layoutIconSize.evaluate(u,{},e.canonical),f={horizontal:{},vertical:void 0},m=u.text;let g,_=[0,0];if(m){const o=m.toString(),c=i.get("text-letter-spacing").evaluate(u,{},e.canonical)*au,p=vo(o)?c:0,g=i.get("text-anchor").evaluate(u,{},e.canonical),y=ed(r,u,e.canonical);if(!y){const t=i.get("text-radial-offset").evaluate(u,{},e.canonical);_=t?td(g,[t*au,Qh]):i.get("text-offset").evaluate(u,{},e.canonical).map((t=>t*au))}let v=s?"center":i.get("text-justify").evaluate(u,{},e.canonical);const b="point"===i.get("symbol-placement")?i.get("text-max-width").evaluate(u,{},e.canonical)*au:1/0,x=()=>{e.bucket.allowVerticalPlacement&&yo(o)&&(f.vertical=bu(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,b,a,g,"left",p,_,t.an.vertical,!0,d,h))};if(!s&&y){const r=new Set;if("auto"===v)for(let t=0;t<y.values.length;t+=2)r.add(rd(y.values[t]));else r.add(v);let i=!1;for(const o of r)if(!f.horizontal[o])if(i)f.horizontal[o]=f.horizontal[0];else{const r=bu(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,b,a,"center",o,p,_,t.an.horizontal,!1,d,h);r&&(f.horizontal[o]=r,i=1===r.positionedLines.length)}x()}else{"auto"===v&&(v=rd(g));const r=bu(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,b,a,g,v,p,_,t.an.horizontal,!1,d,h);r&&(f.horizontal[v]=r),x(),yo(o)&&s&&l&&(f.vertical=bu(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,b,a,g,v,p,_,t.an.vertical,!1,d,h))}}let y=!1;if(u.icon&&u.icon.name){const t=e.imageMap[u.icon.name];t&&(g=Fu(e.imagePositions[u.icon.name],i.get("icon-offset").evaluate(u,{},e.canonical),i.get("icon-anchor").evaluate(u,{},e.canonical)),y=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&W("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const v=od(f.horizontal)||f.vertical;e.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&id(e.bucket,u,f,g,e.imageMap,o,d,p,_,y,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.cH=Vc,t.cI=ic,t.cJ=Ec,t.cK=wc,t.cL=hu,t.cM=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.cN=function(t,r,i,n,o){return e(this,void 0,void 0,(function*(){if(f())try{return yield Q(t,r,i,n,o)}catch(t){}return function(t,e,r,i,n){const o=t.width,a=t.height;tt&&et||(tt=new OffscreenCanvas(o,a),et=tt.getContext("2d",{willReadFrequently:!0})),tt.width=o,tt.height=a,et.drawImage(t,0,0,o,a);const s=et.getImageData(e,r,i,n);return et.clearRect(0,0,o,a),s.data}(t,r,i,n,o)}))},t.cO=ml,t.cP=r,t.cQ=o,t.cR=xc,t.cS=cu,t.cT=on,t.cU=Ao,t.ca=t=>"symbol"===t.type,t.cb=t=>"circle"===t.type,t.cc=t=>"heatmap"===t.type,t.cd=t=>"line"===t.type,t.ce=t=>"fill"===t.type,t.cf=t=>"fill-extrusion"===t.type,t.cg=t=>"hillshade"===t.type,t.ch=t=>"color-relief"===t.type,t.ci=t=>"raster"===t.type,t.cj=t=>"background"===t.type,t.ck=t=>"custom"===t.type,t.cl=F,t.cm=function(t,e,r){const i=M(e.x-r.x,e.y-r.y),n=M(t.x-r.x,t.y-r.y);var o,a;return nt(Math.atan2(i[0]*n[1]-i[1]*n[0],(o=i)[0]*(a=n)[0]+o[1]*a[1]))},t.cn=N,t.co=function(t,e){return at[e]&&(t instanceof MouseEvent||t instanceof WheelEvent)},t.cp=function(t,e){return ot[e]&&"touches"in t},t.cq=function(t){return ot[t]||at[t]},t.cr=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t},t.cs=function(t,e){const{x:r,y:i}=xh.fromLngLat(e);return!(t<0||t>25||i<0||i>=1||r<0||r>=1)},t.ct=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.cu=class extends ta{},t.cv=bd,t.cx=function(t){return t.message===st},t.cy=dt,t.cz=function(t,e){ct.REGISTERED_PROTOCOLS[t]=e},t.d=mt,t.e=U,t.f=t=>e(void 0,void 0,void 0,(function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),t.g=ut,t.h=t=>new Promise(((e,r)=>{const i=new Image;i.onload=()=>{e(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=K}))},i.onerror=()=>r(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 n=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):K})),t.i=X,t.j=(t,e)=>ft(U(t,{type:"json"}),e),t.k=vt,t.l=yt,t.m=ft,t.n=(t,e)=>ft(U(t,{type:"arrayBuffer"}),e),t.o=function(t){return new hu(t).readFields(du,[])},t.p=mu,t.q=nl,t.r=qo,t.s=rt,t.t=Do,t.u=_o,t.v=xt,t.w=W,t.x=ro,t.y=ao,t.z=eo})),r("worker",["./shared"],(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,r){for(const n of e){this._layerConfigs[n.id]=n;const e=this._layers[n.id]=t.bI(n);e._featureFilter=t.a9(e.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(const t of r)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const i=t.cB(Object.values(this._layerConfigs),this.keyCache);for(const t of i){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const i=r.source||"";let n=this.familiesBySource[i];n||(n=this.familiesBySource[i]={});const o=r.sourceLayer||"_geojsonTileLayer";let a=n[o];a||(a=n[o]=[]),a.push(e)}}}class r{constructor(e){const r={},i=[];for(const t in e){const n=e[t],o=r[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const r={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};i.push(r),o[t]={rect:r,metrics:e.metrics}}}const{w:n,h:o}=t.p(i),a=new t.q({width:n||1,height:o||1});for(const s in e){const i=e[s];for(const e in i){const n=i[+e];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const o=r[s][e].rect;t.q.copy(n.bitmap,a,{x:0,y:0},{x:o.x+1,y:o.y+1},n.bitmap)}}this.image=a,this.positions=r}}t.cC("GlyphAtlas",r);class i{constructor(e){this.tileID=new t.Z(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.globalState=e.globalState}parse(e,i,o,a,s){return t._(this,void 0,void 0,(function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a7;const l=new t.cD(Object.keys(e.layers).sort()),c=new t.cE(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o,subdivisionGranularity:s},d=i.familiesBySource[this.source];for(const r in d){const i=e.layers[r];if(!i)continue;1===i.version&&t.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(r),s=[];for(let t=0;t<i.length;t++){const e=i.feature(t),n=c.getId(e,r);s.push({feature:e,id:n,index:t,sourceLayerIndex:a})}for(const e of d[r]){const r=e[0];r.source!==this.source&&t.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(n(e,this.zoom,o),(u[r.id]=r.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source,globalState:this.globalState})).populate(s,h,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}const p=t.bM(h.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const t=new AbortController;this.inFlightDependencies.push(t),f=a.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const m=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(m.length){const t=new AbortController;this.inFlightDependencies.push(t),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},t)}const _=Object.keys(h.patternDependencies);let y=Promise.resolve({});if(_.length){const t=new AbortController;this.inFlightDependencies.push(t),y=a.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const[v,b,x]=yield Promise.all([f,g,y]),w=new r(v),S=new t.cF(b,x);for(const e in u){const r=u[e];r instanceof t.a8?(n(r.layers,this.zoom,o),t.cG({bucket:r,glyphMap:v,glyphPositions:w.positions,imageMap:b,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):r.hasPattern&&(r instanceof t.cH||r instanceof t.cI||r instanceof t.cJ)&&(n(r.layers,this.zoom,o),r.addFeatures(h,this.tileID.canonical,S.patternPositions))}return this.status="done",{buckets:Object.values(u).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:w.image,imageAtlas:S,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?w.positions:null}}))}}function n(e,r,i){const n=new t.F(r);for(const t of e)t.recalculate(n,i)}class o{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(e,r){return t._(this,void 0,void 0,(function*(){const i=yield t.n(e.request,r);try{return{vectorTile:new t.cK.VectorTile(new t.cL(i.data)),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires}}catch(t){const n=new Uint8Array(i.data);let o=`Unable to parse the tile at ${e.request.url}, `;throw o+=31===n[0]&&139===n[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(o)}}))}loadTile(e){return t._(this,void 0,void 0,(function*(){const r=e.uid,n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cM(e.request),o=new i(e);this.loading[r]=o;const a=new AbortController;o.abort=a;try{const i=yield this.loadVectorTile(e,a);if(delete this.loading[r],!i)return null;const s=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(n){const t=n.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}o.vectorTile=i.vectorTile;const u=o.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=o,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:c};try{const e=yield u;return t.e({rawTileData:s.slice(0)},e,l,c)}finally{delete this.fetching[r]}}catch(t){throw delete this.loading[r],o.status="done",this.loaded[r]=o,t}}))}reloadTile(e){return t._(this,void 0,void 0,(function*(){const r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const i=this.loaded[r];if(i.showCollisionBoxes=e.showCollisionBoxes,i.globalState=e.globalState,"parsing"===i.status){const n=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);let o;if(this.fetching[r]){const{rawTileData:e,cacheControl:i,resourceTiming:a}=this.fetching[r];delete this.fetching[r],o=t.e({rawTileData:e.slice(0)},n,i,a)}else o=n;return o}if("done"===i.status&&i.vectorTile)return i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){const t=this.loading,r=e.uid;t&&t[r]&&t[r].abort&&(t[r].abort.abort(),delete t[r])}))}removeTile(e){return t._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}))}}class a{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,(function*(){const{uid:r,encoding:i,rawImageData:n,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,c=n.width+2,u=n.height+2,h=t.b(n)?new t.R({width:c,height:u},yield t.cN(n,-1,-1,c,u)):n,d=new t.cO(r,h,i,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=d,d}))}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}var s,l,c=function(){if(l)return s;function t(t,r){if(0!==t.length){e(t[0],r);for(var i=1;i<t.length;i++)e(t[i],!r)}}function e(t,e){for(var r=0,i=0,n=0,o=t.length,a=o-1;n<o;a=n++){var s=(t[n][0]-t[a][0])*(t[a][1]+t[n][1]),l=r+s;i+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+i>=0!=!!e&&t.reverse()}return l=1,s=function e(r,i){var n,o=r&&r.type;if("FeatureCollection"===o)for(n=0;n<r.features.length;n++)e(r.features[n],i);else if("GeometryCollection"===o)for(n=0;n<r.geometries.length;n++)e(r.geometries[n],i);else if("Feature"===o)e(r.geometry,i);else if("Polygon"===o)t(r.coordinates,i);else if("MultiPolygon"===o)for(n=0;n<r.coordinates.length;n++)t(r.coordinates[n],i);return r}}(),u=t.cP(c);const h=t.cK.VectorTileFeature.prototype.toGeoJSON;class d{constructor(e){this._feature=e,this.extent=t.$,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const r of this._feature.geometry)e.push([new t.P(r[0],r[1])]);return e}{const e=[];for(const r of this._feature.geometry){const i=[];for(const e of r)i.push(new t.P(e[0],e[1]));e.push(i)}return e}}toGeoJSON(t,e,r){return h.call(this,t,e,r)}}class p{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.$,this.length=e.length,this._features=e}feature(t){return new d(this._features[t])}}var f,m,g,_={exports:{}},y=function(){if(g)return _.exports;g=1;var e=t.cS(),r=function(){if(m)return f;m=1;var e=t.cQ(),r=t.cR().VectorTileFeature;function i(t,e){this.options=e||{},this.features=t,this.length=t.length}function n(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}return f=i,i.prototype.feature=function(t){return new n(this.features[t],this.options.extent)},n.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var r=0;r<t.length;r++){for(var i=t[r],n=[],o=0;o<i.length;o++)n.push(new e(i[o][0],i[o][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,i=1/0,n=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),i=Math.min(i,l.y),n=Math.max(n,l.y)}return[e,i,r,n]},n.prototype.toGeoJSON=r.prototype.toGeoJSON,f}();function i(t){var r=new e;return function(t,e){for(var r in t.layers)e.writeMessage(3,n,t.layers[r])}(t,r),r.finish()}function n(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var i={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)i.feature=t.feature(r),e.writeMessage(2,o,i);var n=i.keys;for(r=0;r<n.length;r++)e.writeStringField(3,n[r]);var a=i.values;for(r=0;r<a.length;r++)e.writeMessage(4,u,a[r])}function o(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,a,t),e.writeVarintField(3,r.type),e.writeMessage(4,c,r)}function a(t,e){var r=t.feature,i=t.keys,n=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],c=o[s];if(null!==l){void 0===c&&(i.push(s),o[s]=c=i.length-1),e.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var h=u+":"+l,d=a[h];void 0===d&&(n.push(l),a[h]=d=n.length-1),e.writeVarint(d)}}}function s(t,e){return(e<<3)+(7&t)}function l(t){return t<<1^t>>31}function c(t,e){for(var r=t.loadGeometry(),i=t.type,n=0,o=0,a=r.length,c=0;c<a;c++){var u=r[c],h=1;1===i&&(h=u.length),e.writeVarint(s(1,h));for(var d=3===i?u.length-1:u.length,p=0;p<d;p++){1===p&&1!==i&&e.writeVarint(s(2,d-1));var f=u[p].x-n,m=u[p].y-o;e.writeVarint(l(f)),e.writeVarint(l(m)),n+=f,o+=m}3===i&&e.writeVarint(s(7,1))}}function u(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}return _.exports=i,_.exports.fromVectorTileJs=i,_.exports.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var o in t)n[o]=new r(t[o].features,e),n[o].name=o,n[o].version=e.version,n[o].extent=e.extent;return i({layers:n})},_.exports.GeoJSONWrapper=r,_.exports}(),v=t.cP(y);const b={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},x=Math.fround||(w=new Float32Array(1),t=>(w[0]=+t,w[0]));var w;class S{constructor(t){this.options=Object.assign(Object.create(b),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const o=[];for(let s=0;s<t.length;s++){const e=t[s];if(!e.geometry)continue;const[r,i]=e.geometry.coordinates,n=x(E(r)),a=x(P(i));o.push(n,a,1/0,s,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[i+1]=this._createTree(o);e&&console.timeEnd(n);for(let s=i;s>=r;s--){const t=+Date.now();a=this.trees[s]=this._createTree(this._cluster(a,s)),e&&console.log("z%d: %d clusters in %dms",s,a.numItems,+Date.now()-t)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){const t=this.getClusters([r,i,180,o],e),a=this.getClusters([-180,i,n,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(E(r),P(o),E(n),P(i)),l=a.data,c=[];for(const u of s){const t=this.stride*u;c.push(l[t+5]>1?T(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);const o=n.data;if(e*this.stride>=o.length)throw new Error(i);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=n.within(o[e*this.stride],o[e*this.stride+1],a),l=[];for(const c of s){const e=c*this.stride;o[e+4]===t&&l.push(o[e+5]>1?T(o,e,this.clusterProps):this.points[o[e+3]])}if(0===l.length)throw new Error(i);return l}getLeaves(t,e,r){const i=[];return this._appendLeaves(i,t,e=e||10,r=r||0,0),i}getTile(t,e,r){const i=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(r-s)/n,c=(r+1+s)/n,u={features:[]};return this._addTileFeatures(i.range((e-s)/n,l,(e+1+s)/n,c),i.data,e,r,n,u),0===e&&this._addTileFeatures(i.range(1-s/n,l,1,c),i.data,n,r,n,u),e===n-1&&this._addTileFeatures(i.range(0,l,s/n,c),i.data,-1,r,n,u),u.features.length?u:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,i,n){const o=this.getChildren(e);for(const a of o){const e=a.properties;if(e&&e.cluster?n+e.point_count<=i?n+=e.point_count:n=this._appendLeaves(t,e.cluster_id,r,i,n):n<i?n++:t.push(a),t.length===r)break}return n}_createTree(e){const r=new t.aH(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)r.add(e[t],e[t+1]);return r.finish(),r.data=e,r}_addTileFeatures(t,e,r,i,n,o){for(const a of t){const t=a*this.stride,s=e[t+5]>1;let l,c,u;if(s)l=I(e,t,this.clusterProps),c=e[t],u=e[t+1];else{const r=this.points[e[t+3]];l=r.properties;const[i,n]=r.geometry.coordinates;c=E(i),u=P(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-r)),Math.round(this.options.extent*(u*n-i))]],tags:l};let d;d=s||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:i,reduce:n,minPoints:o}=this.options,a=r/(i*Math.pow(2,e)),s=t.data,l=[],c=this.stride;for(let u=0;u<s.length;u+=c){if(s[u+2]<=e)continue;s[u+2]=e;const r=s[u],i=s[u+1],h=t.within(s[u],s[u+1],a),d=s[u+5];let p=d;for(const t of h){const r=t*c;s[r+2]>e&&(p+=s[r+5])}if(p>d&&p>=o){let t,o=r*d,a=i*d,f=-1;const m=(u/c<<5)+(e+1)+this.points.length;for(const r of h){const i=r*c;if(s[i+2]<=e)continue;s[i+2]=e;const l=s[i+5];o+=s[i]*l,a+=s[i+1]*l,s[i+4]=m,n&&(t||(t=this._map(s,u,!0),f=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(s,i)))}s[u+4]=m,l.push(o/p,a/p,1/0,m,-1,p),n&&l.push(f)}else{for(let t=0;t<c;t++)l.push(s[u+t]);if(p>1)for(const t of h){const r=t*c;if(!(s[r+2]<=e)){s[r+2]=e;for(let t=0;t<c;t++)l.push(s[r+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const i=this.clusterProps[t[e+6]];return r?Object.assign({},i):i}const i=this.points[t[e+3]].properties,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}}function T(t,e,r){return{type:"Feature",id:t[e+3],properties:I(t,e,r),geometry:{type:"Point",coordinates:[(i=t[e],360*(i-.5)),k(t[e+1])]}};var i}function I(t,e,r){const i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,o=t[e+6],a=-1===o?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}function E(t){return t/360+.5}function P(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function k(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function C(t,e,r,i){let n=i;const o=e+(r-e>>1);let a,s=r-e;const l=t[e],c=t[e+1],u=t[r],h=t[r+1];for(let d=e+3;d<r;d+=3){const e=A(t[d],t[d+1],l,c,u,h);if(e>n)a=d,n=e;else if(e===n){const t=Math.abs(d-o);t<s&&(a=d,s=t)}}n>i&&(a-e>3&&C(t,e,a,i),t[a+2]=n,r-a>3&&C(t,a,r,i))}function A(t,e,r,i,n,o){let a=n-r,s=o-i;if(0!==a||0!==s){const l=((t-r)*a+(e-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return a=t-r,s=e-i,a*a+s*s}function M(t,e,r,i){const n={id:null==t?null:t,type:e,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===e||"MultiPoint"===e||"LineString"===e)R(n,r);else if("Polygon"===e)R(n,r[0]);else if("MultiLineString"===e)for(const o of r)R(n,o);else if("MultiPolygon"===e)for(const o of r)R(n,o[0]);return n}function R(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function L(t,e,r,i){if(!e.geometry)return;const n=e.geometry.coordinates;if(n&&0===n.length)return;const o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=i||0),"Point"===o)D(n,s);else if("MultiPoint"===o)for(const c of n)D(c,s);else if("LineString"===o)z(n,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(const r of n)s=[],z(r,s,a,!1),t.push(M(l,"LineString",s,e.properties));return}O(n,s,a,!1)}else if("Polygon"===o)O(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of e.geometry.geometries)L(t,{id:l,geometry:n,properties:e.properties},r,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of n){const e=[];O(t,e,a,!0),s.push(e)}}t.push(M(l,o,s,e.properties))}function D(t,e){e.push(F(t[0]),N(t[1]),0)}function z(t,e,r,i){let n,o,a=0;for(let l=0;l<t.length;l++){const r=F(t[l][0]),s=N(t[l][1]);e.push(r,s,0),l>0&&(a+=i?(n*s-r*o)/2:Math.sqrt(Math.pow(r-n,2)+Math.pow(s-o,2))),n=r,o=s}const s=e.length-3;e[2]=1,C(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function O(t,e,r,i){for(let n=0;n<t.length;n++){const o=[];z(t[n],o,r,i),e.push(o)}}function F(t){return t/360+.5}function N(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function B(t,e,r,i,n,o,a,s){if(i/=e,o>=(r/=e)&&a<i)return t;if(a<r||o>=i)return null;const l=[];for(const c of t){const t=c.geometry;let e=c.type;const o=0===n?c.minX:c.minY,a=0===n?c.maxX:c.maxY;if(o>=r&&a<i){l.push(c);continue}if(a<r||o>=i)continue;let u=[];if("Point"===e||"MultiPoint"===e)j(t,u,r,i,n);else if("LineString"===e)U(t,u,r,i,n,!1,s.lineMetrics);else if("MultiLineString"===e)G(t,u,r,i,n,!1);else if("Polygon"===e)G(t,u,r,i,n,!0);else if("MultiPolygon"===e)for(const s of t){const t=[];G(s,t,r,i,n,!0),t.length&&u.push(t)}if(u.length){if(s.lineMetrics&&"LineString"===e){for(const t of u)l.push(M(c.id,e,t,c.tags));continue}"LineString"!==e&&"MultiLineString"!==e||(1===u.length?(e="LineString",u=u[0]):e="MultiLineString"),"Point"!==e&&"MultiPoint"!==e||(e=3===u.length?"Point":"MultiPoint"),l.push(M(c.id,e,u,c.tags))}}return l.length?l:null}function j(t,e,r,i,n){for(let o=0;o<t.length;o+=3){const a=t[o+n];a>=r&&a<=i&&$(e,t[o],t[o+1],t[o+2])}}function U(t,e,r,i,n,o,a){let s=V(t);const l=0===n?q:Z;let c,u,h=t.start;for(let g=0;g<t.length-3;g+=3){const d=t[g],p=t[g+1],f=t[g+2],m=t[g+3],_=t[g+4],y=0===n?d:p,v=0===n?m:_;let b=!1;a&&(c=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-_,2))),y<r?v>r&&(u=l(s,d,p,m,_,r),a&&(s.start=h+c*u)):y>i?v<i&&(u=l(s,d,p,m,_,i),a&&(s.start=h+c*u)):$(s,d,p,f),v<r&&y>=r&&(u=l(s,d,p,m,_,r),b=!0),v>i&&y<=i&&(u=l(s,d,p,m,_,i),b=!0),!o&&b&&(a&&(s.end=h+c*u),e.push(s),s=V(t)),a&&(h+=c)}let d=t.length-3;const p=t[d],f=t[d+1],m=0===n?p:f;m>=r&&m<=i&&$(s,p,f,t[d+2]),d=s.length-3,o&&d>=3&&(s[d]!==s[0]||s[d+1]!==s[1])&&$(s,s[0],s[1],s[2]),s.length&&e.push(s)}function V(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function G(t,e,r,i,n,o){for(const a of t)U(a,e,r,i,n,o,!1)}function $(t,e,r,i){t.push(e,r,i)}function q(t,e,r,i,n,o){const a=(o-e)/(i-e);return $(t,o,r+(n-r)*a,1),a}function Z(t,e,r,i,n,o){const a=(o-r)/(n-r);return $(t,e+(i-e)*a,o,1),a}function W(t,e){const r=[];for(let i=0;i<t.length;i++){const n=t[i],o=n.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=H(n.geometry,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of n.geometry)a.push(H(t,e))}else if("MultiPolygon"===o){a=[];for(const t of n.geometry){const r=[];for(const i of t)r.push(H(i,e));a.push(r)}}r.push(M(n.id,o,a,n.tags))}return r}function H(t,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function X(t,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,n=t.y;for(const o of t.features){const t=o.geometry,a=o.type;if(o.geometry=[],1===a)for(let s=0;s<t.length;s+=2)o.geometry.push(J(t[s],t[s+1],e,r,i,n));else for(let s=0;s<t.length;s++){const a=[];for(let o=0;o<t[s].length;o+=2)a.push(J(t[s][o],t[s][o+1],e,r,i,n));o.geometry.push(a)}}return t.transformed=!0,t}function J(t,e,r,i,n,o){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-o))]}function Y(t,e,r,i,n){const o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:i,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const s of t)K(a,s,o,n);return a}function K(t,e,r,i){const n=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let s=0;s<n.length;s+=3)a.push(n[s],n[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)Q(a,n,t,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let s=0;s<n.length;s++)Q(a,n[s],t,r,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(let s=0;s<n.length;s++){const e=n[s];for(let i=0;i<e.length;i++)Q(a,e[i],t,r,!0,0===i)}if(a.length){let r=e.tags||null;if("LineString"===o&&i.lineMetrics){r={};for(const t in e.tags)r[t]=e.tags[t];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}const s={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:r};null!==e.id&&(s.id=e.id),t.features.push(s)}}function Q(t,e,r,i,n,o){const a=i*i;if(i>0&&e.size<(n?a:i))return void(r.numPoints+=e.length/3);const s=[];for(let l=0;l<e.length;l+=3)(0===i||e[l+2]>a)&&(r.numSimplified++,s.push(e[l],e[l+1])),r.numPoints++;n&&function(t,e){let r=0;for(let i=0,n=t.length,o=n-2;i<n;o=i,i+=2)r+=(t[i]-t[o])*(t[i+1]+t[o+1]);if(r>0===e)for(let i=0,n=t.length;i<n/2;i+=2){const e=t[i],r=t[i+1];t[i]=t[n-2-i],t[i+1]=t[n-1-i],t[n-2-i]=e,t[n-1-i]=r}}(s,o),t.push(s)}const tt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class et{constructor(t,e){const r=(e=this.options=function(t,e){for(const r in e)t[r]=e[r];return t}(Object.create(tt),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(t,e){const r=[];if("FeatureCollection"===t.type)for(let i=0;i<t.features.length;i++)L(r,t.features[i],e,i);else L(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(t,e){const r=e.buffer/e.extent;let i=t;const n=B(t,1,-1-r,r,0,-1,2,e),o=B(t,1,1-r,2+r,0,-1,2,e);return(n||o)&&(i=B(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=W(n,1).concat(i)),o&&(i=i.concat(W(o,-1)))),i}(i,e),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(t,e,r,i,n,o,a){const s=[t,e,r,i],l=this.options,c=l.debug;for(;s.length;){i=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();const u=1<<e,h=rt(e,r,i);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=Y(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(d.source=t,null==n){if(e===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(null!=n){const t=n-e;if(r!==o>>t||i!==a>>t)continue}}if(d.source=null,0===t.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,g=1+p;let _=null,y=null,v=null,b=null,x=B(t,u,r-p,r+m,0,d.minX,d.maxX,l),w=B(t,u,r+f,r+g,0,d.minX,d.maxX,l);t=null,x&&(_=B(x,u,i-p,i+m,1,d.minY,d.maxY,l),y=B(x,u,i+f,i+g,1,d.minY,d.maxY,l),x=null),w&&(v=B(w,u,i-p,i+m,1,d.minY,d.maxY,l),b=B(w,u,i+f,i+g,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd("clipping"),s.push(_||[],e+1,2*r,2*i),s.push(y||[],e+1,2*r,2*i+1),s.push(v||[],e+1,2*r+1,2*i),s.push(b||[],e+1,2*r+1,2*i+1)}}getTile(t,e,r){t=+t,e=+e,r=+r;const i=this.options,{extent:n,debug:o}=i;if(t<0||t>24)return null;const a=1<<t,s=rt(t,e=e+a&a-1,r);if(this.tiles[s])return X(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);let l,c=t,u=e,h=r;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[rt(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?X(this.tiles[s],n):null):null}}function rt(t,e,r){return 32*((1<<t)*r+e)+t}function it(t,e){return e?t.properties[e]:t.id}function nt(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=it(t,e);if("FeatureCollection"===t.type){const r=new Set;for(const i of t.features){const t=it(i,e);if(null==t)return!1;if(r.has(t))return!1;r.add(t)}return!0}return!1}function ot(t,e){const r=new Map;if(null==t);else if("Feature"===t.type)r.set(it(t,e),t);else for(const i of t.features)r.set(it(i,e),i);return r}class at extends o{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(e,r){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const r=this._geoJSONIndex.getTile(t.z,t.x,t.y);if(!r)return null;const i=new p(r.features);let n=v(i);return 0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:i,rawData:n.buffer}}))}loadData(e){return t._(this,void 0,void 0,(function*(){var r;null===(r=this._pendingRequest)||void 0===r||r.abort();const i=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cM(e.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(e,this._pendingRequest),this._geoJSONIndex=e.cluster?new S(function({superclusterOptions:e,clusterProperties:r}){if(!r||!e)return e;const i={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(r);for(const l of s){const[e,o]=r[l],a=t.cT(o),s=t.cT("string"==typeof e?[e,["accumulated"],["get",l]]:e);i[l]=a.value,n[l]=s.value}return e.map=t=>{a.properties=t;const e={};for(const r of s)e[r]=i[r].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const r of s)o.accumulated=t[r],t[r]=n[r].evaluate(o,a)},e}(e)).load((yield this._pendingData).features):(n=yield this._pendingData,new et(n,e.geojsonVtOptions)),this.loaded={};const r={};if(i){const t=i.finish();t&&(r.resourceTiming={},r.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}return r}catch(e){if(delete this._pendingRequest,t.cx(e))return{abandoned:!0};throw e}var n}))}getData(){return t._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(t){const e=this.loaded;return e&&e[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,r){return t._(this,void 0,void 0,(function*(){let i=yield this.loadGeoJSON(e,r);if(delete this._pendingRequest,"object"!=typeof i)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(u(i,!0),e.filter){const r=t.cT(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const n=i.features.filter((t=>r.value.evaluate({zoom:0},t)));i={type:"FeatureCollection",features:n}}return i}))}loadGeoJSON(e,r){return t._(this,void 0,void 0,(function*(){const{promoteId:i}=e;if(e.request){const n=yield t.j(e.request,r);return this._dataUpdateable=nt(n.data,i)?ot(n.data,i):void 0,n.data}if("string"==typeof e.data)try{const t=JSON.parse(e.data);return this._dataUpdateable=nt(t,i)?ot(t,i):void 0,t}catch(t){throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}if(!e.dataDiff)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${e.source}`);return function(t,e,r){var i,n,o,a;if(e.removeAll&&t.clear(),e.remove)for(const s of e.remove)t.delete(s);if(e.add)for(const s of e.add){const e=it(s,r);null!=e&&t.set(e,s)}if(e.update)for(const s of e.update){let e=t.get(s.id);if(null==e)continue;const r=!s.removeAllProperties&&((null===(i=s.removeProperties)||void 0===i?void 0:i.length)>0||(null===(n=s.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((s.newGeometry||s.removeAllProperties||r)&&(e=Object.assign({},e),t.set(s.id,e),r&&(e.properties=Object.assign({},e.properties))),s.newGeometry&&(e.geometry=s.newGeometry),s.removeAllProperties)e.properties={};else if((null===(o=s.removeProperties)||void 0===o?void 0:o.length)>0)for(const t of s.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(a=s.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:t,value:i}of s.addOrUpdateProperties)e.properties[t]=i}}(this._dataUpdateable,e.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(e){return t._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}class st{constructor(e){this.self=e,this.actor=new t.J(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.cz,this.self.removeProtocol=t.cA,this.self.registerRTLTextPlugin=e=>{t.cU.setMethods(e)},this.actor.registerMessageHandler("LDT",((t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e))),this.actor.registerMessageHandler("RDT",((e,r)=>t._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})))),this.actor.registerMessageHandler("GCEZ",((e,r)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})))),this.actor.registerMessageHandler("GCC",((e,r)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})))),this.actor.registerMessageHandler("GCL",((e,r)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})))),this.actor.registerMessageHandler("LD",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e))),this.actor.registerMessageHandler("GD",((t,e)=>this._getWorkerSource(t,e.type,e.source).getData())),this.actor.registerMessageHandler("LT",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e))),this.actor.registerMessageHandler("RT",((t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e))),this.actor.registerMessageHandler("AT",((t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e))),this.actor.registerMessageHandler("RMT",((t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e))),this.actor.registerMessageHandler("RS",((e,r)=>t._(this,void 0,void 0,(function*(){if(!this.workerSources[e]||!this.workerSources[e][r.type]||!this.workerSources[e][r.type][r.source])return;const t=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],void 0!==t.removeSource&&t.removeSource(r)})))),this.actor.registerMessageHandler("RM",(e=>t._(this,void 0,void 0,(function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e]})))),this.actor.registerMessageHandler("SR",((e,r)=>t._(this,void 0,void 0,(function*(){this.referrer=r})))),this.actor.registerMessageHandler("SRPS",((t,e)=>this._syncRTLPluginState(t,e))),this.actor.registerMessageHandler("IS",((e,r)=>t._(this,void 0,void 0,(function*(){this.self.importScripts(r)})))),this.actor.registerMessageHandler("SI",((t,e)=>this._setImages(t,e))),this.actor.registerMessageHandler("UL",((e,r)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).update(r.layers,r.removedIds)})))),this.actor.registerMessageHandler("SL",((e,r)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).replace(r)}))))}_setImages(e,r){return t._(this,void 0,void 0,(function*(){this.availableImages[e]=r;for(const t in this.workerSources[e]){const i=this.workerSources[e][t];for(const t in i)i[t].availableImages=r}}))}_syncRTLPluginState(e,r){return t._(this,void 0,void 0,(function*(){return yield t.cU.syncState(r,this.self.importScripts)}))}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new e),r}_getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const i={sendAsync:(e,r)=>(e.targetMapId=t,this.actor.sendAsync(e,r))};switch(e){case"vector":this.workerSources[t][e][r]=new o(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new at(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](i,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new a),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new st(self)),st})),r("index",["exports","./shared"],(function(t,e){var r="5.6.1";function i(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let n,o;const a={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t,r,i){const n=requestAnimationFrame((t=>{o(),r(t)})),{unsubscribe:o}=e.s(t.signal,"abort",(()=>{o(),cancelAnimationFrame(n),i(e.c())}),!1)},frameAsync(t){return new Promise(((e,r)=>{this.frame(t,e,r)}))},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>(n||(n=document.createElement("a")),n.href=t,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)}};class s{static testProp(t){if(!s.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in s.docStyle)return t[e];return t[0]}static create(t,e,r){const i=window.document.createElement(t);return void 0!==e&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){s.docStyle&&s.selectProp&&(s.userSelect=s.docStyle[s.selectProp],s.docStyle[s.selectProp]="none")}static enableDrag(){s.docStyle&&s.selectProp&&(s.docStyle[s.selectProp]=s.userSelect)}static setTransform(t,e){t.style[s.transformProp]=e}static addEventListener(t,e,r,i={}){t.addEventListener(e,r,"passive"in i?i:i.capture)}static removeEventListener(t,e,r,i={}){t.removeEventListener(e,r,"passive"in i?i:i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",s.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",s.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",s.suppressClickInternal,!0)}),0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,r,i){const n=r.boundingClientRect;return new e.P((i.clientX-n.left)/r.x-t.clientLeft,(i.clientY-n.top)/r.y-t.clientTop)}static mousePos(t,e){const r=s.getScale(t);return s.getPoint(t,r,e)}static touchPos(t,e){const r=[],i=s.getScale(t);for(let n=0;n<e.length;n++)r.push(s.getPoint(t,i,e[n]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const e=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),r=e.querySelectorAll("script");for(const i of r)i.remove();return s.clean(e),e.innerHTML}static isPossiblyDangerous(t,e){const r=e.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!r.includes("javascript:")&&!r.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const e=t.children;for(const r of e)s.removeAttributes(r),s.clean(r)}static removeAttributes(t){for(const{name:e,value:r}of t.attributes)s.isPossiblyDangerous(e,r)&&t.removeAttribute(e)}}s.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,s.selectProp=s.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),s.transformProp=s.testProp(["transform","WebkitTransform"]);const l={supported:!1,testSupport:function(t){!h&&u&&(d?p(t):c=t)}};let c,u,h=!1,d=!1;function p(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,u),t.isContextLost())return;l.supported=!0}catch(t){}t.deleteTexture(e),h=!0}var f;"undefined"!=typeof document&&(u=document.createElement("img"),u.onload=()=>{c&&p(c),c=null,d=!0},u.onerror=()=>{h=!0,c=null},u.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let r,i,n,o;t.resetRequestQueue=()=>{r=[],i=0,n=0,o={}},t.addThrottleControl=t=>{const e=n++;return o[e]=t,e},t.removeThrottleControl=t=>{delete o[t],s()},t.getImage=(t,i,n=!0)=>new Promise(((o,a)=>{l.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),r.push({abortController:i,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{a(t)},onSuccess:t=>{o(t)}}),s()}));const a=t=>e._(this,void 0,void 0,(function*(){t.state="running";const{requestParameters:r,supportImageRefresh:n,onError:o,onSuccess:a,abortController:l}=t,u=!1===n&&!e.i(self)&&!e.g(r.url)&&(!r.headers||Object.keys(r.headers).reduce(((t,e)=>t&&"accept"===e),!0));i++;const h=u?c(r,l):e.m(r,l);try{const r=yield h;delete t.abortController,t.state="completed",r.data instanceof HTMLImageElement||e.b(r.data)?a(r):r.data&&a({data:yield(d=r.data,"function"==typeof createImageBitmap?e.f(d):e.h(d)),cacheControl:r.cacheControl,expires:r.expires})}catch(e){delete t.abortController,o(e)}finally{i--,s()}var d})),s=()=>{const t=(()=>{for(const t of Object.keys(o))if(o[t]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=i;e<t&&r.length>0;e++){const t=r.shift();t.abortController.signal.aborted?e--:a(t)}},c=(t,r)=>new Promise(((i,n)=>{const o=new Image,a=t.url,s=t.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!e.d(a))&&(o.crossOrigin="anonymous"),r.signal.addEventListener("abort",(()=>{o.src="",n(e.c())})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,i({data:o})},o.onerror=()=>{o.onerror=o.onload=null,r.signal.aborted||n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},o.src=a}))}(f||(f={})),f.resetRequestQueue();class m{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function g(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const r=[];for(const{id:i,url:n}of t){const t=`${i}${n}`;-1===r.indexOf(t)&&(r.push(t),e.push({id:i,url:n}))}}return e}function _(t,e,r){try{const i=new URL(t);return i.pathname+=`${e}${r}`,i.toString()}catch(e){throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function y(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class v extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const r=this.images[t];if(r&&!r.data&&r.spriteData){const t=r.spriteData;r.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),r.spriteData=null}return r}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,r){let i=!0;const n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let r=0;for(const i of t){if(i[0]<r||i[1]<i[0]||e<i[1])return!1;r=i[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const r=e.spriteData,i=r&&r.width||e.data.width,n=r&&r.height||e.data.height;return!(t[0]<0||i<t[0]||t[1]<0||n<t[1]||t[2]<0||i<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,r=!0){const i=this.getImage(t);if(r&&(i.data.width!==e.data.width||i.data.height!==e.data.height))throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=i.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((e,r)=>{let i=!0;if(!this.isLoaded())for(const n of t)this.images[n]||(i=!1);this.isLoaded()||i?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})}))}_getImagesForIds(t){const r={};for(const i of t){let t=this.getImage(i);t||(this.fire(new e.l("styleimagemissing",{id:i})),t=this.getImage(i)),t?r[i]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return r}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const r=this.patterns[t],i=this.getImage(t);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{const r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},n=new e.I(r,i);this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const r=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new e.T(t,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:r,h:i}=e.p(t),n=this.atlasImage;n.resize({width:r||1,height:i||1});for(const o in this.patterns){const{bin:t}=this.patterns[o],r=t.x+1,i=t.y+1,a=this.getImage(o).data,s=a.width,l=a.height;e.R.copy(a,n,{x:0,y:0},{x:r,y:i},{width:s,height:l}),e.R.copy(a,n,{x:0,y:l-1},{x:r,y:i-1},{width:s,height:1}),e.R.copy(a,n,{x:0,y:0},{x:r,y:i+l},{width:s,height:1}),e.R.copy(a,n,{x:s-1,y:0},{x:r-1,y:i},{width:1,height:l}),e.R.copy(a,n,{x:0,y:0},{x:r+s,y:i},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const r of t){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;const t=this.getImage(r);t||e.w(`Image with ID: "${r}" was not found`),y(t)&&this.updateImage(r,t)}}}const b=1e20;function x(t,e,r,i,n,o,a,s,l){for(let c=e;c<e+i;c++)w(t,r*o+c,o,n,a,s,l);for(let c=r;c<r+n;c++)w(t,c*o+e,1,i,a,s,l)}function w(t,e,r,i,n,o,a){o[0]=0,a[0]=-1e20,a[1]=b,n[0]=t[e];for(let s=1,l=0,c=0;s<i;s++){n[s]=t[e+s*r];const i=s*s;do{const t=o[l];c=(n[s]-n[t]+i-t*t)/(s-t)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=b}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;const i=o[l],c=s-i;t[e+s*r]=n[i]+c*c}}class S{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return e._(this,void 0,void 0,(function*(){const e=[];for(const n in t)for(const r of t[n])e.push(this._getAndCacheGlyphsPromise(n,r));const r=yield Promise.all(e),i={};for(const{stack:t,id:n,glyph:o}of r)i[t]||(i[t]={}),i[t][n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return i}))}_getAndCacheGlyphsPromise(t,r){return e._(this,void 0,void 0,(function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let i=e.glyphs[r];if(void 0!==i)return{stack:t,id:r,glyph:i};if(i=this._tinySDF(e,t,r),i)return e.glyphs[r]=i,{stack:t,id:r,glyph:i};const n=Math.floor(r/256);if(256*n>65535)throw new Error("glyphs > 65535 not supported");if(e.ranges[n])return{stack:t,id:r,glyph:i};if(!this.url)throw new Error("glyphsUrl is not set");if(!e.requests[n]){const r=S.loadGlyphRange(t,n,this.url,this.requestManager);e.requests[n]=r}const o=yield e.requests[n];for(const t in o)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=o[+t]);return e.ranges[n]=!0,{stack:t,id:r,glyph:o[r]||null}}))}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(t))||e.u["CJK Unified Ideographs"](t)||e.u["Hangul Syllables"](t)||e.u.Hiragana(t)||e.u.Katakana(t)||e.u["CJK Symbols and Punctuation"](t)||e.u["Halfwidth and Fullwidth Forms"](t))}_tinySDF(t,r,i){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(i))return;let o=t.tinySDF;if(!o){let e="400";/bold/i.test(r)?e="900":/medium/i.test(r)?e="500":/light/i.test(r)&&(e="200"),o=t.tinySDF=new S.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:e})}const a=o.draw(String.fromCharCode(i));return{id:i,bitmap:new e.q({width:a.width||60,height:a.height||60},a.data),metrics:{width:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:a.glyphAdvance/2||24,isDoubleResolution:!0}}}}S.loadGlyphRange=function(t,r,i,n){return e._(this,void 0,void 0,(function*(){const o=256*r,a=o+255,s=n.transformRequest(i.replace("{fontstack}",t).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield e.n(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${r}, ${o}-${a}`);const c={};for(const t of e.o(l.data))c[t.id]=t;return c}))},S.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=e,this.cutoff=i,this.radius=r;const s=this.size=t+4*e,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(r),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(i)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return p;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;f.clearRect(m,m,s,l),f.fillText(t,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(b,0,h),g.fill(0,0,h);for(let v=0;v<l;v++)for(let t=0;t<s;t++){const e=y.data[4*(v*s+t)+3]/255;if(0===e)continue;const r=(v+m)*c+t+m;if(1===e)_[r]=0,g[r]=b;else{const t=.5-e;_[r]=t>0?t*t:0,g[r]=t<0?t*t:0}}x(_,0,0,c,u,c,this.f,this.v,this.z),x(g,m,m,s,l,c,this.f,this.v,this.z);for(let v=0;v<h;v++){const t=Math.sqrt(_[v])-Math.sqrt(g[v]);d[v]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}};class T{constructor(){this.specification=e.v.light.position}possiblyEvaluate(t,r){return e.B(t.expression.evaluate(r))}interpolate(t,r,i){return{x:e.C.number(t.x,r.x,i),y:e.C.number(t.y,r.y,i),z:e.C.number(t.z,r.z,i)}}}let I;class E extends e.E{constructor(t){super(),I=I||new e.r({anchor:new e.D(e.v.light.anchor),position:new T,color:new e.D(e.v.light.color),intensity:new e.D(e.v.light.intensity)}),this._transitionable=new e.t(I),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r={}){if(!this._validate(e.x,t,r))for(const e in t){const r=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),r):this._transitionable.setValue(e,r)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i){return(!i||!1!==i.validate)&&e.y(this,t.call(e.z,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.v}))}}const P=new e.r({"sky-color":new e.D(e.v.sky["sky-color"]),"horizon-color":new e.D(e.v.sky["horizon-color"]),"fog-color":new e.D(e.v.sky["fog-color"]),"fog-ground-blend":new e.D(e.v.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.v.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.v.sky["atmosphere-blend"])});class k extends e.E{constructor(t){super(),this._transitionable=new e.t(P),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.F(0))}setSky(t,r={}){if(!this._validate(e.G,t,r)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const e in t){const r=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),r):this._transitionable.setValue(e,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i={}){return!1!==(null==i?void 0:i.validate)&&e.y(this,t.call(e.z,e.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class C{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,r){const i=[];let n=t.length%2==1?-t[t.length-1]*r:0,o=t[0]*r,a=!0;i.push({left:n,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let l=1;l<t.length;l++){a=!a;const e=t[l];n=s*r,s+=e,o=s*r,i.push({left:n,right:o,isDash:a,zeroLength:0===e})}return i}addRoundDash(t,e,r){const i=e/2;for(let n=-r;n<=r;n++){const e=this.width*(this.nextRow+r+n);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=n/r*(i+1);if(a.isDash){const t=i-Math.abs(d);h=Math.sqrt(u*u+t*t)}else h=i-Math.sqrt(u*u+d*d);this.data[e+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let a=t.length-1;a>=0;--a){const e=t[a],r=t[a+1];e.zeroLength?t.splice(a,1):r&&r.isDash===e.isDash&&(r.left=e.left,t.splice(a,1))}const e=t[0],r=t[t.length-1];e.isDash===r.isDash&&(e.left=r.left-this.width,r.right=e.right+this.width);const i=this.width*this.nextRow;let n=0,o=t[n];for(let a=0;a<this.width;a++){a/o.right>1&&(o=t[++n]);const e=Math.abs(a-o.left),r=Math.abs(a-o.right),s=Math.min(e,r);this.data[i+a]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(t,r){const i=r?7:0,n=2*i+1;if(this.nextRow+n>this.height)return e.w("LineAtlas out of space"),null;let o=0;for(let e=0;e<t.length;e++)o+=t[e];if(0!==o){const e=this.width/o,n=this.getDashRanges(t,this.width,e);r?this.addRoundDash(n,e,i):this.addRegularDash(n)}const a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}const A="maplibre_preloaded_worker_pool";class M{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<M.workerCount;)this.workers.push(new Worker(e.a.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[A]}numActive(){return Object.keys(this.active).length}}const R=Math.floor(a.hardwareConcurrency/2);let L,D;function z(){return L||(L=new M),L}M.workerCount=e.H(globalThis)?Math.max(Math.min(R,3),1):1;class O{constructor(t,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;const i=this.workerPool.acquire(r);for(let n=0;n<i.length;n++){const t=new e.J(i[n],r);t.name=`Worker ${n}`,this.actors.push(t)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const r=[];for(const i of this.actors)r.push(i.sendAsync({type:t,data:e}));return Promise.all(r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(const r of this.actors)r.registerMessageHandler(t,e)}}function F(){return D||(D=new O(z(),e.K),D.registerMessageHandler("GR",((t,r,i)=>e.m(r,i)))),D}function N(t,r){const i=e.L();return e.M(i,i,[1,1,0]),e.N(i,i,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?e.O(i,i,t.calculatePosMatrix(r.toUnwrapped())):i}function B(t,e,r,i,n,o,a){var s;const l=function(t,e,r){if(t)for(const i of t){const t=e[i];if(t&&t.source===r&&"fill-extrusion"===t.type)return!0}else for(const i in e){const t=e[i];if(t.source===r&&"fill-extrusion"===t.type)return!0}return!1}(null!==(s=null==n?void 0:n.layers)&&void 0!==s?s:null,e,t.id),c=o.maxPitchScaleFactor(),u=t.tilesIn(i,c,l);u.sort(j);const h=[];for(const d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(e,r,t._state,d.queryGeometry,d.cameraQueryGeometry,d.scale,n,o,c,N(t.transform,d.tileID),a?(t,e)=>a(d.tileID,t,e):void 0)});return function(t,e){for(const r in t)for(const i of t[r])U(i,e);return t}(function(t){const e={},r={};for(const i of t){const t=i.queryResults,n=i.wrappedTileID,o=r[n]=r[n]||{};for(const r in t){const i=t[r],n=o[r]=o[r]||{},a=e[r]=e[r]||[];for(const t of i)n[t.featureIndex]||(n[t.featureIndex]=!0,a.push(t))}}return e}(h),t)}function j(t,e){const r=t.tileID,i=e.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function U(t,e){const r=t.feature,i=e.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}function V(t,r,i){return e._(this,void 0,void 0,(function*(){let n=t;if(t.url?n=(yield e.j(r.transformRequest(t.url,"Source"),i)).data:yield a.frameAsync(i),!n)return null;const o=e.Q(e.e(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((t=>t.id))),o}))}class G{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof e.S?new e.S(t.lng,t.lat):e.S.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.S?new e.S(t.lng,t.lat):e.S.convert(t),this}extend(t){const r=this._sw,i=this._ne;let n,o;if(t instanceof e.S)n=t,o=t;else{if(!(t instanceof G))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(G.convert(t)):this.extend(e.S.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.S.convert(t)):this;if(n=t._sw,o=t._ne,!n||!o)return this}return r||i?(r.lng=Math.min(n.lng,r.lng),r.lat=Math.min(n.lat,r.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)):(this._sw=new e.S(n.lng,n.lat),this._ne=new e.S(o.lng,o.lat)),this}getCenter(){return new e.S((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 e.S(this.getWest(),this.getNorth())}getSouthEast(){return new e.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:r,lat:i}=e.S.convert(t);let n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(t){return t instanceof G?t:t?new G(t):t}static fromLngLat(t,r=0){const i=360*r/40075017,n=i/Math.cos(Math.PI/180*t.lat);return new G(new e.S(t.lng-n,t.lat-i),new e.S(t.lng+n,t.lat+i))}adjustAntiMeridian(){const t=new e.S(this._sw.lng,this._sw.lat),r=new e.S(this._ne.lng,this._ne.lat);return new G(t,t.lng>r.lng?new e.S(r.lng+360,r.lat):r)}}class ${constructor(t,e,r){this.bounds=G.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const r=Math.pow(2,t.z),i=Math.floor(e.V(this.bounds.getWest())*r),n=Math.floor(e.U(this.bounds.getNorth())*r),o=Math.ceil(e.V(this.bounds.getEast())*r),a=Math.ceil(e.U(this.bounds.getSouth())*r);return t.x>=i&&t.x<o&&t.y>=n&&t.y<a}}class q extends e.E{constructor(t,r,i,n){if(super(),this.id=t,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.Q(r,["url","scheme","tileSize","promoteId"])),this._options=e.e({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(e.e(this,t),t.bounds&&(this.tileBounds=new $(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.k(t))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};r.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise(((e,r)=>{t.reloadPromise={resolve:e,reject:r}}))}else t.actor=this.dispatcher.getActor(),i="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:i,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}}))}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Z extends e.E{constructor(t,r,i,n){super(),this.id=t,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},r),e.e(this,e.Q(r,["url","scheme","tileSize"]))}load(){return e._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(e.e(this,r),r.bounds&&(this.tileBounds=new $(r.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this.fire(new e.k(t))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,(function*(){const r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield f.getImage(this.map._requestManager.transformRequest(r,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const r=this.map.painter.context,n=r.gl,o=i.data;t.texture=this.map.painter.getTileTexture(o.width),t.texture?t.texture.update(o,{useMipmap:!0}):(t.texture=new e.T(r,o,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class W extends Z{constructor(t,r,i,n){super(t,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}loadTile(t){return e._(this,void 0,void 0,(function*(){const r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const r=yield f.getImage(i,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(r&&r.data){const i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});const n=e.b(i)&&e.W()?i:yield this.readImageNow(i),o={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:"LDT",data:o});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}readImageNow(t){return e._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&e.X()){const r=t.width+2,i=t.height+2;try{return new e.R({width:r,height:i},yield e.Y(t,-1,-1,r,i))}catch(t){}}return a.getImageData(t,1)}))}_getNeighboringTiles(t){const r=t.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?t.wrap-1:t.wrap,a=(r.x+1+i)%i,s=r.x+1===i?t.wrap+1:t.wrap,l={};return l[new e.Z(t.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new e.Z(t.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new e.Z(t.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new e.Z(t.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}class H extends e.E{constructor(t,r,i,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=e.e({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==r.buffer?r.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==r.tolerance?r.tolerance:.375),extent:e.$,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.$,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(t){return t*(e.$/this.tileSize)}_getClusterMaxZoom(t){const r=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||e.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${r}"`),r}load(){return e._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return e._(this,void 0,void 0,(function*(){const t=e.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}getCoordinatesFromGeometry(t){return"GeometryCollection"===t.type?t.geometries.map((t=>t.coordinates)).flat(1/0):t.coordinates.flat(1/0)}getBounds(){return e._(this,void 0,void 0,(function*(){const t=new G,e=yield this.getData();let r;switch(e.type){case"FeatureCollection":r=e.features.map((t=>this.getCoordinatesFromGeometry(t.geometry))).flat(1/0);break;case"Feature":r=this.getCoordinatesFromGeometry(e.geometry);break;default:r=this.getCoordinatesFromGeometry(e)}if(0==r.length)return t;for(let i=0;i<r.length-1;i+=2)t.extend([r[i],r[i+1]]);return t}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:r}})}_updateWorkerData(t){return e._(this,void 0,void 0,(function*(){const r=e.e({type:this.type},this.workerOptions);t?r.dataDiff=t:"string"==typeof this._data?(r.request=this.map._requestManager.transformRequest(a.resolveURL(this._data),"Source"),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new e.l("dataloading",{dataType:"source"}));try{const t=yield this.actor.sendAsync({type:"LD",data:r});if(this._pendingLoads--,this._removed||t.abandoned)return void this.fire(new e.l("dataabort",{dataType:"source"}));let i=null;t.resourceTiming&&t.resourceTiming[this.id]&&(i=t.resourceTiming[this.id].slice(0));const n={dataType:"source"};this._collectResourceTiming&&i&&i.length>0&&e.e(n,{resourceTiming:i}),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(t){if(this._pendingLoads--,this._removed)return void this.fire(new e.l("dataabort",{dataType:"source"}));this.fire(new e.k(t))}}))}loaded(){return 0===this._pendingLoads}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};t.abortController=new AbortController;const i=yield this.actor.sendAsync({type:e,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(i,this.map.painter,"RT"===e)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class X extends e.E{constructor(t,e,r,i){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=r,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=e}load(t){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield f.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new e.k(t))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const r=t.map(e.a0.fromLngLat);var i;return this.tileID=function(t){const r=e.a1.fromPoints(t),i=r.width(),n=r.height(),o=Math.max(i,n),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),s=Math.pow(2,a);return new e.a3(a,Math.floor((r.minX+r.maxX)/2*s),Math.floor((r.minY+r.maxY)/2*s))}(r),this.terrainTileRanges=this._getOverlappingTileRanges(r),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=r.map((t=>this.tileID.getTilePoint(t)._round())),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[0].x)<0,this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,r=t.gl;this.texture||(this.texture=new e.T(t,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:r,minY:i,maxX:n,maxY:o}=e.a1.fromPoints(t),a={};for(let s=0;s<=e.a2;s++){const t=Math.pow(2,s),e=Math.floor(r*t),l=Math.floor(i*t),c=Math.floor(n*t),u=Math.floor(o*t);a[s]={minTileX:e,minTileY:l,maxTileX:c,maxTileY:u}}return a}}class J extends X{constructor(t,e,r,i){super(t,e,r,i),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.a4(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new e.k(t))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new e.k(new e.a5(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new e.l("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 Y extends X{constructor(t,r,i,n){super(t,r,i,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new e.k(new e.a5(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.k(new e.a5(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.k(new e.a5(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.k(new e.a5(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.k(new e.a5(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){return e._(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 e.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const r=this.map.painter.context,i=r.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const K={},Q=t=>{switch(t){case"geojson":return H;case"image":return X;case"raster":return Z;case"raster-dem":return W;case"vector":return q;case"video":return J;case"canvas":return Y}return K[t]},tt="RTLPluginLoaded";class et extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=F()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((t=>{throw this.status="error",t}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return e._(this,arguments,void 0,(function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=a.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return e._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.l(tt))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let rt=null;function it(){return rt||(rt=new et),rt}class nt{constructor(t,r){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a6(),this.uses=0,this.tileSize=r,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(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,r,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const r={};if(!e)return r;for(const i of t){const t=i.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){i.layers=t,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)r[e.id]=i}}return r}(t.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.a8){if(this.hasSymbolBuckets=!0,!i)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.a8&&r.hasRTLText){this.hasRTLText=!0,it().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.a7}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t)}const r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new e.T(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,i,n,o,a,s,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l,getElevation:u},t,e,r):{}}querySourceFeatures(t,r){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=r&&r.sourceLayer?r.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;const s=e.a9(r&&r.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let d=0;d<a.length;d++){const r=a.feature(d);if(s.needGeometry){const t=e.aa(r,!0);if(!s.filter(new e.F(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new e.F(this.tileID.overscaledZ),r))continue;const n=i.getId(r,o),p=new e.ab(r,l,c,u,n);p.tile=h,t.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const r=this.expirationTime;if(t.cacheControl){const r=e.ac(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(r)if(this.expirationTime<r)e=!0;else{const i=this.expirationTime-r;i?this.expirationTime=t+Math.max(i,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const r=this.latestFeatureIndex.loadVTLayers();for(const i in this.buckets){if(!e.style.hasLayer(i))continue;const n=this.buckets[i],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=r[o],s=t[o];if(!a||!s||0===Object.keys(s).length)continue;n.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.now()+t}setDependencies(t,e){const r={};for(const i of e)r[i]=!0;this.dependencies[t]=r}hasDependency(t,e){for(const r of t){const t=this.dependencies[r];if(t)for(const r of e)if(t[r])return!0}return!1}}class ot{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){const i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);const n={value:e,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const r=t.wrapped().key,i=void 0===e?0:this.data[r].indexOf(e),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const r in this.data)for(const i of this.data[r])t(i.value)||e.push(i);for(const r of e)this.remove(r.value.tileID,r)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,r,i){const n=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.e(this.stateChanges[t][n],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])i[e]||(this.deletedStates[t][n][e]=null)}else for(const e in i)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,r){if(null===this.deletedStates[t])return;const i=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][i]&&(this.deletedStates[t][i]=this.deletedStates[t][i]||{},this.deletedStates[t][i][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][i])for(r in this.deletedStates[t][i]={},this.stateChanges[t][i])this.deletedStates[t][i][r]=null;else this.deletedStates[t][i]=null;else this.deletedStates[t]=null}getState(t,r){const i=String(r),n=e.e({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][r];if(null===e)return{};for(const t in e)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,r){const i={};for(const n in this.stateChanges){this.state[n]=this.state[n]||{};const t={};for(const r in this.stateChanges[n])this.state[n][r]||(this.state[n][r]={}),e.e(this.state[n][r],this.stateChanges[n][r]),t[r]=this.state[n][r];i[n]=t}for(const n in this.deletedStates){this.state[n]=this.state[n]||{};const t={};if(null===this.deletedStates[n])for(const e in this.state[n])t[e]={},this.state[n][e]={};else for(const e in this.deletedStates[n]){if(null===this.deletedStates[n][e])this.state[n][e]={};else for(const t of Object.keys(this.deletedStates[n][e]))delete this.state[n][e][t];t[e]=this.state[n][e]}i[n]=i[n]||{},e.e(i[n],t)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const e in t)t[e].setFeatureState(i,r)}}const st=89.25;function lt(t,r){const i=e.ag(r.lat,-e.ah,e.ah);return new e.P(e.V(r.lng)*t,e.U(i)*t)}function ct(t,r){return new e.a0(r.x/t,r.y/t).toLngLat()}function ut(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(e.ad(90-t.pitch)),Math.tan(e.ad(st-t.pitch)))}function ht(t,r){const i=t.canonical,n=r/e.ae(i.z),o=i.x+Math.pow(2,i.z)*t.wrap,a=e.af(new Float64Array(16));return e.M(a,a,[o*n,i.y*n,0]),e.N(a,a,[n/e.$,n/e.$,1]),a}function dt(t,r,i,n,o){const a=e.a0.fromLngLat(t,r),s=o*e.ai(1,t.lat),l=s*Math.cos(e.ad(i)),c=Math.sqrt(s*s-l*l),u=c*Math.sin(e.ad(-n)),h=c*Math.cos(e.ad(-n));return new e.a0(a.x+u,a.y+h,a.z+l)}function pt(t,e,r){const i=e.intersectsFrustum(t);if(!r||0===i)return i;const n=e.intersectsPlane(r);return 0===n?0:2===i&&2===n?2:1}function ft(t,e,r){let i=0;const n=(r-e)/10;for(let o=0;o<10;o++)i+=n*Math.pow(Math.cos(e+(o+.5)/10*(r-e)),t);return i}function mt(t,r){return function(i,n,o,a,s){const l=2*((t-1)/e.aj(Math.cos(e.ad(st-s))/Math.cos(e.ad(st)))-1),c=Math.acos(o/a),u=2*ft(l-1,0,e.ad(s/2)),h=Math.min(e.ad(st),c+e.ad(s/2)),d=ft(l-1,Math.min(h,c-e.ad(s/2)),h),p=Math.atan(n/o),f=Math.hypot(n,o);let m=i;return m+=e.aj(a/f/Math.max(.5,Math.cos(e.ad(s/2)))),m+=l*e.aj(Math.cos(p))/2,m-=e.aj(Math.max(1,d/u/r))/2,m}}const gt=mt(9.314,3);function _t(t,r){const i=(r.roundZoom?Math.round:Math.floor)(t.zoom+e.aj(t.tileSize/r.tileSize));return Math.max(0,i)}function yt(t,r){const i=t.getCameraFrustum(),n=t.getClippingPlane(),o=t.screenPointToMercatorCoordinate(t.getCameraPoint()),a=e.a0.fromLngLat(t.center,t.elevation);o.z=a.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;const s=t.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(t,r),c=_t(t,r),u=r.minzoom||0,h=void 0!==r.maxzoom?r.maxzoom:t.maxZoom,d=Math.min(Math.max(0,c),h),p=Math.pow(2,d),f=[p*o.x,p*o.y,0],m=[p*a.x,p*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),_=Math.abs(a.z-o.z),y=Math.hypot(g,_),v=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),b=[],x=[];if(t.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(v(-e)),b.push(v(e));for(b.push(v(0));b.length>0;){const p=b.pop(),g=p.x,v=p.y;let w=p.fullyVisible;const S={x:g,y:v,z:p.zoom},T=s.getTileBoundingVolume(S,p.wrap,t.elevation,r);if(!w){const t=pt(i,T,n);if(0===t)continue;w=2===t}const I=s.distanceToTile2d(o.x,o.y,S,T);let E=c;l&&(E=(r.calculateTileZoom||gt)(t.zoom+e.aj(t.tileSize/r.tileSize),I,_,y,t.fov)),E=(r.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);const P=Math.min(E,h);if(p.wrap=s.getWrap(a,S,p.wrap),p.zoom>=P){if(p.zoom<u)continue;const t=d-p.zoom,i=f[0]-.5-(g<<t),n=f[1]-.5-(v<<t),o=r.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new e.Z(p.zoom===h?o:p.zoom,p.wrap,p.zoom,g,v),distanceSq:e.ak([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let t=0;t<4;t++)b.push({zoom:p.zoom+1,x:(g<<1)+t%2,y:(v<<1)+(t>>1),wrap:p.wrap,fullyVisible:w})}return x.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}const vt=e.a1.fromPoints([new e.P(0,0),new e.P(e.$,e.$)]);class bt extends e.E{constructor(t,e,r){super(),this.id=t,this.dispatcher=r,this.on("data",(t=>this._dataHandler(t))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,r,i)=>{const n=new(Q(e.type))(t,e,r,i);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,r,this),this._tiles={},this._cache=new ot(0,(t=>this._unloadTile(t))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,r,i){return e._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,r,i)}catch(r){t.state="errored",404!==r.status?this._source.fire(new e.k(r,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(xt).map((t=>t.key))}getRenderableIds(t){const r=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&r.push(this._tiles[e]);return t?r.sort(((t,r)=>{const i=t.tileID,n=r.tileID,o=new e.P(i.canonical.x,i.canonical.y)._rotate(-this.transform.bearingInRadians),a=new e.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return i.overscaledZ-n.overscaledZ||a.y-o.y||a.x-o.x})).map((t=>t.tileID.key)):r.map((t=>t.tileID)).sort(xt).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(t){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)t?this._reloadTile(e,"expired"):"errored"!==this._tiles[e].state&&this._reloadTile(e,"reloading")}}_reloadTile(t,r){return e._(this,void 0,void 0,(function*(){const e=this._tiles[t];e&&("loading"!==e.state&&(e.state=r),yield this._loadTile(e,t,r))}))}_tileLoaded(t,r,i){t.timeAdded=a.now(),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.l("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let i=0;i<e.length;i++){const n=e[i];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);r(t,e),r(e,t)}}function r(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let r=e.tileID.canonical.x-t.tileID.canonical.x;const i=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,r,i){for(const n in this._tiles){let o=this._tiles[n];if(i[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]||t[s.canonical.key]){i[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(let r=t.overscaledZ-1;r>=e;r--){const e=t.scaledTo(r),i=this._getLoadedTile(e);if(i)return i}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const r=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(r*i*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const r in this._tiles){const i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(t,e,r,i,n,o){const s={},l={},c=Object.keys(t),u=a.now();for(const a of c){const r=t[a],i=this._tiles[a];if(!i||0!==i.fadeEndTime&&i.fadeEndTime<=u)continue;const n=this.findLoadedParent(r,e),o=this.findLoadedSibling(r),c=n||o||null;c&&(this._addTile(c.tileID),s[c.tileID.key]=c.tileID),l[a]=r}this._retainLoadedChildren(l,i,r,t);for(const a in s)t[a]||(this._coveredTiles[a]=!0,t[a]=s[a]);if(o){const e={},r={};for(const t of n)this._tiles[t.key].hasData()?e[t.key]=t:r[t.key]=t;for(const i in r){const n=r[i].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(e[n[0].key]=t[n[0].key]=n[0],e[n[1].key]=t[n[1].key]=n[1],e[n[2].key]=t[n[2].key]=n[2],e[n[3].key]=t[n[3].key]=n[3],delete r[i])}for(const i in r){const n=r[i],o=this.findLoadedParent(n,this._source.minzoom),a=this.findLoadedSibling(n),s=o||a||null;if(s){e[s.tileID.key]=t[s.tileID.key]=s.tileID;for(const t in e)e[t].isChildOf(s.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}update(t,r){if(!this._sourceLoaded||this._paused)return;let i;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.Z(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(i=yt(t,{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:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter((t=>this._source.hasTile(t))))):i=[];const n=_t(t,this._source),o=Math.max(n-bt.maxOverzooming,this._source.minzoom),a=Math.max(n+bt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of i)if(e.canonical.z>this._source.minzoom){const r=e.scaledTo(e.canonical.z-1);t[r.key]=r;const i=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[i.key]=i}i=i.concat(Object.values(t))}const s=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new e.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(i,n);wt(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,n,i,r);for(const e in l)this._tiles[e].clearFadeHold();const c=e.al(this._tiles,l);for(const e of c){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var r;const i={},n={},o=Math.max(e-bt.maxOverzooming,this._source.minzoom),a=Math.max(e+bt.maxUnderzooming,this._source.minzoom),s={};for(const l of t){const t=this._addTile(l);i[l.key]=l,t.hasData()||e<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,e,a,i);for(const l of t){let t=this._tiles[l.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=l.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=l.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let a=t.wasRequested();for(let e=l.overscaledZ-1;e>=o;--e){const o=l.scaledTo(e);if(n[o.key])break;if(n[o.key]=!0,t=this.getTile(o),!t&&a&&(t=this._addTile(o)),t){const e=t.hasData();if((e||!(null===(r=this.map)||void 0===r?void 0:r.cancelPendingTileRequestsWhileZooming)||a)&&(i[o.key]=o),a=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let r,i=this._tiles[t].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){r=this._loadedParentTiles[i.key];break}e.push(i.key);const t=i.scaledTo(i.overscaledZ-1);if(r=this._getLoadedTile(t),r)break;i=t}for(const t of e)this._loadedParentTiles[t]=r}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,r=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=r}}_addTile(t){let r=this._tiles[t.key];if(r)return r;r=this._cache.getAndRemove(t),r&&(this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,r)));const i=r;return r||(r=new nt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state)),r.uses++,this._tiles[t.key]=r,i||this._source.fire(new e.l("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),r))}refreshTiles(t){for(const e in this._tiles)(this._isIdRenderable(e)||"errored"==this._tiles[e].state)&&t.some((t=>t.equals(this._tiles[e].tileID.canonical)))&&this._reloadTile(e,"expired")}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){const e=t.sourceDataType;"source"===t.dataType&&"metadata"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===e&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,r,i){const n=[],o=this.transform;if(!o)return n;const a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?o.getCameraQueryGeometry(t):t,l=t=>o.screenPointToMercatorCoordinate(t,this.terrain),c=this.transformBbox(t,l,!a),u=this.transformBbox(s,l,!a),h=this.getIds(),d=e.a1.fromPoints(u);for(let p=0;p<h.length;p++){const t=this._tiles[h[p]];if(t.holdingForFade())continue;const i=a?[t.tileID]:[t.tileID.unwrapTo(-1),t.tileID.unwrapTo(0)],s=Math.pow(2,o.zoom-t.tileID.overscaledZ),l=r*t.queryPadding*e.$/t.tileSize/s;for(const r of i){const i=d.map((t=>r.getTilePoint(new e.a0(t.x,t.y))));if(i.expandBy(l),i.intersects(vt)){const e=c.map((t=>r.getTilePoint(t))),i=u.map((t=>r.getTilePoint(t)));n.push({tile:t,tileID:a?r:r.unwrapTo(0),queryGeometry:e,cameraQueryGeometry:i,scale:s})}}}return n}transformBbox(t,r,i){let n=t.map(r);if(i){const i=e.a1.fromPoints(t);i.shrinkBy(.001*Math.min(i.width(),i.height()));const o=i.map(r);e.a1.fromPoints(n).covers(o)||(n=n.map((t=>t.x>.5?new e.a0(t.x-1,t.y,t.z):t)))}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));return this.transform&&this.transform.populateCache(e),e}hasTransition(){if(this._source.hasTransition())return!0;if(wt(this._source.type)){const t=a.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)}removeFeatureState(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,r){const i=this._tiles[t];i&&i.setDependencies(e,r)}reloadTilesForDependencies(t,e){for(const r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((r=>!r.hasDependency(t,e)))}}function xt(t,e){const r=Math.abs(2*t.wrap)-+(t.wrap<0),i=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||i-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function wt(t){return"raster"===t||"image"===t||"video"===t}bt.maxOverzooming=10,bt.maxUnderzooming=3;class St{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.ag(t,0,1);let r=1,i=this._distances[r];const n=t*this.paddedLength+this.padding;for(;i<n&&r<this._distances.length;)i=this._distances[++r];const o=r-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))}}function Tt(t,e){let r=!0;return"always"===t||"never"!==t&&"never"!==e||(r=!1),r}class It{constructor(t,e,r){const i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(let o=0;o<this.xCellCount*this.yCellCount;o++)i.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(t,e,r,i){this._forEachCell(e-i,r-i,e+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(i)}_insertBoxCell(t,e,r,i,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,r,i,n,o){this.circleCells[n].push(o)}_query(t,e,r,i,n,o,a){if(r<0||t>this.width||i<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){if(n)return[{key:null,x1:t,y1:e,x2:r,y2:i}];for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],r=this.circles[3*t+1],i=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-i,y1:r-i,x2:e+i,y2:r+i})}}else this._forEachCell(t,e,r,i,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,r,i){return this._query(t,e,r,i,!1,null)}hitTest(t,e,r,i,n,o){return this._query(t,e,r,i,!0,n,o).length>0}hitTestCircle(t,e,r,i,n){const o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,r,i,n,o,a,s){const{seenUids:l,hitTest:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const n=this.bboxes;for(const a of h)if(!l.box[a]){l.box[a]=!0;const h=4*a,d=this.boxKeys[a];if(t<=n[h+2]&&e<=n[h+3]&&r>=n[h+0]&&i>=n[h+1]&&(!s||s(d))&&(!c||!Tt(u,d.overlapMode))&&(o.push({key:d,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const d=this.circleCells[n];if(null!==d){const n=this.circles;for(const a of d)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,d=this.circleKeys[a];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],t,e,r,i)&&(!s||s(d))&&(!c||!Tt(u,d.overlapMode))){const t=n[h],e=n[h+1],r=n[h+2];if(o.push({key:d,x1:t-r,y1:e-r,x2:t+r,y2:e+r}),c)return!0}}}return!1}_queryCellCircle(t,e,r,i,n,o,a,s){const{circle:l,seenUids:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const t=this.bboxes;for(const e of h)if(!c.box[e]){c.box[e]=!0;const r=4*e,i=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!s||s(i))&&!Tt(u,i.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const t=this.circles;for(const e of d)if(!c.circle[e]){c.circle[e]=!0;const r=3*e,i=this.circleKeys[e];if(this._circlesCollide(t[r],t[r+1],t[r+2],l.x,l.y,l.radius)&&(!s||s(i))&&!Tt(u,i.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,r,i,n,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),u=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,t,e,r,i,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,r,i,n,o){const a=i-t,s=n-e,l=r+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,r,i,n,o,a){const s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+r)return!1;const c=(a-n)/2,u=Math.abs(e-(n+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=r*r}}function Et(t,r,n){const o=e.L();if(!t){const{vecSouth:t,vecEast:e}=kt(r),n=i();n[0]=e[0],n[1]=e[1],n[2]=t[0],n[3]=t[1],a=n,(d=(l=(s=n)[0])*(h=s[3])-(u=s[2])*(c=s[1]))&&(a[0]=h*(d=1/d),a[1]=-c*d,a[2]=-u*d,a[3]=l*d),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var a,s,l,c,u,h,d;return e.N(o,o,[1/n,1/n,1]),o}function Pt(t,r,i,n){if(t){const t=e.L();if(!r){const{vecSouth:e,vecEast:r}=kt(i);t[0]=r[0],t[1]=r[1],t[4]=e[0],t[5]=e[1]}return e.N(t,t,[n,n,1]),t}return i.pixelsToClipSpaceMatrix}function kt(t){const r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),o=Math.cos(t.bearingInRadians),a=Math.sin(t.bearingInRadians),s=e.aq();s[0]=-o*n*i-a*r,s[1]=-a*n*i+o*r;const l=e.ar(s);l<1e-9?e.as(s):e.at(s,s,1/l);const c=e.aq();c[0]=o*n*r-a*i,c[1]=a*n*r+o*i;const u=e.ar(c);return u<1e-9?e.as(c):e.at(c,c,1/u),{vecEast:c,vecSouth:s}}function Ct(t,r,i,n){let o;n?(o=[t,r,n(t,r),1],e.av(o,o,i)):(o=[t,r,0,1],Zt(o,o,i));const a=o[3];return{point:new e.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function At(t,e){return.5+t/e*.5}function Mt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function Rt(t,r,i,n,o,a,s,l,c,u,h,d,p){const f=i?t.textSizeData:t.iconSizeData,m=e.am(f,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],_=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();const y=t.lineVertexArray,v=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=r.transform.width/r.transform.height;let x=!1;for(let w=0;w<v.length;w++){const i=v.get(w);if(i.hidden||i.writingMode===e.an.vertical&&!x){qt(i.numGlyphs,_);continue}x=!1;const S=new e.P(i.anchorX,i.anchorY),T={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:S,unwrappedTileID:c,width:u,height:h,translation:d},I=jt(i.anchorX,i.anchorY,T);if(!Mt(I.point,g)){qt(i.numGlyphs,_);continue}const E=At(r.transform.cameraToCenterDistance,I.signedDistanceFromCamera),P=e.ao(f,m,i),k=a?P*r.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,c)/E:P*E,C=zt({projectionContext:T,pitchedLabelPlaneMatrixInverse:o,symbol:i,fontSize:k,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:l});x=C.useVertical,(C.notEnoughRoom||x||C.needsFlipping&&zt({projectionContext:T,pitchedLabelPlaneMatrixInverse:o,symbol:i,fontSize:k,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&qt(i.numGlyphs,_)}i?t.text.dynamicLayoutVertexBuffer.updateData(_):t.icon.dynamicLayoutVertexBuffer.updateData(_)}function Lt(t,e,r,i,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=e.getoffsetX(o.glyphStartIndex),d=e.getoffsetX(l-1),p=Gt(t*h,r,i,n,o.segment,c,u,s,a);if(!p)return null;const f=Gt(t*d,r,i,n,o.segment,c,u,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function Dt(t,r,i,n){return t===e.an.horizontal&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(t===e.an.vertical?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function zt(t){const{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=t,d=o/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let m;if(n.numGlyphs>1){const t=n.glyphStartIndex+n.numGlyphs,e=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Lt(d,l,p,f,a,n,h,r);if(!c)return{notEnoughRoom:!0};const g=Bt(c.first.point.x,c.first.point.y,r,i),_=Bt(c.last.point.x,c.last.point.y,r,i);if(s&&!a){const t=Dt(n.writingMode,g,_,u);if(t)return t}m=[c.first];for(let i=n.glyphStartIndex+1;i<t-1;i++){const t=Gt(d*l.getoffsetX(i),p,f,a,n.segment,e,o,r,h);if(!t)return{notEnoughRoom:!0};m.push(t)}m.push(c.last)}else{if(s&&!a){const t=Nt(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,o=n.lineStartIndex+n.segment+1,a=new e.P(r.lineVertexArray.getx(o),r.lineVertexArray.gety(o)),s=Nt(a.x,a.y,r),l=s.signedDistanceFromCamera>0?s.point:Ot(r.tileAnchorPoint,a,t,1,r),c=Bt(t.x,t.y,r,i),h=Bt(l.x,l.y,r,i),d=Dt(n.writingMode,c,h,u);if(d)return d}const t=Gt(d*l.getoffsetX(n.glyphStartIndex),p,f,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,h);if(!t||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(const g of m)e.au(c,g.point,g.angle);return{}}function Ot(t,e,r,i,n){const o=t.add(t.sub(e)._unit()),a=Nt(o.x,o.y,n).point,s=r.sub(a);return r.add(s._mult(i/s.mag()))}function Ft(t,r,i){const n=r.projectionCache;if(n.projections[t])return n.projections[t];const o=new e.P(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),a=Nt(o.x,o.y,r);if(a.signedDistanceFromCamera>0)return n.projections[t]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=t-i.direction;return Ot(0===i.distanceFromAnchor?r.tileAnchorPoint:new e.P(r.lineVertexArray.getx(s),r.lineVertexArray.gety(s)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,r)}function Nt(t,e,r){const i=t+r.translation[0],n=e+r.translation[1];let o;return r.pitchWithMap?(o=Ct(i,n,r.pitchedLabelPlaneMatrix,r.getElevation),o.isOccluded=!1):(o=r.transform.projectTileCoordinates(i,n,r.unwrappedTileID,r.getElevation),o.point.x=(.5*o.point.x+.5)*r.width,o.point.y=(.5*-o.point.y+.5)*r.height),o}function Bt(t,r,i,n){if(i.pitchWithMap){const o=[t,r,0,1];return e.av(o,o,n),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:t/i.width*2-1,y:1-r/i.height*2}}function jt(t,e,r){return r.transform.projectTileCoordinates(t,e,r.unwrappedTileID,r.getElevation)}function Ut(t,e,r){return t._unit()._perp()._mult(e*r)}function Vt(t,r,i,n,o,a,s,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const u=i.add(r);if(t+c.direction<n||t+c.direction>=o)return l.projectionCache.offsets[t]=u,u;const h=Ft(t+c.direction,l,c),d=Ut(h.sub(i),s,c.direction),p=i.add(d),f=h.add(d);return l.projectionCache.offsets[t]=e.aw(a,u,p,f)||u,l.projectionCache.offsets[t]}function Gt(t,e,r,i,n,o,a,s,l){const c=i?t-e:t+e;let u=c>0?1:-1,h=0;i&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?o+n:o+n+1;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=Nt(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f,m,g=d,_=d,y=0,v=0;const b=Math.abs(c),x=[];let w;for(;y+v<=b;){if(p+=u,p<o||p>=a)return null;y+=v,_=g,m=f;const t={absOffsetX:b,direction:u,distanceFromAnchor:y,previousVertex:_};if(g=Ft(p,s,t),0===r)x.push(_),w=g.sub(_);else{let e;const i=g.sub(_);e=0===i.mag()?Ut(Ft(p+u,s,t).sub(g),r,u):Ut(i,r,u),m||(m=_.add(e)),f=Vt(p,e,g,o,a,m,r,s,t),x.push(m),w=f.sub(m)}v=w.mag()}const S=w._mult((b-y)/v)._add(m||_),T=h+Math.atan2(g.y-_.y,g.x-_.x);return x.push(S),{point:S,angle:l?T:0,path:x}}const $t=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qt(t,e){for(let r=0;r<t;r++){const t=e.length;e.resize(t+4),e.float32.set($t,3*t)}}function Zt(t,e,r){const i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t[3]=r[3]*i+r[7]*n+r[15],t}const Wt=100;class Ht{constructor(t,e=new It(t.width+200,t.height+200,25),r=new It(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Wt,this.screenBottomBoundary=t.height+Wt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,r,i,n,o,a,s,l,c,u,h){const d=this.projectAndGetPerspectiveRatio(t.anchorPointX+s[0],t.anchorPointY+s[1],n,c,h),p=r*d.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(t,p,i,n,o,a,s,d,c,u,h);else{const e=d.x+(u?u.x*p:0),r=d.y+(u?u.y*p:0);f={allPointsOccluded:!1,box:[e+t.x1*p,r+t.y1*p,e+t.x2*p,r+t.y2*p]}}const[m,g,_,y]=f.box,v=o?f.allPointsOccluded:d.isOccluded;let b=v;return b||(b=d.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(m,g,_,y)),b||"always"!==e&&this.grid.hitTest(m,g,_,y,e,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:v}}placeCollisionCircles(t,r,i,n,o,a,s,l,c,u,h,d,p,f){const m=[],g=new e.P(r.anchorX,r.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),y=(c?o*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,a)/_:o*_)/e.aA,v={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:p},b=Lt(y,n,r.lineOffsetX*y,r.lineOffsetY*y,!1,r,!1,v);let x=!1,w=!1,S=!0;if(b){const r=.5*h*_+d,i=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new St,a=b.first,s=b.last;let p=[];for(let t=a.path.length-1;t>=1;t--)p.push(a.path[t]);for(let t=1;t<s.path.length;t++)p.push(s.path[t]);const f=2.5*r;if(c){const t=this.projectPathToScreenSpace(p,v);p=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let g=[];if(p.length>0){const t=p[0].clone(),r=p[0].clone();for(let e=1;e<p.length;e++)t.x=Math.min(t.x,p[e].x),t.y=Math.min(t.y,p[e].y),r.x=Math.max(r.x,p[e].x),r.y=Math.max(r.y,p[e].y);g=t.x>=i.x&&r.x<=n.x&&t.y>=i.y&&r.y<=n.y?[p]:r.x<i.x||t.x>n.x||r.y<i.y||t.y>n.y?[]:e.ax([p],i.x,i.y,n.x,n.y)}for(const e of g){o.reset(e,.25*r);let i=0;i=o.length<=.5*r?1:Math.ceil(o.paddedLength/f)+1;for(let e=0;e<i;e++){const n=e/Math.max(i-1,1),a=o.lerp(n),s=a.x+Wt,c=a.y+Wt;m.push(s,c,r,0);const h=s-r,d=c-r,p=s+r,f=c+r;if(S=S&&this.isOffscreen(h,d,p,f),w=w||this.isInsideGrid(h,d,p,f),"always"!==t&&this.grid.hitTestCircle(s,c,r,t,u)&&(x=!0,!l))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!l&&x||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:S,collisionDetected:x}}projectPathToScreenSpace(t,r){const i=function(t,r){const i=e.L();return e.ap(i,r.pitchedLabelPlaneMatrix),t.map((t=>{const e=Ct(t.x,t.y,i,r.getElevation),n=r.transform.projectTileCoordinates(e.point.x,e.point.y,r.unwrappedTileID,r.getElevation);return n.point.x=(.5*n.point.x+.5)*r.width,n.point.y=(.5*-n.point.y+.5)*r.height,n}))}(t,r);return function(t){let e=0,r=0,i=0,n=0;for(let o=0;o<t.length;o++)t[o].isOccluded?(i=o+1,n=0):(n++,n>r&&(r=n,e=i));return t.slice(e,e+r)}(i)}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const r=[],i=new e.a1;for(const h of t){const t=new e.P(h.x+Wt,h.y+Wt);i.extend(t),r.push(t)}const{minX:n,minY:o,maxX:a,maxY:s}=i,l=this.grid.query(n,o,a,s).concat(this.ignoredGrid.query(n,o,a,s)),c={},u={};for(const h of l){const t=h.key;if(void 0===c[t.bucketInstanceId]&&(c[t.bucketInstanceId]={}),c[t.bucketInstanceId][t.featureIndex])continue;const i=[new e.P(h.x1,h.y1),new e.P(h.x2,h.y1),new e.P(h.x2,h.y2),new e.P(h.x1,h.y2)];e.ay(r,i)&&(c[t.bucketInstanceId][t.featureIndex]=!0,void 0===u[t.bucketInstanceId]&&(u[t.bucketInstanceId]=[]),u[t.bucketInstanceId].push(t.featureIndex))}return u}insertCollisionBox(t,e,r,i,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,r,i,n,o){const a=r?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let l=0;l<t.length;l+=4)a.insertCircle(s,t[l],t[l+1],t[l+2])}projectAndGetPerspectiveRatio(t,r,i,n,o){if(o){let i;n?(i=[t,r,n(t,r),1],e.av(i,i,o)):(i=[t,r,0,1],Zt(i,i,o));const a=i[3];return{x:(i[0]/a+1)/2*this.transform.width+Wt,y:(-i[1]/a+1)/2*this.transform.height+Wt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const e=this.transform.projectTileCoordinates(t,r,i,n);return{x:(e.point.x+1)/2*this.transform.width+Wt,y:(1-e.point.y)/2*this.transform.height+Wt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/e.signedDistanceFromCamera*.5,isOccluded:e.isOccluded,signedDistanceFromCamera:e.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,r,i){const n=this.transform.projectTileCoordinates(t,e,r,i);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,r,i){return r<Wt||t>=this.screenRightBoundary||i<Wt||e>this.screenBottomBoundary}isInsideGrid(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.af([]);return e.M(t,t,[-100,-100,0]),t}_projectCollisionBox(t,r,i,n,o,a,s,l,c,u,h){let d=1,p=0,f=0,m=1;const g=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(a&&!o){const t=this.projectAndGetPerspectiveRatio(g+1,_,n,c,h),e=t.x-l.x,r=Math.atan((t.y-l.y)/e)+(e<0?Math.PI:0),i=Math.sin(r),o=Math.cos(r);d=o,p=i,f=-i,m=o}else if(!a&&o){const t=kt(this.transform);d=t.vecEast[0],p=t.vecEast[1],f=t.vecSouth[0],m=t.vecSouth[1]}let y=l.x,v=l.y,b=r;o&&(y=g,v=_,b=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),b*=this.transform.getPitchedTextCorrection(g,_,n),u||(b*=e.ag(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(y+=d*u.x*b+f*u.y*b,v+=p*u.x*b+m*u.y*b);const x=t.x1*b,w=t.x2*b,S=(x+w)/2,T=t.y1*b,I=t.y2*b,E=(T+I)/2,P=[{offsetX:x,offsetY:T},{offsetX:S,offsetY:T},{offsetX:w,offsetY:T},{offsetX:w,offsetY:E},{offsetX:w,offsetY:I},{offsetX:S,offsetY:I},{offsetX:x,offsetY:I},{offsetX:x,offsetY:E}];let k=[];for(const{offsetX:A,offsetY:M}of P)k.push(new e.P(y+d*A+f*M,v+p*A+m*M));let C=!1;if(o){const t=k.map((t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,c,h)));C=t.some((t=>!t.isOccluded)),k=t.map((t=>new e.P(t.x,t.y)))}else C=!0;return{box:e.az(k),allPointsOccluded:!C}}}class Xt{constructor(t,e,r,i){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class Jt{constructor(t,e,r,i,n){this.text=new Xt(t?t.text:null,e,r,n),this.icon=new Xt(t?t.icon:null,e,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Yt{constructor(t,e,r){this.text=t,this.icon=e,this.skipFade=r}}class Kt{constructor(t,e,r,i,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}}class Qt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function te(t,r,i,n,o){const{horizontalAlign:a,verticalAlign:s}=e.aG(t);return new e.P(-(a-.5)*r+n[0]*o,-(s-.5)*i+n[1]*o)}class ee{constructor(t,e,r,i,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Ht(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new Qt(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(r,i)=>e.getElevation(t,r,i):null}getBucketParts(t,r,i,n){const o=i.getBucket(r),a=i.latestFeatureIndex;if(!o||!a||r.id!==o.layerIds[0])return;const s=i.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/e.$,d=i.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=e.aB(i,1,this.transform.zoom),m=e.aC(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),g=e.aC(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),_=Et(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new Kt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const y={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:h,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.am(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const e of o.sortKeyRanges){const{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=e;t.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b){const x=e.aD[t.textAnchor],w=[t.textOffset0,t.textOffset1],S=te(x,i,n,w,o),T=this.collisionIndex.placeCollisionBox(r,d,l,c,u,s,a,g,h.predicate,v,S,b);if((!y||this.collisionIndex.placeCollisionBox(y,d,l,c,u,s,a,_,h.predicate,v,S,b).placeable)&&T.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(t=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:w,width:i,height:n,anchor:x,textBoxScale:o,prevAnchor:t},this.markUsedJustification(f,x,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:S,placedGlyphBoxes:T}}}placeLayerBucketPart(t,r,i){const{bucket:n,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=t.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=e.aE(o,"text-overlap","text-allow-overlap"),y="always"===_,v=e.aE(o,"icon-overlap","icon-allow-overlap"),b="always"===v,x="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),S="none"!==o.get("icon-text-fit"),T="viewport-y"===o.get("symbol-z-order"),I=y&&(b||!n.hasIconData()||g),E=b&&(y||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const P=this.retainedQueryData[n.bucketInstanceId].tileID,k=this._getTerrainElevationFunc(P),C=this.transform.getFastPathSimpleProjectionMatrix(P),A=(t,d,b)=>{var T,A;if(r[t.crossTileID])return;if(h)return void(this.placements[t.crossTileID]=new Yt(!1,!1,!1));let M=!1,R=!1,L=!0,D=null,z={box:null,placeable:!1,offscreen:null,occluded:!1},O={placeable:!1},F=null,N=null,B=null,j=0,U=0,V=0;d.textFeatureIndex?j=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(j=t.featureIndex),d.verticalTextFeatureIndex&&(U=d.verticalTextFeatureIndex);const G=d.textBox;if(G){const r=r=>{let i=e.an.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,i=e,this.markUsedOrientation(n,i,t))}return i},o=(r,i)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of n.writingModes)if(t===e.an.vertical?(z=i(),O=z):z=r(),z&&z.placeable)break}else z=r()},c=t.textAnchorOffsetStartIndex,h=t.textAnchorOffsetEndIndex;if(h===c){const i=(e,r)=>{const i=this.collisionIndex.placeCollisionBox(e,_,u,P,l,w,x,a,f.predicate,k,void 0,C);return i&&i.placeable&&(this.markUsedOrientation(n,r,t),this.placedOrientations[t.crossTileID]=r),i};o((()=>i(G,e.an.horizontal)),(()=>{const r=d.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&r?i(r,e.an.vertical):{box:null,offscreen:null}})),r(z&&z.placeable)}else{let p=e.aD[null===(A=null===(T=this.prevPlacement)||void 0===T?void 0:T.variableOffsets[t.crossTileID])||void 0===A?void 0:A.anchor];const m=(e,r,o)=>{const d=e.x2-e.x1,m=e.y2-e.y1,g=t.textBoxScale,y=S&&"never"===v?r:null;let b=null,T="never"===_?1:2,I="never";p&&T++;for(let i=0;i<T;i++){for(let r=c;r<h;r++){const i=n.textAnchorOffsets.get(r);if(p&&i.textAnchor!==p)continue;const c=this.attemptAnchorPlacement(i,e,d,m,g,x,w,u,P,l,f,I,t,n,o,a,s,y,k);if(c&&(b=c.placedGlyphBoxes,b&&b.placeable))return M=!0,D=c.shift,b}p?p=null:I=_}return i&&!b&&(b={box:this.collisionIndex.placeCollisionBox(G,"always",u,P,l,w,x,a,f.predicate,k,void 0,C).box,offscreen:!1,placeable:!1,occluded:!1}),b};o((()=>m(G,d.iconBox,e.an.horizontal)),(()=>{const r=d.verticalTextBox;return n.allowVerticalPlacement&&(!z||!z.placeable)&&t.numVerticalGlyphVertices>0&&r?m(r,d.verticalIconBox,e.an.vertical):{box:null,occluded:!0,offscreen:null}})),z&&(M=z.placeable,L=z.offscreen);const g=r(z&&z.placeable);if(!M&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(n,e.anchor,t,g))}}}if(F=z,M=F&&F.placeable,L=F&&F.offscreen,t.useRuntimeCollisionCircles){const r=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),s=e.ao(n.textSizeData,p,r),u=o.get("text-padding");N=this.collisionIndex.placeCollisionCircles(_,r,n.lineVertexArray,n.glyphOffsetArray,s,l,c,i,w,f.predicate,t.collisionCircleDiameter,u,a,k),N.circles.length&&N.collisionDetected&&!i&&e.w("Collisions detected, but collision boxes are not shown"),M=y||N.circles.length>0&&!N.collisionDetected,L=L&&N.offscreen}if(d.iconFeatureIndex&&(V=d.iconFeatureIndex),d.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,v,u,P,l,w,x,s,f.predicate,k,S&&D?D:void 0,C);O&&O.placeable&&d.verticalIconBox?(B=t(d.verticalIconBox),R=B.placeable):(B=t(d.iconBox),R=B.placeable),L=L&&B.offscreen}const $=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,q=g||0===t.numIconVertices;$||q?q?$||(R=R&&M):M=R&&M:R=M=R&&M;const Z=R&&B.placeable;if(M&&F.placeable&&this.collisionIndex.insertCollisionBox(F.box,_,o.get("text-ignore-placement"),n.bucketInstanceId,O&&O.placeable&&U?U:j,f.ID),Z&&this.collisionIndex.insertCollisionBox(B.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,V,f.ID),N&&M&&this.collisionIndex.insertCollisionCircles(N.circles,_,o.get("text-ignore-placement"),n.bucketInstanceId,j,f.ID),i&&this.storeCollisionData(n.bucketInstanceId,b,d,F,B,N),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Yt((M||I)&&!(null==F?void 0:F.occluded),(R||E)&&!(null==B?void 0:B.occluded),L||n.justReloaded),r[t.crossTileID]=!0};if(T){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){const r=e[t];A(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)A(n.symbolInstances.get(e),n.collisionArrays[e],e);n.justReloaded=!1}storeCollisionData(t,e,r,i,n,o){if(r.textBox||r.iconBox){let o,a;this.collisionBoxArrays.has(t)?o=this.collisionBoxArrays.get(t):(o=new Map,this.collisionBoxArrays.set(t,o)),o.has(e)?a=o.get(e):(a={text:null,icon:null},o.set(e,a)),r.textBox&&(a.text=i.box),r.iconBox&&(a.icon=n.box)}if(o){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<o.circles.length;t+=4)e.push(o.circles[t+0]-Wt),e.push(o.circles[t+1]-Wt),e.push(o.circles[t+2]),e.push(o.collisionDetected?1:0)}}markUsedJustification(t,r,i,n){let o;o=n===e.an.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[e.aF(r)];const a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(const e of a)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=o>=0&&e!==o?0:i.crossTileID)}markUsedOrientation(t,r,i){const n=r===e.an.horizontal||r===e.an.horizontalOnly?r:0,o=r===e.an.vertical?r:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const e of a)t.text.placedSymbolArray.get(e).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const i=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const s in this.placements){const t=this.placements[s],e=n[s];e?(this.opacities[s]=new Jt(e,i,t.text,t.icon),r=r||t.text!==e.text.placed||t.icon!==e.icon.placed):(this.opacities[s]=new Jt(null,i,t.text,t.icon,t.skipFade),r=r||t.text||t.icon)}for(const s in n){const t=n[s];if(!this.opacities[s]){const e=new Jt(t,i,!1,!1);e.isHidden()||(this.opacities[s]=e,r=r||t.text.placed||t.icon.placed)}}for(const s in o)this.variableOffsets[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.variableOffsets[s]=o[s]);for(const s in a)this.placedOrientations[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.placedOrientations[s]=a[s]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const r={};for(const i of e){const e=i.getBucket(t);e&&i.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(t,r,i,n){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const o=t.layers[0],a=o.layout,s=new Jt(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===a.get("text-rotation-alignment"),d="map"===a.get("text-pitch-alignment"),p="none"!==a.get("icon-text-fit"),f=new Jt(null,0,l&&(c||!t.hasIconData()||a.get("icon-optional")),c&&(l||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const m=(t,e,r)=>{for(let i=0;i<e/4;i++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices=t.hasVisibleVertices||r!==he},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let _=0;_<t.symbolInstances.length;_++){const r=t.symbolInstances.get(_),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,crossTileID:a}=r;let l=this.opacities[a];i[a]?l=s:l||(l=f,this.opacities[a]=l),i[a]=!0;const c=r.numIconVertices>0,y=this.placedOrientations[r.crossTileID],v=y===e.an.vertical,b=y===e.an.horizontal||y===e.an.horizontalOnly;if(n>0||o>0){const e=ue(l.text);m(t.text,n,v?he:e),m(t.text,o,b?he:e);const i=l.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||v?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||b?1:0);const a=this.variableOffsets[r.crossTileID];a&&this.markUsedJustification(t,a.anchor,r,y);const s=this.placedOrientations[r.crossTileID];s&&(this.markUsedJustification(t,"left",r,s),this.markUsedOrientation(t,s,r))}if(c){const e=ue(l.icon),i=!(p&&r.verticalPlacedIconSymbolIndex&&v);r.placedIconSymbolIndex>=0&&(m(t.icon,r.numIconVertices,i?e:he),t.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=l.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,r.numVerticalIconVertices,i?he:e),t.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}const x=g&&g.has(_)?g.get(_):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const r=t.collisionArrays[_];if(r){let i=new e.P(0,0);if(r.textBox||r.verticalTextBox){let e=!0;if(u){const t=this.variableOffsets[a];t?(i=te(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),h&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):e=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=b),re(t.textCollisionBox.collisionVertexArray,l.text.placed,!e||n,x.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const e=Boolean(!b&&r.verticalIconBox);let n;r.iconBox&&(n=e),r.verticalIconBox&&(n=!e),re(t.iconCollisionBox.collisionVertexArray,l.icon.placed,n,x.icon,p?i.x:0,p?i.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}}function re(t,e,r,i,n,o){i&&0!==i.length||(i=[0,0,0,0]);const a=i[0]-Wt,s=i[1]-Wt,l=i[2]-Wt,c=i[3]-Wt;t.emplaceBack(e?1:0,r?1:0,n||0,o||0,a,s),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,l,s),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,l,c),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,a,c)}const ie=Math.pow(2,25),ne=Math.pow(2,24),oe=Math.pow(2,17),ae=Math.pow(2,16),se=Math.pow(2,9),le=Math.pow(2,8),ce=Math.pow(2,1);function ue(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*ie+e*ne+r*oe+e*ae+r*se+e*le+r*ce+e}const he=0;class de{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,r,i,n){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,i,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0;return!1}}class pe{constructor(t,e,r,i,n,o,a,s){this.placement=new ee(t,e,o,a,s),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,r){const i=a.now(),n=()=>!this._forceFullPlacement&&a.now()-i>2;for(;this._currentPlacementIndex>=0;){const i=e[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new de(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const fe=512/e.$/2;class me{constructor(t,r,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};const n=new Map;for(let e=0;e<r.length;e++){const t=r.get(e),i=t.key,o=n.get(i);o?o.push(t):n.set(i,[t])}for(const[o,a]of n){const t={positions:a.map((t=>({x:Math.floor(t.anchorX*fe),y:Math.floor(t.anchorY*fe)}))),crossTileIDs:a.map((t=>t.crossTileID))};if(t.positions.length>128){const r=new e.aH(t.positions.length,16,Uint16Array);for(const{x:e,y:i}of t.positions)r.add(e,i);r.finish(),delete t.positions,t.index=r}this._symbolsByKey[o]=t}}getScaledCoordinates(t,r){const{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=r.canonical,c=fe/Math.pow(2,l-o),u=(s*e.$+t.anchorY)*c,h=n*e.$*fe;return{x:Math.floor((a*e.$+t.anchorX)*c-i*e.$*fe),y:Math.floor(u-h)}}findMatches(t,e,r){const i=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const o=t.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);if(a.index){const t=a.index.range(s.x-i,s.y-i,s.x+i,s.y+i).sort();for(const e of t){const t=a.crossTileIDs[e];if(!r[t]){r[t]=!0,o.crossTileID=t;break}}}else if(a.positions)for(let t=0;t<a.positions.length;t++){const e=a.positions[t],n=a.crossTileIDs[t];if(Math.abs(e.x-s.x)<=i&&Math.abs(e.y-s.y)<=i&&!r[n]){r[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class ge{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class _e{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const r in this.indexes){const t=this.indexes[r],i={};for(const r in t){const n=t[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),i[n.tileID.key]=n}this.indexes[r]=i}this.lng=t}addBucket(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let n=0;n<e.symbolInstances.length;n++)e.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const i=this.usedCrossTileIDs[t.overscaledZ];for(const n in this.indexes){const r=this.indexes[n];if(Number(n)>t.overscaledZ)for(const n in r){const o=r[n];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,i)}else{const o=r[t.scaledTo(Number(n)).key];o&&o.findMatches(e.symbolInstances,t,i)}}for(let n=0;n<e.symbolInstances.length;n++){const t=e.symbolInstances.get(n);t.crossTileID||(t.crossTileID=r.generate(),i[t.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new me(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const r of e.getCrossTileIDsLists())for(const e of r)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const r in this.indexes){const i=this.indexes[r];for(const n in i)t[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],e=!0)}return e}}class ye{constructor(){this.layerIndexes={},this.crossTileIDs=new ge,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,r){let i=this.layerIndexes[t.id];void 0===i&&(i=this.layerIndexes[t.id]=new _e);let n=!1;const o={};i.handleWrapJump(r);for(const a of e){const e=a.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(a.tileID,e,this.crossTileIDs)&&(n=!0),o[e.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const r in this.layerIndexes)e[r]||delete this.layerIndexes[r]}}var ve="void main() {fragColor=vec4(1.0);}";const be={prelude:xe("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:xe("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:xe("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:xe("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:xe("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:xe("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:xe(ve,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:xe("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:xe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:xe("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:xe("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:xe("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:xe(ve,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:xe("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:xe("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:xe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:xe("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:xe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:xe("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:xe("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:xe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:xe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:xe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:xe("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:xe("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:xe("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:xe("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:xe("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:xe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:xe("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:xe("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:xe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function xe(t,e){const r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:t=t.replace(r,((t,e,r,i,n)=>(s[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(r,((t,e,r,i,n)=>{const o="float"===i?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\nout ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`})),staticAttributes:i,staticUniforms:a}}class we{constructor(t,e,r){this.vertexBuffer=t,this.indexBuffer=e,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Se=e.aI([{name:"a_pos",type:"Int16",components:2}]);const Te="#define PROJECTION_MERCATOR",Ie="mercator";class Ee{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Ie}get shaderDefine(){return Te}get shaderPreludeCode(){return be.projectionMercator}get vertexShaderPreludeCode(){return be.projectionMercator.vertexSource}get subdivisionGranularity(){return e.aJ.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,r,i,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new e.aK;a.emplaceBack(0,0),a.emplaceBack(e.$,0),a.emplaceBack(0,e.$),a.emplaceBack(e.$,e.$);const s=t.createVertexBuffer(a,Se.members),l=e.aL.simpleSegment(0,0,4,2),c=new e.aM;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=t.createIndexBuffer(c);return this._cachedMesh=new we(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Pe{constructor(t=0,e=0,r=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=i}interpolate(t,r,i){return null!=r.top&&null!=t.top&&(this.top=e.C.number(t.top,r.top,i)),null!=r.bottom&&null!=t.bottom&&(this.bottom=e.C.number(t.bottom,r.bottom,i)),null!=r.left&&null!=t.left&&(this.left=e.C.number(t.left,r.left,i)),null!=r.right&&null!=t.right&&(this.right=e.C.number(t.right,r.right,i)),this}getCenter(t,r){const i=e.ag((this.left+t-this.right)/2,0,t),n=e.ag((this.top+r-this.bottom)/2,0,r);return new e.P(i,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Pe(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ke(t,e){if(!t.renderWorldCopies||t.lngRange)return;const r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}function Ce(t){return Math.max(0,Math.floor(t))}class Ae{constructor(t,r,i,n,o,a){this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===a||!!a,this._minZoom=r||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new e.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ce(this._zoom),this._scale=e.ae(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Pe,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r,i){this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Ce(this._zoom),this._scale=e.ae(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Pe(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!i&&t.autoCalculateNearFarZ,r&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const r=e.aN(t,-180,180)*Math.PI/180;var n,o,a,s,l,c,u,h,d;this._bearingInRadians!==r&&(this._unmodified=!1,this._bearingInRadians=r,this._calcMatrices(),this._rotationMatrix=i(),n=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(a),d=Math.cos(a),n[0]=s*d+c*h,n[1]=l*d+u*h,n[2]=s*-h+c*d,n[3]=l*-h+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const r=e.ag(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return e.aO(this._fovInRadians)}setFov(t){t=e.ag(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=e.ad(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const r=this.getConstrained(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=e.ae(r),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()}resize(t,e,r=!0){this._width=t,this._height=e,r&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new G([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-e.ah,e.ah])}getConstrained(t,e){return this._callbacks.getConstrained(t,e)}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{const{minX:i,minY:n,maxX:o,maxY:a}=e.a1.fromPoints(r).extend(t);return[new e.P(i,n),new e.P(o,n),new e.P(o,a),new e.P(i,a),new e.P(i,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:r}=this.getConstrained(this.center,this.zoom);this.setCenter(e),this.setZoom(r),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=e.af(new Float64Array(16));e.N(t,t,[this._width/2,-this._height/2,1]),e.M(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=e.af(new Float64Array(16)),e.N(t,t,[1,-1,1]),e.M(t,t,[-1,-1,0]),e.N(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,r,i,n){const o=void 0!==i?i:this.bearing,a=n=void 0!==n?n:this.pitch,s=e.a0.fromLngLat(t,r),l=-Math.cos(e.ad(a)),c=Math.sin(e.ad(a)),u=c*Math.sin(e.ad(o)),h=-c*Math.cos(e.ad(o));let d=this.elevation;const p=r-d;let f;l*p>=0||Math.abs(l)<.1?(f=1e4,d=r+f*l):f=-p/l;let m,g,_=e.aP(1,s.y),y=0;do{if(y+=1,y>10)break;g=f/_,m=new e.a0(s.x+u*g,s.y+h*g),_=1/m.meterInMercatorCoordinateUnits()}while(Math.abs(f-g*_)>1e-12);return{center:m.toLngLat(),elevation:d,zoom:e.aj(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const r=e.ai(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/r,n=e.a0.fromLngLat(this.center,this.elevation),o=dt(this.center,this.elevation,this.pitch,this.bearing,i);this._elevation=t;const a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),e.aP(o.z,n.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=e.ai(1,this.center.lat)*this.worldSize;return dt(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const r=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/r,t.canonical.y/r,1/r/e.$,1/r/e.$]}}class Me{constructor(t,r){this.min=t,this.max=r,this.center=e.aQ([],e.aR([],this.min,this.max),.5)}quadrant(t){const r=[t%2==0,t<2],i=e.aS(this.min),n=e.aS(this.max);for(let e=0;e<r.length;e++)i[e]=r[e]?this.min[e]:this.center[e],n[e]=r[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new Me(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let e=!0;for(let r=0;r<t.planes.length;r++){const i=this.intersectsPlane(t.planes[r]);if(0===i)return 0;1===i&&(e=!1)}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],r=t[3];for(let i=0;i<3;i++)t[i]>0?(e+=t[i]*this.min[i],r+=t[i]*this.max[i]):(r+=t[i]*this.min[i],e+=t[i]*this.max[i]);return e>=0?2:r<0?0:1}}class Re{distanceToTile2d(t,e,r,i){const n=i.distanceX([t,e]),o=i.distanceY([t,e]);return Math.hypot(n,o)}getWrap(t,e,r){return r}getTileBoundingVolume(t,r,i,n){var o,a;let s=i,l=i;if(null==n?void 0:n.terrain){const c=new e.Z(t.z,r,t.z,t.x,t.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:i,l=null!==(a=u.maxElevation)&&void 0!==a?a:i}const c=1<<t.z;return new Me([r+t.x/c,t.y/c,s],[r+(t.x+1)/c,(t.y+1)/c,l])}allowVariableZoom(t,r){const i=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=e.ag(78.5-i/2,0,60);return!!r.terrain||t.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class Le{constructor(t,e,r){this.points=t,this.planes=e,this.aabb=r}static fromInvProjectionMatrix(t,r=1,i=0,n,o){const a=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=Math.pow(2,i),l=[[-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((i=>function(t,r,i,n){const o=e.av([],t,r),a=1/o[3]/i*n;return e.aX(o,o,[a,a,1/o[3],a])}(i,t,r,s)));n&&function(t,r,i,n){const o=n?4:0,a=n?0:4;let s=0;const l=[],c=[];for(let d=0;d<4;d++){const r=e.aT([],t[d+a],t[d+o]),i=e.aY(r);e.aQ(r,r,1/i),l.push(i),c.push(r)}for(let d=0;d<4;d++){const r=e.aZ(t[d+o],c[d],i);s=null!==r&&r>=0?Math.max(s,r):Math.max(s,l[d])}const u=function(t,r){const i=e.aT([],t[r[0]],t[r[1]]),n=e.aT([],t[r[2]],t[r[1]]),o=[0,0,0,0];return e.aU(o,e.aV([],i,n)),o[3]=-e.aW(o,t[r[0]]),o}(t,r),h=function(t,r){const i=e.a_(t),n=e.a$([],t,1/i),o=e.aT([],r,e.aQ([],n,e.aW(r,n))),a=e.a_(o);if(a>0){const t=Math.sqrt(1-n[3]*n[3]),i=e.aQ([],n,-n[3]),s=e.aR([],i,e.aQ([],o,t/a));return e.b0(r,s)}return null}(i,u);if(null!==h){const t=h/e.aW(c[0],u);s=Math.min(s,t)}for(let e=0;e<4;e++){const r=Math.min(s,l[e]);t[e+a]=[t[e+o][0]+c[e][0]*r,t[e+o][1]+c[e][1]*r,t[e+o][2]+c[e][2]*r,1]}}(l,a[0],n,o);const c=a.map((t=>{const r=e.aT([],l[t[0]],l[t[1]]),i=e.aT([],l[t[2]],l[t[1]]),n=e.aU([],e.aV([],r,i)),o=-e.aW(n,l[t[1]]);return n.concat(o)})),u=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of l)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),h[t]=Math.max(h[t],e[t]);return new Le(l,c,new Me(u,h))}}class De{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,r=!0){this._helper.resize(t,e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t,e,r,i,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Ae({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)},t,e,r,i,n),this._coveringTilesDetailsProvider=new Re}clone(){const t=new De;return t.apply(this),t}apply(t,e,r){this._helper.apply(t,e,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const r=[new e.b1(0,t)];if(this._helper._renderWorldCopies){const i=this.screenPointToMercatorCoordinate(new e.P(0,0)),n=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new e.P(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),c=1;for(let u=s-c;u<=l+c;u++)0!==u&&r.push(new e.b1(u,t))}return r}getCameraFrustum(){return Le.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const e=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,r){const i=e.ai(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,i),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),a=e.a0.fromLngLat(t),s=new e.a0(a.x-(n.x-o.x),a.y-(n.y-o.y));this.setCenter(null==s?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(e.a0.fromLngLat(t),r.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(e.a0.fromLngLat(t))}screenPointToLocation(t,e){var r;return null===(r=this.screenPointToMercatorCoordinate(t,e))||void 0===r?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){const r=e.pointCoordinate(t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,r){const i=r||0,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.av(n,n,this._pixelMatrixInverse),e.av(o,o,this._pixelMatrixInverse);const a=n[3],s=o[3],l=n[1]/a,c=o[1]/s,u=n[2]/a,h=o[2]/s,d=u===h?0:(i-u)/(h-u);return new e.a0(e.C.number(n[0]/a,o[0]/s,d)/this.worldSize,e.C.number(l,c,d)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){const n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return e.av(n,n,i),new e.P(n[0]/n[3],n[1]/n[3])}getBounds(){const t=Math.max(0,this._helper._height/2-ut(this));return(new G).extend(this.screenPointToLocation(new e.P(0,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new e.P(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?null!=e.pointCoordinate(t):t.y>this.height/2-ut(this)}calculatePosMatrix(t,r=!1,i){var n;const o=null!==(n=t.key)&&void 0!==n?n:e.b2(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const t=a.get(o);return i?t.f32:t.f64}const s=ht(t,this.worldSize);e.O(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),i?l.f32:l.f64}calculateFogMatrix(t){const r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);const n=ht(t,this.worldSize);return e.O(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}getConstrained(t,r){r=e.ag(+r,this.minZoom,this.maxZoom);const i={center:new e.S(t.lng,t.lat),zoom:r};let n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);const o=this.tileSize*e.ae(i.zoom);let a=0,s=o,l=0,c=o,u=0,h=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const t=this._helper._latRange;a=e.U(t[1])*o,s=e.U(t[0])*o,s-a<p&&(u=p/(s-a))}n&&(l=e.aN(e.V(n[0])*o,0,o),c=e.aN(e.V(n[1])*o,0,o),c<l&&(c+=o),c-l<d&&(h=d/(c-l)));const{x:f,y:m}=lt(o,t);let g,_;const y=Math.max(h||0,u||0);if(y){const t=new e.P(h?(c+l)/2:f,u?(s+a)/2:m);return i.center=ct(o,t).wrap(),i.zoom+=e.aj(y),i}if(this._helper._latRange){const t=p/2;m-t<a&&(_=a+t),m+t>s&&(_=s-t)}if(n){const t=(l+c)/2;let r=f;this._helper._renderWorldCopies&&(r=e.aN(f,t-o/2,t+o/2));const i=d/2;r-i<l&&(g=l+i),r+i>c&&(g=c-i)}if(void 0!==g||void 0!==_){const t=new e.P(null!=g?g:f,null!=_?_:m);i.center=ct(o,t).wrap()}return i}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=t-n*this._helper._pixelPerMeter/Math.cos(r),a=n<0?o:t,s=Math.PI/2+this.pitchInRadians,l=e.ad(this.fov)*(Math.abs(Math.cos(e.ad(this.roll)))*this.height+Math.abs(Math.sin(e.ad(this.roll)))*this.width)/this.height*(.5+i.y/this.height),c=Math.sin(l)*a/Math.sin(e.ag(Math.PI-s-l,.01,Math.PI-.01)),u=ut(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=e.ad(.75),p=h>d?2*h*(.5+i.y/(2*u)):d,f=Math.sin(p)*a/Math.sin(e.ag(Math.PI-s-p,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-r)*m+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,r=lt(this.worldSize,this.center),i=r.x,n=r.y;this._helper._pixelPerMeter=e.ai(1,this.center.lat)*this.worldSize;const o=e.ad(Math.min(this.pitch,st)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let s;this._calculateNearFarZIfNeeded(a,o,t),s=new Float64Array(16),e.b3(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),e.ap(this._invProjMatrix,s),s[8]=2*-t.x/this._helper._width,s[9]=2*t.y/this._helper._height,this._projectionMatrix=e.b4(s),e.N(s,s,[1,-1,1]),e.M(s,s,[0,0,-this._helper.cameraToCenterDistance]),e.b5(s,s,-this.rollInRadians),e.b6(s,s,this.pitchInRadians),e.b5(s,s,-this.bearingInRadians),e.M(s,s,[-i,-n,0]),this._mercatorMatrix=e.N([],s,[this.worldSize,this.worldSize,this.worldSize]),e.N(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=e.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),e.M(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=e.ap([],s);const l=[0,0,-1,1];e.av(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),e.b3(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,e.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),e.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),e.b5(this._fogMatrix,this._fogMatrix,-this.rollInRadians),e.b6(this._fogMatrix,this._fogMatrix,this.pitchInRadians),e.b5(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),e.M(this._fogMatrix,this._fogMatrix,[-i,-n,0]),e.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),e.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=e.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=i-Math.round(i)+h*c+d*u,f=n-Math.round(n)+h*u+d*c,m=new Float64Array(s);if(e.M(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=e.ap(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new e.P(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.av(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=e.ai(1,this.center.lat)*this.worldSize;return dt(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,r){const i=e.a0.fromLngLat(t),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return e.av(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){const{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=t,o=this._helper.getMercatorTileCoordinates(r),a=r?this.calculatePosMatrix(r,i,!0):null;let s;return s=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:a||e.b7(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,r){return 1}transformLightDirection(t){return e.aS(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,r,i,n){const o=this.calculatePosMatrix(i);let a;n?(a=[t,r,n(t,r),1],e.av(a,a,o)):(a=[t,r,0,1],Zt(a,a,o));const s=a[3];return{point:new e.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(const e of t)this.calculatePosMatrix(e)}getMatrixForModel(t,r){const i=e.a0.fromLngLat(t,r),n=i.meterInMercatorCoordinateUnits(),o=e.b8();return e.M(o,o,[i.x,i.y,i.z]),e.b5(o,o,Math.PI),e.b6(o,o,Math.PI/2),e.N(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const r=new e.Z(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=ht(r,this.worldSize);e.O(n,this._viewProjMatrix,n),i.tileMercatorCoords=[0,0,1,1];const o=[e.$,e.$,this.worldSize/this._helper.pixelsPerMeter],a=e.b9();return e.N(a,n,o),i.fallbackMatrix=a,i.mainMatrix=a,i}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function ze(){e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Oe(t){if(t.useSlerp)if(t.k<1){const r=e.ba(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),i=e.ba(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);e.bb(n,r,i,t.k);const o=e.bc(n);t.tr.setRoll(o.roll),t.tr.setPitch(o.pitch),t.tr.setBearing(o.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(e.C.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(e.C.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(e.C.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Fe(t,r,i,n,o){const a=o.padding,s=lt(o.worldSize,i.getNorthWest()),l=lt(o.worldSize,i.getNorthEast()),c=lt(o.worldSize,i.getSouthEast()),u=lt(o.worldSize,i.getSouthWest()),h=e.ad(-n),d=s.rotate(h),p=l.rotate(h),f=c.rotate(h),m=u.rotate(h),g=new e.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),_=new e.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),y=g.sub(_),v=(o.width-(a.left+a.right+r.left+r.right))/y.x,b=(o.height-(a.top+a.bottom+r.top+r.bottom))/y.y;if(b<0||v<0)return void ze();const x=Math.min(e.aj(o.scale*Math.min(v,b)),t.maxZoom),w=e.P.convert(t.offset),S=new e.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(e.ad(n)),T=w.add(S).mult(o.scale/e.ae(x));return{center:ct(o.worldSize,s.add(c).div(2).sub(T)),zoom:x,bearing:n}}class Ne{get useGlobeControls(){return!1}handlePanInertia(t,e){return{easingOffset:t,easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,r){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(r,t.around)}cameraForBoxAndBearing(t,e,r,i,n){return Fe(t,e,r,i,n)}handleJumpToCenterZoom(t,r){t.zoom!==(void 0!==r.zoom?+r.zoom:t.zoom)&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(e.S.convert(r.center))}handleEaseTo(t,r){const i=t.zoom,n=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},a={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},s=void 0!==r.zoom,l=!t.isPaddingEqual(r.padding);let c=!1;const u=s?+r.zoom:t.zoom;let h=t.centerPoint.add(r.offsetAsPoint);const d=t.screenPointToLocation(h),{center:p,zoom:f}=t.getConstrained(e.S.convert(r.center||d),null!=u?u:i);ke(t,p);const m=lt(t.worldSize,d),g=lt(t.worldSize,p).sub(m),_=e.ae(f-i);return c=f!==i,{easeFunc:s=>{if(c&&t.setZoom(e.C.number(i,f,s)),e.bd(o,a)||Oe({startEulerAngles:o,endEulerAngles:a,tr:t,k:s,useSlerp:o.roll!=a.roll}),l&&(t.interpolatePadding(n,r.padding,s),h=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{const r=e.ae(t.zoom-i),n=f>i?Math.min(2,_):Math.max(.5,_),o=Math.pow(n,1-s),a=ct(t.worldSize,m.add(g.mult(s*o)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(t,r){const i=void 0!==r.zoom,n=t.zoom,o=t.getConstrained(e.S.convert(r.center||r.locationAtOffset),i?+r.zoom:n),a=o.center,s=o.zoom;ke(t,a);const l=lt(t.worldSize,r.locationAtOffset),c=lt(t.worldSize,a).sub(l),u=c.mag(),h=e.ae(s-n);let d;if(void 0!==r.minZoom){const i=Math.min(+r.minZoom,n,s),o=t.getConstrained(a,i).zoom;d=e.ae(o-n)}return{easeFunc:(r,i,o,u)=>{t.setZoom(1===r?s:n+e.aj(i));const h=1===r?a:ct(t.worldSize,l.add(c.mult(o)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:d,pixelPathLength:u}}}class Be{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}}Be.Replace=[1,0],Be.disabled=new Be(Be.Replace,e.be.transparent,[!1,!1,!1,!1]),Be.unblended=new Be(Be.Replace,e.be.transparent,[!0,!0,!0,!0]),Be.alphaBlended=new Be([1,771],e.be.transparent,[!0,!0,!0,!0]);const je=2305;class Ue{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r}}Ue.disabled=new Ue(!1,1029,je),Ue.backCCW=new Ue(!0,1029,je),Ue.frontCCW=new Ue(!0,1028,je);class Ve{constructor(t,e,r){this.func=t,this.mask=e,this.range=r}}Ve.ReadOnly=!1,Ve.ReadWrite=!0,Ve.disabled=new Ve(519,Ve.ReadOnly,[0,1]);const Ge=7680;class $e{constructor(t,e,r,i,n,o){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o}}$e.disabled=new $e({func:519,mask:0},0,0,Ge,Ge,Ge);const qe=new WeakMap;function Ze(t){var e;if(qe.has(t))return qe.get(t);{const r=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return qe.set(t,r),r}}class We{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const r=t.context,i=r.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;const n=new e.aK;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new e.aM;o.emplaceBack(0,1,2),this._fullscreenTriangle=new we(r.createVertexBuffer(n,Se.members),r.createIndexBuffer(o),e.aL.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(i.TEXTURE1);const a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texImage2D(i.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Ze(i)&&(this._pbo=i.createBuffer(),i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.bufferData(i.PIXEL_PACK_BUFFER,4,i.STREAM_READ),i.bindBuffer(i.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,e){const r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,r){const i=this._cachedRenderContext.context,n=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:e.be.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,n.TRIANGLES,Ve.disabled,$e.disabled,Be.unblended,Ue.disabled,((t,e)=>({u_input:t,u_output_expected:e}))(t,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Ze(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const t=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Ze(t)){const r=t.clientWaitSync(this._readbackQueue.sync,0,0);if(r===t.WAIT_FAILED)return e.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=We._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}const He=e.$/128;function Xe(t,r){const i=void 0!==t.granularity?Math.max(t.granularity,1):1,n=i+(t.generateBorders?2:0),o=i+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),a=n+1,s=o+1,l=t.generateBorders?-1:0,c=t.generateBorders||t.extendToNorthPole?-1:0,u=i+(t.generateBorders?1:0),h=i+(t.generateBorders||t.extendToSouthPole?1:0),d=a*s,p=n*o*6,f=a*s>65536;if(f&&"16bit"===r)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===r,g=new Int16Array(2*d);let _=0;for(let b=c;b<=h;b++)for(let r=l;r<=u;r++){let n=r/i*e.$;-1===r&&(n=-He),r===i+1&&(n=e.$+He);let o=b/i*e.$;-1===b&&(o=t.extendToNorthPole?e.bg:-He),b===i+1&&(o=t.extendToSouthPole?e.bh:e.$+He),g[_++]=n,g[_++]=o}const y=m?new Uint32Array(p):new Uint16Array(p);let v=0;for(let e=0;e<o;e++)for(let t=0;t<n;t++){const r=t+1+e*a,i=t+(e+1)*a,n=t+1+(e+1)*a;y[v++]=t+e*a,y[v++]=i,y[v++]=r,y[v++]=r,y[v++]=i,y[v++]=n}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const Je=new e.aJ({fill:new e.bi(128,2),line:new e.bi(512,0),tile:new e.bi(128,32),stencil:new e.bi(128,1),circle:3});class Ye{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return be.projectionGlobe}get vertexShaderPreludeCode(){return be.projectionMercator.vertexSource}get subdivisionGranularity(){return Je}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new We(t));const r=e.U(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,i),o=a.now();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const s=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=e.bj(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,e.bk(s))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,r,i,n){const o=("stencil"===n?Je.stencil:Je.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:o,generateBorders:r,extendToNorthPole:0===e.y&&i,extendToSouthPole:e.y===(1<<e.z)-1&&i})}_getMesh(t,r){const i=this._getMeshKey(r);if(i in this._tileMeshCache)return this._tileMeshCache[i];const n=function(t,r){const i=Xe(r,"16bit"),n=e.aK.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),o=e.aM.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new we(t.createVertexBuffer(n,Se.members),t.createIndexBuffer(o),e.aL.simpleSegment(0,0,n.length,o.length))}(t,r);return this._tileMeshCache[i]=n,n}recalculate(t){}hasTransition(){const t=a.now();let e=!1;return e=e||(t-this._errorMeasurementLastChangeTime)/1e3<.7,e=e||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,e}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const Ke=new e.r({type:new e.D(e.v.projection.type)});class Qe extends e.E{constructor(t){super(),this._transitionable=new e.t(Ke),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.F(0)),this._mercatorProjection=new Ee,this._verticalPerspectiveProjection=new Ye}get transitionState(){const t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof e.bl){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,e,r,i,n){return this.currentProjection.getMeshFromTileID(t,e,r,i,n)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function tr(t){const e=ir(t.worldSize,t.center.lat);return 2*Math.PI*e}function er(t,r,i,n,o){const a=1/(1<<o),s=r/e.$*a+n*a,l=e.bn((t/e.$*a+i*a)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,u=Math.cos(c),h=new Float64Array(3);return h[0]=Math.sin(l)*u,h[1]=Math.sin(c),h[2]=Math.cos(l)*u,h}function rr(t){return function(t,e){const r=Math.cos(e),i=new Float64Array(3);return i[0]=Math.sin(t)*r,i[1]=Math.sin(e),i[2]=Math.cos(t)*r,i}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function ir(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function nr(t){const r=Math.asin(t[1])/Math.PI*180,i=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(i>1e-6){const n=t[0]/i,o=Math.acos(t[2]/i),a=(n>0?o:-o)/Math.PI*180;return new e.S(e.aN(a,-180,180),r)}return new e.S(0,r)}function or(t){return Math.cos(t*Math.PI/180)}function ar(t,r){const i=or(t),n=or(r);return e.aj(n/i)}function sr(t,r){const i=t.rotate(r.bearingInRadians),n=r.zoom+ar(r.center.lat,0),o=e.bj(1/or(r.center.lat),1/or(Math.min(Math.abs(r.center.lat),60)),e.bm(n,7,3,0,1)),a=360/tr({worldSize:r.worldSize,center:{lat:r.center.lat}});return new e.S(r.center.lng-i.x*a*o,e.ag(r.center.lat+i.y*a,-e.ah,e.ah))}function lr(t){const e=.5*t,r=Math.sin(e),i=Math.cos(e);return Math.log(r+i)-Math.log(i-r)}function cr(t,r,i,n){const o=t.lat+i*n;if(Math.abs(i)>1){const a=(Math.sign(t.lat+i)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,s=Math.abs(t.lat+i)*Math.PI/180,l=lr(a+n*(s-a)),c=lr(a),u=lr(s);return new e.S(t.lng+r*((l-c)/(u-c)),o)}return new e.S(t.lng+r*n,o)}class ur{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,e,r,i){const n=`${t.z}_${t.x}_${t.y}_${(null==i?void 0:i.terrain)?"t":""}`,o=this._cache.get(n);if(o)return o;const a=this._cachePrevious.get(n);if(a)return this._cache.set(n,a),a;const s=this._boundingVolumeFactory(t,e,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}class hr{constructor(t,e,r,i){this.min=r,this.max=i,this.points=t,this.planes=e}static fromAabb(t,e){const r=[];for(let i=0;i<8;i++)r.push([1&~i?t[0]:e[0],1==(i>>1&1)?e[1]:t[1],1==(i>>2&1)?e[2]:t[2]]);return new hr(r,[[-1,0,0,e[0]],[1,0,0,-t[0]],[0,-1,0,e[1]],[0,1,0,-t[1]],[0,0,-1,e[2]],[0,0,1,-t[2]]],t,e)}static fromCenterSizeAngles(t,r,i){const n=e.bq([],i[0],i[1],i[2]),o=e.br([],[r[0],0,0],n),a=e.br([],[0,r[1],0],n),s=e.br([],[0,0,r[2]],n),l=[...t],c=[...t];for(let e=0;e<8;e++)for(let r=0;r<3;r++){const i=t[r]+o[r]*(1&~e?-1:1)+a[r]*(1==(e>>1&1)?1:-1)+s[r]*(1==(e>>2&1)?1:-1);l[r]=Math.min(l[r],i),c[r]=Math.max(c[r],i)}const u=[];for(let h=0;h<8;h++){const r=[...t];e.aR(r,r,e.aQ([],o,1&~h?-1:1)),e.aR(r,r,e.aQ([],a,1==(h>>1&1)?1:-1)),e.aR(r,r,e.aQ([],s,1==(h>>2&1)?1:-1)),u.push(r)}return new hr(u,[[...o,-e.aW(o,u[0])],[...a,-e.aW(a,u[0])],[...s,-e.aW(s,u[0])],[-o[0],-o[1],-o[2],-e.aW(o,u[7])],[-a[0],-a[1],-a[2],-e.aW(a,u[7])],[-s[0],-s[1],-s[2],-e.aW(s,u[7])]],l,c)}intersectsFrustum(t){let e=!0;const r=this.points.length,i=this.planes.length,n=t.planes.length,o=t.points.length;for(let a=0;a<n;a++){const i=t.planes[a];let n=0;for(let t=0;t<r;t++){const e=this.points[t];i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]>=0&&n++}if(0===n)return 0;n<r&&(e=!1)}if(e)return 2;for(let a=0;a<i;a++){const e=this.planes[a];let r=0;for(let i=0;i<o;i++){const n=t.points[i];e[0]*n[0]+e[1]*n[1]+e[2]*n[2]+e[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(t){const e=this.points.length;let r=0;for(let i=0;i<e;i++){const e=this.points[i];t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0&&r++}return r===e?2:0===r?0:1}}function dr(t,e,r){const i=t-e;return i<0?-i:Math.max(0,i-r)}function pr(t,e,r,i,n){const o=t-r;let a;return a=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(a,dr(e,i,n))}class fr{constructor(){this._boundingVolumeCache=new ur(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,e,r,i){const n=1<<r.z,o=1/n,a=r.x/n,s=r.y/n;let l=2;return l=Math.min(l,pr(t,e,a,s,o)),l=Math.min(l,pr(t,e,a+.5,-s-o,o)),l=Math.min(l,pr(t,e,a+.5,2-s-o,o)),l}getWrap(t,e,r){const i=1<<e.z,n=1/i,o=e.x/i,a=dr(t.x,o,n),s=dr(t.x,o-1,n),l=dr(t.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(t,e){return _t(t,e)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,e,r,i){return this._boundingVolumeCache.getTileBoundingVolume(t,e,r,i)}_computeTileBoundingVolume(t,r,i,n){var o,a;let s=i,l=i;if(null==n?void 0:n.terrain){const c=new e.Z(t.z,r,t.z,t.x,t.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:i,l=null!==(a=u.maxElevation)&&void 0!==a?a:i}if(s/=e.bt,l/=e.bt,s+=1,l+=1,t.z<=0)return hr.fromAabb([-l,-l,-l],[l,l,l]);if(1===t.z)return hr.fromAabb([0===t.x?-l:0,0===t.y?0:-l,-l],[0===t.x?0:l,0===t.y?l:0,l]);{const r=[er(0,0,t.x,t.y,t.z),er(e.$,0,t.x,t.y,t.z),er(e.$,e.$,t.x,t.y,t.z),er(0,e.$,t.x,t.y,t.z)],i=[];for(const t of r)i.push(e.aQ([],t,l));if(l!==s)for(const t of r)i.push(e.aQ([],t,s));0===t.y&&i.push([0,1,0]),t.y===(1<<t.z)-1&&i.push([0,-1,0]);const n=[1,1,1],o=[-1,-1,-1];for(const t of i)for(let e=0;e<3;e++)n[e]=Math.min(n[e],t[e]),o[e]=Math.max(o[e],t[e]);const a=er(e.$/2,e.$/2,t.x,t.y,t.z),c=e.aV([],[0,1,0],a);e.aU(c,c);const u=e.aV([],a,c);e.aU(u,u);const h=e.aV([],r[2],r[1]);e.aU(h,h);const d=e.aV([],r[0],r[3]);e.aU(d,d),i.push(e.aQ([],a,l)),t.y>=(1<<t.z)/2&&i.push(e.aQ([],er(e.$/2,0,t.x,t.y,t.z),l)),t.y<(1<<t.z)/2&&i.push(e.aQ([],er(e.$/2,e.$,t.x,t.y,t.z),l));const p=mr(a,i),f=mr(u,i),m=[-a[0],-a[1],-a[2],p.max],g=[a[0],a[1],a[2],-p.min],_=[-u[0],-u[1],-u[2],f.max],y=[u[0],u[1],u[2],-f.min],v=[...h,0],b=[...d,0],x=[];return 0===t.y?x.push(e.bs(b,v,m),e.bs(b,v,g)):x.push(e.bs(_,v,m),e.bs(_,v,g),e.bs(_,b,m),e.bs(_,b,g)),t.y===(1<<t.z)-1?x.push(e.bs(b,v,m),e.bs(b,v,g)):x.push(e.bs(y,v,m),e.bs(y,v,g),e.bs(y,b,m),e.bs(y,b,g)),new hr(x,[m,g,_,y,v,b],n,o)}}}function mr(t,r){let i=1/0,n=-1/0;for(const o of r){const r=e.aW(t,o);i=Math.min(i,r),n=Math.max(n,r)}return{min:i,max:n}}class gr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(){this._cachedClippingPlane=e.bu(),this._projectionMatrix=e.b8(),this._globeViewProjMatrix32f=e.b7(),this._globeViewProjMatrixNoCorrection=e.b8(),this._globeViewProjMatrixNoCorrectionInverted=e.b8(),this._globeProjMatrixInverted=e.b8(),this._cameraPosition=e.bo(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Ae({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._coveringTilesDetailsProvider=new fr}clone(){const t=new gr;return t.apply(this),t}apply(t,e){this._globeLatitudeErrorCorrectionRadians=e||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=e.bo();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:e,applyGlobeMatrix:r}=t,i=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const r=this.pitchInRadians,i=this.cameraToCenterDistance/t,n=Math.sin(r)*i,o=Math.cos(r)*i+1,a=1/Math.sqrt(n*n+o*o)*1;let s=-n,l=o;const c=Math.sqrt(s*s+l*l);s/=c,l/=c;const u=[0,s,l];e.bv(u,u,[0,0,0],-this.bearingInRadians),e.bw(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),e.bx(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/e.aY(u);return e.aQ(u,u,h),[...u,-a*h]}isLocationOccluded(t){return!this.isSurfacePointVisible(rr(t))}transformLightDirection(t){const r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),o=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],a=[o[2],0,-o[0]],s=[0,0,0];e.aV(s,a,o),e.aU(a,a),e.aU(s,s);const l=[0,0,0];return e.aU(l,[a[0]*t[0]+s[0]*t[1]+o[0]*t[2],a[1]*t[0]+s[1]*t[1]+o[1]*t[2],a[2]*t[0]+s[2]*t[1]+o[2]*t[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){const n=function(t,r,i){const n=1/(1<<i.z);return new e.a0(t/e.$*n+i.x*n,r/e.$*n+i.y*n)}(t,r,i.canonical),o=(a=n.y,[e.bn(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);var a;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(t,r,i,n){const o=i.canonical,a=er(t,r,o.x,o.y,o.z),s=1+(n?n(t,r):0)/e.bt,l=[a[0]*s,a[1]*s,a[2]*s,1];e.av(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,u=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new e.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=ir(this.worldSize,this.center.lat),r=e.b9(),i=e.b9();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),e.b3(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;r[8]=2*-n.x/this._helper._width,r[9]=2*n.y/this._helper._height,this._projectionMatrix=e.b4(r),this._globeProjMatrixInverted=e.b9(),e.ap(this._globeProjMatrixInverted,r),e.M(r,r,[0,0,-this.cameraToCenterDistance]),e.b5(r,r,this.rollInRadians),e.b6(r,r,-this.pitchInRadians),e.b5(r,r,this.bearingInRadians),e.M(r,r,[0,0,-t]);const o=e.bo();o[0]=t,o[1]=t,o[2]=t,e.b6(i,r,this.center.lat*Math.PI/180),e.by(i,i,-this.center.lng*Math.PI/180),e.N(i,i,o),this._globeViewProjMatrixNoCorrection=i,e.b6(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),e.by(r,r,-this.center.lng*Math.PI/180),e.N(r,r,o),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=e.b9(),e.ap(this._globeViewProjMatrixNoCorrectionInverted,i);const a=e.bo();this._cameraPosition=e.bo(),this._cameraPosition[2]=this.cameraToCenterDistance/t,e.bv(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),e.bw(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),e.bv(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),e.aR(this._cameraPosition,this._cameraPosition,[0,0,1]),e.bw(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),e.bx(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const s=e.b4(this._globeViewProjMatrixNoCorrectionInverted);e.N(s,s,[1,1,-1]),this._cachedFrustum=Le.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){e.w("calculateFogMatrix is not supported on globe projection.");const r=e.b9();return e.af(r),r}getVisibleUnwrappedCoordinates(t){return[new e.b1(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&e.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixNoCorrection)return 1;const i=rr(t);e.aQ(i,i,1+r/e.bt);const n=e.bu();return e.av(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){const t=.5*this.width,r=.5*this.height,i=[new e.P(0,0),new e.P(t,0),new e.P(this.width,0),new e.P(this.width,r),new e.P(this.width,this.height),new e.P(t,this.height),new e.P(0,this.height),new e.P(0,r)],n=[];for(const e of i)n.push(this.unprojectScreenPoint(e));let o=0,a=0,s=0,l=0;const c=this.center;for(const h of n){const t=e.bz(c.lng,h.lng),r=e.bz(c.lat,h.lat);t<a&&(a=t),t>o&&(o=t),r<l&&(l=r),r>s&&(s=r)}const u=[c.lng+a,c.lat+l,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new G(u)}getConstrained(t,r){const i=e.ag(t.lat,-e.ah,e.ah),n=e.ag(+r,this.minZoom+ar(0,i),this.maxZoom);return{center:new e.S(t.lng,i),zoom:n}}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}setLocationAtPoint(t,r){const i=rr(this.unprojectScreenPoint(r)),n=rr(t),o=e.bo();e.bA(o);const a=e.bo();e.bx(a,i,o,-this.center.lng*Math.PI/180),e.bw(a,a,o,this.center.lat*Math.PI/180);const s=n[0]*n[0]+n[2]*n[2],l=a[0]*a[0];if(s<l)return;const c=Math.sqrt(s-l),u=-c,h=e.bB(n[0],n[2],a[0],c),d=e.bB(n[0],n[2],a[0],u),p=e.bo();e.bx(p,n,o,-h);const f=e.bB(p[1],p[2],a[1],a[2]),m=e.bo();e.bx(m,n,o,-d);const g=e.bB(m[1],m[2],a[1],a[2]),_=.5*Math.PI,y=f>=-_&&f<=_,v=g>=-_&&g<=_;let b,x;if(y&&v){const t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;e.bC(h,t)+e.bC(f,r)<e.bC(d,t)+e.bC(g,r)?(b=h,x=f):(b=d,x=g)}else if(y)b=h,x=f;else{if(!v)return;b=d,x=g}const w=b/Math.PI*180,S=x/Math.PI*180,T=this.center.lat;this.setCenter(new e.S(w,e.ag(S,-90,90))),this.setZoom(this.zoom+ar(T,this.center.lat))}locationToScreenPoint(t,r){const i=rr(t);if(r){const n=r.getElevationForLngLatZoom(t,this._helper._tileZoom);e.aQ(i,i,1+n/e.bt)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){const r=e.bu();return e.av(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new e.P((.5*r[0]+.5)*this.width,(.5*-r[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){const e=r.pointCoordinate(t);if(e)return e}return e.a0.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var r;return null===(r=this.screenPointToMercatorCoordinate(t,e))||void 0===r?void 0:r.toLngLat()}isPointOnMapSurface(t,e){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,i)}getRayDirectionFromPixel(t){const r=e.bu();r[0]=t.x/this.width*2-1,r[1]=-1*(t.y/this.height*2-1),r[2]=1,r[3]=1,e.av(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];const i=e.bo();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];const n=e.bo();return e.aU(n,i),n}isSurfacePointVisible(t){const e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const r=e.bu();return e.av(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(t,r){const i=e.aW(t,r),n=e.bo(),o=e.bo();e.aQ(o,r,i),e.aT(n,t,o);const a=1-e.aW(n,n);if(a<0)return null;const s=e.aW(t,t)-1,l=-i+(i<0?1:-1)*Math.sqrt(a),c=s/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(t){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(r,i);if(n){const t=e.bo();e.aR(t,r,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);const o=e.bo();return e.aU(o,t),nr(o)}const o=this._cachedClippingPlane,a=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],s=-e.b0(o,r)/a,l=e.bo();if(s>0)e.aR(l,r,[i[0]*s,i[1]*s,i[2]*s]);else{const t=e.bo();e.aR(t,r,[2*i[0],2*i[1],2*i[2]]);const n=e.b0(this._cachedClippingPlane,t);e.aT(l,t,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(t){const r=e.bo();return r[0]=t[0]*-t[3],r[1]=t[1]*-t[3],r[2]=t[2]*-t[3],{center:r,radius:Math.sqrt(1-t[3]*t[3])}}(o);return nr(function(t,r,i){const n=e.bo();e.aT(n,i,t);const o=e.bo();return e.bp(o,t,n,r/e.a_(n)),o}(c.center,c.radius,l))}getMatrixForModel(t,r){const i=e.S.convert(t),n=1/e.bt,o=e.b8();return e.by(o,o,i.lng/180*Math.PI),e.b6(o,o,-i.lat/180*Math.PI),e.M(o,o,[0,0,1+r/e.bt]),e.b6(o,o,.5*Math.PI),e.N(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const r=this.getProjectionData({overscaledTileID:new e.Z(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}}class _r{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,r=!0){this._helper.resize(t,e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Ae({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._globeness=1,this._mercatorTransform=new De,this._verticalPerspectiveTransform=new gr}clone(){const t=new _r;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const e=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:e.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return e.bj(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return e.bj(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,i){const n=this._mercatorTransform.getPitchedTextCorrection(t,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return e.bj(n,o,this._globeness)}projectTileCoordinates(t,e,r,i){return this.currentTransform.projectTileCoordinates(t,e,r,i)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,e){return this.currentTransform.getConstrained(t,e)}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){const e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;const r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=e.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class yr{get useGlobeControls(){return!0}handlePanInertia(t,r){const i=sr(t,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new e.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){const i=t.around,n=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);const o=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);const a=r.zoom-o;if(0===a)return;const s=e.bz(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=e.bz(r.center.lat,n.lat),u=r.getRayDirectionFromPixel(i),h=r.cameraPosition,d=-1*e.aW(h,u),p=e.bo();e.aR(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=e.aY(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=ir(r.worldSize,r.center.lat)/Math.min(r.width,r.height),_=e.bm(g,.9,.5,1,.25),y=(1-e.ae(-a))*Math.min(m,_),v=r.center.lat,b=r.zoom,x=new e.S(r.center.lng+l*y,e.ag(r.center.lat+c*y,-e.ah,e.ah));r.setLocationAtPoint(n,i);const w=r.center,S=e.bm(Math.abs(s),45,85,0,1),T=e.bm(g,.75,.35,0,1),I=Math.pow(Math.max(S,T),.25),E=e.bz(w.lng,x.lng),P=e.bz(w.lat,x.lat);r.setCenter(new e.S(w.lng+E*I,w.lat+P*I).wrap()),r.setZoom(b+ar(v,r.center.lat))}handleMapControlsPan(t,e,r){if(!t.panDelta)return;const i=e.center.lat,n=e.zoom;e.setCenter(sr(t.panDelta,e).wrap()),e.setZoom(n+ar(i,e.center.lat))}cameraForBoxAndBearing(t,r,i,n,o){const a=Fe(t,r,i,n,o),s=r.left/o.width*2-1,l=(o.width-r.right)/o.width*2-1,c=r.top/o.height*-2+1,u=(o.height-r.bottom)/o.height*-2+1,h=e.bz(i.getWest(),i.getEast())<0,d=h?i.getEast():i.getWest(),p=h?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=d+.5*e.bz(d,p),_=f+.5*e.bz(f,m),y=o.clone();y.setCenter(a.center),y.setBearing(a.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(a.zoom);const v=y.modelViewProjectionMatrix,b=[rr(i.getNorthWest()),rr(i.getNorthEast()),rr(i.getSouthWest()),rr(i.getSouthEast()),rr(new e.S(p,_)),rr(new e.S(d,_)),rr(new e.S(g,f)),rr(new e.S(g,m))],x=rr(a.center);let w=Number.POSITIVE_INFINITY;for(const e of b)s<0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(e,x,v,"x",s))),l>0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(e,x,v,"x",l))),c>0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(e,x,v,"y",c))),u<0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(e,x,v,"y",u)));if(Number.isFinite(w)&&0!==w)return a.zoom=y.zoom+e.aj(w),a;ze()}handleJumpToCenterZoom(t,r){const i=t.center.lat,n=t.getConstrained(r.center?e.S.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());const o=void 0!==r.zoom?+r.zoom:t.zoom+ar(i,n.lat);t.zoom!==o&&t.setZoom(o)}handleEaseTo(t,r){const i=t.zoom,n=t.center,o=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,c=!t.isPaddingEqual(r.padding);let u=!1;const h=r.center?e.S.convert(r.center):n,d=t.getConstrained(h,i).center;ke(t,d);const p=t.clone();p.setCenter(d),p.setZoom(l?+r.zoom:i+ar(n.lat,h.lat)),p.setBearing(r.bearing);const f=new e.P(e.ag(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),e.ag(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));p.setLocationAtPoint(d,f);const m=(r.offset&&r.offsetAsPoint.mag())>0?p.center:d,g=l?+r.zoom:i+ar(n.lat,m.lat),_=i+ar(n.lat,0),y=g+ar(m.lat,0),v=e.bz(n.lng,m.lng),b=e.bz(n.lat,m.lat),x=e.ae(y-_);return u=g!==i,{easeFunc:i=>{if(e.bd(a,s)||Oe({startEulerAngles:a,endEulerAngles:s,tr:t,k:i,useSlerp:a.roll!=s.roll}),c&&t.interpolatePadding(o,r.padding,i),r.around)e.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{const e=y>_?Math.min(2,x):Math.max(.5,x),r=Math.pow(e,1-i),o=cr(n,v,b,i*r);t.setCenter(o.wrap())}if(u){const r=e.C.number(_,y,i)+ar(0,t.center.lat);t.setZoom(r)}},isZooming:u,elevationCenter:m}}handleFlyTo(t,r){const i=void 0!==r.zoom,n=t.center,o=t.zoom,a=t.padding,s=!t.isPaddingEqual(r.padding),l=t.getConstrained(e.S.convert(r.center||r.locationAtOffset),o).center,c=i?+r.zoom:t.zoom+ar(t.center.lat,l.lat),u=t.clone();u.setCenter(l),u.setZoom(c),u.setBearing(r.bearing);const h=new e.P(e.ag(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),e.ag(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));u.setLocationAtPoint(l,h);const d=u.center;ke(t,d);const p=function(t,r,i){const n=rr(r),o=rr(i),a=e.aW(n,o),s=Math.acos(a),l=tr(t);return s/(2*Math.PI)*l}(t,n,d),f=o+ar(n.lat,0),m=c+ar(d.lat,0),g=e.ae(m-f);let _;if("number"==typeof r.minZoom){const i=+r.minZoom+ar(d.lat,0),n=Math.min(i,f,m)+ar(0,d.lat),o=t.getConstrained(d,n).zoom+ar(d.lat,0);_=e.ae(o-f)}const y=e.bz(n.lng,d.lng),v=e.bz(n.lat,d.lat);return{easeFunc:(i,o,l,u)=>{const h=cr(n,y,v,l);s&&t.interpolatePadding(a,r.padding,i);const p=1===i?d:h;t.setCenter(p.wrap());const m=f+e.aj(o);t.setZoom(1===i?c:m+ar(0,p.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:_,pixelPathLength:p}}static solveVectorScale(t,e,r,i,n){const o="x"===i?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],a=[r[3],r[7],r[11],r[15]],s=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],l=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],u=e[0]*a[0]+e[1]*a[1]+e[2]*a[2];return c+n*l===s+n*u||a[3]*(s-c)+o[3]*(u-l)+s*u==c*l?null:(c+o[3]-n*u-n*a[3])/(c-s-n*u+n*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}}class vr{constructor(t){this._globe=t,this._mercatorCameraHelper=new Ne,this._verticalPerspectiveCameraHelper=new yr}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,r){this.currentHelper.handleMapControlsPan(t,e,r)}cameraForBoxAndBearing(t,e,r,i,n){return this.currentHelper.cameraForBoxAndBearing(t,e,r,i,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}const br=(t,r)=>e.y(t,r&&r.filter((t=>"source.canvas"!==t.identifier))),xr=e.bD();class wr extends e.E{constructor(t,r={}){super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||this.sourceCaches[t].reload()}},this.map=t,this.dispatcher=new O(z(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler("GI",((t,e)=>this.getImages(t,e))),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new S(t._requestManager,r.localIdeographFontFamily),this.lineAtlas=new C(256,512),this.crossTileSymbolIndex=new ye,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.bE,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",e.bF()),it().on(tt,this._rtlPluginLoaded),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const r=e.getSource();if(r&&r.vectorLayerIds)for(const i in this._layers){const t=this._layers[i];t.source===r.id&&this._validateLayer(t)}}))}setGlobalStateProperty(t,r){var i,n,o;this._checkLoaded();const a=null===r?null!==(o=null===(n=null===(i=this.stylesheet.state)||void 0===i?void 0:i[t])||void 0===n?void 0:n.default)&&void 0!==o?o:null:r;if(e.bG(a,this._globalState[t]))return this;this._globalState[t]=a;const s=this._findGlobalStateAffectedSources([t]);for(const e in this.sourceCaches)s.has(e)&&(this._reloadSource(e),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const r=[];for(const n in t)!e.bG(this._globalState[n],t[n].default)&&(r.push(n),this._globalState[n]=t[n].default);const i=this._findGlobalStateAffectedSources(r);for(const e in this.sourceCaches)i.has(e)&&(this._reloadSource(e),this._changed=!0)}_findGlobalStateAffectedSources(t){if(0===t.length)return new Set;const e=new Set;for(const r in this._layers){const i=this._layers[r],n=i.getLayoutAffectingGlobalStateRefs();for(const r of t)n.has(r)&&e.add(i.source)}return e}loadURL(t,r={},i){this.fire(new e.l("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.validate;const n=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;e.j(n,this._loadStyleRequest).then((t=>{this._loadStyleRequest=null,this._load(t.data,r,i)})).catch((t=>{this._loadStyleRequest=null,t&&!o.signal.aborted&&this.fire(new e.k(t))}))}loadJSON(t,r={},i){this.fire(new e.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,i)})).catch((()=>{}))}loadEmpty(){this.fire(new e.l("dataloading",{dataType:"style"})),this._load(xr,{validate:!1})}_load(t,r,i){var n,o,a;const s=r.transformStyle?r.transformStyle(i,t):t;if(!r.validate||!br(this,e.z(s))){this._loaded=!0,this.stylesheet=s;for(const t in s.sources)this.addSource(t,s.sources[t],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new E(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new k(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.setGlobalState(null!==(a=this.stylesheet.state)&&void 0!==a?a:null),this.fire(new e.l("data",{dataType:"style"})),this.fire(new e.l("style.load"))}}_createLayers(){const t=e.bH(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const r of t){const t=e.bI(r);t.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=t}}_loadSprite(t,r=!1,i=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,r,i,n){return e._(this,void 0,void 0,(function*(){const o=g(t),s=i>1?"@2x":"",l={},c={};for(const{id:t,url:i}of o){const o=r.transformRequest(_(i,s,".json"),"SpriteJSON");l[t]=e.j(o,n);const a=r.transformRequest(_(i,s,".png"),"SpriteImage");c[t]=f.getImage(a,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,r){return e._(this,void 0,void 0,(function*(){const e={};for(const i in t){e[i]={};const n=a.getImageCanvasContext((yield r[i]).data),o=(yield t[i]).data;for(const t in o){const{width:r,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=o[t];e[i][t]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:r,height:a,x:s,y:l,context:n}}}}return e}))}(l,c)}))}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const i=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in t))):[];for(const t of i)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const n in t[e]){const i="default"===e?n:`${e}:${n}`;this._spritesImagesIds[e].push(i),i in this.imageManager.images?this.imageManager.updateImage(i,t[e][n],!1):this.imageManager.addImage(i,t[e][n]),r&&(this._changedImages[i]=!0)}}})).catch((t=>{this._spriteRequest=null,n=t,this.fire(new e.k(n))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"})),i&&i(n)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}_validateLayer(t){const r=this.sourceCaches[t.source];if(!r)return;const i=t.sourceLayer;if(!i)return;const n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new e.k(new Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,r=!1){const i=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?e.bJ(i):i);const n=[];for(const o of t)if(i[o]){const t=r?e.bJ(i[o]):i[o];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const r of e){const e=this._layers[r];"custom"!==e.type&&(t[r]=e.serialize())}return t}hasTransitions(){var t,e,r;if(null===(t=this.light)||void 0===t?void 0:t.hasTransition())return!0;if(null===(e=this.sky)||void 0===e?void 0:e.hasTransition())return!0;if(null===(r=this.projection)||void 0===r?void 0:r.hasTransition())return!0;for(const i in this.sourceCaches)if(this.sourceCaches[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const r=this._changed;if(r){const e=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(e.length||r.length)&&this._updateWorkerLayers(e,r);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const i in this._updatedPaintProps)this._layers[i].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const i={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];i[e]=t.used,t.used=!1}for(const e of this._order){const r=this._layers[e];r.recalculate(t,this._availableImages),!r.isHidden(t.zoom)&&r.source&&(this.sourceCaches[r.source].used=!0)}for(const n in i){const t=this.sourceCaches[n];!!i[n]!=!!t.used&&t.fire(new e.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:n}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new e.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){var i;this._checkLoaded();const n=this.serialize();if(t=r.transformStyle?r.transformStyle(n,t):t,(null===(i=r.validate)||void 0===i||i)&&br(this,e.z(t)))return!1;(t=e.bJ(t)).layers=e.bH(t.layers);const o=e.bK(n,t),a=this._getOperationsToPerform(o);if(a.unimplemented.length>0)throw new Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(const e of a.operations)e();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],r=[];for(const i of t)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":e.push((()=>this.addLayer.apply(this,i.args)));break;case"removeLayer":e.push((()=>this.removeLayer.apply(this,i.args)));break;case"setPaintProperty":e.push((()=>this.setPaintProperty.apply(this,i.args)));break;case"setLayoutProperty":e.push((()=>this.setLayoutProperty.apply(this,i.args)));break;case"setFilter":e.push((()=>this.setFilter.apply(this,i.args)));break;case"addSource":e.push((()=>this.addSource.apply(this,i.args)));break;case"removeSource":e.push((()=>this.removeSource.apply(this,i.args)));break;case"setLayerZoomRange":e.push((()=>this.setLayerZoomRange.apply(this,i.args)));break;case"setLight":e.push((()=>this.setLight.apply(this,i.args)));break;case"setGeoJSONSourceData":e.push((()=>this.setGeoJSONSourceData.apply(this,i.args)));break;case"setGlyphs":e.push((()=>this.setGlyphs.apply(this,i.args)));break;case"setSprite":e.push((()=>this.setSprite.apply(this,i.args)));break;case"setTerrain":e.push((()=>this.map.setTerrain.apply(this,i.args)));break;case"setSky":e.push((()=>this.setSky.apply(this,i.args)));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":e.push((()=>this.setGlobalState.apply(this,i.args)));break;case"setTransition":e.push((()=>{}));break;default:r.push(i.command)}return{operations:e,unimplemented:r}}addImage(t,r){if(this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,r),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,i={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(e.z.source,`sources.${t}`,r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const n=this.sourceCaches[t]=new bt(t,r,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t}))),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.k(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));const r=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],r.fire(new e.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const r=this.sourceCaches[t].getSource();if("geojson"!==r.type)throw new Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,r,i={}){this._checkLoaded();const n=t.id;if(this.getLayer(n))return void this.fire(new e.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===t.type){if(br(this,e.bL(t)))return;o=e.bI(t)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(n,t.source),t=e.bJ(t),t=e.e(t,{source:n})),this._validate(e.z.layer,`layers.${n}`,t,{arrayIndex:-1},i))return;o=e.bI(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new e.k(new Error(`Cannot add layer "${n}" before non-existing layer "${r}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;const i=this._order.indexOf(t);this._order.splice(i,1);const n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new e.k(new Error(`Cannot move layer "${t}" before non-existing layer "${r}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const r=this._layers[t];if(!r)return void this.fire(new e.k(new Error(`Cannot remove non-existing layer "${t}".`)));r.setEventedParent(null);const i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=r,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],r.onRemove&&r.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,i){this._checkLoaded();const n=this.getLayer(t);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new e.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,i={}){this._checkLoaded();const n=this.getLayer(t);if(n){if(!e.bG(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(e.z.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(e.bJ(r)),this._updateLayer(n)))}else this.fire(new e.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.bJ(this.getLayer(t).filter)}setLayoutProperty(t,r,i,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bG(o.getLayoutProperty(r),i)||(o.setLayoutProperty(r,i,n),this._updateLayer(o)):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){const i=this.getLayer(t);if(i)return i.getLayoutProperty(r);this.fire(new e.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,i,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bG(o.getPaintProperty(r),i)||(o.setPaintProperty(r,i,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,r){this._checkLoaded();const i=t.source,n=t.sourceLayer,o=this.sourceCaches[i];if(void 0===o)return void this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&n?this.fire(new e.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,t.id,r)):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,r){this._checkLoaded();const i=t.source,n=this.sourceCaches[i];if(void 0===n)return void this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?t.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,t.id,r):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const r=t.source,i=t.sourceLayer,n=this.sourceCaches[r];if(void 0!==n)return"vector"!==n.getSource().type||i?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,t.id)):void this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.k(new Error(`The source '${r}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.bM(this.sourceCaches,(t=>t.serialize())),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return e.bN({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:t,layers:r,terrain:i},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,r={},i=[];for(let o=this._order.length-1;o>=0;o--){const n=this._order[o];if(e(n)){r[n]=o;for(const e of t){const t=e[n];if(t)for(const e of t)i.push(e)}}}i.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=i.length-1;t>=0;t--){const e=i[t].feature;if(r[e.layer.id]<o)break;n.push(e),i.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(t,r,i){r&&r.filter&&this._validate(e.z.filter,"queryRenderedFeatures.filter",r.filter,null,r);const n={};if(r&&r.layers){if(!(Array.isArray(r.layers)||r.layers instanceof Set))return this.fire(new e.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const t of r.layers){const r=this._layers[t];if(!r)return this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}const o=[];r.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,l=Object.assign(Object.assign({},r),{layers:s});for(const e in this.sourceCaches)r.layers&&!n[e]||o.push(B(this.sourceCaches[e],this._layers,a,t,l,i,this.map.terrain?(t,e,r)=>this.map.terrain.getElevation(t,e,r):void 0));return this.placement&&o.push(function(t,e,r,i,n,o,a){const s={},l=o.queryRenderedSymbols(i),c=[];for(const u of Object.keys(l).map(Number))c.push(a[u]);c.sort(j);for(const u of c){const r=u.featureIndex.lookupSymbolFeatures(l[u.bucketInstanceId],e,u.bucketIndex,u.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in r){const e=s[t]=s[t]||[],i=r[t];i.sort(((t,e)=>{const r=u.featureSortOrder;if(r){const i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of i)e.push(t)}}return function(t,e,r){for(const i in t)for(const n of t[i])U(n,r[e[i].source]);return t}(s,t,r)}(this._layers,a,this.sourceCaches,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,r){r&&r.filter&&this._validate(e.z.filter,"querySourceFeatures.filter",r.filter,null,r);const i=this.sourceCaches[t];return i?function(t,e){const r=t.getRenderableIds().map((e=>t.getTileByID(e))),i=[],n={};for(let o=0;o<r.length;o++){const t=r[o],a=t.tileID.canonical.key;n[a]||(n[a]=!0,t.querySourceFeatures(i,e))}return i}(i,r):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();const i=this.light.getLight();let n=!1;for(const a in t)if(!e.bG(t[a],i[a])){n=!0;break}if(!n)return;const o={now:a.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(o)}getProjection(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.sky}setSky(t,r={}){this._checkLoaded();const i=this.getSky();let n=!1;if(!t&&!i)return;if(t&&!i)n=!0;else if(!t&&i)n=!0;else for(const a in t)if(!e.bG(t[a],i[a])){n=!0;break}if(!n)return;const o={now:a.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,r),this.sky.updateTransitions(o)}_setProjectionInternal(t){const r=function(t){if(Array.isArray(t)){const e=new Qe({type:t});return{projection:e,transform:new _r,cameraHelper:new vr(e)}}switch(t){case"mercator":return{projection:new Ee,transform:new De,cameraHelper:new Ne};case"globe":{const t=new Qe({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new _r,cameraHelper:new vr(t)}}case"vertical-perspective":return{projection:new Ye,transform:new gr,cameraHelper:new yr};default:return e.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new Ee,transform:new De,cameraHelper:new Ne}}}(t);this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper);for(const e in this.sourceCaches)this.sourceCaches[e].reload()}_validate(t,r,i,n,o={}){return(!o||!1!==o.validate)&&br(this,t.call(e.z,e.e({key:r,style:this.serialize(),value:i,styleSpec:e.v},n)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),it().off(tt,this._rtlPluginLoaded);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this.sourceCaches){const t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,e,r,i,n=!1){let o=!1,s=!1;const l={};for(const a of this._order){const e=this._layers[a];if("symbol"!==e.type)continue;if(!l[e.source]){const t=this.sourceCaches[e.source];l[e.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(e,l[e.source],t.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.now(),t.zoom))&&(this.pauseablePlacement=new pe(t,this.map.terrain,this._order,n,e,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const a of this._order){const t=this._layers[a];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,r){return e._(this,void 0,void 0,(function*(){const t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[r.source];return e&&e.setDependencies(r.tileID.key,r.type,r.icons),t}))}getGlyphs(t,r){return e._(this,void 0,void 0,(function*(){const t=yield this.glyphManager.getGlyphs(r.stacks),e=this.sourceCaches[r.source];return e&&e.setDependencies(r.tileID.key,r.type,[""]),t}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}){this._checkLoaded(),t&&this._validate(e.z.glyphs,"glyphs",t,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,r,i={},n){this._checkLoaded();const o=[{id:t,url:r}],a=[...g(this.stylesheet.sprite),...o];this._validate(e.z.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(t){this._checkLoaded();const r=g(this.stylesheet.sprite);if(r.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;r.splice(r.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}else this.fire(new e.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return g(this.stylesheet.sprite)}setSprite(t,r={},i){this._checkLoaded(),t&&this._validate(e.z.sprite,"sprite",t,null,r)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}}var Sr=e.aI([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Tr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,r,i,n,o,a,s,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==i.length;for(let u=0;!c&&u<i.length;u++)this.boundPaintVertexBuffers[u]!==i[u]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,r,i,n,o,a,s,l):(t.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(t,e,r,i,n,o,a,s){const l=t.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,e.enableAttributes(u,t);for(const h of r)h.enableAttributes(u,t);o&&o.enableAttributes(u,t),a&&a.enableAttributes(u,t),s&&s.enableAttributes(u,t),e.bind(),e.setVertexAttribPointers(u,t,n);for(const h of r)h.bind(),h.setVertexAttribPointers(u,t,n);o&&(o.bind(),o.setVertexAttribPointers(u,t,n)),i&&i.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,t,n)),s&&(s.bind(),s.setVertexAttribPointers(u,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Ir=(t,r,i,n,o)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):e.be.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):e.be.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Er={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Pr(t){const e=[];for(let r=0;r<t.length;r++){if(null===t[r])continue;const i=t[r].split(" ");e.push(i.pop())}return e}class kr{constructor(t,r,i,n,o,a,s,l,c=[]){const u=t.gl;this.program=u.createProgram();const h=Pr(r.staticAttributes),d=i?i.getBinderAttributes():[],p=h.concat(d),f=be.prelude.staticUniforms?Pr(be.prelude.staticUniforms):[],m=s.staticUniforms?Pr(s.staticUniforms):[],g=r.staticUniforms?Pr(r.staticUniforms):[],_=i?i.getBinderUniforms():[],y=f.concat(m).concat(g).concat(_),v=[];for(const e of y)v.indexOf(e)<0&&v.push(e);const b=i?i.defines():[];Ze(u)&&b.unshift("#version 300 es"),o&&b.push("#define OVERDRAW_INSPECTOR;"),a&&b.push("#define TERRAIN3D;"),l&&b.push(l),c&&b.push(...c);let x=b.concat(be.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join("\n"),w=b.concat(be.prelude.vertexSource,s.vertexSource,r.vertexSource).join("\n");Ze(u)||(x=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),w=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const S=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,x),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S);const T=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,w),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T),this.attributes={};const I={};this.numAttributes=p.length;for(let e=0;e<this.numAttributes;e++)p[e]&&(u.bindAttribLocation(this.program,e,p[e]),this.attributes[p[e]]=e);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(T),u.deleteShader(S);for(let e=0;e<v.length;e++){const t=v[e];if(t&&!I[t]){const e=u.getUniformLocation(this.program,t);e&&(I[t]=e)}}this.fixedUniforms=n(t,I),this.terrainUniforms=((t,r)=>({u_depth:new e.bO(t,r.u_depth),u_terrain:new e.bO(t,r.u_terrain),u_terrain_dim:new e.bf(t,r.u_terrain_dim),u_terrain_matrix:new e.bQ(t,r.u_terrain_matrix),u_terrain_unpack:new e.bR(t,r.u_terrain_unpack),u_terrain_exaggeration:new e.bf(t,r.u_terrain_exaggeration)}))(t,I),this.projectionUniforms=((t,r)=>({u_projection_matrix:new e.bQ(t,r.u_projection_matrix),u_projection_tile_mercator_coords:new e.bR(t,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new e.bR(t,r.u_projection_clipping_plane),u_projection_transition:new e.bf(t,r.u_projection_transition),u_projection_fallback_matrix:new e.bQ(t,r.u_projection_fallback_matrix)}))(t,I),this.binderUniforms=i?i.getUniforms(t,I):[]}draw(t,e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(n),t.setCullFace(o),s){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(s[t])}if(l)for(const x in l)this.projectionUniforms[Er[x]].set(l[x]);if(a)for(const x in this.fixedUniforms)this.fixedUniforms[x].set(a[x]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:f});let b=0;switch(e){case v.LINES:b=2;break;case v.TRIANGLES:b=3;break;case v.LINE_STRIP:b=1}for(const x of d.get()){const r=x.vaos||(x.vaos={});(r[c]||(r[c]=new Tr)).bind(t,this,u,m?m.getPaintVertexBuffers():[],h,x.vertexOffset,g,_,y),v.drawElements(e,x.primitiveLength*b,v.UNSIGNED_SHORT,x.primitiveOffset*b*2)}}}function Cr(t,r,i){const n=1/e.aB(i,1,r.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,r.transform.tileZoom)/o,s=a*(i.tileID.canonical.x+i.tileID.wrap*o),l=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Ar=(t,r,i,n)=>{const o=t.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=e.bU();"viewport"===o.properties.get("anchor")&&e.bV(l,t.transform.bearingInRadians),e.bW(s,s,l);const c=t.transform.transformLightDirection(s),u=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+r,u_opacity:i,u_fill_translate:n}},Mr=(t,r,i,n,o,a,s)=>e.e(Ar(t,r,i,n),Cr(a,t,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),Rr=(t,r,i,n)=>e.e(Cr(r,t,i),{u_fill_translate:n}),Lr=(t,e)=>({u_world:t,u_fill_translate:e}),Dr=(t,r,i,n,o)=>e.e(Rr(t,r,i,o),{u_world:n}),zr=(t,r,i,n,o)=>{const a=t.transform;let s,l,c=0;if("map"===i.paint.get("circle-pitch-alignment")){const t=e.aB(r,1,a.zoom);s=!0,l=[t,t],c=t/(e.$*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*o}else s=!1,l=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},Or=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),Fr=t=>({u_viewport_size:[t.width,t.height]}),Nr=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),Br=(t,r,i,n)=>{const o=e.aB(t,1,r)/(e.$*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:e.aB(t,1,r),u_intensity:i,u_globe_extrude_scale:o}},jr=(t,r,i,n)=>{const o=e.L();e.bX(o,0,t.width,t.height,0,0,1);const a=t.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},Ur=(t,e,r)=>{const i=r.paint.get("hillshade-accent-color");let n;switch(r.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0}const o=r.getIlluminationProperties();for(let a=0;a<o.directionRadians.length;a++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(o.directionRadians[a]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:Gr(0,e.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:i,u_method:n,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},Vr=(t,r)=>{const i=r.stride,n=e.L();return e.bX(n,0,e.$,-e.$,0,0,1),e.M(n,n,[0,-e.$,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}};function Gr(t,r){const i=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.a0(0,n/i).toLngLat().lat,new e.a0(0,(n+1)/i).toLngLat().lat]}const $r=(t,e,r=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),qr=(t,r,i,n)=>{const o=t.transform;return{u_translation:Jr(t,r,i),u_ratio:n/e.aB(r,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Zr=(t,r,i,n,o)=>e.e(qr(t,r,i,n),{u_image:0,u_image_height:o}),Wr=(t,r,i,n,o)=>{const a=t.transform,s=Xr(r,a);return{u_translation:Jr(t,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/e.aB(r,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Hr=(t,r,i,n,o,a)=>{const s=t.lineAtlas,l=Xr(r,t.transform),c="round"===i.layout.get("line-cap"),u=s.getDash(o.from,c),h=s.getDash(o.to,c),d=u.width*a.fromScale,p=h.width*a.toScale;return e.e(qr(t,r,i,n),{u_patternscale_a:[l/d,-u.height/2],u_patternscale_b:[l/p,-h.height/2],u_sdfgamma:s.width/(256*Math.min(d,p)*t.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:a.t})};function Xr(t,r){return 1/e.aB(t,1,r.tileZoom)}function Jr(t,r,i){return e.aC(t.transform,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Yr=(t,e,r,i,n)=>{return{u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Kr(i.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,a};function Kr(t){t*=Math.PI/180;const e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}const Qr=(t,e,r,i,n,o,a,s,l,c,u,h,d)=>{const p=a.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:p.width/p.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+i,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d}},ti=(t,r,i,n,o,a,s,l,c,u,h,d,p,f)=>{const m=s.transform;return e.e(Qr(t,r,i,n,o,a,s,l,c,u,h,d,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},ei=(t,r,i,n,o,a,s,l,c,u,h,d,p)=>e.e(ti(t,r,i,n,o,a,s,l,c,u,!0,h,0,p),{u_texsize_icon:d,u_texture_icon:1}),ri=(t,e)=>({u_opacity:t,u_color:e}),ii=(t,r,i,n,o)=>e.e(function(t,r,i,n){const o=i.imageManager.getPattern(t.from.toString()),a=i.imageManager.getPattern(t.to.toString()),{width:s,height:l}=i.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,i.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),d=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:r.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/e.aB(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(i,o,r,n),{u_opacity:t}),ni=(t,e)=>{},oi={fillExtrusion:(t,r)=>({u_lightpos:new e.bS(t,r.u_lightpos),u_lightpos_globe:new e.bS(t,r.u_lightpos_globe),u_lightintensity:new e.bf(t,r.u_lightintensity),u_lightcolor:new e.bS(t,r.u_lightcolor),u_vertical_gradient:new e.bf(t,r.u_vertical_gradient),u_opacity:new e.bf(t,r.u_opacity),u_fill_translate:new e.bT(t,r.u_fill_translate)}),fillExtrusionPattern:(t,r)=>({u_lightpos:new e.bS(t,r.u_lightpos),u_lightpos_globe:new e.bS(t,r.u_lightpos_globe),u_lightintensity:new e.bf(t,r.u_lightintensity),u_lightcolor:new e.bS(t,r.u_lightcolor),u_vertical_gradient:new e.bf(t,r.u_vertical_gradient),u_height_factor:new e.bf(t,r.u_height_factor),u_opacity:new e.bf(t,r.u_opacity),u_fill_translate:new e.bT(t,r.u_fill_translate),u_image:new e.bO(t,r.u_image),u_texsize:new e.bT(t,r.u_texsize),u_pixel_coord_upper:new e.bT(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bT(t,r.u_pixel_coord_lower),u_scale:new e.bS(t,r.u_scale),u_fade:new e.bf(t,r.u_fade)}),fill:(t,r)=>({u_fill_translate:new e.bT(t,r.u_fill_translate)}),fillPattern:(t,r)=>({u_image:new e.bO(t,r.u_image),u_texsize:new e.bT(t,r.u_texsize),u_pixel_coord_upper:new e.bT(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bT(t,r.u_pixel_coord_lower),u_scale:new e.bS(t,r.u_scale),u_fade:new e.bf(t,r.u_fade),u_fill_translate:new e.bT(t,r.u_fill_translate)}),fillOutline:(t,r)=>({u_world:new e.bT(t,r.u_world),u_fill_translate:new e.bT(t,r.u_fill_translate)}),fillOutlinePattern:(t,r)=>({u_world:new e.bT(t,r.u_world),u_image:new e.bO(t,r.u_image),u_texsize:new e.bT(t,r.u_texsize),u_pixel_coord_upper:new e.bT(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bT(t,r.u_pixel_coord_lower),u_scale:new e.bS(t,r.u_scale),u_fade:new e.bf(t,r.u_fade),u_fill_translate:new e.bT(t,r.u_fill_translate)}),circle:(t,r)=>({u_camera_to_center_distance:new e.bf(t,r.u_camera_to_center_distance),u_scale_with_map:new e.bO(t,r.u_scale_with_map),u_pitch_with_map:new e.bO(t,r.u_pitch_with_map),u_extrude_scale:new e.bT(t,r.u_extrude_scale),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_globe_extrude_scale:new e.bf(t,r.u_globe_extrude_scale),u_translate:new e.bT(t,r.u_translate)}),collisionBox:(t,r)=>({u_pixel_extrude_scale:new e.bT(t,r.u_pixel_extrude_scale)}),collisionCircle:(t,r)=>({u_viewport_size:new e.bT(t,r.u_viewport_size)}),debug:(t,r)=>({u_color:new e.bP(t,r.u_color),u_overlay:new e.bO(t,r.u_overlay),u_overlay_scale:new e.bf(t,r.u_overlay_scale)}),depth:ni,clippingMask:ni,heatmap:(t,r)=>({u_extrude_scale:new e.bf(t,r.u_extrude_scale),u_intensity:new e.bf(t,r.u_intensity),u_globe_extrude_scale:new e.bf(t,r.u_globe_extrude_scale)}),heatmapTexture:(t,r)=>({u_matrix:new e.bQ(t,r.u_matrix),u_world:new e.bT(t,r.u_world),u_image:new e.bO(t,r.u_image),u_color_ramp:new e.bO(t,r.u_color_ramp),u_opacity:new e.bf(t,r.u_opacity)}),hillshade:(t,r)=>({u_image:new e.bO(t,r.u_image),u_latrange:new e.bT(t,r.u_latrange),u_exaggeration:new e.bf(t,r.u_exaggeration),u_altitudes:new e.bZ(t,r.u_altitudes),u_azimuths:new e.bZ(t,r.u_azimuths),u_accent:new e.bP(t,r.u_accent),u_method:new e.bO(t,r.u_method),u_shadows:new e.bY(t,r.u_shadows),u_highlights:new e.bY(t,r.u_highlights)}),hillshadePrepare:(t,r)=>({u_matrix:new e.bQ(t,r.u_matrix),u_image:new e.bO(t,r.u_image),u_dimension:new e.bT(t,r.u_dimension),u_zoom:new e.bf(t,r.u_zoom),u_unpack:new e.bR(t,r.u_unpack)}),colorRelief:(t,r)=>({u_image:new e.bO(t,r.u_image),u_unpack:new e.bR(t,r.u_unpack),u_dimension:new e.bT(t,r.u_dimension),u_elevation_stops:new e.bO(t,r.u_elevation_stops),u_color_stops:new e.bO(t,r.u_color_stops),u_color_ramp_size:new e.bO(t,r.u_color_ramp_size),u_opacity:new e.bf(t,r.u_opacity)}),line:(t,r)=>({u_translation:new e.bT(t,r.u_translation),u_ratio:new e.bf(t,r.u_ratio),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.bT(t,r.u_units_to_pixels)}),lineGradient:(t,r)=>({u_translation:new e.bT(t,r.u_translation),u_ratio:new e.bf(t,r.u_ratio),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.bT(t,r.u_units_to_pixels),u_image:new e.bO(t,r.u_image),u_image_height:new e.bf(t,r.u_image_height)}),linePattern:(t,r)=>({u_translation:new e.bT(t,r.u_translation),u_texsize:new e.bT(t,r.u_texsize),u_ratio:new e.bf(t,r.u_ratio),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_image:new e.bO(t,r.u_image),u_units_to_pixels:new e.bT(t,r.u_units_to_pixels),u_scale:new e.bS(t,r.u_scale),u_fade:new e.bf(t,r.u_fade)}),lineSDF:(t,r)=>({u_translation:new e.bT(t,r.u_translation),u_ratio:new e.bf(t,r.u_ratio),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.bT(t,r.u_units_to_pixels),u_patternscale_a:new e.bT(t,r.u_patternscale_a),u_patternscale_b:new e.bT(t,r.u_patternscale_b),u_sdfgamma:new e.bf(t,r.u_sdfgamma),u_image:new e.bO(t,r.u_image),u_tex_y_a:new e.bf(t,r.u_tex_y_a),u_tex_y_b:new e.bf(t,r.u_tex_y_b),u_mix:new e.bf(t,r.u_mix)}),raster:(t,r)=>({u_tl_parent:new e.bT(t,r.u_tl_parent),u_scale_parent:new e.bf(t,r.u_scale_parent),u_buffer_scale:new e.bf(t,r.u_buffer_scale),u_fade_t:new e.bf(t,r.u_fade_t),u_opacity:new e.bf(t,r.u_opacity),u_image0:new e.bO(t,r.u_image0),u_image1:new e.bO(t,r.u_image1),u_brightness_low:new e.bf(t,r.u_brightness_low),u_brightness_high:new e.bf(t,r.u_brightness_high),u_saturation_factor:new e.bf(t,r.u_saturation_factor),u_contrast_factor:new e.bf(t,r.u_contrast_factor),u_spin_weights:new e.bS(t,r.u_spin_weights),u_coords_top:new e.bR(t,r.u_coords_top),u_coords_bottom:new e.bR(t,r.u_coords_bottom)}),symbolIcon:(t,r)=>({u_is_size_zoom_constant:new e.bO(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bO(t,r.u_is_size_feature_constant),u_size_t:new e.bf(t,r.u_size_t),u_size:new e.bf(t,r.u_size),u_camera_to_center_distance:new e.bf(t,r.u_camera_to_center_distance),u_pitch:new e.bf(t,r.u_pitch),u_rotate_symbol:new e.bO(t,r.u_rotate_symbol),u_aspect_ratio:new e.bf(t,r.u_aspect_ratio),u_fade_change:new e.bf(t,r.u_fade_change),u_label_plane_matrix:new e.bQ(t,r.u_label_plane_matrix),u_coord_matrix:new e.bQ(t,r.u_coord_matrix),u_is_text:new e.bO(t,r.u_is_text),u_pitch_with_map:new e.bO(t,r.u_pitch_with_map),u_is_along_line:new e.bO(t,r.u_is_along_line),u_is_variable_anchor:new e.bO(t,r.u_is_variable_anchor),u_texsize:new e.bT(t,r.u_texsize),u_texture:new e.bO(t,r.u_texture),u_translation:new e.bT(t,r.u_translation),u_pitched_scale:new e.bf(t,r.u_pitched_scale)}),symbolSDF:(t,r)=>({u_is_size_zoom_constant:new e.bO(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bO(t,r.u_is_size_feature_constant),u_size_t:new e.bf(t,r.u_size_t),u_size:new e.bf(t,r.u_size),u_camera_to_center_distance:new e.bf(t,r.u_camera_to_center_distance),u_pitch:new e.bf(t,r.u_pitch),u_rotate_symbol:new e.bO(t,r.u_rotate_symbol),u_aspect_ratio:new e.bf(t,r.u_aspect_ratio),u_fade_change:new e.bf(t,r.u_fade_change),u_label_plane_matrix:new e.bQ(t,r.u_label_plane_matrix),u_coord_matrix:new e.bQ(t,r.u_coord_matrix),u_is_text:new e.bO(t,r.u_is_text),u_pitch_with_map:new e.bO(t,r.u_pitch_with_map),u_is_along_line:new e.bO(t,r.u_is_along_line),u_is_variable_anchor:new e.bO(t,r.u_is_variable_anchor),u_texsize:new e.bT(t,r.u_texsize),u_texture:new e.bO(t,r.u_texture),u_gamma_scale:new e.bf(t,r.u_gamma_scale),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_is_halo:new e.bO(t,r.u_is_halo),u_translation:new e.bT(t,r.u_translation),u_pitched_scale:new e.bf(t,r.u_pitched_scale)}),symbolTextAndIcon:(t,r)=>({u_is_size_zoom_constant:new e.bO(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bO(t,r.u_is_size_feature_constant),u_size_t:new e.bf(t,r.u_size_t),u_size:new e.bf(t,r.u_size),u_camera_to_center_distance:new e.bf(t,r.u_camera_to_center_distance),u_pitch:new e.bf(t,r.u_pitch),u_rotate_symbol:new e.bO(t,r.u_rotate_symbol),u_aspect_ratio:new e.bf(t,r.u_aspect_ratio),u_fade_change:new e.bf(t,r.u_fade_change),u_label_plane_matrix:new e.bQ(t,r.u_label_plane_matrix),u_coord_matrix:new e.bQ(t,r.u_coord_matrix),u_is_text:new e.bO(t,r.u_is_text),u_pitch_with_map:new e.bO(t,r.u_pitch_with_map),u_is_along_line:new e.bO(t,r.u_is_along_line),u_is_variable_anchor:new e.bO(t,r.u_is_variable_anchor),u_texsize:new e.bT(t,r.u_texsize),u_texsize_icon:new e.bT(t,r.u_texsize_icon),u_texture:new e.bO(t,r.u_texture),u_texture_icon:new e.bO(t,r.u_texture_icon),u_gamma_scale:new e.bf(t,r.u_gamma_scale),u_device_pixel_ratio:new e.bf(t,r.u_device_pixel_ratio),u_is_halo:new e.bO(t,r.u_is_halo),u_translation:new e.bT(t,r.u_translation),u_pitched_scale:new e.bf(t,r.u_pitched_scale)}),background:(t,r)=>({u_opacity:new e.bf(t,r.u_opacity),u_color:new e.bP(t,r.u_color)}),backgroundPattern:(t,r)=>({u_opacity:new e.bf(t,r.u_opacity),u_image:new e.bO(t,r.u_image),u_pattern_tl_a:new e.bT(t,r.u_pattern_tl_a),u_pattern_br_a:new e.bT(t,r.u_pattern_br_a),u_pattern_tl_b:new e.bT(t,r.u_pattern_tl_b),u_pattern_br_b:new e.bT(t,r.u_pattern_br_b),u_texsize:new e.bT(t,r.u_texsize),u_mix:new e.bf(t,r.u_mix),u_pattern_size_a:new e.bT(t,r.u_pattern_size_a),u_pattern_size_b:new e.bT(t,r.u_pattern_size_b),u_scale_a:new e.bf(t,r.u_scale_a),u_scale_b:new e.bf(t,r.u_scale_b),u_pixel_coord_upper:new e.bT(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bT(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new e.bf(t,r.u_tile_units_to_pixels)}),terrain:(t,r)=>({u_texture:new e.bO(t,r.u_texture),u_ele_delta:new e.bf(t,r.u_ele_delta),u_fog_matrix:new e.bQ(t,r.u_fog_matrix),u_fog_color:new e.bP(t,r.u_fog_color),u_fog_ground_blend:new e.bf(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.bf(t,r.u_fog_ground_blend_opacity),u_horizon_color:new e.bP(t,r.u_horizon_color),u_horizon_fog_blend:new e.bf(t,r.u_horizon_fog_blend),u_is_globe_mode:new e.bf(t,r.u_is_globe_mode)}),terrainDepth:(t,r)=>({u_ele_delta:new e.bf(t,r.u_ele_delta)}),terrainCoords:(t,r)=>({u_texture:new e.bO(t,r.u_texture),u_terrain_coords_id:new e.bf(t,r.u_terrain_coords_id),u_ele_delta:new e.bf(t,r.u_ele_delta)}),projectionErrorMeasurement:(t,r)=>({u_input:new e.bf(t,r.u_input),u_output_expected:new e.bf(t,r.u_output_expected)}),atmosphere:(t,r)=>({u_sun_pos:new e.bS(t,r.u_sun_pos),u_atmosphere_blend:new e.bf(t,r.u_atmosphere_blend),u_globe_position:new e.bS(t,r.u_globe_position),u_globe_radius:new e.bf(t,r.u_globe_radius),u_inv_proj_matrix:new e.bQ(t,r.u_inv_proj_matrix)}),sky:(t,r)=>({u_sky_color:new e.bP(t,r.u_sky_color),u_horizon_color:new e.bP(t,r.u_horizon_color),u_horizon:new e.bT(t,r.u_horizon),u_horizon_normal:new e.bT(t,r.u_horizon_normal),u_sky_horizon_blend:new e.bf(t,r.u_sky_horizon_blend),u_sky_blend:new e.bf(t,r.u_sky_blend)})};class ai{constructor(t,e,r){this.context=t;const i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const si={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class li{constructor(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let r=0;r<this.attributes.length;r++){const i=e.attributes[this.attributes[r].name];void 0!==i&&t.enableVertexAttribArray(i)}}setVertexAttribPointers(t,e,r){for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[si[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ci{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ui extends ci{getDefault(){return e.be.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class hi extends ci{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class di extends ci{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class pi extends ci{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class fi extends ci{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class mi extends ci{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class gi extends ci{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class _i extends ci{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class yi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class vi extends ci{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class bi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class xi extends ci{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class wi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class Si extends ci{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ti extends ci{getDefault(){return e.be.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ii extends ci{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ei extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class Pi extends ci{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ki extends ci{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Ci extends ci{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ai extends ci{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Mi extends ci{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ri extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Li extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Di extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class zi extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Oi extends ci{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Fi extends ci{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const r=this.gl;Ze(r)?r.bindVertexArray(t):null===(e=r.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ni extends ci{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Bi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ji extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ui extends ci{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class Vi extends Ui{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Gi extends Ui{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class $i extends Ui{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const qi="Framebuffer is not complete";class Zi{constructor(t,e,r,i,n){this.context=t,this.width=e,this.height=r;const o=t.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new Vi(t,a),i)this.depthAttachment=n?new $i(t,a):new Gi(t,a);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(qi)}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Wi{constructor(t){var e,r;if(this.gl=t,this.clearColor=new ui(this),this.clearDepth=new hi(this),this.clearStencil=new di(this),this.colorMask=new pi(this),this.depthMask=new fi(this),this.stencilMask=new mi(this),this.stencilFunc=new gi(this),this.stencilOp=new _i(this),this.stencilTest=new yi(this),this.depthRange=new vi(this),this.depthTest=new bi(this),this.depthFunc=new xi(this),this.blend=new wi(this),this.blendFunc=new Si(this),this.blendColor=new Ti(this),this.blendEquation=new Ii(this),this.cullFace=new Ei(this),this.cullFaceSide=new Pi(this),this.frontFace=new ki(this),this.program=new Ci(this),this.activeTexture=new Ai(this),this.viewport=new Mi(this),this.bindFramebuffer=new Ri(this),this.bindRenderbuffer=new Li(this),this.bindTexture=new Di(this),this.bindVertexBuffer=new zi(this),this.bindElementBuffer=new Oi(this),this.bindVertexArray=new Fi(this),this.pixelStoreUnpack=new Ni(this),this.pixelStoreUnpackPremultiplyAlpha=new Bi(this),this.pixelStoreUnpackFlipY=new ji(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ze(t)){this.HALF_FLOAT=t.HALF_FLOAT;const i=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!==(r=t.RGB16F)&&void 0!==r?r:null==i?void 0:i.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new ai(this,t,e)}createVertexBuffer(t,e,r){return new li(this,t,e,r)}createRenderbuffer(t,e,r){const i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,r,i){return new Zi(this,t,e,r,i)}clear({color:t,depth:e,stencil:r}){const i=this.gl;let n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==r&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bG(t.blendFunction,Be.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Ze(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return Ze(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Hi;function Xi(t,r,i,n,o){const a=t.context,s=t.transform,l=a.gl,c=t.useProgram("collisionBox"),u=[];let h=0,d=0;for(let e=0;e<n.length;e++){const p=n[e],f=r.getTile(p).getBucket(i);if(!f)continue;const m=o?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;g.length>0&&(u.push({circleArray:g,circleOffset:d,coord:p}),h+=g.length/4,d=h),m&&c.draw(a,l.LINES,Ve.disabled,$e.disabled,t.colorModeForRenderPass(),Ue.disabled,Or(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),s.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,t.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!u.length)return;const p=t.useProgram("collisionCircle"),f=new e.b_;f.resize(4*h),f._trim();let m=0;for(const e of u)for(let t=0;t<e.circleArray.length/4;t++){const r=4*t,i=e.circleArray[r+0],n=e.circleArray[r+1],o=e.circleArray[r+2],a=e.circleArray[r+3];f.emplace(m++,i,n,o,a,0),f.emplace(m++,i,n,o,a,1),f.emplace(m++,i,n,o,a,2),f.emplace(m++,i,n,o,a,3)}(!Hi||Hi.length<2*h)&&(Hi=function(t){const r=2*t,i=new e.c0;i.resize(r),i._trim();for(let e=0;e<r;e++){const t=6*e;i.uint16[t+0]=4*e+0,i.uint16[t+1]=4*e+1,i.uint16[t+2]=4*e+2,i.uint16[t+3]=4*e+2,i.uint16[t+4]=4*e+3,i.uint16[t+5]=4*e+0}return i}(h));const g=a.createIndexBuffer(Hi,!0),_=a.createVertexBuffer(f,e.b$.members,!0);for(const y of u){const r=Fr(t.transform);p.draw(a,l.TRIANGLES,Ve.disabled,$e.disabled,t.colorModeForRenderPass(),Ue.disabled,r,t.style.map.terrain&&t.style.map.terrain.getTerrainData(y.coord),null,i.id,_,g,e.aL.simpleSegment(0,2*y.circleOffset,y.circleArray.length,y.circleArray.length/2),null,t.transform.zoom,null,null,null)}_.destroy(),g.destroy()}const Ji=e.af(new Float32Array(16));function Yi(t,r,i,n,o,a){const{horizontalAlign:s,verticalAlign:l}=e.aG(t);return new e.P((-(s-.5)*r/o+n[0])*a,(-(l-.5)*i/o+n[1])*a)}function Ki(t,r,i,n,o,a){const s=r.tileAnchorPoint.add(new e.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let t=n.mult(a);i||(t=t.rotate(-o));const e=s.add(t);return Ct(e.x,e.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(i){const e=Nt(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(t),i=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(n.rotate(i))}return t.add(n)}function Qi(t,r,i,n,o,a,s,l,c,u,h,d){const p=t.text.placedSymbolArray,f=t.text.dynamicLayoutVertexArray,m=t.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){const m=p.get(_),y=m.hidden||!m.crossTileID||t.allowVerticalPlacement&&!m.placedOrientation?null:n[m.crossTileID];if(y){const n=new e.P(m.anchorX,m.anchorY),p={getElevation:d,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,pitchWithMap:i,transform:o,tileAnchorPoint:n,translation:u,unwrappedTileID:h},_=i?jt(n.x,n.y,p):Nt(n.x,n.y,p),v=At(o.cameraToCenterDistance,_.signedDistanceFromCamera);let b=e.ao(t.textSizeData,l,m)*v/e.aA;i&&(b*=t.tilePixelRatio/s);const{width:x,height:w,anchor:S,textOffset:T,textBoxScale:I}=y,E=Yi(S,x,w,T,I,b),P=o.getPitchedTextCorrection(n.x+u[0],n.y+u[1],h),k=Ki(_.point,p,r,E,-o.bearingInRadians,P),C=t.allowVerticalPlacement&&m.placedOrientation===e.an.vertical?Math.PI/2:0;for(let t=0;t<m.numGlyphs;t++)e.au(f,k,C);c&&m.associatedIconIndex>=0&&(g[m.associatedIconIndex]={shiftedAnchor:k,angle:C})}else qt(m.numGlyphs,f)}if(c){m.clear();const r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){const i=r.get(t);if(i.hidden)qt(i.numGlyphs,m);else{const r=g[t];if(r)for(let t=0;t<i.numGlyphs;t++)e.au(m,r.shiftedAnchor,r.angle);else qt(i.numGlyphs,m)}}t.icon.dynamicLayoutVertexBuffer.updateData(m)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function tn(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function en(t,r,i,n,o,a,s,l,c,u,h,d,p){const f=t.context,m=f.gl,g=t.transform,_="map"===l,y="map"===c,v="viewport"!==l&&"point"!==i.layout.get("symbol-placement"),b=_&&!y&&!v,x=!i.layout.get("symbol-sort-key").isConstant();let w=!1;const S=t.getDepthModeForSublayer(0,Ve.ReadOnly),T=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=[],E=g.getCircleRadiusCorrection();for(const P of n){const n=r.getTile(P),l=n.getBucket(i);if(!l)continue;const c=o?l.text:l.icon;if(!c||!c.segments.get().length||!c.hasVisibleVertices)continue;const h=c.programConfigurations.get(i.id),d=o||l.sdfIcons,f=o?l.textSizeData:l.iconSizeData,S=y||0!==g.pitch,k=t.useProgram(tn(d,o,l),h),C=e.am(f,g.zoom),A=t.style.map.terrain&&t.style.map.terrain.getTerrainData(P);let M,R,L,D,z=[0,0],O=null;if(o)R=n.glyphAtlasTexture,L=m.LINEAR,M=n.glyphAtlasTexture.size,l.iconsInText&&(z=n.imageAtlasTexture.size,O=n.imageAtlasTexture,D=S||t.options.rotating||t.options.zooming||"composite"===f.kind||"camera"===f.kind?m.LINEAR:m.NEAREST);else{const e=1!==i.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;R=n.imageAtlasTexture,L=d||t.options.rotating||t.options.zooming||e||S?m.LINEAR:m.NEAREST,M=n.imageAtlasTexture.size}const F=e.aB(n,1,t.transform.zoom),N=Et(_,t.transform,F),B=e.L();e.ap(B,N);const j=Pt(y,_,t.transform,F),U=e.aC(g,n,a,s),V=g.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),G=T&&l.hasTextData(),$="none"!==i.layout.get("icon-text-fit")&&G&&l.hasIconData();if(v){const e=t.style.map.terrain?(e,r)=>t.style.map.terrain.getElevation(P,e,r):null,r="map"===i.layout.get("text-rotation-alignment");Rt(l,t,o,N,B,y,u,r,P.toUnwrapped(),g.width,g.height,U,e)}const q=o&&T||$,Z=v||q?Ji:y?N:t.transform.clipSpaceToPixelsMatrix,W=d&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=d?l.iconsInText?ei(f.kind,C,b,y,v,q,t,Z,j,U,M,z,E):ti(f.kind,C,b,y,v,q,t,Z,j,U,o,M,0,E):Qr(f.kind,C,b,y,v,q,t,Z,j,U,o,M,E);const X={program:k,buffers:c,uniformValues:H,projectionData:V,atlasTexture:R,atlasTextureIcon:O,atlasInterpolation:L,atlasInterpolationIcon:D,isSDF:d,hasHalo:W};if(x&&l.canOverlap){w=!0;const t=c.segments.get();for(const r of t)I.push({segments:new e.aL([r]),sortKey:r.sortKey,state:X,terrainData:A})}else I.push({segments:c.segments,sortKey:0,state:X,terrainData:A})}w&&I.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of I){const r=e.state;if(f.activeTexture.set(m.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,m.CLAMP_TO_EDGE),r.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),r.isSDF){const n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,rn(r.buffers,e.segments,i,t,r.program,S,h,d,n,r.projectionData,e.terrainData)),n.u_is_halo=0}rn(r.buffers,e.segments,i,t,r.program,S,h,d,r.uniformValues,r.projectionData,e.terrainData)}}function rn(t,e,r,i,n,o,a,s,l,c,u){const h=i.context;n.draw(h,h.gl.TRIANGLES,o,a,s,Ue.backCCW,l,u,c,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,i.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function nn(t,r,i,n,o){const a=t.context,s=a.gl,l=$e.disabled,c=new Be([s.ONE,s.ONE],e.be.transparent,[!0,!0,!0,!0]),u=r.getBucket(i);if(!u)return;const h=n.key;let d=i.heatmapFbos.get(h);d||(d=an(a,r.tileSize,r.tileSize),i.heatmapFbos.set(h,d)),a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,r.tileSize,r.tileSize]),a.clear({color:e.be.transparent});const p=u.programConfigurations.get(i.id),f=t.useProgram("heatmap",p,!o),m=t.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);f.draw(a,s.TRIANGLES,Ve.disabled,l,c,Ue.disabled,Br(r,t.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,t.transform.zoom,p)}function on(t,e,r,i,n){const o=t.context,a=o.gl,s=t.transform;o.setColorMode(t.colorModeForRenderPass());const l=sn(o,e),c=r.key,u=e.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=s.getProjectionData({overscaledTileID:r,applyTerrainMatrix:n,applyGlobeMatrix:!i});t.useProgram("heatmapTexture").draw(o,a.TRIANGLES,Ve.disabled,$e.disabled,t.colorModeForRenderPass(),Ue.disabled,jr(t,e,0,1),null,h,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,s.zoom),u.destroy(),e.heatmapFbos.delete(c)}function an(t,e,r){var i,n;const o=t.gl,a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const s=null!==(i=t.HALF_FLOAT)&&void 0!==i?i:o.UNSIGNED_BYTE,l=null!==(n=t.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e,r,0,o.RGBA,s,null);const c=t.createFramebuffer(e,r,!1,!1);return c.colorAttachment.set(a),c}function sn(t,r){return r.colorRampTexture||(r.colorRampTexture=new e.T(t,r.colorRamp,t.gl.RGBA)),r.colorRampTexture}function ln(t,e,r,i,n){if(!r||!i||!i.imageAtlas)return;const o=i.imageAtlas.patternPositions;let a=o[r.to.toString()],s=o[r.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){const t=n.getPaintProperty(e);a=o[t],s=o[t]}a&&s&&t.setConstantPatternPositions(a,s)}function cn(t,r,i,n,o,a,s,l){const c=t.context.gl,u="fill-pattern",h=i.paint.get(u),d=h&&h.constantOr(1),p=i.getCrossfadeParameters();let f,m,g,_,y;const v=t.transform,b=i.paint.get("fill-translate"),x=i.paint.get("fill-translate-anchor");s?(m=d&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=d?"fillPattern":"fill",f=c.TRIANGLES);const w=h.constantOr(null);for(const S of n){const n=r.getTile(S);if(d&&!n.patternsLoaded())continue;const h=n.getBucket(i);if(!h)continue;const T=h.programConfigurations.get(i.id),I=t.useProgram(m,T),E=t.style.map.terrain&&t.style.map.terrain.getTerrainData(S);d&&(t.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),T.updatePaintBuffers(p)),ln(T,u,w,n,i);const P=v.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),k=e.aC(v,n,b,x);if(s){_=h.indexBuffer2,y=h.segments2;const e=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&d?Dr(t,p,n,e,k):Lr(e,k)}else _=h.indexBuffer,y=h.segments,g=d?Rr(t,p,n,k):{u_fill_translate:k};const C=t.stencilModeForClipping(S);I.draw(t.context,f,o,C,a,Ue.backCCW,g,E,P,i.id,h.layoutVertexBuffer,_,y,i.paint,t.transform.zoom,T)}}function un(t,r,i,n,o,a,s,l){const c=t.context,u=c.gl,h="fill-extrusion-pattern",d=i.paint.get(h),p=d.constantOr(1),f=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=d.constantOr(null),_=t.transform;for(const y of n){const n=r.getTile(y),d=n.getBucket(i);if(!d)continue;const v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(y),b=d.programConfigurations.get(i.id),x=t.useProgram(p?"fillExtrusionPattern":"fillExtrusion",b);p&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),b.updatePaintBuffers(f));const w=_.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});ln(b,h,g,n,i);const S=e.aC(_,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),T=i.paint.get("fill-extrusion-vertical-gradient"),I=p?Mr(t,T,m,S,y,f,n):Ar(t,T,m,S);x.draw(c,c.gl.TRIANGLES,o,a,s,Ue.backCCW,I,v,w,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,t.transform.zoom,b,t.style.map.terrain&&d.centroidVertexBuffer)}}function hn(t,e,r,i,n,o,a,s,l){var c;const u=t.style.projection,h=t.context,d=t.transform,p=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],m=t.useProgram("hillshade",null,!1,f),g=!t.options.moving;for(const _ of i){const i=e.getTile(_),f=i.fbo;if(!f)continue;const y=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),v=null===(c=t.style.map.terrain)||void 0===c?void 0:c.getTerrainData(_);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,f.colorAttachment.get());const b=d.getProjectionData({overscaledTileID:_,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,p.TRIANGLES,o,n[_.overscaledZ],a,Ue.backCCW,Ur(t,i,r),v,b,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function dn(t,r,i,n,o,a,s,l,c){var u;const h=t.style.projection,d=t.context,p=t.transform,f=d.gl,m=t.useProgram("colorRelief"),g=!t.options.moving;let _=!0,y=0;for(const v of n){const n=r.getTile(v),b=n.dem;if(_){const t=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:e,colorTexture:r}=i.getColorRampTextures(d,t,b.getUnpackVector());d.activeTexture.set(f.TEXTURE1),e.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),_=!1,y=e.size[0]}if(!b||!b.data)continue;const x=b.stride,w=b.getPixels();if(d.activeTexture.set(f.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(x),n.demTexture){const t=n.demTexture;t.update(w,{premultiply:!1}),t.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else n.demTexture=new e.T(d,w,f.RGBA,{premultiply:!1}),n.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const S=h.getMeshFromTileID(d,v.canonical,l,!0,"raster"),T=null===(u=t.style.map.terrain)||void 0===u?void 0:u.getTerrainData(v),I=p.getProjectionData({overscaledTileID:v,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,a,o[v.overscaledZ],s,Ue.backCCW,$r(i,n.dem,y),T,I,i.id,S.vertexBuffer,S.indexBuffer,S.segments)}}const pn=[new e.P(0,0),new e.P(e.$,0),new e.P(e.$,e.$),new e.P(0,e.$)];function fn(t,e,r,i,n,o,a,s,l=!1,c=!1){const u=i[i.length-1].overscaledZ,h=t.context,d=h.gl,p=t.useProgram("raster"),f=t.transform,m=t.style.projection,g=t.colorModeForRenderPass(),_=!t.options.moving;for(const y of i){const i=t.getDepthModeForSublayer(y.overscaledZ-u,1===r.paint.get("raster-opacity")?Ve.ReadWrite:Ve.ReadOnly,d.LESS),v=e.getTile(y);v.registerFadeDuration(r.paint.get("raster-fade-duration"));const b=e.findLoadedParent(y,0),x=e.findLoadedSibling(y),w=mn(v,b||x||null,e,r,t.transform,t.style.map.terrain);let S,T;const I="nearest"===r.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),v.texture.bind(I,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1),b?(b.texture.bind(I,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),S=Math.pow(2,b.tileID.overscaledZ-v.tileID.overscaledZ),T=[v.tileID.canonical.x*S%1,v.tileID.canonical.y*S%1]):v.texture.bind(I,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),v.texture.useMipmap&&h.extTextureFilterAnisotropic&&t.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const E=t.style.map.terrain&&t.style.map.terrain.getTerrainData(y),P=f.getProjectionData({overscaledTileID:y,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),k=Yr(T||[0,0],S||1,w,r,s),C=m.getMeshFromTileID(h,y.canonical,o,a,"raster");p.draw(h,d.TRIANGLES,i,n?n[y.overscaledZ]:$e.disabled,g,l?Ue.frontCCW:Ue.backCCW,k,E,P,r.id,C.vertexBuffer,C.indexBuffer,C.segments)}}function mn(t,r,i,n,o,s){const l=n.paint.get("raster-fade-duration");if(!s&&l>0){const n=a.now(),s=(n-t.timeAdded)/l,c=r?(n-r.timeAdded)/l:-1,u=i.getSource(),h=_t(o,{tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(t.tileID.overscaledZ-h),p=d&&t.refreshedUponExpiration?1:e.ag(d?s:1-c,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const gn=new e.be(1,0,0,1),_n=new e.be(0,1,0,1),yn=new e.be(0,0,1,1),vn=new e.be(1,0,1,1),bn=new e.be(0,1,1,1);function xn(t,e,r,i){Sn(t,0,e+r/2,t.transform.width,r,i)}function wn(t,e,r,i){Sn(t,e-r/2,0,r,t.transform.height,i)}function Sn(t,e,r,i,n,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,r*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Tn(t,r,i){const n=t.context,o=n.gl,a=t.useProgram("debug"),s=Ve.disabled,l=$e.disabled,c=t.colorModeForRenderPass(),u="$debug",h=t.style.map.terrain&&t.style.map.terrain.getTerrainData(i);n.activeTexture.set(o.TEXTURE0);const d=r.getTileByID(i.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),f=r.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/t.transform.zoom)*.5;let g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const r=t.debugOverlayCanvas,i=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(t,`${g} ${p}kB`);const _=t.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,Be.alphaBlended,Ue.disabled,Nr(e.be.transparent,m),null,_,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,Ue.disabled,Nr(e.be.red),h,_,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function In(t,e,r,i){const{isRenderingGlobe:n}=i,o=t.context,a=o.gl,s=t.transform,l=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),u=t.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);for(const h of r){const r=e.getTerrainMesh(h.tileID),i=t.renderToTexture.getTexture(h),d=e.getTerrainData(h.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i.texture);const p=e.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(h.tileID.toUnwrapped()),m=Ir(p,f,t.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,a.TRIANGLES,c,$e.disabled,l,Ue.backCCW,m,d,g,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function En(t,r){if(!r.mesh){const i=new e.aK;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const n=new e.aM;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new we(t.createVertexBuffer(i,Se.members),t.createIndexBuffer(n),e.aL.simpleSegment(0,0,i.length,n.length))}return r.mesh}class Pn{constructor(t,r){this.context=new Wi(t),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.af(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=bt.maxUnderzooming+bt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ye}resize(t,e,r){if(this.width=Math.floor(t*r),this.height=Math.floor(e*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const i of this.style._order)this.style._layers[i].resize()}setup(){const t=this.context,r=new e.aK;r.emplaceBack(0,0),r.emplaceBack(e.$,0),r.emplaceBack(0,e.$),r.emplaceBack(e.$,e.$),this.tileExtentBuffer=t.createVertexBuffer(r,Se.members),this.tileExtentSegments=e.aL.simpleSegment(0,0,4,2);const i=new e.aK;i.emplaceBack(0,0),i.emplaceBack(e.$,0),i.emplaceBack(0,e.$),i.emplaceBack(e.$,e.$),this.debugBuffer=t.createVertexBuffer(i,Se.members),this.debugSegments=e.aL.simpleSegment(0,0,4,5);const n=new e.c5;n.emplaceBack(0,0,0,0),n.emplaceBack(e.$,0,e.$,0),n.emplaceBack(0,e.$,0,e.$),n.emplaceBack(e.$,e.$,e.$,e.$),this.rasterBoundsBuffer=t.createVertexBuffer(n,Sr.members),this.rasterBoundsSegments=e.aL.simpleSegment(0,0,4,2);const o=new e.aK;o.emplaceBack(0,0),o.emplaceBack(e.$,0),o.emplaceBack(0,e.$),o.emplaceBack(e.$,e.$),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(o,Se.members),this.rasterBoundsSegmentsPosOnly=e.aL.simpleSegment(0,0,4,5);const a=new e.aK;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(a,Se.members),this.viewportSegments=e.aL.simpleSegment(0,0,4,2);const s=new e.c6;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);const l=new e.aM;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new $e({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new we(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const i=e.L();e.bX(i,0,this.width,this.height,0,0,1),e.N(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);const n={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,Ve.disabled,this.stencilClearMode,Be.disabled,Ue.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();const i=this.context;i.setColorMode(Be.disabled),i.setDepthMode(Ve.disabled);const n={};for(const o of e)n[o.key]=this.nextStencilID++;this._renderTileMasks(n,e,r,!0),this._renderTileMasks(n,e,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,e,r,i){const n=this.context,o=n.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of e){const e=t[c.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),h=a.getMeshFromTileID(this.context,c.canonical,i,!0,"stencil"),d=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!r,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,Ve.disabled,new $e({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),Be.disabled,r?Ue.disabled:Ue.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const t=this.context,e=t.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=yt(i,{tileSize:i.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=r.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=i.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,e.TRIANGLES,o,$e.disabled,Be.disabled,Ue.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new $e({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new $e({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const e=this.context.gl,r=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let r=0;r<n;r++)t[r+i]=new $e({func:e.GEQUAL,mask:255},r+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,r]}return[{[i]:$e.disabled},r]}stencilConfigForOverlapTwoPass(t){const e=this.context.gl,r=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){const t={},o={};for(let r=0;r<n;r++)t[r+i]=new $e({func:e.GREATER,mask:255},n+1+r,255,e.KEEP,e.KEEP,e.REPLACE),o[r+i]=new $e({func:e.GREATER,mask:255},1+r,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[t,o,r]}return this.nextStencilID=3,[{[i]:new $e({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[i]:new $e({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},r]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const r=1/8;return new Be([t.CONSTANT_COLOR,t.ONE],new e.be(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Be.unblended:Be.alphaBlended}getDepthModeForSublayer(t,e,r){if(!this.opaquePassEnabledForLayer())return Ve.disabled;const i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ve(r||this.context.gl.LEQUAL,e,[i,i])}getDepthModeFor3D(){return new Ve(this.context.gl.LEQUAL,Ve.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){var i,n;this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.now()),this.imageManager.beginFrame();const o=this.style._order,s=this.style.sourceCaches,l={},c={},u={},h={isRenderingToTexture:!1,isRenderingGlobe:(null===(i=t.projection)||void 0===i?void 0:i.transitionState)>0};for(const e in s){const t=s[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),c[e]=l[e].slice().reverse(),u[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<o.length;e++)if(this.style._layers[o[e]].is3D()){this.opaquePassCutoff=e;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const e of o){const t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;const r=c[t.source];("custom"===t.type||r.length)&&this.renderLayer(this,s[t.source],t,r,h)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?e.be.black:e.be.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,e){const r=t.context,i=r.gl,n=((t,e,r)=>{const i=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),o=ut(e),a=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-o*n)*r,(e.height/2+o*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*r,u_sky_blend:a}})(e,t.style.map.transform,t.pixelRatio),o=new Ve(i.LEQUAL,Ve.ReadWrite,[0,1]),a=$e.disabled,s=t.colorModeForRenderPass(),l=t.useProgram("sky"),c=En(r,e);l.draw(r,i.TRIANGLES,o,a,s,Ue.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[o[this.currentLayer]],e=s[t.source],r=l[t.source];this._renderTileClippingMasks(t,r,!1),this.renderLayer(this,e,t,r,h)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const t=this.style._layers[o[this.currentLayer]],e=s[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,h))continue;this.opaquePassEnabledForLayer()||d||(d=!0,h.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const r=("symbol"===t.type?u:c)[t.source];this._renderTileClippingMasks(t,l[t.source],!!this.renderToTexture),this.renderLayer(this,e,t,r,h)}if(h.isRenderingGlobe&&function(t,r,i){const n=t.context,o=n.gl,a=t.useProgram("atmosphere"),s=new Ve(o.LEQUAL,Ve.ReadOnly,[0,1]),l=t.transform,c=function(t,r){const i=t.properties.get("position"),n=[-i.x,-i.y,-i.z],o=e.af(new Float64Array(16));return"map"===t.properties.get("anchor")&&(e.b5(o,o,r.rollInRadians),e.b6(o,o,-r.pitchInRadians),e.b5(o,o,r.bearingInRadians),e.b6(o,o,r.center.lat*Math.PI/180),e.by(o,o,-r.center.lng*Math.PI/180)),e.c4(n,n,o),n}(i,t.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=r.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const d=ir(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,e.av(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,e.av(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((t,e,r,i,n)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],d,p),g=En(n,r);a.draw(n,o.TRIANGLES,s,$e.disabled,Be.alphaBlended,Ue.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const t=function(t,e){let r=null;const i=Object.values(t._layers).flatMap((r=>r.source&&!r.isHidden(e)?[t.sourceCaches[r.source]]:[])),n=i.filter((t=>"vector"===t.getSource().type)),o=i.filter((t=>"vector"!==t.getSource().type)),a=t=>{(!r||r.getSource().maxzoom<t.getSource().maxzoom)&&(r=t)};return n.forEach((t=>a(t))),r||o.forEach((t=>a(t))),r}(this.style,this.transform.zoom);t&&function(t,e,r){for(let i=0;i<r.length;i++)Tn(t,e,r[i])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;xn(t,t.transform.height-(e.top||0),3,gn),xn(t,e.bottom||0,3,_n),wn(t,e.left||0,3,yn),wn(t,t.transform.width-(e.right||0),3,vn);const r=t.transform.centerPoint;!function(t,e,r,i){Sn(t,e-1,r-10,2,20,i),Sn(t,e-10,r-1,20,2,i)}(t,r.x,t.transform.height-r.y,bn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const r=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=t?!e.c7(r,i):!e.c8(r,i)),n||(n=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(e.c9(r,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,r){const i=t.context,n=i.gl,o=t.transform,a=Be.unblended,s=new Ve(n.LEQUAL,Ve.ReadWrite,[0,1]),l=r.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");i.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:e.be.transparent,depth:1});for(const e of l){const t=r.getTerrainMesh(e.tileID),l=r.getTerrainData(e.tileID),u=o.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:r.getMeshFrameDelta(o.zoom)};c.draw(i,n.TRIANGLES,s,$e.disabled,a,Ue.backCCW,h,l,u,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,r){const i=t.context,n=i.gl,o=t.transform,a=Be.unblended,s=new Ve(n.LEQUAL,Ve.ReadWrite,[0,1]),l=r.getCoordsTexture(),c=r.sourceCache.getRenderableTiles(),u=t.useProgram("terrainCoords");i.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:e.be.transparent,depth:1}),r.coordsIndex=[];for(const e of c){const t=r.getTerrainMesh(e.tileID),c=r.getTerrainData(e.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const h={u_terrain_coords_id:(255-r.coordsIndex.length)/255,u_texture:0,u_ele_delta:r.getMeshFrameDelta(o.zoom)},d=o.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,n.TRIANGLES,s,$e.disabled,a,Ue.backCCW,h,c,d,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),r.coordsIndex.push(e.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,r,i,n,o){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(n||[]).length)&&(this.id=i.id,e.ca(i)?function(t,r,i,n,o,a){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:s}=a,l=$e.disabled,c=t.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,r,i,n,o,a,s,l,c){const u=r.transform,h=r.style.map.terrain,d="map"===o,p="map"===a;for(const f of t){const t=n.getTile(f),o=t.getBucket(i);if(!o||!o.text||!o.text.segments.get().length)continue;const a=e.am(o.textSizeData,u.zoom),m=e.aB(t,1,r.transform.zoom),g=Et(d,r.transform,m),_="none"!==i.layout.get("icon-text-fit")&&o.hasIconData();if(a){const r=Math.pow(2,u.zoom-t.tileID.overscaledZ),i=h?(t,e)=>h.getElevation(f,t,e):null;Qi(o,d,p,c,u,g,r,a,_,e.aC(u,t,s,l),f.toUnwrapped(),i)}}}(n,t,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&en(t,r,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),l,c,s),0!==i.paint.get("text-opacity").constantOr(1)&&en(t,r,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),l,c,s),r.map.showCollisionBoxes&&(Xi(t,r,i,n,!0),Xi(t,r,i,n,!1))}(t,r,i,n,this.style.placement.variableOffsets,o):e.cb(i)?function(t,r,i,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=i.paint.get("circle-opacity"),l=i.paint.get("circle-stroke-width"),c=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=t.context,d=h.gl,p=t.transform,f=t.getDepthModeForSublayer(0,Ve.ReadOnly),m=$e.disabled,g=t.colorModeForRenderPass(),_=[],y=p.getCircleRadiusCorrection();for(let v=0;v<n.length;v++){const o=n[v],s=r.getTile(o),l=s.getBucket(i);if(!l)continue;const c=i.paint.get("circle-translate"),h=i.paint.get("circle-translate-anchor"),d=e.aC(p,s,c,h),f=l.programConfigurations.get(i.id),m=t.useProgram("circle",f),g=l.layoutVertexBuffer,b=l.indexBuffer,x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(o),w={programConfiguration:f,program:m,layoutVertexBuffer:g,indexBuffer:b,uniformValues:zr(t,s,i,d,y),terrainData:x,projectionData:p.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){const t=l.segments.get();for(const r of t)_.push({segments:new e.aL([r]),sortKey:r.sortKey,state:w})}else _.push({segments:l.segments,sortKey:0,state:w})}u&&_.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of _){const{programConfiguration:r,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=e.state;n.draw(h,d.TRIANGLES,f,m,g,Ue.backCCW,s,l,c,i.id,o,a,e.segments,i.paint,t.transform.zoom,r)}}(t,r,i,n,o):e.cc(i)?function(t,r,i,n,o){if(0===i.paint.get("heatmap-opacity"))return;const a=t.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(t.style.map.terrain){for(const e of n){const n=r.getTile(e);r.hasRenderableParent(e)||("offscreen"===t.renderPass?nn(t,n,i,e,l):"translucent"===t.renderPass&&on(t,i,e,s,l))}a.viewport.set([0,0,t.width,t.height])}else"offscreen"===t.renderPass?function(t,r,i,n){const o=t.context,a=o.gl,s=t.transform,l=$e.disabled,c=new Be([a.ONE,a.ONE],e.be.transparent,[!0,!0,!0,!0]);(function(t,r,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,r.width/4,r.height/4]);let o=i.heatmapFbos.get(e.c1);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer)):(o=an(t,r.width/4,r.height/4),i.heatmapFbos.set(e.c1,o))})(o,t,i),o.clear({color:e.be.transparent});for(let e=0;e<n.length;e++){const u=n[e];if(r.hasRenderableParent(u))continue;const h=r.getTile(u),d=h.getBucket(i);if(!d)continue;const p=d.programConfigurations.get(i.id),f=t.useProgram("heatmap",p),m=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,Ve.disabled,l,c,Ue.backCCW,Br(h,s.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,s.zoom,p)}o.viewport.set([0,0,t.width,t.height])}(t,r,i,n):"translucent"===t.renderPass&&function(t,r){const i=t.context,n=i.gl;i.setColorMode(t.colorModeForRenderPass());const o=r.heatmapFbos.get(e.c1);o&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),sn(i,r).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(i,n.TRIANGLES,Ve.disabled,$e.disabled,t.colorModeForRenderPass(),Ue.disabled,jr(t,r,0,1),null,null,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,r.paint,t.transform.zoom))}(t,i)}(t,r,i,n,o):e.cd(i)?function(t,r,i,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=i.paint.get("line-opacity"),l=i.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;const c=t.getDepthModeForSublayer(0,Ve.ReadOnly),u=t.colorModeForRenderPass(),h=i.paint.get("line-dasharray"),d=i.paint.get("line-pattern"),p=d.constantOr(1),f=i.paint.get("line-gradient"),m=i.getCrossfadeParameters(),g=p?"linePattern":h?"lineSDF":f?"lineGradient":"line",_=t.context,y=_.gl,v=t.transform;let b=!0;for(const x of n){const n=r.getTile(x);if(p&&!n.patternsLoaded())continue;const o=n.getBucket(i);if(!o)continue;const s=o.programConfigurations.get(i.id),l=t.context.program.get(),w=t.useProgram(g,s),S=b||w.program!==l,T=t.style.map.terrain&&t.style.map.terrain.getTerrainData(x),I=d.constantOr(null);if(I&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[I.to.toString()],r=t.patternPositions[I.from.toString()];e&&r&&s.setConstantPatternPositions(e,r)}const E=v.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),P=v.getPixelScale(),k=p?Wr(t,n,i,P,m):h?Hr(t,n,i,P,h,m):f?Zr(t,n,i,P,o.lineClipsArray.length):qr(t,n,i,P);if(p)_.activeTexture.set(y.TEXTURE0),n.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),s.updatePaintBuffers(m);else if(h&&(S||t.lineAtlas.dirty))_.activeTexture.set(y.TEXTURE0),t.lineAtlas.bind(_);else if(f){const n=o.gradients[i.id];let a=n.texture;if(i.gradientVersion!==n.version){let s=256;if(i.stepInterpolant){const i=r.getSource().maxzoom,n=x.canonical.z===i?Math.ceil(1<<t.transform.maxZoom-x.canonical.z):1;s=e.ag(e.c2(o.maxLineLength/e.$*1024*n),256,_.maxTextureSize)}n.gradient=e.c3({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:s,image:n.gradient||void 0,clips:o.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(_,n.gradient,y.RGBA),n.version=i.gradientVersion,a=n.texture}_.activeTexture.set(y.TEXTURE0),a.bind(i.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}const C=t.stencilModeForClipping(x);w.draw(_,y.TRIANGLES,c,C,u,Ue.disabled,k,T,E,i.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,i.paint,t.transform.zoom,s,o.layoutVertexBuffer2),b=!1}}(t,r,i,n,o):e.ce(i)?function(t,r,i,n,o){const a=i.paint.get("fill-color"),s=i.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=t.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=t.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===a.constantOr(e.be.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===h){const e=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?Ve.ReadWrite:Ve.ReadOnly);cn(t,r,i,n,e,c,!1,l)}if("translucent"===t.renderPass&&i.paint.get("fill-antialias")){const e=t.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,Ve.ReadOnly);cn(t,r,i,n,e,c,!0,l)}}(t,r,i,n,o):e.cf(i)?function(t,e,r,i,n){const o=r.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===t.renderPass){const n=new Ve(t.context.gl.LEQUAL,Ve.ReadWrite,t.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))un(t,e,r,i,n,$e.disabled,Be.disabled,a),un(t,e,r,i,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),a);else{const o=t.colorModeForRenderPass();un(t,e,r,i,n,$e.disabled,o,a)}}}(t,r,i,n,o):e.cg(i)?function(t,r,i,n,o){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=t.context,l=t.style.projection.useSubdivision,c=t.getDepthModeForSublayer(0,Ve.ReadOnly),u=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,r,i,n,o,a,s){const l=t.context,c=l.gl;for(const u of i){const i=r.getTile(u),h=i.dem;if(!h||!h.data)continue;if(!i.needsHillshadePrepare)continue;const d=h.dim,p=h.stride,f=h.getPixels();if(l.activeTexture.set(c.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(p),i.demTexture){const t=i.demTexture;t.update(f,{premultiply:!1}),t.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else i.demTexture=new e.T(l,f,c.RGBA,{premultiply:!1}),i.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);l.activeTexture.set(c.TEXTURE0);let m=i.fbo;if(!m){const t=new e.T(l,{width:d,height:d,data:null},c.RGBA);t.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=i.fbo=l.createFramebuffer(d,d,!0,!1),m.colorAttachment.set(t.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,d,d]),t.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,a,s,Ue.disabled,Vr(i.tileID,h),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(t,r,n,i,c,$e.disabled,u),s.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(l){const[e,o,s]=t.stencilConfigForOverlapTwoPass(n);hn(t,r,i,s,e,c,u,!1,a),hn(t,r,i,s,o,c,u,!0,a)}else{const[e,o]=t.getStencilConfigForOverlapAndUpdateStencilID(n);hn(t,r,i,o,e,c,u,!1,a)}}(t,r,i,n,o):e.ch(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=t.style.projection.useSubdivision,s=t.getDepthModeForSublayer(0,Ve.ReadOnly),l=t.colorModeForRenderPass();if(a){const[n,a,c]=t.stencilConfigForOverlapTwoPass(i);dn(t,e,r,c,n,s,l,!1,o),dn(t,e,r,c,a,s,l,!0,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(i);dn(t,e,r,a,n,s,l,!1,o)}}(t,r,i,n,o):e.ci(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=e.getSource(),s=t.style.projection.useSubdivision;if(a instanceof X)fn(t,e,r,i,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=t.stencilConfigForOverlapTwoPass(i);fn(t,e,r,s,n,!1,!0,pn,!1,o),fn(t,e,r,s,a,!0,!0,pn,!1,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(i);fn(t,e,r,a,n,!1,!0,pn,!1,o)}}(t,r,i,n,o):e.cj(i)?function(t,e,r,i,n){const o=r.paint.get("background-color"),a=r.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:s}=n,l=t.context,c=l.gl,u=t.style.projection,h=t.transform,d=h.tileSize,p=r.paint.get("background-pattern");if(t.isPatternMissing(p))return;const f=!p&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;const m=$e.disabled,g=t.getDepthModeForSublayer(0,"opaque"===f?Ve.ReadWrite:Ve.ReadOnly),_=t.colorModeForRenderPass(),y=t.useProgram(p?"backgroundPattern":"background"),v=i||yt(h,{tileSize:d,terrain:t.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context));const b=r.getCrossfadeParameters();for(const x of v){const e=h.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),i=p?ii(a,t,p,{tileID:x,tileSize:d},b):ri(a,o),n=t.style.map.terrain&&t.style.map.terrain.getTerrainData(x),f=u.getMeshFromTileID(l,x.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,g,m,_,Ue.backCCW,i,n,e,r.id,f.vertexBuffer,f.indexBuffer,f.segments)}}(t,0,i,n,o):e.ck(i)&&function(t,e,r,i){const{isRenderingGlobe:n}=i,o=t.context,a=r.implementation,s=t.style.projection,l=t.transform,c=l.getProjectionDataForCustomLayer(n),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:c},h=a.renderingMode?a.renderingMode:"2d";if("offscreen"===t.renderPass){const e=a.prerender;e&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),e.call(a,o.gl,u),o.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode($e.disabled);const e="3d"===h?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,Ve.ReadOnly);o.setDepthMode(e),a.render(o.gl,u),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}(t,0,i,o))}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r}useProgram(t,e,r=!1,i=[]){this.cache=this.cache||{};const n=!!this.style.map.terrain,o=this.style.projection,a=r?be.projectionMercator:o.shaderPreludeCode,s=r?Te:o.shaderDefine,l=t+(e?e.cacheKey:"")+`/${r?Ie:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(i?`/${i.join("/")}`:"");return this.cache[l]||(this.cache[l]=new kr(this.context,be[t],e,oi[t],this._showOverdrawInspector,n,a,s,i)),this.cache[l]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function kn(t,e){let r,i=!1,n=null,o=null;const a=()=>{n=null,i&&(t.apply(o,r),n=setTimeout(a,e),i=!1)};return(...t)=>(i=!0,o=this,r=t,n||a(),n)}class Cn{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(!this._isValidHash(t))return!1;const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let r=e;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${e}`);let i=window.location.hash.replace(r,"");i.startsWith("#&")?i=i.slice(0,1)+i.slice(2):"#"===i&&(i="");let n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=kn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${a}/${r}`:`${r}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const r=window.location.hash.slice(1).split("&").map((r=>{const i=r.split("=")[0];return i===t?(e=!0,`${i}=${c}`):r})).filter((t=>t));return e||r.push(`${t}=${c}`),`#${r.join("&")}`}return`#${c}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new e.S(+t[2],+t[1])}catch(t){return!1}const r=+t[0],i=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const An={linearity:.3,easing:e.cl(0,0,.3,1)},Mn=e.e({deceleration:2500,maxSpeed:1400},An),Rn=e.e({deceleration:20,maxSpeed:1400},An),Ln=e.e({deceleration:1e3,maxSpeed:360},An),Dn=e.e({deceleration:1e3,maxSpeed:90},An),zn=e.e({deceleration:1e3,maxSpeed:360},An);class On{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=a.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const r={zoom:0,bearing:0,pitch:0,roll:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,r.roll+=e.rollDelta||0,e.panDelta&&r.pan._add(e.panDelta),e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){const o=Nn(r.pan.mag(),i,e.e({},Mn,t||{})),a=r.pan.mult(o.amount/r.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);n.center=s.easingCenter,n.offset=s.easingOffset,Fn(n,o)}if(r.zoom){const t=Nn(r.zoom,i,Rn);n.zoom=this._map.transform.zoom+t.amount,Fn(n,t)}if(r.bearing){const t=Nn(r.bearing,i,Ln);n.bearing=this._map.transform.bearing+e.ag(t.amount,-179,179),Fn(n,t)}if(r.pitch){const t=Nn(r.pitch,i,Dn);n.pitch=this._map.transform.pitch+t.amount,Fn(n,t)}if(r.roll){const t=Nn(r.roll,i,zn);n.roll=this._map.transform.roll+e.ag(t.amount,-179,179),Fn(n,t)}if(n.zoom||n.bearing){const t=void 0===r.pinchAround?r.around:r.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(n,{noMoveStart:!0})}}function Fn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function Nn(t,r,i){const{maxSpeed:n,linearity:o,deceleration:a}=i,s=e.ag(t*o/(r/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:i.easing,duration:1e3*l,amount:s*(l/2)}}class Bn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(t,i);const o=s.mousePos(r.getCanvas(),i),a=r.unproject(o);super(t,e.e({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}}class jn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i){const n="touchend"===t?i.changedTouches:i.touches,o=s.touchPos(r.getCanvasContainer(),n),a=o.map((t=>r.unproject(t))),l=o.reduce(((t,e,r,i)=>t.add(e.div(i.length))),new e.P(0,0));super(t,{points:o,point:l,lngLats:a,lngLat:r.unproject(l),originalEvent:i}),this._defaultPrevented=!1}}class Un extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,r){super(t,{originalEvent:r}),this._defaultPrevented=!1}}class Vn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Un(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Bn(t.type,this._map,t))}mouseup(t){this._map.fire(new Bn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Bn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Bn(t.type,this._map,t))}mouseover(t){this._map.fire(new Bn(t.type,this._map,t))}mouseout(t){this._map.fire(new Bn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new jn(t.type,this._map,t))}touchmove(t){this._map.fire(new jn(t.type,this._map,t))}touchend(t){this._map.fire(new jn(t.type,this._map,t))}touchcancel(t){this._map.fire(new jn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Bn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Bn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Bn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $n{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this._map.terrain)}}class qn{constructor(t,e){this._map=t,this._tr=new $n(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(s.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const i=this._startPos;this._lastPos=r,this._box||(this._box=s.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const n=Math.min(i.x,r.x),o=Math.max(i.x,r.x),a=Math.min(i.y,r.y),l=Math.max(i.y,r.y);s.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=l-a+"px"}mouseupWindow(t,r){if(!this._active)return;if(0!==t.button)return;const i=this._startPos,n=r;if(this.reset(),s.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new e.l("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new e.l(t,{originalEvent:r}))}}function Zn(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const r={};for(let i=0;i<t.length;i++)r[t[i].identifier]=e[i];return r}class Wn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){const r=new e.P(0,0);for(const e of t)r._add(e);return r.div(t.length)}(r),this.touches=Zn(i,r)))}touchmove(t,e,r){if(this.aborted||!this.centroid)return;const i=Zn(r,e);for(const n in this.touches){const t=i[n];(!t||t.dist(this.touches[n])>30)&&(this.aborted=!0)}}touchend(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Hn{constructor(t){this.singleTap=new Wn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,r){this.singleTap.touchstart(t,e,r)}touchmove(t,e,r){this.singleTap.touchmove(t,e,r)}touchend(t,e,r){const i=this.singleTap.touchend(t,e,r);if(i){const e=t.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if(e&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class Xn{constructor(t){this._tr=new $n(t),this._zoomIn=new Hn({numTouches:1,numTaps:2}),this._zoomOut=new Hn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)}touchmove(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)}touchend(t,e,r){const i=this._zoomIn.touchend(t,e,r),n=this._zoomOut.touchend(t,e,r),o=this._tr;return i?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(i)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const i=Array.isArray(e)?e[0]:e;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&s.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Yn=0,Kn=2,Qn={[Yn]:1,[Kn]:2};class to{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=s.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const r=Qn[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton)}isValidEndEvent(t){return s.mouseButton(t)===this._eventButton}}class eo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class ro{constructor(t=new to({checkCorrectEvent:()=>!0}),e=new eo){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e}_executeRelevantHandler(t,e,r){return t instanceof MouseEvent?e(t):"undefined"!=typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.startMove(t)),(t=>this.oneFingerTouchMoveStateManager.startMove(t)))}endMove(t){this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.endMove(t)),(t=>this.oneFingerTouchMoveStateManager.endMove(t)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidStartEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidMoveEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidEndEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t)))}}const io=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class no{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,r){return this._calculateTransform(t,e,r)}touchmove(t,e,r){if(this._active){if(!this._shouldBePrevented(r.length))return t.preventDefault(),this._calculateTransform(t,e,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,r){this._calculateTransform(t,e,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);const n=Zn(i,r),o=new e.P(0,0),a=new e.P(0,0);let s=0;for(const e in n){const t=n[e],r=this._touches[e];r&&(o._add(t),a._add(t.sub(r)),s++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(s)||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class oo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,r){if(!this._firstTwoTouches)return;t.preventDefault();const[i,n]=this._firstTwoTouches,o=ao(r,e,i),a=ao(r,e,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;const[i,n]=this._firstTwoTouches,o=ao(r,e,i),a=ao(r,e,n);o&&a||(this._active&&s.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function ao(t,e,r){for(let i=0;i<t.length;i++)if(t[i].identifier===r)return e[i]}function so(t,e){return Math.log(t/e)/Math.LN2}class lo extends oo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(so(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:so(this._distance,r),pinchAround:e}}}function co(t,e){return 180*t.angleWith(e)/Math.PI}class uo extends oo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,r){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:co(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,r=co(t,this._startVector);return Math.abs(r)<e}}function ho(t){return Math.abs(t.y)>Math.abs(t.x)}class po extends oo{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,r){super.touchstart(t,e,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,ho(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const i=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,r){if(void 0!==this._valid)return this._valid;const i=t.mag()>=2,n=e.mag()>=2;if(!i&&!n)return;if(!i||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return ho(t)&&ho(e)&&o}}const fo={panStep:100,bearingStep:15,pitchStep:10};class mo{constructor(t){this._tr=new $n(t);const e=fo;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,r=0,i=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:a=>{const s=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:go,zoom:e?Math.round(s.zoom)+e*(t.shiftKey?2:1):s.zoom,bearing:s.bearing+r*this._bearingStep,pitch:s.pitch+i*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function go(t){return t*(2-t)}const _o=4.000244140625,yo=1/450;class vo{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new $n(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=yo}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=a.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==e&&e%_o==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(i*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){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 r=s.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(e.S.convert(i.center)):r,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e)}if(0!==this._delta){const r="wheel"===this._type&&Math.abs(this._delta)>_o?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);const n="number"!=typeof this._targetZoom?t.scale:e.ae(this._targetZoom);this._targetZoom=t.getConstrained(t.getCameraLngLat(),e.aj(n*i)).zoom,"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,i=this._startZoom,n=this._easing;let o,s=!1;if("wheel"===this._type&&i&&n){const t=a.now()-this._lastWheelEventTime,l=Math.min((t+5)/200,1),c=n(l);o=e.C.number(i,r,c),l<1?this._frameId||(this._frameId=!0):s=!0}else o=r,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=e.cn;if(this._prevEase){const t=this._prevEase,i=(a.now()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=e.cl(o,s,.25,1)}return this._prevEase={start:a.now(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class bo{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 xo{constructor(t){this._tr=new $n(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wo{constructor(){this._tap=new Hn({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(t,e,r){if(!this._swipePoint)if(this._tapTime){const i=e[0],n=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(i)<30;n&&o?r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,e,r)}touchmove(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const i=e[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,r)}touchend(t,e,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{const i=this._tap.touchend(t,e,r);i&&(this._tapTime=t.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class So{constructor(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class To{constructor(t,e,r,i){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Io{constructor(t,e,r,i){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Eo{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=s.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=e,this._container.appendChild(i);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(s.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(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new e.l("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Po=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class ko extends e.l{}function Co(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class Ao{constructor(t,r){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},o={},a={};for(const{handlerName:u,handler:h,allowed:d}of this._handlers){if(!h.isEnabled())continue;let l;if(this._blockedByActive(a,d,u))h.reset();else if(h[r||t.type]){if(e.co(t,r||t.type)){const e=s.mousePos(this._map.getCanvas(),t);l=h[r||t.type](t,e)}else if(e.cp(t,r||t.type)){const e=this._getMapTouches(t.touches),i=s.touchPos(this._map.getCanvas(),e);l=h[r||t.type](t,i,e)}else e.cq(r||t.type)||(l=h[r||t.type](t));this.mergeHandlerResult(n,o,l,u,i),l&&l.needsRenderFrame&&this._triggerRenderFrame()}(l||h.isActive())&&(a[u]=h)}const l={};for(const e in this._previousActiveHandlers)a[e]||(l[e]=i);this._previousActiveHandlers=a,(Object.keys(l).length||Co(n))&&(this._changes.push([n,o,l]),this._triggerRenderFrame()),(Object.keys(a).length||Co(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new On(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,n,o]of this._listeners)s.addEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(const[t,e,r]of this._listeners)s.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new Vn(r,t));const n=r.boxZoom=new qn(r,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const o=r.cooperativeGestures=new Eo(r,t.cooperativeGestures);this._add("cooperativeGestures",o),t.cooperativeGestures&&o.enable();const a=new Xn(r),l=new xo(r);r.doubleClickZoom=new bo(l,a),this._add("tapZoom",a),this._add("clickZoom",l),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();const c=new wo;this._add("tapDragZoom",c);const u=r.touchPitch=new po(r);this._add("touchPitch",u),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);const h=()=>r.project(r.getCenter()),d=function({enable:t,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const l=new to({checkCorrectEvent:t=>0===s.mouseButton(t)&&t.ctrlKey||2===s.mouseButton(t)&&!t.ctrlKey});return new Jn({clickTolerance:r,move:(t,r)=>{const s=a();if(i&&Math.abs(s.y-t.y)>n)return{bearingDelta:e.cm(new e.P(t.x,r.y),r,s)};let l=(r.x-t.x)*o;return i&&r.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:l,enable:t,assignEvents:io})}(t,h),p=function({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5}){const i=new to({checkCorrectEvent:t=>0===s.mouseButton(t)&&t.ctrlKey||2===s.mouseButton(t)});return new Jn({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*r}),moveStateManager:i,enable:t,assignEvents:io})}(t),f=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:r=.3},i){const n=new to({checkCorrectEvent:t=>2===s.mouseButton(t)&&t.ctrlKey});return new Jn({clickTolerance:e,move:(t,e)=>{const n=i();let o=(e.x-t.x)*r;return e.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:t,assignEvents:io})}(t,h);r.dragRotate=new To(t,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();const m=function({enable:t,clickTolerance:e}){const r=new to({checkCorrectEvent:t=>0===s.mouseButton(t)&&!t.ctrlKey});return new Jn({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:io})}(t),g=new no(t,r);r.dragPan=new So(i,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);const _=new uo,y=new lo;r.touchZoomRotate=new Io(i,y,_,c),this._add("touchRotate",_,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate);const v=r.scrollZoom=new vo(r,(()=>this._triggerRenderFrame()));this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);const b=r.keyboard=new mo(r);this._add("keyboard",b),t.interactive&&t.keyboard&&r.keyboard.enable(),this._add("blockableMapEvent",new Gn(r))}_add(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Po(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,r){for(const i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const r of t)this._el.contains(r.target)&&e.push(r);return e}mergeHandlerResult(t,r,i,n,o){if(!i)return;e.e(t,i);const a={handlerName:n,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(r.zoom=a),void 0!==i.panDelta&&(r.drag=a),void 0!==i.rollDelta&&(r.roll=a),void 0!==i.pitchDelta&&(r.pitch=a),void 0!==i.bearingDelta&&(r.rotate=a)}_applyChanges(){const t={},r={},i={};for(const[n,o,a]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.e(r,o),e.e(i,a);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,e,r){const i=this._map,n=i._getTransformForUpdate(),o=i.terrain;if(!(Co(t)||o&&this._terrainMovement))return this._fireEvents(e,r,!0);i._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=t;void 0!==d&&(h=d),h=h||i.transform.centerPoint,o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const p={panDelta:a,zoomDelta:s,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(a?h.sub(a):h);o?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(a))):this._map.cameraHelper.handleMapControlsPan(p,n,f):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(p,n,f))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._map.cameraHelper.handleMapControlsPan(p,n,f)),i._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)}_fireEvents(t,r,i){const n=Po(this._eventsInProgress),o=Po(t),s={};for(const e in t){const{originalEvent:r}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=r),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:r}=t[e];this._fireEvent(e,r)}const l={};let c;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:i}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=r[t]||i,l[`${e}end`]=c)}for(const e in l)this._fireEvent(e,l[e]);const u=Po(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(i&&h){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&a.prefersReducedMotion?(this._map.fire(new e.l("moveend",{originalEvent:c})),r(this._map.getBearing())&&this._map.resetNorth()):(r(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new e.l(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new ko("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Mo extends e.E{constructor(t,e,r){super(),this._renderFrameCallback=()=>{const t=Math.min((a.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this.cameraHelper=e,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,e){t.apply(this.transform),this.transform=t,this.cameraHelper=e}getCenter(){return new e.S(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,i){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},r),i)}panTo(t,r,i){return this.easeTo(e.e({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,r,i){return this.easeTo(e.e({zoom:t},r),i)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new e.l("movestart",r)).fire(new e.l("move",r)).fire(new e.l("moveend",r))),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,r,i){return this.easeTo(e.e({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,e.e({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(e.e({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=G.convert(t).adjustAntiMeridian();const r=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,e)}_cameraForBoxAndBearing(t,r,i,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=e.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}const a=e.e(o,n.padding);n.padding=a;const s=this.transform,l=new G(t,r);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,i,s)}fitBounds(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)}fitScreenCoordinates(t,r,i,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(e.P.convert(t)),this.transform.screenPointToLocation(e.P.convert(r)),i,n),n,o)}_fitInternal(t,r,i){return t?(delete(r=e.e(t,r)).padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(t,r){this.stop();const i=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,t);const l=i.zoom!==s;return"elevation"in t&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),"bearing"in t&&i.bearing!==+t.bearing&&(n=!0,i.setBearing(+t.bearing)),"pitch"in t&&i.pitch!==+t.pitch&&(o=!0,i.setPitch(+t.pitch)),"roll"in t&&i.roll!==+t.roll&&(a=!0,i.setRoll(+t.roll)),null==t.padding||i.isPaddingEqual(t.padding)||i.setPadding(t.padding),this._applyUpdatedTransform(i),this.fire(new e.l("movestart",r)).fire(new e.l("move",r)),l&&this.fire(new e.l("zoomstart",r)).fire(new e.l("zoom",r)).fire(new e.l("zoomend",r)),n&&this.fire(new e.l("rotatestart",r)).fire(new e.l("rotate",r)).fire(new e.l("rotateend",r)),o&&this.fire(new e.l("pitchstart",r)).fire(new e.l("pitch",r)).fire(new e.l("pitchend",r)),a&&this.fire(new e.l("rollstart",r)).fire(new e.l("roll",r)).fire(new e.l("rollend",r)),this.fire(new e.l("moveend",r))}calculateCameraOptionsFromTo(t,r,i,n=0){const o=e.a0.fromLngLat(t,r),a=e.a0.fromLngLat(i,n),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,u=Math.hypot(s,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(s,l),d=e.aj(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(s,-l)/Math.PI;let f=180*Math.acos(h/u)/Math.PI;return f=c<0?90-f:90+f,{center:a.toLngLat(),elevation:n,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,r,i,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(t,e,r,i);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:r,pitch:i,roll:n}}easeTo(t,r){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.cn},t)).animate||!t.essential&&a.prefersReducedMotion)&&(t.duration=0);const i=this._getTransformForUpdate(),n=this.getBearing(),o=i.pitch,s=i.roll,l="bearing"in t?this._normalizeBearing(t.bearing,n):n,c="pitch"in t?+t.pitch:o,u="roll"in t?this._normalizeBearing(t.roll,s):s,h="padding"in t?t.padding:i.padding,d=e.P.convert(t.offset);let p,f;t.around&&(p=e.S.convert(t.around),f=i.locationToScreenPoint(p));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(i,{bearing:l,pitch:c,roll:u,padding:h,around:p,aroundPoint:f,offsetAsPoint:d,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||u!==s,this._padding=!i.isPaddingEqual(h),this._zooming=this._zooming||g.isZooming,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease((e=>{g.easeFunc(e),this.terrain&&!t.freezeElevation&&this._updateElevation(e),this._applyUpdatedTransform(i),this._fireMoveEvents(r)}),(e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,e)}),t),this}_prepareEase(t,r,i={}){this._moving=!0,r||i.moving||this.fire(new e.l("movestart",t)),this._zooming&&!i.zooming&&this.fire(new e.l("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new e.l("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new e.l("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new e.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&r!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(r-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=r}this.transform.setElevation(e.C.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const e=t.getCameraLngLat(),r=t.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(r<i){const r=this.calculateCameraOptionsFromTo(e,i,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(t){const e=[];if(e.push((t=>this._elevateCameraIfInsideTerrain(t))),this.transformCameraUpdate&&e.push((t=>this.transformCameraUpdate(t))),!e.length)return;const r=t.clone();for(const i of e){const t=r.clone(),{center:e,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=i(t);e&&t.setCenter(e),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==o&&t.setRoll(o),void 0!==a&&t.setPitch(a),void 0!==s&&t.setBearing(s),r.apply(t)}this.transform.apply(r)}_fireMoveEvents(t){this.fire(new e.l("move",t)),this._zooming&&this.fire(new e.l("zoom",t)),this._rotating&&this.fire(new e.l("rotate",t)),this._pitching&&this.fire(new e.l("pitch",t)),this._rolling&&this.fire(new e.l("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;const i=this._zooming,n=this._rotating,o=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new e.l("zoomend",t)),n&&this.fire(new e.l("rotateend",t)),o&&this.fire(new e.l("pitchend",t)),a&&this.fire(new e.l("rollend",t)),this.fire(new e.l("moveend",t))}flyTo(t,r){if(!t.essential&&a.prefersReducedMotion){const i=e.Q(t,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(i,r)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.cn},t);const i=this._getTransformForUpdate(),n=i.bearing,o=i.pitch,s=i.roll,l=i.padding,c="bearing"in t?this._normalizeBearing(t.bearing,n):n,u="pitch"in t?+t.pitch:o,h="roll"in t?this._normalizeBearing(t.roll,s):s,d="padding"in t?t.padding:i.padding,p=e.P.convert(t.offset);let f=i.centerPoint.add(p);const m=i.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(i,{bearing:c,pitch:u,roll:h,padding:d,locationAtOffset:m,offsetAsPoint:p,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let _=t.curve;const y=Math.max(i.width,i.height),v=y/g.scaleOfZoom,b=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/b*2));const x=_*_;function w(t){const e=(v*v-y*y+(t?-1:1)*x*x*b*b)/(2*(t?v:y)*x*b);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function T(t){return(Math.exp(t)+Math.exp(-t))/2}const I=w(!1);let E=function(t){return T(I)/T(I+_*t)},P=function(t){return y*((T(I)*(S(e=I+_*t)/T(e))-S(I))/x)/b;var e},k=(w(!0)-I)/_;if(Math.abs(b)<2e-6||!isFinite(k)){if(Math.abs(y-v)<1e-6)return this.easeTo(t,r);const e=v<y?-1:1;k=Math.abs(Math.log(v/y))/_,P=()=>0,E=t=>Math.exp(e*_*t)}return t.duration="duration"in t?+t.duration:1e3*k/("screenSpeed"in t?+t.screenSpeed/_:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==s,this._padding=!i.isPaddingEqual(d),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease((a=>{const m=a*k,_=1/E(m),y=P(m);this._rotating&&i.setBearing(e.C.number(n,c,a)),this._pitching&&i.setPitch(e.C.number(o,u,a)),this._rolling&&i.setRoll(e.C.number(s,h,a)),this._padding&&(i.interpolatePadding(l,d,a),f=i.centerPoint.add(p)),g.easeFunc(a,_,y,f),this.terrain&&!t.freezeElevation&&this._updateElevation(a),this._applyUpdatedTransform(i),this._fireMoveEvents(r)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(r=this.handlers)||void 0===r||r.stop(!1),this}_ease(t,e,r){!1===r.animate||0===r.duration?(t(1),e()):(this._easeStart=a.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){t=e.aN(t,-180,180);const i=Math.abs(t-r);return Math.abs(t-360-r)<i&&(t-=360),Math.abs(t+360-r)<i&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.S.convert(t),this.transform.tileZoom):null}}const Ro={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Lo{constructor(t=Ro){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=s.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=s.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=s.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(){s.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(t,e){const r=this._map._getUIString(`AttributionControl.${e}`);t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,r)=>{for(let i=r+1;i<t.length;i++)if(t[i].indexOf(e)>=0)return!1;return!0}));const r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=s.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Do{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=s.create("div","maplibregl-ctrl");const e=s.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){s.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class zo{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,r=e?this._queue.concat(e):this._queue;for(const i of r)if(i.id===t)return void(i.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const r of e)if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Oo=e.aI([{name:"a_pos3d",type:"Int16",components:3}]);class Fo extends e.E{constructor(t){super(),this._lastTilesetChange=a.now(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,r){this.sourceCache.update(t,r),this._renderableTilesKeys=[];const i={};for(const n of yt(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),e.bX(n.terrainRttPosMatrix32f,0,e.$,e.$,0,0,1),this._tiles[n.key]=new nt(n,this.tileSize),this._lastTilesetChange=a.now());for(const e in this._tiles)i[e]||delete this._tiles[e]}freeRtt(t){for(const e in this._tiles){const r=this._tiles[e];(!t||r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const r={};for(const i of this._renderableTilesKeys){const n=this._tiles[i].tileID,o=t.clone(),a=e.b9();if(n.canonical.equals(t.canonical))e.bX(a,0,e.$,e.$,0,0,1);else if(n.canonical.isChildOf(t.canonical)){const r=n.canonical.z-t.canonical.z,i=n.canonical.x-(n.canonical.x>>r<<r),o=n.canonical.y-(n.canonical.y>>r<<r),s=e.$>>r;e.bX(a,0,s,s,0,0,1),e.M(a,a,[-i*s,-o*s,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{const r=t.canonical.z-n.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r),o=t.canonical.y-(t.canonical.y>>r<<r),s=e.$>>r;e.bX(a,0,e.$,e.$,0,0,1),e.M(a,a,[i*s,o*s,0]),e.N(a,a,[1/2**r,1/2**r,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),r[i]=o}return r}_getTerrainCoordsForTileRanges(t,r){const i={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,r))continue;const a=t.clone(),s=e.b9();if(o.canonical.z===t.canonical.z){const r=t.canonical.x-o.canonical.x,i=t.canonical.y-o.canonical.y;e.bX(s,0,e.$,e.$,0,0,1),e.M(s,s,[r*e.$,i*e.$,0])}else if(o.canonical.z>t.canonical.z){const r=o.canonical.z-t.canonical.z,i=o.canonical.x-(o.canonical.x>>r<<r),n=o.canonical.y-(o.canonical.y>>r<<r),a=t.canonical.x-(o.canonical.x>>r),l=t.canonical.y-(o.canonical.y>>r),c=e.$>>r;e.bX(s,0,c,c,0,0,1),e.M(s,s,[-i*c+a*e.$,-n*c+l*e.$,0])}else{const r=t.canonical.z-o.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r),n=t.canonical.y-(t.canonical.y>>r<<r),a=(t.canonical.x>>r)-o.canonical.x,l=(t.canonical.y>>r)-o.canonical.y,c=e.$<<r;e.bX(s,0,c,c,0,0,1),e.M(s,s,[i*e.$+a*c,n*e.$+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),i[n]=a}return i}getSourceTile(t,e){const r=this.sourceCache._source;let i=t.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(i).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!n||!n.dem)&&e)for(;i>=r.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(i--).key);return n}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){return e[t.canonical.z]&&t.canonical.x>=e[t.canonical.z].minTileX&&t.canonical.x<=e[t.canonical.z].maxTileX&&t.canonical.y>=e[t.canonical.z].minTileY&&t.canonical.y<=e[t.canonical.z].maxTileY}}class No{constructor(t,e,r){this._meshCache={},this.painter=t,this.sourceCache=new Fo(e),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,r,i,n=e.$){var o;if(!(r>=0&&r<n&&i>=0&&i<n))return 0;const a=this.getTerrainData(t),s=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!s)return 0;const l=e.cr([],[r/n*e.$,i/n*e.$],a.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],u=Math.floor(c[0]),h=Math.floor(c[1]),d=c[0]-u,p=c[1]-h;return s.get(u,h)*(1-d)*(1-p)+s.get(u+1,h)*d*(1-p)+s.get(u,h+1)*(1-d)*p+s.get(u+1,h+1)*d*p}getElevationForLngLatZoom(t,r){if(!e.cs(r,t.wrap()))return 0;const{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(i,n%e.$,o%e.$,e.$)}getElevation(t,r,i,n=e.$){return this.getDEMElevation(t,r,i,n)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,r=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new e.T(t,r,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new e.T(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.af([])}const r=this.sourceCache.getSourceTile(t,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){const t=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new e.T(t,r.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),r.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}const i=r&&r+r.tileID.key+t.key;if(i&&!this._demMatrixCache[i]){const i=this.sourceCache.sourceCache._source.maxzoom;let n=t.canonical.z-r.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=i?n=t.canonical.z-i:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=t.canonical.x-(t.canonical.x>>n<<n),a=t.canonical.y-(t.canonical.y>>n<<n),s=e.ct(new Float64Array(16),[1/(e.$<<n),1/(e.$<<n),0]);e.M(s,s,[o*e.$,a*e.$,0]),this._demMatrixCache[t.key]={matrix:s,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:r&&r.dem&&r.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r&&r.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(t){const r=this.painter,i=r.width/devicePixelRatio,n=r.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new e.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new e.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,o=0;e<this._coordsTextureSize;e++)for(let t=0;t<this._coordsTextureSize;t++,o+=4)r[o+0]=255&t,r[o+1]=255&e,r[o+2]=t>>8<<4|e>>8,r[o+3]=0;const i=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new e.T(t,i,t.gl.RGBA,{premultiply:!1});return n.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const r=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,r),i.bindFramebuffer.set(null);const l=r[0]+(r[2]>>4<<8),c=r[1]+((15&r[2])<<8),u=this.coordsIndex[255-r[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*d;return new e.a0((h.tileID.canonical.x*d+l)/p+h.tileID.wrap,(h.tileID.canonical.y*d+c)/p,this.getElevation(h.tileID,l,c,d))}depthAtPoint(t){const e=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,e),r.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var r;const i=(null===(r=this.painter.style.projection)||void 0===r?void 0:r.transitionState)>0,n=i&&0===t.canonical.y,o=i&&t.canonical.y===(1<<t.canonical.z)-1,a=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new e.cu,c=new e.aM,u=this.meshSize,h=e.$/u,d=u*u;for(let e=0;e<=u;e++)for(let t=0;t<=u;t++)l.emplaceBack(t*h,e*h,0);for(let e=0;e<d;e+=u+1)for(let t=0;t<u;t++)c.emplaceBack(t+e,u+t+e+1,u+t+e+2),c.emplaceBack(t+e,u+t+e+2,t+e+1);const p=l.length,f=p+(u+1),m=(u+1)*u,g=n?e.bg:0,_=n?0:1,y=o?e.bh:e.$,v=o?0:1;for(let e=0;e<=u;e++)l.emplaceBack(e*h,g,_);for(let e=0;e<=u;e++)l.emplaceBack(e*h,y,v);for(let e=0;e<u;e++)c.emplaceBack(m+e,f+e,f+e+1),c.emplaceBack(m+e,f+e+1,m+e+1),c.emplaceBack(0+e,p+e+1,p+e),c.emplaceBack(0+e,0+e+1,p+e+1);const b=l.length,x=b+2*(u+1);for(const S of[0,1])for(let t=0;t<=u;t++)for(const r of[0,1])l.emplaceBack(S*e.$,t*h,r);for(let e=0;e<2*u;e+=2)c.emplaceBack(b+e,b+e+1,b+e+3),c.emplaceBack(b+e,b+e+3,b+e+2),c.emplaceBack(x+e,x+e+3,x+e+1),c.emplaceBack(x+e,x+e+2,x+e+3);const w=new we(s.createVertexBuffer(l,Oo.members),s.createIndexBuffer(c),e.aL.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(t){return 2*Math.PI*e.bt/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,e){var r;const{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(r=this.getMinMaxElevation(i).minElevation)&&void 0!==r?r:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return e&&e.dem&&(r.minElevation=e.dem.min*this.exaggeration,r.maxElevation=e.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,r){const i=e.a0.fromLngLat(t.wrap()),n=(1<<r)*e.$,o=i.x*n,a=i.y*n,s=Math.floor(o/e.$),l=Math.floor(a/e.$);return{tileID:new e.Z(r,0,r,s,l),mercatorX:o,mercatorY:a}}}class Bo{constructor(t,e,r){this._context=t,this._size=e,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new e.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(i.texture),{id:t,fbo:r,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const jo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Uo{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Bo(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((r=>!t._layers[r].isHidden(e))),this._coordsAscending={};for(const r in t.sourceCaches){this._coordsAscending[r]={};const e=t.sourceCaches[r].getVisibleCoordinates(),i=t.sourceCaches[r].getSource(),n=i instanceof X?i.terrainTileRanges:null;for(const t of e){const e=this.terrain.sourceCache.getTerrainCoords(t,n);for(const t in e)this._coordsAscending[r][t]||(this._coordsAscending[r][t]=[]),this._coordsAscending[r][t].push(e[t])}}this._coordsAscendingStr={};for(const r of t._order){const e=t._layers[r],i=e.source;if(jo[e.type]&&!this._coordsAscendingStr[i]){this._coordsAscendingStr[i]={};for(const t in this._coordsAscending[i])this._coordsAscendingStr[i][t]=this._coordsAscending[i][t].map((t=>t.key)).sort().join()}}for(const r of this._renderableTiles)for(const t in this._coordsAscendingStr){const e=this._coordsAscendingStr[t][r.tileID.key];e&&e!==r.rttCoords[t]&&(r.rtt=[])}}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;const i=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(jo[n]&&(this._prevType&&jo[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(jo[this._prevType]||jo[n]&&a){this._prevType=n;const t=this._stacks.length-1,r=this._stacks[t]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(In(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){const e=this.pool.getObjectForId(n.rtt[t].id);if(e.stamp===n.rtt[t].stamp){this.pool.useObject(e);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),n.rtt[t]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:e.be.transparent,stencil:0}),o.currentStencilSource=void 0;for(let t=0;t<r.length;t++){const e=o.style._layers[r[t]],s=e.source?this._coordsAscending[e.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(e,s,!0),o.renderLayer(o,o.style.sourceCaches[e.source],e,s,i),e.source&&(n.rttCoords[e.source]=this._coordsAscendingStr[e.source][n.tileID.key])}}return In(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),jo[n]}return!1}}const Vo={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Go=r,$o={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ro,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:e.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},qo={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Zo{constructor(t,r,i=!1){this.mousedown=t=>{this.startMove(t,s.mousePos(this.element,t)),s.addEventListener(window,"mousemove",this.mousemove),s.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,s.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHanlder.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),s.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;const n=new ro;this._rotatePitchHanlder=new Jn({clickTolerance:3,move:(t,n)=>{const o=r.getBoundingClientRect(),a=new e.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:e.cm(new e.P(t.x,n.y),n,a),pitchDelta:i?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,s.addEventListener(r,"mousedown",this.mousedown),s.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),s.addEventListener(r,"touchcancel",this.reset)}startMove(t,e){this._rotatePitchHanlder.dragStart(t,e),s.disableDrag()}move(t,e){const r=this.map,{bearingDelta:i,pitchDelta:n}=this._rotatePitchHanlder.dragMove(t,e)||{};i&&r.setBearing(r.getBearing()+i),n&&r.setPitch(r.getPitch()+n)}off(){const t=this.element;s.removeEventListener(t,"mousedown",this.mousedown),s.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend),s.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){s.enableDrag(),s.removeEventListener(window,"mousemove",this.mousemove),s.removeEventListener(window,"mouseup",this.mouseup),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend)}}let Wo;function Ho(t,r,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return null==t?void 0:t.wrap();const o=new e.S(t.lng,t.lat);if(t=new e.S(t.lng,t.lat),r){const n=new e.S(t.lng-360,t.lat),o=new e.S(t.lng+360,t.lat),a=i.locationToScreenPoint(t).distSqr(r);i.locationToScreenPoint(n).distSqr(r)<a?t=n:i.locationToScreenPoint(o).distSqr(r)<a&&(t=o)}for(;Math.abs(t.lng-i.center.lng)>180;){const e=i.locationToScreenPoint(t);if(e.x>=0&&e.y>=0&&e.x<=i.width&&e.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t.lng!==o.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(t))?t:o}const Xo={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 Jo(t,e,r){const i=t.classList;for(const n in Xo)i.remove(`maplibregl-${r}-anchor-${n}`);i.add(`maplibregl-${r}-anchor-${e}`)}class Yo extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._lngLat=Ho(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),s.setTransform(this._element,`${Xo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),a.frameAsync(new AbortController).then((()=>{this._updateOpacity(t&&"moveend"===t.type)})).catch((()=>{}))},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.l("dragstart"))),this.fire(new e.l("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),"active"===this._state&&this.fire(new e.l("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div");const r=s.createNS("http://www.w3.org/2000/svg","svg"),i=41,n=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${i}px`),r.setAttributeNS(null,"width",`${n}px`),r.setAttributeNS(null,"viewBox",`0 0 ${n} ${i}`);const o=s.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=s.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=s.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.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 t of c){const e=s.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const u=s.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=s.createNS("http://www.w3.org/2000/svg","path");h.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"),u.appendChild(h);const d=s.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=s.createNS("http://www.w3.org/2000/svg","path");p.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"),d.appendChild(p);const f=s.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=s.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=s.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=s.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),a.appendChild(l),a.appendChild(u),a.appendChild(d),a.appendChild(f),a.appendChild(m),r.appendChild(a),r.setAttributeNS(null,"height",i*this._scale+"px"),r.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(r),this._offset=e.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Jo(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),s.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.S.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,r=13.5,i=Math.abs(r)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[i,-1*(e-r+i)],"bottom-right":[-i,-1*(e-r+i)],left:[r,-1*(e-r)],right:[-13.5,-1*(e-r)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var r,i;const n=null===(r=this._map)||void 0===r?void 0:r.terrain,o=this._map.transform.isLocationOccluded(this._lngLat);if(!n||o){const t=o?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const a=this._map,s=a.terrain.depthAtPoint(this._pos),l=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006)return void(this._element.style.opacity=this._opacity);const c=-this._offset.y/a.transform.pixelsPerMeter,u=Math.sin(a.getPitch()*Math.PI/180)*c,h=a.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),d=a.transform.lngLatToCameraDepth(this._lngLat,l+u)-h>.006;(null===(i=this._popup)||void 0===i?void 0:i.isOpen())&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return(void 0===this._opacity||void 0===t&&void 0===e)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const Ko={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Qo=0,ta=!1;const ea={maxWidth:100,unit:"metric"};function ra(t,e,r){const i=r&&r.maxWidth||100,n=t._container.clientHeight/2,o=t._container.clientWidth/2,a=t.unproject([o-i/2,n]),s=t.unproject([o+i/2,n]),l=Math.round(t.project(s).x-t.project(a).x),c=Math.min(i,l,t._container.clientWidth),u=a.distanceTo(s);if(r&&"imperial"===r.unit){const r=3.2808*u;r>5280?ia(e,c,r/5280,t._getUIString("ScaleControl.Miles")):ia(e,c,r,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?ia(e,c,u/1852,t._getUIString("ScaleControl.NauticalMiles")):u>=1e3?ia(e,c,u/1e3,t._getUIString("ScaleControl.Kilometers")):ia(e,c,u,t._getUIString("ScaleControl.Meters"))}function ia(t,e,r,i){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let r=t/e;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(r),e*r}(r);t.style.width=e*(n/r)+"px",t.innerHTML=`${n} ${i}`}const na={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},oa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function aa(t){if(t){if("number"==typeof t){const r=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(r,r),"top-right":new e.P(-r,r),bottom:new e.P(0,-t),"bottom-left":new e.P(r,-r),"bottom-right":new e.P(-r,-r),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const r=e.P.convert(t);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:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return aa(new e.P(0,0))}const sa=r;t.AJAXError=e.cy,t.Event=e.l,t.Evented=e.E,t.LngLat=e.S,t.MercatorCoordinate=e.a0,t.Point=e.P,t.addProtocol=e.cz,t.config=e.a,t.removeProtocol=e.cA,t.AttributionControl=Lo,t.BoxZoomHandler=qn,t.CanvasSource=Y,t.CooperativeGesturesHandler=Eo,t.DoubleClickZoomHandler=bo,t.DragPanHandler=So,t.DragRotateHandler=To,t.EdgeInsets=Pe,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.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(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){s.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=s.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);s.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_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 e.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.l("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()}},t.GeoJSONSource=H,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const r=new e.S(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=this._map.getBearing(),o=e.e({bearing:n},this.options.fitBoundsOptions),a=G.fromLngLat(r,i);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const r=new e.S(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.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=t=>{if(this._map){if(1===t.code){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 t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&ta)return;this.options.trackUserLocation&&this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=s.create("button","maplibregl-ctrl-geolocate",this._container),s.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Yo({element:this._dotElement}),this._circleElement=s.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Yo({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",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.l("trackuserlocationend")),this.fire(new e.l("userlocationlostfocus")))}))}},this.options=e.e({},Ko,t)}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,(function*(t=!1){if(void 0!==Wo&&!t)return Wo;if(void 0===window.navigator.permissions)return Wo=!!window.navigator.geolocation,Wo;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Wo="denied"!==t.state}catch(t){Wo=!!window.navigator.geolocation}return Wo}))}().then((t=>this._finishSetupUI(t))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(),s.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Qo=0,ta=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitude<e.getWest()||r.longitude>e.getEast()||r.latitude<e.getSouth()||r.latitude>e.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 t=this._map.getBounds(),e=t.getSouthEast(),r=t.getNorthEast(),i=e.distanceTo(r),n=Math.ceil(this._accuracy/(i/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return e.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 e.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Qo--,ta=!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 e.l("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 e.l("trackuserlocationstart")),this.fire(new e.l("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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Qo++,Qo>1?(t={maximumAge:6e5,timeout:0},ta=!0):(t=this.options.positionOptions,ta=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}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)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;const e=null===(t=this._map.getProjection())||void 0===t?void 0:t.type;this._map.setProjection("mercator"!==e&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(t=this._map.getProjection())||void 0===t?void 0:t.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=s.create("button","maplibregl-ctrl-globe",this._container),s.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=Cn,t.ImageSource=X,t.KeyboardHandler=mo,t.LngLatBounds=G,t.LogoControl=Do,t.Map=class extends Mo{constructor(t){var r,i;e.cv.mark(e.cw.create);const n=Object.assign(Object.assign(Object.assign({},$o),t),{canvasContextAttributes:Object.assign(Object.assign({},$o.canvasContextAttributes),t.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new De,a=new Ne;if(void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),super(o,a,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new zo,this._controls=[],this._mapId=e.a6(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.l("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.l("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},Vo),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=f.addThrottleControl((()=>this.isMoving())),this._requestManager=new m(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=kn((t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())}),50);this._resizeObserver=new ResizeObserver((r=>{t?e(r):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Ao(this,n),this._hash=n.hash&&new Cn("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,e.e({},n.fitBoundsOptions,{duration:0}))));const s="string"==typeof n.style||!("globe"===(null===(i=null===(r=n.style)||void 0===r?void 0:r.projection)||void 0===i?void 0:i.type));this.resize(null,s),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Lo("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Do,n.logoPosition),this.on("style.load",(()=>{if(s||this._resizeTransform(),this.transform.unmodified){const t=e.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.l(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.l(`${t.dataType}dataloading`,t))})),this.on("dataabort",(t=>{this.fire(new e.l("sourcedataabort",t))}))}_getMapId(){return this._mapId}setGlobalStateProperty(t,e){return this.style.setGlobalStateProperty(t,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,r,i){return null==i&&this.terrain&&(i=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,r,i)}resize(t,r=!0){const[i,n]=this._containerDimensions(),o=this._getClampedPixelRatio(i,n);if(this._resizeCanvas(i,n,o),this.painter.resize(i,n,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(i,n);this._resizeCanvas(i,n,e),this.painter.resize(i,n,e)}this._resizeTransform(r);const a=!this._moving;return a&&(this.stop(),this.fire(new e.l("movestart",t)).fire(new e.l("move",t))),this.fire(new e.l("resize",t)),a&&this.fire(new e.l("moveend",t)),this}_resizeTransform(t=!0){var e;const[r,i]=this._containerDimensions();this.transform.resize(r,i,t),null===(e=this._requestedCameraState)||void 0===e||e.resize(r,i,t)}_getClampedPixelRatio(t,e){const{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),o=t*n,a=e*n;return Math.min(o>r?r/o:1,a>i?i/a:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(G.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.setMinZoom(t),this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.setMaxZoom(t),this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.setMinPitch(t),this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>180)throw new Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch)return this.transform.setMaxPitch(t),this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}project(t){return this.transform.locationToScreenPoint(e.S.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,r){if("mouseenter"===t||"mouseover"===t){let i=!1;const n=n=>{const o=e.filter((t=>this.getLayer(t))),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?i||(i=!0,r.call(this,new Bn(t,this,n.originalEvent,{features:a}))):i=!1};return{layers:e,listener:r,delegates:{mousemove:n,mouseout:()=>{i=!1}}}}if("mouseleave"===t||"mouseout"===t){let i=!1;const n=n=>{const o=e.filter((t=>this.getLayer(t)));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?i=!0:i&&(i=!1,r.call(this,new Bn(t,this,n.originalEvent)))},o=e=>{i&&(i=!1,r.call(this,new Bn(t,this,e.originalEvent)))};return{layers:e,listener:r,delegates:{mousemove:n,mouseout:o}}}{const i=t=>{const i=e.filter((t=>this.getLayer(t))),n=0!==i.length?this.queryRenderedFeatures(t.point,{layers:i}):[];n.length&&(t.features=n,r.call(this,t),delete t.features)};return{layers:e,listener:r,delegates:{[t]:i}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,r){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const i=this._delegatedListeners[t];for(let n=0;n<i.length;n++){const t=i[n];if(t.listener===r&&t.layers.length===e.length&&t.layers.every((t=>e.includes(t)))){for(const e in t.delegates)this.off(e,t.delegates[e]);return void i.splice(n,1)}}}on(t,e,r){if(void 0===r)return super.on(t,e);const i="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,i,r);this._saveDelegatedListener(t,n);for(const o in n.delegates)this.on(o,n.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(t,i,r)}}}once(t,e,r){if(void 0===r)return super.once(t,e);const i="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,i,r);for(const o in n.delegates){const e=n.delegates[o];n.delegates[o]=(...n)=>{this._removeDelegatedListener(t,i,r),e(...n)}}this._saveDelegatedListener(t,n);for(const o in n.delegates)this.once(o,n.delegates[o]);return this}off(t,e,r){return void 0===r?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,r),this)}queryRenderedFeatures(t,r){if(!this.style)return[];let i;const n=t instanceof e.P||Array.isArray(t),o=n?t:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:t)||{},o instanceof e.P||"number"==typeof o[0])i=[e.P.convert(o)];else{const t=e.P.convert(o[0]),r=e.P.convert(o[1]);i=[t,new e.P(r.x,t.y),r,new e.P(t.x,r.y),t]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,r){return!1!==(r=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var r,i;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new wr(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,n):this.style.loadJSON(t,e,n),this):(null===(i=null===(r=this.style)||void 0===r?void 0:r.projection)||void 0===i||i.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new wr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){if("string"==typeof t){const i=this._requestManager.transformRequest(t,"Style");e.j(i,new AbortController).then((t=>{this._updateDiff(t.data,r)})).catch((t=>{t&&this.fire(new e.k(t))}))}else"object"==typeof t&&this._updateDiff(t,r)}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(i){e.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const r=this.style&&this.style.sourceCaches[t];if(void 0!==r)return r.loaded();this.fire(new e.k(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const r=this.style.sourceCaches[t.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&r.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===t.source&&e.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."),"color-relief"===r.type&&r.source===t.source&&e.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new No(this.painter,r,t),this.painter.renderToTexture=new Uo(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=e=>{var r;"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(r=e.source)||void 0===r?void 0:r.type)?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(e.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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new e.l("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const r=t[e]._tiles;for(const t in r){const e=r[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,e,r){if(r){const i=this.getSource(r);if(!i)throw new Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=mt(Math.max(1,t),Math.max(1,e))}else for(const i in this.style.sourceCaches)this.style.sourceCaches[i].getSource().calculateTileZoom=mt(Math.max(1,t),Math.max(1,e));return this._update(!0),this}refreshTiles(t,r){const i=this.style.sourceCaches[t];if(!i)throw new Error(`There is no source cache with ID "${t}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map((t=>new e.a3(t.z,t.x,t.y))))}addImage(t,r,i={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=i;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||e.b(r))){if(void 0===r.width||void 0===r.height)return this.fire(new e.k(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:i,height:a,data:d}=r,p=r;return this.style.addImage(t,{data:new e.R({width:i,height:a},new Uint8Array(d)),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,t),this}}{const{width:i,height:d,data:p}=a.getImageData(r);this.style.addImage(t,{data:new e.R({width:i,height:d},p),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(t,r){const i=this.style.getImage(t);if(!i)return this.fire(new e.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=r instanceof HTMLImageElement||e.b(r)?a.getImageData(r):r,{width:o,height:s,data:l}=n;if(void 0===o||void 0===s)return this.fire(new e.k(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(o!==i.data.width||s!==i.data.height)return this.fire(new e.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(r instanceof HTMLImageElement||e.b(r));return i.data.replace(l,c),this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.k(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return f.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)}setFilter(t,e,r={}){return this.style.setFilter(t,e,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,r,i={}){return this.style.setPaintProperty(t,e,r,i),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,r,i={}){return this.style.setLayoutProperty(t,e,r,i),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,r,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=s.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=s.create("canvas","maplibregl-canvas",e),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 r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);const n=this._controlContainer=s.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{o[t]=s.create("div",`maplibregl-ctrl-${t} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",(r=>{e={requestedAttributes:t},r&&(e.statusMessage=r.statusMessage,e.type=r.type)}),{once:!0});let r=null;if(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!r){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new Pn(r,this.transform),l.testSupport(r)}migrateProjection(t,r){super.migrateProjection(t,r),this.painter.transform=t,this.fire(new e.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,i,n,o,s;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,r=a.now();this.style.zoomHistory.update(t,r);const i=new e.F(t,{now:r,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),n=i.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(i)}const h=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(s=this.style.projection)||void 0===s?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new e.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.cv.mark(e.cw.load),this.fire(new e.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,e.cv.mark(e.cw.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const e of this._controls)e.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),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==r?void 0:r.loseContext)&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),s.remove(this._canvasContainer),s.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),e.cv.clearMetrics(),this._removed=!0,this.fire(new e.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,a.frame(this._frameRequest,(t=>{e.cv.frame(t),this._frameRequest=null;try{this._render(t)}catch(t){if(!e.cx(t)&&!function(t){return t.message===qi}(t))throw t}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return Go}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},t.MapMouseEvent=Bn,t.MapTouchEvent=jn,t.MapWheelEvent=Un,t.Marker=Yo,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,e)=>{const r=this._map._getUIString(`NavigationControl.${e}`);t.title=r,t.setAttribute("aria-label",r)},this.options=e.e({},qo,t),this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),s.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),s.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=s.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Zo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){s.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const r=s.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}},t.Popup=class extends e.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&s.remove(this._content),this._container&&(s.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 e.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=s.create("div","maplibregl-popup",this._map.getContainer()),this._tip=s.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);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=Ho(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const e=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor;const i=aa(this.options.offset);if(!r){const t=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=e.y+i.bottom.y<n?["top"]:e.y>this._map.transform.height-n?["bottom"]:[],e.x<t/2?o.push("left"):e.x>this._map.transform.width-t/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}let n=e.add(i[r]);this.options.subpixelPositioning||(n=n.round()),s.setTransform(this._container,`${Xo[r]} translate(${n.x}px,${n.y}px)`),Jo(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(na),t)}addTo(t){return this._map&&this.remove(),this._map=t,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 e.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.S.convert(t),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(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),r=document.createElement("body");let i;for(r.innerHTML=t;i=r.firstChild,i;)e.appendChild(i);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=s.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 t=this._container.querySelector(oa);t&&t.focus()}},t.RasterDEMTileSource=W,t.RasterTileSource=Z,t.ScaleControl=class{constructor(t){this._onMove=()=>{ra(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ra(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ea),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=vo,t.Style=wr,t.TerrainControl=class{constructor(t){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=t}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=s.create("button","maplibregl-ctrl-terrain",this._container),s.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(){s.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=po,t.TwoFingersTouchRotateHandler=uo,t.TwoFingersTouchZoomHandler=lo,t.TwoFingersTouchZoomRotateHandler=Io,t.VectorTileSource=q,t.VideoSource=J,t.addSourceType=(t,r)=>e._(void 0,void 0,void 0,(function*(){if(Q(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{K[t]=e})(t,r)})),t.clearPrewarmedResources=function(){const t=L;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(A),L=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()"))},t.createTileMesh=Xe,t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return it().getRTLTextPluginStatus()},t.getVersion=function(){return sa},t.getWorkerCount=function(){return M.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return F().broadcast("IS",t)},t.prewarm=function(){z().acquire(A)},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setRTLTextPlugin=function(t,e){return it().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){M.workerCount=t},t.setWorkerUrl=function(t){e.a.WORKER_URL=t}})),t}()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{AnimationConfig:()=>o.AnimationConfig,AnimationDrawingConfig:()=>o.AnimationDrawingConfig,AnimationStatus:()=>o.AnimationStatus,Banner:()=>Yt,BasicCategory:()=>c.BasicCategory,BasicWithIcon:()=>c.BasicWithIcon,BasicWithLogo:()=>c.BasicWithLogo,CameraAnimation:()=>g.CameraAnimation,Category:()=>c.Category,Configuration:()=>u.Configuration,CssComponent:()=>h.CssComponent,CssCustomization:()=>h.CssCustomization,CssDefinitions:()=>h.CssDefinitions,CssElement:()=>h.CssElement,CssScreen:()=>h.CssScreen,CssTheme:()=>h.CssTheme,DaysOfTheWeek:()=>v.DaysOfTheWeek,DrawRouteConfiguration:()=>n.DrawRouteConfiguration,FitOptions:()=>d.FitOptions,GetRouteConfiguration:()=>n.GetRouteConfiguration,GradientStyle:()=>b.GradientStyle,HealthResponse:()=>t.HealthResponse,IdLocation:()=>n.IdLocation,InnerFloor:()=>p.InnerFloor,Institution:()=>ue,InternalLinkCategory:()=>c.InternalLinkCategory,LatLng:()=>f.LatLng,LazarilloMap:()=>l.LazarilloMap,LazarilloSDK:()=>x.LazarilloSDK,LzLocation:()=>m.LzLocation,LzPlace:()=>ne,LzRoute:()=>Zt,LzRouteLeg:()=>Wt,LzRouteStep:()=>Ht,LzTransport:()=>de,MapCamera:()=>g.MapCamera,MapConfig:()=>_.MapConfig,MarkerConfig:()=>e.MarkerConfig,MultiLanguage:()=>y.MultiLanguage,NestedCategory:()=>c.NestedCategory,OpeningHours:()=>v.OpeningHours,OpeningTime:()=>v.OpeningTime,PhoneCategory:()=>c.PhoneCategory,PlaceCategory:()=>c.PlaceCategory,ProductCategory:()=>c.ProductCategory,Property:()=>a.Property,RealtimeSchedule:()=>s.RealtimeSchedule,RouteLocation:()=>n.RouteLocation,RouteStyle:()=>b.RouteStyle,Schedule:()=>s.Schedule,SolidStyle:()=>b.SolidStyle,TextCategory:()=>c.TextCategory,TextPosition:()=>D,UrlCategory:()=>c.UrlCategory,initializeSDK:()=>Pr,isBasicWithIcon:()=>hr,isBasicWithLogo:()=>ur,loadCustomization:()=>Mr});var t={};r.r(t);var e={};r.r(e),r.d(e,{D:()=>O,x:()=>D});var n={};r.r(n),r.d(n,{D_:()=>dt,lc:()=>ht,sZ:()=>ut});var o={};r.r(o),r.d(o,{o:()=>_t,U:()=>yt});var a={};r.r(a),r.d(a,{n:()=>le});var s={};r.r(s),r.d(s,{Q:()=>de});var l={};r.r(l),r.d(l,{O:()=>cr});var c={};r.r(c),r.d(c,{Y:()=>hr,c:()=>ur});var u={};r.r(u);var h={};r.r(h);var d={};r.r(d);var p={};r.r(p);var f={};r.r(f);var m={};r.r(m);var g={};r.r(g);var _={};r.r(_);var y={};r.r(y);var v={};r.r(v);var b={};r.r(b);var x={};r.r(x),r.d(x,{f:()=>Pr});var w=r(443),S=r.n(w);function T(t){var e={lat:-1/0,lng:-1/0},r={lat:1/0,lng:1/0};return t.forEach((function(t){t.lat>e.lat&&(e.lat=t.lat),t.lng>e.lng&&(e.lng=t.lng),t.lat<r.lat&&(r.lat=t.lat),t.lng<r.lng&&(r.lng=t.lng)})),[r,e]}function I(t,e,r){return e=P(e),function(t,e){if(e&&("object"==C(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,E()?Reflect.construct(e,r||[],P(t).constructor):e.apply(t,r))}function E(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(E=function(){return!!t})()}function P(t){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},P(t)}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},k(t,e)}function C(t){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,L(i.key),i)}}function R(t,e,r){return e&&M(t.prototype,e),r&&M(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function L(t){var e=function(t,e){if("object"!=C(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=C(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==C(e)?e:e+""}var D=function(t){return t[t.left=0]="left",t[t.right=1]="right",t[t.top=2]="top",t[t.bottom=3]="bottom",t}({}),z=function(){return R((function t(){A(this,t)}),null,[{key:"createMarkerElement",value:function(t){var e=document.createElement("div");e.addEventListener("click",(function(){var e;null===(e=t.onClick)||void 0===e||e.call(t)}));var r="40px",i="40px";if(t.element){var n,o,a;e.appendChild(t.element);var s=null===(n=e.getElementsByTagName("img"))||void 0===n?void 0:n[0];return r="".concat(null!==(o=null==s?void 0:s.height)&&void 0!==o?o:40,"px"),i="".concat(null!==(a=null==s?void 0:s.width)&&void 0!==a?a:40,"px"),this.setAndCreateText(t,e,r,i)}var l=document.createElement("div");if(l.id="element",l.style.display="flex",l.style.justifyContent="center",l.style.alignItems="center",l.style.cursor="pointer",e.appendChild(l),"string"==typeof t.icon){var c=this.createIcon(t);r=c.style.height,i=c.style.width,l.appendChild(c)}else if(t.icon instanceof HTMLImageElement)r="".concat(t.icon.height,"px"),i="".concat(t.icon.width,"px"),l.appendChild(t.icon);else if(t.icon){var u,h,d,p=null===(u=t.icon.getElementsByTagName("img"))||void 0===u?void 0:u[0];r="".concat(null!==(h=null==p?void 0:p.height)&&void 0!==h?h:40,"px"),i="".concat(null!==(d=null==p?void 0:p.width)&&void 0!==d?d:40,"px"),l.appendChild(t.icon)}return this.setAndCreateText(t,l,r,i),e}},{key:"setAndCreateText",value:function(t,e,r,i){if("string"==typeof t.text){var n=this.createTextElement(t.text,t.textProperties),o=this.setMarkerTextStyle(n,r,i,t.textPosition);e.appendChild(o)}else if(t.text){var a=this.setMarkerTextStyle(t.text,r,i,t.textPosition);e.appendChild(a)}return e}},{key:"setMarkerTextStyle",value:function(t,e,r,i){switch(t.style.position="absolute",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.width="max-content",i){case D.top:t.style.bottom=e;break;case D.bottom:t.style.top=e;break;case D.left:t.style.right=r;break;default:t.style.left=r}return t}},{key:"createIcon",value:function(t){var e,r,i,n,o=document.createElement("img");return o.src="string"==typeof t.icon?t.icon:"",o.width=null!==(e=null===(r=t.iconProperties)||void 0===r?void 0:r.width)&&void 0!==e?e:40,o.height=null!==(i=null===(n=t.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:40,o.style.objectFit="contain",o.style.filter="drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25))",o}},{key:"createTextElement",value:function(t,e){var r,i,n,o,a,s,l,c=document.createElement("p");return c.textContent=t,c.style.fontSize=null!==(r=null==e?void 0:e.fontSize)&&void 0!==r?r:"14px",c.style.padding=null!==(i=null==e?void 0:e.padding)&&void 0!==i?i:"0px",c.style.margin=null!==(n=null==e?void 0:e.margin)&&void 0!==n?n:"0px",c.style.fontWeight=null!==(o=null==e?void 0:e.fontWeight)&&void 0!==o?o:"600",c.style.fontFamily=null!==(a=null==e?void 0:e.fontFamily)&&void 0!==a?a:"'Open Sans', sans-serif",c.style.color=null!==(s=null==e?void 0:e.color)&&void 0!==s?s:"#000000",c.style.textShadow=null!==(l=null==e?void 0:e.textShadow)&&void 0!==l?l:"-1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff",c}}])}(),O=function(t){function e(t){var r,i,n,o;return A(this,e),(o=I(this,e,[{element:z.createMarkerElement(t),draggable:!1}])).setLngLat([t.coordinate.lng,t.coordinate.lat]),o.setRotationAlignment(null!==(r=t.rotationAlignment)&&void 0!==r?r:"viewport"),o.setPitchAlignment("viewport"),o.id=null!==(i=t.id)&&void 0!==i?i:function(){for(var t="",e="0123456789ABCDEF",r=0;r<10;r++)t+=e.charAt(Math.floor(16*Math.random()));return t}(),o.coordinate=t.coordinate,o.floorId=null!==(n=t.floorId)&&void 0!==n?n:"",o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k(t,e)}(e,t),R(e,[{key:"addToMap",value:function(t){t&&this.addTo(t)}},{key:"updateIcon",value:function(t){var e;if(t.element)this._element.innerHTML="",this._element.appendChild(t.element);else{var r,i=z.createMarkerElement(t),n=this._element.querySelector("div"),o=i.querySelector("div");o&&(null==n||null===(r=n.parentElement)||void 0===r||r.replaceChild(o,n))}this.setRotationAlignment(null!==(e=t.rotationAlignment)&&void 0!==e?e:"viewport"),this.setPitchAlignment("viewport")}},{key:"setFloor",value:function(t){this.floorId=t}},{key:"hide",value:function(){this.remove()}},{key:"show",value:function(t){t&&this.addTo(t)}},{key:"changeFloor",value:function(t,e){t==this.floorId?this.show(e):this.hide()}}])}(w.Marker);function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}function N(t,e,r){return r&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,B(i.key),i)}}(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function B(t){var e=function(t,e){if("object"!=F(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=F(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==F(e)?e:e+""}var j=Math.asin,U=Math.atan2,V=Math.cos,G=Math.sin,$=Math.pow,q=Math.sqrt,Z=Math.PI;function W(t){return G(t/2)*G(t/2)}function H(t){return t*(Z/180)}function X(t){return t*(180/Z)}function J(t,e){return t.lat===e.lat&&t.lng===e.lng}var Y=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return N(t,0,[{key:"distance",value:function(e,r){var i=H(e.lat),n=H(r.lat),o=H(e.lng),a=H(r.lng)-o,s=W(n-i)+V(i)*V(n)*W(a);return 2*t.EARTH_RADIUS*j(q(s))}},{key:"intermediatePointBetween",value:function(e,r,i){var n=H(e.lat),o=H(r.lat),a=H(e.lng),s=H(r.lng),l=t.distance(e,r)/t.EARTH_RADIUS,c=G((1-i)*l)/G(l),u=G(i*l)/G(l),h=c*V(n)*V(a)+u*V(o)*V(s),d=c*V(n)*G(a)+u*V(o)*G(s),p=c*G(n)+u*G(o),f=U(p,q($(h,2)+$(d,2))),m=U(d,h);return{lat:X(f),lng:X(m)}}},{key:"bearingInDegBetween",value:function(e,r){return X(t.bearingInRadBetween(e,r))}},{key:"bearingInRadBetween",value:function(t,e){var r=e.lng-t.lng,i=e.lat-t.lat;return(Z/2-U(i,r)+2*Z)%(2*Z)}},{key:"intermediateAngleBetween",value:function(t,e,r){var i=(e-t+180)%360-180;return i<-180&&(i+=360),(t+360+i*r)%360}}])}();function K(t){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(t)}function Q(t){return function(t){if(Array.isArray(t))return tt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return tt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function et(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,it(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function rt(t,e,r){return(e=it(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function it(t){var e=function(t,e){if("object"!=K(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=K(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==K(e)?e:e+""}!function(t,e,r){(e=B(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(Y,"EARTH_RADIUS",6378e3);var nt=function(){return et((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),rt(this,"AHEAD_ID","AHEAD_ID"),rt(this,"BEHIND_ID","BEHIND_ID"),rt(this,"CURRENT_ID","CURRENT_ID"),rt(this,"aheadSourceData",{type:"FeatureCollection",features:[]}),rt(this,"behindSourceData",{type:"FeatureCollection",features:[]}),rt(this,"currentSourceData",{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}),rt(this,"animationStatus","NO_ROUTE"),rt(this,"stepAnimationStatus","NO_ROUTE"),this.lazarilloMap=e}),[{key:"map",get:function(){return this.lazarilloMap.map}},{key:"addSourcesAndLayers",value:function(){this.map.addSource(this.AHEAD_ID,{type:"geojson",data:this.aheadSourceData}),this.map.addLayer({id:this.AHEAD_ID,type:"line",source:this.AHEAD_ID,layout:{"line-join":"round","line-cap":"round"}}),this.map.addSource(this.BEHIND_ID,{type:"geojson",data:this.behindSourceData}),this.map.addLayer({id:this.BEHIND_ID,type:"line",source:this.BEHIND_ID,layout:{"line-join":"round","line-cap":"round"}}),this.map.addSource(this.CURRENT_ID,{type:"geojson",data:this.currentSourceData}),this.map.addLayer({id:this.CURRENT_ID,type:"line",source:this.CURRENT_ID,layout:{"line-join":"round","line-cap":"round"}})}},{key:"addRoute",value:function(t,e){this.setSourceData(this.AHEAD_ID,t.steps),this.setLayerPaint(this.AHEAD_ID,e),this.updateLayerFilter(this.AHEAD_ID)}},{key:"setSourceData",value:function(t,e){var r=this.createFeaturesFrom(e),i=this.map.getSource(t);switch(t){case this.AHEAD_ID:this.aheadSourceData.features=r,null==i||i.setData(this.aheadSourceData);break;case this.BEHIND_ID:this.behindSourceData.features=r,null==i||i.setData(this.behindSourceData)}}},{key:"setCurrentSourceData",value:function(t){var e,r;this.currentSourceData.properties={floor_key:(null!==(e=null==t||null===(r=t.startInsideFloor)||void 0===r?void 0:r.length)&&void 0!==e?e:0)>0?null==t?void 0:t.startInsideFloor:this.lazarilloMap.getCurrentFloor()};var i=null==t?void 0:t.coordinates[0];this.currentSourceData.geometry.coordinates=null!=i?[[i.lng,i.lat]]:[];var n=this.map.getSource(this.CURRENT_ID);null==n||n.setData(this.currentSourceData)}},{key:"setLayerPaint",value:function(t,e){var r=this.preparePaintForLayer(e);for(var i in r)this.map.setPaintProperty(t,i,r[i])}},{key:"preparePaintForLayer",value:function(t){if("color"in t.routeStyle)return{"line-color":t.routeStyle.color,"line-gradient":null,"line-width":t.polylineWidth};var e=t.routeStyle,r=e.colors,i=e.positions;if(null==i&&(n=r.length,o=1/(n-1),i=Array.from({length:n},(function(t,e){return e*o}))),i.length!==r.length)throw new Error("Error: position array has different length than colors array");var n,o,a=function(t,e){return t.flatMap((function(t,r){return[t,e[r]]}))}(i,r);return{"line-color":null,"line-gradient":["interpolate",["linear"],["line-progress"]].concat(Q(a)),"line-width":t.polylineWidth}}},{key:"updateLayerFilter",value:function(t,e){var r=null!=e?e:this.lazarilloMap.getCurrentFloor();void 0!==r&&this.map.getStyle().layers.some((function(e){return e.id===t}))&&this.map.setFilter(t,["==",["get","floor_key"],r])}},{key:"createFeaturesFrom",value:function(t){var e=this.lazarilloMap.getCurrentFloor();return t.map((function(t){var r,i;return{type:"Feature",properties:{floor_key:(null!==(r=null===(i=t.startInsideFloor)||void 0===i?void 0:i.length)&&void 0!==r?r:0)>0?t.startInsideFloor:e},geometry:{type:"LineString",coordinates:t.geoJsonCoordinates}}}))}},{key:"updateRouteLayers",value:function(t){this.updateLayerFilter(this.AHEAD_ID,t),this.updateLayerFilter(this.BEHIND_ID,t),this.updateLayerFilter(this.CURRENT_ID,t)}},{key:"updateRouteMarkerVisibility",value:function(t){var e,r,i;(null===(e=this.routeMarker)||void 0===e?void 0:e.floorId)===t?null===(r=this.routeMarker)||void 0===r||r.show(this.map):null===(i=this.routeMarker)||void 0===i||i.hide()}},{key:"updatePlaceFloorForRouting",value:function(t,e){t&&e&&(this.lazarilloMap.updatePlaceAndFloorForRouting(t,e),this.updateRouteLayers(e),this.setMarkerFloor(e),this.updateRouteMarkerVisibility(e))}},{key:"startAnimating",value:function(t,e,r){var i,n,o,a,s=this;"NO_ROUTE"===this.animationStatus&&"NO_ROUTE"===this.stepAnimationStatus||this.clearForNextAnimation(),this.animationStatus="STARTED",this.route=t;var l=t.steps[0];this.updatePlaceFloorForRouting(l.startInsidePlace,l.startInsideFloor),this.setSourceData(this.AHEAD_ID,t.steps),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.properties={floor_key:(null!==(i=null===(n=l.startInsideFloor)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0?l.startInsideFloor:this.lazarilloMap.getCurrentFloor()},this.currentSourceData.geometry.coordinates=[[l.coordinates[0].lng,l.coordinates[0].lat]],this.setLayerPaint(this.AHEAD_ID,e.aheadConfig),this.setLayerPaint(this.BEHIND_ID,e.behindConfig),this.setLayerPaint(this.CURRENT_ID,e.behindConfig),this.animationConfig=r,this.routeMarker=new O({coordinate:l.startLocation,floorId:l.startInsideFloor,icon:e.routeIcon,rotationAlignment:"map"}),this.routeMarker.addToMap(this.map),null===(o=(a=this.animationConfig).callBack)||void 0===o||o.call(a,{isFinished:!1,step:l}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:requestAnimationFrame((function(t){return s.animateStep(t)})),onFinish:function(t){return s.prepareForNextStep(t)}}}},{key:"clearForNextAnimation",value:function(){var t;null===(t=this.routeMarker)||void 0===t||t.remove(),this.routeMarker=void 0,this.setSourceData(this.AHEAD_ID,[]),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.geometry.coordinates=[];var e=this.map.getSource(this.CURRENT_ID);null==e||e.setData(this.currentSourceData),"STARTED"!==this.animationStatus&&"ANIMATING"!==this.stepAnimationStatus||null==this.conditions||cancelAnimationFrame(this.conditions.animationId),this.animationStatus="NO_ROUTE",this.stepAnimationStatus="NO_ROUTE",this.conditions=void 0,this.animationConfig=void 0}},{key:"removeRoute",value:function(){this.clearForNextAnimation()}},{key:"internalPause",value:function(){"STARTED"==this.animationStatus&&null!=this.conditions&&(cancelAnimationFrame(this.conditions.animationId),this.animationStatus="PAUSED")}},{key:"pauseAnimation",value:function(){this.internalPause()}},{key:"internalResume",value:function(){var t=this;"PAUSED"==this.animationStatus&&null!=this.conditions&&(this.conditions.resetTime=!0,this.conditions.animationId=requestAnimationFrame((function(e){return t.animateStep(e)})),this.animationStatus="STARTED")}},{key:"resumeAnimation",value:function(){this.internalResume()}},{key:"restartAnimation",value:function(){var t,e,r,i,n,o=this;if("NO_ROUTE"===this.animationStatus)throw new Error("Does not exist animated route to restart");if(null==this.conditions||null==this.animationConfig||null==this.route||null==this.routeMarker)throw new Error("Error: conditions and animationConfig should not be null at this point");"STARTED"===this.animationStatus&&cancelAnimationFrame(this.conditions.animationId),this.animationStatus="STARTED";var a=this.route.steps[0];this.updatePlaceFloorForRouting(a.startInsidePlace,a.startInsideFloor),this.setSourceData(this.AHEAD_ID,this.route.steps),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.properties={floor_key:(null!==(t=null===(e=a.startInsideFloor)||void 0===e?void 0:e.length)&&void 0!==t?t:0)>0?a.startInsideFloor:this.lazarilloMap.getCurrentFloor()},this.currentSourceData.geometry.coordinates=[[a.coordinates[0].lng,a.coordinates[0].lat]];var s=this.map.getSource(this.CURRENT_ID);null==s||s.setData(this.currentSourceData),null===(r=this.setRotation(0))||void 0===r||r.setLngLat(a.startLocation).addTo(this.map),null===(i=(n=this.animationConfig).callBack)||void 0===i||i.call(n,{isFinished:!1,step:a}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:requestAnimationFrame((function(t){return o.animateStep(t)})),onFinish:function(t){return o.prepareForNextStep(t)}}}},{key:"stopAnimation",value:function(){"FINISHED"!=this.animationStatus&&(this.animationStatus="FINISHED")}},{key:"addStepAnimation",value:function(t,e,r){var i,n=this;"NO_ROUTE"===this.animationStatus&&"NO_ROUTE"===this.stepAnimationStatus||this.clearForNextAnimation(),this.stepAnimationStatus="WAITING",this.route=t;var o=t.steps[0];this.updatePlaceFloorForRouting(o.startInsidePlace,o.startInsideFloor),this.setSourceData(this.AHEAD_ID,t.steps),this.setSourceData(this.BEHIND_ID,[]),this.setCurrentSourceData(o),this.setLayerPaint(this.AHEAD_ID,e.aheadConfig),this.setLayerPaint(this.BEHIND_ID,e.behindConfig),this.setLayerPaint(this.CURRENT_ID,e.behindConfig),this.animationConfig=r,this.routeMarker=new O({coordinate:o.startLocation,floorId:o.startInsideFloor,icon:e.routeIcon,rotationAlignment:"map"}),this.routeMarker.addToMap(this.map),this.cameraFollow(o.startLocation),null===(i=r.callBack)||void 0===i||i.call(r,{isFinished:!1,step:o}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:0,isStepByStep:!0,onFinish:function(){if(null==n.conditions||null==n.animationConfig||null==n.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var e=n.conditions.index;e++;var i=n.route.steps.slice(0,e),o=n.route.steps.slice(e),a=n.route.steps[e];if(n.setSourceData(n.BEHIND_ID,i),n.setSourceData(n.AHEAD_ID,o),n.setCurrentSourceData(a),n.conditions.index=e,e<t.steps.length){var s,l=t.steps[e];null===(s=r.callBack)||void 0===s||s.call(r,{isFinished:!1,step:l})}else{var c;null===(c=r.callBack)||void 0===c||c.call(r,{isFinished:!0,step:null})}n.stepAnimationStatus="WAITING"}}}},{key:"nextStepAnimation",value:function(){var t=this;if("NO_ROUTE"===this.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");if("ANIMATING"===this.stepAnimationStatus&&cancelAnimationFrame(this.conditions.animationId),this.stepAnimationStatus="ANIMATING",!(this.conditions.index<this.route.steps.length))throw new Error("Error: Does not exist next step to animate");this.conditions.coordinatesIndex=0,this.conditions.startTime=void 0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,this.conditions.waitStartTime=void 0,this.conditions.animationId=requestAnimationFrame((function(e){return t.animateStep(e)}))}},{key:"previousStepAnimation",value:function(){if("NO_ROUTE"===this.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");"ANIMATING"===this.stepAnimationStatus&&cancelAnimationFrame(this.conditions.animationId),this.stepAnimationStatus="WAITING";var t,e,r=this.conditions.index;if(!(r>0))throw new Error("previous step doesn't exists to animate");r--;var i=this.route.steps.slice(0,r),n=this.route.steps.slice(r),o=this.route.steps[r];this.setSourceData(this.BEHIND_ID,i),this.setSourceData(this.AHEAD_ID,n),this.setCurrentSourceData(o),o.startInsideFloor!=o.endInsideFloor&&o.startInsideFloor&&this.updatePlaceFloorForRouting(o.startInsidePlace,o.startInsideFloor),this.conditions.index=r,this.conditions.coordinatesIndex=0,this.conditions.startTime=void 0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,this.conditions.waitStartTime=void 0,this.setLngLat(o.startLocation);var a=i.at(-1);if(null!=a){var s=a.coordinates.slice(-2),l=Y.bearingInDegBetween(s[0],s[1]);this.setRotation(l)}else this.setRotation(0);null===(t=(e=this.animationConfig).callBack)||void 0===t||t.call(e,{isFinished:!1,step:o})}},{key:"centerOnCurrentStep",value:function(){var t;if("NO_ROUTE"===this.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var e=null===(t=this.routeMarker)||void 0===t?void 0:t.getLngLat();if(!e)throw new Error("Error: marker has no position set");this.map.panTo(e)}},{key:"prepareForNextStep",value:function(t){var e=this;if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var r=this.conditions.index,i=this.route.steps.slice(0,r+1),n=this.route.steps.slice(r+1);if(this.setSourceData(this.BEHIND_ID,i),this.setSourceData(this.AHEAD_ID,n),this.currentSourceData.geometry.coordinates=[],r+1<this.route.steps.length){var o,a,s,l,c=this.route.steps[r+1];this.currentSourceData.geometry.coordinates.push([c.startLocation.lng,c.startLocation.lat]),this.currentSourceData.properties={floor_key:(null!==(o=null===(a=c.startInsideFloor)||void 0===a?void 0:a.length)&&void 0!==o?o:0)>0?c.startInsideFloor:this.lazarilloMap.getCurrentFloor()},this.conditions.startTime=t,this.conditions.index++,this.conditions.coordinatesIndex=0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,J(this.route.steps[r].endLocation,c.startLocation)||(this.conditions.nextFloorFirstStepIndex=r+2),this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})),null===(s=(l=this.animationConfig).callBack)||void 0===s||s.call(l,{isFinished:!1,step:this.route.steps[r+1]})}else{var u,h;null===(u=(h=this.animationConfig).callBack)||void 0===u||u.call(h,{isFinished:!0,step:null}),this.animationStatus="FINISHED"}}},{key:"animateStep",value:function(t){var e=this;if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions and animationConfig should not be null at this point");var r=this.conditions,i=r.startTime,n=r.resetTime,o=r.progress,a=this.conditions,s=a.coordinatesIndex,l=a.iconRotation,c=a.index,u=a.onFinish,h=a.rotatingIcon,d=a.waitStartTime,p=this.animationConfig,f=p.stepTime,m=p.minimumSpeed,g=p.iconRotationTime,_=p.changeFloorTime;if(null==i)return this.conditions.startTime=t,void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})));n?(i=t-o,this.conditions.startTime=i,n=!1,this.conditions.resetTime=n):(o=t-i,this.conditions.progress=o);var y=o/1e3,v=this.route.steps[c];if(v.coordinates.length<=0)null==u||u(t);else{var b=v.coordinates[s],x=v.coordinates[s+1];if(null!=b&&null!=x){var w;if(h){var S=Y.bearingInDegBetween(b,x);if(0===g||this.conditions.nextFloorFirstStepIndex===c||Math.abs(S-this.conditions.iconRotation)<15)return this.conditions.nextFloorFirstStepIndex=void 0,this.setRotation(S),this.conditions.startTime=t,this.conditions.rotatingIcon=!1,this.conditions.iconRotation=S,void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})));if(y<g){var T=Y.intermediateAngleBetween(l,S,y/g);return this.setRotation(T),void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})))}return this.setRotation(S),this.conditions.startTime=t,this.conditions.rotatingIcon=!1,this.conditions.iconRotation=S,void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})))}var I=Y.distance(b,x),E=Math.max(v.distance/f,null!=m?m:0);if(E*y>I){this.currentSourceData.geometry.coordinates.push([x.lng,x.lat]);var P=this.map.getSource(this.CURRENT_ID);if(null==P||P.setData(this.currentSourceData),s+2<v.coordinates.length){var k=v.coordinates[s+2];if(!J(x,k))if(this.conditions.isStepByStep)this.conditions.rotatingIcon=!0;else{var C,A=Y.bearingInDegBetween(x,k);this.conditions.iconRotation=A,null===(C=this.routeMarker)||void 0===C||C.setRotation(A)}return this.conditions.startTime=t,this.conditions.progress=0,this.conditions.coordinatesIndex++,void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})))}return v.startInsideFloor!==v.endInsideFloor?null==d?(this.conditions.waitStartTime=t,void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})))):t-d<1e3*_?void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)}))):(this.updatePlaceFloorForRouting(v.endInsidePlace,v.endInsideFloor),this.setLngLat(v.endLocation),this.conditions.waitStartTime=void 0,void(null==u||u(t))):void(null==u||u(t))}var M=E*y/I,R=0===I?x:Y.intermediatePointBetween(b,x,Math.min(M,1));this.currentSourceData.geometry.coordinates.push([R.lng,R.lat]);var L=this.map.getSource(this.CURRENT_ID);return null==L||L.setData(this.currentSourceData),this.setLngLat(R),null===(w=this.routeMarker)||void 0===w||w.addTo(this.map),void(this.conditions.animationId=requestAnimationFrame((function(t){return e.animateStep(t)})))}null==u||u(t)}}},{key:"setLngLat",value:function(t){var e,r;null!==(e=this.conditions)&&void 0!==e&&e.isStepByStep&&this.cameraFollow(t),null===(r=this.routeMarker)||void 0===r||r.setLngLat(t)}},{key:"setRotation",value:function(t){var e,r,i,n;return null!==(e=this.conditions)&&void 0!==e&&e.isStepByStep&&this.lazarilloMap.updateCamera({duration:null===(i=this.animationConfig)||void 0===i?void 0:i.iconRotationTime,animate:!0,bearing:t,center:null===(n=this.routeMarker)||void 0===n?void 0:n.getLngLat()}),null===(r=this.routeMarker)||void 0===r?void 0:r.setRotation(t)}},{key:"setMarkerFloor",value:function(t){var e;null===(e=this.routeMarker)||void 0===e||e.setFloor(t)}},{key:"cameraFollow",value:function(t){var e,r;this.lazarilloMap.updateCamera({center:t,animate:!0,bearing:null===(e=this.routeMarker)||void 0===e?void 0:e.getRotation(),duration:null===(r=this.animationConfig)||void 0===r?void 0:r.iconRotationTime})}}])}(),ot=["ar"];function at(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}function st(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var lt=function(t){return t.cardinal="CARDINAL",t.clock="CLOCK",t.relative="RELATIVE",t}({}),ct=function(t){return t.metric="METRIC",t.imperial="IMPERIAL",t.steps="STEPS",t}({}),ut=function(t){return t.walking="WALKING",t.driving="DRIVING",t.bicycling="BICYCLING",t.transit="TRANSIT",t}({}),ht=at((function t(e){var r,i,n,o;st(this,t),this.initialLocation=e.initialLocation,this.finalLocation=e.finalLocation,this.preferAccessibleRoute=null!==(r=e.preferAccessibleRoute)&&void 0!==r&&r,this.language=null!==(i=e.language)&&void 0!==i?i:"en",this.unitSystem=null!==(n=e.unitSystem)&&void 0!==n?n:ct.metric,this.announceFormat=null!==(o=e.announceFormat)&&void 0!==o?o:lt.relative})),dt=at((function t(e){var r,i;st(this,t),this.polylineWidth=null!==(r=e.polylineWidth)&&void 0!==r?r:10,this.routeStyle=null!==(i=e.routeStyle)&&void 0!==i?i:{type:"Solid",color:"#1257ED"}}));function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function ft(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,mt(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function mt(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=pt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==pt(e)?e:e+""}function gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _t=ft((function t(e){var r,i,n,o;gt(this,t),this.stepTime=null!==(r=e.stepTime)&&void 0!==r?r:3,this.minimumSpeed=null!==(i=e.minimumSpeed)&&void 0!==i?i:40,this.changeFloorTime=null!==(n=e.changeFloorTime)&&void 0!==n?n:0,this.iconRotationTime=null!==(o=e.iconRotationTime)&&void 0!==o?o:0,this.callBack=e.callBack})),yt=function(){return ft((function t(e){var r,i,n;if(gt(this,t),this.aheadPathStyle=null!==(r=e.aheadPathStyle)&&void 0!==r?r:{type:"Solid",color:"#757575"},this.behindPathStyle=null!==(i=e.behindPathStyle)&&void 0!==i?i:{type:"Solid",color:"#0076B6"},this.polylineWidth=null!==(n=e.polylineWidth)&&void 0!==n?n:10,null!=e.routeIcon)this.routeIcon=e.routeIcon;else{var o=new Image(40,40);o.src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjUuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDQwIDQwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MCA0MDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiMwMDc2QjY7fQoJLnN0MXtmaWxsOiNGRkZGRkY7fQo8L3N0eWxlPgo8Zz4KCTxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjIwIiBjeT0iMjAiIHI9IjIwIi8+Cgk8cGF0aCBjbGFzcz0ic3QxIiBkPSJNMTIuNCwyOS43Yy0wLjIsMC4xLTAuNCwwLjEtMC42LDAuMWMtMC4yLDAtMC40LTAuMS0wLjUtMC4zYy0wLjItMC4xLTAuMi0wLjMtMC4zLTAuNWMwLTAuMiwwLTAuNCwwLjEtMC42CgkJbDguMi0xNy44YzAuMi0wLjQsMC41LTAuNiwwLjktMC42YzAuNCwwLDAuNywwLjIsMC45LDAuNmw3LjksMTcuOWMwLjEsMC4yLDAuMSwwLjQsMC4xLDAuNmMwLDAuMi0wLjEsMC40LTAuMywwLjUKCQljLTAuMSwwLjEtMC4zLDAuMi0wLjUsMC4zYy0wLjIsMC0wLjQsMC0wLjYtMC4xTDIwLDI2LjVMMTIuNCwyOS43eiBNMTMuOSwyN2w2LjEtMi42bDYuMSwyLjdsLTYtMTMuOEwxMy45LDI3eiIvPgo8L2c+Cjwvc3ZnPgo=",this.routeIcon=o}}),[{key:"aheadConfig",get:function(){return new dt({polylineWidth:this.polylineWidth,routeStyle:this.aheadPathStyle})}},{key:"behindConfig",get:function(){return new dt({polylineWidth:this.polylineWidth,routeStyle:this.behindPathStyle})}}])}(),vt=r(773),bt=r.n(vt),xt=r(738),wt=r.n(xt),St={accessToken:"1e7e62a3edc14868b4098d653d0f33b9",captureUncaught:!0,captureUnhandledRejections:!0,payload:{environment:"testenv",client:{javascript:{code_version:"1.0"}}}};function Tt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Object.fromEntries(e.map((function(t,e){return[e,t]})))}function It(t){return It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(t)}function Et(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Pt(i.key),i)}}function Pt(t){var e=function(t,e){if("object"!=It(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=It(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==It(e)?e:e+""}var kt="f0c8d3b96d336e857a8628f49dd1baf7d7add0e9",Ct="https://countly.lazarillo.app",At=function(){function t(){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rollbar=new(wt())(St),bt().init({app_key:kt,url:Ct,app_version:"2.19.0-beta.2",session_update:10,debug:!1,require_consent:!1,namespace:"SDK JS"}),this.countly=null!==bt()&&void 0!==bt()?bt():{},this.countly.q=null!==(e=bt().q)&&void 0!==e?e:[],this.countly.q.push(["track_sessions","track_pageview","track_clicks","track_scrolls","track_errors","track_links","track_forms","collect_from_forms"])}return function(t,e,r){return e&&Et(t.prototype,e),r&&Et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"logEvent",value:function(t,e){this.countly.q.push(["add_event",{key:t,segmentation:e}])}},{key:"logDebug",value:function(){var t,e=Tt.apply(void 0,arguments);null===(t=this.rollbar)||void 0===t||t.captureEvent(e,"debug")}},{key:"logWarning",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i;null===(i=this.rollbar)||void 0===i||i.warning.apply(i,e)}},{key:"logError",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i;null===(i=this.rollbar)||void 0===i||i.error.apply(i,e)}},{key:"debugLog",value:function(){}}],[{key:"getInstance",value:function(){return null==t.instance&&(t.instance=new t),t.instance}}])}();function Mt(t){if(t instanceof Error)return t;var e=String(t);return new Error(e)}function Rt(t){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(t)}function Lt(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Dt(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Dt(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=Rt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==Rt(e)?e:e+""}var zt=function(){return Lt((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.logger=At.getInstance()}),[{key:"logEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.logger.logEvent(t,this.prepareSegmentation(e))}},{key:"logError",value:function(t){for(var e,r=Mt(t),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(e=this.logger).logError.apply(e,[r].concat(n))}},{key:"logWarning",value:function(t){for(var e,r=Mt(t),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(e=this.logger).logWarning.apply(e,[r].concat(n))}},{key:"logDebug",value:function(){var t;(t=this.logger).logDebug.apply(t,arguments)}},{key:"debugLog",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this.logger.debugLog(e)}}])}();const Ot={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Ft;const Nt=new Uint8Array(16);function Bt(){if(!Ft&&(Ft="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ft))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ft(Nt)}const jt=[];for(let r=0;r<256;++r)jt.push((r+256).toString(16).slice(1));const Ut=function(t,e,r){if(Ot.randomUUID&&!e&&!t)return Ot.randomUUID();const i=(t=t||{}).random||(t.rng||Bt)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=i[t];return e}return function(t,e=0){return jt[t[e+0]]+jt[t[e+1]]+jt[t[e+2]]+jt[t[e+3]]+"-"+jt[t[e+4]]+jt[t[e+5]]+"-"+jt[t[e+6]]+jt[t[e+7]]+"-"+jt[t[e+8]]+jt[t[e+9]]+"-"+jt[t[e+10]]+jt[t[e+11]]+jt[t[e+12]]+jt[t[e+13]]+jt[t[e+14]]+jt[t[e+15]]}(i)};function Vt(t){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(t)}function Gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $t(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,qt(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function qt(t){var e=function(t,e){if("object"!=Vt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=Vt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==Vt(e)?e:e+""}var Zt=function(){return $t((function t(e){var r=this;Gt(this,t),this.id=Ut(),this.legs=[],e.legs.forEach((function(t){var e=new Wt(t);r.legs.push(e)}))}),[{key:"steps",get:function(){return this.legs.flatMap((function(t){return t.steps}))}},{key:"duration",get:function(){return this.legs.map((function(t){return t.duration})).reduce((function(t,e){return t+e}),0)}},{key:"length",get:function(){return this.legs.map((function(t){return t.distance})).reduce((function(t,e){return t+e}),0)}}])}(),Wt=$t((function t(e){var r=this;Gt(this,t),this.distance=e.distance.value,this.duration=e.duration.value,this.startLocation=e.start_location,this.endLocation=e.end_location,this.steps=[],e.steps.forEach((function(t){var e=new Ht(t);r.steps.push(e)}))})),Ht=function(){return $t((function t(e){Gt(this,t),this.distance=e.distance.value,this.duration=e.duration.value,this.startLocation=e.start_location,this.startInsideFloor=e.start_inside_floor,this.startInsidePlace=e.start_inside_place,this.endLocation=e.end_location,this.endInsideFloor=e.end_inside_floor,this.endInsidePlace=e.end_inside_place,this.htmlInstruction=e.html_instructions,this.plainInstruction=e.plain_instructions,this.maneuver=e.maneuver,this.elevatorStep=e.elevator_step,this.showPopup=e.show_popup,this.iconPrefix=e.icon_prefix,this.polyline=new Xt(e.polyline)}),[{key:"geoJsonCoordinates",get:function(){return this.polyline.geoJsonCoordinates}},{key:"coordinates",get:function(){return this.polyline.coordinates}}])}(),Xt=function(){return $t((function t(e){Gt(this,t),this.points=e.points,this.pointsLatLng=e.points_lat_lng,this.overviewPoints=e.overview_points,this.decodedPoints=function(t,e){void 0===e&&(e=5);for(var r=Math.pow(10,e),i=t.length,n=new Array(Math.floor(t.length/2)),o=0,a=0,s=0,l=0;o<i;++l){var c=1,u=0,h=void 0;do{c+=(h=t.charCodeAt(o++)-63-1)<<u,u+=5}while(h>=31);a+=1&c?~(c>>1):c>>1,c=1,u=0;do{c+=(h=t.charCodeAt(o++)-63-1)<<u,u+=5}while(h>=31);s+=1&c?~(c>>1):c>>1,n[l]=[a/r,s/r]}return n.length=l,n}(e.points).map((function(t){return{lat:t[0],lng:t[1]}}))}),[{key:"geoJsonCoordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints.map((function(t){return[t.lng,t.lat]})):this.decodedPoints.map((function(t){return[t.lng,t.lat]}))}},{key:"coordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints:this.decodedPoints}}])}();function Jt(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}var Yt=Jt((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.url=e.url,this.tags=e.tags,this.urlAction=e.url_action,this.sameLink=e.sameLink}));function Kt(t){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(t)}function Qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function te(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Qt(Object(r),!0).forEach((function(e){ee(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ee(t,e,r){return(e=ie(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function re(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ie(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ie(t){var e=function(t,e){if("object"!=Kt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=Kt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==Kt(e)?e:e+""}var ne=function(){return re((function t(e){var r,i,n,o,a,s,l,c,u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var h=(null!==(r=e.tags)&&void 0!==r?r:[]).concat(null!==(i=e.keywords)&&void 0!==i?i:[]);for(var d in this.lazarilloId=e.id,this.clientId=null!==(n=e.alias)&&void 0!==n?n:e.externalId,this.title=e.title,this.hidePlace=h.includes("hide_search"),this.description=e.description,this.shortDescription=e.shortDescription,this.position={lat:e.lat,lng:e.lng},this.category=e.category,this.tags=null!==(o=e.tags)&&void 0!==o?o:[],this.generalCategory=e.general_category,this.localizedCategory=null!==(a=e.localizedCategory)&&void 0!==a?a:"",this.parentInstitutionId=e.parent_institution,this.inFloors=e.inFloor,this.innerFloors=[],e.innerFloors)this.innerFloors.push(te(te({},e.innerFloors[d]),{},{key:d}));this.innerFloors.sort((function(t,e){return t.index-e.index})),this.openingHours=e.opening_hours,this.address=e.address,this.transportLine=null===(s=e.properties)||void 0===s?void 0:s.filter((function(t){return"transport_line"===t.type})),e.logo&&(this.logo="string"==typeof e.logo?e.logo:e.logo.light),this.images=null!==(l=e.images)&&void 0!==l?l:[],this.banners=(null!==(c=e.banners)&&void 0!==c?c:[]).map((function(t){return new Yt(t)})),this.properties=le.parseProperties(null!==(u=e.properties)&&void 0!==u?u:[]),this.parentId=e.parent_id,this.parentType=e.parent_type,this.metadata=e.metadata}),[{key:"inFloor",value:function(t){var e=this;return t.find((function(t){var r;return t.key===(null===(r=e.inFloors)||void 0===r?void 0:r[0])}))}},{key:"toString",value:function(){return"LzPlace ".concat(this.lazarilloId)}}])}();function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function ae(t,e,r){return r&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,se(i.key),i)}}(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function se(t){var e=function(t,e){if("object"!=oe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=oe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==oe(e)?e:e+""}var le=function(){return ae((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}),0,[{key:"parseProperties",value:function(t){var e=this;try{var r=[];return t&&t.forEach((function(t){if(t.child_places){var i,n=t.child_places,o={childPlaces:[],title:t.key,subtitle:t.text,childParentPlace:t.child_parent_place,icon:t.icon,iconPrefix:null!==(i=t.iconPrefix)&&void 0!==i?i:"fas"};n.forEach((function(t){if("string"==typeof t)o.childPlaces.push(t);else{var e=new ne(t);o.childPlaces.push(e)}})),r.push(o)}else if(t.child_properties){var a,s=t.child_properties,l={childProperties:[],title:t.key,subtitle:t.text,childParentPlace:t.child_parent_place,icon:t.icon,iconPrefix:null!==(a=t.iconPrefix)&&void 0!==a?a:"fas"},c=e.parseProperties(s);l.childProperties=c,r.push(l)}else if(t.url){var u={title:t.key,subtitle:t.text,icon:t.icon,iconPrefix:t.iconPrefix,url:t.url,type:t.type};r.push(u)}else{var h,d={title:t.key,subtitle:t.text,childParentPlace:t.child_parent_place,icon:t.icon,type:t.type,iconPrefix:null!==(h=t.iconPrefix)&&void 0!==h?h:"fas"};r.push(d)}})),r}catch(i){return console.log(i),console.log(t),[]}}}])}();function ce(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}var ue=ce((function t(e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.lazarilloId=e.id,this.country=e.country,this.title=e.title,this.category=e.category,this.icon=e.icon,this.description=e.description,this.hasPlaces=e.hasPlaces,this.properties=le.parseProperties(null!==(r=e.properties)&&void 0!==r?r:[])}));function he(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}var de=he((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.schedule=e.schedules,this.routes=e.realtimeSchedules}));function pe(t){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(t)}function fe(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ge(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function me(t,e,r){return(e=ge(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ge(t){var e=function(t,e){if("object"!=pe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=pe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pe(e)?e:e+""}var _e=function(){return fe((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),me(this,"cachedPlaces",new Map),me(this,"cachedVehicles",new Map),me(this,"cachedStops",new Map),me(this,"cachedRoutes",new Map),me(this,"cachedAccessibleRoutes",new Map)}),[{key:"getPlace",value:function(t){return this.cachedPlaces.get(t)}},{key:"hasPlace",value:function(t){return this.cachedPlaces.has(t)}},{key:"setPlace",value:function(t,e){this.cachedPlaces.set(t,e)}},{key:"getVehicle",value:function(t){return this.cachedVehicles.get(t)}},{key:"setVehicle",value:function(t,e){this.cachedVehicles.set(t,e)}},{key:"getStops",value:function(t){return this.cachedStops.get(t)}},{key:"setStops",value:function(t,e){this.cachedStops.set(t,e)}},{key:"getRoute",value:function(t){return this.cachedRoutes.get(t)}},{key:"setRoute",value:function(t,e){this.cachedRoutes.set(t,e)}},{key:"getAccessibleRoute",value:function(t){return this.cachedAccessibleRoutes.get(t)}},{key:"setAccessibleRoute",value:function(t,e){this.cachedAccessibleRoutes.set(t,e)}},{key:"cleanRoutesCache",value:function(){this.cachedRoutes.clear()}},{key:"cleanAccessibleRoutesCache",value:function(){this.cachedAccessibleRoutes.clear()}}])}();function ye(t){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(t)}function ve(t){return function(t){if(Array.isArray(t))return be(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return be(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?be(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function be(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function xe(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */xe=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function _(){}function y(){}function v(){}var b={};c(b,a,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(M([])));w&&w!==r&&i.call(w,a)&&(b=w);var S=v.prototype=_.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(n,o,a,s){var l=h(t[n],t,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==ye(u)&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(u).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;n(this,"_invoke",{value:function(t,i){function n(){return new e((function(e,n){r(t,i,e,n)}))}return o=o?o.then(n,n):n()}})}function E(e,r,i){var n=d;return function(o,a){if(n===f)throw Error("Generator is already running");if(n===m){if("throw"===o)throw a;return{value:t,done:!0}}for(i.method=o,i.arg=a;;){var s=i.delegate;if(s){var l=P(s,i);if(l){if(l===g)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===d)throw n=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=f;var c=h(e,r,i);if("normal"===c.type){if(n=i.done?m:p,c.arg===g)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(n=m,i.method="throw",i.arg=c.arg)}}}function P(e,r){var i=r.method,n=e.iterator[i];if(n===t)return r.delegate=null,"throw"===i&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(ye(e)+" is not iterable")}return y.prototype=v,n(S,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:y,configurable:!0}),y.displayName=c(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},T(I.prototype),c(I.prototype,s,(function(){return this})),e.AsyncIterator=I,e.async=function(t,r,i,n,o){void 0===o&&(o=Promise);var a=new I(u(t,r,i,n),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var i in e)r.push(i);return r.reverse(),function t(){for(;r.length;){var i=r.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=M,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(i,n){return s.type="throw",s.arg=e,r.next=i,n&&(r.method="next",r.arg=t),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;C(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:M(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}function we(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(i,n)}function Se(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var o=t.apply(e,r);function a(t){we(o,i,n,a,s,"next",t)}function s(t){we(o,i,n,a,s,"throw",t)}a(void 0)}))}}function Te(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Ee(i.key),i)}}function Ie(t,e,r){return(e=Ee(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ee(t){var e=function(t,e){if("object"!=ye(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=ye(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==ye(e)?e:e+""}me(_e,"instance",new _e);var Pe=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Ie(this,"baseUrl","https://api.mapvx.com/sdk/"),Ie(this,"baseUrlMapVx","https://api.mapvx.com/api/"),this.lang=e}return function(t,e,r){return e&&Te(t.prototype,e),r&&Te(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"setLang",value:function(t){this.lang=t}},{key:"fetchTransport",value:(_=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,stopId:i,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v2/vehiclesWithSchedules",o,n));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e){return _.apply(this,arguments)})},{key:"fetchStops",value:(g=Se(xe().mark((function e(r,i,n){var o,a;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={method:"GET",headers:{"content-type":"application/json"}},a={token:r,stopId:i,vehicleId:n,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v2/stops",a,o));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e,r){return g.apply(this,arguments)})},{key:"fetchMapStyle",value:(m=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},null!=i&&(o.place_id=i),e.abrupt("return",t.fetchFromUrl(this.baseUrl+"mapStyleJson",o,n));case 4:case"end":return e.stop()}}),e,this)}))),function(t,e){return m.apply(this,arguments)})},{key:"fetchAllowedPlaces",value:(f=Se(xe().mark((function e(r){var i,n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:"GET",headers:{"content-type":"application/json"}},n={token:r,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v2/availablePlaces",n,i));case 3:case"end":return e.stop()}}),e,this)}))),function(t){return f.apply(this,arguments)})},{key:"fetchPlaceDetail",value:(p=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,place_id:i,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v3/place",o,n));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e){return p.apply(this,arguments)})},{key:"fetchSubPlaces",value:(d=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:i,targetPlace:r,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v3/subPlaces",o,n));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"fetchRoute",value:(h=Se(xe().mark((function e(r,i){var n,o,a,s,l,c,u,h,d,p,f,m,g,_,y;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(_ in n={method:"GET",headers:{"content-type":"application/json"}},o={fromLatLng:void 0,fromBuilding:void 0,fromFloor:void 0,toLatLng:void 0,toBuilding:void 0,toFloor:void 0,fromPlaceId:void 0,toPlaceId:void 0,travelMode:ut.walking,reducedMobility:r.preferAccessibleRoute?1:0,announceFormat:r.announceFormat,userBearing:0,lang:this.lang,unitSystem:r.unitSystem,token:i},"id"in r.initialLocation?o.fromPlaceId=r.initialLocation.id:(a=r.initialLocation,s=a.lat,l=a.lng,c=a.floorId,u=a.placeId,o.fromLatLng="".concat(s,",").concat(l),o.fromFloor=c,o.fromBuilding=u),"id"in r.finalLocation?o.toPlaceId=r.finalLocation.id:(h=r.finalLocation,d=h.lat,p=h.lng,f=h.floorId,m=h.placeId,o.toLatLng="".concat(d,",").concat(p),o.toFloor=f,o.toBuilding=m),g={},o)null!=(y=o[_])&&(g[_]=y);return e.abrupt("return",t.fetchFromUrl(this.baseUrl+"route",g,n));case 7:case"end":return e.stop()}}),e,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"fetchRouteV2",value:(u=Se(xe().mark((function e(r,i){var n,o,a,s,l,c,u,h,d,p,f,m,g,_,y;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(_ in n={method:"GET",headers:{"content-type":"application/json"}},o={fromLatLng:void 0,fromBuilding:void 0,fromFloor:void 0,toLatLng:void 0,toBuilding:void 0,toFloor:void 0,fromPlaceId:void 0,toPlaceId:void 0,travelMode:ut.walking,reducedMobility:r.preferAccessibleRoute?1:0,announceFormat:r.announceFormat,userBearing:0,lang:this.lang,unitSystem:r.unitSystem,token:i},"id"in r.initialLocation?o.fromPlaceId=r.initialLocation.id:(a=r.initialLocation,s=a.lat,l=a.lng,c=a.floorId,u=a.placeId,o.fromLatLng="".concat(s,",").concat(l),o.fromFloor=c,o.fromBuilding=u),"id"in r.finalLocation?o.toPlaceId=r.finalLocation.id:(h=r.finalLocation,d=h.lat,p=h.lng,f=h.floorId,m=h.placeId,o.toLatLng="".concat(d,",").concat(p),o.toFloor=f,o.toBuilding=m),g={},o)null!=(y=o[_])&&(g[_]=y);return e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v2/route",g,n));case 7:case"end":return e.stop()}}),e,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"fetchInstitutions",value:(c=Se(xe().mark((function e(r){var i,n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:"GET",headers:{"content-type":"application/json"}},n={token:r,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v2/institution",n,i));case 3:case"end":return e.stop()}}),e,this)}))),function(t){return c.apply(this,arguments)})},{key:"fetchSearchResults",value:(l=Se(xe().mark((function e(r,i,n,o){var a,s;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a={method:"GET",headers:{"content-type":"application/json"}},s={institution_id:r,input:i,lang:this.lang,token:n},o&&(s.parentPlaces=ve(o)),e.abrupt("return",t.fetchFromUrl(this.baseUrl+"v2/searchPlacesWithFilters",s,a));case 4:case"end":return e.stop()}}),e,this)}))),function(t,e,r,i){return l.apply(this,arguments)})},{key:"fetchConfiguration",value:(s=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},i&&(o.place_id=i),e.abrupt("return",t.fetchFromUrl(this.baseUrlMapVx+"configuration",o,n));case 4:case"end":return e.stop()}}),e,this)}))),function(t,e){return s.apply(this,arguments)})},{key:"fetchCategories",value:(a=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},i&&(o.id=i),e.abrupt("return",t.fetchFromUrl(this.baseUrlMapVx+"category",o,n));case 4:case"end":return e.stop()}}),e,this)}))),function(t,e){return a.apply(this,arguments)})},{key:"fetchRoutesForOrigin",value:(o=Se(xe().mark((function e(r,i,n,o,a,s){var l,c;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l={method:"GET",headers:{"content-type":"application/json"}},c={token:r,placeId:i,fromPlace:n,announceFormat:o,unitSystem:a,mode:s,lang:this.lang},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"routes_for_origin",c,l));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e,r,i,n,a){return o.apply(this,arguments)})},{key:"fetchCacheTimestamp",value:(n=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,placeId:i},e.abrupt("return",t.fetchFromUrl(this.baseUrl+"cache_timestamp",o,n));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"fetchCssCustomization",value:(i=Se(xe().mark((function e(r,i){var n,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,type:i},e.abrupt("return",t.fetchFromUrl(this.baseUrlMapVx+"styles/customStyles",o,n));case 3:case"end":return e.stop()}}),e,this)}))),function(t,e){return i.apply(this,arguments)})},{key:"postHealth",value:(r=Se(xe().mark((function e(r,i,n,o,a){var s,l,c;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=JSON.stringify({healthPingId:i,placeId:n,totemId:o,status:a}),l={token:r},c={method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:s},e.abrupt("return",t.fetchFromUrl(this.baseUrlMapVx+"health",l,c));case 4:case"end":return e.stop()}}),e,this)}))),function(t,e,i,n,o){return r.apply(this,arguments)})}],[{key:"fetchFromUrl",value:(e=Se(xe().mark((function t(e,r,i){var n;return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new URL(e)).search=new URLSearchParams(r).toString(),t.abrupt("return",fetch(n.toString(),i));case 3:case"end":return t.stop()}}),t)}))),function(t,r,i){return e.apply(this,arguments)})}]);var e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_}();function ke(t){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ke(t)}function Ce(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(t,e)||Me(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Me(t))||e){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Me(t,e){if(t){if("string"==typeof t)return Re(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Re(t,e):void 0}}function Re(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function Le(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Le=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function _(){}function y(){}function v(){}var b={};c(b,a,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(M([])));w&&w!==r&&i.call(w,a)&&(b=w);var S=v.prototype=_.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(n,o,a,s){var l=h(t[n],t,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==ke(u)&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(u).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;n(this,"_invoke",{value:function(t,i){function n(){return new e((function(e,n){r(t,i,e,n)}))}return o=o?o.then(n,n):n()}})}function E(e,r,i){var n=d;return function(o,a){if(n===f)throw Error("Generator is already running");if(n===m){if("throw"===o)throw a;return{value:t,done:!0}}for(i.method=o,i.arg=a;;){var s=i.delegate;if(s){var l=P(s,i);if(l){if(l===g)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===d)throw n=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=f;var c=h(e,r,i);if("normal"===c.type){if(n=i.done?m:p,c.arg===g)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(n=m,i.method="throw",i.arg=c.arg)}}}function P(e,r){var i=r.method,n=e.iterator[i];if(n===t)return r.delegate=null,"throw"===i&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(ke(e)+" is not iterable")}return y.prototype=v,n(S,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:y,configurable:!0}),y.displayName=c(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},T(I.prototype),c(I.prototype,s,(function(){return this})),e.AsyncIterator=I,e.async=function(t,r,i,n,o){void 0===o&&(o=Promise);var a=new I(u(t,r,i,n),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var i in e)r.push(i);return r.reverse(),function t(){for(;r.length;){var i=r.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=M,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(i,n){return s.type="throw",s.arg=e,r.next=i,n&&(r.method="next",r.arg=t),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;C(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:M(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}function De(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(i,n)}function ze(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var o=t.apply(e,r);function a(t){De(o,i,n,a,s,"next",t)}function s(t){De(o,i,n,a,s,"throw",t)}a(void 0)}))}}function Oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Fe(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Oe(Object(r),!0).forEach((function(e){Ge(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ne(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,$e(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Be(t,e,r){return e=Ue(e),function(t,e){if(e&&("object"==ke(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,je()?Reflect.construct(e,[],Ue(t).constructor):e.apply(t,r))}function je(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(je=function(){return!!t})()}function Ue(t){return Ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ue(t)}function Ve(t,e){return Ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ve(t,e)}function Ge(t,e,r){return(e=$e(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $e(t){var e=function(t,e){if("object"!=ke(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=ke(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==ke(e)?e:e+""}var qe=function(t){function e(t,r){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ge(i=Be(this,e),"cache",_e.instance),i.token=t,i.requester=new Pe(r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ve(t,e)}(e,t),Ne(e,[{key:"setLang",value:function(t){this.requester.setLang(t)}},{key:"prepareSegmentation",value:function(t){return Fe(Fe({},t),{},{token:this.token})}},{key:"fetchAndParseMapStyle",value:(_=ze(Le().mark((function t(e){var r,i,n,o;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==e||!this.baseStyle){t.next=2;break}return t.abrupt("return",this.baseStyle);case 2:return t.prev=2,t.next=5,this.requester.fetchMapStyle(this.token,e);case 5:if((r=t.sent).ok){t.next=11;break}return t.next=9,r.json();case 9:throw i=t.sent,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 11:return t.next=13,r.json();case 13:return n=t.sent,o=n.style,void 0===e&&(this.baseStyle=o),this.logEvent("fetchAndParseMapStyle"),t.abrupt("return",o);case 20:throw t.prev=20,t.t0=t.catch(2),this.logWarning(t.t0,{functionName:"fetchAndParseMapStyle"}),new Error("Failed to fetch and parse map style");case 24:case"end":return t.stop()}}),t,this,[[2,20]])}))),function(t){return _.apply(this,arguments)})},{key:"fetchAndParseInstitutions",value:(g=ze(Le().mark((function t(){var e,r,i,n,o,a,s,l,c;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchInstitutions(this.token);case 3:if((e=t.sent).ok){t.next=9;break}return t.next=7,e.json();case 7:throw r=t.sent,new Error("Fetch failed with status ".concat(e.status,": ").concat(r));case 9:return t.next=11,e.json();case 11:i=t.sent,n=[],o=Ae(i);try{for(o.s();!(a=o.n()).done;)s=a.value,l=new ue(s),n.push(l)}catch(u){o.e(u)}finally{o.f()}if(n.sort((function(t,e){return t.title.localeCompare(e.title)})),!(c=n)){t.next=22;break}return this.logEvent("fetchAndParseInstitutionsV2"),t.abrupt("return",c);case 22:throw new Error("No institutions associated to this apiKey");case 23:t.next=29;break;case 25:throw t.prev=25,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseInstitutionsV2"}),new Error("Failed to fetch and parse institution");case 29:case"end":return t.stop()}}),t,this,[[0,25]])}))),function(){return g.apply(this,arguments)})},{key:"fetchAndParsePlaceDetail",value:(m=ze(Le().mark((function t(e){var r,i,n,o,a;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,null==(r=this.cache.getPlace(e))){t.next=5;break}return this.logEvent("fetchAndParsePlaceDetail",{cached:"true"}),t.abrupt("return",r);case 5:return t.next=7,this.requester.fetchPlaceDetail(this.token,e);case 7:if((i=t.sent).ok){t.next=13;break}return t.next=11,i.json();case 11:throw n=t.sent,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 13:return t.next=15,i.json();case 15:return o=t.sent,a=new ne(o),this.cache.setPlace(a.lazarilloId,a),null!=a.clientId&&this.cache.setPlace(a.clientId,a),this.logEvent("fetchAndParsePlaceDetail",{cached:"false"}),t.abrupt("return",a);case 23:throw t.prev=23,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParsePlaceDetail"}),new Error("Failed to fetch and parse place detail");case 27:case"end":return t.stop()}}),t,this,[[0,23]])}))),function(t){return m.apply(this,arguments)})},{key:"fetchAndParseSubPlaces",value:(f=ze(Le().mark((function t(e){var r,i,n,o,a=this;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchSubPlaces(e,this.token);case 3:if((r=t.sent).ok){t.next=9;break}return t.next=7,r.json();case 7:throw i=t.sent,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 9:return t.next=11,r.json();case 11:return n=t.sent,o=n.map((function(t){return new ne(t)})),this.logEvent("fetchAndParseSubPlaces"),o.forEach((function(t){a.cache.hasPlace(t.lazarilloId)||a.cache.setPlace(t.lazarilloId,t),null==t.clientId||a.cache.hasPlace(t.clientId)||a.cache.setPlace(t.clientId,t)})),t.abrupt("return",o);case 18:throw t.prev=18,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseSubPlaces",parentPlaceId:e}),new Error("Failed to fetch and parse subplaces");case 22:case"end":return t.stop()}}),t,this,[[0,18]])}))),function(t){return f.apply(this,arguments)})},{key:"fetchAndParseAvailablePlaces",value:(p=ze(Le().mark((function t(){var e,r,i,n,o=this;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchAllowedPlaces(this.token);case 3:if((e=t.sent).ok){t.next=9;break}return t.next=7,e.json();case 7:throw r=t.sent,new Error("Fetch failed with status ".concat(e.status,": ").concat(r));case 9:return t.next=11,e.json();case 11:return i=t.sent,n=i.map((function(t){return new ne(t)})),this.logEvent("fetchAndParseAvailablePlaces"),n.forEach((function(t){o.cache.hasPlace(t.lazarilloId)||o.cache.setPlace(t.lazarilloId,t),null==t.clientId||o.cache.hasPlace(t.clientId)||o.cache.setPlace(t.clientId,t)})),t.abrupt("return",n);case 18:throw t.prev=18,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseAvailablePlaces"}),new Error("Failed to fetch and parse parent places");case 22:case"end":return t.stop()}}),t,this,[[0,18]])}))),function(){return p.apply(this,arguments)})},{key:"getCachedPlaces",value:function(t){var e=this,r=[];return t.forEach((function(t){var i=e.cache.getPlace(t);if(null!=i)r.push(i);else{var n=new Error("The id was not found on cache");"captureStackTrace"in Error&&Error.captureStackTrace(n),e.logWarning(n,{functionName:"getCachedPlaces",id:t})}})),r}},{key:"fetchAndParseRoute",value:(d=ze(Le().mark((function t(e){var r,i,n,o,a,s;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,r="","id"in e.finalLocation&&(r=e.finalLocation.id),null==(i=this.cache.getRoute(r))){t.next=8;break}return this.logEvent("fetchAndParseRoute",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),t.abrupt("return",i.data);case 8:return t.next=10,this.requester.fetchRoute(e,this.token);case 10:if((n=t.sent).ok){t.next=16;break}return t.next=14,n.json();case 14:throw o=t.sent,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 16:return t.next=18,n.json();case 18:return a=t.sent,s=new Zt(a[0]),this.logEvent("fetchAndParseRoute"),this.debugLog("Route cache testing. Fetched."),t.abrupt("return",s);case 25:throw t.prev=25,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseRoute"}),new Error("Failed to fetch and parse route");case 29:case"end":return t.stop()}}),t,this,[[0,25]])}))),function(t){return d.apply(this,arguments)})},{key:"fetchAndParseRouteV2",value:(h=ze(Le().mark((function t(e){var r,i,n,o,a,s;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,r="","id"in e.finalLocation&&(r=e.finalLocation.id),null==(i=this.cache.getRoute(r))){t.next=8;break}return this.logEvent("fetchAndParseRouteV2",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),t.abrupt("return",i.data);case 8:return t.next=10,this.requester.fetchRouteV2(e,this.token);case 10:if((n=t.sent).ok){t.next=16;break}return t.next=14,n.json();case 14:throw o=t.sent,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 16:return t.next=18,n.json();case 18:return a=t.sent,s=new Zt(a[0]),this.logEvent("fetchAndParseRouteV2"),this.debugLog("Route cache testing. Fetched."),t.abrupt("return",s);case 25:throw t.prev=25,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseRouteV2"}),new Error("Failed to fetch and parse route");case 29:case"end":return t.stop()}}),t,this,[[0,25]])}))),function(t){return h.apply(this,arguments)})},{key:"fetchAndParseTransport",value:(u=ze(Le().mark((function t(e){var r,i,n,o,a,s,l,c,u,h=this;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,null==(r=this.cache.getVehicle(e))||!(Date.now()-r.timestamp<6e3||0===r.data.routes.length)){t.next=5;break}return this.logEvent("fetchAndParseTransport",{cached:"true"}),t.abrupt("return",r.data);case 5:return t.next=7,this.requester.fetchTransport(this.token,e);case 7:if((i=t.sent).ok){t.next=13;break}return t.next=11,i.json();case 11:throw n=t.sent,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 13:return t.next=15,i.json();case 15:if(!((o=t.sent).realtimeSchedules.length>0)){t.next=22;break}return a=o.realtimeSchedules.map((function(t){return h.fetchAndParseStops(e,t.vehicleId)})),t.next=20,Promise.all(a);case 20:(s=t.sent).length>0&&o.realtimeSchedules.forEach((function(t){var e,r;t.stops=null!==(e=null===(r=s.find((function(e){return e.id==t.vehicleId})))||void 0===r?void 0:r.places)&&void 0!==e?e:[]}));case 22:return l=new de(o),this.cache.setVehicle(e,{timestamp:Date.now(),data:l}),this.logEvent("fetchAndParseTransport",{cached:"false"}),t.abrupt("return",l);case 28:if(t.prev=28,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseTransport"}),null==(c=this.cache.getVehicle(e))){t.next=38;break}return u=new de({realtimeSchedules:[],schedules:c.data.schedule}),this.logEvent("fetchAndParseTransport",{cached:"true"}),t.abrupt("return",u);case 38:throw new Error("Failed to fetch and parse transport");case 39:case"end":return t.stop()}}),t,this,[[0,28]])}))),function(t){return u.apply(this,arguments)})},{key:"fetchAndParseStops",value:(c=ze(Le().mark((function t(e,r){var i,n,o,a,s;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!(null!=(i=this.cache.getStops(e+r))&&Date.now()-i.timestamp<6e4)){t.next=5;break}return this.logEvent("fetchAndParseStops",{cached:"true"}),t.abrupt("return",{id:r,places:i.data});case 5:return t.next=7,this.requester.fetchStops(this.token,e,r);case 7:if((n=t.sent).ok){t.next=13;break}return t.next=11,n.json();case 11:throw o=t.sent,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 13:return t.next=15,n.json();case 15:return a=t.sent,s=a.map((function(t){return new ne(t)})),this.cache.setStops(e+r,{timestamp:Date.now(),data:s}),this.logEvent("fetchAndParseStops",{cached:"false"}),t.abrupt("return",{id:r,places:s});case 22:throw t.prev=22,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseStops"}),new Error("Failed to fetch and parse stops");case 26:case"end":return t.stop()}}),t,this,[[0,22]])}))),function(t,e){return c.apply(this,arguments)})},{key:"fetchAndParseSearchResults",value:(l=ze(Le().mark((function t(e,r,i){var n,o,a,s;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchSearchResults(e,r,this.token,i);case 3:if((n=t.sent).ok){t.next=9;break}return t.next=7,n.json();case 7:throw o=t.sent,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 9:return t.next=11,n.json();case 11:return a=t.sent,s=a.map((function(t){return new ne(t)})),t.abrupt("return",s);case 16:throw t.prev=16,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseSearchResults"}),new Error("Failed to fetch and parse search results");case 20:case"end":return t.stop()}}),t,this,[[0,16]])}))),function(t,e,r){return l.apply(this,arguments)})},{key:"fetchAndParseRoutesFromOrigin",value:(s=ze(Le().mark((function t(e,r,i,n,o){var a,s,l,c,u,h=this;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchRoutesForOrigin(this.token,e,r,i,n,o);case 3:if((a=t.sent).ok){t.next=9;break}return t.next=7,a.json();case 7:throw s=t.sent,new Error("Fetch failed with status ".concat(a.status,": ").concat(s));case 9:return t.next=11,a.json();case 11:l=t.sent,c=l.routes,u=l.accessibleRoutes,Object.entries(c).forEach((function(t){var e=Ce(t,2),r=e[0],i=e[1],n=new Zt(i[0]);h.cache.setRoute(r,{timestamp:Date.now(),data:n})})),Object.entries(u).forEach((function(t){var e=Ce(t,2),r=e[0],i=e[1],n=new Zt(i[0]);h.cache.setAccessibleRoute(r,{timestamp:Date.now(),data:n})})),this.debugLog("Route cache testing. Cache populated!"),t.next=23;break;case 19:throw t.prev=19,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseRoutesFromOrigin"}),new Error("Failed to fetch and parse routes from origin results");case 23:case"end":return t.stop()}}),t,this,[[0,19]])}))),function(t,e,r,i,n){return s.apply(this,arguments)})},{key:"fetchAndParseCacheTimestamp",value:(a=ze(Le().mark((function t(e){var r,i,n,o;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchCacheTimestamp(this.token,e);case 3:if((r=t.sent).ok){t.next=9;break}return t.next=7,r.json();case 7:throw i=t.sent,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 9:return t.next=11,r.json();case 11:return n=t.sent,o=n.lastUpdate,t.abrupt("return",o);case 16:throw t.prev=16,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseCacheTimestamp"}),new Error("Failed to fetch and parse cache timestamp");case 20:case"end":return t.stop()}}),t,this,[[0,16]])}))),function(t){return a.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.cache.cleanRoutesCache(),this.cache.cleanAccessibleRoutesCache()}},{key:"fetchAndParseConfiguration",value:(o=ze(Le().mark((function t(e){var r,i,n;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchConfiguration(this.token,e);case 3:if((r=t.sent).ok){t.next=9;break}return t.next=7,r.json();case 7:throw i=t.sent,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 9:return t.next=11,r.json();case 11:return n=t.sent,t.abrupt("return",n);case 15:throw t.prev=15,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseConfiguration"}),new Error("Failed to fetch and parse configuration");case 19:case"end":return t.stop()}}),t,this,[[0,15]])}))),function(t){return o.apply(this,arguments)})},{key:"fetchAndParseCategories",value:(n=ze(Le().mark((function t(e){var r,i;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchCategories(this.token,e);case 3:if((r=t.sent).ok){t.next=9;break}return t.next=7,r.json();case 7:throw i=t.sent,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 9:return t.next=11,r.json();case 11:return t.abrupt("return",t.sent);case 14:throw t.prev=14,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseCategories"}),new Error("Failed to fetch and parse categories");case 18:case"end":return t.stop()}}),t,this,[[0,14]])}))),function(t){return n.apply(this,arguments)})},{key:"fetchAndParseCssCustomization",value:(i=ze(Le().mark((function t(e){var r,i,n;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.requester.fetchCssCustomization(this.token,e);case 3:if((r=t.sent).ok){t.next=9;break}return t.next=7,r.json();case 7:throw i=t.sent,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 9:return t.next=11,r.json();case 11:return n=t.sent,t.abrupt("return",n);case 15:throw t.prev=15,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"fetchAndParseCssCustomization"}),new Error("Failed to fetch and parse css customization");case 19:case"end":return t.stop()}}),t,this,[[0,15]])}))),function(t){return i.apply(this,arguments)})},{key:"postAndParseHealthPing",value:(r=ze(Le().mark((function t(e,r,i,n){var o,a,s;return Le().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.requester.postHealth(this.token,e,r,i,n);case 2:if((o=t.sent).ok){t.next=8;break}return t.next=6,o.json();case 6:throw a=t.sent,new Error("Post failed with status ".concat(o.status,": ").concat(a));case 8:return t.next=10,o.json();case 10:return s=t.sent,t.abrupt("return",s);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e,i,n){return r.apply(this,arguments)})}]);var r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_}(zt);function Ze(t){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ze(t)}function We(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */We=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function _(){}function y(){}function v(){}var b={};c(b,a,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(M([])));w&&w!==r&&i.call(w,a)&&(b=w);var S=v.prototype=_.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(n,o,a,s){var l=h(t[n],t,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==Ze(u)&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(u).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;n(this,"_invoke",{value:function(t,i){function n(){return new e((function(e,n){r(t,i,e,n)}))}return o=o?o.then(n,n):n()}})}function E(e,r,i){var n=d;return function(o,a){if(n===f)throw Error("Generator is already running");if(n===m){if("throw"===o)throw a;return{value:t,done:!0}}for(i.method=o,i.arg=a;;){var s=i.delegate;if(s){var l=P(s,i);if(l){if(l===g)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===d)throw n=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=f;var c=h(e,r,i);if("normal"===c.type){if(n=i.done?m:p,c.arg===g)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(n=m,i.method="throw",i.arg=c.arg)}}}function P(e,r){var i=r.method,n=e.iterator[i];if(n===t)return r.delegate=null,"throw"===i&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(Ze(e)+" is not iterable")}return y.prototype=v,n(S,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:y,configurable:!0}),y.displayName=c(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},T(I.prototype),c(I.prototype,s,(function(){return this})),e.AsyncIterator=I,e.async=function(t,r,i,n,o){void 0===o&&(o=Promise);var a=new I(u(t,r,i,n),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var i in e)r.push(i);return r.reverse(),function t(){for(;r.length;){var i=r.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=M,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(i,n){return s.type="throw",s.arg=e,r.next=i,n&&(r.method="next",r.arg=t),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;C(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:M(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}function He(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(i,n)}function Xe(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var o=t.apply(e,r);function a(t){He(o,i,n,a,s,"next",t)}function s(t){He(o,i,n,a,s,"throw",t)}a(void 0)}))}}function Je(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(t,e)||tr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Ke(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ye(Object(r),!0).forEach((function(e){sr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ye(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Qe(t){return function(t){if(Array.isArray(t))return er(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||tr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tr(t,e){if(t){if("string"==typeof t)return er(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?er(t,e):void 0}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function rr(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,lr(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ir(t,e,r){return e=or(e),function(t,e){if(e&&("object"==Ze(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,nr()?Reflect.construct(e,[],or(t).constructor):e.apply(t,r))}function nr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nr=function(){return!!t})()}function or(t){return or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},or(t)}function ar(t,e){return ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ar(t,e)}function sr(t,e,r){return(e=lr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lr(t){var e=function(t,e){if("object"!=Ze(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=Ze(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ze(e)?e:e+""}var cr=function(t){function e(t,r,i){var n,o,a;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),sr(a=ir(this,e),"potentialParentPlaces",[]),sr(a,"innerFloors",[]),sr(a,"subPlaces",[]),sr(a,"currentFloor",""),sr(a,"baseFilters",{}),sr(a,"markers",[]),sr(a,"enableHover",!1),sr(a,"hoveredId","unselected"),sr(a,"failedTiles",new Set),ot.includes(null!==(n=t.lang)&&void 0!==n?n:"")&&a.setRTLSupport(),a.repository=new qe(i,null!==(o=t.lang)&&void 0!==o?o:"en"),a.token=i,a.parentPlaceId=t.parentPlaceId,a.routeController=new nt(a),a.userLocationMarker=void 0,a.watchPositionID=void 0,a.onFloorChange=t.onFloorChange,a.onParentPlaceChange=t.onParentPlaceChange,null!=t.parentPlaceId&&a.initialPlaceDetailSetUp(t.parentPlaceId),t.otherPotentialParentPlacesIds&&t.otherPotentialParentPlacesIds.length>0&&a.loadOtherPotentialParentPlaces(t.otherPotentialParentPlacesIds),a.enableHover=t.enableHover||!1,a.initialMapStyleSetUp(t,r),a}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ar(t,e)}(e,t),rr(e,[{key:"setRTLSupport",value:function(){var t=this;(0,w.setRTLTextPlugin)("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!1).catch((function(e){t.logWarning(e,{functionName:"setRTLSupport"})}))}},{key:"initialPlaceDetailSetUp",value:function(t){var e=this;this.repository.fetchAndParsePlaceDetail(t).then((function(t){e.changeParentPlaceTo(t),e.potentialParentPlaces.push(t)})).catch(console.error)}},{key:"loadOtherPotentialParentPlaces",value:function(t){var e=this;Promise.all(t.map((function(t){return e.repository.fetchAndParsePlaceDetail(t)}))).then((function(t){var r;(r=e.potentialParentPlaces).push.apply(r,Qe(t))})).catch(console.error)}},{key:"subPlacesLoad",value:function(t){var e=this;this.repository.fetchAndParseSubPlaces(t).then((function(t){e.subPlaces=t})).catch(console.error)}},{key:"initialMapStyleSetUp",value:function(t,e){var r=this;this.repository.fetchAndParseMapStyle(t.parentPlaceId).then((function(i){var n,o,a,s={container:e,style:i,center:t.center,zoom:t.zoom,pitch:null!==(n=t.pitch)&&void 0!==n?n:0,attributionControl:!1,maplibreLogo:!1,bearingSnap:null!==(o=t.bearingSnap)&&void 0!==o?o:0,cancelPendingTileRequestsWhileZooming:!1};if(t.maxZoom&&(s.maxZoom=t.maxZoom),t.minZoom&&(s.minZoom=t.minZoom),t.maxBounds&&t.maxBounds.length>1){var l=T(t.maxBounds);s.maxBounds=new w.LngLatBounds([l[0].lng,l[0].lat],[l[1].lng,l[1].lat])}return r.map=new w.Map(s),r.map.addControl(new w.NavigationControl({showCompass:void 0===t.showCompass||t.showCompass,showZoom:void 0===t.showZoom||t.showZoom}),null!==(a=t.navigationPosition)&&void 0!==a?a:"top-right"),r.map.on("load",(function(){var e;r.whenStyleUpdates(i),t.lang&&r.setLayersForLanguage(t.lang),null===(e=t.onMapReady)||void 0===e||e.call(t),r.onHover(),r.subscribeToFailedTiles()})),r.map.on("zoomend",(function(){var e;null===(e=t.onZoomEnd)||void 0===e||e.call(t,r.getZoomLevel())})),r.map.on("rotate",(function(){var e;null===(e=t.onRotate)||void 0===e||e.call(t,r.map.getBearing())})),r.defaultClickListener(),r.map})).catch(console.error)}},{key:"setBaseFilters",value:function(t){var e=this,r=["==",["get","public_place"],!0];t.layers.filter((function(t){return t.id.startsWith("indoor-")})).forEach((function(t){var i=e.baseFilters[t.id];if(null!=i){var n=["all",i,r];e.map.setFilter(t.id,n)}else e.map.setFilter(t.id,r);switch(t.type){case"line":case"symbol":case"fill-extrusion":case"fill":null!=t.filter&&(e.baseFilters[t.id]=t.filter)}}))}},{key:"setLayersForLanguage",value:function(t){var e,r,i=this,n=["aerodrome_label","mountain_peak","park","place","poi","transportation_name","water_name","waterway"],o=null!==(e=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==e?e:[];o.filter((function(t){var e;return"symbol"===t.type&&"openmaptiles"===t.source&&n.includes(null!==(e=t["source-layer"])&&void 0!==e?e:"")})).map((function(t){return t.id})).forEach((function(e){try{var r=i.map.getLayoutProperty(e,"symbol-placement");i.map.setLayoutProperty(e,"text-field",["case",["has","name:".concat(t)],["get","name:".concat(t)],["format",["get","name:latin"],"line"===r?" ":"\n",["get","name:nonlatin"]]])}catch(n){i.logWarning(n,{functionName:"setLayersForLanguage"})}})),o.filter((function(t){var e;return"symbol"===t.type&&"indoorequal"===t.source&&void 0!==(null===(e=t.layout)||void 0===e?void 0:e["text-field"])})).map((function(t){return t.id})).forEach((function(e){try{i.map.setLayoutProperty(e,"text-field",["case",["has","name:".concat(t)],["get","name:".concat(t)],["get","name"]])}catch(r){i.logWarning(r,{functionName:"setLayersForLanguage"})}}))}},{key:"prepareSegmentation",value:function(t){var e;return Ke(Ke({},t),{},{token:this.token,parentPlaceId:null!==(e=this.parentPlaceId)&&void 0!==e?e:"None"})}},{key:"destroyMap",value:function(){this.map.remove(),this.unsubscribeFromFailedTiles()}},{key:"getCurrentFloor",value:function(){return this.currentFloor}},{key:"changeParentPlaceTo",value:function(t){var e,r,i,n,o,a=this,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0;this.parentPlace=t,this.parentPlaceId=null==t?void 0:t.lazarilloId,this.innerFloors=null!==(e=null==t?void 0:t.innerFloors.sort((function(t,e){return t.index-e.index})))&&void 0!==e?e:[],this.currentFloor=null!==(r=null!==(i=null===(n=this.innerFloors.find((function(t){return t.defaultFloor})))||void 0===n?void 0:n.key)&&void 0!==i?i:null===(o=this.innerFloors[0])||void 0===o?void 0:o.key)&&void 0!==r?r:"",t&&this.subPlacesLoad(t.lazarilloId),s&&this.repository.fetchAndParseMapStyle(null==t?void 0:t.lazarilloId).then((function(t){a.map.setStyle(t),a.whenStyleUpdates(t),null==l||l()})).catch(console.error)}},{key:"updatePlaceAndFloor",value:function(t,e){var r,i,n,o,a,s=this.potentialParentPlaces.find((function(e){return e.lazarilloId===t}));this.parentPlace=s,this.parentPlaceId=null==s?void 0:s.lazarilloId,this.innerFloors=null!==(r=null==s?void 0:s.innerFloors.sort((function(t,e){return t.index-e.index})))&&void 0!==r?r:[],this.currentFloor=null!==(i=null!==(n=null!=e?e:null===(o=this.innerFloors.find((function(t){return t.defaultFloor})))||void 0===o?void 0:o.key)&&void 0!==n?n:null===(a=this.innerFloors[0])||void 0===a?void 0:a.key)&&void 0!==i?i:""}},{key:"updateParentPlaceAndFloor",value:function(t,e){try{var r,i;this.updatePlaceAndFloor(t,e),this.filterByFloorKey(this.currentFloor),null===(r=this.onParentPlaceChange)||void 0===r||r.call(this,t),null===(i=this.onFloorChange)||void 0===i||i.call(this,this.currentFloor),this.logEvent("updateParentPlaceAndFloor")}catch(n){this.logWarning(n,{functionName:"updateParentPlaceAndFloor"})}}},{key:"setLang",value:function(t){this.repository.setLang(t)}},{key:"setParentPlace",value:function(t,e,r){this.changeParentPlaceTo(t,e,r)}},{key:"removeParentPlace",value:function(){this.changeParentPlaceTo(void 0,!0)}},{key:"whenStyleUpdates",value:function(t){this.setBaseFilters(t),this.routeController.addSourcesAndLayers(),this.filterByFloorKey(this.currentFloor)}},{key:"addMarker",value:function(t){try{var e=new O(t);return e.changeFloor(this.currentFloor,this.map),this.markers.push(e),this.logEvent("addMarker"),e.id}catch(r){throw this.logWarning(r,{functionName:"addMarker"}),new Error("Failed to add marker")}}},{key:"updateMarker",value:function(t){try{var e,r=this.markers.find((function(e){return e.id===t.id}));return void 0!==r&&r.updateIcon(t),this.logEvent("updateMarker"),null!==(e=null==r?void 0:r.id)&&void 0!==e?e:""}catch(i){throw this.logWarning(i,{functionName:"updateMarker"}),new Error("Failed to update marker")}}},{key:"showMarker",value:function(t){try{var e=this.markers.find((function(e){return e.id===t}));null!==e&&this.map&&(null==e||e.show(this.map)),this.logEvent("showMarker")}catch(r){this.logWarning(r,{functionName:"showMarker"})}}},{key:"hideMarker",value:function(t){try{var e=this.markers.find((function(e){return e.id===t}));null!==e&&(null==e||e.hide()),this.logEvent("hideMarker")}catch(r){this.logWarning(r,{functionName:"hideMarker"})}}},{key:"removeMarker",value:function(t){try{var e=this.markers.find((function(e){return e.id===t}));null!==e&&(null==e||e.remove(),this.markers=this.markers.filter((function(e){return e.id!==t}))),this.logEvent("removeMarker")}catch(r){throw this.logWarning(r,{functionName:"removeMarker"}),new Error("Failed to remove marker")}}},{key:"removeAllMarkers",value:function(){try{this.markers.forEach((function(t){t.remove()})),this.markers=[],this.logEvent("removeAllMarkers")}catch(t){throw this.logWarning(t,{functionName:"removeAllMarkers"}),new Error("Failed to remove all markers")}}},{key:"filterByFloorKey",value:function(t){this.currentFloor=t,this.innerFloors.every((function(e){return e.key!==t}))&&""!==t&&this.logEvent("invalidFloorKey",{floorKey:t}),this.updateFiltersTo(t),this.updateMarkersTo(t),this.routeController.updateRouteLayers(t),this.routeController.updateRouteMarkerVisibility(t)}},{key:"getContainer",value:function(){return this.map.getContainer()}},{key:"updateMarkersTo",value:function(t){var e=this;this.markers.forEach((function(r){r.changeFloor(t,e.map)}))}},{key:"updateFiltersTo",value:function(t){var e,r,i,n=this;if(this.map){var o=null!==(e=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==e?e:[];o.filter((function(t){return t.id.startsWith("base-indoor-")})).forEach((function(t){n.map.removeLayer(t.id)}));var a=null===(i=this.innerFloors.find((function(e){return e.key===t})))||void 0===i?void 0:i.baseFloor,s=o.filter((function(t){return t.id.startsWith("indoor-")}));if(null!=a){var l,c=null===(l=s[0])||void 0===l?void 0:l.id;s.filter((function(t){return"fill-extrusion"!==t.type})).forEach((function(t){var e=structuredClone(t);e.id="base-"+t.id,n.baseFilters[e.id]=n.baseFilters[t.id],n.map.addLayer(e,c),n.applyLayerFilters(e,a)}))}s.forEach((function(e){n.applyLayerFilters(e,t)}))}}},{key:"applyLayerFilters",value:function(t,e){var r,i=this.baseFilters[t.id],n=["any",["==",["get","floor_key"],e]],o=["==",["get","public_place"],!0],a=["!=",["get","is_subplace"],null!==(r=this.parentPlaceId)&&void 0!==r?r:""],s=["==",["get","show_in_floor"],e],l=o;null!=this.parentPlaceId&&(l=["any",n,o]);var c=["all",l,["any",a,s]];if(t.id.includes("hover")?i=["==",["get","ref"],this.hoveredId]:t.id.includes("colored")||"fill"!=t.type&&"fill-extrusion"!==t.type||c.push(["!=",["get","ref"],this.hoveredId]),null!=i){var u=["all",i,c];this.map.setFilter(t.id,u)}else this.map.setFilter(t.id,c)}},{key:"getInnerFloors",value:function(){return this.innerFloors}},{key:"updateCamera",value:function(t,e){this.map.once("moveend",e),this.map.easeTo(Ke({},t))}},{key:"setMaxZoom",value:function(t){this.map.setMaxZoom(t)}},{key:"setMinZoom",value:function(t){this.map.setMinZoom(t)}},{key:"isInsideBounds",value:function(t){var e=this.map.getMaxBounds();return null==e||e.contains(t)}},{key:"setMaxBounds",value:function(t){if(t.length>1){var e=T(t);this.map.setMaxBounds(new w.LngLatBounds([e[0].lng,e[0].lat],[e[1].lng,e[1].lat]))}}},{key:"fitCoordinates",value:function(t,e){if(1===t.length){var r=Je(t,1)[0];this.map.setCenter({lat:r.lat,lng:r.lng})}else if(t.length>1){var i,n,o,a,s,l,c,u,h,d=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=tr(t))||e){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(t);try{for(d.s();!(h=d.n()).done;){var p=h.value,f=p.lat,m=p.lng;s=void 0===s?f:Math.min(s,f),l=void 0===l?m:Math.min(l,m),c=void 0===c?f:Math.max(c,f),u=void 0===u?m:Math.max(u,m)}}catch(v){d.e(v)}finally{d.f()}var g=[null!==(i=l)&&void 0!==i?i:0,null!==(n=s)&&void 0!==n?n:0,null!==(o=u)&&void 0!==o?o:0,null!==(a=c)&&void 0!==a?a:0];if(e){var _=this.map.getBearing(),y=this.map.getPitch();e.bearing=void 0!==e.bearing?e.bearing:_,e.pitch=void 0!==e.pitch?e.pitch:y}this.map.fitBounds(g,e)}}},{key:"getZoomLevel",value:function(){return this.map.getZoom()}},{key:"updateFloor",value:function(t){try{var e;this.filterByFloorKey(t),null===(e=this.onFloorChange)||void 0===e||e.call(this,t),this.logEvent("updateFloor",{floorId:t})}catch(r){this.logWarning(r,{functionName:"updateFloor",floorId:t})}}},{key:"updatePlaceAndFloorForRouting",value:function(t,e){try{var r;this.updatePlaceAndFloor(t,e),this.updateFiltersTo(e),this.updateMarkersTo(e),null===(r=this.onFloorChange)||void 0===r||r.call(this,e),this.logEvent("updatePlaceAndFloorForRouting",{floorId:e})}catch(i){this.logWarning(i,{functionName:"updatePlaceAndFloorForRouting",floorId:e})}}},{key:"addRoute",value:(a=Xe(We().mark((function t(e){var r,i,n,o,a=arguments;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},t.prev=1,this.logEvent("addRoute"),i=new ht(e),n=new dt(r),t.next=7,this.repository.fetchAndParseRoute(i);case 7:return o=t.sent,this.routeController.addRoute(o,n),t.abrupt("return",o);case 12:throw t.prev=12,t.t0=t.catch(1),this.logWarning(t.t0,{functionName:"addRoute"}),new Error("Error: Failed to add route");case 16:case"end":return t.stop()}}),t,this,[[1,12]])}))),function(t){return a.apply(this,arguments)})},{key:"removeRoute",value:function(){try{this.logEvent("removeRoute"),this.routeController.removeRoute()}catch(t){this.logWarning(t,{functionName:"removeRoute"})}}},{key:"addPopOver",value:function(t){var e=t.placeId;if(void 0!==e){var r=this.subPlaces.find((function(t){return t.clientId===e||t.lazarilloId===e}));void 0!==r&&(new(S().Popup)).setLngLat(r.position).setHTML(r.title).addTo(this.map)}return""}},{key:"removePopOver",value:function(t){throw Error("Not implemented")}},{key:"startClickListener",value:function(t){this.clickCallback=t}},{key:"stopClickListener",value:function(){this.clickCallback=void 0}},{key:"defaultClickListener",value:function(){var t=this;this.map.on("click",(function(e){var r,i,n=t.map.queryRenderedFeatures(e.point).find((function(t){return"room"===t.properties.class})),o=t.subPlaces.find((function(t){return t.lazarilloId===(null==n?void 0:n.properties.ref)})),a=null!==(r=null!==(i=null==o?void 0:o.lazarilloId)&&void 0!==i?i:null==o?void 0:o.clientId)&&void 0!==r?r:"";void 0!==o&&t.clickCallback&&t.clickCallback(a)}))}},{key:"onHover",value:function(){var t=this;this.enableHover&&(this.map.on("mousemove","hoverable",(function(e){var r,i=null===(r=e.features)||void 0===r?void 0:r.find((function(e){var r,i;return(null===(r=e.properties.ref)||void 0===r?void 0:r.length)>0&&(null===(i=e.properties)||void 0===i?void 0:i.floor_key)===t.currentFloor})),n=null==i?void 0:i.properties.ref;void 0!==n&&n.length>0?(t.hoveredId=n,t.updateFiltersTo(t.currentFloor)):void 0===n&&"unselected"!==t.hoveredId&&(t.hoveredId="unselected",t.updateFiltersTo(t.currentFloor))})),this.map.on("mouseleave","hoverable",(function(){t.hoveredId="unselected",t.updateFiltersTo(t.currentFloor)})))}},{key:"setPlacesAsSelected",value:function(t,e){try{this.hasLayer("indoor-colored-places")||(this.logWarning(new Error("Layer indoor-colored-places does not exist on current style")),this.createColoredPlacesLayer());var r=this.createBasicFilters(),i=t.map((function(t){return["==",["get","ref"],t]})),n=["any"].concat(Qe(i)),o=["all",n,r];if(this.map.setFilter("indoor-colored-places",o),this.baseFilters["indoor-colored-places"]=n,void 0!==e){var a=this.map.getLayer("indoor-colored-places");switch(null==a?void 0:a.type){case"fill":this.map.setPaintProperty("indoor-colored-places","fill-color",e);break;case"fill-extrusion":this.map.setPaintProperty("indoor-colored-places","fill-extrusion-color",e)}}}catch(s){this.logWarning(s,{functionName:"setPlacesAsSelected"})}}},{key:"is3DStyle",value:function(){return this.map.getStyle().layers.some((function(t){return"fill-extrusion"===t.type}))}},{key:"createColoredPlacesLayer",value:function(){this.is3DStyle()?this.map.addLayer({id:"indoor-colored-places",type:"fill-extrusion",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"fill-extrusion-height":2.5,"fill-extrusion-color":"#276EF1","fill-extrusion-opacity":.8}}):this.map.addLayer({id:"indoor-colored-places",type:"fill",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"fill-color":"#276EF1"}})}},{key:"createBasicFilters",value:function(){var t,e,r=["==",["get","public_place"],!0],i=["!=",["get","is_subplace"],null!==(t=this.parentPlaceId)&&void 0!==t?t:""],n=null!==(e=this.currentFloor)&&void 0!==e?e:"+",o=["==",["get","floor_key"],n],a=["==",["get","show_in_floor"],n],s=r;return null!=this.parentPlaceId&&(s=["any",o,r]),["all",s,["any",i,a]]}},{key:"hasLayer",value:function(t){return void 0!==this.map.getLayer(t)}},{key:"clearColoredPlaces",value:function(){if(this.hasLayer("indoor-colored-places")){var t=["==",["get","ref"],"unselected"];this.baseFilters["indoor-colored-places"]=t,this.map.setFilter("indoor-colored-places",t)}}},{key:"startAnimateRoute",value:(o=Xe(We().mark((function t(e){var r,i,n,o,a,s,l=arguments;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:{},i=l.length>2&&void 0!==l[2]?l[2]:{},t.prev=2,!(e instanceof Zt)){t.next=7;break}n=e,t.next=11;break;case 7:return o=new ht(e),t.next=10,this.repository.fetchAndParseRoute(o);case 10:n=t.sent;case 11:return a=new yt(r),s=new _t(i),this.routeController.startAnimating(n,a,s),t.abrupt("return",n);case 17:throw t.prev=17,t.t0=t.catch(2),this.logWarning(t.t0,{functionName:"startAnimateRoute"}),new Error("Error: Failed to start animating route");case 21:case"end":return t.stop()}}),t,this,[[2,17]])}))),function(t){return o.apply(this,arguments)})},{key:"startAnimateRouteV2",value:(n=Xe(We().mark((function t(e){var r,i,n,o,a,s,l=arguments;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:{},i=l.length>2&&void 0!==l[2]?l[2]:{},t.prev=2,!(e instanceof Zt)){t.next=7;break}n=e,t.next=11;break;case 7:return o=new ht(e),t.next=10,this.repository.fetchAndParseRouteV2(o);case 10:n=t.sent;case 11:return a=new yt(r),s=new _t(i),this.routeController.startAnimating(n,a,s),t.abrupt("return",n);case 17:throw t.prev=17,t.t0=t.catch(2),this.logWarning(t.t0,{functionName:"startAnimateRouteV2"}),new Error("Error: Failed to start animating route");case 21:case"end":return t.stop()}}),t,this,[[2,17]])}))),function(t){return n.apply(this,arguments)})},{key:"pauseAnimateRoute",value:function(){try{this.routeController.pauseAnimation(),this.logEvent("pauseAnimateRoute")}catch(t){this.logWarning(t,{functionName:"pauseAnimateRoute"})}}},{key:"resumeAnimateRoute",value:function(){try{this.routeController.resumeAnimation(),this.logEvent("resumeAnimateRoute")}catch(t){this.logWarning(t,{functionName:"resumeAnimateRoute"})}}},{key:"restartAnimateRoute",value:function(){try{this.routeController.restartAnimation(),this.logEvent("restartAnimateRoute")}catch(t){this.logWarning(t,{functionName:"restartAnimateRoute"})}}},{key:"stopAnimateRoute",value:function(){this.logWarning(new Error("Not implemented"),{functionName:"stopAnimateRoute"})}},{key:"addStepAnimation",value:(i=Xe(We().mark((function t(e){var r,i,n,o,a,s,l=arguments;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:{},i=l.length>2&&void 0!==l[2]?l[2]:{},t.prev=2,!(e instanceof Zt)){t.next=7;break}n=e,t.next=11;break;case 7:return o=new ht(e),t.next=10,this.repository.fetchAndParseRoute(o);case 10:n=t.sent;case 11:return a=new yt(r),s=new _t(i),this.routeController.addStepAnimation(n,a,s),this.logEvent("addStepAnimation"),t.abrupt("return",n);case 18:throw t.prev=18,t.t0=t.catch(2),this.logWarning(t.t0,{functionName:"addStepAnimation"}),new Error("Error: Failed to add step animation");case 22:case"end":return t.stop()}}),t,this,[[2,18]])}))),function(t){return i.apply(this,arguments)})},{key:"addStepAnimationV2",value:(r=Xe(We().mark((function t(e){var r,i,n,o,a,s,l=arguments;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:{},i=l.length>2&&void 0!==l[2]?l[2]:{},t.prev=2,!(e instanceof Zt)){t.next=7;break}n=e,t.next=11;break;case 7:return o=new ht(e),t.next=10,this.repository.fetchAndParseRouteV2(o);case 10:n=t.sent;case 11:return a=new yt(r),s=new _t(i),this.routeController.addStepAnimation(n,a,s),this.logEvent("addStepAnimationV2"),t.abrupt("return",n);case 18:throw t.prev=18,t.t0=t.catch(2),this.logWarning(t.t0,{functionName:"addStepAnimationV2"}),new Error("Error: Failed to add step animation");case 22:case"end":return t.stop()}}),t,this,[[2,18]])}))),function(t){return r.apply(this,arguments)})},{key:"nextStepAnimation",value:function(){try{this.routeController.nextStepAnimation(),this.logEvent("nextStepAnimation")}catch(t){throw this.logWarning(t,{functionName:"nextStepAnimation"}),new Error("Error: Failed to animate step")}}},{key:"previousStepAnimation",value:function(){try{this.routeController.previousStepAnimation(),this.logEvent("previousStepAnimation")}catch(e){this.logWarning(e,{functionName:"previousStepAnimation"});var t=e instanceof Error?e.message:String(e);throw new Error("Error: Failed to prepare to animate previous step, "+t)}}},{key:"centerOnCurrentStepAnimation",value:function(){try{this.routeController.centerOnCurrentStep(),this.logEvent("centerOnCurrentStepAnimation")}catch(e){this.logWarning(e,{functionName:"centerOnCurrentStepAnimation"});var t=e instanceof Error?e.message:String(e);throw new Error("Error: Failed to center on current step animation, "+t)}}},{key:"addUserLocationTracking",value:function(t){var e=new Image(40,40);e.src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDk5OS45IDk5OS45IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA5OTkuOSA5OTkuOSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8ZyBpZD0iY2lyY2xlIj4NCgk8Y2lyY2xlIGZpbGw9IiM0NzdDRkMiIGN4PSI1MDAiIGN5PSI1MDAiIHI9IjQ5OS45Ii8+DQo8L2c+DQo8ZyBpZD0iTGF5ZXJfMV8xXyI+DQoJPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTczNC43LDQwOS43YzAtMzIuNC02LjEwMS02Mi44LTE4LjMtOTEuM2MtMTIuMi0yOC40LTI5LTUzLjMtNTAuNC03NC43Yy0yMS40LTIxLjQtNDYuMy0zOC4yLTc0LjctNTAuNA0KCQlDNTYyLjksMTgxLjEsNTMyLjQsMTc1LDUwMCwxNzVzLTYyLjgsNi4xLTkxLjMsMTguM2MtMjguNCwxMi4yLTUzLjQsMjktNzQuNyw1MC40Yy0yMS40LDIxLjQtMzguMiw0Ni4zLTUwLjQsNzQuNw0KCQljLTEyLjIsMjguMzk5LTE4LjMsNTguODk5LTE4LjMsOTEuM2MwLDIyLDMuNCw0NS4zLDEwLjEsNjkuN2M2LjcsMjQuNSwxNS42LDQ5LjEsMjYuNiw3My44YzExLDI0LjgsMjMuNSw0OS4yLDM3LjYsNzMuMzk5DQoJCWMxNC4xLDI0LjIsMjguNCw0Ny4yLDQzLjEsNjkuMkM0MTYuOSw3NDcuMiw0NTYuMSw3OTguNSw1MDAuMSw4NDkuOWM0NC01MS40LDgzLjEwMS0xMDIuNywxMTcuNC0xNTQuMTAxDQoJCWMxNC43LTIyLDI5LTQ1LjEsNDMuMS02OS4yQzY3NC43LDYwMi41LDY4Ny4yLDU3OCw2OTguMiw1NTMuMnMxOS44OTktNDkuNCwyNi42LTczLjhDNzMxLjMsNDU0LjksNzM0LjcsNDMxLjcsNzM0LjcsNDA5Ljd6DQoJCSBNNTIyLjIsNDkyLjd2LTc4LjVINDk2Yy03LjQsMC0xNC4yLDEuMzk5LTIwLjQsNC4xYy02LjMsMi43LTExLjgsNi41LTE2LjYsMTEuMmMtNC44LDQuOC04LjUsMTAuMy0xMS4yLDE2LjYNCgkJYy0yLjcsNi4zMDEtNC4xLDEzLjEwMS00LjEsMjAuNHYxMDQuN2gtNTIuM1Y0NjYuNWMwLTE0LjQsMi43LTI4LDguMi00MC43YzUuNC0xMi43LDEyLjktMjMuOCwyMi41LTMzLjMNCgkJYzkuNS05LjUsMjAuNjAxLTE3LDMzLjMwMS0yMi41YzEyLjY5OS01LjQsMjYuMTk5LTguMiw0MC42OTktOC4yaDI2LjJ2LTc4LjVMNjUzLDM4OEw1MjIuMiw0OTIuN3oiLz4NCjwvZz4NCjxjaXJjbGUgZmlsbD0iI0ZGRkZGRiIgY3g9IjUwMC41NDgiIGN5PSI0MDguNDUiIHI9IjIyNCIvPg0KPGNpcmNsZSBmaWxsPSIjNDc3Q0ZDIiBjeD0iNTAwLjU0OCIgY3k9IjQwOC40NSIgcj0iNjgiLz4NCjwvc3ZnPg0K";var r=new O({coordinate:{lat:0,lng:0},icon:e,text:""});r.addToMap(this.map),this.userLocationMarker=r,this.watchPositionID=navigator.geolocation.watchPosition((function(t){r.setLngLat([t.coords.longitude,t.coords.latitude])}),(function(t){console.error("Error getting user location:",t)}),{enableHighAccuracy:t})}},{key:"removeUserLocationTracking",value:function(){void 0!==this.userLocationMarker?(this.userLocationMarker.remove(),this.userLocationMarker=void 0,this.watchPositionID&&(navigator.geolocation.clearWatch(this.watchPositionID),this.watchPositionID=void 0)):console.error("Error trying to remove location tracking, is already gone")}},{key:"getBearing",value:function(){return this.map.getBearing()}},{key:"addBorderToPlaces",value:function(t,e,r){try{this.hasLayer("indoor-bordered-places")||(this.logWarning(new Error("Layer indoor-bordered-places does not exist on current style")),this.createBorderedPlacesLayer());var i=this.createBasicFilters(),n=t.map((function(t){return["==",["get","ref"],t]})),o=["any"].concat(Qe(n)),a=["all",o,i];this.map.setFilter("indoor-bordered-places",a),this.baseFilters["indoor-bordered-places"]=o,void 0!==e&&void 0!==r&&(this.map.setPaintProperty("indoor-bordered-places","line-color",e),this.map.setPaintProperty("indoor-bordered-places","line-width",r))}catch(s){throw this.logWarning(s,{functionName:"addBorderToPlaces"}),new Error("Failed to add border to places")}}},{key:"createBorderedPlacesLayer",value:function(){this.map.addLayer({id:"indoor-bordered-places",type:"line",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"line-color":"#276EF1","line-width":4}})}},{key:"clearBorderedPlaces",value:function(){if(this.hasLayer("indoor-bordered-places")){var t=["==",["get","ref"],"unselected"];this.baseFilters["indoor-bordered-places"]=t,this.map.setFilter("indoor-bordered-places",t)}}},{key:"onWebGLContextLost",value:function(t){var e=this;t.originalEvent.preventDefault(),console.warn("Contexto WebGL perdido 😢");var r=this.map.getCanvas(),i=r.getContext("webgl")||r.getContext("webgl2");if(i&&i.isContextLost()){var n;r.addEventListener("webglcontextrestored",(function(){console.debug("Contexto WebGL restaurado, forzando re-render"),e.map.triggerRepaint(),e.failedTiles.clear()}),{once:!0});var o=i.getExtension("WEBGL_lose_context");null==o||null===(n=o.restoreContext)||void 0===n||n.call(o)}}},{key:"onWebGLContextRestored",value:function(){console.debug("Evento webglcontextrestored recibido, haciendo map.redraw()"),this.map.redraw(),this.failedTiles.clear()}},{key:"onSourceData",value:function(t){"vector"!==t.source.type||"indoorequal"!==t.sourceId||t.isSourceLoaded||this.failedTiles.add(t.tile)}},{key:"subscribeToFailedTiles",value:function(){var t=this;this.retryTimer||(this.retryTimer=setInterval((function(){t.map.getSource("indoorequal")&&(Array.from(t.failedTiles).forEach((function(e){var r;null===(r=t.map.getSource("indoorequal"))||void 0===r||r.loadTile(e)})),t.failedTiles.size>0&&t.failedTiles.clear())}),1e3),this.map.on("sourcedata",this.onSourceData.bind(this)),this.map.on("sourcedataabort",this.onSourceData.bind(this)),this.map.on("webglcontextlost",this.onWebGLContextLost.bind(this)),this.map.on("webglcontextrestored",this.onWebGLContextRestored.bind(this)))}},{key:"unsubscribeFromFailedTiles",value:function(){this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=void 0),this.map.off("sourcedata",this.onSourceData.bind(this)),this.map.off("sourcedataabort",this.onSourceData.bind(this)),this.map.off("webglcontextlost",this.onWebGLContextLost.bind(this)),this.map.off("webglcontextrestored",this.onWebGLContextRestored.bind(this))}}]);var r,i,n,o,a}(zt);function ur(t){return void 0!==t.logo}function hr(t){return void 0!==t.icon}function dr(t){return dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(t)}function pr(t){return function(t){if(Array.isArray(t))return fr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return fr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fr(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function mr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */mr=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function _(){}function y(){}function v(){}var b={};c(b,a,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(M([])));w&&w!==r&&i.call(w,a)&&(b=w);var S=v.prototype=_.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(n,o,a,s){var l=h(t[n],t,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==dr(u)&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(u).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;n(this,"_invoke",{value:function(t,i){function n(){return new e((function(e,n){r(t,i,e,n)}))}return o=o?o.then(n,n):n()}})}function E(e,r,i){var n=d;return function(o,a){if(n===f)throw Error("Generator is already running");if(n===m){if("throw"===o)throw a;return{value:t,done:!0}}for(i.method=o,i.arg=a;;){var s=i.delegate;if(s){var l=P(s,i);if(l){if(l===g)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===d)throw n=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=f;var c=h(e,r,i);if("normal"===c.type){if(n=i.done?m:p,c.arg===g)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(n=m,i.method="throw",i.arg=c.arg)}}}function P(e,r){var i=r.method,n=e.iterator[i];if(n===t)return r.delegate=null,"throw"===i&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(dr(e)+" is not iterable")}return y.prototype=v,n(S,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:y,configurable:!0}),y.displayName=c(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},T(I.prototype),c(I.prototype,s,(function(){return this})),e.AsyncIterator=I,e.async=function(t,r,i,n,o){void 0===o&&(o=Promise);var a=new I(u(t,r,i,n),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(S),c(S,l,"Generator"),c(S,a,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var i in e)r.push(i);return r.reverse(),function t(){for(;r.length;){var i=r.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=M,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(i,n){return s.type="throw",s.arg=e,r.next=i,n&&(r.method="next",r.arg=t),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var n=i.arg;C(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:M(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}function gr(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(i,n)}function _r(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var o=t.apply(e,r);function a(t){gr(o,i,n,a,s,"next",t)}function s(t){gr(o,i,n,a,s,"throw",t)}a(void 0)}))}}function yr(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Er(i.key),i)}}function vr(t,e,r){return e=xr(e),function(t,e){if(e&&("object"==dr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,br()?Reflect.construct(e,[],xr(t).constructor):e.apply(t,r))}function br(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(br=function(){return!!t})()}function xr(t){return xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xr(t)}function wr(t,e){return wr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wr(t,e)}function Sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Tr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Sr(Object(r),!0).forEach((function(e){Ir(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ir(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=function(t,e){if("object"!=dr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e);if("object"!=dr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==dr(e)?e:e+""}function Pr(t,e){var r=Tr(Tr({},{lang:"en"}),e);return new kr(t,r)}var kr=function(t){function e(t,r){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ir(i=vr(this,e),"headingListeners",[]),i.token=t,i.config=r,i.repository=new qe(t,i.config.lang),i.cachePlaces(),i.logEvent("initSDK"),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wr(t,e)}(e,t),function(t,e,r){return e&&yr(t.prototype,e),r&&yr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"cachePlaces",value:function(){var t=this;this.repository.fetchAndParseAvailablePlaces().catch((function(e){t.logWarning(e)}))}},{key:"setSdkLang",value:function(t){this.config.lang=t,this.repository.setLang(t)}},{key:"getPlaceDetail",value:(m=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParsePlaceDetail(e);case 3:return r=t.sent,this.logEvent("getPlaceDetail",{id:e}),t.abrupt("return",r);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getPlaceDetail",id:e}),Error("Error getPlaceDetail");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return m.apply(this,arguments)})},{key:"prepareSegmentation",value:function(t){return Tr(Tr({},t),{},{token:this.token})}},{key:"createMap",value:function(t,e){try{e.lang=this.config.lang;var r=new cr(e,t,this.token);return this.logEvent("createMap"),r}catch(i){throw this.logWarning(i,{functionName:"createMap"}),new Error("Failed to create map")}}},{key:"getConfiguration",value:(f=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseConfiguration(e);case 3:return r=t.sent,this.logEvent("configuration"),t.abrupt("return",r);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getConfiguration"}),new Error("Failed to get configuration");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return f.apply(this,arguments)})},{key:"getCategories",value:(p=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseCategories(e);case 3:return r=t.sent,this.logEvent("categories"),t.abrupt("return",r);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getCategories"}),new Error("Failed to get categories");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return p.apply(this,arguments)})},{key:"getTransport",value:(d=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseTransport(e);case 3:return r=t.sent,t.abrupt("return",r);case 7:throw t.prev=7,t.t0=t.catch(0),Error("Failed to get transport");case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return d.apply(this,arguments)})},{key:"getCachedPlaces",value:function(t){try{var e=this.repository.getCachedPlaces(t);return this.logEvent("getCachedPlaces"),e}catch(r){throw this.logWarning(r,{functionName:"getCachedPlaces"}),Error("Failed to get cached places")}}},{key:"getAvailablePlaces",value:(h=_r(mr().mark((function t(){var e;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseAvailablePlaces();case 3:return e=t.sent,this.logEvent("getAvailablePlaces"),t.abrupt("return",e);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getAvailablePlaces"}),Error("Failed to get available places");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(){return h.apply(this,arguments)})},{key:"getSubPlaces",value:(u=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseSubPlaces(e);case 3:return r=t.sent,this.logEvent("getSubPlaces"),t.abrupt("return",r);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getSubPlaces"}),Error("Failed to get subplaces");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return u.apply(this,arguments)})},{key:"getInstitutions",value:(c=_r(mr().mark((function t(){var e;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseInstitutions();case 3:return e=t.sent,this.logEvent("getInstitutions"),t.abrupt("return",e);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getInstitution"}),Error("Error getInstitution");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(){return c.apply(this,arguments)})},{key:"getRoute",value:(l=_r(mr().mark((function t(e){var r,i;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r=new ht(e),t.next=4,this.repository.fetchAndParseRoute(r);case 4:return i=t.sent,this.logEvent("getRoute"),t.abrupt("return",i);case 9:throw t.prev=9,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getRoute"}),new Error("Failed to get route");case 13:case"end":return t.stop()}}),t,this,[[0,9]])}))),function(t){return l.apply(this,arguments)})},{key:"getRouteV2",value:(s=_r(mr().mark((function t(e){var r,i;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r=new ht(e),t.next=4,this.repository.fetchAndParseRouteV2(r);case 4:return i=t.sent,this.logEvent("getRouteV2"),t.abrupt("return",i);case 9:throw t.prev=9,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getRouteV2"}),new Error("Failed to get route");case 13:case"end":return t.stop()}}),t,this,[[0,9]])}))),function(t){return s.apply(this,arguments)})},{key:"getPlacesByInput",value:(a=_r(mr().mark((function t(e,r,i,n){var o,a;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o=i?n?[i].concat(pr(n)):[i]:n,t.next=4,this.repository.fetchAndParseSearchResults(r,e,o);case 4:return a=t.sent,this.logEvent("getPlacesByInput"),t.abrupt("return",a);case 9:throw t.prev=9,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getPlacesByInput"}),new Error("Failed to get places by input");case 13:case"end":return t.stop()}}),t,this,[[0,9]])}))),function(t,e,r,i){return a.apply(this,arguments)})},{key:"getPlacesByCategory",value:function(t){throw Error("Not implemented")}},{key:"getUserLocation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e4};return new Promise((function(e,r){navigator.geolocation.getCurrentPosition((function(t){e(t)}),(function(t){r(t)}),t)}))}},{key:"watchUserPosition",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e3};return navigator.geolocation.watchPosition((function(e){t(e)}),(function(t){e(t)}),r)}},{key:"unWatchUserPosition",value:function(t){navigator.geolocation.clearWatch(t)}},{key:"watchUserHeading",value:function(t,e){var r=function(r){if(function(t){return t instanceof DeviceOrientationEvent}(r)){var i=null;void 0!==r.webkitCompassHeading?i=r.webkitCompassHeading||null:r.absolute&&null!==r.alpha&&(i=360-r.alpha),null!==i?t(i):e("Could not retrieve heading information.")}};this.headingListeners.push(r),"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",r):"ondeviceorientation"in window&&window.addEventListener("deviceorientation",r)}},{key:"unwatchUserHeading",value:function(){this.headingListeners.forEach((function(t){window.removeEventListener("deviceorientationabsolute",t),window.removeEventListener("deviceorientation",t)})),this.headingListeners=[]}},{key:"loadRoutesForOriginCache",value:(o=_r(mr().mark((function t(e,r,i,n,o){return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.repository.fetchAndParseRoutesFromOrigin(e,r,i,n,o);case 2:case"end":return t.stop()}}),t,this)}))),function(t,e,r,i,n){return o.apply(this,arguments)})},{key:"getCacheTimestamp",value:(n=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseCacheTimestamp(e);case 3:return r=t.sent,this.logEvent("getCacheTimestamp"),t.abrupt("return",r);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getCacheTimestamp"}),new Error("Failed to get cache timestamp");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return n.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.repository.cleanRoutesCache()}},{key:"getCssCustomization",value:(i=_r(mr().mark((function t(e){var r;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.fetchAndParseCssCustomization(e);case 3:return r=t.sent,this.logEvent("cssCustomization"),t.abrupt("return",r);case 8:throw t.prev=8,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"getCssCustomization"}),new Error("Failed to get css customization");case 12:case"end":return t.stop()}}),t,this,[[0,8]])}))),function(t){return i.apply(this,arguments)})},{key:"notifyHealth",value:(r=_r(mr().mark((function t(e,r,i,n){var o;return mr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.repository.postAndParseHealthPing(e,r,i,n);case 3:return o=t.sent,t.abrupt("return",o);case 7:throw t.prev=7,t.t0=t.catch(0),this.logWarning(t.t0,{functionName:"notifyHealth"}),new Error("Failed to notify health");case 11:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t,e,i,n){return r.apply(this,arguments)})}],[{key:"getLang",value:function(){return this.config.lang}}]);var r,i,n,o,a,s,l,c,u,h,d,p,f,m}(zt);function Cr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ar(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ar(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ar(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function Mr(t){var e=document.createElement("style");e.textContent="";for(var r=0,i=Object.entries(t);r<i.length;r++){var n=Cr(i[r],2),o=Rr(n[0],n[1]);e.textContent+=o}document.head.appendChild(e);var a=Object.keys(t).at(0);null!=a&&document.body.classList.add(a)}function Rr(t,e){var r=".".concat(t," {\n"),i=e.definitions;null!=i&&(r=function(t,e){for(var r=0,i=Object.entries(null!==(n=t.colors)&&void 0!==n?n:{});r<i.length;r++)for(var n,o=Cr(i[r],2),a=o[0],s=o[1],l=0,c=Object.entries(s);l<c.length;l++){var u=Cr(c[l],2),h=u[0],d=u[1];e+=" --definitions-colors-".concat(a,"-").concat(h,": ").concat(d,";\n")}for(var p=0,f=Object.entries(null!==(m=t.shadows)&&void 0!==m?m:{});p<f.length;p++){var m,g=Cr(f[p],2),_=g[0],y=g[1];e+=" --definitions-shadows-".concat(_,": ").concat(y,";\n")}for(var v=0,b=Object.entries(null!==(x=t.textFonts)&&void 0!==x?x:{});v<b.length;v++){var x,w=Cr(b[v],2),S=w[0],T=w[1];e+=" --definitions-textFonts-".concat(S,": ").concat(T,";\n")}return e}(i,r));for(var n=0,o=Object.entries(null!==(a=e.screens)&&void 0!==a?a:{});n<o.length;n++)for(var a,s=Cr(o[n],2),l=s[0],c=s[1],u=0,h=Object.entries(c);u<h.length;u++)for(var d=Cr(h[u],2),p=d[0],f=d[1],m=0,g=Object.entries(f);m<g.length;m++)for(var _=Cr(g[m],2),y=_[0],v=_[1],b=0,x=Object.entries(v);b<x.length;b++){var w=Cr(x[b],2),S=w[0],T=w[1];r+=" --".concat(l,"-").concat(p,"-").concat(y,"-").concat(S,": ").concat(T,";\n")}return r+="}\n"}})(),i})(),ft.exports=mt()),_t=(t=>(t.youAreHere="youAreHere",t.placePopup="placePopup",t.pin="pin",t.default="default",t))(_t||{});const yt="lazarillo-sdk";var vt,bt={exports:{}};var xt,wt=(vt||(vt=1,xt=bt,function(t,e){xt.exports=e()}(0,(()=>{return t={276:function(){!function(t){t.console||(t.console={});for(var e,r,i=t.console,n=function(){},o=["memory"],a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=o.pop();)i[e]||(i[e]={});for(;r=a.pop();)i[r]||(i[r]=n)}("undefined"==typeof window?this:window)},180:function(t,e,r){var i,n,o;n=[r(124)],void 0===(o="function"==typeof(i=function(t){var e=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(r))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(t){return!!t.match(r)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var r=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),i=r.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(r=i?r.replace(i[0],""):r).split(/\s+/).slice(1),o=this.extractLocation(i?i[1]:n.pop()),a=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(o[0])>-1?void 0:o[0];return new t({functionName:a,fileName:s,lineNumber:o[1],columnNumber:o[2],source:e})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(t){return!t.match(i)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t({functionName:e});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(r),n=i&&i[1]?i[1]:void 0,o=this.extractLocation(e.replace(r,""));return new t({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e})}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[],o=2,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new t({fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera10:function(e){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[],o=0,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new t({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera11:function(r){return r.stack.split("\n").filter((function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this).map((function(e){var r,i=e.split("@"),n=this.extractLocation(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;o.match(/\(([^)]*)\)/)&&(r=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new t({functionName:a,args:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e})}),this)}}})?i.apply(e,n):i)||(t.exports=o)},124:function(t,e){var r,i;void 0===(i="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t){return t.charAt(0).toUpperCase()+t.substring(1)}function r(t){return function(){return this[t]}}var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=i.concat(n,o,["args"],["evalOrigin"]);function s(t){if(t)for(var r=0;r<a.length;r++)void 0!==t[a[r]]&&this["set"+e(a[r])](t[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof s)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:i?i+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},s.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),i=t.substring(0,e),n=t.substring(e+1,r).split(","),o=t.substring(r+1);if(0===o.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),l=a[1],c=a[2],u=a[3];return new s({functionName:i,args:n||void 0,fileName:l,lineNumber:c||void 0,columnNumber:u||void 0})};for(var l=0;l<i.length;l++)s.prototype["get"+e(i[l])]=r(i[l]),s.prototype["set"+e(i[l])]=function(t){return function(e){this[t]=Boolean(e)}}(i[l]);for(var c=0;c<n.length;c++)s.prototype["get"+e(n[c])]=r(n[c]),s.prototype["set"+e(n[c])]=function(e){return function(r){if(!t(r))throw new TypeError(e+" must be a Number");this[e]=Number(r)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+e(o[u])]=r(o[u]),s.prototype["set"+e(o[u])]=function(t){return function(e){this[t]=String(e)}}(o[u]);return s})?r.apply(e,[]):r)||(t.exports=i)},815:(t,e,r)=>{var i=r(702),n=r(817),o={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443};function a(t,e,r,i,n){this.options=t,this.transport=e,this.url=r,this.truncation=i,this.jsonBackup=n,this.accessToken=t.accessToken,this.transportOptions=s(t,r)}function s(t,e){return n.getTransportFromOptions(t,o,e)}a.prototype.postItem=function(t,e){var r=n.transportOptions(this.transportOptions,"POST"),i=n.buildPayload(this.accessToken,t,this.jsonBackup),o=this;setTimeout((function(){o.transport.post(o.accessToken,r,i,e)}),0)},a.prototype.buildJsonPayload=function(t,e){var r,o=n.buildPayload(this.accessToken,t,this.jsonBackup);return(r=this.truncation?this.truncation.truncate(o):i.stringify(o)).error?(e&&e(r.error),null):r.value},a.prototype.postJsonPayload=function(t,e){var r=n.transportOptions(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,t,e)},a.prototype.configure=function(t){var e=this.oldOptions;return this.options=i.merge(e,t),this.transportOptions=s(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this},t.exports=a},817:(t,e,r)=>{var i=r(702);t.exports={buildPayload:function(t,e,r){if(!i.isType(e.context,"string")){var n=i.stringify(e.context,r);n.error?e.context="Error: could not serialize 'context'":e.context=n.value||"",e.context.length>255&&(e.context=e.context.substr(0,255))}return{access_token:t,data:e}},getTransportFromOptions:function(t,e,r){var i=e.hostname,n=e.protocol,o=e.port,a=e.path,s=e.search,l=t.timeout,c=function(t){var e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=t.defaultTransport||"xhr";return void 0===e.fetch&&(r="xhr"),void 0===e.XMLHttpRequest&&(r="fetch"),r}(t),u=t.proxy;if(t.endpoint){var h=r.parse(t.endpoint);i=h.hostname,n=h.protocol,o=h.port,a=h.pathname,s=h.search}return{timeout:l,hostname:i,protocol:n,port:o,path:a,search:s,proxy:u,transport:c}},transportOptions:function(t,e){var r=t.protocol||"https:",i=t.port||("http:"===r?80:"https:"===r?443:void 0),n=t.hostname,o=t.path,a=t.timeout,s=t.transport;return t.search&&(o+=t.search),t.proxy&&(o=r+"//"+n+o,n=t.proxy.host||t.proxy.hostname,i=t.proxy.port,r=t.proxy.protocol||r),{timeout:a,protocol:r,hostname:n,path:o,port:i,method:e,transport:s}},appendPathToPath:function(t,e){var r=/\/$/.test(t),i=/^\//.test(e);return r&&i?e=e.substring(1):r||i||(e="/"+e),t+e}}},739:(t,e,r)=>{var i=r(343);"undefined"==typeof window||window._rollbarStartTime||(window._rollbarStartTime=(new Date).getTime()),t.exports=i},403:(t,e,r)=>{var i=r(562),n=r(702),o=r(815),a=r(802),s=r(349),l=r(477),c=r(509),u=r(860),h=r(417),d=r(172),p=r(61),f=r(303);function m(t,e){this.options=n.handleOptions(w,t,null,a),this.options._configuredOptions=t;var r=this.components.telemeter,s=this.components.instrumenter,f=this.components.polyfillJSON;this.wrapGlobals=this.components.wrapGlobals,this.scrub=this.components.scrub;var m=this.components.truncation,g=new l(m),_=new o(this.options,g,c,m);r&&(this.telemeter=new r(this.options)),this.client=e||new i(this.options,_,a,this.telemeter,"browser");var y=v(),b="undefined"!=typeof document&&document;this.isChrome=y.chrome&&y.chrome.runtime,this.anonymousErrorsPending=0,function(t,e,r){t.addTransform(u.handleDomException).addTransform(u.handleItemWithError).addTransform(u.ensureItemHasSomethingToSay).addTransform(u.addBaseInfo).addTransform(u.addRequestInfo(r)).addTransform(u.addClientInfo(r)).addTransform(u.addPluginInfo(r)).addTransform(u.addBody).addTransform(h.addMessageWithError).addTransform(h.addTelemetryData).addTransform(h.addConfigToPayload).addTransform(u.addScrubber(e.scrub)).addTransform(h.addPayloadOptions).addTransform(h.userTransform(a)).addTransform(h.addConfiguredOptions).addTransform(h.addDiagnosticKeys).addTransform(h.itemToPayload)}(this.client.notifier,this,y),this.client.queue.addPredicate(p.checkLevel).addPredicate(d.checkIgnore).addPredicate(p.userCheckIgnore(a)).addPredicate(p.urlIsNotBlockListed(a)).addPredicate(p.urlIsSafeListed(a)).addPredicate(p.messageIsIgnored(a)),this.setupUnhandledCapture(),s&&(this.instrumenter=new s(this.options,this.client.telemeter,this,y,b),this.instrumenter.instrument()),n.setupJSON(f),this.rollbar=this}var g=null;function _(t){var e="Rollbar is not initialized";a.error(e),t&&t(new Error(e))}function y(t){for(var e=0,r=t.length;e<r;++e)if(n.isFunction(t[e]))return t[e]}function v(){return"undefined"!=typeof window&&window||"undefined"!=typeof self&&self}m.init=function(t,e){return g?g.global(t).configure(t):g=new m(t,e)},m.prototype.components={},m.setComponents=function(t){m.prototype.components=t},m.prototype.global=function(t){return this.client.global(t),this},m.global=function(t){if(g)return g.global(t);_()},m.prototype.configure=function(t,e){var r=this.options,i={};return e&&(i={payload:e}),this.options=n.handleOptions(r,t,i,a),this.options._configuredOptions=n.handleOptions(r._configuredOptions,t,i),this.client.configure(this.options,e),this.instrumenter&&this.instrumenter.configure(this.options),this.setupUnhandledCapture(),this},m.configure=function(t,e){if(g)return g.configure(t,e);_()},m.prototype.lastError=function(){return this.client.lastError},m.lastError=function(){if(g)return g.lastError();_()},m.prototype.log=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.log(t),{uuid:e}},m.log=function(){if(g)return g.log.apply(g,arguments);_(y(arguments))},m.prototype.debug=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.debug(t),{uuid:e}},m.debug=function(){if(g)return g.debug.apply(g,arguments);_(y(arguments))},m.prototype.info=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.info(t),{uuid:e}},m.info=function(){if(g)return g.info.apply(g,arguments);_(y(arguments))},m.prototype.warn=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warn(t),{uuid:e}},m.warn=function(){if(g)return g.warn.apply(g,arguments);_(y(arguments))},m.prototype.warning=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warning(t),{uuid:e}},m.warning=function(){if(g)return g.warning.apply(g,arguments);_(y(arguments))},m.prototype.error=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.error(t),{uuid:e}},m.error=function(){if(g)return g.error.apply(g,arguments);_(y(arguments))},m.prototype.critical=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.critical(t),{uuid:e}},m.critical=function(){if(g)return g.critical.apply(g,arguments);_(y(arguments))},m.prototype.buildJsonPayload=function(t){return this.client.buildJsonPayload(t)},m.buildJsonPayload=function(){if(g)return g.buildJsonPayload.apply(g,arguments);_()},m.prototype.sendJsonPayload=function(t){return this.client.sendJsonPayload(t)},m.sendJsonPayload=function(){if(g)return g.sendJsonPayload.apply(g,arguments);_()},m.prototype.setupUnhandledCapture=function(){var t=v();this.unhandledExceptionsInitialized||(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(s.captureUncaughtExceptions(t,this),this.wrapGlobals&&this.options.wrapGlobalEventHandlers&&this.wrapGlobals(t,this),this.unhandledExceptionsInitialized=!0),this.unhandledRejectionsInitialized||(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&(s.captureUnhandledRejections(t,this),this.unhandledRejectionsInitialized=!0)},m.prototype.handleUncaughtException=function(t,e,r,i,o,a){if(this.options.captureUncaught||this.options.handleUncaughtExceptions){if(this.options.inspectAnonymousErrors&&this.isChrome&&null===o&&""===e)return"anonymous";var s,l=n.makeUnhandledStackInfo(t,e,r,i,o,"onerror","uncaught exception",f);n.isError(o)?(s=this._createItem([t,o,a]))._unhandledStackInfo=l:n.isError(e)?(s=this._createItem([t,e,a]))._unhandledStackInfo=l:(s=this._createItem([t,a])).stackInfo=l,s.level=this.options.uncaughtErrorLevel,s._isUncaught=!0,this.client.log(s)}},m.prototype.handleAnonymousErrors=function(){if(this.options.inspectAnonymousErrors&&this.isChrome){var t=this;try{Error.prepareStackTrace=function(e,r){if(t.options.inspectAnonymousErrors&&t.anonymousErrorsPending){if(t.anonymousErrorsPending-=1,!e)return;e._isAnonymous=!0,t.handleUncaughtException(e.message,null,null,null,e)}return e.stack}}catch(t){this.options.inspectAnonymousErrors=!1,this.error("anonymous error handler failed",t)}}},m.prototype.handleUnhandledRejection=function(t,e){if(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections){var r="unhandled rejection was null or undefined!";if(t)if(t.message)r=t.message;else{var i=n.stringify(t);i.value&&(r=i.value)}var o,a=t&&t._rollbarContext||e&&e._rollbarContext;n.isError(t)?o=this._createItem([r,t,a]):(o=this._createItem([r,t,a])).stackInfo=n.makeUnhandledStackInfo(r,"",0,0,null,"unhandledrejection","",f),o.level=this.options.uncaughtErrorLevel,o._isUncaught=!0,o._originalArgs=o._originalArgs||[],o._originalArgs.push(e),this.client.log(o)}},m.prototype.wrap=function(t,e,r){try{var i;if(i=n.isFunction(e)?e:function(){return e||{}},!n.isFunction(t))return t;if(t._isWrap)return t;if(!t._rollbar_wrapped&&(t._rollbar_wrapped=function(){r&&n.isFunction(r)&&r.apply(this,arguments);try{return t.apply(this,arguments)}catch(r){var e=r;throw e&&window._rollbarWrappedError!==e&&(n.isType(e,"string")&&(e=new String(e)),e._rollbarContext=i()||{},e._rollbarContext._wrappedSource=t.toString(),window._rollbarWrappedError=e),e}},t._rollbar_wrapped._isWrap=!0,t.hasOwnProperty))for(var o in t)t.hasOwnProperty(o)&&"_rollbar_wrapped"!==o&&(t._rollbar_wrapped[o]=t[o]);return t._rollbar_wrapped}catch(e){return t}},m.wrap=function(t,e){if(g)return g.wrap(t,e);_()},m.prototype.captureEvent=function(){var t=n.createTelemetryEvent(arguments);return this.client.captureEvent(t.type,t.metadata,t.level)},m.captureEvent=function(){if(g)return g.captureEvent.apply(g,arguments);_()},m.prototype.captureDomContentLoaded=function(t,e){return e||(e=new Date),this.client.captureDomContentLoaded(e)},m.prototype.captureLoad=function(t,e){return e||(e=new Date),this.client.captureLoad(e)},m.prototype.loadFull=function(){a.info("Unexpected Rollbar.loadFull() called on a Notifier instance. This can happen when Rollbar is loaded multiple times.")},m.prototype._createItem=function(t){return n.createItem(t,a,this)};var b=r(948),x=r(677),w={version:b.version,scrubFields:x.scrubFields,logLevel:b.logLevel,reportLevel:b.reportLevel,uncaughtErrorLevel:b.uncaughtErrorLevel,endpoint:b.endpoint,verbose:!1,enabled:!0,transmit:!0,sendConfig:!1,includeItemsInTelemetry:!0,captureIp:!0,inspectAnonymousErrors:!0,ignoreDuplicateErrors:!0,wrapGlobalEventHandlers:!1};t.exports=m},677:t=>{t.exports={scrubFields:["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken","cc-number","card number","cardnumber","cardnum","ccnum","ccnumber","cc num","creditcardnumber","credit card number","newcreditcardnumber","new credit card","creditcardno","credit card no","card#","card #","cc-csc","cvc","cvc2","cvv2","ccv2","security code","card verification","name on credit card","name on card","nameoncard","cardholder","card holder","name des karteninhabers","ccname","card type","cardtype","cc type","cctype","payment type","expiration date","expirationdate","expdate","cc-exp","ccmonth","ccyear"]}},616:t=>{var e={ieVersion:function(){var t;if("undefined"==typeof document)return t;for(var e=3,r=document.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="\x3c!--[if gt IE "+ ++e+"]><i></i><![endif]--\x3e",i[0];);return e>4?e:t}};t.exports=e},300:t=>{function e(t){return(t.getAttribute("type")||"").toLowerCase()}function r(t){if(!t||!t.tagName)return"";var e=[t.tagName];t.id&&e.push("#"+t.id),t.classes&&e.push("."+t.classes.join("."));for(var r=0;r<t.attributes.length;r++)e.push("["+t.attributes[r].key+'="'+t.attributes[r].value+'"]');return e.join("")}function i(t){if(!t||!t.tagName)return null;var e,r,i,n,o={};o.tagName=t.tagName.toLowerCase(),t.id&&(o.id=t.id),(e=t.className)&&"string"==typeof e&&(o.classes=e.split(/\s+/));var a=["type","name","title","alt"];for(o.attributes=[],n=0;n<a.length;n++)r=a[n],(i=t.getAttribute(r))&&o.attributes.push({key:r,value:i});return o}t.exports={describeElement:i,descriptionToString:r,elementArrayToString:function(t){for(var e,i,n=[],o=0,a=t.length-1;a>=0;a--){if(e=r(t[a]),i=o+3*n.length+e.length,a<t.length-1&&i>=83){n.unshift("...");break}n.unshift(e),o+=e.length}return n.join(" > ")},treeToArray:function(t){for(var e,r=[],n=0;t&&n<5&&"html"!==(e=i(t)).tagName;n++)r.unshift(e),t=t.parentNode;return r},getElementFromEvent:function(t,e){return t.target?t.target:e&&e.elementFromPoint?e.elementFromPoint(t.clientX,t.clientY):void 0},isDescribedElement:function(t,r,i){if(t.tagName.toLowerCase()!==r.toLowerCase())return!1;if(!i)return!0;t=e(t);for(var n=0;n<i.length;n++)if(i[n]===t)return!0;return!1},getElementType:e}},349:t=>{t.exports={captureUncaughtExceptions:function(t,e,r){if(t){var i;if("function"==typeof e._rollbarOldOnError)i=e._rollbarOldOnError;else if(t.onerror){for(i=t.onerror;i._rollbarOldOnError;)i=i._rollbarOldOnError;e._rollbarOldOnError=i}e.handleAnonymousErrors();var n=function(){var r=Array.prototype.slice.call(arguments,0);!function(t,e,r,i){t._rollbarWrappedError&&(i[4]||(i[4]=t._rollbarWrappedError),i[5]||(i[5]=t._rollbarWrappedError._rollbarContext),t._rollbarWrappedError=null);var n=e.handleUncaughtException.apply(e,i);r&&r.apply(t,i),"anonymous"===n&&(e.anonymousErrorsPending+=1)}(t,e,i,r)};r&&(n._rollbarOldOnError=i),t.onerror=n}},captureUnhandledRejections:function(t,e,r){if(t){"function"==typeof t._rollbarURH&&t._rollbarURH.belongsToShim&&t.removeEventListener("unhandledrejection",t._rollbarURH);var i=function(t){var r,i,n;try{r=t.reason}catch(t){r=void 0}try{i=t.promise}catch(t){i="[unhandledrejection] error getting `promise` from event"}try{n=t.detail,!r&&n&&(r=n.reason,i=n.promise)}catch(t){}r||(r="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(r,i)};i.belongsToShim=r,t._rollbarURH=i,t.addEventListener("unhandledrejection",i)}}}},802:(t,e,r)=>{r(276);var i=r(616),n=r(702);t.exports={error:function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("Rollbar:"),i.ieVersion()<=8?console.error(n.formatArgsAsString(t)):console.error.apply(console,t)},info:function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("Rollbar:"),i.ieVersion()<=8?console.info(n.formatArgsAsString(t)):console.info.apply(console,t)},log:function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("Rollbar:"),i.ieVersion()<=8?console.log(n.formatArgsAsString(t)):console.log.apply(console,t)}}},172:(t,e,r)=>{var i=r(702);t.exports={checkIgnore:function(t,e){return!i.get(e,"plugins.jquery.ignoreAjaxErrors")||!i.get(t,"body.message.extra.isAjax")}}},343:(t,e,r)=>{var i=r(403),n=r(773),o=r(568),a=r(876),s=r(965),l=r(369),c=r(473);i.setComponents({telemeter:n,instrumenter:o,polyfillJSON:a,wrapGlobals:s,scrub:l,truncation:c}),t.exports=i},568:(t,e,r)=>{var i=r(702),n=r(650),o=r(297),a=r(369),s=r(509),l=r(300),c={network:!0,networkResponseHeaders:!1,networkResponseBody:!1,networkRequestHeaders:!1,networkRequestBody:!1,networkErrorOnHttp5xx:!1,networkErrorOnHttp4xx:!1,networkErrorOnHttp0:!1,log:!0,dom:!0,navigation:!0,connectivity:!0,contentSecurityPolicy:!0,errorOnContentSecurityPolicy:!1};function u(t,e){for(var r;t[e].length;)(r=t[e].shift())[0][r[1]]=r[2]}function h(t,e,r,n,o){this.options=t;var a=t.autoInstrument;!1===t.enabled||!1===a?this.autoInstrument={}:(i.isType(a,"object")||(a=c),this.autoInstrument=i.merge(c,a)),this.scrubTelemetryInputs=!!t.scrubTelemetryInputs,this.telemetryScrubber=t.telemetryScrubber,this.defaultValueScrubber=function(t){for(var e=[],r=0;r<t.length;++r)e.push(new RegExp(t[r],"i"));return function(t){var r=function(t){if(!t||!t.attributes)return null;for(var e=t.attributes,r=0;r<e.length;++r)if("name"===e[r].key)return e[r].value;return null}(t);if(!r)return!1;for(var i=0;i<e.length;++i)if(e[i].test(r))return!0;return!1}}(t.scrubFields),this.telemeter=e,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this._window=n||{},this._document=o||{},this.replacements={network:[],log:[],navigation:[],connectivity:[]},this.eventRemovers={dom:[],connectivity:[],contentsecuritypolicy:[]},this._location=this._window.location,this._lastHref=this._location&&this._location.href}function d(t){return"undefined"!=typeof URL&&t instanceof URL}h.prototype.configure=function(t){this.options=i.merge(this.options,t);var e=t.autoInstrument,r=i.merge(this.autoInstrument);!1===t.enabled||!1===e?this.autoInstrument={}:(i.isType(e,"object")||(e=c),this.autoInstrument=i.merge(c,e)),this.instrument(r),void 0!==t.scrubTelemetryInputs&&(this.scrubTelemetryInputs=!!t.scrubTelemetryInputs),void 0!==t.telemetryScrubber&&(this.telemetryScrubber=t.telemetryScrubber)},h.prototype.instrument=function(t){!this.autoInstrument.network||t&&t.network?!this.autoInstrument.network&&t&&t.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||t&&t.log?!this.autoInstrument.log&&t&&t.log&&this.deinstrumentConsole():this.instrumentConsole(),!this.autoInstrument.dom||t&&t.dom?!this.autoInstrument.dom&&t&&t.dom&&this.deinstrumentDom():this.instrumentDom(),!this.autoInstrument.navigation||t&&t.navigation?!this.autoInstrument.navigation&&t&&t.navigation&&this.deinstrumentNavigation():this.instrumentNavigation(),!this.autoInstrument.connectivity||t&&t.connectivity?!this.autoInstrument.connectivity&&t&&t.connectivity&&this.deinstrumentConnectivity():this.instrumentConnectivity(),!this.autoInstrument.contentSecurityPolicy||t&&t.contentSecurityPolicy?!this.autoInstrument.contentSecurityPolicy&&t&&t.contentSecurityPolicy&&this.deinstrumentContentSecurityPolicy():this.instrumentContentSecurityPolicy()},h.prototype.deinstrumentNetwork=function(){u(this.replacements,"network")},h.prototype.instrumentNetwork=function(){var t=this;function e(e,r){e in r&&i.isFunction(r[e])&&o(r,e,(function(e){return t.rollbar.wrap(e)}))}if("XMLHttpRequest"in this._window){var r=this._window.XMLHttpRequest.prototype;o(r,"open",(function(t){return function(e,r){var n=d(r);return(i.isType(r,"string")||n)&&(r=n?r.toString():r,this.__rollbar_xhr?(this.__rollbar_xhr.method=e,this.__rollbar_xhr.url=r,this.__rollbar_xhr.status_code=null,this.__rollbar_xhr.start_time_ms=i.now(),this.__rollbar_xhr.end_time_ms=null):this.__rollbar_xhr={method:e,url:r,status_code:null,start_time_ms:i.now(),end_time_ms:null}),t.apply(this,arguments)}}),this.replacements,"network"),o(r,"setRequestHeader",(function(e){return function(r,n){return this.__rollbar_xhr||(this.__rollbar_xhr={}),i.isType(r,"string")&&i.isType(n,"string")&&(t.autoInstrument.networkRequestHeaders&&(this.__rollbar_xhr.request_headers||(this.__rollbar_xhr.request_headers={}),this.__rollbar_xhr.request_headers[r]=n),"content-type"===r.toLowerCase()&&(this.__rollbar_xhr.request_content_type=n)),e.apply(this,arguments)}}),this.replacements,"network"),o(r,"send",(function(r){return function(n){var a=this;function s(){if(a.__rollbar_xhr&&(null===a.__rollbar_xhr.status_code&&(a.__rollbar_xhr.status_code=0,t.autoInstrument.networkRequestBody&&(a.__rollbar_xhr.request=n),a.__rollbar_event=t.captureNetwork(a.__rollbar_xhr,"xhr",void 0)),a.readyState<2&&(a.__rollbar_xhr.start_time_ms=i.now()),a.readyState>3)){a.__rollbar_xhr.end_time_ms=i.now();var e=null;if(a.__rollbar_xhr.response_content_type=a.getResponseHeader("Content-Type"),t.autoInstrument.networkResponseHeaders){var r=t.autoInstrument.networkResponseHeaders;e={};try{var o,s;if(!0===r){var l=a.getAllResponseHeaders();if(l){var c,u,h=l.trim().split(/[\r\n]+/);for(s=0;s<h.length;s++)o=(c=h[s].split(": ")).shift(),u=c.join(": "),e[o]=u}}else for(s=0;s<r.length;s++)e[o=r[s]]=a.getResponseHeader(o)}catch(t){}}var d=null;if(t.autoInstrument.networkResponseBody)try{d=a.responseText}catch(t){}var p=null;(d||e)&&(p={},d&&(t.isJsonContentType(a.__rollbar_xhr.response_content_type)?p.body=t.scrubJson(d):p.body=d),e&&(p.headers=e)),p&&(a.__rollbar_xhr.response=p);try{var f=a.status;f=1223===f?204:f,a.__rollbar_xhr.status_code=f,a.__rollbar_event.level=t.telemeter.levelFromStatus(f),t.errorOnHttpStatus(a.__rollbar_xhr)}catch(t){}}}return e("onload",a),e("onerror",a),e("onprogress",a),"onreadystatechange"in a&&i.isFunction(a.onreadystatechange)?o(a,"onreadystatechange",(function(e){return t.rollbar.wrap(e,void 0,s)})):a.onreadystatechange=s,a.__rollbar_xhr&&t.trackHttpErrors()&&(a.__rollbar_xhr.stack=(new Error).stack),r.apply(this,arguments)}}),this.replacements,"network")}"fetch"in this._window&&o(this._window,"fetch",(function(e){return function(r,o){for(var a=new Array(arguments.length),s=0,l=a.length;s<l;s++)a[s]=arguments[s];var c,u=a[0],h="GET",p=d(u);i.isType(u,"string")||p?c=p?u.toString():u:u&&(c=u.url,u.method&&(h=u.method)),a[1]&&a[1].method&&(h=a[1].method);var f={method:h,url:c,status_code:null,start_time_ms:i.now(),end_time_ms:null};if(a[1]&&a[1].headers){var m=n(a[1].headers);f.request_content_type=m.get("Content-Type"),t.autoInstrument.networkRequestHeaders&&(f.request_headers=t.fetchHeaders(m,t.autoInstrument.networkRequestHeaders))}return t.autoInstrument.networkRequestBody&&(a[1]&&a[1].body?f.request=a[1].body:a[0]&&!i.isType(a[0],"string")&&a[0].body&&(f.request=a[0].body)),t.captureNetwork(f,"fetch",void 0),t.trackHttpErrors()&&(f.stack=(new Error).stack),e.apply(this,a).then((function(e){f.end_time_ms=i.now(),f.status_code=e.status,f.response_content_type=e.headers.get("Content-Type");var r=null;t.autoInstrument.networkResponseHeaders&&(r=t.fetchHeaders(e.headers,t.autoInstrument.networkResponseHeaders));var n=null;return t.autoInstrument.networkResponseBody&&"function"==typeof e.text&&(n=e.clone().text()),(r||n)&&(f.response={},n&&("function"==typeof n.then?n.then((function(e){e&&t.isJsonContentType(f.response_content_type)?f.response.body=t.scrubJson(e):f.response.body=e})):f.response.body=n),r&&(f.response.headers=r)),t.errorOnHttpStatus(f),e}))}}),this.replacements,"network")},h.prototype.captureNetwork=function(t,e,r){return t.request&&this.isJsonContentType(t.request_content_type)&&(t.request=this.scrubJson(t.request)),this.telemeter.captureNetwork(t,e,r)},h.prototype.isJsonContentType=function(t){return!!(t&&i.isType(t,"string")&&t.toLowerCase().includes("json"))},h.prototype.scrubJson=function(t){return JSON.stringify(a(JSON.parse(t),this.options.scrubFields))},h.prototype.fetchHeaders=function(t,e){var r={};try{var i;if(!0===e){if("function"==typeof t.entries)for(var n=t.entries(),o=n.next();!o.done;)r[o.value[0]]=o.value[1],o=n.next()}else for(i=0;i<e.length;i++){var a=e[i];r[a]=t.get(a)}}catch(t){}return r},h.prototype.trackHttpErrors=function(){return this.autoInstrument.networkErrorOnHttp5xx||this.autoInstrument.networkErrorOnHttp4xx||this.autoInstrument.networkErrorOnHttp0},h.prototype.errorOnHttpStatus=function(t){var e=t.status_code;if(e>=500&&this.autoInstrument.networkErrorOnHttp5xx||e>=400&&this.autoInstrument.networkErrorOnHttp4xx||0===e&&this.autoInstrument.networkErrorOnHttp0){var r=new Error("HTTP request failed with Status "+e);r.stack=t.stack,this.rollbar.error(r,{skipFrames:1})}},h.prototype.deinstrumentConsole=function(){if("console"in this._window&&this._window.console.log)for(var t;this.replacements.log.length;)t=this.replacements.log.shift(),this._window.console[t[0]]=t[1]},h.prototype.instrumentConsole=function(){if("console"in this._window&&this._window.console.log){var t=this,e=this._window.console,r=["debug","info","warn","error","log"];try{for(var n=0,o=r.length;n<o;n++)a(r[n])}catch(t){this.diagnostic.instrumentConsole={error:t.message}}}function a(r){var n=e[r],o=e,a="warn"===r?"warning":r;e[r]=function(){var e=Array.prototype.slice.call(arguments),r=i.formatArgsAsString(e);t.telemeter.captureLog(r,a),n&&Function.prototype.apply.call(n,o,e)},t.replacements.log.push([r,n])}},h.prototype.deinstrumentDom=function(){("addEventListener"in this._window||"attachEvent"in this._window)&&this.removeListeners("dom")},h.prototype.instrumentDom=function(){if("addEventListener"in this._window||"attachEvent"in this._window){var t=this.handleClick.bind(this),e=this.handleBlur.bind(this);this.addListener("dom",this._window,"click","onclick",t,!0),this.addListener("dom",this._window,"blur","onfocusout",e,!0)}},h.prototype.handleClick=function(t){try{var e=l.getElementFromEvent(t,this._document),r=e&&e.tagName,i=l.isDescribedElement(e,"a")||l.isDescribedElement(e,"button");r&&(i||l.isDescribedElement(e,"input",["button","submit"]))?this.captureDomEvent("click",e):l.isDescribedElement(e,"input",["checkbox","radio"])&&this.captureDomEvent("input",e,e.value,e.checked)}catch(t){}},h.prototype.handleBlur=function(t){try{var e=l.getElementFromEvent(t,this._document);e&&e.tagName&&(l.isDescribedElement(e,"textarea")?this.captureDomEvent("input",e,e.value):l.isDescribedElement(e,"select")&&e.options&&e.options.length?this.handleSelectInputChanged(e):l.isDescribedElement(e,"input")&&!l.isDescribedElement(e,"input",["button","submit","hidden","checkbox","radio"])&&this.captureDomEvent("input",e,e.value))}catch(t){}},h.prototype.handleSelectInputChanged=function(t){if(t.multiple)for(var e=0;e<t.options.length;e++)t.options[e].selected&&this.captureDomEvent("input",t,t.options[e].value);else t.selectedIndex>=0&&t.options[t.selectedIndex]&&this.captureDomEvent("input",t,t.options[t.selectedIndex].value)},h.prototype.captureDomEvent=function(t,e,r,i){if(void 0!==r)if(this.scrubTelemetryInputs||"password"===l.getElementType(e))r="[scrubbed]";else{var n=l.describeElement(e);this.telemetryScrubber?this.telemetryScrubber(n)&&(r="[scrubbed]"):this.defaultValueScrubber(n)&&(r="[scrubbed]")}var o=l.elementArrayToString(l.treeToArray(e));this.telemeter.captureDom(t,o,r,i)},h.prototype.deinstrumentNavigation=function(){var t=this._window.chrome;!(t&&t.app&&t.app.runtime)&&this._window.history&&this._window.history.pushState&&u(this.replacements,"navigation")},h.prototype.instrumentNavigation=function(){var t=this._window.chrome;if(!(t&&t.app&&t.app.runtime)&&this._window.history&&this._window.history.pushState){var e=this;o(this._window,"onpopstate",(function(t){return function(){var r=e._location.href;e.handleUrlChange(e._lastHref,r),t&&t.apply(this,arguments)}}),this.replacements,"navigation"),o(this._window.history,"pushState",(function(t){return function(){var r=arguments.length>2?arguments[2]:void 0;return r&&e.handleUrlChange(e._lastHref,r+""),t.apply(this,arguments)}}),this.replacements,"navigation")}},h.prototype.handleUrlChange=function(t,e){var r=s.parse(this._location.href),i=s.parse(e),n=s.parse(t);this._lastHref=e,r.protocol===i.protocol&&r.host===i.host&&(e=i.path+(i.hash||"")),r.protocol===n.protocol&&r.host===n.host&&(t=n.path+(n.hash||"")),this.telemeter.captureNavigation(t,e)},h.prototype.deinstrumentConnectivity=function(){("addEventListener"in this._window||"body"in this._document)&&(this._window.addEventListener?this.removeListeners("connectivity"):u(this.replacements,"connectivity"))},h.prototype.instrumentConnectivity=function(){if("addEventListener"in this._window||"body"in this._document)if(this._window.addEventListener)this.addListener("connectivity",this._window,"online",void 0,function(){this.telemeter.captureConnectivityChange("online")}.bind(this),!0),this.addListener("connectivity",this._window,"offline",void 0,function(){this.telemeter.captureConnectivityChange("offline")}.bind(this),!0);else{var t=this;o(this._document.body,"ononline",(function(e){return function(){t.telemeter.captureConnectivityChange("online"),e&&e.apply(this,arguments)}}),this.replacements,"connectivity"),o(this._document.body,"onoffline",(function(e){return function(){t.telemeter.captureConnectivityChange("offline"),e&&e.apply(this,arguments)}}),this.replacements,"connectivity")}},h.prototype.handleCspEvent=function(t){var e="Security Policy Violation: blockedURI: "+t.blockedURI+", violatedDirective: "+t.violatedDirective+", effectiveDirective: "+t.effectiveDirective+", ";t.sourceFile&&(e+="location: "+t.sourceFile+", line: "+t.lineNumber+", col: "+t.columnNumber+", "),e+="originalPolicy: "+t.originalPolicy,this.telemeter.captureLog(e,"error"),this.handleCspError(e)},h.prototype.handleCspError=function(t){this.autoInstrument.errorOnContentSecurityPolicy&&this.rollbar.error(t)},h.prototype.deinstrumentContentSecurityPolicy=function(){"addEventListener"in this._document&&this.removeListeners("contentsecuritypolicy")},h.prototype.instrumentContentSecurityPolicy=function(){if("addEventListener"in this._document){var t=this.handleCspEvent.bind(this);this.addListener("contentsecuritypolicy",this._document,"securitypolicyviolation",null,t,!1)}},h.prototype.addListener=function(t,e,r,i,n,o){e.addEventListener?(e.addEventListener(r,n,o),this.eventRemovers[t].push((function(){e.removeEventListener(r,n,o)}))):i&&(e.attachEvent(i,n),this.eventRemovers[t].push((function(){e.detachEvent(i,n)})))},h.prototype.removeListeners=function(t){for(;this.eventRemovers[t].length;)this.eventRemovers[t].shift()()},t.exports=h},860:(t,e,r)=>{var i=r(702),n=r(303),o=r(802);function a(t,e,r){var n=t.message,o=t.custom;n||(n="Item sent with null or missing arguments.");var a={body:n};o&&(a.extra=i.merge(o)),i.set(t,"data.body",{message:a}),r(null,t)}function s(t){var e=t.stackInfo.stack;return e&&0===e.length&&t._unhandledStackInfo&&t._unhandledStackInfo.stack&&(e=t._unhandledStackInfo.stack),e}function l(t,e,r){var o=t&&t.data.description,a=t&&t.custom,l=s(t),u=n.guessErrorClass(e.message),h={exception:{class:c(e,u[0],r),message:u[1]}};if(o&&(h.exception.description=o),l){var d,p,f,m,g,_,y,v;for(0===l.length&&(h.exception.stack=e.rawStack,h.exception.raw=String(e.rawException)),h.frames=[],y=0;y<l.length;++y)p={filename:(d=l[y]).url?i.sanitizeUrl(d.url):"(unknown)",lineno:d.line||null,method:d.func&&"?"!==d.func?d.func:"[anonymous]",colno:d.column},r.sendFrameUrl&&(p.url=d.url),p.method&&p.method.endsWith&&p.method.endsWith("_rollbar_wrapped")||(f=m=g=null,(_=d.context?d.context.length:0)&&(v=Math.floor(_/2),m=d.context.slice(0,v),f=d.context[v],g=d.context.slice(v)),f&&(p.code=f),(m||g)&&(p.context={},m&&m.length&&(p.context.pre=m),g&&g.length&&(p.context.post=g)),d.args&&(p.args=d.args),h.frames.push(p));h.frames.reverse(),a&&(h.extra=i.merge(a))}return h}function c(t,e,r){return t.name?t.name:r.guessErrorClass?e:"(unknown)"}t.exports={handleDomException:function(t,e,r){if(t.err&&"DOMException"===n.Stack(t.err).name){var i=new Error;i.name=t.err.name,i.message=t.err.message,i.stack=t.err.stack,i.nested=t.err,t.err=i}r(null,t)},handleItemWithError:function(t,e,r){if(t.data=t.data||{},t.err)try{t.stackInfo=t.err._savedStackTrace||n.parse(t.err,t.skipFrames),e.addErrorContext&&function(t){var e=[],r=t.err;for(e.push(r);r.nested||r.cause;)r=r.nested||r.cause,e.push(r);i.addErrorContext(t,e)}(t)}catch(e){o.error("Error while parsing the error object.",e);try{t.message=t.err.message||t.err.description||t.message||String(t.err)}catch(e){t.message=String(t.err)||String(e)}delete t.err}r(null,t)},ensureItemHasSomethingToSay:function(t,e,r){t.message||t.stackInfo||t.custom||r(new Error("No message, stack info, or custom data"),null),r(null,t)},addBaseInfo:function(t,e,r){var n=e.payload&&e.payload.environment||e.environment;t.data=i.merge(t.data,{environment:n,level:t.level,endpoint:e.endpoint,platform:"browser",framework:"browser-js",language:"javascript",server:{},uuid:t.uuid,notifier:{name:"rollbar-browser-js",version:e.version},custom:t.custom}),r(null,t)},addRequestInfo:function(t){return function(e,r,n){var o={};t&&t.location&&(o.url=t.location.href,o.query_string=t.location.search);var a="$remote_ip";r.captureIp?!0!==r.captureIp&&(a+="_anonymize"):a=null,a&&(o.user_ip=a),Object.keys(o).length>0&&i.set(e,"data.request",o),n(null,e)}},addClientInfo:function(t){return function(e,r,n){if(!t)return n(null,e);var o=t.navigator||{},a=t.screen||{};i.set(e,"data.client",{runtime_ms:e.timestamp-t._rollbarStartTime,timestamp:Math.round(e.timestamp/1e3),javascript:{browser:o.userAgent,language:o.language,cookie_enabled:o.cookieEnabled,screen:{width:a.width,height:a.height}}}),n(null,e)}},addPluginInfo:function(t){return function(e,r,n){if(!t||!t.navigator)return n(null,e);for(var o,a=[],s=t.navigator.plugins||[],l=0,c=s.length;l<c;++l)o=s[l],a.push({name:o.name,description:o.description});i.set(e,"data.client.javascript.plugins",a),n(null,e)}},addBody:function(t,e,r){t.stackInfo?t.stackInfo.traceChain?function(t,e,r){for(var n=t.stackInfo.traceChain,o=[],a=n.length,s=0;s<a;s++){var c=l(t,n[s],e);o.push(c)}i.set(t,"data.body",{trace_chain:o}),r(null,t)}(t,e,r):function(t,e,r){if(s(t)){var o=l(t,t.stackInfo,e);i.set(t,"data.body",{trace:o}),r(null,t)}else{var u=t.stackInfo,h=n.guessErrorClass(u.message),d=c(u,h[0],e),p=h[1];t.message=d+": "+p,a(t,0,r)}}(t,e,r):a(t,0,r)},addScrubber:function(t){return function(e,r,i){if(t){var n=r.scrubFields||[],o=r.scrubPaths||[];e.data=t(e.data,n,o)}i(null,e)}}}},477:(t,e,r)=>{var i=r(702),n=r(656),o=r(86);function a(t){this.truncation=t}a.prototype.get=function(t,e,r,n,o){n&&i.isFunction(n)||(n=function(){}),i.addParamsAndAccessTokenToPath(t,e,r);var a=i.formatUrl(e);this._makeZoneRequest(t,a,"GET",null,n,o,e.timeout,e.transport)},a.prototype.post=function(t,e,r,n,o){if(n&&i.isFunction(n)||(n=function(){}),!r)return n(new Error("Cannot send empty request"));var a;if((a=this.truncation?this.truncation.truncate(r):i.stringify(r)).error)return n(a.error);var s=a.value,l=i.formatUrl(e);this._makeZoneRequest(t,l,"POST",s,n,o,e.timeout,e.transport)},a.prototype.postJsonPayload=function(t,e,r,n,o){n&&i.isFunction(n)||(n=function(){});var a=i.formatUrl(e);this._makeZoneRequest(t,a,"POST",r,n,o,e.timeout,e.transport)},a.prototype._makeZoneRequest=function(){var t="undefined"!=typeof window&&window||void 0!==n&&n,e=t&&t.Zone&&t.Zone.current,r=Array.prototype.slice.call(arguments);if(e&&"angular"===e._name){var i=e._parent,n=this;i.run((function(){n._makeRequest.apply(void 0,r)}))}else this._makeRequest.apply(void 0,r)},a.prototype._makeRequest=function(t,e,r,i,a,s,l,c){if("undefined"!=typeof RollbarProxy)return function(t,e){(new RollbarProxy).sendJsonPayload(t,(function(t){}),(function(t){e(new Error(t))}))}(i,a);"fetch"===c?n(t,e,r,i,a,l):o(t,e,r,i,a,s,l)},t.exports=a},656:(t,e,r)=>{var i=r(802),n=r(702);t.exports=function(t,e,r,o,a,s){var l,c;n.isFiniteNumber(s)&&(l=new AbortController,c=setTimeout((function(){l.abort()}),s)),fetch(e,{method:r,headers:{"Content-Type":"application/json","X-Rollbar-Access-Token":t,signal:l&&l.signal},body:o}).then((function(t){return c&&clearTimeout(c),t.json()})).then((function(t){a(null,t)})).catch((function(t){i.error(t.message),a(t)}))}},86:(t,e,r)=>{var i=r(702),n=r(802);function o(t,e){var r=new Error(t);return r.code=e||"ENOTFOUND",r}t.exports=function(t,e,r,a,s,l,c){var u;if(!(u=l?l():function(){var t,e,r=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],i=r.length;for(e=0;e<i;e++)try{t=r[e]();break}catch(t){}return t}()))return s(new Error("No way to send a request"));try{try{var h=function(){try{if(h&&4===u.readyState){h=void 0;var t=i.jsonParse(u.responseText);if((a=u)&&a.status&&200===a.status)return void s(t.error,t.value);if(function(t){return t&&i.isType(t.status,"number")&&t.status>=400&&t.status<600}(u)){if(403===u.status){var e=t.value&&t.value.message;n.error(e)}s(new Error(String(u.status)))}else s(o("XHR response had no status code (likely connection failure)"))}}catch(t){var r;r=t&&t.stack?t:new Error(t),s(r)}var a};u.open(r,e,!0),u.setRequestHeader&&(u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("X-Rollbar-Access-Token",t)),i.isFiniteNumber(c)&&(u.timeout=c),u.onreadystatechange=h,u.send(a)}catch(t){if("undefined"!=typeof XDomainRequest){if(!window||!window.location)return s(new Error("No window available during request, unknown environment"));"http:"===window.location.href.substring(0,5)&&"https"===e.substring(0,5)&&(e="http"+e.substring(5));var d=new XDomainRequest;d.onprogress=function(){},d.ontimeout=function(){s(o("Request timed out","ETIMEDOUT"))},d.onerror=function(){s(new Error("Error during request"))},d.onload=function(){var t=i.jsonParse(d.responseText);s(t.error,t.value)},d.open(r,e,!0),d.send(a)}else s(new Error("Cannot find a method to transport a request"))}}catch(t){s(t)}}},509:t=>{t.exports={parse:function(t){var e,r,i={protocol:null,auth:null,host:null,path:null,hash:null,href:t,hostname:null,port:null,pathname:null,search:null,query:null};if(-1!==(e=t.indexOf("//"))?(i.protocol=t.substring(0,e),r=e+2):r=0,-1!==(e=t.indexOf("@",r))&&(i.auth=t.substring(r,e),r=e+1),-1===(e=t.indexOf("/",r))){if(-1===(e=t.indexOf("?",r)))return-1===(e=t.indexOf("#",r))?i.host=t.substring(r):(i.host=t.substring(r,e),i.hash=t.substring(e)),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),i;i.host=t.substring(r,e),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=e}else i.host=t.substring(r,e),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=e;if(-1===(e=t.indexOf("#",r))?i.path=t.substring(r):(i.path=t.substring(r,e),i.hash=t.substring(e)),i.path){var n=i.path.split("?");i.pathname=n[0],i.query=n[1],i.search=i.query?"?"+i.query:null}return i}}},965:t=>{function e(t,e,r){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var i=e.addEventListener;i._rollbarOldAdd&&i.belongsToShim;)i=i._rollbarOldAdd;var n=function(e,r,n){i.call(this,e,t.wrap(r),n)};n._rollbarOldAdd=i,n.belongsToShim=r,e.addEventListener=n;for(var o=e.removeEventListener;o._rollbarOldRemove&&o.belongsToShim;)o=o._rollbarOldRemove;var a=function(t,e,r){o.call(this,t,e&&e._rollbar_wrapped||e,r)};a._rollbarOldRemove=o,a.belongsToShim=r,e.removeEventListener=a}}t.exports=function(t,r,i){if(t){var n,o,a="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(n=0;n<a.length;++n)t[o=a[n]]&&t[o].prototype&&e(r,t[o].prototype,i)}}},948:t=>{t.exports={version:"2.26.4",endpoint:"api.rollbar.com/api/1/item/",logLevel:"debug",reportLevel:"debug",uncaughtErrorLevel:"error",maxItems:0,itemsPerMin:60}},303:(t,e,r)=>{var i=r(180),n=new RegExp("^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ");function o(t){var e={};return e._stackFrame=t,e.url=t.fileName,e.line=t.lineNumber,e.func=t.functionName,e.column=t.columnNumber,e.args=t.args,e.context=null,e}function a(t,e){return{stack:function(){var r=[];e=e||0;try{r=i.parse(t)}catch(t){r=[]}for(var n=[],a=e;a<r.length;a++)n.push(new o(r[a]));return n}(),message:t.message,name:(r=t,n=r.name&&r.name.length&&r.name,a=r.constructor.name&&r.constructor.name.length&&r.constructor.name,n&&a?"Error"===n?a:n:n||a),rawStack:t.stack,rawException:t};var r,n,a}t.exports={guessFunctionName:function(){return"?"},guessErrorClass:function(t){if(!t||!t.match)return["Unknown error. There was no error message to display.",""];var e=t.match(n),r="(unknown)";return e&&(r=e[e.length-1],t=(t=t.replace((e[e.length-2]||"")+r+":","")).replace(/(^[\s]+|[\s]+$)/g,"")),[r,t]},gatherContext:function(){return null},parse:function(t,e){var r=t;if(r.nested||r.cause){for(var i=[];r;)i.push(new a(r,e)),r=r.nested||r.cause,e=0;return i[0].traceChain=i,i[0]}return new a(r,e)},Stack:a,Frame:o}},420:t=>{var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var i,n=e.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(i in t);return void 0===i||e.call(t,i)};t.exports=function t(){var e,r,n,o,a,s={},l=null,c=arguments.length;for(e=0;e<c;e++)if(null!=(l=arguments[e]))for(a in l)r=s[a],s!==(n=l[a])&&(n&&i(n)?(o=r&&i(r)?r:{},s[a]=t(o,n)):void 0!==n&&(s[a]=n));return s}},314:(t,e,r)=>{var i=r(702);function n(t,e){this.queue=t,this.options=e,this.transforms=[],this.diagnostic={}}n.prototype.configure=function(t){this.queue&&this.queue.configure(t);var e=this.options;return this.options=i.merge(e,t),this},n.prototype.addTransform=function(t){return i.isFunction(t)&&this.transforms.push(t),this},n.prototype.log=function(t,e){if(e&&i.isFunction(e)||(e=function(){}),!this.options.enabled)return e(new Error("Rollbar is not enabled"));this.queue.addPendingItem(t);var r=t.err;this._applyTransforms(t,function(i,n){if(i)return this.queue.removePendingItem(t),e(i,null);this.queue.addItem(n,e,r,t)}.bind(this))},n.prototype._applyTransforms=function(t,e){var r=-1,i=this.transforms.length,n=this.transforms,o=this.options,a=function(t,s){t?e(t,null):++r!==i?n[r](s,o,a):e(null,s)};a(null,t)},t.exports=n},61:(t,e,r)=>{var i=r(702);function n(t,e,r){if(!t)return!r;var n,o,a=t.frames;if(!a||0===a.length)return!r;for(var s=e.length,l=a.length,c=0;c<l;c++){if(n=a[c].filename,!i.isType(n,"string"))return!r;for(var u=0;u<s;u++)if(o=e[u],new RegExp(o).test(n))return!0}return!1}function o(t,e,r,o){var a,s,l=!1;"blocklist"===r&&(l=!0);try{if(a=l?e.hostBlockList:e.hostSafeList,s=i.get(t,"body.trace_chain")||[i.get(t,"body.trace")],!a||0===a.length)return!l;if(0===s.length||!s[0])return!l;for(var c=s.length,u=0;u<c;u++)if(n(s[u],a,l))return!0}catch(t){l?e.hostBlockList=null:e.hostSafeList=null;var h=l?"hostBlockList":"hostSafeList";return o.error("Error while reading your configuration's "+h+" option. Removing custom "+h+".",t),!l}return!1}t.exports={checkLevel:function(t,e){var r=t.level,n=i.LEVELS[r]||0,o=e.reportLevel;return!(n<(i.LEVELS[o]||0))},userCheckIgnore:function(t){return function(e,r){var n=!!e._isUncaught;delete e._isUncaught;var o=e._originalArgs;delete e._originalArgs;try{i.isFunction(r.onSendCallback)&&r.onSendCallback(n,o,e)}catch(e){r.onSendCallback=null,t.error("Error while calling onSendCallback, removing",e)}try{if(i.isFunction(r.checkIgnore)&&r.checkIgnore(n,o,e))return!1}catch(e){r.checkIgnore=null,t.error("Error while calling custom checkIgnore(), removing",e)}return!0}},urlIsNotBlockListed:function(t){return function(e,r){return!o(e,r,"blocklist",t)}},urlIsSafeListed:function(t){return function(e,r){return o(e,r,"safelist",t)}},messageIsIgnored:function(t){return function(e,r){var n,o,a,s,l,c;try{if(!(a=r.ignoredMessages)||0===a.length)return!0;if(c=function(t){var e=t.body,r=[];if(e.trace_chain)for(var n=e.trace_chain,o=0;o<n.length;o++){var a=n[o];r.push(i.get(a,"exception.message"))}return e.trace&&r.push(i.get(e,"trace.exception.message")),e.message&&r.push(i.get(e,"message.body")),r}(e),0===c.length)return!0;for(s=a.length,n=0;n<s;n++)for(l=new RegExp(a[n],"gi"),o=0;o<c.length;o++)if(l.test(c[o]))return!1}catch(e){r.ignoredMessages=null,t.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}}},358:(t,e,r)=>{var i=r(702);function n(t,e,r,i){this.rateLimiter=t,this.api=e,this.logger=r,this.options=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}n.prototype.configure=function(t){this.api&&this.api.configure(t);var e=this.options;return this.options=i.merge(e,t),this},n.prototype.addPredicate=function(t){return i.isFunction(t)&&this.predicates.push(t),this},n.prototype.addPendingItem=function(t){this.pendingItems.push(t)},n.prototype.removePendingItem=function(t){var e=this.pendingItems.indexOf(t);-1!==e&&this.pendingItems.splice(e,1)},n.prototype.addItem=function(t,e,r,n){e&&i.isFunction(e)||(e=function(){});var o=this._applyPredicates(t);if(o.stop)return this.removePendingItem(n),void e(o.err);if(this._maybeLog(t,r),this.removePendingItem(n),this.options.transmit){this.pendingRequests.push(t);try{this._makeApiRequest(t,function(r,i){this._dequeuePendingRequest(t),e(r,i)}.bind(this))}catch(r){this._dequeuePendingRequest(t),e(r)}}else e(new Error("Transmit disabled"))},n.prototype.wait=function(t){i.isFunction(t)&&(this.waitCallback=t,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){this._maybeCallWait()}.bind(this),500)))},n.prototype._applyPredicates=function(t){for(var e=null,r=0,i=this.predicates.length;r<i;r++)if(!(e=this.predicates[r](t,this.options))||void 0!==e.err)return{stop:!0,err:e.err};return{stop:!1,err:null}},n.prototype._makeApiRequest=function(t,e){var r=this.rateLimiter.shouldSend(t);r.shouldSend?this.api.postItem(t,function(r,i){r?this._maybeRetry(r,t,e):e(r,i)}.bind(this)):r.error?e(r.error):this.api.postItem(r.payload,e)};var o=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"];n.prototype._maybeRetry=function(t,e,r){var n=!1;if(this.options.retryInterval){for(var a=0,s=o.length;a<s;a++)if(t.code===o[a]){n=!0;break}n&&i.isFiniteNumber(this.options.maxRetries)&&(e.retries=e.retries?e.retries+1:1,e.retries>this.options.maxRetries&&(n=!1))}n?this._retryApiRequest(e,r):r(t)},n.prototype._retryApiRequest=function(t,e){this.retryQueue.push({item:t,callback:e}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;this.retryQueue.length;){var t=this.retryQueue.shift();this._makeApiRequest(t.item,t.callback)}}.bind(this),this.options.retryInterval))},n.prototype._dequeuePendingRequest=function(t){var e=this.pendingRequests.indexOf(t);-1!==e&&(this.pendingRequests.splice(e,1),this._maybeCallWait())},n.prototype._maybeLog=function(t,e){if(this.logger&&this.options.verbose){var r=e;if(r=(r=r||i.get(t,"body.trace.exception.message"))||i.get(t,"body.trace_chain.0.exception.message"))return void this.logger.error(r);(r=i.get(t,"body.message.body"))&&this.logger.log(r)}},n.prototype._maybeCallWait=function(){return!(!i.isFunction(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))},t.exports=n},790:(t,e,r)=>{var i=r(702);function n(t){this.startTime=i.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(t)}function o(t,e,r){return!t.ignoreRateLimit&&e>=1&&r>e}function a(t,e,r,i,n,o,a){var s=null;return r&&(r=new Error(r)),r||i||(s=function(t,e,r,i,n){var o={body:{message:{body:n?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",extra:{maxItems:r,itemsPerMinute:i}}},language:"javascript",environment:e.environment||e.payload&&e.payload.environment,notifier:{version:e.notifier&&e.notifier.version||e.version}};return"browser"===t?(o.platform="browser",o.framework="browser-js",o.notifier.name="rollbar-browser-js"):"server"===t?(o.framework=e.framework||"node-js",o.notifier.name=e.notifier.name):"react-native"===t&&(o.framework=e.framework||"react-native",o.notifier.name=e.notifier.name),o}(t,e,n,o,a)),{error:r,shouldSend:i,payload:s}}n.globalSettings={startTime:i.now(),maxItems:void 0,itemsPerMinute:void 0},n.prototype.configureGlobal=function(t){void 0!==t.startTime&&(n.globalSettings.startTime=t.startTime),void 0!==t.maxItems&&(n.globalSettings.maxItems=t.maxItems),void 0!==t.itemsPerMinute&&(n.globalSettings.itemsPerMinute=t.itemsPerMinute)},n.prototype.shouldSend=function(t,e){var r=(e=e||i.now())-this.startTime;(r<0||r>=6e4)&&(this.startTime=e,this.perMinCounter=0);var s=n.globalSettings.maxItems,l=n.globalSettings.itemsPerMinute;if(o(t,s,this.counter))return a(this.platform,this.platformOptions,s+" max items reached",!1);if(o(t,l,this.perMinCounter))return a(this.platform,this.platformOptions,l+" items per minute reached",!1);this.counter++,this.perMinCounter++;var c=!o(t,s,this.counter),u=c;return c=c&&!o(t,l,this.perMinCounter),a(this.platform,this.platformOptions,null,c,s,l,u)},n.prototype.setPlatformOptions=function(t,e){this.platform=t,this.platformOptions=e},t.exports=n},562:(t,e,r)=>{var i=r(790),n=r(358),o=r(314),a=r(702);function s(t,e,r,i,u){this.options=a.merge(t),this.logger=r,s.rateLimiter.configureGlobal(this.options),s.rateLimiter.setPlatformOptions(u,this.options),this.api=e,this.queue=new n(s.rateLimiter,e,r,this.options);var h=this.options.tracer||null;c(h)?(this.tracer=h,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new o(this.queue,this.options),this.telemeter=i,l(t),this.lastError=null,this.lastErrorHash="none"}function l(t){t.stackTraceLimit&&(Error.stackTraceLimit=t.stackTraceLimit)}function c(t){if(!t)return!1;if(!t.scope||"function"!=typeof t.scope)return!1;var e=t.scope();return!(!e||!e.active||"function"!=typeof e.active)}s.rateLimiter=new i({maxItems:0,itemsPerMinute:60}),s.prototype.global=function(t){return s.rateLimiter.configureGlobal(t),this},s.prototype.configure=function(t,e){var r=this.options,i={};e&&(i={payload:e}),this.options=a.merge(r,t,i);var n=this.options.tracer||null;return c(n)?(this.tracer=n,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),l(t),this.global(this.options),c(t.tracer)&&(this.tracer=t.tracer),this},s.prototype.log=function(t){var e=this._defaultLogLevel();return this._log(e,t)},s.prototype.debug=function(t){this._log("debug",t)},s.prototype.info=function(t){this._log("info",t)},s.prototype.warn=function(t){this._log("warning",t)},s.prototype.warning=function(t){this._log("warning",t)},s.prototype.error=function(t){this._log("error",t)},s.prototype.critical=function(t){this._log("critical",t)},s.prototype.wait=function(t){this.queue.wait(t)},s.prototype.captureEvent=function(t,e,r){return this.telemeter&&this.telemeter.captureEvent(t,e,r)},s.prototype.captureDomContentLoaded=function(t){return this.telemeter&&this.telemeter.captureDomContentLoaded(t)},s.prototype.captureLoad=function(t){return this.telemeter&&this.telemeter.captureLoad(t)},s.prototype.buildJsonPayload=function(t){return this.api.buildJsonPayload(t)},s.prototype.sendJsonPayload=function(t){this.api.postJsonPayload(t)},s.prototype._log=function(t,e){var r;if(e.callback&&(r=e.callback,delete e.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(e)){if(r){var i=new Error("ignored identical item");i.item=e,r(i)}}else try{this._addTracingInfo(e),e.level=e.level||t,this.telemeter&&this.telemeter._captureRollbarItem(e),e.telemetryEvents=this.telemeter&&this.telemeter.copyEvents()||[],this.notifier.log(e,r)}catch(t){r&&r(t),this.logger.error(t)}},s.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},s.prototype._sameAsLastError=function(t){if(!t._isUncaught)return!1;var e=function(t){return(t.message||"")+"::"+((t.err||{}).stack||String(t.err))}(t);return this.lastErrorHash===e||(this.lastError=t.err,this.lastErrorHash=e,!1)},s.prototype._addTracingInfo=function(t){if(this.tracer){var e=this.tracer.scope().active();if(function(t){if(!t||!t.context||"function"!=typeof t.context)return!1;var e=t.context();return!!(e&&e.toSpanId&&e.toTraceId&&"function"==typeof e.toSpanId&&"function"==typeof e.toTraceId)}(e)){e.setTag("rollbar.error_uuid",t.uuid),e.setTag("rollbar.has_error",!0),e.setTag("error",!0),e.setTag("rollbar.item_url",`https://rollbar.com/item/uuid/?uuid=${t.uuid}`),e.setTag("rollbar.occurrence_url",`https://rollbar.com/occurrence/uuid/?uuid=${t.uuid}`);var r=e.context().toSpanId(),i=e.context().toTraceId();t.custom?(t.custom.opentracing_span_id=r,t.custom.opentracing_trace_id=i):t.custom={opentracing_span_id:r,opentracing_trace_id:i}}}},t.exports=s},369:(t,e,r)=>{var i=r(702),n=r(267);function o(t,e){var r=e.split("."),n=r.length-1;try{for(var o=0;o<=n;++o)o<n?t=t[r[o]]:t[r[o]]=i.redact()}catch(t){}}t.exports=function(t,e,r){if(e=e||[],r)for(var a=0;a<r.length;++a)o(t,r[a]);var s=function(t){for(var e,r=[],i=0;i<t.length;++i)e="^\\[?(%5[bB])?"+t[i]+"\\[?(%5[bB])?\\]?(%5[dD])?$",r.push(new RegExp(e,"i"));return r}(e),l=function(t){for(var e,r=[],i=0;i<t.length;++i)e="\\[?(%5[bB])?"+t[i]+"\\[?(%5[bB])?\\]?(%5[dD])?",r.push(new RegExp("("+e+"=)([^&\\n]+)","igm"));return r}(e);function c(t,e){return e+i.redact()}return n(t,(function t(e,r,o){var a=function(t,e){var r;for(r=0;r<s.length;++r)if(s[r].test(t)){e=i.redact();break}return e}(e,r);return a===r?i.isType(r,"object")||i.isType(r,"array")?n(r,t,o):function(t){var e;if(i.isType(t,"string"))for(e=0;e<l.length;++e)t=t.replace(l[e],c);return t}(a):a}))}},773:(t,e,r)=>{var i=r(702),n=100;function o(t){this.queue=[],this.options=i.merge(t);var e=this.options.maxTelemetryEvents||n;this.maxQueueSize=Math.max(0,Math.min(e,n))}function a(t,e){return e||{error:"error",manual:"info"}[t]||"info"}o.prototype.configure=function(t){var e=this.options;this.options=i.merge(e,t);var r=this.options.maxTelemetryEvents||n,o=Math.max(0,Math.min(r,n)),a=0;this.queue.length>o&&(a=this.queue.length-o),this.maxQueueSize=o,this.queue.splice(0,a)},o.prototype.copyEvents=function(){var t=Array.prototype.slice.call(this.queue,0);if(i.isFunction(this.options.filterTelemetry))try{for(var e=t.length;e--;)this.options.filterTelemetry(t[e])&&t.splice(e,1)}catch(t){this.options.filterTelemetry=null}return t},o.prototype.capture=function(t,e,r,n,o){var s={level:a(t,r),type:t,timestamp_ms:o||i.now(),body:e,source:"client"};n&&(s.uuid=n);try{if(i.isFunction(this.options.filterTelemetry)&&this.options.filterTelemetry(s))return!1}catch(t){this.options.filterTelemetry=null}return this.push(s),s},o.prototype.captureEvent=function(t,e,r,i){return this.capture(t,e,r,i)},o.prototype.captureError=function(t,e,r,i){var n={message:t.message||String(t)};return t.stack&&(n.stack=t.stack),this.capture("error",n,e,r,i)},o.prototype.captureLog=function(t,e,r,i){return this.capture("log",{message:t},e,r,i)},o.prototype.captureNetwork=function(t,e,r,i){e=e||"xhr",t.subtype=t.subtype||e,i&&(t.request=i);var n=this.levelFromStatus(t.status_code);return this.capture("network",t,n,r)},o.prototype.levelFromStatus=function(t){return t>=200&&t<400?"info":0===t||t>=400?"error":"info"},o.prototype.captureDom=function(t,e,r,i,n){var o={subtype:t,element:e};return void 0!==r&&(o.value=r),void 0!==i&&(o.checked=i),this.capture("dom",o,"info",n)},o.prototype.captureNavigation=function(t,e,r){return this.capture("navigation",{from:t,to:e},"info",r)},o.prototype.captureDomContentLoaded=function(t){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,t&&t.getTime())},o.prototype.captureLoad=function(t){return this.capture("navigation",{subtype:"load"},"info",void 0,t&&t.getTime())},o.prototype.captureConnectivityChange=function(t,e){return this.captureNetwork({change:t},"connectivity",e)},o.prototype._captureRollbarItem=function(t){if(this.options.includeItemsInTelemetry)return t.err?this.captureError(t.err,t.level,t.uuid,t.timestamp):t.message?this.captureLog(t.message,t.level,t.uuid,t.timestamp):t.custom?this.capture("log",t.custom,t.level,t.uuid,t.timestamp):void 0},o.prototype.push=function(t){this.queue.push(t),this.queue.length>this.maxQueueSize&&this.queue.shift()},t.exports=o},417:(t,e,r)=>{var i=r(702);function n(t,e){i.isFunction(t[e])&&(t[e]=t[e].toString())}t.exports={itemToPayload:function(t,e,r){var i=t.data;t._isUncaught&&(i._isUncaught=!0),t._originalArgs&&(i._originalArgs=t._originalArgs),r(null,i)},addPayloadOptions:function(t,e,r){var n=e.payload||{};n.body&&delete n.body,t.data=i.merge(t.data,n),r(null,t)},addTelemetryData:function(t,e,r){t.telemetryEvents&&i.set(t,"data.body.telemetry",t.telemetryEvents),r(null,t)},addMessageWithError:function(t,e,r){if(t.message){var n="data.body.trace_chain.0",o=i.get(t,n);if(o||(n="data.body.trace",o=i.get(t,n)),o){if(!o.exception||!o.exception.description)return i.set(t,n+".exception.description",t.message),void r(null,t);var a=i.get(t,n+".extra")||{},s=i.merge(a,{message:t.message});i.set(t,n+".extra",s)}r(null,t)}else r(null,t)},userTransform:function(t){return function(e,r,n){var o=i.merge(e),a=null;try{i.isFunction(r.transform)&&(a=r.transform(o.data,e))}catch(i){return r.transform=null,t.error("Error while calling custom transform() function. Removing custom transform().",i),void n(null,e)}i.isPromise(a)?a.then((function(t){t&&(o.data=t),n(null,o)}),(function(t){n(t,e)})):n(null,o)}},addConfigToPayload:function(t,e,r){if(!e.sendConfig)return r(null,t);var n=i.get(t,"data.custom")||{};n._rollbarConfig=e,t.data.custom=n,r(null,t)},addConfiguredOptions:function(t,e,r){var i=e._configuredOptions;n(i,"transform"),n(i,"checkIgnore"),n(i,"onSendCallback"),delete i.accessToken,t.data.notifier.configured_options=i,r(null,t)},addDiagnosticKeys:function(t,e,r){var n=i.merge(t.notifier.client.notifier.diagnostic,t.diagnostic);if(i.get(t,"err._isAnonymous")&&(n.is_anonymous=!0),t._isUncaught&&(n.is_uncaught=t._isUncaught),t.err)try{n.raw_error={message:t.err.message,name:t.err.name,constructor_name:t.err.constructor&&t.err.constructor.name,filename:t.err.fileName,line:t.err.lineNumber,column:t.err.columnNumber,stack:t.err.stack}}catch(t){n.raw_error={failed:String(t)}}t.data.notifier.diagnostic=i.merge(t.data.notifier.diagnostic,n),r(null,t)}}},473:(t,e,r)=>{var i=r(702),n=r(267);function o(t,e){return[t,i.stringify(t,e)]}function a(t,e){var r=t.length;return r>2*e?t.slice(0,e).concat(t.slice(r-e)):t}function s(t,e,r){r=void 0===r?30:r;var n,o=t.data.body;if(o.trace_chain)for(var s=o.trace_chain,l=0;l<s.length;l++)n=a(n=s[l].frames,r),s[l].frames=n;else o.trace&&(n=a(n=o.trace.frames,r),o.trace.frames=n);return[t,i.stringify(t,e)]}function l(t,e){return e&&e.length>t?e.slice(0,t-3).concat("..."):e}function c(t,e,r){return e=n(e,(function e(r,o,a){switch(i.typeName(o)){case"string":return l(t,o);case"object":case"array":return n(o,e,a);default:return o}})),[e,i.stringify(e,r)]}function u(t){return t.exception&&(delete t.exception.description,t.exception.message=l(255,t.exception.message)),t.frames=a(t.frames,1),t}function h(t,e){var r=t.data.body;if(r.trace_chain)for(var n=r.trace_chain,o=0;o<n.length;o++)n[o]=u(n[o]);else r.trace&&(r.trace=u(r.trace));return[t,i.stringify(t,e)]}function d(t,e){return i.maxByteSize(t)>e}t.exports={truncate:function(t,e,r){r=void 0===r?524288:r;for(var i,n,a,l=[o,s,c.bind(null,1024),c.bind(null,512),c.bind(null,256),h];i=l.shift();)if(t=(n=i(t,e))[0],(a=n[1]).error||!d(a.value,r))return a;return a},raw:o,truncateFrames:s,truncateStrings:c,maybeTruncateValue:l}},702:(t,e,r)=>{var i=r(420),n={};function o(t,e){return e===a(t)}function a(t){var e=typeof t;return"object"!==e?e:t?t instanceof Error?"error":{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(t){return o(t,"function")}function l(t){var e=Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),r=RegExp("^"+e+"$");return c(t)&&r.test(t)}function c(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function u(){var t=y();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:7&r|8).toString(16)}))}var h={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function d(t,e){var r,i;try{r=n.stringify(t)}catch(n){if(e&&s(e))try{r=e(t)}catch(t){i=t}else i=n}return{error:i,value:r}}function p(t,e){return function(r,i){try{e(r,i)}catch(e){t.error(e)}}}function f(t){return function t(e,r){var i,n,s,l={};try{for(n in e)(i=e[n])&&(o(i,"object")||o(i,"array"))?r.includes(i)?l[n]="Removed circular reference: "+a(i):((s=r.slice()).push(i),l[n]=t(i,s)):l[n]=i}catch(t){l="Failed cloning custom data: "+t.message}return l}(t,[t])}var m=["log","network","dom","navigation","error","manual"],g=["critical","error","warning","info","debug"];function _(t,e){for(var r=0;r<t.length;++r)if(t[r]===e)return!0;return!1}function y(){return Date.now?+Date.now():+new Date}t.exports={addParamsAndAccessTokenToPath:function(t,e,r){(r=r||{}).access_token=t;var i,n=[];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push([i,r[i]].join("="));var o="?"+n.sort().join("&");(e=e||{}).path=e.path||"";var a,s=e.path.indexOf("?"),l=e.path.indexOf("#");-1!==s&&(-1===l||l>s)?(a=e.path,e.path=a.substring(0,s)+o+"&"+a.substring(s+1)):-1!==l?(a=e.path,e.path=a.substring(0,l)+o+a.substring(l)):e.path=e.path+o},createItem:function(t,e,r,i,n){for(var o,s,l,c,h,d,m=[],g=[],_=0,v=t.length;_<v;++_){var b=a(d=t[_]);switch(g.push(b),b){case"undefined":break;case"string":o?m.push(d):o=d;break;case"function":c=p(e,d);break;case"date":m.push(d);break;case"error":case"domexception":case"exception":s?m.push(d):s=d;break;case"object":case"array":if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}if(i&&"object"===b&&!h){for(var x=0,w=i.length;x<w;++x)if(void 0!==d[i[x]]){h=d;break}if(h)break}l?m.push(d):l=d;break;default:if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}m.push(d)}}l&&(l=f(l)),m.length>0&&(l||(l=f({})),l.extraArgs=f(m));var S={message:o,err:s,custom:l,timestamp:y(),callback:c,notifier:r,diagnostic:{},uuid:u()};return function(t,e){e&&void 0!==e.level&&(t.level=e.level,delete e.level),e&&void 0!==e.skipFrames&&(t.skipFrames=e.skipFrames,delete e.skipFrames)}(S,l),i&&h&&(S.request=h),n&&(S.lambdaContext=n),S._originalArgs=t,S.diagnostic.original_arg_types=g,S},addErrorContext:function(t,e){var r=t.data.custom||{},n=!1;try{for(var o=0;o<e.length;++o)e[o].hasOwnProperty("rollbarContext")&&(r=i(r,f(e[o].rollbarContext)),n=!0);n&&(t.data.custom=r)}catch(e){t.diagnostic.error_context="Failed: "+e.message}},createTelemetryEvent:function(t){for(var e,r,i,n,o=0,s=t.length;o<s;++o)switch(a(n=t[o])){case"string":!e&&_(m,n)?e=n:!i&&_(g,n)&&(i=n);break;case"object":r=n}return{type:e||"manual",metadata:r||{},level:i}},filterIp:function(t,e){if(t&&t.user_ip&&!0!==e){var r=t.user_ip;if(e)try{var i;if(-1!==r.indexOf("."))(i=r.split(".")).pop(),i.push("0"),r=i.join(".");else if(-1!==r.indexOf(":")){if((i=r.split(":")).length>2){var n=i.slice(0,3),o=n[2].indexOf("/");-1!==o&&(n[2]=n[2].substring(0,o)),r=n.concat("0000:0000:0000:0000:0000").join(":")}}else r=null}catch(t){r=null}else r=null;t.user_ip=r}},formatArgsAsString:function(t){var e,r,i,n=[];for(e=0,r=t.length;e<r;++e){switch(a(i=t[e])){case"object":(i=(i=d(i)).error||i.value).length>500&&(i=i.substr(0,497)+"...");break;case"null":i="null";break;case"undefined":i="undefined";break;case"symbol":i=i.toString()}n.push(i)}return n.join(" ")},formatUrl:function(t,e){if(!(e=e||t.protocol)&&t.port&&(80===t.port?e="http:":443===t.port&&(e="https:")),e=e||"https:",!t.hostname)return null;var r=e+"//"+t.hostname;return t.port&&(r=r+":"+t.port),t.path&&(r+=t.path),r},get:function(t,e){if(t){var r=e.split("."),i=t;try{for(var n=0,o=r.length;n<o;++n)i=i[r[n]]}catch(t){i=void 0}return i}},handleOptions:function(t,e,r,n){var o=i(t,e,r);return o=function(t,e){return t.hostWhiteList&&!t.hostSafeList&&(t.hostSafeList=t.hostWhiteList,t.hostWhiteList=void 0,e&&e.log("hostWhiteList is deprecated. Use hostSafeList.")),t.hostBlackList&&!t.hostBlockList&&(t.hostBlockList=t.hostBlackList,t.hostBlackList=void 0,e&&e.log("hostBlackList is deprecated. Use hostBlockList.")),t}(o,n),!e||e.overwriteScrubFields||e.scrubFields&&(o.scrubFields=(t.scrubFields||[]).concat(e.scrubFields)),o},isError:function(t){return o(t,"error")||o(t,"exception")},isFiniteNumber:function(t){return Number.isFinite(t)},isFunction:s,isIterable:function(t){var e=a(t);return"object"===e||"array"===e},isNativeFunction:l,isObject:c,isString:function(t){return"string"==typeof t||t instanceof String},isType:o,isPromise:function(t){return c(t)&&o(t.then,"function")},jsonParse:function(t){var e,r;try{e=n.parse(t)}catch(t){r=t}return{error:r,value:e}},LEVELS:{debug:0,info:1,warning:2,error:3,critical:4},makeUnhandledStackInfo:function(t,e,r,i,n,o,a,s){var l={url:e||"",line:r,column:i};l.func=s.guessFunctionName(l.url,l.line),l.context=s.gatherContext(l.url,l.line);var c="undefined"!=typeof document&&document&&document.location&&document.location.href,u="undefined"!=typeof window&&window&&window.navigator&&window.navigator.userAgent;return{mode:o,message:n?String(n):t||a,url:c,stack:[l],useragent:u}},merge:i,now:y,redact:function(){return"********"},RollbarJSON:n,sanitizeUrl:function(t){var e=function(t){if(o(t,"string")){for(var e=h,r=e.parser[e.strictMode?"strict":"loose"].exec(t),i={},n=0,a=e.key.length;n<a;++n)i[e.key[n]]=r[n]||"";return i[e.q.name]={},i[e.key[12]].replace(e.q.parser,(function(t,r,n){r&&(i[e.q.name][r]=n)})),i}}(t);return e?(""===e.anchor&&(e.source=e.source.replace("#","")),t=e.source.replace("?"+e.query,"")):"(unknown)"},set:function(t,e,r){if(t){var i=e.split("."),n=i.length;if(!(n<1))if(1!==n)try{for(var o=t[i[0]]||{},a=o,s=1;s<n-1;++s)o[i[s]]=o[i[s]]||{},o=o[i[s]];o[i[n-1]]=r,t[i[0]]=a}catch(t){return}else t[i[0]]=r}},setupJSON:function(t){s(n.stringify)&&s(n.parse)||(o(JSON,"undefined")||(t?(l(JSON.stringify)&&(n.stringify=JSON.stringify),l(JSON.parse)&&(n.parse=JSON.parse)):(s(JSON.stringify)&&(n.stringify=JSON.stringify),s(JSON.parse)&&(n.parse=JSON.parse))),s(n.stringify)&&s(n.parse)||t&&t(n))},stringify:d,maxByteSize:function(t){for(var e=0,r=t.length,i=0;i<r;i++){var n=t.charCodeAt(i);n<128?e+=1:n<2048?e+=2:n<65536&&(e+=3)}return e},typeName:a,uuid4:u}},650:t=>{function e(t){return"string"!=typeof t&&(t=String(t)),t.toLowerCase()}function r(t){this.map={},t instanceof r?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}r.prototype.append=function(t,r){t=e(t),r=function(t){return"string"!=typeof t&&(t=String(t)),t}(r);var i=this.map[t];this.map[t]=i?i+", "+r:r},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},r.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),function(t){return{next:function(){var e=t.shift();return{done:void 0===e,value:e}}}}(t)},t.exports=function(t){return"undefined"==typeof Headers?new r(t):new Headers(t)}},876:(t,e,r)=>{var i=r(708);t.exports=i},297:t=>{t.exports=function(t,e,r,i,n){var o=t[e];t[e]=r(o),i&&i[n].push([t,e,o])}},267:(t,e,r)=>{var i=r(702);t.exports=function(t,e,r){var n,o,a,s,l=i.isType(t,"object"),c=i.isType(t,"array"),u=[];if(r=r||{obj:[],mapped:[]},l){if(s=r.obj.indexOf(t),l&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(t),s=r.obj.length-1}if(l)for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&u.push(n);else if(c)for(a=0;a<t.length;++a)u.push(a);var h=l?{}:[],d=!0;for(a=0;a<u.length;++a)o=t[n=u[a]],h[n]=e(n,o,r),d=d&&h[n]===t[n];return l&&!d&&(r.mapped[s]=h),d?t:h}},708:t=>{t.exports=function(t){var e,r,i,n,o,a,s,l,c,u,h,d,p,f=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function m(t){return t<10?"0"+t:t}function g(){return this.valueOf()}function _(t){return f.lastIndex=0,f.test(t)?'"'+t.replace(f,(function(t){var e=i[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+t+'"'}function y(t,i){var o,a,s,l,c,u=e,h=i[t];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(t)),"function"==typeof n&&(h=n.call(i,t,h)),typeof h){case"string":return _(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(e+=r,c=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,o=0;o<l;o+=1)c[o]=y(o,h)||"null";return s=0===c.length?"[]":e?"[\n"+e+c.join(",\n"+e)+"\n"+u+"]":"["+c.join(",")+"]",e=u,s}if(n&&"object"==typeof n)for(l=n.length,o=0;o<l;o+=1)"string"==typeof n[o]&&(s=y(a=n[o],h))&&c.push(_(a)+(e?": ":":")+s);else for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(s=y(a,h))&&c.push(_(a)+(e?": ":":")+s);return s=0===c.length?"{}":e?"{\n"+e+c.join(",\n"+e)+"\n"+u+"}":"{"+c.join(",")+"}",e=u,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+m(this.getUTCMonth()+1)+"-"+m(this.getUTCDate())+"T"+m(this.getUTCHours())+":"+m(this.getUTCMinutes())+":"+m(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=g,Number.prototype.toJSON=g,String.prototype.toJSON=g),"function"!=typeof t.stringify&&(i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},t.stringify=function(t,i,o){var a;if(e="",r="","number"==typeof o)for(a=0;a<o;a+=1)r+=" ";else"string"==typeof o&&(r=o);if(n=i,i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON.stringify");return y("",{"":t})}),"function"!=typeof t.parse&&(t.parse=(u={"\\":"\\",'"':'"',"/":"/",t:"\t",n:"\n",r:"\r",f:"\f",b:"\b"},h={go:function(){o="ok"},firstokey:function(){l=c,o="colon"},okey:function(){l=c,o="colon"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},d={go:function(){o="ok"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},p={"{":{go:function(){a.push({state:"ok"}),s={},o="firstokey"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s={},o="firstokey"},firstavalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"},avalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"}},"}":{firstokey:function(){var t=a.pop();c=s,s=t.container,l=t.key,o=t.state},ocomma:function(){var t=a.pop();s[l]=c,c=s,s=t.container,l=t.key,o=t.state}},"[":{go:function(){a.push({state:"ok"}),s=[],o="firstavalue"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s=[],o="firstavalue"},firstavalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"},avalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"}},"]":{firstavalue:function(){var t=a.pop();c=s,s=t.container,l=t.key,o=t.state},acomma:function(){var t=a.pop();s.push(c),c=s,s=t.container,l=t.key,o=t.state}},":":{colon:function(){if(Object.hasOwnProperty.call(s,l))throw new SyntaxError("Duplicate key '"+l+'"');o="ovalue"}},",":{ocomma:function(){s[l]=c,o="okey"},acomma:function(){s.push(c),o="avalue"}},true:{go:function(){c=!0,o="ok"},ovalue:function(){c=!0,o="ocomma"},firstavalue:function(){c=!0,o="acomma"},avalue:function(){c=!0,o="acomma"}},false:{go:function(){c=!1,o="ok"},ovalue:function(){c=!1,o="ocomma"},firstavalue:function(){c=!1,o="acomma"},avalue:function(){c=!1,o="acomma"}},null:{go:function(){c=null,o="ok"},ovalue:function(){c=null,o="ocomma"},firstavalue:function(){c=null,o="acomma"},avalue:function(){c=null,o="acomma"}}},function(t,e){var r,i,n=/^[\u0020\t\n\r]*(?:([,:\[\]{}]|true|false|null)|(-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)|"((?:[^\r\n\t\\\"]|\\(?:["\\\/trnfb]|u[0-9a-fA-F]{4}))*)")/;o="go",a=[];try{for(;r=n.exec(t);)r[1]?p[r[1]][o]():r[2]?(c=+r[2],d[o]()):(i=r[3],c=i.replace(/\\(?:u(.{4})|([^u]))/g,(function(t,e,r){return e?String.fromCharCode(parseInt(e,16)):u[r]})),h[o]()),t=t.slice(r[0].length)}catch(t){o=t}if("ok"!==o||/[^\u0020\t\n\r]/.test(t))throw o instanceof SyntaxError?o:new SyntaxError("JSON");return"function"==typeof e?function t(r,i){var n,o,a=r[i];if(a&&"object"==typeof a)for(n in c)Object.prototype.hasOwnProperty.call(a,n)&&(void 0!==(o=t(a,n))?a[n]=o:delete a[n]);return e.call(r,i,a)}({"":c},""):c}))}}},e={},function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}(739);var t,e}))),bt.exports);class St{static initialize(t){St.getInstance().rollbar=wt.init({accessToken:"208cf50b805f409bb0b08d5c9f68ce61",captureUncaught:!0,captureUnhandledRejections:!0,payload:{environment:"production",component:t,client:{javascript:{code_version:void 0}}}})}static getInstance(){return St.instance||(St.instance=new St),St.instance}error(t,e){this.rollbar?.error(t,e)}info(t,e){this.rollbar?.info(t,e)}warning(t,e){this.rollbar?.warning(t,e)}critical(t,e){this.rollbar?.critical(t,e)}}class Tt{constructor(){this.MEASUREMENT_ID="G-6XL8YD35QR",this.isInitialized=!1,this.sessionId=""}static getInstance(){return Tt.instance||(Tt.instance=new Tt),Tt.instance}generateSessionId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}initialize(t){if(this.isInitialized)return;Tt.component=t,this.sessionId=this.generateSessionId();const e=document.createElement("script");e.async=!0,e.src=`https://www.googletagmanager.com/gtag/js?id=${this.MEASUREMENT_ID}`,document.head.appendChild(e),window.dataLayer=window.dataLayer||[];window.gtag=window.gtag||((...t)=>{window.dataLayer.push(t)}),window.gtag("js",new Date),window.gtag("config",this.MEASUREMENT_ID,{send_page_view:!0,groups:"mapvx"}),this.isInitialized=!0}resetSessionId(){this.sessionId=this.generateSessionId()}trackPageView(t){this.isInitialized&&window.gtag("event","page_view",{page_title:t,page_location:window.location.href,page_path:t,component:Tt.component,session_id:this.sessionId,send_to:"mapvx"})}trackEvent(t,e){this.isInitialized&&window.gtag("event",t,{...e,component:Tt.component,session_id:this.sessionId,send_to:"mapvx"})}trackUserTiming(t,e,r){this.isInitialized&&window.gtag("event","timing_complete",{name:e,value:r,event_category:t,component:Tt.component,session_id:this.sessionId,send_to:"mapvx"})}trackException(t,e=!1){this.isInitialized&&window.gtag("event","exception",{description:t,fatal:e,component:Tt.component,session_id:this.sessionId,send_to:"mapvx"})}}exports.AnalyticsController=Tt,exports.MarkerStyle=_t,exports.RollbarController=St,exports.SDKController=class{constructor(t){this.connected=!1,this.enabledFloors=[],this.host=t,this.host.addController(this),this.contextProvider=new dt(this.host,{context:yt,initialValue:{enabledFloors:[],markers:[],cameraInitialized:!1}})}async prewarm(t,e,r,i){if(!this.connected)return;const n=gt.initializeSDK(t,{lang:e});this.contextProvider.setValue({...this.contextProvider.value,sdk:n,locale:e,parentPlaceId:r,originId:i?.originId??this.contextProvider.value.originId,destinationId:i?.destinationId??this.contextProvider.value.destinationId});try{const[t,e,o,a]=await Promise.all([n.getConfiguration(r).catch((()=>{})),n.getPlaceDetail(r).catch((()=>{})),i?.originId?n.getPlaceDetail(i.originId).catch((()=>{})):Promise.resolve(void 0),i?.destinationId?n.getPlaceDetail(i.destinationId).catch((()=>{})):Promise.resolve(void 0)]),s=e?.innerFloors||[];let l,c=s;if(o||a){const t=[o,a].map((t=>t?.inFloor(s))).filter((t=>void 0!==t));t.length>0&&(c=t),l=a?.inFloors?.[0]?s.find((t=>t.key===a.inFloors[0])):o?.inFloors?.[0]?s.find((t=>t.key===o.inFloors[0])):void 0}this.enabledFloors=c,this.contextProvider.setValue({...this.contextProvider.value,generalConfig:t??this.contextProvider.value.generalConfig,parentPlace:e??this.contextProvider.value.parentPlace,origin:o??this.contextProvider.value.origin,destination:a??this.contextProvider.value.destination,enabledFloors:c,currentFloor:l??this.contextProvider.value.currentFloor,markers:[...o?[{id:o.lazarilloId,data:o,style:_t.youAreHere}]:[],...a?[{id:a.lazarilloId,data:a,style:_t.placePopup}]:[]]})}catch(o){St.getInstance().warning("Error prewarming SDK",{error:o,parentPlaceId:r})}}initialize(t,e,r){if(!this.connected)return;const i=this.contextProvider.value;if(i.sdk&&i.locale===e&&i.parentPlaceId===r)return;this.initializeSDK(t,e,r);const{originId:n,destinationId:o}=this.contextProvider.value;n&&o&&this.setOriginAndDestination(n,o)}async setOriginAndDestination(t,e){if(!this.connected)return;const r=this.contextProvider.value.sdk;if(this.contextProvider.setValue({...this.contextProvider.value,originId:t,destinationId:e}),r)try{const[i,n]=await Promise.all([t,e].map((t=>{if(t?.length>0)return r.getPlaceDetail(t).catch((()=>{}))})));this.contextProvider.setValue({...this.contextProvider.value,origin:i,destination:n}),this.createOriginDestinationMarkers(i,n);const o=n?.inFloors?.[0]||i?.inFloors?.[0];o&&this.setFloor(o);const a=this.contextProvider.value.parentPlace?.innerFloors||[],s=[i,n].filter((t=>!!t)).map((t=>t.inFloor(a))).filter((t=>void 0!==t));this.enabledFloors=s,this.contextProvider.setValue({...this.contextProvider.value,enabledFloors:s})}catch(i){St.getInstance().warning("Error setting origin and destination",{error:i,originId:t,destinationId:e})}}getDestination(){return this.contextProvider.value.destination}async loadRoute(t,e,r=!1){if(!this.connected)return;const i=this.contextProvider.value.sdk;if(i)try{const n=await i.getRoute({initialLocation:{id:t},finalLocation:{id:e},preferAccessibleRoute:r});if(!n)return;const o=this.contextProvider.value.parentPlace?.innerFloors||[],a=n.legs.flatMap((t=>t.steps.flatMap((t=>[t.startInsideFloor,t.endInsideFloor])))).map((t=>t?o.find((e=>e.key===t)):void 0)).filter((t=>void 0!==t));this.contextProvider.setValue({...this.contextProvider.value,route:n,enabledFloors:a,isRouteAnimating:!1})}catch(n){St.getInstance().warning("Error loading route",{error:n,originId:t,destinationId:e})}}async loadConfig(t){const e=this.contextProvider.value.sdk;if(e)try{const r=await e.getConfiguration(t);this.contextProvider.setValue({...this.contextProvider.value,generalConfig:r})}catch(r){St.getInstance().warning("Error loading config",{error:r,parentPlaceId:t})}}async initializeSDK(t,e,r){const i=gt.initializeSDK(t,{lang:e});this.contextProvider.setValue({...this.contextProvider.value,sdk:i,locale:e,parentPlaceId:r});try{const[t,e]=await Promise.all([i.getConfiguration(r).catch((()=>{})),i.getPlaceDetail(r).catch((()=>{}))]),{origin:n,destination:o}=this.contextProvider.value;let a=e?.innerFloors||[];const s=n?.inFloor(a)||o?.inFloor(a);(n||o)&&(a=[n,o].map((t=>t?.inFloor(a))).filter((t=>void 0!==t)),this.enabledFloors=a),this.contextProvider.setValue({...this.contextProvider.value,generalConfig:t??this.contextProvider.value.generalConfig,parentPlace:e??this.contextProvider.value.parentPlace,enabledFloors:a,currentFloor:s})}catch(n){St.getInstance().warning("Error initializing SDK",{error:n,parentPlaceId:r})}}createOriginDestinationMarkers(t,e){const r=[];t&&r.push({id:t.lazarilloId,data:t,style:_t.youAreHere}),e&&r.push({id:e.lazarilloId,data:e,style:_t.placePopup}),this.contextProvider.setValue({...this.contextProvider.value,markers:r})}setAccessibleRoute(t){this.contextProvider.setValue({...this.contextProvider.value,accessibleRoute:t});const{originId:e,destinationId:r,route:i}=this.contextProvider.value;e&&r&&i&&this.loadRoute(e,r,t)}repeatRoute(){this.contextProvider.setValue({...this.contextProvider.value,isRouteAnimating:!0})}removeRoute(){this.contextProvider.setValue({...this.contextProvider.value,route:void 0,enabledFloors:this.enabledFloors})}routeAnimationFinished(){this.contextProvider.setValue({...this.contextProvider.value,isRouteAnimating:!1})}startRouteAnimation(){this.contextProvider.setValue({...this.contextProvider.value,isRouteAnimating:!0})}generateRoute(){const{originId:t,destinationId:e,accessibleRoute:r}=this.contextProvider.value;t&&e&&this.loadRoute(t,e,!!r)}setFloor(t){const{parentPlace:e,currentFloor:r}=this.contextProvider.value;if(!e)return;if(r?.key===t)return;const i=e.innerFloors.find((e=>e.key===t));i&&this.contextProvider.setValue({...this.contextProvider.value,currentFloor:i})}hostConnected(){this.connected=!0}hostDisconnected(){this.connected=!1}setMapReady(t){this.contextProvider.setValue({...this.contextProvider.value,mapReady:t})}setCameraInitialized(t){this.contextProvider.setValue({...this.contextProvider.value,cameraInitialized:t})}resetData(){this.contextProvider.setValue({...this.contextProvider.value,originId:void 0,destinationId:void 0,destination:void 0,route:void 0,enabledFloors:this.enabledFloors,currentFloor:this.contextProvider.value.parentPlace?.innerFloors?.[0],markers:[],accessibleRoute:!1,isRouteAnimating:!1,cameraInitialized:!1}),this.host.requestUpdate()}},exports.T=V,exports.distExports=gt,exports.i=ot,exports.i$1=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,r,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[i+1]),t[0]);return new n(i,t,r)},exports.loadCompactFloorSelector=()=>Promise.resolve().then((()=>require("./compact-floor-selector-CM85VieL.cjs"))),exports.loadCustomMap=()=>Promise.resolve().then((()=>require("./custom-map-DRJdhNz0.cjs"))),exports.loadFloorSelector=()=>Promise.resolve().then((()=>require("./floor-selector-BwhllcLc.cjs"))),exports.loadQrModal=()=>Promise.resolve().then((()=>require("./qr-modal-LH9N2Lki.cjs"))),exports.loadRouteOptions=()=>Promise.resolve().then((()=>require("./route-options-EkTBrOWM.cjs"))),exports.n=function(t){return(e,r)=>"object"==typeof r?lt(t,e,r):((t,e,r)=>{const i=e.hasOwnProperty(r);return e.constructor.createProperty(r,t),i?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)},exports.preloadMaplibreCss=async()=>{try{await Promise.resolve().then((()=>require("./maplibre-gl-BNL6ASmq.cjs")))}catch{}},exports.r=o,exports.s=ct,exports.sdkContext=yt,exports.t=t=>(e,r)=>{void 0!==r?r.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)},exports.x=U;
|
|
61
|
-
//# sourceMappingURL=lazy-load-CqAzFOsw.cjs.map
|