@mapvx/web-components 0.0.32 → 0.0.34
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-IDYKUTl3.cjs → base-floor-selector-_si0OaKV.cjs} +2 -2
- package/dist/cjs/{class-map-CGHo1D7M.cjs → class-map-CIFK_Nvk.cjs} +3 -3
- package/dist/cjs/{compact-floor-selector-Co8Y3T2c.cjs → compact-floor-selector-CjEWEJM8.cjs} +3 -3
- package/dist/cjs/{consume-BWIh7rxI.cjs → consume-BhigA9qa.cjs} +2 -2
- package/dist/cjs/{custom-map--UZ5N3Lg.cjs → custom-map-D3dQQyOb.cjs} +2 -2
- package/dist/cjs/{floor-selector-CNuGDuNc.cjs → floor-selector-DFyRRyAb.cjs} +3 -3
- package/dist/cjs/lazy-load-BE9-keHk.cjs +56 -0
- package/dist/cjs/map-view-with-modal.cjs +2 -2
- package/dist/cjs/{qr-modal-Dq7dOqh6.cjs → qr-modal-B4BqIRX4.cjs} +2 -2
- package/dist/cjs/{route-options-B45xnSu4.cjs → route-options-DQc0dugR.cjs} +4 -4
- package/dist/cjs/route-view-totems.cjs +2 -2
- package/dist/es/assets/accessibility-D3Vyfstu.js.map +1 -0
- package/dist/es/assets/back_arrow-B3RltzaY.js.map +1 -0
- package/dist/es/assets/{compact-floor-selector-BQ0lsGyg.js → compact-floor-selector-DNCJAHDM.js} +2 -2
- package/dist/es/assets/compact-floor-selector-DNCJAHDM.js.map +1 -0
- package/dist/es/assets/components-BeCPn1I0.js +249 -0
- package/dist/es/assets/components-BeCPn1I0.js.map +1 -0
- package/dist/es/assets/icon-destination-point-DEI58b8w.js.map +1 -0
- package/dist/es/assets/icon-origin-point-GS06gE2l.js.map +1 -0
- package/dist/es/assets/{map-view-with-modal-JX4bFkkK.js → map-view-with-modal-D-9U3spD.js} +2 -2
- package/dist/es/assets/map-view-with-modal-D-9U3spD.js.map +1 -0
- package/dist/es/assets/repeat_icon-DN4_p9eh.js.map +1 -0
- package/dist/es/assets/{route-view-totems-B-1OEdkb.js → route-view-totems-C-vpK0Jw.js} +10 -9
- package/dist/es/assets/route-view-totems-C-vpK0Jw.js.map +1 -0
- package/dist/es/assets/styles-BByP6ECU.js.map +1 -0
- package/dist/es/assets/utils-CIDFE1sK.js +2 -0
- package/dist/es/assets/utils-CIDFE1sK.js.map +1 -0
- package/dist/es/assets/walking-BggsSG4g.js.map +1 -0
- package/dist/es/index.js +1 -1
- package/dist/es/index.js.map +1 -0
- package/dist/es/route-view-totems.js +1 -1
- package/dist/es/route-view-totems.js.map +1 -0
- package/dist/iife/map-view-with-modal.js +21 -21
- package/dist/iife/route-view-totems.js +24 -24
- package/dist/sw/mvx-tiles-sw.js +4 -4
- package/package.json +20 -16
- package/dist/cjs/lazy-load-Dy0Wc6yS.cjs +0 -56
- package/dist/es/assets/components-CNuu24gs.js +0 -234
- package/dist/es/assets/utils-DslQaI0J.js +0 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let n=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const r=this.t;if(t&&void 0===e){const t=void 0!==r&&1===r.length;t&&(e=i.get(r)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&i.set(r,e))}return e}toString(){return this.cssText}};const o=e=>new n("string"==typeof e?e:e+"",void 0,r),a=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return o(t)})(e):e,{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,y=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},v=(e,t)=>!s(e,t),b={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:v};
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2017 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=b){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&l(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:n}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const o=i?.call(this);n?.call(this,t),this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??b}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=d(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...u(e),...h(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const e=this._$Eu(t,r);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(a(e))}else void 0!==e&&t.push(a(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((r,i)=>{if(t)r.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of i){const i=document.createElement("style"),n=e.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)}})(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(void 0!==i&&!0===r.reflect){const n=(void 0!==r.converter?.toAttribute?r.converter:_).toAttribute(t,r.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=r.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=i;const o=n.fromAttribute(t,e.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,r,i=!1,n){if(void 0!==e){const o=this.constructor;if(!1===i&&(n=this[e]),r??=o.getPropertyOptions(e),!((r.hasChanged??v)(n,t)||r.useDefault&&r.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:n},o){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),!0!==n||void 0!==o)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e){const{wrapped:e}=r,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,r,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[y("elementProperties")]=new Map,x[y("finalized")]=new Map,g?.({ReactiveElement:x}),(p.reactiveElementVersions??=[]).push("2.1.2");
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2017 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*/
|
|
17
|
+
const w=globalThis,T=e=>e,S=w.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,I="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+P,A=`<${k}>`,C=document,M=()=>C.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,R=Array.isArray,O="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,z=/>/g,B=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),N=/'/g,j=/"/g,V=/^(?:script|style|textarea|title)$/i,U=(e=>(t,...r)=>({_$litType$:e,strings:t,values:r}))(1),G=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),$=new WeakMap,W=C.createTreeWalker(C,129);function Z(e,t){if(!R(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const H=(e,t)=>{const r=e.length-1,i=[];let n,o=2===t?"<svg>":3===t?"<math>":"",a=L;for(let s=0;s<r;s++){const t=e[s];let r,l,c=-1,u=0;for(;u<t.length&&(a.lastIndex=u,l=a.exec(t),null!==l);)u=a.lastIndex,a===L?"!--"===l[1]?a=F:void 0!==l[1]?a=z:void 0!==l[2]?(V.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=B):void 0!==l[3]&&(a=B):a===B?">"===l[0]?(a=n??L,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,r=l[1],a=void 0===l[3]?B:'"'===l[3]?j:N):a===j||a===N?a=B:a===F||a===z?a=L:(a=B,n=void 0);const h=a===B&&e[s+1].startsWith("/>")?" ":"";o+=a===L?t+A:c>=0?(i.push(r),t.slice(0,c)+I+t.slice(c)+P+h):t+P+(-2===c?s:h)}return[Z(e,o+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class X{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let n=0,o=0;const a=e.length-1,s=this.parts,[l,c]=H(e,t);if(this.el=X.createElement(l,r),W.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=W.nextNode())&&s.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(I)){const t=c[o++],r=i.getAttribute(e).split(P),a=/([.?@])?(.*)/.exec(t);s.push({type:1,index:n,name:a[2],strings:r,ctor:"."===a[1]?ee:"?"===a[1]?te:"@"===a[1]?re:Q}),i.removeAttribute(e)}else e.startsWith(P)&&(s.push({type:6,index:n}),i.removeAttribute(e));if(V.test(i.tagName)){const e=i.textContent.split(P),t=e.length-1;if(t>0){i.textContent=S?S.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],M()),W.nextNode(),s.push({type:2,index:++n});i.append(e[t],M())}}}else if(8===i.nodeType)if(i.data===k)s.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(P,e+1));)s.push({type:7,index:n}),e+=P.length-1}n++}}static createElement(e,t){const r=C.createElement("template");return r.innerHTML=e,r}}function K(e,t,r=e,i){if(t===G)return t;let n=void 0!==i?r._$Co?.[i]:r._$Cl;const o=D(t)?void 0:t._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(e),n._$AT(e,r,i)),void 0!==i?(r._$Co??=[])[i]=n:r._$Cl=n),void 0!==n&&(t=K(e,n._$AS(e,t.values),n,i)),t}class Y{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??C).importNode(t,!0);W.currentNode=i;let n=W.nextNode(),o=0,a=0,s=r[0];for(;void 0!==s;){if(o===s.index){let t;2===s.type?t=new J(n,n.nextSibling,this,e):1===s.type?t=new s.ctor(n,s.name,s.strings,this,e):6===s.type&&(t=new ie(n,this,e)),this._$AV.push(t),s=r[++a]}o!==s?.index&&(n=W.nextNode(),o++)}return W.currentNode=C,i}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class J{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=K(this,e,t),D(e)?e===q||null==e||""===e?(this._$AH!==q&&this._$AR(),this._$AH=q):e!==this._$AH&&e!==G&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>R(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==q&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(C.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=X.createElement(Z(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new Y(i,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=$.get(e.strings);return void 0===t&&$.set(e.strings,t=new X(e)),t}k(e){R(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const n of e)i===t.length?t.push(r=new J(this.O(M()),this.O(M()),this,this.options)):r=t[i],r._$AI(n),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=T(e).nextSibling;T(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Q{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,n){this.type=1,this._$AH=q,this._$AN=void 0,this.element=e,this.name=t,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=q}_$AI(e,t=this,r,i){const n=this.strings;let o=!1;if(void 0===n)e=K(this,e,t,0),o=!D(e)||e!==this._$AH&&e!==G,o&&(this._$AH=e);else{const i=e;let a,s;for(e=n[0],a=0;a<n.length-1;a++)s=K(this,i[r+a],t,a),s===G&&(s=this._$AH[a]),o||=!D(s)||s!==this._$AH[a],s===q?e=q:e!==q&&(e+=(s??"")+n[a+1]),this._$AH[a]=s}o&&!i&&this.j(e)}j(e){e===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ee extends Q{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===q?void 0:e}}class te extends Q{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==q)}}class re extends Q{constructor(e,t,r,i,n){super(e,t,r,i,n),this.type=5}_$AI(e,t=this){if((e=K(this,e,t,0)??q)===G)return;const r=this._$AH,i=e===q&&r!==q||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==q&&(r===q||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ie{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){K(this,e)}}const ne=w.litHtmlPolyfillSupport;ne?.(X,J),(w.litHtmlVersions??=[]).push("3.3.2");const oe=globalThis;
|
|
18
|
+
/**
|
|
19
|
+
* @license
|
|
20
|
+
* Copyright 2017 Google LLC
|
|
21
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
+
*/let ae=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{const i=r?.renderBefore??t;let n=i._$litPart$;if(void 0===n){const e=r?.renderBefore??null;i._$litPart$=n=new J(t.insertBefore(M(),e),e,void 0,r??{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return G}};ae._$litElement$=!0,ae.finalized=!0,oe.litElementHydrateSupport?.({LitElement:ae});const se=oe.litElementPolyfillSupport;se?.({LitElement:ae}),(oe.litElementVersions??=[]).push("4.2.2");
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2017 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
const le={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:v},ce=(e=le,t,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&&((e=Object.create(e)).wrapped=!0),o.set(r.name,e),"accessor"===i){const{name:i}=r;return{set(r){const n=t.get.call(this);t.set.call(this,r),this.requestUpdate(i,n,e,!0,r)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=r;return function(r){const n=this[i];t.call(this,r),this.requestUpdate(i,n,e,!0,r)}}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 ue=class extends Event{constructor(e,t,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,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 he{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){const r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:t}]of this.subscriptions)e(this.o,t)},void 0!==e&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});const{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}}
|
|
51
|
+
/**
|
|
52
|
+
* @license
|
|
53
|
+
* Copyright 2021 Google LLC
|
|
54
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
+
*/class de extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}}class pe extends he{constructor(e,t,r){super(void 0!==t.context?t.initialValue:r),this.onContextRequest=e=>{if(e.context!==this.context)return;const t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context)return;if((e.contextTarget??e.composedPath()[0])===this.host)return;const t=new Set;for(const[r,{consumerHost:i}]of this.subscriptions)t.has(r)||(t.add(r),i.dispatchEvent(new ue(this.context,i,r,!0)));e.stopPropagation()},this.host=e,void 0!==t.context?this.context=t.context:this.context=t,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 de(this.context,this.host))}}var fe,me,ge={exports:{}},ye={exports:{}};function _e(){return fe||(fe=1,ye.exports=function(){var e={},t={};function r(r,i,n){if(t[r]=n,"index"===r){var o="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",a={};return t.shared(a),t.index(e,a),"undefined"!=typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),e}}return r("shared",["exports"],function(e){function t(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})}function r(e,t){this.x=e,this.y=t}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,o;"function"==typeof SuppressedError&&SuppressedError,r.prototype={clone(){return new r(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),r=Math.sin(e),i=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=i,this},_rotateAround(e,t){const r=Math.cos(e),i=Math.sin(e),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-i*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:r},r.convert=function(e){if(e instanceof r)return e;if(Array.isArray(e))return new r(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new r(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var a=function(){if(o)return n;function e(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return o=1,n=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=e,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-e)<t));i++)e>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},n}(),s=i(a);let l,c;function u(){return null==l&&(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function h(){if(null==c&&(c=!1,u())){const e=5,t=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<e*e;i++){const r=4*i;t.fillStyle=`rgb(${r},${r+1},${r+2})`,t.fillRect(i%e,Math.floor(i/e),1,1)}const r=t.getImageData(0,0,e,e).data;for(let t=0;t<e*e*4;t++)if(t%4!=3&&r[t]!==t){c=!0;break}}}return c||!1}var d=1e-6,p="undefined"!=typeof Float32Array?Float32Array:Array;function f(){var e=new p(9);return p!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function m(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function g(){var e=new p(3);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function y(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function _(e,t,r){var i=new p(3);return i[0]=e,i[1]=t,i[2]=r,i}function v(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function b(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function x(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[0],s=r[1],l=r[2];return e[0]=n*l-o*s,e[1]=o*a-i*l,e[2]=i*s-n*a,e}var w,T=y;function S(e,t,r){var i=t[0],n=t[1],o=t[2],a=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,e[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,e[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,e[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,e}function E(){var e=new p(4);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function I(e,t,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,i*=o,r*=o;var a=Math.sin(t),s=Math.cos(t),l=Math.sin(r),c=Math.cos(r),u=Math.sin(i),h=Math.cos(i);switch(n){case"xyz":e[0]=a*c*h+s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h-a*l*u;break;case"xzy":e[0]=a*c*h-s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h+a*l*u;break;case"yxz":e[0]=a*c*h+s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h+a*l*u;break;case"yzx":e[0]=a*c*h+s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h-a*l*u;break;case"zxy":e[0]=a*c*h-s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h-a*l*u;break;case"zyx":e[0]=a*c*h-s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h+a*l*u;break;default:throw new Error("Unknown angle order "+n)}return e}function P(){var e=new p(2);return p!=Float32Array&&(e[0]=0,e[1]=0),e}function k(e,t){var r=new p(2);return r[0]=e,r[1]=t,r}g(),w=new p(4),p!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[3]=0),g(),_(1,0,0),_(0,1,0),E(),E(),f(),P();const A=8192;function C(e,t,r){return t*(A/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}function M(e,t){return(e%t+t)%t}function D(e,t,r){return e*(1-r)+t*r}function R(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function O(e,t,r,i){const n=new s(e,t,r,i);return e=>n.solve(e)}const L=O(.25,.1,.25,1);function F(e,t,r){return Math.min(r,Math.max(t,e))}function z(e,t,r){const i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function B(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}let N=1;function j(e,t,r){const i={};for(const n in e)i[n]=t.call(this,e[n],n,e);return i}function V(e,t,r){const i={};for(const n in e)t.call(this,e[n],n,e)&&(i[n]=e[n]);return i}function U(e){return Array.isArray(e)?e.map(U):"object"==typeof e&&e?j(e,U):e}const G={};function q(e){G[e]||("undefined"!=typeof console&&console.warn(e),G[e]=!0)}function $(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function W(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let Z=null;function H(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const X="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function K(e,r,i,n,o){return t(this,void 0,void 0,function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const a=null==t?void 0:t.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 t.copyTo(l,function(e,t,r,i,n){const o=4*Math.max(-t,0),a=(Math.max(0,r)-r)*i*4+o,s=4*i,l=Math.max(0,t),c=Math.max(0,r);return{rect:{x:l,y:c,width:Math.min(e.width,t+i)-l,height:Math.min(e.height,r+n)-c},layout:[{offset:a,stride:s}]}}(e,r,i,n,o)),s)for(let e=0;e<l.length;e+=4){const t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{t.close()}})}let Y,J;function Q(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function ee(e){return e*Math.PI/180}function te(e){return e/Math.PI*180}const re={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ie={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ne="AbortError";class oe extends Error{constructor(e=ne){super(e instanceof Error?e.message:e),this.name=ne,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function ae(e){return e.name===ne}const se={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function le(e){return se.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const ce="global-dispatcher";class ue extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}}const he=()=>W(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,de=function(e,r){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){const t=le(e.url);if(t)return t(e,r);if(W(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:ce},r)}if(!(/^file:/.test(i=e.url)||/^file:/.test(he())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,r){return t(this,void 0,void 0,function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:he(),signal:r.signal});let i,n;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{i=yield fetch(t)}catch(t){if(ae(t))throw t;throw new ue(0,t.message,e.url,new Blob)}if(!i.ok){const t=yield i.blob();throw new ue(i.status,i.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text();const o=yield n;return r.signal.throwIfAborted(),{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}})}(e,r);if(W(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:ce},r)}var i;return function(e,t){return new Promise((r,i)=>{var n;const o=new XMLHttpRequest;o.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(o.responseType="arraybuffer");for(const t in e.headers)o.setRequestHeader(t,e.headers[t]);"json"===e.type&&(o.responseType="text",(null===(n=e.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===e.credentials,o.onerror=()=>{i(new Error(o.statusText))},o.onload=()=>{if(!t.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let t=o.response;if("json"===e.type)try{t=JSON.parse(o.response)}catch(e){return void i(e)}r({data:t,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const t=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});i(new ue(o.status,o.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{o.abort(),i(new oe(t.signal.reason))}),o.send(e.body)})}(e,r)};function pe(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function fe(e,t,r){r[e]&&-1!==r[e].indexOf(t)||(r[e]=r[e]||[],r[e].push(t))}function me(e,t,r){if(r&&r[e]){const i=r[e].indexOf(t);-1!==i&&r[e].splice(i,1)}}class ge{constructor(e,t={}){B(this,t),this.type=e}}class ye extends ge{constructor(e,t={}){super("error",B({error:e},t))}}class _e{on(e,t){return this._listeners=this._listeners||{},fe(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return me(e,t,this._listeners),me(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},fe(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){"string"==typeof e&&(e=new ge(e,t||{}));const r=e.type;if(this.listens(r)){e.target=this;const t=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of t)r.call(this,e);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const o of i)me(r,o,this._oneTimeListeners),o.call(this,e);const n=this._eventedParent;n&&(B(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(e))}else e instanceof ye&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var ve={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const be=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function xe(e,t){const r={};for(const i in e)"ref"!==i&&(r[i]=e[i]);return be.forEach(e=>{e in t&&(r[e]=t[e])}),r}function we(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!we(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!we(e[r],t[r]))return!1;return!0}return e===t}function Te(e,t){e.push(t)}function Se(e,t,r){Te(r,{command:"addSource",args:[e,t[e]]})}function Ee(e,t,r){Te(t,{command:"removeSource",args:[e]}),r[e]=!0}function Ie(e,t,r,i){Ee(e,r,i),Se(e,t,r)}function Pe(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!we(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!we(e[r][i],t[r][i]))return!1;return!0}function ke(e,t,r,i,n,o){e=e||{},t=t||{};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(we(e[a],t[a])||r.push({command:o,args:[i,a,t[a],n]}));for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&!Object.prototype.hasOwnProperty.call(e,a)&&(we(e[a],t[a])||r.push({command:o,args:[i,a,t[a],n]}))}function Ae(e){return e.id}function Ce(e,t){return e[t.id]=t,e}class Me{constructor(e,t,r,i){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),null!=t&&t.__line__&&(this.line=t.__line__)}}function De(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}class Re extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Oe{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[r,i]of t)this.bindings[r]=i}concat(e){return new Oe(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Le={kind:"null"},Fe={kind:"number"},ze={kind:"string"},Be={kind:"boolean"},Ne={kind:"color"},je={kind:"projectionDefinition"},Ve={kind:"object"},Ue={kind:"value"},Ge={kind:"collator"},qe={kind:"formatted"},$e={kind:"padding"},We={kind:"colorArray"},Ze={kind:"numberArray"},He={kind:"resolvedImage"},Xe={kind:"variableAnchorOffsetCollection"};function Ke(e,t){return{kind:"array",itemType:e,N:t}}function Ye(e){if("array"===e.kind){const t=Ye(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Je=[Le,Fe,ze,Be,Ne,je,qe,Ve,Ke(Ue),$e,Ze,We,He,Xe];function Qe(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Qe(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Je)if(!Qe(e,t))return null}return`Expected ${Ye(e)} but found ${Ye(t)} instead.`}function et(e,t){return t.some(t=>t.kind===e.kind)}function tt(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function rt(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const it=.96422,nt=.82521,ot=4/29,at=6/29,st=3*at*at,lt=at*at*at,ct=Math.PI/180,ut=180/Math.PI;function ht(e){return(e%=360)<0&&(e+=360),e}function dt([e,t,r,i]){let n,o;const a=ft((.2225045*(e=pt(e))+.7168786*(t=pt(t))+.0606169*(r=pt(r)))/1);e===t&&t===r?n=o=a:(n=ft((.4360747*e+.3850649*t+.1430804*r)/it),o=ft((.0139322*e+.0971045*t+.7141733*r)/nt));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function pt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ft(e){return e>lt?Math.pow(e,1/3):e/st+ot}function mt([e,t,r,i]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,a=isNaN(r)?n:n-r/200;return n=1*yt(n),o=it*yt(o),a=nt*yt(a),[gt(3.1338561*o-1.6168667*n-.4906146*a),gt(-.9787684*o+1.9161415*n+.033454*a),gt(.0719453*o-.2289914*n+1.4052427*a),i]}function gt(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function yt(e){return e>at?e*e*e:st*(e-ot)}const _t=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function vt(e,t){return _t(e,t)?e[t]:void 0}function bt(e){return parseInt(e.padEnd(2,e),16)/255}function xt(e,t){return wt(t?e/100:e,0,1)}function wt(e,t,r){return Math.min(Math.max(t,e),r)}function Tt(e){return!e.some(Number.isNaN)}const St={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 Et(e,t,r){return e+r*(t-e)}function It(e,t,r){return e.map((e,i)=>Et(e,t[i],r))}class Pt{constructor(e,t,r,i=1,n=!0){this.r=e,this.g=t,this.b=r,this.a=i,n||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static parse(e){if(e instanceof Pt)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=vt(St,e);if(t){const[e,r,i]=t;return[e/255,r/255,i/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let r=1;return[bt(e.slice(r,r+=t)),bt(e.slice(r,r+=t)),bt(e.slice(r,r+=t)),bt(e.slice(r,r+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,r,i,n,o,a,s,l,c,u,h,d]=t,p=[n||" ",s||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[i,a,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[wt(+r/t,0,1),wt(+o/t,0,1),wt(+l/t,0,1),h?xt(+h,d):1];if(Tt(e))return e}}return}}const r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[e,t,i,n,o,a,s,l,c]=r,u=[i||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,wt(+n,0,100),wt(+a,0,100),l?xt(+l,c):1];if(Tt(e))return function([e,t,r,i]){function n(i){const n=(i+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=ht(e),t/=100,r/=100,[n(0),n(8),n(4),i]}(e)}}}(e);return t?new Pt(...t,!1):void 0}get rgb(){const{r:e,g:t,b:r,a:i}=this,n=i||1/0;return this.overwriteGetter("rgb",[e/n,t/n,r/n,i])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,r,i,n]=dt(e),o=Math.sqrt(r*r+i*i);return[Math.round(1e4*o)?ht(Math.atan2(i,r)*ut):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",dt(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,i]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${i})`}static interpolate(e,t,r,i="rgb"){switch(i){case"rgb":{const[i,n,o,a]=It(e.rgb,t.rgb,r);return new Pt(i,n,o,a,!1)}case"hcl":{const[i,n,o,a]=e.hcl,[s,l,c,u]=t.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 e=s-i;s>i&&e>180?e-=360:s<i&&i-s>180&&(e+=360),h=i+r*e}const[p,f,m,g]=function([e,t,r,i]){return e=isNaN(e)?0:e*ct,mt([r,Math.cos(e)*t,Math.sin(e)*t,i])}([h,null!=d?d:Et(n,l,r),Et(o,c,r),Et(a,u,r)]);return new Pt(p,f,m,g,!1)}case"lab":{const[i,n,o,a]=mt(It(e.lab,t.lab,r));return new Pt(i,n,o,a,!1)}}}}Pt.black=new Pt(0,0,0,1),Pt.white=new Pt(1,1,1,1),Pt.transparent=new Pt(0,0,0,0),Pt.red=new Pt(1,0,0,1);class kt{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const At=["bottom","center","top"];class Ct{constructor(e,t,r,i,n,o){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=o}}class Mt{constructor(e){this.sections=e}static fromString(e){return new Mt([new Ct(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof Mt?e:Mt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dt)return e;if("number"==typeof e)return new Dt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Dt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Dt(It(e.values,t.values,r))}}class Rt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Rt)return e;if("number"==typeof e)return new Rt([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new Rt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Rt(It(e.values,t.values,r))}}class Ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ot)return e;if("string"==typeof e){const t=Pt.parse(e);if(!t)return;return new Ot([t])}if(!Array.isArray(e))return;const t=[];for(const r of e){if("string"!=typeof r)return;const e=Pt.parse(r);if(!e)return;t.push(e)}return new Ot(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r,i="rgb"){const n=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)n.push(Pt.interpolate(e.values[o],t.values[o],r,i));return new Ot(n)}}class Lt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Ft=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class zt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const r=e[t],i=e[t+1];if("string"!=typeof r||!Ft.has(r))return;if(!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new zt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){const i=e.values,n=t.values;if(i.length!==n.length)throw new Lt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==n[a])throw new Lt(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${i[a]}, to[${a}]: ${n[a]}`);o.push(i[a]);const[e,t]=i[a+1],[s,l]=n[a+1];o.push([Et(e,s,r),Et(t,l,r)])}return new zt(o)}}class Bt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Bt({name:e,available:!1}):null}}class Nt{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(e,t,r){return new Nt(e,t,r)}static parse(e){return e instanceof Nt?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new Nt(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new Nt(e.from,e.to,e.transition):"string"==typeof e?new Nt(e,e,1):void 0}}function jt(e,t,r,i){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Vt(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Nt||e instanceof Pt||e instanceof kt||e instanceof Mt||e instanceof Dt||e instanceof Rt||e instanceof Ot||e instanceof zt||e instanceof Bt)return!0;if(Array.isArray(e)){for(const t of e)if(!Vt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Vt(e[t]))return!1;return!0}return!1}function Ut(e){if(null===e)return Le;if("string"==typeof e)return ze;if("boolean"==typeof e)return Be;if("number"==typeof e)return Fe;if(e instanceof Pt)return Ne;if(e instanceof Nt)return je;if(e instanceof kt)return Ge;if(e instanceof Mt)return qe;if(e instanceof Dt)return $e;if(e instanceof Rt)return Ze;if(e instanceof Ot)return We;if(e instanceof zt)return Xe;if(e instanceof Bt)return He;if(Array.isArray(e)){const t=e.length;let r;for(const i of e){const e=Ut(i);if(r){if(r===e)continue;r=Ue;break}r=e}return Ke(r||Ue,t)}return Ve}function Gt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Pt||e instanceof Nt||e instanceof Mt||e instanceof Dt||e instanceof Rt||e instanceof Ot||e instanceof zt||e instanceof Bt?e.toString():JSON.stringify(e)}class qt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Vt(e[1]))return t.error("invalid value");const r=e[1];let i=Ut(r);const n=t.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new qt(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const $t={string:ze,number:Fe,boolean:Be,object:Ve};class Wt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,i=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in $t)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=$t[r],i++}else n=Ue;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],i++}r=Ke(n,o)}else{if(!$t[n])throw new Error(`Types doesn't contain name = ${n}`);r=$t[n]}const o=[];for(;i<e.length;i++){const r=t.parse(e[i],i,Ue);if(!r)return null;o.push(r)}return new Wt(r,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!Qe(this.type,Ut(r)))return r;if(t===this.args.length-1)throw new Lt(`Expected value to be of type ${Ye(this.type)}, but found ${Ye(Ut(r))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Zt={"to-boolean":Be,"to-color":Ne,"to-number":Fe,"to-string":ze};class Ht{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0];if(!Zt[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!==e.length)return t.error("Expected one argument.");const i=Zt[r],n=[];for(let o=1;o<e.length;o++){const r=t.parse(e[o],o,Ue);if(!r)return null;n.push(r)}return new Ht(i,n)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,r;for(const i of this.args){if(t=i.evaluate(e),r=null,t instanceof Pt)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:jt(t[0],t[1],t[2],t[3]),!r))return new Pt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Lt(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const i=Dt.parse(t);if(i)return i}throw new Lt(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=Rt.parse(t);if(i)return i}throw new Lt(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=Ot.parse(t);if(i)return i}throw new Lt(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const i=zt.parse(t);if(i)return i}throw new Lt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const i=Number(t);if(!isNaN(i))return i}throw new Lt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Mt.fromString(Gt(this.args[0].evaluate(e)));case"resolvedImage":return Bt.fromString(Gt(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Gt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Xt=["Unknown","Point","LineString","Polygon"];class Kt{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?Xt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Pt.parse(e),this._parseColorCache.set(e,t)),t}}class Yt{constructor(e,t,r=[],i,n=new Oe,o=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=n,this.errors=o,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,n={}){return t?this.concat(t,r,i)._parse(e,n):this._parse(e,n)}_parse(e,t){function r(e,t,r){return"assert"===r?new Wt(t,[e]):"coerce"===r?new Ht(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=e[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(e,this);if(!i)return null;if(this.expectedType){const e=this.expectedType,n=i.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))i=r(i,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else i=r(i,e,t.typeAnnotation||"assert")}if(!(i instanceof qt)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const t=new Kt;try{i=new qt(i.type,i.evaluate(t))}catch(e){return this.error(e.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r){const i="number"==typeof e?this.path.concat(e):this.path,n=r?this.scope.concat(r):this.scope;return new Yt(this.registry,this._isConstant,i,t||null,n,this.errors)}error(e,...t){const r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new Re(r,e))}checkSubtype(e,t){const r=Qe(e,t);return r&&this.error(r),r}}class Jt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let n=1;n<e.length-1;n+=2){const i=e[n];if("string"!=typeof i)return t.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=t.parse(e[n+1],n+1);if(!o)return null;r.push([i,o])}const i=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return i?new Jt(r,i):null}outputDefined(){return this.result.outputDefined()}}class Qt{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new Qt(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class er{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Fe),i=t.parse(e[2],2,Ke(t.expectedType||Ue));return r&&i?new er(i.type.itemType,r,i):null}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Lt(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new Lt(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new Lt(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class tr{constructor(e,t){this.type=Be,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ue),i=t.parse(e[2],2,Ue);return r&&i?et(r.type,[Be,ze,Fe,Le,Ue])?new tr(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!tt(t,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(Ut(t))} instead.`);if(!tt(r,["string","array"]))throw new Lt(`Expected second argument to be of type array or string, but found ${Ye(Ut(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class rr{constructor(e,t,r){this.type=Fe,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ue),i=t.parse(e[2],2,Ue);if(!r||!i)return null;if(!et(r.type,[Be,ze,Fe,Le,Ue]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(r.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new rr(r,i,n):null}return new rr(r,i)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!tt(t,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(Ut(t))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),tt(r,["string"])){const e=r.indexOf(t,i);return-1===e?-1:[...r.slice(0,e)].length}if(tt(r,["array"]))return r.indexOf(t,i);throw new Lt(`Expected second argument to be of type array or string, but found ${Ye(Ut(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ir{constructor(e,t,r,i,n,o){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n={},o=[];for(let l=2;l<e.length-1;l+=2){let a=e[l];const s=e[l+1];Array.isArray(a)||(a=[a]);const c=t.concat(l);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,Ut(e)))return null}else r=Ut(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(s,l,i);if(!u)return null;i=i||u.type,o.push(u)}const a=t.parse(e[1],1,Ue);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,i);return s?"value"!==a.type.kind&&t.concat(1).checkSubtype(r,a.type)?null:new ir(r,i,a,n,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(Ut(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class nr{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const i=[];for(let o=1;o<e.length-1;o+=2){const n=t.parse(e[o],o,Be);if(!n)return null;const a=t.parse(e[o+1],o+1,r);if(!a)return null;i.push([n,a]),r=r||a.type}const n=t.parse(e[e.length-1],e.length-1,r);if(!n)return null;if(!r)throw new Error("Can't infer output type");return new nr(r,i,n)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class or{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ue),i=t.parse(e[2],2,Fe);if(!r||!i)return null;if(!et(r.type,[Ke(Ue),ze,Ue]))return t.error(`Expected first argument to be of type array or string, but found ${Ye(r.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new or(r.type,r,i,n):null}return new or(r.type,r,i)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),tt(t,["string"]))return[...t].slice(r,i).join("");if(tt(t,["array"]))return t.slice(r,i);throw new Lt(`Expected first argument to be of type array or string, but found ${Ye(Ut(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ar(e,t){const r=e.length-1;let i,n,o=0,a=r,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=e[s],n=e[s+1],i<=t){if(s===r||t<n)return s;o=s+1}else{if(!(i>t))throw new Lt("Input is not a number.");a=s-1}return 0}class sr{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[i,n]of r)this.labels.push(i),this.outputs.push(n)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,Fe);if(!r)return null;const i=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let o=1;o<e.length;o+=2){const r=1===o?-1/0:e[o],a=e[o+1],s=o,l=o+1;if("number"!=typeof r)return t.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 t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,n);if(!c)return null;n=n||c.type,i.push([r,c])}return new sr(n,r,i)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const n=t.length;return i>=t[n-1]?r[n-1].evaluate(e):r[ar(t,i)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cr,ur,hr=function(){if(ur)return cr;function e(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return ur=1,cr=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=e,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-e)<t));i++)e>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},cr}(),dr=lr(hr);class pr{constructor(e,t,r,i,n){this.type=e,this.operator=t,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(e,t,r,i){let n=0;if("exponential"===e.name)n=fr(t,e.base,r,i);else if("linear"===e.name)n=fr(t,1,r,i);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new dr(o[0],o[1],o[2],o[3]).solve(fr(t,1,r,i))}return n}static parse(e,t){let[r,i,n,...o]=e;if(!Array.isArray(i)||0===i.length)return t.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const e=i[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const e=i.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Fe),!n)return null;const a=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||t.expectedType==We?t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType):s=Ne;for(let l=0;l<o.length;l+=2){const e=o[l],r=o[l+1],i=l+3,n=l+4;if("number"!=typeof e)return t.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]>=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=t.parse(r,n,s);if(!c)return null;s=s||c.type,a.push([e,c])}return rt(s,Fe)||rt(s,je)||rt(s,Ne)||rt(s,$e)||rt(s,Ze)||rt(s,We)||rt(s,Xe)||rt(s,Ke(Fe))?new pr(s,r,i,n,a):t.error(`Type ${Ye(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const n=t.length;if(i>=t[n-1])return r[n-1].evaluate(e);const o=ar(t,i),a=pr.interpolationFactor(this.interpolation,i,t[o],t[o+1]),s=r[o].evaluate(e),l=r[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Et(s,l,a);case"color":return Pt.interpolate(s,l,a);case"padding":return Dt.interpolate(s,l,a);case"colorArray":return Ot.interpolate(s,l,a);case"numberArray":return Rt.interpolate(s,l,a);case"variableAnchorOffsetCollection":return zt.interpolate(s,l,a);case"array":return It(s,l,a);case"projectionDefinition":return Nt.interpolate(s,l,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return Pt.interpolate(s,l,a,"hcl");case"colorArray":return Ot.interpolate(s,l,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Pt.interpolate(s,l,a,"lab");case"colorArray":return Ot.interpolate(s,l,a,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function fr(e,t,r,i){const n=i-r,o=e-r;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}const mr={color:Pt.interpolate,number:Et,padding:Dt.interpolate,numberArray:Rt.interpolate,colorArray:Ot.interpolate,variableAnchorOffsetCollection:zt.interpolate,array:It};class gr{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=null;const i=t.expectedType;i&&"value"!==i.kind&&(r=i);const n=[];for(const a of e.slice(1)){const e=t.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}if(!r)throw new Error("No output type");const o=i&&n.some(e=>Qe(i,e.type));return new gr(o?Ue:r,n)}evaluate(e){let t,r=null,i=0;for(const n of this.args)if(i++,r=n.evaluate(e),r&&r instanceof Bt&&!r.available&&(t||(t=r.name),r=null,i===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function yr(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function _r(e,t,r,i){return 0===i.compare(t,r)}function vr(e,t,r){const i="=="!==e&&"!="!==e;return class n{constructor(e,t,r){this.type=Be,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let o=t.parse(e[1],1,Ue);if(!o)return null;if(!yr(r,o.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${Ye(o.type)}'.`);let a=t.parse(e[2],2,Ue);if(!a)return null;if(!yr(r,a.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${Ye(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${Ye(o.type)}' and '${Ye(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Wt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Wt(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,Ge),!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 t=Ut(o),r=Ut(a);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Lt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const e=Ut(o),r=Ut(a);if("string"!==e.kind||"string"!==r.kind)return t(n,o,a)}return this.collator?r(n,o,a,this.collator.evaluate(n)):t(n,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const br=vr("==",function(e,t,r){return t===r},_r),xr=vr("!=",function(e,t,r){return t!==r},function(e,t,r,i){return!_r(0,t,r,i)}),wr=vr("<",function(e,t,r){return t<r},function(e,t,r,i){return i.compare(t,r)<0}),Tr=vr(">",function(e,t,r){return t>r},function(e,t,r,i){return i.compare(t,r)>0}),Sr=vr("<=",function(e,t,r){return t<=r},function(e,t,r,i){return i.compare(t,r)<=0}),Er=vr(">=",function(e,t,r){return t>=r},function(e,t,r,i){return i.compare(t,r)>=0});class Ir{constructor(e,t,r){this.type=Ge,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");const i=t.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Be);if(!i)return null;const n=t.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Be);if(!n)return null;let o=null;return r.locale&&(o=t.parse(r.locale,1,ze),!o)?null:new Ir(i,n,o)}evaluate(e){return new kt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Pr{constructor(e,t,r,i,n){this.type=ze,this.number=e,this.locale=t,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,Fe);if(!r)return null;const i=e[2];if("object"!=typeof i||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let n=null;if(i.locale&&(n=t.parse(i.locale,1,ze),!n))return null;let o=null;if(i.currency&&(o=t.parse(i.currency,1,ze),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=t.parse(i["min-fraction-digits"],1,Fe),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=t.parse(i["max-fraction-digits"],1,Fe),!s)?null:new Pr(r,n,o,a,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class kr{constructor(e){this.type=qe,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const i=[];let n=!1;for(let o=1;o<=e.length-1;++o){const r=e[o];if(n&&"object"==typeof r&&!Array.isArray(r)){n=!1;let e=null;if(r["font-scale"]&&(e=t.parse(r["font-scale"],1,Fe),!e))return null;let o=null;if(r["text-font"]&&(o=t.parse(r["text-font"],1,Ke(ze)),!o))return null;let a=null;if(r["text-color"]&&(a=t.parse(r["text-color"],1,Ne),!a))return null;let s=null;if(r["vertical-align"]){if("string"==typeof r["vertical-align"]&&!At.includes(r["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${r["vertical-align"]}' instead.`);if(s=t.parse(r["vertical-align"],1,ze),!s)return null}const l=i[i.length-1];l.scale=e,l.font=o,l.textColor=a,l.verticalAlign=s}else{const r=t.parse(e[o],1,Ue);if(!r)return null;const a=r.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.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 kr(i)}evaluate(e){return new Mt(this.sections.map(t=>{const r=t.content.evaluate(e);return Ut(r)===He?new Ct("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Ct(Gt(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Ar{constructor(e){this.type=He,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,ze);return r?new Ar(r):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=Bt.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}}class Cr{constructor(e){this.type=Fe,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${Ye(r.type)} instead.`):new Cr(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Lt(`Expected value to be of type string or array, but found ${Ye(Ut(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mr=8192;function Dr(e,t){const r=(180+e[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(r*n*Mr),Math.round(i*n*Mr)]}function Rr(e,t){const r=Math.pow(2,t.z);return[(n=(e[0]/Mr+t.x)/r,360*n-180),(i=(e[1]/Mr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,n}function Or(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Lr(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Fr(e,t,r){const i=e[0]-t[0],n=e[1]-t[1],o=e[0]-r[0],a=e[1]-r[1];return i*a-o*n==0&&i*o<=0&&n*a<=0}function zr(e,t,r,i){return 0!=(n=[i[0]-r[0],i[1]-r[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!Gr(e,t,r,i)||!Gr(r,i,e,t));var n,o}function Br(e,t,r){for(const i of r)for(let r=0;r<i.length-1;++r)if(zr(e,t,i[r],i[r+1]))return!0;return!1}function Nr(e,t,r=!1){let i=!1;for(const s of t)for(let t=0;t<s.length-1;t++){if(Fr(e,s[t],s[t+1]))return r;(o=s[t])[1]>(n=e)[1]!=(a=s[t+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 jr(e,t){for(const r of t)if(Nr(e,r))return!0;return!1}function Vr(e,t){for(const r of e)if(!Nr(r,t))return!1;for(let r=0;r<e.length-1;++r)if(Br(e[r],e[r+1],t))return!1;return!0}function Ur(e,t){for(const r of t)if(Vr(e,r))return!0;return!1}function Gr(e,t,r,i){const n=i[0]-r[0],o=i[1]-r[1],a=(e[0]-r[0])*o-n*(e[1]-r[1]),s=(t[0]-r[0])*o-n*(t[1]-r[1]);return a>0&&s<0||a<0&&s>0}function qr(e,t,r){const i=[];for(let n=0;n<e.length;n++){const o=[];for(let i=0;i<e[n].length;i++){const a=Dr(e[n][i],r);Or(t,a),o.push(a)}i.push(o)}return i}function $r(e,t,r){const i=[];for(let n=0;n<e.length;n++){const o=qr(e[n],t,r);i.push(o)}return i}function Wr(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){const t=.5*i;let n=e[0]-r[0]>t?-i:r[0]-e[0]>t?i:0;0===n&&(n=e[0]-r[2]>t?-i:r[2]-e[0]>t?i:0),e[0]+=n}Or(t,e)}function Zr(e,t,r,i){const n=Math.pow(2,i.z)*Mr,o=[i.x*Mr,i.y*Mr],a=[];for(const s of e)for(const e of s){const i=[e.x+o[0],e.y+o[1]];Wr(i,t,r,n),a.push(i)}return a}function Hr(e,t,r,i){const n=Math.pow(2,i.z)*Mr,o=[i.x*Mr,i.y*Mr],a=[];for(const l of e){const e=[];for(const r of l){const i=[r.x+o[0],r.y+o[1]];Or(t,i),e.push(i)}a.push(e)}if(t[2]-t[0]<=n/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const i of e)Wr(i,t,r,n)}var s;return a}class Xr{constructor(e,t){this.type=Be,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Vt(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const r of t.features){const{type:t,coordinates:i}=r.geometry;"Polygon"===t&&e.push(i),"MultiPolygon"===t&&e.push(...i)}if(e.length)return new Xr(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Xr(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Xr(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=qr(t.coordinates,i,n),a=Zr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!Nr(e,o))return!1}if("MultiPolygon"===t.type){const o=$r(t.coordinates,i,n),a=Zr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!jr(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=qr(t.coordinates,i,n),a=Hr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!Vr(e,o))return!1}if("MultiPolygon"===t.type){const o=$r(t.coordinates,i,n),a=Hr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!Ur(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Kr=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(r(i,o)>=0)break;t[e]=o,e=n}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1);const o=i+1;if(o<this.length&&r(t[o],t[i])<0&&(i=o),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}};function Yr(e,t,r=0,i=e.length-1,n=Qr){for(;i>r;){if(i-r>600){const o=i-r+1,a=t-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);Yr(e,t,Math.max(r,Math.floor(t-a*l/o+c)),Math.min(i,Math.floor(t+(o-a)*l/o+c)),n)}const o=e[t];let a=r,s=i;for(Jr(e,r,t),n(e[i],o)>0&&Jr(e,r,i);a<s;){for(Jr(e,a,s),a++,s--;n(e[a],o)<0;)a++;for(;n(e[s],o)>0;)s--}0===n(e[r],o)?Jr(e,r,s):(s++,Jr(e,s,i)),s<=t&&(r=s+1),t<=s&&(i=s-1)}}function Jr(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function Qr(e,t){return e<t?-1:e>t?1:0}function ei(e,t){if(e.length<=1)return[e];const r=[];let i,n;for(const o of e){const e=ri(o);0!==e&&(o.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(i&&r.push(i),i=[o]):i.push(o))}if(i&&r.push(i),t>1)for(let o=0;o<r.length;o++)r[o].length<=t||(Yr(r[o],t,1,r[o].length-1,ti),r[o]=r[o].slice(0,t));return r}function ti(e,t){return t.area-e.area}function ri(e){let t=0;for(let r,i,n=0,o=e.length,a=o-1;n<o;a=n++)r=e[n],i=e[a],t+=(i.x-r.x)*(r.y+i.y);return t}const ii=1/298.257223563,ni=ii*(2-ii),oi=Math.PI/180;class ai{constructor(e){const t=6378.137*oi*1e3,r=Math.cos(e*oi),i=1/(1-ni*(1-r*r)),n=Math.sqrt(i);this.kx=t*n*r,this.ky=t*n*i*(1-ni)}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r,i,n,o,a=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],c=e[s][1],u=this.wrap(e[s+1][0]-l)*this.kx,h=(e[s+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[s+1][0],c=e[s+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[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(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function si(e,t){return t[0]-e[0]}function li(e){return e[1]-e[0]+1}function ci(e,t){return e[1]>=e[0]&&e[1]<t}function ui(e,t){if(e[0]>e[1])return[null,null];const r=li(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];const i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function hi(e,t){if(!ci(t,e.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)Or(r,e[i]);return r}function di(e){const t=[1/0,1/0,-1/0,-1/0];for(const r of e)for(const e of r)Or(t,e);return t}function pi(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function fi(e,t,r){if(!pi(e)||!pi(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function mi(e,t,r){const i=r.pointOnLine(t,e);return r.distance(e,i.point)}function gi(e,t,r,i,n){const o=Math.min(mi(e,[r,i],n),mi(t,[r,i],n)),a=Math.min(mi(r,[e,t],n),mi(i,[e,t],n));return Math.min(o,a)}function yi(e,t,r,i,n){if(!ci(t,e.length)||!ci(i,r.length))return 1/0;let o=1/0;for(let a=t[0];a<t[1];++a){const t=e[a],s=e[a+1];for(let e=i[0];e<i[1];++e){const i=r[e],a=r[e+1];if(zr(t,s,i,a))return 0;o=Math.min(o,gi(t,s,i,a,n))}}return o}function _i(e,t,r,i,n){if(!ci(t,e.length)||!ci(i,r.length))return NaN;let o=1/0;for(let a=t[0];a<=t[1];++a)for(let t=i[0];t<=i[1];++t)if(o=Math.min(o,n.distance(e[a],r[t])),0===o)return o;return o}function vi(e,t,r){if(Nr(e,t,!0))return 0;let i=1/0;for(const n of t){const t=n[0],o=n[n.length-1];if(t!==o&&(i=Math.min(i,mi(e,[o,t],r)),0===i))return i;const a=r.pointOnLine(n,e);if(i=Math.min(i,r.distance(e,a.point)),0===i)return i}return i}function bi(e,t,r,i){if(!ci(t,e.length))return NaN;for(let o=t[0];o<=t[1];++o)if(Nr(e[o],r,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],a=e[o+1];for(const e of r)for(let r=0,o=e.length,s=o-1;r<o;s=r++){const o=e[s],l=e[r];if(zr(t,a,o,l))return 0;n=Math.min(n,gi(t,a,o,l,i))}}return n}function xi(e,t){for(const r of e)for(const e of r)if(Nr(e,t,!0))return!0;return!1}function wi(e,t,r,i=1/0){const n=di(e),o=di(t);if(i!==1/0&&fi(n,o,r)>=i)return i;if(Lr(n,o)){if(xi(e,t))return 0}else if(xi(t,e))return 0;let a=1/0;for(const s of e)for(let e=0,i=s.length,n=i-1;e<i;n=e++){const i=s[n],o=s[e];for(const e of t)for(let t=0,n=e.length,s=n-1;t<n;s=t++){const n=e[s],l=e[t];if(zr(i,o,n,l))return 0;a=Math.min(a,gi(i,o,n,l,r))}}return a}function Ti(e,t,r,i,n,o){if(!o)return;const a=fi(hi(i,o),n,r);a<t&&e.push([a,o,[0,0]])}function Si(e,t,r,i,n,o,a){if(!o||!a)return;const s=fi(hi(i,o),hi(n,a),r);s<t&&e.push([s,o,a])}function Ei(e,t,r,i,n=1/0){let o=Math.min(i.distance(e[0],r[0][0]),n);if(0===o)return o;const a=new Kr([[0,[0,e.length-1],[0,0]]],si),s=di(r);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(li(l)<=c){if(!ci(l,e.length))return NaN;if(t){const t=bi(e,l,r,i);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=vi(e[t],r,i);if(o=Math.min(o,n),0===o)return 0}}else{const r=ui(l,t);Ti(a,o,i,e,s,r[0]),Ti(a,o,i,e,s,r[1])}}return o}function Ii(e,t,r,i,n,o=1/0){let a=Math.min(o,n.distance(e[0],r[0]));if(0===a)return a;const s=new Kr([[0,[0,e.length-1],[0,r.length-1]]],si);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],u=t?50:100,h=i?50:100;if(li(l)<=u&&li(c)<=h){if(!ci(l,e.length)&&ci(c,r.length))return NaN;let o;if(t&&i)o=yi(e,l,r,c,n),a=Math.min(a,o);else if(t&&!i){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=mi(r[e],t,n),a=Math.min(a,o),0===a)return a}else if(!t&&i){const t=r.slice(c[0],c[1]+1);for(let r=l[0];r<=l[1];++r)if(o=mi(e[r],t,n),a=Math.min(a,o),0===a)return a}else o=_i(e,l,r,c,n),a=Math.min(a,o)}else{const o=ui(l,t),u=ui(c,i);Si(s,a,n,e,r,o[0],u[0]),Si(s,a,n,e,r,o[0],u[1]),Si(s,a,n,e,r,o[1],u[0]),Si(s,a,n,e,r,o[1],u[1])}}return a}function Pi(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}class ki{constructor(e,t){this.type=Fe,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Vt(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new ki(t,t.features.map(e=>Pi(e.geometry)).flat());if("Feature"===t.type)return new ki(t,Pi(t.geometry));if("type"in t&&"coordinates"in t)return new ki(t,Pi(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=e.geometry(),i=r.flat().map(t=>Rr([t.x,t.y],e.canonical));if(0===r.length)return NaN;const n=new ai(i[0][1]);let o=1/0;for(const a of t){switch(a.type){case"Point":o=Math.min(o,Ii(i,!1,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Ii(i,!1,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Ei(i,!1,a.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=e.geometry(),i=r.flat().map(t=>Rr([t.x,t.y],e.canonical));if(0===r.length)return NaN;const n=new ai(i[0][1]);let o=1/0;for(const a of t){switch(a.type){case"Point":o=Math.min(o,Ii(i,!0,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Ii(i,!0,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Ei(i,!0,a.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const r=e.geometry();if(0===r.length||0===r[0].length)return NaN;const i=ei(r,0).map(t=>t.map(t=>t.map(t=>Rr([t.x,t.y],e.canonical)))),n=new ai(i[0][0][0][1]);let o=1/0;for(const a of t)for(const e of i){switch(a.type){case"Point":o=Math.min(o,Ei([a.coordinates],!1,e,n,o));break;case"LineString":o=Math.min(o,Ei(a.coordinates,!0,e,n,o));break;case"Polygon":o=Math.min(o,wi(e,a.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ai{constructor(e){this.type=Ue,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[1];return null==r?t.error("Global state property must be defined."):"string"!=typeof r?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Ai(r)}evaluate(e){var t;const r=null===(t=e.globals)||void 0===t?void 0:t.globalState;return r&&0!==Object.keys(r).length?vt(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Ci={"==":br,"!=":xr,">":Tr,"<":wr,">=":Er,"<=":Sr,array:Wt,at:er,boolean:Wt,case:nr,coalesce:gr,collator:Ir,format:kr,image:Ar,in:tr,"index-of":rr,interpolate:pr,"interpolate-hcl":pr,"interpolate-lab":pr,length:Cr,let:Jt,literal:qt,match:ir,number:Wt,"number-format":Pr,object:Wt,slice:or,step:sr,string:Wt,"to-boolean":Ht,"to-color":Ht,"to-number":Ht,"to-string":Ht,var:Qt,within:Xr,distance:ki,"global-state":Ai};class Mi{constructor(e,t,r,i){this.name=e,this.type=t,this._evaluate=r,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const r=e[0],i=Mi.definitions[r];if(!i)return t.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(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[l,c]of a){s=new Yt(t.registry,Fi,t.path,null,t.scope);const i=[];let o=!1;for(let t=1;t<e.length;t++){const r=e[t],n=Array.isArray(l)?l[t-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 e=0;e<i.length;e++){const t=Array.isArray(l)?l[e]:l.type,r=i[e];s.concat(e+1).checkSubtype(t,r.type)}if(0===s.errors.length)return new Mi(r,n,c,i)}}if(1===a.length)t.errors.push(...s.errors);else{const r=(a.length?a:o).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(Ye).join(", ")})`:`(${Ye(t.type)}...)`;var t}).join(" | "),i=[];for(let n=1;n<e.length;n++){const r=t.parse(e[n],1+i.length);if(!r)return null;i.push(Ye(r.type))}t.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(e,t){Mi.definitions=t;for(const r in t)e[r]=Mi}}function Di(e,[t,r,i,n]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);const o=n?n.evaluate(e):1,a=jt(t,r,i,o);if(a)throw new Lt(a);return new Pt(t/255,r/255,i/255,o,!1)}function Ri(e,t){return e in t}function Oi(e,t){const r=t[e];return void 0===r?null:r}function Li(e){return{type:e}}function Fi(e){if(e instanceof Qt)return Fi(e.boundExpression);if(e instanceof Mi&&"error"===e.name)return!1;if(e instanceof Ir)return!1;if(e instanceof Xr)return!1;if(e instanceof ki)return!1;if(e instanceof Ai)return!1;const t=e instanceof Ht||e instanceof Wt;let r=!0;return e.eachChild(e=>{r=t?r&&Fi(e):r&&e instanceof qt}),!!r&&zi(e)&&Ni(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function zi(e){if(e instanceof Mi){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Xr)return!1;if(e instanceof ki)return!1;let t=!0;return e.eachChild(e=>{t&&!zi(e)&&(t=!1)}),t}function Bi(e){if(e instanceof Mi&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!Bi(e)&&(t=!1)}),t}function Ni(e,t){if(e instanceof Mi&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!Ni(e,t)&&(r=!1)}),r}function ji(e){return{result:"success",value:e}}function Vi(e){return{result:"error",value:e}}function Ui(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Gi(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function qi(e){return!!e.expression&&e.expression.interpolated}function $i(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Wi(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&Ut(e)===Ve}function Zi(e){return e}function Hi(e,t){const r=e.stops&&"object"==typeof e.stops[0][0],i=r||!(r||void 0!==e.property),n=e.type||(qi(t)?"exponential":"interval"),o=function(e){switch(e.type){case"color":return Pt.parse;case"padding":return Dt.parse;case"numberArray":return Rt.parse;case"colorArray":return Ot.parse;default:return null}}(t);if(o&&((e=De({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],o(e[1])])),e.default=o(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==(a=e.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${e.colorSpace}"`);var a;const s=function(e){switch(e){case"exponential":return Ji;case"interval":return Yi;case"categorical":return Ki;case"identity":return Qi;default:throw new Error(`Unknown function type "${e}"`)}}(n);let l,c;if("categorical"===n){l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}if(r){const r={},i=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===r[o]&&(r[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},i.push(o)),r[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of i)n.push([r[e].zoom,Hi(r[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:pr.interpolationFactor.bind(void 0,o),zoomStops:n.map(e=>e[0]),evaluate:({zoom:r},i)=>Ji({stops:n,base:e.base},t,r).evaluate(r,i)}}if(i){const r="exponential"===n?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:pr.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:r})=>s(e,t,r,l,c)}}return{kind:"source",evaluate(r,i){const n=i&&i.properties?i.properties[e.property]:void 0;return void 0===n?Xi(e.default,t.default):s(e,t,n,l,c)}}}function Xi(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function Ki(e,t,r,i,n){return Xi(typeof r===n?i[r]:void 0,e.default,t.default)}function Yi(e,t,r){if("number"!==$i(r))return Xi(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];const n=ar(e.stops.map(e=>e[0]),r);return e.stops[n][1]}function Ji(e,t,r){const i=void 0!==e.base?e.base:1;if("number"!==$i(r))return Xi(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];const o=ar(e.stops.map(e=>e[0]),r),a=function(e,t,r,i){const n=i-r,o=e-r;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(r,i,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],c=mr[t.type]||Zi;return"function"==typeof s.evaluate?{evaluate(...t){const r=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return c(r,i,a,e.colorSpace)}}:c(s,l,a,e.colorSpace)}function Qi(e,t,r){switch(t.type){case"color":r=Pt.parse(r);break;case"formatted":r=Mt.fromString(r.toString());break;case"resolvedImage":r=Bt.fromString(r.toString());break;case"padding":r=Dt.parse(r);break;case"colorArray":r=Ot.parse(r);break;case"numberArray":r=Rt.parse(r);break;default:$i(r)===t.type||"enum"===t.type&&t.values[r]||(r=void 0)}return Xi(r,e.default,t.default)}Mi.register(Ci,{error:[{kind:"error"},[ze],(e,[t])=>{throw new Lt(t.evaluate(e))}],typeof:[ze,[Ue],(e,[t])=>Ye(Ut(t.evaluate(e)))],"to-rgba":[Ke(Fe,4),[Ne],(e,[t])=>{const[r,i,n,o]=t.evaluate(e).rgb;return[255*r,255*i,255*n,o]}],rgb:[Ne,[Fe,Fe,Fe],Di],rgba:[Ne,[Fe,Fe,Fe,Fe],Di],has:{type:Be,overloads:[[[ze],(e,[t])=>Ri(t.evaluate(e),e.properties())],[[ze,Ve],(e,[t,r])=>Ri(t.evaluate(e),r.evaluate(e))]]},get:{type:Ue,overloads:[[[ze],(e,[t])=>Oi(t.evaluate(e),e.properties())],[[ze,Ve],(e,[t,r])=>Oi(t.evaluate(e),r.evaluate(e))]]},"feature-state":[Ue,[ze],(e,[t])=>Oi(t.evaluate(e),e.featureState||{})],properties:[Ve,[],e=>e.properties()],"geometry-type":[ze,[],e=>e.geometryType()],id:[Ue,[],e=>e.id()],zoom:[Fe,[],e=>e.globals.zoom],"heatmap-density":[Fe,[],e=>e.globals.heatmapDensity||0],elevation:[Fe,[],e=>e.globals.elevation||0],"line-progress":[Fe,[],e=>e.globals.lineProgress||0],accumulated:[Ue,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Fe,Li(Fe),(e,t)=>{let r=0;for(const i of t)r+=i.evaluate(e);return r}],"*":[Fe,Li(Fe),(e,t)=>{let r=1;for(const i of t)r*=i.evaluate(e);return r}],"-":{type:Fe,overloads:[[[Fe,Fe],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[Fe],(e,[t])=>-t.evaluate(e)]]},"/":[Fe,[Fe,Fe],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[Fe,[Fe,Fe],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[Fe,[],()=>Math.LN2],pi:[Fe,[],()=>Math.PI],e:[Fe,[],()=>Math.E],"^":[Fe,[Fe,Fe],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[Fe,[Fe],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))],log2:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Fe,[Fe],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Fe,[Fe],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Fe,[Fe],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Fe,[Fe],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Fe,[Fe],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Fe,[Fe],(e,[t])=>Math.atan(t.evaluate(e))],min:[Fe,Li(Fe),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[Fe,Li(Fe),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[Fe,[Fe],(e,[t])=>Math.abs(t.evaluate(e))],round:[Fe,[Fe],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[Fe,[Fe],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Fe,[Fe],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Be,[ze,Ue],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[Be,[Ue],(e,[t])=>e.id()===t.value],"filter-type-==":[Be,[ze],(e,[t])=>e.geometryType()===t.value],"filter-<":[Be,[ze,Ue],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Be,[Ue],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[Be,[ze,Ue],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Be,[Ue],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[Be,[ze,Ue],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Be,[Ue],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[Be,[ze,Ue],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Be,[Ue],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[Be,[Ue],(e,[t])=>t.value in e.properties()],"filter-has-id":[Be,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Be,[Ke(ze)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Be,[Ke(Ue)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Be,[ze,Ke(Ue)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Be,[ze,Ke(Ue)],(e,[t,r])=>function(e,t,r,i){for(;r<=i;){const n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Be,overloads:[[[Be,Be],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Li(Be),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:Be,overloads:[[[Be,Be],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Li(Be),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[Be,[Be],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Be,[ze],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[ze,[ze],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ze,[ze],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ze,Li(Ue),(e,t)=>t.map(t=>Gt(t.evaluate(e))).join("")],"resolved-locale":[ze,[Ge],(e,[t])=>t.evaluate(e).resolvedLocale()]});class en{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new Kt,this._defaultValue=t?function(e){if("color"===e.type&&Wi(e.default))return new Pt(0,0,0,0);switch(e.type){case"color":return Pt.parse(e.default)||null;case"padding":return Dt.parse(e.default)||null;case"numberArray":return Rt.parse(e.default)||null;case"colorArray":return Ot.parse(e.default)||null;case"variableAnchorOffsetCollection":return zt.parse(e.default)||null;case"projectionDefinition":return Nt.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._globalState&&(e=un(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,n,o){this._globalState&&(e=un(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Lt(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function tn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Ci}function rn(e,t,r){const i=new Yt(Ci,Fi,[],t?function(e){const t={color:Ne,string:ze,number:Fe,enum:ze,boolean:Be,formatted:qe,padding:$e,numberArray:Ze,colorArray:We,projectionDefinition:je,resolvedImage:He,variableAnchorOffsetCollection:Xe};return"array"===e.type?Ke(t[e.value]||Ue,e.length):t[e.type]}(t):void 0),n=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?ji(new en(n,t,r)):Vi(i.errors)}class nn{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Bi(t.expression),this.globalStateRefs=cn(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._globalState&&(e=un(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,o)}evaluate(e,t,r,i,n,o){return this._globalState&&(e=un(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,o)}}class on{constructor(e,t,r,i,n){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Bi(t.expression),this.globalStateRefs=cn(t.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._globalState&&(e=un(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,o)}evaluate(e,t,r,i,n,o){return this._globalState&&(e=un(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,o)}interpolationFactor(e,t,r){return this.interpolationType?pr.interpolationFactor(this.interpolationType,e,t,r):0}}function an(e,t,r){const i=rn(e,t,r);if("error"===i.result)return i;const n=i.value.expression,o=zi(n);if(!o&&!Ui(t))return Vi([new Re("","data expressions not supported")]);const a=Ni(n,["zoom"]);if(!a&&!Gi(t))return Vi([new Re("","zoom expressions not supported")]);const s=ln(n);return s||a?s instanceof Re?Vi([s]):s instanceof pr&&!qi(t)?Vi([new Re("",'"interpolate" expressions cannot be used with this property')]):ji(s?new on(o?"camera":"composite",i.value,s.labels,s instanceof pr?s.interpolation:void 0,r):new nn(o?"constant":"source",i.value,r)):Vi([new Re("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class sn{constructor(e,t){this._parameters=e,this._specification=t,De(this,Hi(this._parameters,this._specification))}static deserialize(e){return new sn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ln(e){let t=null;if(e instanceof Jt)t=ln(e.result);else if(e instanceof gr){for(const r of e.args)if(t=ln(r),t)break}else(e instanceof sr||e instanceof pr)&&e.input instanceof Mi&&"zoom"===e.input.name&&(t=e);return t instanceof Re||e.eachChild(e=>{const r=ln(e);r instanceof Re?t=r:!t&&r?t=new Re("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Re("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function cn(e,t=new Set){return e instanceof Ai&&t.add(e.key),e.eachChild(e=>{cn(e,t)}),t}function un(e,t){const{zoom:r,heatmapDensity:i,elevation:n,lineProgress:o,isSupportedScript:a,accumulated:s}=null!=e?e:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:o,isSupportedScript:a,accumulated:s,globalState:t}}function hn(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!hn(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const dn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pn(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};hn(e)||(e=gn(e));const r=rn(e,dn,t);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,i)=>r.value.evaluate(e,t,{},i),needGeometry:mn(e),getGlobalStateRefs:()=>cn(r.value.expression)}}function fn(e,t){return e<t?-1:e>t?1:0}function mn(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(mn(e[t]))return!0;return!1}function gn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?yn(e[1],e[2],"=="):"!="===t?bn(yn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?yn(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(gn))):"all"===t?["all"].concat(e.slice(1).map(gn)):"none"===t?["all"].concat(e.slice(1).map(gn).map(bn)):"in"===t?_n(e[1],e.slice(2)):"!in"===t?bn(_n(e[1],e.slice(2))):"has"===t?vn(e[1]):"!has"!==t||bn(vn(e[1]));var r}function yn(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function _n(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(fn)]]:["filter-in-small",e,["literal",t]]}}function vn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function bn(e){return["!",e]}function xn(e){const t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const r of e)t+=`${xn(r)},`;return`${t}]`}const r=Object.keys(e).sort();let i="{";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${xn(e[r[n]])},`;return`${i}}`}function wn(e){let t="";for(const r of be)t+=`/${xn(e[r])}`;return t}function Tn(e){const t=e.value;return t?[new Me(e.key,t,"constants have been deprecated as of v8")]:[]}function Sn(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function En(e){if(Array.isArray(e))return e.map(En);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const r in e)t[r]=En(e[r]);return t}return Sn(e)}function In(e){const t=e.key,r=e.value,i=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec;let l=[];const c=$i(r);if("object"!==c)return[new Me(t,r,`object expected, ${c} found`)];for(const u in r){const e=u.split(".")[0],c=vt(i,e)||i["*"];let h;if(vt(n,e))h=n[e];else if(vt(i,e)){if(void 0===r[u])continue;h=s}else if(n["*"])h=n["*"];else{if(!i["*"]){l.push(new Me(t,r[u],`unknown property "${u}"`));continue}h=s}l=l.concat(h({key:(t?`${t}.`:t)+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 Me(t,r,`missing required property "${u}"`));return l}function Pn(e){const t=e.value,r=e.valueSpec,i=e.style,n=e.styleSpec,o=e.key,a=e.arrayElementValidator||e.validateSpec;if("array"!==$i(t))return[new Me(o,t,`array expected, ${$i(t)} found`)];if(r.length&&t.length!==r.length)return[new Me(o,t,`array length ${r.length} expected, length ${t.length} found`)];let s={type:r.value,values:r.values};n.$version<7&&(s.function=r.function),"object"===$i(r.value)&&(s=r.value);let l=[];for(let c=0;c<t.length;c++)l=l.concat(a({array:t,arrayIndex:c,value:t[c],valueSpec:s,validateSpec:e.validateSpec,style:i,styleSpec:n,key:`${o}[${c}]`}));return l}function kn(e){const t=e.key,r=e.value,i=e.valueSpec;let n=$i(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new Me(t,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new Me(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new Me(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function An(e){const t=e.valueSpec,r=Sn(e.value.type);let i,n,o,a={};const s="categorical"!==r&&void 0===e.value.property,l=!s,c="array"===$i(e.value.stops)&&"array"===$i(e.value.stops[0])&&"object"===$i(e.value.stops[0][0]),u=In({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===r)return[new Me(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const i=e.value;return t=t.concat(Pn({key:e.key,value:i,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===$i(i)&&0===i.length&&t.push(new Me(e.key,i,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===r&&s&&u.push(new Me(e.key,e.value,'missing required property "property"')),"identity"===r||e.value.stops||u.push(new Me(e.key,e.value,'missing required property "stops"')),"exponential"===r&&e.valueSpec.expression&&!qi(e.valueSpec)&&u.push(new Me(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ui(e.valueSpec)?u.push(new Me(e.key,e.value,"property functions not supported")):s&&!Gi(e.valueSpec)&&u.push(new Me(e.key,e.value,"zoom functions not supported"))),"categorical"!==r&&!c||void 0!==e.value.property||u.push(new Me(e.key,e.value,'"property" property is required')),u;function h(e){let r=[];const i=e.value,s=e.key;if("array"!==$i(i))return[new Me(s,i,`array expected, ${$i(i)} found`)];if(2!==i.length)return[new Me(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==$i(i[0]))return[new Me(s,i,`object expected, ${$i(i[0])} found`)];if(void 0===i[0].zoom)return[new Me(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Me(s,i,"object stop key must have value")];if(o&&o>Sn(i[0].zoom))return[new Me(s,i[0].zoom,"stop zoom values must appear in ascending order")];Sn(i[0].zoom)!==o&&(o=Sn(i[0].zoom),n=void 0,a={}),r=r.concat(In({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:kn,value:d}}))}else r=r.concat(d({key:`${s}[0]`,value:i[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},i));return tn(En(i[1]))?r.concat([new Me(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):r.concat(e.validateSpec({key:`${s}[1]`,value:i[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const s=$i(e.value),l=Sn(e.value),c=null!==e.value?e.value:o;if(i){if(s!==i)return[new Me(e.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 Me(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==r){let i=`number expected, ${s} found`;return Ui(t)&&void 0===r&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(e.key,c,i)]}return"categorical"!==r||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===s&&void 0!==n&&l<n?[new Me(e.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===r&&l in a?[new Me(e.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Me(e.key,c,`integer expected, found ${l}`)]}}function Cn(e){const t=("property"===e.expressionContext?an:rn)(En(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new Me(`${e.key}${t.key}`,e.value,t.message));const r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new Me(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Bi(r))return[new Me(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Bi(r))return[new Me(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Ni(r,["zoom","feature-state"]))return[new Me(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!zi(r))return[new Me(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Mn(e){const t=e.key,r=e.value,i=$i(r);return"string"!==i?[new Me(t,r,`color expected, ${i} found`)]:Pt.parse(String(r))?[]:[new Me(t,r,`color expected, "${r}" found`)]}function Dn(e){const t=e.key,r=e.value,i=e.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(Sn(r))&&n.push(new Me(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(Sn(r))&&n.push(new Me(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function Rn(e){return hn(En(e.value))?Cn(De({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):On(e)}function On(e){const t=e.value,r=e.key;if("array"!==$i(t))return[new Me(r,t,`array expected, ${$i(t)} found`)];const i=e.styleSpec;let n,o=[];if(t.length<1)return[new Me(r,t,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Sn(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Sn(t[1])&&o.push(new Me(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Me(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=$i(t[1]),"string"!==n&&o.push(new Me(`${r}[1]`,t[1],`string expected, ${n} found`)));for(let a=2;a<t.length;a++)n=$i(t[a]),"$type"===Sn(t[1])?o=o.concat(Dn({key:`${r}[${a}]`,value:t[a],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Me(`${r}[${a}]`,t[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let i=1;i<t.length;i++)o=o.concat(On({key:`${r}[${i}]`,value:t[i],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=$i(t[1]),2!==t.length?o.push(new Me(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Me(`${r}[1]`,t[1],`string expected, ${n} found`))}return o}function Ln(e,t){const r=e.key,i=e.validateSpec,n=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return i({key:r,value:a,valueSpec:o.transition,style:n,styleSpec:o});const u=e.valueSpec||l[s];if(!u)return[new Me(r,a,`unknown property "${s}"`)];let h;if("string"===$i(a)&&Ui(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new Me(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"===e.layerType&&"text-font"===s&&Wi(En(a))&&"identity"===Sn(a.type)&&d.push(new Me(r,a,'"text-font" does not support identity functions')),d.concat(i({key:e.key,value:a,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function Fn(e){return Ln(e,"paint")}function zn(e){return Ln(e,"layout")}function Bn(e){let t=[];const r=e.value,i=e.key,n=e.style,o=e.styleSpec;if("object"!==$i(r))return[new Me(i,r,`object expected, ${$i(r)} found`)];r.type||r.ref||t.push(new Me(i,r,'either "type" or "ref" is required'));let a=Sn(r.type);const s=Sn(r.ref);if(r.id){const o=Sn(r.id);for(let a=0;a<e.arrayIndex;a++){const e=n.layers[a];Sn(e.id)===o&&t.push(new Me(i,r.id,`duplicate layer id "${r.id}", previously used at line ${e.id.__line__}`))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in r&&t.push(new Me(i,r[e],`"${e}" is prohibited for ref layers`))}),n.layers.forEach(t=>{Sn(t.id)===s&&(e=t)}),e?e.ref?t.push(new Me(i,r.ref,"ref cannot reference another ref layer")):a=Sn(e.type):t.push(new Me(i,r.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(r.source){const e=n.sources&&n.sources[r.source],o=e&&Sn(e.type);e?"vector"===o&&"raster"===a?t.push(new Me(i,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a||"raster-dem"!==o&&"color-relief"===a?t.push(new Me(i,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?t.push(new Me(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==o||r["source-layer"]?"raster-dem"===o&&"hillshade"!==a&&"color-relief"!==a?t.push(new Me(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&&e.lineMetrics||t.push(new Me(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Me(i,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Me(i,r.source,`source "${r.source}" not found`))}else t.push(new Me(i,r,'missing required property "source"'));return t=t.concat(In({key:i,value:r,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:Rn,layout:e=>In({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>zn(De({layerType:a},e))}}),paint:e=>In({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Fn(De({layerType:a},e))}})}})),t}function Nn(e){const t=e.value,r=e.key,i=$i(t);return"string"!==i?[new Me(r,t,`string expected, ${i} found`)]:[]}const jn={promoteId:function({key:e,value:t}){if("string"===$i(t))return Nn({key:e,value:t});{const r=[];for(const i in t)r.push(...Nn({key:`${e}.${i}`,value:t[i]}));return r}}};function Vn(e){const t=e.value,r=e.key,i=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new Me(r,t,'"type" is required')];const a=Sn(t.type);let s;switch(a){case"vector":case"raster":return s=In({key:r,value:t,valueSpec:i[`source_${a.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:jn,validateSpec:o}),s;case"raster-dem":return s=function(e){var t;const r=null!==(t=e.sourceName)&&void 0!==t?t:"",i=e.value,n=e.styleSpec,o=n.source_raster_dem,a=e.style;let s=[];const l=$i(i);if(void 0===i)return s;if("object"!==l)return s.push(new Me("source_raster_dem",i,`object expected, ${l} found`)),s;const c="custom"===Sn(i.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const d in i)!c&&u.includes(d)?s.push(new Me(d,i[d],`In "${r}": "${d}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[d]?s=s.concat(e.validateSpec({key:d,value:i[d],valueSpec:o[d],validateSpec:e.validateSpec,style:a,styleSpec:n})):s.push(new Me(d,i[d],`unknown property "${d}"`));return s}({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=In({key:r,value:t,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:jn}),t.cluster)for(const e in t.clusterProperties){const[i,n]=t.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;s.push(...Cn({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),s.push(...Cn({key:`${r}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return In({key:r,value:t,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return In({key:r,value:t,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new Me(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Un(e){const t=e.value,r=e.styleSpec,i=r.light,n=e.style;let o=[];const a=$i(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Me("light",t,`object expected, ${a} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&i[a[1]]&&i[a[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:n,styleSpec:r}):i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:n,styleSpec:r}):[new Me(s,t[s],`unknown property "${s}"`)])}return o}function Gn(e){const t=e.value,r=e.styleSpec,i=r.sky,n=e.style,o=$i(t);if(void 0===t)return[];if("object"!==o)return[new Me("sky",t,`object expected, ${o} found`)];let a=[];for(const s in t)a=a.concat(i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],style:n,styleSpec:r}):[new Me(s,t[s],`unknown property "${s}"`)]);return a}function qn(e){const t=e.value,r=e.styleSpec,i=r.terrain,n=e.style;let o=[];const a=$i(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Me("terrain",t,`object expected, ${a} found`)]),o;for(const s in t)o=o.concat(i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:n,styleSpec:r}):[new Me(s,t[s],`unknown property "${s}"`)]);return o}function $n(e){let t=[];const r=e.value,i=e.key;if(Array.isArray(r)){const n=[],o=[];for(const a in r)r[a].id&&n.includes(r[a].id)&&t.push(new Me(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)&&t.push(new Me(i,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url),t=t.concat(In({key:`${i}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Nn({key:i,value:r})}function Wn(e){return Boolean(e)&&e.constructor===Object}function Zn(e){return Wn(e.value)?[]:[new Me(e.key,e.value,`object expected, ${$i(e.value)} found`)]}const Hn={"*":()=>[],array:Pn,boolean:function(e){const t=e.value,r=e.key,i=$i(t);return"boolean"!==i?[new Me(r,t,`boolean expected, ${i} found`)]:[]},number:kn,color:Mn,constants:Tn,enum:Dn,filter:Rn,function:An,layer:Bn,object:In,source:Vn,light:Un,sky:Gn,terrain:qn,projection:function(e){const t=e.value,r=e.styleSpec,i=r.projection,n=e.style,o=$i(t);if(void 0===t)return[];if("object"!==o)return[new Me("projection",t,`object expected, ${o} found`)];let a=[];for(const s in t)a=a.concat(i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],style:n,styleSpec:r}):[new Me(s,t[s],`unknown property "${s}"`)]);return a},projectionDefinition:function(e){const t=e.key;let r=e.value;r=r instanceof String?r.valueOf():r;const i=$i(r);return"array"!==i||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(r)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(r)?["array","string"].includes(i)?[]:[new Me(t,r,`projection expected, invalid type "${i}" found`)]:[new Me(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Nn,formatted:function(e){return 0===Nn(e).length?[]:Cn(e)},resolvedImage:function(e){return 0===Nn(e).length?[]:Cn(e)},padding:function(e){const t=e.key,r=e.value;if("array"===$i(r)){if(r.length<1||r.length>4)return[new Me(t,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(e.validateSpec({key:`${t}[${o}]`,value:r[o],validateSpec:e.validateSpec,valueSpec:i}));return n}return kn({key:t,value:r,valueSpec:{}})},numberArray:function(e){const t=e.key,r=e.value;if("array"===$i(r)){const i={type:"number"};if(r.length<1)return[new Me(t,r,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<r.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:r[o],validateSpec:e.validateSpec,valueSpec:i}));return n}return kn({key:t,value:r,valueSpec:{}})},colorArray:function(e){const t=e.key,r=e.value;if("array"===$i(r)){if(r.length<1)return[new Me(t,r,"array length at least 1 expected, length 0 found")];let e=[];for(let i=0;i<r.length;i++)e=e.concat(Mn({key:`${t}[${i}]`,value:r[i]}));return e}return Mn({key:t,value:r})},variableAnchorOffsetCollection:function(e){const t=e.key,r=e.value,i=$i(r),n=e.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new Me(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(Dn({key:`${t}[${a}]`,value:r[a],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(Pn({key:`${t}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return o},sprite:$n,state:Zn,fontFaces:function(e){const t=e.key,r=e.value,i=e.validateSpec,n=e.styleSpec,o=e.style;if(!Wn(r))return[new Me(t,r,`object expected, ${$i(r)} found`)];const a=[];for(const s in r){const e=r[s],l=$i(e);if("string"===l)a.push(...Nn({key:`${t}.${s}`,value:e}));else if("array"===l){const r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of e.entries())a.push(...In({key:`${t}.${s}[${l}]`,value:c,valueSpec:r,styleSpec:n,style:o,validateSpec:i}))}else a.push(new Me(`${t}.${s}`,e,`string or array expected, ${l} found`))}return a}};function Xn(e){const t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=Xn,r.expression&&Wi(Sn(t))?An(e):r.expression&&tn(En(t))?Cn(e):r.type&&Hn[r.type]?Hn[r.type](e):In(De({},e,{valueSpec:r.type?i[r.type]:r}))}function Kn(e){const t=e.value,r=e.key,i=Nn(e);return i.length||(-1===t.indexOf("{fontstack}")&&i.push(new Me(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&i.push(new Me(r,t,'"glyphs" url must include a "{range}" token'))),i}function Yn(e,t=ve){let r=[];return r=r.concat(Xn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Xn,objectElementValidators:{glyphs:Kn,"*":()=>[]}})),e.constants&&(r=r.concat(Tn({key:"constants",value:e.constants}))),Qn(r)}function Jn(e){return function(t){return e(Object.assign({},t,{validateSpec:Xn}))}}function Qn(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function eo(e){return function(...t){return Qn(e.apply(this,t))}}Yn.source=eo(Jn(Vn)),Yn.sprite=eo(Jn($n)),Yn.glyphs=eo(Jn(Kn)),Yn.light=eo(Jn(Un)),Yn.sky=eo(Jn(Gn)),Yn.terrain=eo(Jn(qn)),Yn.state=eo(Jn(Zn)),Yn.layer=eo(Jn(Bn)),Yn.filter=eo(Jn(Rn)),Yn.paintProperty=eo(Jn(Fn)),Yn.layoutProperty=eo(Jn(zn));const to={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class ro{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){var e;return null!==(e=this._literalValue)&&void 0!==e?e:this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const t=rn(e,to,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=cn(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const io=ve,no=Yn,oo=no.light,ao=no.sky,so=no.paintProperty,lo=no.layoutProperty;function co(e,t){let r=!1;if(t&&t.length)for(const i of t)e.fire(new ye(new Error(i.message))),r=!0;return r}class uo{constructor(e,t,r){const i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(r=n[2]);for(let e=0;e<this.d*this.d;e++){const t=n[3+e],r=n[3+e+1];i.push(t===r?null:n.subarray(t,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=t+2*r;for(let e=0;e<this.d*this.d;e++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;const n=r/t*e;this.min=-n,this.max=e+n}insert(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),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(e,t,r,i,n,o){this.cells[n].push(o)}query(e,t,r,i,n){const o=this.min,a=this.max;if(e<=o&&t<=o&&a<=r&&a<=i&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(e,t,r,i,this._queryCell,o,{},n),o}}_queryCell(e,t,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]):e<=c[l+2]&&t<=c[l+3]&&r>=c[l+0]&&i>=c[l+1])?(a[h]=!0,o.push(n[h])):a[h]=!1}}}}_forEachCell(e,t,r,i,n,o,a,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),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,e,t,r,i,c,o,a,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=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(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let n=t;for(let o=0;o<e.length;o++){const t=e[o];i[3+o]=n,i.set(t,n),n+=t.length}return i[3+e.length]=n,i.set(this.keys,n),n+=this.keys.length,i[3+e.length+1]=n,i.set(this.bboxes,n),n+=this.bboxes.length,i.buffer}static serialize(e,t){const r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(e){return new uo(e.buffer)}}const ho={};function po(e,t,r={}){if(ho[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ho[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}po("Object",Object),po("Set",Set),po("TransferableGridIndex",uo),po("Color",Pt),po("Error",Error),po("AJAXError",ue),po("ResolvedImage",Bt),po("StylePropertyFunction",sn),po("StyleExpression",en,{omit:["_evaluator"]}),po("ZoomDependentExpression",on),po("ZoomConstantExpression",nn),po("CompoundExpression",Mi,{omit:["_evaluate"]});for(const Ff in Ci)Ci[Ff]._classRegistryKey||po(`Expression_${Ff}`,Ci[Ff]);function fo(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function mo(e){return e.$name||e.constructor._classRegistryKey}function go(e){return!function(e){if(null===e||"object"!=typeof e)return!1;const t=mo(e);return!(!t||"Object"===t)}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||fo(e)||H(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function yo(e,t){if(go(e))return(fo(e)||H(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){const r=[];for(const i of e)r.push(yo(i,t));return r}if("object"!=typeof e)throw new Error("can't serialize object of type "+typeof e);const r=mo(e);if(!r)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!ho[r])throw new Error(`${r} is not registered.`);const{klass:i}=ho[r],n=i.serialize?i.serialize(e,t):{};if(i.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in e){if(!e.hasOwnProperty(i))continue;if(ho[r].omit.indexOf(i)>=0)continue;const o=e[i];n[i]=ho[r].shallow.indexOf(i)>=0?o:yo(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function _o(e){if(go(e))return e;if(Array.isArray(e))return e.map(_o);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=mo(e)||"Object";if(!ho[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=ho[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);const i=Object.create(r.prototype);for(const n of Object.keys(e)){if("$name"===n)continue;const r=e[n];i[n]=ho[t].shallow.indexOf(n)>=0?r:_o(r)}return i}class vo{constructor(){this.first=!0}update(e,t){const r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}}function bo(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function xo(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function wo(e){return/\s/u.test(String.fromCodePoint(e))}function To(e){for(const t of e)if(xo(t.codePointAt(0)))return!0;return!1}function So(e){for(const t of e)if(!Po(t.codePointAt(0)))return!1;return!0}function Eo(e){const t=e.map(e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}}).filter(e=>e);return new RegExp(t.join("|"),"u")}const Io=Eo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Po(e){return!Io.test(String.fromCodePoint(e))}function ko(e){return!(xo(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}const Ao=Eo(["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 Co(e){return Ao.test(String.fromCodePoint(e))}function Mo(e,t){return!(!t&&Co(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function Do(e){for(const t of e)if(Co(t.codePointAt(0)))return!0;return!1}const Ro=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ro.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,r){return t(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,i=new Promise(e=>{this.loadScriptResolve=e});r(t);const n=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(yield Promise.race([i,n]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)})}};class Oo{constructor(e,t){this.isSupportedScript=Lo,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new vo,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new vo,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}}function Lo(e){return function(e,t){for(const r of e)if(!Mo(r.codePointAt(0),t))return!1;return!0}(e,"loaded"===Ro.getRTLTextPluginStatus())}const Fo="-transition";class zo{constructor(e,t,r){this.property=e,this.value=t,this.expression=function(e,t,r){if(Wi(e))return new sn(e,t);if(tn(e)){const i=an(e,t,r);if("error"===i.result)throw new Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return i.value}{let r=e;return"color"===t.type&&"string"==typeof e?r=Pt.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==t.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?r=zt.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(r=Nt.parse(e)):r=Ot.parse(e):r=Rt.parse(e):r=Dt.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===t?e.specification.default:t,e.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}}class Bo{constructor(e,t){this.property=e,this.value=new zo(e,void 0,t)}transitioned(e,t){return new jo(this.property,this.value,t,B({},e.transition,this.transition),e.now)}untransitioned(){return new jo(this.property,this.value,null,{},0)}}class No{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}getValue(e){return U(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Bo(this._values[e].property,this._globalState)),this._values[e].value=new zo(this._values[e].property,null===t?void 0:U(t),this._globalState)}getTransition(e){return U(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Bo(this._values[e].property,this._globalState)),this._values[e].transition=U(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r);const i=this.getTransition(t);void 0!==i&&(e[`${t}${Fo}`]=i)}return e}transitioned(e,t){const r=new Vo(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){const e=new Vo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class jo{constructor(e,t,r,i,n){this.property=e,this.value=t,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){const i=e.now||0,n=this.value.possiblyEvaluate(e,t,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(e,t,r);{const a=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,r),n,R(a))}}return n}}class Vo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){const i=new qo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Uo{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return void 0!==this._values[e].value}getValue(e){return U(this._values[e].value)}setValue(e,t){this._values[e]=new zo(this._values[e].property,null===t?void 0:U(t),this._globalState)}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){const i=new qo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}}class Go{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}}class qo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class $o{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,r){const i=mr[this.specification.type];return i?i(e,t,r):e}}class Wo{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,r,i){return new Go(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},r,i)}:e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Go(this,{kind:"constant",value:void 0},e.parameters);const i=mr[this.specification.type];if(i){const n=i(e.value.value,t.value.value,r);return new Go(this,{kind:"constant",value:n},e.parameters)}return e}evaluate(e,t,r,i,n,o){return"constant"===e.kind?e.value:e.evaluate(t,r,i,n,o)}}class Zo extends Wo{possiblyEvaluate(e,t,r,i){if(void 0===e.value)return new Go(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},r,i),o="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,t);return new Go(this,{kind:"constant",value:a},t)}if("camera"===e.expression.kind){const r=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Go(this,{kind:"constant",value:r},t)}return new Go(this,e.expression,t)}evaluate(e,t,r,i,n,o){if("source"===e.kind){const a=e.evaluate(t,r,i,n,o);return this._calculate(a,a,a,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}}class Ho{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){if(void 0!==e.value){if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},r,i);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new Oo(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Oo(Math.floor(t.zoom),t)),e.expression.evaluate(new Oo(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}}class Xo{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}}class Ko{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const r=e[t];r.specification.overridable&&this.overridableProperties.push(t);const i=this.defaultPropertyValues[t]=new zo(r,void 0,void 0),n=this.defaultTransitionablePropertyValues[t]=new Bo(r,void 0);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}}po("DataDrivenProperty",Wo),po("DataConstantProperty",$o),po("CrossFadedDataDrivenProperty",Zo),po("CrossFadedProperty",Ho),po("ColorRampProperty",Xo);class Yo extends _e{constructor(e,t,r){if(super(),this.id=e.id,this.type=e.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this._visibilityExpression=function(e,t){return new ro(e,t)}(this.visibility,r),"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=pn(e.filter,r)),t.layout&&(this._unevaluatedLayout=new Uo(t.layout,r)),t.paint)){this._transitionablePaint=new No(t.paint,r);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new qo(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=pn(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(const t in this._unevaluatedLayout._values){const r=this._unevaluatedLayout._values[t];for(const t of r.getGlobalStateRefs())e.add(t)}for(const t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){var e;const t=new globalThis.Map;if(this._transitionablePaint)for(const r in this._transitionablePaint._values){const i=this._transitionablePaint._values[r].value;for(const n of i.getGlobalStateRefs()){const o=null!==(e=t.get(n))&&void 0!==e?e:[];o.push({name:r,value:i.value}),t.set(n,o)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,r={}){if(null==t||!this._validate(lo,`layers.${this.id}.layout.${e}`,e,t,r))return"visibility"===e?(this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(Fo)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if(null!=t&&this._validate(so,`layers.${this.id}.paint.${e}`,e,t,r))return!1;if(e.endsWith(Fo))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const r=this._transitionablePaint._values[e],i="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const a=this._transitionablePaint._values[e].value;return a.isDataDriven()||n||i||this._handleOverridablePaintPropertyUpdate(e,o,a)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),V(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,r,i,n={}){return(!n||!1!==n.validate)&&co(this,e.call(no,{key:t,layerType:this.type,objectKey:r,value:i,styleSpec:ve,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Go&&Ui(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}let Jo;var Qo={get paint(){return Jo=Jo||new Ko({"raster-opacity":new $o(ve.paint_raster["raster-opacity"]),"raster-hue-rotate":new $o(ve.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new $o(ve.paint_raster["raster-brightness-min"]),"raster-brightness-max":new $o(ve.paint_raster["raster-brightness-max"]),"raster-saturation":new $o(ve.paint_raster["raster-saturation"]),"raster-contrast":new $o(ve.paint_raster["raster-contrast"]),"raster-resampling":new $o(ve.paint_raster["raster-resampling"]),"raster-fade-duration":new $o(ve.paint_raster["raster-fade-duration"])})}};class ea extends Yo{constructor(e,t){super(e,Qo,t)}}const ta={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ra{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ia{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function na(e,t=1){let r=0,i=0;return{members:e.map(e=>{const n=ta[e.type].BYTES_PER_ELEMENT,o=r=oa(r,Math.max(t,n)),a=e.components||1;return i=Math.max(i,n),r+=n*a,{name:e.name,type:e.type,components:a,offset:o}}),size:oa(r,Math.max(i,t)),alignment:t}}function oa(e,t){return Math.ceil(e/t)*t}class aa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,e}}aa.prototype.bytesPerElement=4,po("StructArrayLayout2i4",aa);class sa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,e}}sa.prototype.bytesPerElement=6,po("StructArrayLayout3i6",sa);class la extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,e}}la.prototype.bytesPerElement=8,po("StructArrayLayout4i8",la);class ca extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=6*e;return this.int16[s+0]=t,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,e}}ca.prototype.bytesPerElement=12,po("StructArrayLayout2i4i12",ca);class ua extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=4*e,l=8*e;return this.int16[s+0]=t,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,e}}ua.prototype.bytesPerElement=8,po("StructArrayLayout2i4ub8",ua);class ha extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.float32[i+0]=t,this.float32[i+1]=r,e}}ha.prototype.bytesPerElement=8,po("StructArrayLayout2f8",ha);class da extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,n,o,a,s,l,c)}emplace(e,t,r,i,n,o,a,s,l,c,u){const h=10*e;return this.uint16[h+0]=t,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,e}}da.prototype.bytesPerElement=20,po("StructArrayLayout10ui20",da);class pa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,r,i,n,o,a,s)}emplace(e,t,r,i,n,o,a,s,l){const c=8*e;return this.uint16[c+0]=t,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=o,this.uint16[c+5]=a,this.uint16[c+6]=s,this.uint16[c+7]=l,e}}pa.prototype.bytesPerElement=16,po("StructArrayLayout8ui16",pa);class fa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,r,i,n,o,a,s,l,c,u,h)}emplace(e,t,r,i,n,o,a,s,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,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,e}}fa.prototype.bytesPerElement=24,po("StructArrayLayout4i4ui4i24",fa);class ma extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}}ma.prototype.bytesPerElement=12,po("StructArrayLayout3f12",ma);class ga extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}ga.prototype.bytesPerElement=4,po("StructArrayLayout1ul4",ga);class ya extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,r,i,n,o,a,s,l)}emplace(e,t,r,i,n,o,a,s,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,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,e}}ya.prototype.bytesPerElement=20,po("StructArrayLayout6i1ul2ui20",ya);class _a extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=6*e;return this.int16[s+0]=t,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,e}}_a.prototype.bytesPerElement=12,po("StructArrayLayout2i2i2i12",_a);class va extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n)}emplace(e,t,r,i,n,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,this.int16[s+6]=n,this.int16[s+7]=o,e}}va.prototype.bytesPerElement=16,po("StructArrayLayout2f1f2i16",va);class ba extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=16*e,l=4*e,c=8*e;return this.uint8[s+0]=t,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,e}}ba.prototype.bytesPerElement=16,po("StructArrayLayout2ub2f2i16",ba);class xa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,this.uint16[n+2]=i,e}}xa.prototype.bytesPerElement=6,po("StructArrayLayout3ui6",xa);class wa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g){const y=this.length;return this.resize(y+1),this.emplace(y,e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g)}emplace(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y){const _=24*e,v=12*e,b=48*e;return this.int16[_+0]=t,this.int16[_+1]=r,this.uint16[_+2]=i,this.uint16[_+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+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[_+22]=y,e}}wa.prototype.bytesPerElement=48,po("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",wa);class Ta extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,S,E,I,P){const k=this.length;return this.resize(k+1),this.emplace(k,e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,S,E,I,P)}emplace(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,S,E,I,P,k){const A=32*e,C=16*e;return this.int16[A+0]=t,this.int16[A+1]=r,this.int16[A+2]=i,this.int16[A+3]=n,this.int16[A+4]=o,this.int16[A+5]=a,this.int16[A+6]=s,this.int16[A+7]=l,this.uint16[A+8]=c,this.uint16[A+9]=u,this.uint16[A+10]=h,this.uint16[A+11]=d,this.uint16[A+12]=p,this.uint16[A+13]=f,this.uint16[A+14]=m,this.uint16[A+15]=g,this.uint16[A+16]=y,this.uint16[A+17]=_,this.uint16[A+18]=v,this.uint16[A+19]=b,this.uint16[A+20]=x,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[C+12]=S,this.float32[C+13]=E,this.float32[C+14]=I,this.uint16[A+30]=P,this.uint16[A+31]=k,e}}Ta.prototype.bytesPerElement=64,po("StructArrayLayout8i15ui1ul2f2ui64",Ta);class Sa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Sa.prototype.bytesPerElement=4,po("StructArrayLayout1f4",Sa);class Ea extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}}Ea.prototype.bytesPerElement=12,po("StructArrayLayout1ui2f12",Ea);class Ia extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=r,this.uint16[n+3]=i,e}}Ia.prototype.bytesPerElement=8,po("StructArrayLayout1ul2ui8",Ia);class Pa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}}Pa.prototype.bytesPerElement=4,po("StructArrayLayout2ui4",Pa);class ka extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ka.prototype.bytesPerElement=2,po("StructArrayLayout1ui2",ka);class Aa extends ia{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,e}}Aa.prototype.bytesPerElement=16,po("StructArrayLayout4f16",Aa);class Ca extends ra{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 r(this.anchorPointX,this.anchorPointY)}}Ca.prototype.size=20;class Ma extends ya{get(e){return new Ca(this,e)}}po("CollisionBoxArray",Ma);class Da extends ra{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Da.prototype.size=48;class Ra extends wa{get(e){return new Da(this,e)}}po("PlacedSymbolArray",Ra);class Oa extends ra{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Oa.prototype.size=64;class La extends Ta{get(e){return new Oa(this,e)}}po("SymbolInstanceArray",La);class Fa extends Sa{getoffsetX(e){return this.float32[1*e+0]}}po("GlyphOffsetArray",Fa);class za extends sa{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}po("SymbolLineVertexArray",za);class Ba extends ra{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]}}Ba.prototype.size=12;class Na extends Ea{get(e){return new Ba(this,e)}}po("TextAnchorOffsetArray",Na);class ja extends ra{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]}}ja.prototype.size=8;class Va extends Ia{get(e){return new ja(this,e)}}po("FeatureIndexArray",Va);class Ua extends aa{}class Ga extends aa{}class qa extends aa{}class $a extends ca{}class Wa extends ua{}class Za extends ha{}class Ha extends da{}class Xa extends pa{}class Ka extends fa{}class Ya extends ma{}class Ja extends ga{}class Qa extends _a{}class es extends ba{}class ts extends xa{}class rs extends Pa{}const is=na([{name:"a_pos",components:2,type:"Int16"}],4),{members:ns}=is;class os{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,r,i){const n=this.segments[this.segments.length-1];return e>os.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${os.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${os.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>os.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i?this.createNewSegment(t,r,i):n}createNewSegment(e,t,r){const i={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(i.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,t,r){return this.prepareSegment(0,e,t,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,r,i){return new os([{vertexOffset:e,primitiveOffset:t,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}}function as(e,t){return 256*(e=F(Math.floor(e),0,255))+F(Math.floor(t),0,255)}os.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,po("SegmentVector",os);const ss=na([{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"}]),ls=na([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var cs,us,hs,ds={exports:{}},ps={exports:{}},fs={exports:{}},ms=function(){if(hs)return ds.exports;hs=1;var e=(cs||(cs=1,ps.exports=function(e,t){var r,i,n,o,a,s,l,c;for(i=e.length-(r=3&e.length),n=t,a=3432918353,s=461845907,c=0;c<i;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.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&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=e.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}),ps.exports),t=(us||(us=1,fs.exports=function(e,t){for(var r,i=e.length,n=t^i,o=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.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&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),fs.exports);return ds.exports=e,ds.exports.murmur3=e,ds.exports.murmur2=t,ds.exports}(),gs=i(ms);class ys{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,r,i){this.ids.push(_s(e)),this.positions.push(t,r,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=_s(e);let r=0,i=this.ids.length-1;for(;r<i;){const e=r+i>>1;this.ids[e]>=t?i=e:r=e+1}const n=[];for(;this.ids[r]===t;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(e,t){const r=new Float64Array(e.ids),i=new Uint32Array(e.positions);return vs(r,i,0,r.length-1),t&&t.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(e){const t=new ys;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function _s(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:gs(String(e))}function vs(e,t,r,i){for(;r<i;){const n=e[r+i>>1];let o=r-1,a=i+1;for(;;){do{o++}while(e[o]<n);do{a--}while(e[a]>n);if(o>=a)break;bs(e,o,a),bs(t,3*o,3*a),bs(t,3*o+1,3*a+1),bs(t,3*o+2,3*a+2)}a-r<i-a?(vs(e,t,r,a),r=a+1):(vs(e,t,a+1,i),i=a)}}function bs(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}po("FeaturePositionMap",ys);class xs{constructor(e,t){this.gl=e.gl,this.location=t}}class ws extends xs{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ts extends xs{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ss extends xs{constructor(e,t){super(e,t),this.current=Pt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Es=new Float32Array(16);function Is(e){return[as(255*e.r,255*e.g),as(255*e.b,255*e.a)]}class Ps{constructor(e,t,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return"color"===this.type?new Ss(e,t):new ws(e,t)}}class ks{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,r,i){let n=null;"u_pattern_to"===i?n=this.patternTo:"u_pattern_from"===i?n=this.patternFrom:"u_dasharray_to"===i?n=this.dashTo:"u_dasharray_from"===i?n=this.dashFrom:"u_pixel_ratio_to"===i?n=this.pixelRatioTo:"u_pixel_ratio_from"===i&&(n=this.pixelRatioFrom),null!==n&&e.set(n)}getBinding(e,t,r){return"u_pattern"===r.substr(0,9)||"u_dasharray_"===r.substr(0,12)?new Ts(e,t):new ws(e,t)}}class As{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,r){const i=this.paintVertexArray.length,n=this.expression.evaluate(new Oo(0,r),t,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(i,e,n)}updatePaintArray(e,t,r,i,n){const o=this.expression.evaluate(new Oo(0,n),r,i);this._setPaintValue(e,t,o)}_setPaintValue(e,t,r){if("color"===this.type){const i=Is(r);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Cs{constructor(e,t,r,i,n,o){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,r){const i=this.expression.evaluate(new Oo(this.zoom,r),t,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new Oo(this.zoom+1,r),t,{},r.canonical,[],r.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,i,n)}updatePaintArray(e,t,r,i,n){const o=this.expression.evaluate(new Oo(this.zoom,n),r,i),a=this.expression.evaluate(new Oo(this.zoom+1,n),r,i);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,r,i){if("color"===this.type){const n=Is(r),o=Is(i);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n[0],n[1],o[0],o[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=F(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new ws(e,t)}}class Ms{constructor(e,t,r,i,n,o){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,r){const i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,this.getPositionIds(t),r)}updatePaintArray(e,t,r,i,n){this._setPaintValues(e,t,this.getPositionIds(r),n)}_setPaintValues(e,t,r,i){const n=this.getPositions(i);if(!n||!r)return;const o=n[r.min],a=n[r.mid],s=n[r.max];if(o&&a&&s)for(let l=e;l<t;l++)this.emplace(this.zoomInPaintVertexArray,l,a,o),this.emplace(this.zoomOutPaintVertexArray,l,a,s)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ds extends Ms{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return ss.members}emplace(e,t,r,i){e.emplace(t,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}}class Rs extends Ms{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return ls.members}emplace(e,t,r,i){e.emplace(t,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}}class Os{constructor(e,t,r){this.binders={},this._buffers=[];const i=[];for(const n in e.paint._values){if(!r(n))continue;const o=e.paint.get(n);if(!(o instanceof Go&&Ui(o.property.specification)))continue;const a=Fs(n,e.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 ks(s.value,a):new Ps(s.value,a,l),i.push(`/u_${n}`);else if("source"===s.kind||h){const r=zs(n,l,"source");this.binders[n]=h?"line-dasharray"===n?new Rs(s,l,c,t,r,e.id):new Ds(s,l,c,t,r,e.id):new As(s,a,l,r),i.push(`/a_${n}`)}else{const e=zs(n,l,"composite");this.binders[n]=new Cs(s,a,l,c,t,e),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof As||t instanceof Cs?t.maxValue:0}populatePaintArrays(e,t,r){for(const i in this.binders){const n=this.binders[i];(n instanceof As||n instanceof Cs||n instanceof Ms)&&n.populatePaintArray(e,t,r)}}setConstantPatternPositions(e,t){for(const r in this.binders){const i=this.binders[r];i instanceof ks&&i.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(const r in this.binders){const i=this.binders[r];i instanceof ks&&i.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,r,i,n){let o=!1;for(const a in e){const s=t.getPositions(a);for(const t of s){const s=r.feature(t.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof As||l instanceof Cs||l instanceof Ms)&&!0===l.expression.isStateDependent){const c=i.paint.get(r);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[a],n),o=!0}}}}return o}defines(){const e=[];for(const t in this.binders){const r=this.binders[t];(r instanceof Ps||r instanceof ks)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const r=this.binders[t];if(r instanceof As||r instanceof Cs)for(let t=0;t<r.paintVertexAttributes.length;t++)e.push(r.paintVertexAttributes[t].name);else if(r instanceof Ms){const t=r.getVertexAttributes();for(const r of t)e.push(r.name)}}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const r=this.binders[t];if(r instanceof Ps||r instanceof ks||r instanceof Cs)for(const t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const r=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Ps||n instanceof ks||n instanceof Cs)for(const o of n.uniformNames)if(t[o]){const a=n.getBinding(e,t[o],o);r.push({name:o,property:i,binding:a})}}return r}setUniforms(e,t,r,i){for(const{name:n,property:o,binding:a}of t)this.binders[o].setUniform(a,i,r.get(o),n)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const r=this.binders[t];if(e&&r instanceof Ms){const t=2===e.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(r instanceof As||r instanceof Cs)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(const t in this.binders){const r=this.binders[t];(r instanceof As||r instanceof Cs||r instanceof Ms)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof As||t instanceof Cs||t instanceof Ms)&&t.destroy()}}}class Ls{constructor(e,t,r=()=>!0){this.programConfigurations={};for(const i of e)this.programConfigurations[i.id]=new Os(i,t,r);this.needsUpload=!1,this._featureMap=new ys,this._bufferOffset=0}populatePaintArrays(e,t,r,i){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,i);void 0!==t.id&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(const n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Fs(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function zs(e,t,r){const i={color:{source:ha,composite:Aa},number:{source:Sa,composite:ha}},n=function(e){return{"line-pattern":{source:Ha,composite:Ha},"fill-pattern":{source:Ha,composite:Ha},"fill-extrusion-pattern":{source:Ha,composite:Ha},"line-dasharray":{source:Xa,composite:Xa}}[e]}(e);return n&&n[r]||i[t][r]}po("ConstantBinder",Ps),po("CrossFadedConstantBinder",ks),po("SourceExpressionBinder",As),po("CrossFadedPatternBinder",Ds),po("CrossFadedDasharrayBinder",Rs),po("CompositeExpressionBinder",Cs),po("ProgramConfiguration",Os,{omit:["_buffers"]}),po("ProgramConfigurationSet",Ls);const Bs=Math.pow(2,14)-1,Ns=-Bs-1;function js(e){const t=A/e.extent,r=e.loadGeometry();for(let i=0;i<r.length;i++){const e=r[i];for(let r=0;r<e.length;r++){const i=e[r],n=Math.round(i.x*t),o=Math.round(i.y*t);i.x=F(n,Ns,Bs),i.y=F(o,Ns,Bs),(n<i.x||n>i.x+1||o<i.y||o>i.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Vs(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?js(e):[]}}const Us=-32768;function Gs(e,t,r,i,n){e.emplaceBack(Us+8*t+i,Us+8*r+n)}class qs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ga,this.indexArray=new ts,this.segments=new os,this.programConfigurations=new Ls(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){const i=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===i.type;if("circle"===i.type){const e=i;o=e.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===e.paint.get("circle-pitch-alignment")}const l=s?t.subdivisionGranularity.circle:1;for(const{feature:c,id:u,index:h,sourceLayerIndex:d}of e){const e=this.layers[0]._featureFilter.needGeometry,t=Vs(c,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),t,r))continue;const i=a?o.evaluate(t,{},r):void 0,s={id:u,properties:c.properties,type:c.type,sourceLayerIndex:d,index:h,geometry:e?t.geometry:js(c),patterns:{},sortKey:i};n.push(s)}a&&n.sort((e,t)=>e.sortKey-t.sortKey);for(const c of n){const{geometry:i,index:n,sourceLayerIndex:o}=c,a=e[n].feature;this.addFeature(c,i,n,r,l),t.featureIndex.insert(a,i,n,o,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ns),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,i,n=1){let 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 t)for(const t of s){const r=t.x,i=t.y;if(r<0||r>=A||i<0||i>=A)continue;const n=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,e.sortKey),s=n.vertexLength;for(let e=0;e<a;e++)for(let t=0;t<a;t++)Gs(this.layoutVertexArray,r,i,o[t],o[e]);for(let e=0;e<a-1;e++)for(let t=0;t<a-1;t++){const r=s+e*a+t,i=s+(e+1)*a+t;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,e,r,{imagePositions:{},canonical:i})}}function $s(e,t){for(let r=0;r<e.length;r++)if(el(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(el(e,t[r]))return!0;return!!Xs(e,t)}function Ws(e,t,r){return!!el(e,t)||!!Ys(t,e,r)}function Zs(e,t){if(1===e.length)return Qs(t,e[0]);for(let r=0;r<t.length;r++){const i=t[r];for(let t=0;t<i.length;t++)if(el(e,i[t]))return!0}for(let r=0;r<e.length;r++)if(Qs(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(Xs(e,t[r]))return!0;return!1}function Hs(e,t,r){if(e.length>1){if(Xs(e,t))return!0;for(let i=0;i<t.length;i++)if(Ys(t[i],e,r))return!0}for(let i=0;i<e.length;i++)if(Ys(e[i],t,r))return!0;return!1}function Xs(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)if(Ks(i,n,t[e],t[e+1]))return!0}return!1}function Ks(e,t,r,i){return $(e,r,i)!==$(t,r,i)&&$(e,t,r)!==$(e,t,i)}function Ys(e,t,r){const i=r*r;if(1===t.length)return e.distSqr(t[0])<i;for(let n=1;n<t.length;n++)if(Js(e,t[n-1],t[n])<i)return!0;return!1}function Js(e,t,r){const i=t.distSqr(r);if(0===i)return e.distSqr(t);const n=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return e.distSqr(n<0?t:n>1?r:r.sub(t)._mult(n)._add(t))}function Qs(e,t){let r,i,n,o=!1;for(let a=0;a<e.length;a++){r=e[a];for(let e=0,a=r.length-1;e<r.length;a=e++)i=r[e],n=r[a],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(o=!o)}return o}function el(e,t){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){const o=e[i],a=e[n];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function tl(e,t,r){const i=r[0],n=r[2];if(e.x<i.x&&t.x<i.x||e.x>n.x&&t.x>n.x||e.y<i.y&&t.y<i.y||e.y>n.y&&t.y>n.y)return!1;const o=$(e,t,r[0]);return o!==$(e,t,r[1])||o!==$(e,t,r[2])||o!==$(e,t,r[3])}function rl(e,t,r){const i=t.paint.get(e).value;return"constant"===i.kind?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function il(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function nl(e,t,i,n,o){if(!t[0]&&!t[1])return e;const a=r.convert(t)._mult(o);"viewport"===i&&a._rotate(-n);const s=[];for(let r=0;r<e.length;r++)s.push(e[r].sub(a));return s}function ol(e){const t=[];for(let r=0;r<e.length;r++){const i=e[r],n=t.at(-1);(0===r||n&&!i.equals(n))&&t.push(i)}return t}function al({queryGeometry:e,size:t},r){return Ws(e,r,t)}function sl({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},o){return Ws(e,o,t*(r.projectTileCoordinates(o.x,o.y,i,n).signedDistanceFromCamera/r.cameraToCenterDistance))}function ll({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},o){const a=r.projectTileCoordinates(o.x,o.y,i,n).signedDistanceFromCamera,s=t*(r.cameraToCenterDistance/a);return Ws(e,hl(o,r,i,n),s)}function cl({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},o){return Ws(e,hl(o,r,i,n),t)}function ul({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:o="map",pitchScale:a="map"},s){const l="map"===o?"map"===a?al:sl:"map"===a?ll:cl,c={queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n};for(const u of s)for(const e of u)if(l(c,e))return!0;return!1}function hl(e,t,i,n){const o=t.projectTileCoordinates(e.x,e.y,i,n).point;return new r((.5*o.x+.5)*t.width,(.5*-o.y+.5)*t.height)}let dl,pl;po("CircleBucket",qs,{omit:["layers"]});var fl={get paint(){return pl=pl||new Ko({"circle-radius":new Wo(ve.paint_circle["circle-radius"]),"circle-color":new Wo(ve.paint_circle["circle-color"]),"circle-blur":new Wo(ve.paint_circle["circle-blur"]),"circle-opacity":new Wo(ve.paint_circle["circle-opacity"]),"circle-translate":new $o(ve.paint_circle["circle-translate"]),"circle-translate-anchor":new $o(ve.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new $o(ve.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new $o(ve.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wo(ve.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wo(ve.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wo(ve.paint_circle["circle-stroke-opacity"])})},get layout(){return dl=dl||new Ko({"circle-sort-key":new Wo(ve.layout_circle["circle-sort-key"])})}};class ml extends Yo{constructor(e,t){super(e,fl,t)}createBucket(e){return new qs(e)}queryRadius(e){const t=e;return rl("circle-radius",this,t)+rl("circle-stroke-width",this,t)+il(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=nl(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let d,p;return"map"===h?(d=l,p=c*o):(d=function(e,t,r,i){return e.map(e=>hl(e,t,r,i))}(l,n,a,s),p=c),ul({queryGeometry:d,size:p,transform:n,unwrappedTileID:a,getElevation:s,pitchAlignment:h,pitchScale:u},i)}}class gl extends qs{}let yl;po("HeatmapBucket",gl,{omit:["layers"]});var _l={get paint(){return yl=yl||new Ko({"heatmap-radius":new Wo(ve.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wo(ve.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new $o(ve.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Xo(ve.paint_heatmap["heatmap-color"]),"heatmap-opacity":new $o(ve.paint_heatmap["heatmap-opacity"])})}};function vl(e,{width:t,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*r*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*r*i}`)}else n=new Uint8Array(t*r*i);return e.width=t,e.height=r,e.data=n,e}function bl(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;const n=vl({},{width:t,height:r},i);xl(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=n.data}function xl(e,t,r,i,n,o){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,s=t.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)*e.width+r.x)*o,u=((i.y+l)*t.width+i.x)*o;for(let e=0;e<n.width*o;e++)s[u+e]=a[c+e]}return t}class wl{constructor(e,t){vl(this,e,1,t)}resize(e){bl(this,e,1)}clone(){return new wl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){xl(e,t,r,i,n,1)}}class Tl{constructor(e,t){vl(this,e,4,t)}resize(e){bl(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Tl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){xl(e,t,r,i,n,4)}setPixel(e,t,r){const i=4*(e*this.width+t);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 Sl(e){const t={},r=e.resolution||256,i=e.clips?e.clips.length:1,n=e.image||new Tl({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)=>{t[e.evaluationKey]=a;const s=e.expression.evaluate(t);n.setPixel(i/4/r,o/4,s)};if(e.clips)for(let a=0,s=0;a<i;++a,s+=4*r)for(let t=0,i=0;t<r;t++,i+=4){const n=t/(r-1),{start:l,end:c}=e.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}po("AlphaImage",wl),po("RGBAImage",Tl);const El="big-fb";class Il extends Yo{createBucket(e){return new gl(e)}constructor(e,t){super(e,_l,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Sl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(El)&&this.heatmapFbos.delete(El)}queryRadius(e){return rl("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){return ul({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,r)*o,transform:n,unwrappedTileID:a,getElevation:s},i)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}let Pl;var kl={get paint(){return Pl=Pl||new Ko({"hillshade-illumination-direction":new $o(ve.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new $o(ve.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new $o(ve.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new $o(ve.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new $o(ve.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new $o(ve.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new $o(ve.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new $o(ve.paint_hillshade["hillshade-method"])})}};class Al extends Yo{constructor(e,t){super(e,kl,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values;const n=Math.max(e.length,t.length,r.length,i.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));const o=t.map(ee);return{directionRadians:e.map(ee),altitudeRadians:o,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let Cl;var Ml={get paint(){return Cl=Cl||new Ko({"color-relief-opacity":new $o(ve["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Xo(ve["paint_color-relief"]["color-relief-color"])})}};class Dl{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this.update(t,i)}update(e,t,r){const{width:i,height:n}=e,o=!(this.size&&this.size[0]===i&&this.size[1]===n||r),{context:a}=this,{gl:s}=a;if(this.useMipmap=Boolean(t&&t.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||!1!==t.premultiply)),o)this.size=[i,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||H(e)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,i,n,0,this.format,s.UNSIGNED_BYTE,e.data);else{const{x:t,y:o}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||H(e)?s.texSubImage2D(s.TEXTURE_2D,0,t,o,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,t,o,i,n,s.RGBA,s.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,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),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Rl{constructor(e,t,r,i=1,n=1,o=1,a=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void q(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;const s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.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 e=0;e<s;e++){const t=this.get(l,e);t>this.max&&(this.max=t),t<this.min&&(this.min=t)}}get(e,t){const r=new Uint8Array(this.data.buffer),i=4*this._idx(e,t);return this.unpack(r[i],r[i+1],r[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+1)*this.stride+(e+1)}unpack(e,t,r){return e*this.redFactor+t*this.greenFactor+r*this.blueFactor-this.baseShift}pack(e){return Ol(e,this.getUnpackVector())}getPixels(){return new Tl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,n=t*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(t){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=-t*this.dim,l=-r*this.dim;for(let c=o;c<a;c++)for(let t=i;t<n;t++)this.data[this._idx(t,c)]=e.data[this._idx(t+s,c+l)]}}function Ol(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=Math.min(r,i,n),s=Math.round((e+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/i)%256,b:Math.floor(s*a/n)%256}}po("DEMData",Rl);class Ll extends Yo{constructor(e,t){super(e,Ml,t)}_createColorRamp(e){const t={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof nn&&r._styleExpression.expression instanceof pr){this.colorRampExpression=r;const e=r._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(const r of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:r}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Pt.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;const i={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let o=0;o<t.elevationStops.length-.5;o+=n)i.elevationStops.push(t.elevationStops[Math.round(o)]),i.colorStops.push(t.colorStops[Math.round(o)]);return q(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const i=this._createColorRamp(t),n=new Tl({width:i.colorStops.length,height:1}),o=new Tl({width:i.colorStops.length,height:1});for(let a=0;a<i.elevationStops.length;a++){const e=Ol(i.elevationStops[a],r);o.setPixel(0,a,new Pt(e.r/255,e.g/255,e.b/255,1)),n.setPixel(0,a,i.colorStops[a])}return this.colorRampTextures={elevationTexture:new Dl(e,o,e.gl.RGBA),colorTexture:new Dl(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Fl=na([{name:"a_pos",components:2,type:"Int16"}],4),{members:zl}=Fl;function Bl(e,t,r){const i=r.patternDependencies;let n=!1;for(const o of t){const t=o.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);const r=t.constantOr(null);r&&(n=!0,i[r.to]=!0,i[r.from]=!0)}return n}function Nl(e,t,r,i,n){const{zoom:o}=i,a=n.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:o-1},r,{},n.availableImages),i=t.evaluate({zoom:o},r,{},n.availableImages),l=t.evaluate({zoom:o+1},r,{},n.availableImages);e=e&&e.name?e.name:e,i=i&&i.name?i.name:i,l=l&&l.name?l.name:l,a[e]=!0,a[i]=!0,a[l]=!0,r.patterns[s.id]={min:e,mid:i,max:l}}}return r}function jl(e,t,r,i,n){let o;if(n===function(e,t,r,i){let n=0;for(let o=t,a=r-i;o<r;o+=i)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,r,i)>0)for(let a=t;a<r;a+=i)o=lc(a/i|0,e[a],e[a+1],o);else for(let a=r-i;a>=t;a-=i)o=lc(a/i|0,e[a],e[a+1],o);return o&&rc(o,o.next)&&(cc(o),o=o.next),o}function Vl(e,t){if(!e)return e;t||(t=e);let r,i=e;do{if(r=!1,i.steiner||!rc(i,i.next)&&0!==tc(i.prev,i,i.next))i=i.next;else{if(cc(i),i=t=i.prev,i===i.next)break;r=!0}}while(r||i!==t);return t}function Ul(e,t,r,i,n,o,a){if(!e)return;!a&&o&&function(e,t,r,i){let n=e;do{0===n.z&&(n.z=Kl(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,r=1;do{let i,n=e;e=null;let o=null;for(t=0;n;){t++;let a=n,s=0;for(let e=0;e<r&&(s++,a=a.nextZ,a);e++);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:e=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(t>1)}(n)}(e,i,n,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?ql(e,i,n,o):Gl(e))t.push(l.i,e.i,c.i),cc(e),e=c.next,s=c.next;else if((e=c)===s){a?1===a?Ul(e=$l(Vl(e),t),t,r,i,n,o,2):2===a&&Wl(e,t,r,i,n,o):Ul(Vl(e),t,r,i,n,o,1);break}}}function Gl(e){const t=e.prev,r=e,i=e.next;if(tc(t,r,i)>=0)return!1;const n=t.x,o=r.x,a=i.x,s=t.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!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Ql(n,s,o,l,a,c,f.x,f.y)&&tc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ql(e,t,r,i){const n=e.prev,o=e,a=e.next;if(tc(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),y=Kl(p,f,t,r,i),_=Kl(m,g,t,r,i);let v=e.prevZ,b=e.nextZ;for(;v&&v.z>=y&&b&&b.z<=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&Ql(s,u,l,h,c,d,v.x,v.y)&&tc(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&&Ql(s,u,l,h,c,d,b.x,b.y)&&tc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&Ql(s,u,l,h,c,d,v.x,v.y)&&tc(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=_;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&Ql(s,u,l,h,c,d,b.x,b.y)&&tc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function $l(e,t){let r=e;do{const i=r.prev,n=r.next.next;!rc(i,n)&&ic(i,r,r.next,n)&&ac(i,n)&&ac(n,i)&&(t.push(i.i,r.i,n.i),cc(r),cc(r.next),r=e=n),r=r.next}while(r!==e);return Vl(r)}function Wl(e,t,r,i,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&ec(a,e)){let s=sc(a,e);return a=Vl(a,a.next),s=Vl(s,s.next),Ul(a,t,r,i,n,o,0),void Ul(s,t,r,i,n,o,0)}e=e.next}a=a.next}while(a!==e)}function Zl(e,t){let r=e.x-t.x;return 0===r&&(r=e.y-t.y,0===r)&&(r=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Hl(e,t){const r=function(e,t){let r=t;const i=e.x,n=e.y;let o,a=-1/0;if(rc(e,r))return r;do{if(rc(e,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){const e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=i&&e>a&&(a=e,o=r.x<r.next.x?r:r.next,e===i))return o}r=r.next}while(r!==t);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&&Jl(n<c?i:a,n,l,c,n<c?a:i,n,r.x,r.y)){const t=Math.abs(n-r.y)/(i-r.x);ac(r,e)&&(t<u||t===u&&(r.x>o.x||r.x===o.x&&Xl(o,r)))&&(o=r,u=t)}r=r.next}while(r!==s);return o}(e,t);if(!r)return t;const i=sc(r,e);return Vl(i,i.next),Vl(r,r.next)}function Xl(e,t){return tc(e.prev,e,t.prev)<0&&tc(t.next,e,e.next)<0}function Kl(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Yl(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Jl(e,t,r,i,n,o,a,s){return(n-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(i-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(n-a)*(i-s)}function Ql(e,t,r,i,n,o,a,s){return!(e===a&&t===s)&&Jl(e,t,r,i,n,o,a,s)}function ec(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&ic(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(ac(e,t)&&ac(t,e)&&function(e,t){let r=e,i=!1;const n=(e.x+t.x)/2,o=(e.y+t.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!==e);return i}(e,t)&&(tc(e.prev,e,t.prev)||tc(e,t.prev,t))||rc(e,t)&&tc(e.prev,e,e.next)>0&&tc(t.prev,t,t.next)>0)}function tc(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function rc(e,t){return e.x===t.x&&e.y===t.y}function ic(e,t,r,i){const n=oc(tc(e,t,r)),o=oc(tc(e,t,i)),a=oc(tc(r,i,e)),s=oc(tc(r,i,t));return n!==o&&a!==s||!(0!==n||!nc(e,r,t))||!(0!==o||!nc(e,i,t))||!(0!==a||!nc(r,e,i))||!(0!==s||!nc(r,t,i))}function nc(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function oc(e){return e>0?1:e<0?-1:0}function ac(e,t){return tc(e.prev,e,e.next)<0?tc(e,t,e.next)>=0&&tc(e,e.prev,t)>=0:tc(e,t,e.prev)<0||tc(e,e.next,t)<0}function sc(e,t){const r=uc(e.i,e.x,e.y),i=uc(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function lc(e,t,r,i){const n=uc(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function cc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function uc(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class hc{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class dc{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}dc.noSubdivision=new dc({fill:new hc(0,0),line:new hc(0,0),tile:new hc(0,0),stencil:new hc(0,0),circle:1}),po("SubdivisionGranularityExpression",hc),po("SubdivisionGranularitySetting",dc);const pc=-32768,fc=32767;class mc{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=A/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=0|Math.round(e),i=0|Math.round(t),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(e){if(this._granularity<2)return function(e,t){const r=[];for(let i=0;i<t.length;i+=3){const n=t[i],o=t[i+1],a=t[i+2],s=e[2*n],l=e[2*n+1];(e[2*o]-s)*(e[2*a+1]-l)-(e[2*o+1]-l)*(e[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,e);const t=[],r=e.length;for(let i=0;i<r;i+=3){const r=[e[i+0],e[i+1],e[i+2]],n=[this._vertexBuffer[2*e[i+0]+0],this._vertexBuffer[2*e[i+0]+1],this._vertexBuffer[2*e[i+1]+0],this._vertexBuffer[2*e[i+1]+1],this._vertexBuffer[2*e[i+2]+0],this._vertexBuffer[2*e[i+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let e=0;e<3;e++){const t=n[2*e],r=n[2*e+1];o=Math.min(o,t),s=Math.max(s,t),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 e=h;e<d;e++){const i=this._scanlineGenerateVertexRingForCellRow(e,n,r);_c(this._vertexBuffer,i,t)}else t.push(...r)}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){const i=e*this._granularityCellSize,n=i+this._granularityCellSize,o=[];for(let a=0;a<3;a++){const e=t[2*a],s=t[2*a+1],l=t[2*(a+1)%6],c=t[(2*(a+1)+1)%6],u=t[2*(a+2)%6],h=t[(2*(a+2)+1)%6],d=l-e,p=c-s,f=0===d,m=0===p,g=(i-s)/p,y=(n-s)/p,_=Math.min(g,y),v=Math.max(g,y);if(!m&&(_>=1||v<=0)||m&&(s<i||s>n)){c>=i&&c<=n&&o.push(r[(a+1)%3]);continue}!m&&_>0&&o.push(this._vertexToIndex(e+d*_,s+p*_));const b=e+d*Math.max(_,0),x=e+d*Math.min(v,1);f||this._generateIntraEdgeVertices(o,e,s,l,c,b,x),!m&&v<1&&o.push(this._vertexToIndex(e+d*v,s+p*v)),(m||c>=i&&c<=n)&&o.push(r[(a+1)%3]),!m&&(c<=i||c>=n)&&this._generateInterEdgeVertices(o,e,s,l,c,u,h,x,i,n)}return o}_generateIntraEdgeVertices(e,t,r,i,n,o,a){const s=i-t,l=n-r,c=0===l,u=c?Math.min(t,i):Math.min(o,a),h=c?Math.max(t,i):Math.max(o,a),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?t<i:o<a)for(let f=d;f<=p;f++){const i=f*this._granularityCellSize;e.push(this._vertexToIndex(i,r+l*(i-t)/s))}else for(let f=p;f>=d;f--){const i=f*this._granularityCellSize;e.push(this._vertexToIndex(i,r+l*(i-t)/s))}}_generateInterEdgeVertices(e,t,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),y=i+h*m;let _=Math.floor(Math.min(y,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,s)/this._granularityCellSize)-1,b=s<y;const x=0===d;if(x&&(a===l||a===c))return;if(x||m>=1||g<=0){const e=r-a,i=o+(t-o)*Math.min((l-a)/e,(c-a)/e);_=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 T=_;T<=v;T++)e.push(this._vertexToIndex(T*this._granularityCellSize,w));else for(let T=v;T>=_;T--)e.push(this._vertexToIndex(T*this._granularityCellSize,w))}_generateOutline(e){const t=[];for(const r of e){const e=yc(r,this._granularity,!0),i=this._pointArrayToIndices(e),n=[];for(let t=1;t<i.length;t++)n.push(i[t-1]),n.push(i[t]);t.push(n)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const r=e[t+1];r===pc&&(e[t+1]=-32767),r===fc&&(e[t+1]=32766)}}_generatePoleQuad(e,t,r,i,n,o){i>n!=(o===pc)?(e.push(t),e.push(r),e.push(this._vertexToIndex(i,o)),e.push(r),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(i,o))):(e.push(r),e.push(t),e.push(this._vertexToIndex(i,o)),e.push(this._vertexToIndex(n,o)),e.push(r),e.push(this._vertexToIndex(i,o)))}_fillPoles(e,t,r){const i=this._vertexBuffer,n=A,o=e.length;for(let a=2;a<o;a+=3){const o=e[a-2],s=e[a-1],l=e[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];t&&(0===u&&0===d&&this._generatePoleQuad(e,o,s,c,h,pc),0===d&&0===f&&this._generatePoleQuad(e,s,l,h,p,pc),0===f&&0===u&&this._generatePoleQuad(e,l,o,p,c,pc)),r&&(u===n&&d===n&&this._generatePoleQuad(e,o,s,c,h,fc),d===n&&f===n&&this._generatePoleQuad(e,s,l,h,p,fc),f===n&&u===n&&this._generatePoleQuad(e,l,o,p,c,fc))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:i}=function(e){const t=[],r=[];for(const i of e)if(0!==i.length){i!==e[0]&&t.push(r.length/2);for(let e=0;e<i.length;e++)r.push(i[e].x),r.push(i[e].y)}return{flattened:r,holeIndices:t}}(e);let n;this._initializeVertices(r);try{const e=function(e,t,r=2){const i=t&&t.length,n=i?t[0]*r:e.length;let o=jl(e,0,n,r,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(i&&(o=function(e,t,r,i){const n=[];for(let o=0,a=t.length;o<a;o++){const r=jl(e,t[o]*i,o<a-1?t[o+1]*i:e.length,i,!1);r===r.next&&(r.steiner=!0),n.push(Yl(r))}n.sort(Zl);for(let o=0;o<n.length;o++)r=Hl(n[o],r);return r}(e,t,o,r)),e.length>80*r){s=e[0],l=e[1];let t=s,i=l;for(let o=r;o<n;o+=r){const r=e[o],n=e[o+1];r<s&&(s=r),n<l&&(l=n),r>t&&(t=r),n>i&&(i=n)}c=Math.max(t-s,i-l),c=0!==c?32767/c:0}return Ul(o,a,r,s,l,c,0),a}(r,i),t=this._convertIndices(r,e);n=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(e,t){const r=[];for(let i=0;i<t.length;i++)r.push(this._vertexToIndex(e[2*t[i]],e[2*t[i]+1]));return r}_pointArrayToIndices(e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];t.push(this._vertexToIndex(i.x,i.y))}return t}}function gc(e,t,r,i=!0){return new mc(r,t).subdividePolygonInternal(e,i)}function yc(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];const n=e[0],o=e[e.length-1],a=i&&(n.x!==o.x||n.y!==o.y);if(t<2)return a?[...e,e[0]]:[...e];const s=Math.floor(A/t),l=[];l.push(new r(e[0].x,e[0].y));const c=e.length,u=a?c:c-1;for(let h=0;h<u;h++){const t=e[h],i=h<c-1?e[h+1]:e[0],n=t.x,o=t.y,a=i.x,u=i.y,d=n!==a,p=o!==u;if(!d&&!p)continue;const f=a-n,m=u-o,g=Math.abs(f),y=Math.abs(m);let _=n,v=o;for(;;){const e=f>0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,t=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,i=Math.abs(_-e),n=Math.abs(v-t),o=Math.abs(_-a),c=Math.abs(v-u),h=d?i/g:Number.POSITIVE_INFINITY,b=p?n/y:Number.POSITIVE_INFINITY;if((o<=i||!d)&&(c<=n||!p))break;if(h<b&&d||!p){_=e,v+=m*h;const t=new r(_,Math.round(v));l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}else{_+=f*b,v=t;const e=new r(Math.round(_),v);l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}}const b=new r(a,u);l[l.length-1].x===b.x&&l[l.length-1].y===b.y||l.push(b)}return l}function _c(e,t,r){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let i=0,n=e[2*t[0]];for(let l=1;l<t.length;l++){const r=e[2*t[l]];r<n&&(n=r,i=l)}const o=t.length;let a=i,s=(a+1)%o;for(;;){const i=a-1>=0?a-1:o-1,n=(s+1)%o,l=e[2*t[i]],c=e[2*t[n]],u=e[2*t[a]],h=e[2*t[a]+1],d=e[2*t[s]+1];let p=!1;if(l<c)p=!0;else if(l>c)p=!1;else{const r=d-h,o=-(e[2*t[s]]-u),a=h<d?1:-1;((l-u)*r+(e[2*t[i]+1]-h)*o)*a>((c-u)*r+(e[2*t[n]+1]-h)*o)*a&&(p=!0)}if(p){const e=t[i],n=t[a],l=t[s];e!==n&&e!==l&&n!==l&&r.push(l,n,e),a--,a<0&&(a=o-1)}else{const e=t[n],i=t[a],l=t[s];e!==i&&e!==l&&i!==l&&r.push(l,i,e),s++,s>=o&&(s=0)}if(i===n)break}}function vc(e,t,r,i,n,o,a,s,l){const c=n.length/2,u=a&&s&&l;if(c<os.MAX_VERTEX_ARRAY_LENGTH){const h=t.prepareSegment(c,r,i),d=h.vertexLength;for(let e=0;e<o.length;e+=3)i.emplaceBack(d+o[e],d+o[e+1],d+o[e+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 t=0;t<n.length;t+=2)e(n[t],n[t+1]);if(u)for(let e=0;e<l.length;e++){const t=l[e];for(let e=1;e<t.length;e+=2)s.emplaceBack(p+t[e-1],p+t[e]);f.primitiveLength+=t.length/2}}else!function(e,t,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=e.getOrCreateLatestSegment(t,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,y=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(y?1:0))>os.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,r),l=s.count,m=!0,g=!0,y=!0,u=0);const _=bc(a,i,o,s,d,m,c),v=bc(a,i,o,s,p,g,c),b=bc(a,i,o,s,f,y,c);r.emplaceBack(u+_-l,u+v-l,u+b-l),c.primitiveLength++}}(t,r,i,n,o,e),u&&function(e,t,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=e.getOrCreateLatestSegment(t,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))>os.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,r),l=s.count,f=!0,m=!0,u=0);const g=bc(a,i,o,s,n,f,c),y=bc(a,i,o,s,h,m,c);r.emplaceBack(u+g-l,u+y-l),c.primitiveLength++}}}(a,r,s,n,l,e),t.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function bc(e,t,r,i,n,o,a){if(o){const o=i.count;return r(t[2*n],t[2*n+1]),e[n]=i.count,i.count++,a.vertexLength++,o}return e[n]}class xc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new qa,this.indexArray=new ts,this.indexArray2=new rs,this.programConfigurations=new Ls(e.layers,e.zoom),this.segments=new os,this.segments2=new os,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=Bl("fill",this.layers,t);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 e){const e=this.layers[0]._featureFilter.needGeometry,u=Vs(a,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),u,r))continue;const h=n?i.evaluate(u,{},r,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:js(a),patterns:{},sortKey:h};o.push(d)}n&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const a of o){const{geometry:i,index:n,sourceLayerIndex:o}=a;if(this.hasDependencies){const e=Nl("fill",this.layers,a,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(a,i,n,r,{},t.subdivisionGranularity);t.featureIndex.insert(e[n].feature,i,n,o,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures(e,t,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zl),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,r,i,n,o){for(const a of ei(t,500)){const e=gc(a,i,o.fill.getGranularityForZoomLevel(i.z)),t=this.layoutVertexArray;vc((e,r)=>{t.emplaceBack(e,r)},this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}}let wc,Tc;po("FillBucket",xc,{omit:["layers","patternFeatures"]});var Sc={get paint(){return Tc=Tc||new Ko({"fill-antialias":new $o(ve.paint_fill["fill-antialias"]),"fill-opacity":new Wo(ve.paint_fill["fill-opacity"]),"fill-color":new Wo(ve.paint_fill["fill-color"]),"fill-outline-color":new Wo(ve.paint_fill["fill-outline-color"]),"fill-translate":new $o(ve.paint_fill["fill-translate"]),"fill-translate-anchor":new $o(ve.paint_fill["fill-translate-anchor"]),"fill-pattern":new Zo(ve.paint_fill["fill-pattern"])})},get layout(){return wc=wc||new Ko({"fill-sort-key":new Wo(ve.layout_fill["fill-sort-key"])})}};class Ec extends Yo{constructor(e,t){super(e,Sc,t)}recalculate(e,t){super.recalculate(e,t);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(e){return new xc(e)}queryRadius(){return il(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:r,pixelsToTileUnits:i}){return Zs(nl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),t)}isTileClipped(){return!0}}const Ic=na([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Pc=na([{name:"a_centroid",components:2,type:"Int16"}],4),{members:kc}=Ic;class Ac{constructor(e,t,r,i,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=n,e.readFields(Cc,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,o=1,a=0,s=0,l=0;for(;e.pos<t;){if(a<=0){const t=e.readVarint();o=7&t,a=t>>3}if(a--,1===o||2===o)s+=e.readSVarint(),l+=e.readSVarint(),1===o&&(n&&i.push(n),n=[]),n&&n.push(new r(s,l));else{if(7!==o)throw new Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(i<=0){const t=e.readVarint();r=7&t,i=t>>3}if(i--,1===r||2===r)n+=e.readSVarint(),o+=e.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>c&&(c=o);else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,l,s,c]}toGeoJSON(e,t,r){const i=this.extent*Math.pow(2,r),n=this.extent*e,o=this.extent*t,a=this.loadGeometry();function s(e){return[360*(e.x+n)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/i)*Math.PI))-90]}function l(e){return e.map(s)}let c;if(1===this.type){const e=[];for(const r of a)e.push(r[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=a.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=Mc(a),t=[];for(const r of e)t.push(r.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function Cc(e,t,r){1===e?t.id=r.readVarint():2===e?function(e,t){const r=e.readVarint()+e.pos;for(;e.pos<r;){const r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}(r,t):3===e?t.type=r.readVarint():4===e&&(t._geometry=r.pos)}function Mc(e){const t=e.length;if(t<=1)return[e];const r=[];let i,n;for(let o=0;o<t;o++){const t=Dc(e[o]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(i&&r.push(i),i=[e[o]]):i&&i.push(e[o]))}return i&&r.push(i),r}function Dc(e){let t=0;for(let r,i,n=0,o=e.length,a=o-1;n<o;a=n++)r=e[n],i=e[a],t+=(i.x-r.x)*(r.y+i.y);return t}Ac.types=["Unknown","Point","LineString","Polygon"];class Rc{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Oc,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Ac(this._pbf,t,this.extent,this._keys,this._values)}}function Oc(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){let t=null;const r=e.readVarint()+e.pos;for(;e.pos<r;){const r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(r))}class Lc{constructor(e,t){this.layers=e.readFields(Fc,{},t)}}function Fc(e,t,r){if(3===e){const e=new Rc(r,r.readVarint()+r.pos);e.length&&(t[e.name]=e)}}const zc=Math.pow(2,13);function Bc(e,t,r,i,n,o,a,s){e.emplaceBack(t,r,2*Math.floor(i*zc)+a,n*zc*2,o*zc*2,Math.round(s))}class Nc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new $a,this.centroidVertexArray=new Ua,this.indexArray=new ts,this.programConfigurations=new Ls(e.layers,e.zoom),this.segments=new os,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.features=[],this.hasDependencies=Bl("fill-extrusion",this.layers,t);for(const{feature:i,id:n,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Vs(i,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),s,r))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:e?s.geometry:js(i),properties:i.properties,type:i.type,patterns:{}};this.hasDependencies?this.features.push(Nl("fill-extrusion",this.layers,l,{zoom:this.zoom},t)):this.addFeature(l,l.geometry,o,r,{},t.subdivisionGranularity),t.featureIndex.insert(i,l.geometry,o,a,this.index,!0)}}addFeatures(e,t,r){for(const i of this.features){const{geometry:n}=i;this.addFeature(i,n,i.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Pc.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,r,i,n,o){for(const a of ei(t,500)){const t={x:0,y:0,sampleCount:0},r=this.layoutVertexArray.length;this.processPolygon(t,i,e,a,o);const n=this.layoutVertexArray.length-r,s=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<n;e++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}processPolygon(e,t,r,i,n){if(i.length<1)return;if(Uc(i[0]))return;for(const u of i)0!==u.length&&jc(e,u);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(t.z),s="Polygon"===Ac.types[r.type];for(const u of i){if(0===u.length)continue;if(Uc(u))continue;const e=yc(u,a,s);this._generateSideFaces(e,o)}if(!s)return;const l=gc(i,t,a,!1),c=this.layoutVertexArray;vc((e,t)=>{Bc(c,e,t,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let i=1;i<e.length;i++){const n=e[i],o=e[i-1];if(Vc(n,o))continue;t.segment.vertexLength+4>os.MAX_VERTEX_ARRAY_LENGTH&&(t.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),Bc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,r),Bc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,r),r+=s,Bc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,r),Bc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,r);const l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function jc(e,t){for(let r=0;r<t.length;r++){const i=t[r];r===t.length-1&&t[0].x===i.x&&t[0].y===i.y||(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}function Vc(e,t){return e.x===t.x&&(e.x<0||e.x>A)||e.y===t.y&&(e.y<0||e.y>A)}function Uc(e){return e.every(e=>e.x<0)||e.every(e=>e.x>A)||e.every(e=>e.y<0)||e.every(e=>e.y>A)}let Gc;po("FillExtrusionBucket",Nc,{omit:["layers","features"]});var qc={get paint(){return Gc=Gc||new Ko({"fill-extrusion-opacity":new $o(ve["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wo(ve["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new $o(ve["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new $o(ve["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zo(ve["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wo(ve["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wo(ve["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new $o(ve["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class $c extends Yo{constructor(e,t){super(e,qc,t)}createBucket(e){return new Nc(e)}queryRadius(){return il(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){const l=nl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=function(e,t){const i=[];for(const n of e){const e=[n.x,n.y,0,1];S(e,e,t),i.push(new r(e[0]/e[3],e[1]/e[3]))}return i}(l,s),d=function(e,t,i,n){const o=[],a=[],s=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const m of e){const e=[],t=[];for(const i of m){const o=i.x,a=i.y,m=n[0]*o+n[4]*a+n[12],g=n[1]*o+n[5]*a+n[13],y=n[2]*o+n[6]*a+n[14],_=n[3]*o+n[7]*a+n[15],v=y+c,b=_+u,x=m+h,w=g+d,T=y+p,S=_+f,E=new r((m+s)/b,(g+l)/b);E.z=v/b,e.push(E);const I=new r(x/S,w/S);I.z=T/S,t.push(I)}o.push(e),a.push(t)}return[o,a]}(n,u,c,s);return function(e,t,r){let i=1/0;Zs(r,t)&&(i=Zc(r,t[0]));for(let n=0;n<t.length;n++){const o=t[n],a=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],a[e+1],a[e],t];$s(r,n)&&(i=Math.min(i,Zc(r,n)))}}return i!==1/0&&i}(d[0],d[1],h)}}function Wc(e,t){return e.x*t.x+e.y*t.y}function Zc(e,t){if(1===e.length){let r=0;const i=t[r++];let n;for(;!n||i.equals(n);)if(n=t[r++],!n)return 1/0;for(;r<t.length;r++){const o=t[r],a=e[0],s=n.sub(i),l=o.sub(i),c=a.sub(i),u=Wc(s,s),h=Wc(s,l),d=Wc(l,l),p=Wc(c,s),f=Wc(c,l),m=u*d-h*h,g=(d*p-h*f)/m,y=(u*f-h*p)/m,_=i.z*(1-g-y)+n.z*g+o.z*y;if(isFinite(_))return _}return 1/0}{let e=1/0;for(const r of t)e=Math.min(e,r.z);return e}}const Hc=na([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Xc}=Hc,Kc=na([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Yc}=Kc,Jc=Math.cos(Math.PI/180*37.5),Qc=Math.pow(2,14)/.5;class eu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Wa,this.layoutVertexArray2=new Za,this.indexArray=new ts,this.programConfigurations=new Ls(e.layers,e.zoom),this.segments=new os,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=Bl("line",this.layers,t)||this.hasLineDasharray(this.layers);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 e){const e=this.layers[0]._featureFilter.needGeometry,t=Vs(a,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),t,r))continue;const u=n?i.evaluate(t,{},r):void 0,h={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?t.geometry:js(a),patterns:{},dashes:{},sortKey:u};o.push(h)}n&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const a of o){const{geometry:i,index:n,sourceLayerIndex:o}=a;this.hasDependencies?(Bl("line",this.layers,t)?Nl("line",this.layers,a,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,a,this.zoom,t),this.patternFeatures.push(a)):this.addFeature(a,i,n,r,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[n].feature,i,n,o,this.index)}}update(e,t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(e,t,r,i){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,r,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Yc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,r,i,n,o,a){const s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),c=s.get("line-cap"),u=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const d of t)this.addLine(d,e,l,c,u,h,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,dashPositions:o,canonical:i})}addLine(e,t,r,i,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=yc(e,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===Ac.types[t.type];let c=e.length;for(;c>=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u<c-1&&e[u].equals(e[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,y;this.e1=this.e2=-1,l&&(p=e[c-2],y=e[u].sub(p)._unit()._perp());for(let _=u;_<c;_++){if(m=_===c-1?l?e[u+1]:void 0:e[_+1],m&&e[_].equals(m))continue;y&&(g=y),p&&(f=p),p=e[_],y=m?m.sub(p)._unit()._perp():g,g=g||y;let t=g.add(y);0===t.x&&0===t.y||t._unit();const a=g.x*y.x+g.y*y.y,s=t.x*y.x+t.y*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.y-g.y*y.x>0;if(x&&_>u){const e=p.dist(f);if(e>2*h){const t=p.sub(p.sub(f)._mult(h/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,g,0,0,d),f=t}}const T=f&&m;let S=T?r:l?"butt":i;if(T&&"round"===S&&(v<o?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>n&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<n&&(S="miter")),f&&this.updateDistance(f,p),"miter"===S)t._mult(v),this.addCurrentVertex(p,t,0,0,d);else if("flipbevel"===S){if(v>100)t=y.mult(-1);else{const e=v*g.add(y).mag()/g.sub(y).mag();t._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(p,t,0,0,d),this.addCurrentVertex(p,t.mult(-1),0,0,d)}else if("bevel"===S||"fakeround"===S){const e=-Math.sqrt(v*v-1),t=w?e:0,r=w?0:e;if(f&&this.addCurrentVertex(p,g,t,r,d),"fakeround"===S){const e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let r=t/e;if(.5!==r){const e=r-.5;r+=r*e*(r-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*e*e+(.848013+a*(.215638*a-1.06021)))}const i=y.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,y,-t,-r,d)}else if("butt"===S)this.addCurrentVertex(p,t,0,0,d);else if("square"===S){const e=f?1:-1;this.addCurrentVertex(p,t,e,e,d)}else"round"===S&&(f&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,y,-1,-1,d,!0),this.addCurrentVertex(p,y,0,0,d)));if(x&&_<c-1){const e=p.dist(m);if(e>2*h){const t=p.add(m.sub(p)._mult(h/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,y,0,0,d),p=t}}}}addCurrentVertex(e,t,r,i,n,o=!1){const a=t.y*i-t.x,s=-t.y-t.x*i;this.addHalfVertex(e,t.x+t.y*r,t.y-t.x*r,o,!1,r,n),this.addHalfVertex(e,a,s,o,!0,-i,n),this.distance>Qc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,n,o))}addHalfVertex({x:e,y:t},r,i,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Qc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<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(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(const t of e){const e=t.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,i){for(const n of e){const e=n.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;const o="round"===n.layout.get("line-cap"),a={dasharray:e.value.evaluate({zoom:r-1},t,{}),round:o},s={dasharray:e.value.evaluate({zoom:r},t,{}),round:o},l={dasharray:e.value.evaluate({zoom:r+1},t,{}),round:o},c=`${a.dasharray.join(",")},${a.round}`,u=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`;i.dashDependencies[c]=a,i.dashDependencies[u]=s,i.dashDependencies[h]=l,t.dashes[n.id]={min:c,mid:u,max:h}}}}let tu,ru;po("LineBucket",eu,{omit:["layers","patternFeatures"]});var iu={get paint(){return ru=ru||new Ko({"line-opacity":new Wo(ve.paint_line["line-opacity"]),"line-color":new Wo(ve.paint_line["line-color"]),"line-translate":new $o(ve.paint_line["line-translate"]),"line-translate-anchor":new $o(ve.paint_line["line-translate-anchor"]),"line-width":new Wo(ve.paint_line["line-width"]),"line-gap-width":new Wo(ve.paint_line["line-gap-width"]),"line-offset":new Wo(ve.paint_line["line-offset"]),"line-blur":new Wo(ve.paint_line["line-blur"]),"line-dasharray":new Zo(ve.paint_line["line-dasharray"]),"line-pattern":new Zo(ve.paint_line["line-pattern"]),"line-gradient":new Xo(ve.paint_line["line-gradient"])})},get layout(){return tu=tu||new Ko({"line-cap":new $o(ve.layout_line["line-cap"]),"line-join":new Wo(ve.layout_line["line-join"]),"line-miter-limit":new $o(ve.layout_line["line-miter-limit"]),"line-round-limit":new $o(ve.layout_line["line-round-limit"]),"line-sort-key":new Wo(ve.layout_line["line-sort-key"])})}};class nu extends Wo{possiblyEvaluate(e,t){return t=new Oo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=B({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}}let ou;class au extends Yo{constructor(e,t){super(e,iu,t),this.gradientVersion=0,ou||(ou=new nu(iu.paint.properties["line-width"].specification),ou.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof sr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=ou.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new eu(e)}queryRadius(e){const t=e,r=su(rl("line-width",this,t),rl("line-gap-width",this,t)),i=rl("line-offset",this,t);return r/2+Math.abs(i)+il(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a}){const s=nl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*su(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(n=function(e,t){const i=[];for(let n=0;n<e.length;n++){const o=ol(e[n]),a=[];for(let e=0;e<o.length;e++){const i=o[e],n=o[e-1],s=o[e+1],l=0===e?new r(0,0):i.sub(n)._unit()._perp(),c=e===o.length-1?new r(0,0):s.sub(i)._unit()._perp(),u=l._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),a.push(u._mult(t)._add(i))}i.push(a)}return i}(n,c*a)),function(e,t,r){for(let i=0;i<t.length;i++){const n=t[i];if(e.length>=3)for(let t=0;t<n.length;t++)if(el(e,n[t]))return!0;if(Hs(e,n,r))return!0}return!1}(s,n,l)}isTileClipped(){return!0}}function su(e,t){return t>0?t+2*e:e}const lu=na([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),cu=na([{name:"a_projected_pos",components:3,type:"Float32"}],4);na([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const uu=na([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);na([{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 hu=na([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),du=na([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function pu(e,t,r){return e.sections.forEach(e=>{e.text=function(e,t,r){const i=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?e=e.toLocaleUpperCase():"lowercase"===i&&(e=e.toLocaleLowerCase()),Ro.applyArabicShaping&&(e=Ro.applyArabicShaping(e)),e}(e.text,t,r)}),e}na([{name:"triangle",components:3,type:"Uint16"}]),na([{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"}]),na([{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"}]),na([{type:"Float32",name:"offsetX"}]),na([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),na([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var fu=24;const mu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},gu={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},yu={40:!0};function _u(e,t,r,i,n,o){if("fontStack"in t){const i=r[t.fontStack],o=i&&i[e];return o?o.metrics.advance*t.scale+n:0}{const e=i[t.imageName];return e?e.displaySize[0]*t.scale*fu/o+n:0}}function vu(e,t,r,i){const n=Math.pow(e-t,2);return i?e<t?n/2:2*n:n+Math.abs(r)*r}function bu(e,t,r){let i=0;return 10===e&&(i-=1e4),r&&(i+=150),40!==e&&65288!==e||(i+=50),41!==t&&65289!==t||(i+=50),i}function xu(e,t,r,i,n,o){let a=null,s=vu(t,r,n,o);for(const l of i){const e=vu(t-l.x,r,n,o)+l.badness;e<=s&&(a=l,s=e)}return{index:e,x:t,priorBreak:a,badness:s}}function wu(e){return e?wu(e.priorBreak).concat(e.index):[]}class Tu{constructor(e="",t=[],r=[]){this.text=e,this.sections=t,this.sectionIndex=r,this.imageSectionID=null}static fromFeature(e,t){const r=new Tu;for(let i=0;i<e.sections.length;i++){const n=e.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,t)}return r}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",r={premature:!0,value:void 0};const i=e[Symbol.iterator]();let n=i.next();const o=e[Symbol.iterator]();o.next();let a=o.next();for(;!n.done;)t+=!a.done&&ko(a.value.codePointAt(0))&&!mu[a.value]||!r.premature&&ko(r.value.codePointAt(0))&&!mu[r.value]||!mu[n.value]?n.value:mu[n.value],r={value:n.value,premature:!1},n=i.next(),a=o.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes("")}trim(){const e=this.text.match(/^\s*/),t=e?e[0].length:0,r=this.text.match(/\S\s*$/),i=r?r[0].length-1:0;this.text=this.text.substring(t,this.text.length-i),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-i)}substring(e,t){const r=[...this.text].slice(e,t).join(""),i=this.sectionIndex.slice(e,t);return new Tu(r,this.sections,i)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,r=0;for(let i=0;i<this.length();i++){const n=this.getSection(i);if("imageName"in n){const i=e[n.imageName];if(!i)continue;const o=i.displaySize;t=Math.max(t,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:t,maxImageHeight:r}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t});const r=this.sections.length-1;this.sectionIndex.push(...[...e.text].map(()=>r))}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void q("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this.sectionIndex.push(this.sections.length-1)):q("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,r,i,n){const o=[],a=this.determineAverageLineWidth(e,t,r,i,n),s=this.hasZeroWidthSpaces();let l=0,c=0;const u=this.text[Symbol.iterator]();let h=u.next();const d=this.text[Symbol.iterator]();d.next();let p=d.next();const f=this.text[Symbol.iterator]();f.next(),f.next();let m=f.next();for(;!h.done;){const t=this.getSection(c),g=h.value.codePointAt(0);if(wo(g)||(l+=_u(g,t,r,i,e,n)),!p.done){const e=bo(g),r=p.value.codePointAt(0);(gu[g]||e||"imageName"in t||!m.done&&yu[r])&&o.push(xu(c+1,l,a,o,bu(g,r,e&&s),!1))}c++,h=u.next(),p=d.next(),m=f.next()}return wu(xu(this.length(),l,a,o,0,!0))}determineAverageLineWidth(e,t,r,i,n){let o=0,a=0;for(const s of this.text){const t=this.getSection(a);o+=_u(s.codePointAt(0),t,r,i,e,n),a++}return o/Math.max(1,Math.ceil(o/t))}}const Su=4294967296,Eu=1/Su,Iu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Pu{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,r=this.length){for(;this.pos<r;){const r=this.readVarint(),i=r>>3,n=this.pos;this.type=7&r,e(i,t,this),this.pos===n&&this.skip(r)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Su;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Su;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let r,i;return i=t[this.pos++],r=127&i,i<128?r:(i=t[this.pos++],r|=(127&i)<<7,i<128?r:(i=t[this.pos++],r|=(127&i)<<14,i<128?r:(i=t[this.pos++],r|=(127&i)<<21,i<128?r:(i=t[this.pos],r|=(15&i)<<28,function(e,t,r){const i=r.buf;let n,o;if(o=i[r.pos++],n=(112&o)>>4,o<128)return ku(e,n,t);if(o=i[r.pos++],n|=(127&o)<<3,o<128)return ku(e,n,t);if(o=i[r.pos++],n|=(127&o)<<10,o<128)return ku(e,n,t);if(o=i[r.pos++],n|=(127&o)<<17,o<128)return ku(e,n,t);if(o=i[r.pos++],n|=(127&o)<<24,o<128)return ku(e,n,t);if(o=i[r.pos++],n|=(1&o)<<31,o<128)return ku(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(r,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Iu?Iu.decode(this.buf.subarray(t,e)):function(e,t,r){let i="",n=t;for(;n<r;){const t=e[n];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>r)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Eu),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Eu),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let r,i;if(e>=0?(r=e%4294967296|0,i=e/4294967296|0):(r=~(-e%4294967296),i=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,i=i+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,r.buf[r.pos]=127&(e>>>=7)}(r,0,t),function(e,t){const r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(i,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,r){for(let i,n,o=0;o<t.length;o++){if(i=t.charCodeAt(o),i>55295&&i<57344){if(!n){i>56319||o+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=i;continue}if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=63&i|128)}return r}(this.buf,e,this.pos);const r=this.pos-t;r>=128&&Au(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let r=0;r<t;r++)this.buf[this.pos++]=e[r]}writeRawMessage(e,t){this.pos++;const r=this.pos;e(t,this);const i=this.pos-r;i>=128&&Au(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(e,t,r){this.writeTag(e,2),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Cu,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Mu,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Ou,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Du,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Ru,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Lu,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Fu,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,zu,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Bu,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function ku(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Au(e,t,r){const i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(i);for(let n=r.pos-1;n>=e;n--)r.buf[n+i]=r.buf[n]}function Cu(e,t){for(let r=0;r<e.length;r++)t.writeVarint(e[r])}function Mu(e,t){for(let r=0;r<e.length;r++)t.writeSVarint(e[r])}function Du(e,t){for(let r=0;r<e.length;r++)t.writeFloat(e[r])}function Ru(e,t){for(let r=0;r<e.length;r++)t.writeDouble(e[r])}function Ou(e,t){for(let r=0;r<e.length;r++)t.writeBoolean(e[r])}function Lu(e,t){for(let r=0;r<e.length;r++)t.writeFixed32(e[r])}function Fu(e,t){for(let r=0;r<e.length;r++)t.writeSFixed32(e[r])}function zu(e,t){for(let r=0;r<e.length;r++)t.writeFixed64(e[r])}function Bu(e,t){for(let r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Nu(e,t,r){1===e&&r.readMessage(ju,t)}function ju(e,t,r){if(3===e){const{id:e,bitmap:i,width:n,height:o,left:a,top:s,advance:l}=r.readMessage(Vu,{});t.push({id:e,bitmap:new wl({width:n+6,height:o+6},i),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function Vu(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}function Uu(e){let t=0,r=0;for(const a of e)t+=a.w*a.h,r=Math.max(r,a.w);e.sort((e,t)=>t.h-e.h);const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let n=0,o=0;for(const a of e)for(let e=i.length-1;e>=0;e--){const t=i[e];if(!(a.w>t.w||a.h>t.h)){if(a.x=t.x,a.y=t.y,o=Math.max(o,a.y+a.h),n=Math.max(n,a.x+a.w),a.w===t.w&&a.h===t.h){const t=i.pop();t&&e<i.length&&(i[e]=t)}else a.h===t.h?(t.x+=a.w,t.w-=a.w):a.w===t.w?(t.y+=a.h,t.h-=a.h):(i.push({x:t.x+a.w,y:t.y,w:t.w-a.w,h:a.h}),t.y+=a.h,t.h-=a.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}class Gu{constructor(e,{pixelRatio:t,version:r,stretchX:i,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,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 qu{constructor(e,t){const r={},i={};this.haveRenderCallbacks=[];const n=[];this.addImages(e,r,n),this.addImages(t,i,n);const{w:o,h:a}=Uu(n),s=new Tl({width:o||1,height:a||1});for(const l in e){const t=e[l],i=r[l].paddedRect;Tl.copy(t.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},t.data)}for(const l in t){const e=t[l],r=i[l].paddedRect,n=r.x+1,o=r.y+1,a=e.data.width,c=e.data.height;Tl.copy(e.data,s,{x:0,y:0},{x:n,y:o},e.data),Tl.copy(e.data,s,{x:0,y:c-1},{x:n,y:o-1},{width:a,height:1}),Tl.copy(e.data,s,{x:0,y:0},{x:n,y:o+c},{width:a,height:1}),Tl.copy(e.data,s,{x:a-1,y:0},{x:n-1,y:o},{width:1,height:c}),Tl.copy(e.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(e,t,r){for(const i in e){const n=e[i],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),t[i]=new Gu(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in e.updatedImages)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t),this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}patchUpdatedImage(e,t,r){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[i,n]=e.tl;r.update(t.data,void 0,{x:i,y:n})}}var $u;function Wu(t,r,i,n,o,a,s,l,c,u,h,d,p,f,m){const g=Tu.fromFeature(t,o);let y;d===e.az.vertical&&g.verticalizePunctuation();let _=g.determineLineBreaks(u,a,r,n,f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=Ro;if(v&&1===g.sections.length){y=[],_=_.map(e=>g.toCodeUnitIndex(e));const e=v(g.toString(),_);for(const t of e){const e=[...t].map(()=>0);y.push(new Tu(t,g.sections,e))}}else if(b){y=[],_=_.map(e=>g.toCodeUnitIndex(e));let e=0;const t=[];for(const i of g.text)t.push(...Array(i.length).fill(g.sectionIndex[e])),e++;const r=b(g.text,t,_);for(const i of r){const e=[];let t="";for(const r of i[0])e.push(i[1][t.length]),t+=r;y.push(new Tu(i[0],g.sections,e))}}else y=function(e,t){const r=[];let i=0;for(const n of t)r.push(e.substring(i,n)),i=n;return i<e.length()&&r.push(e.substring(i,e.length())),r}(g,_);const x=[],w={positionedLines:x,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,t,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,y=fu/h;let _=0;for(const x of n){x.trim();const n=x.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};e.positionedLines[_]=a;const s=a.positionedGlyphs;let h=0;if(!x.length()){p+=o,++_;continue}const v=Hu(i,x,y);let b=0;for(const o of x.text){const a=x.getSection(b),f=o.codePointAt(0),m=Ku(l,u,f),g={glyph:f,imageName:null,x:d,y:p+-17,vertical:m,scale:1,fontStack:"",sectionIndex:x.getSectionIndex(b),metrics:null,rect:null};let _;if("fontStack"in a){if(_=Yu(a,f,m,v,t,r),!_)continue;g.fontStack=a.fontStack}else{if(e.iconsInText=!0,a.scale*=y,_=Ju(a,m,n,v,i),!_)continue;h=Math.max(h,_.imageOffset),g.imageName=a.imageName}const{rect:w,metrics:T,baselineOffset:S}=_;g.y+=S,g.scale=a.scale,g.metrics=T,g.rect=w,s.push(g),m?(e.verticalizable=!0,d+=("imageName"in a?T.advance:fu)*a.scale+c):d+=T.advance*a.scale+c,b++}0!==s.length&&(f=Math.max(d-c,f),Qu(s,0,s.length-1,g)),d=0,a.lineOffset=Math.max(h,(n-1)*fu);const w=o*n+h;p+=w,m=Math.max(w,m),++_}const{horizontalAlign:v,verticalAlign:b}=Zu(a);(function(e,t,r,i,n,o,a,s,l){const c=(t-r)*n;let u=0;u=o!==a?-s*i- -17:-i*l*a+.5*a;for(const h of e)for(const e of h.positionedGlyphs)e.x+=c,e.y+=u})(e.positionedLines,g,v,b,f,m,o,p,n.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}(w,r,i,n,y,s,l,c,d,u,p,m),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(x)&&w}function Zu(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Hu(e,t,r){const i=t.getMaxScale()*fu,{maxImageWidth:n,maxImageHeight:o}=t.getMaxImageSize(e),a=Math.max(i,o*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:a}}function Xu(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function Ku(t,r,i){return!(t===e.az.horizontal||!r&&!xo(i)||r&&(wo(i)||(n=i,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function Yu(e,t,r,i,n,o){const a=o[e.fontStack],s=function(e,t,r,i){if(e&&e.rect)return e;const n=t[r.fontStack],o=n&&n[i];return o?{rect:null,metrics:o.metrics}:null}(a&&a[t],n,e,t);if(null===s)return null;let l;if(r)l=i.verticalLineContentWidth-e.scale*fu;else{const t=Xu(e.verticalAlign);l=(i.horizontalLineContentHeight-e.scale*fu)*t}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function Ju(e,t,r,i,n){const o=n[e.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:1,top:-3,advance:t?s[1]:s[0]};let c;if(t)c=i.verticalLineContentWidth-s[1]*e.scale;else{const t=Xu(e.verticalAlign);c=(i.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(t?s[0]:s[1])*e.scale-fu*r}}function Qu(e,t,r,i){if(0===i)return;const n=e[r],o=(e[r].x+n.metrics.advance*n.scale)*i;for(let a=t;a<=r;a++)e[a].x-=o}function eh(e,t,r){const{horizontalAlign:i,verticalAlign:n}=Zu(r),o=t[0]-e.displaySize[0]*i,a=t[1]-e.displaySize[1]*n;return{image:e,top:a,bottom:a+e.displaySize[1],left:o,right:o+e.displaySize[0]}}function th(e){var t,r;let i=e.left,n=e.top,o=e.right-i,a=e.bottom-n;const s=null!==(t=e.image.textFitWidth)&&void 0!==t?t:"stretchOrShrink",l=null!==(r=e.image.textFitHeight)&&void 0!==r?r:"stretchOrShrink",c=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const e=Math.ceil(a*c);i*=e/o,o=e}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const e=Math.ceil(o/c);n*=e/a,a=e}return{x1:i,y1:n,x2:i+o,y2:n+a}}function rh(e,t,r,i,n,o){const a=e.image;let s;if(a.content){const e=a.content,t=a.pixelRatio||1;s=[e[0]/t,e[1]/t,a.displaySize[0]-e[2]/t,a.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.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=t.top*o,m=t.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}}po("ImagePosition",Gu),po("ImageAtlas",qu),e.az=void 0,($u=e.az||(e.az={}))[$u.none=0]="none",$u[$u.horizontal=1]="horizontal",$u[$u.vertical=2]="vertical",$u[$u.horizontalOnly=3]="horizontalOnly";const ih=128,nh=32640;function oh(e,t){const{expression:r}=t;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Oo(e+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:i}=r;let n=0;for(;n<t.length&&t[n]<=e;)n++;n=Math.max(0,n-1);let o=n;for(;o<t.length&&t[o]<e+1;)o++;o=Math.min(t.length-1,o);const a=t[n],s=t[o];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:i}:{kind:"camera",minZoom:a,maxZoom:s,minSize:r.evaluate(new Oo(a)),maxSize:r.evaluate(new Oo(s)),interpolationType:i}}}function ah(e,t,r){let i="never";const n=e.get(t);return n?i=n:e.get(r)&&(i="always"),i}const sh=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lh(e,t,r,i,n,o,a,s,l,c,u,h,d){const p=s?Math.min(nh,Math.round(s[0])):0,f=s?Math.min(nh,Math.round(s[1])):0;e.emplaceBack(t,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 ch(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function uh(e){for(const t of e.sections)if(Do(t.text))return!0;return!1}class hh{constructor(e){this.layoutVertexArray=new Ka,this.indexArray=new ts,this.programConfigurations=e,this.segments=new os,this.dynamicLayoutVertexArray=new Ya,this.opacityVertexArray=new Ja,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ra}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lu.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,cu.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,sh,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}po("SymbolBuffers",hh);class dh{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new os,this.collisionVertexArray=new es}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,uu.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}po("CollisionBuffers",dh);class ph{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=oh(this.zoom,r["text-size"]),this.iconSizeData=oh(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"!==ah(i,"text-overlap","text-allow-overlap")||"never"!==ah(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(t=>e.az[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new hh(new Ls(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new hh(new Ls(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Fa,this.lineVertexArray=new za,this.symbolInstances=new La,this.textAnchorOffsets=new Na}calculateGlyphDependencies(e,t,r,i,n){for(const o of e)if(t[o.codePointAt(0)]=!0,(r||i)&&n){const e=mu[o];e&&(t[e.codePointAt(0)]=!0)}}populate(t,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 Mt&&!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 Oo(this.zoom);for(const{feature:g,id:y,index:_,sourceLayerIndex:v}of t){const t=n._featureFilter.needGeometry,r=Vs(g,t);if(!n._featureFilter.filter(m,r,i))continue;let s,l;if(t||(r.geometry=js(g)),c){const e=n.getValueAndResolveTokens("text-field",r,i,f),t=Mt.factory(e),o=this.hasRTLText=this.hasRTLText||uh(t);(!o||"unavailable"===Ro.getRTLTextPluginStatus()||o&&Ro.isParsed())&&(s=pu(t,n,r))}if(u){const e=n.getValueAndResolveTokens("icon-image",r,i,f);l=e instanceof Bt?e:Bt.fromString(e)}if(!s&&!l)continue;const b=this.sortFeaturesByKey?h.evaluate(r,{},i):void 0;if(this.features.push({id:y,text:s,icon:l,index:_,sourceLayerIndex:v,geometry:r.geometry,properties:g.properties,type:Ac.types[g.type],sortKey:b}),l&&(d[l.name]=!0),s){const t=a.evaluate(r,{},i).join(","),n="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.az.vertical)>=0;for(const e of s.sections)if(e.image)d[e.image.name]=!0;else{const r=To(s.toString()),i=e.fontStack||t,o=p[i]=p[i]||{};this.calculateGlyphDependencies(e.text,o,n,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},r={},i=[];let n=0;function o(t){i.push(e[t]),n++}function a(e,t,n){const o=r[e];return delete r[e],r[t]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function s(e,r,n){const o=t[r];return delete t[r],t[e]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(e,t,r){const i=r?t[0][t[0].length-1]:t[0][0];return`${e}:${i.x}:${i.y}`}for(let c=0;c<e.length;c++){const u=e[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 t&&r[p]!==t[f]){const e=s(p,f,h),n=a(p,f,i[e].geometry);delete t[p],delete r[f],r[l(d,i[n].geometry,!0)]=n,i[e].geometry=null}else p in r?a(p,f,h):f in t?s(p,f,h):(o(c),t[p]=n-1,r[f]=n-1)}return i.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const r=this.lineVertexArray.length;if(void 0!==e.segment){let r=e.dist(t[e.segment+1]),i=e.dist(t[e.segment]);const n={};for(let o=e.segment+1;o<t.length;o++)n[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:r},o<t.length-1&&(r+=t[o+1].dist(t[o]));for(let o=e.segment||0;o>=0;o--)n[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:i},o>0&&(i+=t[o-1].dist(t[o]));for(let e=0;e<t.length;e++){const t=n[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,r,i,n,o,a,s,l,c,u,h,d){const p=t.indexArray,f=t.layoutVertexArray,m=t.segments.prepareSegment(4*r.length,f,p,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,y=m.vertexLength,_=this.allowVerticalPlacement&&s===e.az.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let e=0;e<r.length;e++){const{tl:n,tr:o,bl:s,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:y,minFontScaleY:b,glyphOffset:x,isSDF:w,sectionIndex:T}=r[e],S=m.vertexLength,E=x[1];lh(f,l.x,l.y,n.x,E+n.y,u.x,u.y,i,w,h.x,h.y,y,b),lh(f,l.x,l.y,o.x,E+o.y,u.x+u.w,u.y,i,w,g.x,h.y,y,b),lh(f,l.x,l.y,s.x,E+s.y,u.x,u.y+u.h,i,w,h.x,g.y,y,b),lh(f,l.x,l.y,c.x,E+c.y,u.x+u.w,u.y+u.h,i,w,g.x,g.y,y,b),ch(t.dynamicLayoutVertexArray,l,_),p.emplaceBack(S,S+2,S+1),p.emplaceBack(S+1,S+2,S+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==r.length-1&&T===r[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,a,a.index,{imagePositions:{},canonical:d,formattedSection:v&&v[T]})}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,y,c,u,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,r,i,n,o){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(e,t,i,n,o,a,s){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,u=o.layoutVertexArray,h=o.collisionVertexArray,d=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,d,p,new r(e,t)),this._addCollisionDebugVertex(u,h,a,d,p,new r(i,t)),this._addCollisionDebugVertex(u,h,a,d,p,new r(i,n)),this._addCollisionDebugVertex(u,h,a,d,p,new r(e,n)),l.vertexLength+=4;const f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let n=e;n<t;n++){const e=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,i?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new dh(Qa,hu.members,rs),this.iconCollisionBox=new dh(Qa,hu.members,rs);for(let e=0;e<this.symbolInstances.length;e++){const t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,i,n,o,a,s,l){const c={};for(let u=t;u<r;u++){const t=e.get(u);c.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.textFeatureIndex=t.featureIndex;break}for(let u=i;u<n;u++){const t=e.get(u);c.verticalTextBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.verticalTextFeatureIndex=t.featureIndex;break}for(let u=o;u<a;u++){const t=e.get(u);c.iconBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.iconFeatureIndex=t.featureIndex;break}for(let u=s;u<l;u++){const t=e.get(u);c.verticalIconBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.verticalIconFeatureIndex=t.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+4*r.numGlyphs;for(let n=r.vertexStartIndex;n<i;n+=4)e.indexArray.emplaceBack(n,n+2,n+1),e.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),r=Math.cos(e),i=[],n=[],o=[];for(let a=0;a<this.symbolInstances.length;++a){o.push(a);const e=this.symbolInstances.get(a);i.push(0|Math.round(t*e.anchorX+r*e.anchorY)),n.push(e.featureIndex)}return o.sort((e,t)=>i[e]-i[t]||n[t]-n[e]),o}addToSortKeyRanges(e,t){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach((e,t,r)=>{e>=0&&r.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let fh,mh;po("SymbolBucket",ph,{omit:["layers","collisionBoxArray","features","compareText"]}),ph.MAX_GLYPHS=65535,ph.addDynamicAttributes=ch;var gh={get paint(){return mh=mh||new Ko({"icon-opacity":new Wo(ve.paint_symbol["icon-opacity"]),"icon-color":new Wo(ve.paint_symbol["icon-color"]),"icon-halo-color":new Wo(ve.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wo(ve.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wo(ve.paint_symbol["icon-halo-blur"]),"icon-translate":new $o(ve.paint_symbol["icon-translate"]),"icon-translate-anchor":new $o(ve.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wo(ve.paint_symbol["text-opacity"]),"text-color":new Wo(ve.paint_symbol["text-color"],{runtimeType:Ne,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Wo(ve.paint_symbol["text-halo-color"]),"text-halo-width":new Wo(ve.paint_symbol["text-halo-width"]),"text-halo-blur":new Wo(ve.paint_symbol["text-halo-blur"]),"text-translate":new $o(ve.paint_symbol["text-translate"]),"text-translate-anchor":new $o(ve.paint_symbol["text-translate-anchor"])})},get layout(){return fh=fh||new Ko({"symbol-placement":new $o(ve.layout_symbol["symbol-placement"]),"symbol-spacing":new $o(ve.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new $o(ve.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wo(ve.layout_symbol["symbol-sort-key"]),"symbol-z-order":new $o(ve.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new $o(ve.layout_symbol["icon-allow-overlap"]),"icon-overlap":new $o(ve.layout_symbol["icon-overlap"]),"icon-ignore-placement":new $o(ve.layout_symbol["icon-ignore-placement"]),"icon-optional":new $o(ve.layout_symbol["icon-optional"]),"icon-rotation-alignment":new $o(ve.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wo(ve.layout_symbol["icon-size"]),"icon-text-fit":new $o(ve.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $o(ve.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wo(ve.layout_symbol["icon-image"]),"icon-rotate":new Wo(ve.layout_symbol["icon-rotate"]),"icon-padding":new Wo(ve.layout_symbol["icon-padding"]),"icon-keep-upright":new $o(ve.layout_symbol["icon-keep-upright"]),"icon-offset":new Wo(ve.layout_symbol["icon-offset"]),"icon-anchor":new Wo(ve.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new $o(ve.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new $o(ve.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new $o(ve.layout_symbol["text-rotation-alignment"]),"text-field":new Wo(ve.layout_symbol["text-field"]),"text-font":new Wo(ve.layout_symbol["text-font"]),"text-size":new Wo(ve.layout_symbol["text-size"]),"text-max-width":new Wo(ve.layout_symbol["text-max-width"]),"text-line-height":new $o(ve.layout_symbol["text-line-height"]),"text-letter-spacing":new Wo(ve.layout_symbol["text-letter-spacing"]),"text-justify":new Wo(ve.layout_symbol["text-justify"]),"text-radial-offset":new Wo(ve.layout_symbol["text-radial-offset"]),"text-variable-anchor":new $o(ve.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Wo(ve.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Wo(ve.layout_symbol["text-anchor"]),"text-max-angle":new $o(ve.layout_symbol["text-max-angle"]),"text-writing-mode":new $o(ve.layout_symbol["text-writing-mode"]),"text-rotate":new Wo(ve.layout_symbol["text-rotate"]),"text-padding":new $o(ve.layout_symbol["text-padding"]),"text-keep-upright":new $o(ve.layout_symbol["text-keep-upright"]),"text-transform":new Wo(ve.layout_symbol["text-transform"]),"text-offset":new Wo(ve.layout_symbol["text-offset"]),"text-allow-overlap":new $o(ve.layout_symbol["text-allow-overlap"]),"text-overlap":new $o(ve.layout_symbol["text-overlap"]),"text-ignore-placement":new $o(ve.layout_symbol["text-ignore-placement"]),"text-optional":new $o(ve.layout_symbol["text-optional"])})}};class yh{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Le,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}po("FormatSectionOverride",yh,{omit:["defaultValue"]});class _h extends Yo{constructor(e,t){super(e,gh,t)}recalculate(e,t){if(super.recalculate(e,t),"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 e=this.layout.get("text-writing-mode");if(e){const t=[];for(const r of e)t.indexOf(r)<0&&t.push(r);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,r,i){const n=this.layout.get(e).evaluate(t,{},r,i),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||tn(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,(t,r)=>e&&r in e?String(e[r]):"")}(t.properties,n)}createBucket(e){return new ph(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of gh.paint.overridableProperties){if(!_h.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),r=new yh(t),i=new en(r,t.property.specification);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new nn("source",i):new on("composite",i,t.value.zoomStops),this.paint._values[e]=new Go(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&_h.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const r=e.get("text-field"),i=gh.paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(i.overrides&&i.overrides.hasOverride(t))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof Mt)o(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){const e=t=>{n||(t instanceof qt&&Ut(t.value)===qe?o(t.value.sections):t instanceof kr?o(t.sections):t.eachChild(e))},t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let vh;var bh={get paint(){return vh=vh||new Ko({"background-color":new $o(ve.paint_background["background-color"]),"background-pattern":new Ho(ve.paint_background["background-pattern"]),"background-opacity":new $o(ve.paint_background["background-opacity"])})}};class xh extends Yo{constructor(e,t){super(e,bh,t)}}class wh extends Yo{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}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 Th{constructor(e){this._methodToThrottle=e,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 Sh={once:!0},Eh=6371008.8;class Ih{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ih(z(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,r=this.lat*t,i=e.lat*t,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return Eh*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof Ih)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Ih(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Ih(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Ph=2*Math.PI*Eh;function kh(e){return Ph*Math.cos(e*Math.PI/180)}function Ah(e){return(180+e)/360}function Ch(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Mh(e,t){return e/kh(t)}function Dh(e){return 360*e-180}function Rh(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Oh(e,t){return e*kh(Rh(t))}class Lh{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(e,t=0){const r=Ih.convert(e);return new Lh(Ah(r.lng),Ch(r.lat),Mh(t,r.lat))}toLngLat(){return new Ih(Dh(this.x),Rh(this.y))}toAltitude(){return Oh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ph*(e=Rh(this.y),1/Math.cos(e*Math.PI/180));var e}}function Fh(e,t,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[e*i-2*Math.PI*6378137/2,t*i-2*Math.PI*6378137/2]}class zh{constructor(e,t,r){if(!function(e,t,r){return!(e<0||e>25||r<0||r>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,r))throw new Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=jh(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){const i=function(e,t,r){var i=Fh(256*e,256*(t=Math.pow(2,r)-t-1),r),n=Fh(256*(e+1),256*(t+1),r);return i[0]+","+i[1]+","+n[0]+","+n[1]}(this.x,this.y,this.z),n=function(e,t,r){let i,n="";for(let o=e;o>0;o--)i=1<<o-1,n+=(t&i?1:0)+(r&i?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new r((e.x*t-this.x)*A,(e.y*t-this.y)*A)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Bh{constructor(e,t){this.wrap=e,this.canonical=t,this.key=jh(e,t.z,t.z,t.x,t.y)}}class Nh{constructor(e,t,r,i,n){if(this.terrainRttPosMatrix32f=null,e<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${r}`);this.overscaledZ=e,this.wrap=t,this.canonical=new zh(r,+i,+n),this.key=jh(t,e,r,i,n)}clone(){return new Nh(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new Nh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Nh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?jh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):jh(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(e){if(e.wrap!==this.wrap)return!1;if(this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;const t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Nh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new Nh(t,this.wrap,t,r,i),new Nh(t,this.wrap,t,r+1,i),new Nh(t,this.wrap,t,r,i+1),new Nh(t,this.wrap,t,r+1,i+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Nh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Nh(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Bh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Lh(e.x-this.wrap,e.y))}}function jh(e,t,r,i,n){(e*=2)<0&&(e=-1*e-1);const o=1<<r;return(o*o*e+o*n+i).toString(36)+r.toString(36)+t.toString(36)}function Vh(e,t){return t?e.properties[t]:e.id}function Uh(e,t){const r={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const i of t.removeProperties){const t=e.addOrUpdateProperties.findIndex(e=>e.key===i);t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(r.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(r.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(r.newGeometry=t.newGeometry||e.newGeometry),r}function Gh(e){var t,r;if(!e)return{};const i={};return i.removeAll=e.removeAll,i.remove=new Set(e.remove||[]),i.add=new Map(null===(t=e.add)||void 0===t?void 0:t.map(e=>[e.id,e])),i.update=new Map(null===(r=e.update)||void 0===r?void 0:r.map(e=>[e.id,e])),i}po("CanonicalTileID",zh),po("OverscaledTileID",Nh,{omit:["terrainRttPosMatrix32f"]});class qh{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const t=new qh;return t.extend(e(new r(this.minX,this.minY))),t.extend(e(new r(this.maxX,this.minY))),t.extend(e(new r(this.minX,this.maxY))),t.extend(e(new r(this.maxX,this.maxY))),t}static fromPoints(e){const t=new qh;for(const r of e)t.extend(r);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class $h{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Wh{constructor(e,t,r,i,n){this.type="Feature",this._vectorTileFeature=e,this._x=r,this._y=i,this._z=t,this.properties=e.properties,this.id=n}projectPoint(e,t,r,i){return[360*(e.x+t)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+r)/i)*Math.PI))-90]}projectLine(e,t,r,i){return e.map(e=>this.projectPoint(e,t,r,i))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,t=e.extent*Math.pow(2,this._z),r=e.extent*this._x,i=e.extent*this._y,n=e.loadGeometry();switch(e.type){case 1:{const e=[];for(const t of n)e.push(t[0]);const o=this.projectLine(e,r,i,t);this._geometry=1===e.length?{type:"Point",coordinates:o[0]}:{type:"MultiPoint",coordinates:o};break}case 2:{const e=n.map(e=>this.projectLine(e,r,i,t));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{const e=Mc(n),o=[];for(const n of e)o.push(n.map(e=>this.projectLine(e,r,i,t)));this._geometry=1===o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}}class Zh{_name;dataBuffer;nullabilityBuffer;_size;constructor(e,t,r){this._name=e,this.dataBuffer=t,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Hh extends Zh{}class Xh extends Hh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Kh extends Hh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Yh extends Zh{delta;constructor(e,t,r,i){super(e,t,i),this.delta=r}}class Jh extends Yh{constructor(e,t,r,i){super(e,Int32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Qh extends Zh{constructor(e,t,r){super(e,Int32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}class ed{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(e,t,r,i,n=4096){this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let t=0;for(;t<this.numFeatures;){let r;this.idVector&&(r=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(t)):this.idVector.getValue(t));const i=e?.next().value,n={};for(const e of this.propertyVectors){if(!e)continue;const r=e.name,i=e.getValue(t);null!==i&&(n[r]=i)}t++,yield{id:r,geometry:i,properties:n}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;this.idVector&&(i=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(r)):this.idVector.getValue(r));const n={coordinates:t[r],type:this.geometryVector.geometryType(r)},o={};for(const e of this.propertyVectors){if(!e)continue;const t=e.name,i=e.getValue(r);null!==i&&(o[t]=i)}e.push({id:i,geometry:n,properties:o})}return e}containsMaxSaveIntegerValues(e){return e instanceof Xh||e instanceof Qh&&e instanceof Jh||e instanceof Kh}}class td{value;constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var rd,id,nd,od,ad,sd,ld,cd,ud,hd;function dd(e,t,r){const i=new Int32Array(r);let n=0,o=t.get();for(let a=0;a<i.length;a++){let t=e[o++],r=127&t;t<128||(t=e[o++],r|=(127&t)<<7,t<128||(t=e[o++],r|=(127&t)<<14,t<128||(t=e[o++],r|=(127&t)<<21,t<128||(t=e[o++],r|=(15&t)<<28)))),i[n++]=r}return t.set(o),i}function pd(e,t,r){const i=new BigInt64Array(r);for(let n=0;n<i.length;n++)i[n]=_d(e,t);return i}function fd(e,t){let r,i;return i=e[t.get()],t.increment(),r=127&i,i<128?r:(i=e[t.get()],t.increment(),r|=(127&i)<<7,i<128?r:(i=e[t.get()],t.increment(),r|=(127&i)<<14,i<128?r:(i=e[t.get()],t.increment(),r|=(127&i)<<21,i<128?r:(i=e[t.get()],r|=(15&i)<<28,function(e,t,r){let i,n;if(n=t[r.get()],r.increment(),i=(112&n)>>4,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<3,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<10,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<17,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<24,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(1&n)<<31,n<128)return 4294967296*i+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(r,e,t)))))}function md(e,t,r,i){throw new Error("FastPFor is not implemented yet.")}function gd(e){return e>>>1^-(1&e)}function yd(e){return e>>1n^-(1n&e)}function _d(e,t){let r=0n,i=0,n=t.get();for(;n<e.length;){const t=e[n++];if(r|=BigInt(127&t)<<BigInt(i),!(128&t))break;if(i+=7,i>=64)throw new Error("Varint too long")}return t.set(n),r}function vd(e,t,r){const i=new Int32Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];i.fill(e[o+t],n,n+r),n+=r}return i}function bd(e,t,r){const i=new BigInt64Array(r);let n=0;for(let o=0;o<t;o++){const r=Number(e[o]);i.fill(e[o+t],n,n+r),n+=r}return i}function xd(e,t,r){const i=new Float64Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];i.fill(e[o+t],n,n+r),n+=r}return i}function wd(e){const t=e.length/4*4;let r=1;if(t>=4)for(let i=e[0];r<t-4;r+=4)i=e[r]+=i,i=e[r+1]+=i,i=e[r+2]+=i,i=e[r+3]+=i;for(;r!=e.length;)e[r]+=e[r-1],++r}function Td(e){e[0]=e[0]>>>1^-(1&e[0]),e[1]=e[1]>>>1^-(1&e[1]);const t=e.length/4*4;let r=2;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t>>>1^-(1&t))+e[r-2],e[r+1]=(i>>>1^-(1&i))+e[r-1],e[r+2]=(n>>>1^-(1&n))+e[r],e[r+3]=(o>>>1^-(1&o))+e[r+1]}for(;r!=e.length;r+=2)e[r]=(e[r]>>>1^-(1&e[r]))+e[r-2],e[r+1]=(e[r+1]>>>1^-(1&e[r+1]))+e[r-1]}!function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"}(rd||(rd={})),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT",e.ALP="ALP"}(id||(id={})),function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"}(nd||(nd={}));class Sd{_dictionaryType;_offsetType;_lengthType;constructor(e,t,r){this._dictionaryType=e,this._offsetType=t,this._lengthType=r}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function Ed(e,t){const r=function(e,t){const r=e[t.get()],i=Object.values(nd)[r>>4];let n=null;switch(i){case nd.DATA:n=new Sd(Object.values(od)[15&r]);break;case nd.OFFSET:n=new Sd(null,Object.values(ad)[15&r]);break;case nd.LENGTH:n=new Sd(null,null,Object.values(sd)[15&r])}t.increment();const o=e[t.get()],a=Object.values(rd)[o>>5],s=Object.values(rd)[o>>2&7],l=Object.values(id)[3&o];t.increment();const c=dd(e,t,2),u=c[0];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:a,logicalLevelTechnique2:s,physicalLevelTechnique:l,numValues:u,byteLength:c[1],decompressedCount:u}}(e,t);return r.logicalLevelTechnique1===rd.MORTON?function(e,t,r){const i=dd(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:i[0],coordinateShift:i[1]}}(r,e,t):rd.RLE!==r.logicalLevelTechnique1&&rd.RLE!==r.logicalLevelTechnique2||id.NONE===r.physicalLevelTechnique?r:function(e,t,r){const i=dd(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}(r,e,t)}!function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(od||(od={})),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(ad||(ad={})),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(sd||(sd={})),function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(ld||(ld={}));class Id{values;_size;constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8);return 1==(this.values[t]>>e%8&1)}set(e,t){const r=Math.floor(e/8);this.values[r]=this.values[r]|(t?1:0)<<e%8}getInt(e){const t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Pd(e,t,r,i,n){return function(e,t,r){switch(t.logicalLevelTechnique1){case rd.DELTA:return t.logicalLevelTechnique2===rd.RLE?function(e,t,r){const i=new Int32Array(r);let n=0,o=0;for(let a=0;a<t;a++){const r=e[a],s=gd(e[a+t]);for(let e=0;e<r;e++)o+=s,i[n++]=o}return i}(e,t.runs,t.numRleValues):(function(e){e[0]=e[0]>>>1^-(1&e[0]);const t=e.length/4*4;let r=1;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t>>>1^-(1&t))+e[r-1],e[r+1]=(i>>>1^-(1&i))+e[r],e[r+2]=(n>>>1^-(1&n))+e[r+1],e[r+3]=(o>>>1^-(1&o))+e[r+2]}for(;r!=e.length;++r)e[r]=(e[r]>>>1^-(1&e[r]))+e[r-1]}(e),e);case rd.RLE:return function(e,t,r){return r?function(e,t,r){const i=new Int32Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];let a=e[o+t];a=a>>>1^-(1&a),i.fill(a,n,n+r),n+=r}return i}(e,t.runs,t.numRleValues):vd(e,t.runs,t.numRleValues)}(e,t,r);case rd.MORTON:return wd(e),e;case rd.COMPONENTWISE_DELTA:return Td(e),e;case rd.NONE:return r&&function(e){for(let t=0;t<e.length;t++){const r=e[t];e[t]=r>>>1^-(1&r)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(Ad(e,t,r),r,i)}function kd(e,t,r){return function(e,t){if(t.logicalLevelTechnique1===rd.DELTA&&t.logicalLevelTechnique2===rd.NONE){const t=function(e){const t=new Int32Array(e.length+1);t[0]=0,t[1]=gd(e[0]);let r=t[1],i=2;for(;i!=t.length;++i){const n=e[i-1];r+=n>>>1^-(1&n),t[i]=t[i-1]+r}return t}(e);return t}if(t.logicalLevelTechnique1===rd.RLE&&t.logicalLevelTechnique2===rd.NONE){const r=function(e,t,r){const i=new Int32Array(r+1);i[0]=0;let n=1,o=i[0];for(let a=0;a<t;a++){const r=e[a],s=e[a+t];for(let e=n;e<n+r;e++)i[e]=s+o,o=i[e];n+=r}return i}(e,t.runs,t.numRleValues);return r}if(t.logicalLevelTechnique1===rd.NONE&&t.logicalLevelTechnique2===rd.NONE){!function(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}(e);const r=new Int32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===rd.DELTA&&t.logicalLevelTechnique2===rd.RLE){const r=function(e,t,r){const i=new Int32Array(r+1);i[0]=0;let n=1,o=i[0];for(let a=0;a<t;a++){const r=e[a];let s=e[a+t];s=s>>>1^-(1&s);for(let e=n;e<n+r;e++)i[e]=s+o,o=i[e];n+=r}return i}(e,t.runs,t.numRleValues);return wd(r),r}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Ad(e,t,r),r)}function Ad(e,t,r){const i=r.physicalLevelTechnique;if(i===id.FAST_PFOR)return md();if(i===id.VARINT)return dd(e,t,r.numValues);if(i===id.NONE){const i=t.get();t.add(r.byteLength);const n=e.subarray(i,t.get());return new Int32Array(n)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function Cd(e,t,r,i){const n=Ad(e,t,r);if(1===n.length){const e=n[0];return i?gd(e):e}return i?function(e){return gd(e[1])}(n):function(e){return e[1]}(n)}function Md(e,t,r){return function(e){if(2==e.length){const t=gd(e[1]);return[t,t]}return[gd(e[2]),gd(e[3])]}(Ad(e,t,r))}function Dd(e,t,r){return function(e){if(2==e.length){const t=yd(e[1]);return[t,t]}return[yd(e[2]),yd(e[3])]}(pd(e,t,r.numValues))}function Rd(e,t,r,i){return function(e,t,r){switch(t.logicalLevelTechnique1){case rd.DELTA:return t.logicalLevelTechnique2===rd.RLE?function(e,t,r){const i=new BigInt64Array(r);let n=0,o=0n;for(let a=0;a<t;a++){const r=Number(e[a]),s=yd(e[a+t]);for(let e=0;e<r;e++)o+=s,i[n++]=o}return i}(e,t.runs,t.numRleValues):(function(e){e[0]=e[0]>>1n^-(1n&e[0]);const t=e.length/4*4;let r=1;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t>>1n^-(1n&t))+e[r-1],e[r+1]=(i>>1n^-(1n&i))+e[r],e[r+2]=(n>>1n^-(1n&n))+e[r+1],e[r+3]=(o>>1n^-(1n&o))+e[r+2]}for(;r!=e.length;++r)e[r]=(e[r]>>1n^-(1n&e[r]))+e[r-1]}(e),e);case rd.RLE:return function(e,t,r){return r?function(e,t,r){const i=new BigInt64Array(r);let n=0;for(let o=0;o<t;o++){const r=Number(e[o]);let a=e[o+t];a=a>>1n^-(1n&a),i.fill(a,n,n+r),n+=r}return i}(e,t.runs,t.numRleValues):bd(e,t.runs,t.numRleValues)}(e,t,r);case rd.NONE:return r&&function(e){for(let t=0;t<e.length;t++){const r=e[t];e[t]=r>>1n^-(1n&r)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(pd(e,t,r.numValues),r,i)}function Od(e,t,r,i){const n=pd(e,t,r.numValues);if(1===n.length){const e=n[0];return i?yd(e):e}return i?function(e){return yd(e[1])}(n):function(e){return e[1]}(n)}function Ld(e,t,r,i,n){return function(e,t,r,i){switch(t.logicalLevelTechnique1){case rd.DELTA:return t.logicalLevelTechnique2===rd.RLE&&(e=vd(e,t.runs,t.numRleValues)),function(e,t){const r=new Int32Array(e.size());let i=0;e.get(0)?(r[0]=e.get(0)?t[0]>>>1^-(1&t[0]):0,i=1):r[0]=0;let n=1;for(;n!=r.length;++n)r[n]=e.get(n)?r[n-1]+(t[i]>>>1^-(1&t[i++])):r[n-1];return r}(i,e);case rd.RLE:return function(e,t,r,i){const n=t;return r?function(e,t,r){const i=new Int32Array(e.size());let n=0;for(let o=0;o<r;o++){const a=t[o];let s=t[o+r];s=s>>>1^-(1&s);for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0,n++);n+=a}return i}(i,e,n.runs):function(e,t,r){const i=new Int32Array(e.size());let n=0;for(let o=0;o<r;o++){const a=t[o],s=t[o+r];for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0,n++);n+=a}return i}(i,e,n.runs)}(e,t,r,i);case rd.MORTON:return wd(e),e;case rd.COMPONENTWISE_DELTA:return Td(e),e;case rd.NONE:return e=r?function(e,t){const r=new Int32Array(e.size());let i=0,n=0;for(;n!=r.length;++n)if(e.get(n)){const e=t[i++];r[n]=e>>>1^-(1&e)}else r[n]=0;return r}(i,e):function(e,t){const r=new Int32Array(e.size());let i=0,n=0;for(;n!=r.length;++n)r[n]=e.get(n)?t[i++]:0;return r}(i,e),e;default:throw new Error("The specified Logical level technique is not supported")}}(r.physicalLevelTechnique===id.FAST_PFOR?md():dd(e,t,r.numValues),r,i,n)}function Fd(e,t,r,i){const n=e.logicalLevelTechnique1;if(n===rd.RLE)return 1===e.runs?ld.CONST:ld.FLAT;const o=t instanceof Id?t.size():t;if(n===rd.DELTA&&e.logicalLevelTechnique2===rd.RLE){const t=e.runs,n=2;if(e.numRleValues!==o)return ld.FLAT;if(1===t)return ld.SEQUENCE;if(2===t){const t=i.get();let o;if(e.physicalLevelTechnique===id.VARINT)o=dd(r,i,4);else{const e=i.get();o=new Int32Array(r.buffer,r.byteOffset+e,4)}if(i.set(t),o[2]===n&&o[3]===n)return ld.SEQUENCE}}return 1===e.numValues?ld.CONST:ld.FLAT}class zd extends Hh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Bd extends Yh{constructor(e,t,r,i){super(e,BigInt64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Nd{_geometryOffsets;_partOffsets;_ringOffsets;constructor(e,t,r){this._geometryOffsets=e,this._partOffsets=t,this._ringOffsets=r}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function jd(e,t,r){return{x:Vd(e,t)-r,y:Vd(e>>1,t)-r}}function Vd(e,t){let r=0;for(let i=0;i<t;i++)r|=(e&1<<2*i)>>i;return r}!function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"}(cd||(cd={})),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(ud||(ud={})),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(hd||(hd={}));class Ud{createPoint(e){return[[e]]}createMultiPoint(e){return e.map(e=>[e])}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,t){return[e].concat(t)}createMultiPolygon(e){return e.flat()}}function Gd(e){const t=new Array(e.numGeometries);let i=1,n=1,o=1,a=0;const s=new Ud;let l=0,c=0;const u=e.mortonSettings,h=e.topologyVector,d=h.geometryOffsets,p=h.partOffsets,f=h.ringOffsets,m=e.vertexOffsets,g=e.containsPolygonGeometry(),y=e.vertexBuffer;for(let _=0;_<e.numGeometries;_++){const h=e.geometryType(_);if(h===cd.POINT){if(m&&0!==m.length)if(e.vertexBufferType===hd.VEC_2){const e=2*m[c++],i=new r(y[e],y[e+1]);t[a++]=s.createPoint(i)}else{const e=jd(y[m[c++]],u.numBits,u.coordinateShift),i=new r(e.x,e.y);t[a++]=s.createPoint(i)}else{const e=new r(y[l++],y[l++]);t[a++]=s.createPoint(e)}d&&o++,p&&i++,f&&n++}else if(h===cd.MULTIPOINT){const e=d[o]-d[o-1];o++;const i=new Array(e);if(m&&0!==m.length){for(let t=0;t<e;t++){const e=2*m[c++];i[t]=new r(y[e],y[e+1])}t[a++]=s.createMultiPoint(i)}else{for(let t=0;t<e;t++){const e=y[l++],n=y[l++];i[t]=new r(e,n)}t[a++]=s.createMultiPoint(i)}}else if(h===cd.LINESTRING){let r,h=0;g?(h=f[n]-f[n-1],n++):h=p[i]-p[i-1],i++,m&&0!==m.length?(r=e.vertexBufferType===hd.VEC_2?Hd(y,m,c,h,!1):Xd(y,m,c,h,!1,u),c+=h):(r=Zd(y,l,h,!1),l+=2*h),t[a++]=s.createLineString(r),d&&o++}else if(h===cd.POLYGON){const r=p[i]-p[i-1];i++;const h=new Array(r-1);let g=f[n]-f[n-1];if(n++,m&&0!==m.length){const r=e.vertexBufferType===hd.VEC_2?$d(y,m,c,g):Wd(y,m,c,g,0,u);c+=g;for(let t=0;t<h.length;t++)g=f[n]-f[n-1],n++,h[t]=e.vertexBufferType===hd.VEC_2?$d(y,m,c,g):Wd(y,m,c,g,0,u),c+=g;t[a++]=s.createPolygon(r,h)}else{const e=qd(y,l,g);l+=2*g;for(let t=0;t<h.length;t++)g=f[n]-f[n-1],n++,h[t]=qd(y,l,g),l+=2*g;t[a++]=s.createPolygon(e,h)}d&&o++}else if(h===cd.MULTILINESTRING){const r=d[o]-d[o-1];o++;const h=new Array(r);if(m&&0!==m.length){for(let t=0;t<r;t++){let r=0;g?(r=f[n]-f[n-1],n++):r=p[i]-p[i-1],i++;const o=e.vertexBufferType===hd.VEC_2?Hd(y,m,c,r,!1):Xd(y,m,c,r,!1,u);h[t]=o,c+=r}t[a++]=s.createMultiLineString(h)}else{for(let e=0;e<r;e++){let t=0;g?(t=f[n]-f[n-1],n++):t=p[i]-p[i-1],i++,h[e]=Zd(y,l,t,!1),l+=2*t}t[a++]=s.createMultiLineString(h)}}else{if(h!==cd.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const r=d[o]-d[o-1];o++;const h=new Array(r);let g=0;if(m&&0!==m.length){for(let t=0;t<r;t++){const r=p[i]-p[i-1];i++;const o=new Array(r-1);g=f[n]-f[n-1],n++;const a=e.vertexBufferType===hd.VEC_2?$d(y,m,c,g):Wd(y,m,c,g,0,u);c+=g;for(let t=0;t<o.length;t++)g=f[n]-f[n-1],n++,o[t]=e.vertexBufferType===hd.VEC_2?$d(y,m,c,g):Wd(y,m,c,g,0,u),c+=g;h[t]=s.createPolygon(a,o)}t[a++]=s.createMultiPolygon(h)}else{for(let e=0;e<r;e++){const t=p[i]-p[i-1];i++;const r=new Array(t-1);g=f[n]-f[n-1],n++;const o=qd(y,l,g);l+=2*g;for(let e=0;e<r.length;e++){const t=f[n]-f[n-1];n++,r[e]=qd(y,l,t),l+=2*t}h[e]=s.createPolygon(o,r)}t[a++]=s.createMultiPolygon(h)}}}}return t}function qd(e,t,r){return Zd(e,t,r,!0)}function $d(e,t,r,i){return Hd(e,t,r,i,!0)}function Wd(e,t,r,i,n,o){return Xd(e,t,r,i,!0,o)}function Zd(e,t,i,n){const o=new Array(n?i+1:i);for(let a=0;a<2*i;a+=2)o[a/2]=new r(e[t+a],e[t+a+1]);return n&&(o[o.length-1]=o[0]),o}function Hd(e,t,i,n,o){const a=new Array(o?n+1:n);for(let s=0;s<2*n;s+=2){const n=2*t[i+s/2];a[s/2]=new r(e[n],e[n+1])}return o&&(a[a.length-1]=a[0]),a}function Xd(e,t,i,n,o,a){const s=new Array(o?n+1:n);for(let l=0;l<n;l++){const n=jd(e[t[i+l]],a.numBits,a.coordinateShift);s[l]=new r(n.x,n.y)}return o&&(s[s.length-1]=s[0]),s}class Kd{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(e,t,r,i,n){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=Gd(this);let t=0;for(;t<this.numGeometries;)yield{coordinates:e[t],type:this.geometryType(t)},t++}getSimpleEncodedVertex(e){const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const t=jd(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return Gd(this)}get mortonSettings(){return this._mortonSettings}}class Yd extends Kd{_numGeometries;_geometryType;constructor(e,t,r,i,n,o,a){super(r,i,n,o,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===cd.POLYGON||this._geometryType===cd.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class Jd extends Kd{_geometryTypes;constructor(e,t,r,i,n,o){super(e,r,i,n,o),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===cd.POLYGON||this.geometryType(e)===cd.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Qd{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,i=t.partOffsets,n=t.ringOffsets,o=t.geometryOffsets;let a=0,s=1,l=1,c=1;for(let u=0;u<this.numGeometries;u++)switch(this.geometryType(u)){case cd.POLYGON:{const t=i[s]-i[s-1];s++;const h=[];for(let e=0;e<t;e++){const e=n[l]-n[l-1];l++;const t=[];for(let i=0;i<e;i++){const e=this._vertexBuffer[a++],i=this._vertexBuffer[a++];t.push(new r(e,i))}t.length>0&&t.push(t[0]),h.push(t)}e[u]=h,o&&c++}break;case cd.MULTIPOLYGON:{const t=o[c]-o[c-1];c++;const h=[];for(let e=0;e<t;e++){const e=i[s]-i[s-1];s++;for(let t=0;t<e;t++){const e=n[l]-n[l-1];l++;const t=[];for(let i=0;i<e;i++){const e=this._vertexBuffer[a++],i=this._vertexBuffer[a++];t.push(new r(e,i))}t.length>0&&t.push(t[0]),h.push(t)}}e[u]=h}}return e}[Symbol.iterator](){return null}}function ep(e,t,r,i,n,o){return new tp(e,t,r,i,n,o)}class tp extends Qd{_numGeometries;_geometryType;constructor(e,t,r,i,n,o){super(r,i,n,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function rp(e,t,r,i,n){return new ip(e,t,r,i,n)}class ip extends Qd{_geometryTypes;constructor(e,t,r,i,n){super(t,r,i,n),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function np(e,t,r,i,n){const o=Ed(e,r);let a=null,s=null,l=null,c=null,u=null,h=null,d=null,p=null;if(Fd(o,i,e,r)===ld.CONST){const n=Cd(e,r,o,!1);for(let i=0;i<t-1;i++){const t=Ed(e,r);switch(t.physicalStreamType){case nd.LENGTH:switch(t.logicalStreamType.lengthType){case sd.GEOMETRIES:a=kd(e,r,t);break;case sd.PARTS:s=kd(e,r,t);break;case sd.RINGS:l=kd(e,r,t);break;case sd.TRIANGLES:d=kd(e,r,t)}break;case nd.OFFSET:switch(t.logicalStreamType.offsetType){case ad.VERTEX:c=Pd(e,r,t,!1);break;case ad.INDEX:p=Pd(e,r,t,!1)}break;case nd.DATA:od.VERTEX===t.logicalStreamType.dictionaryType?u=Pd(e,r,t,!0):(h={numBits:t.numBits,coordinateShift:t.coordinateShift},u=Pd(e,r,t,!1))}}return null!==p?null!=a||null!=s?ep(i,n,d,p,u,new Nd(a,s,l)):ep(i,n,d,p,u):null===h?function(e,t,r,i,n){return new Yd(e,t,hd.VEC_2,r,i,n)}(i,n,new Nd(a,s,l),c,u):function(e,t,r,i,n,o){return new Yd(e,t,hd.MORTON,r,i,n,o)}(i,n,new Nd(a,s,l),c,u,h)}const f=Pd(e,r,o,!1);for(let m=0;m<t-1;m++){const t=Ed(e,r);switch(t.physicalStreamType){case nd.LENGTH:switch(t.logicalStreamType.lengthType){case sd.GEOMETRIES:a=Pd(e,r,t,!1);break;case sd.PARTS:s=Pd(e,r,t,!1);break;case sd.RINGS:l=Pd(e,r,t,!1);break;case sd.TRIANGLES:d=kd(e,r,t)}break;case nd.OFFSET:switch(t.logicalStreamType.offsetType){case ad.VERTEX:c=Pd(e,r,t,!1);break;case ad.INDEX:p=Pd(e,r,t,!1)}break;case nd.DATA:od.VERTEX===t.logicalStreamType.dictionaryType?u=Pd(e,r,t,!0):(h={numBits:t.numBits,coordinateShift:t.coordinateShift},u=Pd(e,r,t,!1))}}return null!==p&&null===s?rp(f,d,p,u):(null!==a?(a=op(f,a,2),null!==s&&null!==l?(s=ap(f,a,s,!1),l=function(e,t,r,i){const n=new Int32Array(r[r.length-1]+1);let o=0;n[0]=o;let a=1,s=1,l=0;for(let c=0;c<e.length;c++){const u=e[c],h=t[c+1]-t[c];if(0!==u&&3!==u)for(let e=0;e<h;e++){const e=r[a]-r[a-1];a++;for(let t=0;t<e;t++)o=n[s++]=o+i[l++]}else for(let e=0;e<h;e++)n[s++]=++o,a++}return n}(f,a,s,l)):null!==s&&(s=function(e,t,r){const i=new Int32Array(t[t.length-1]+1);let n=0;i[0]=n;let o=1,a=0;for(let s=0;s<e.length;s++){const l=e[s],c=t[s+1]-t[s];if(4===l||1===l)for(let e=0;e<c;e++)n=i[o++]=n+r[a++];else for(let e=0;e<c;e++)i[o++]=++n}return i}(f,a,s))):null!==s&&null!==l?(s=op(f,s,1),l=ap(f,s,l,!0)):null!==s&&(s=op(f,s,0)),null!==p?rp(f,d,p,u,new Nd(a,s,l)):null===h?function(e,t,r,i){return new Jd(hd.VEC_2,e,t,r,i)}(f,new Nd(a,s,l),c,u):function(e,t,r,i,n){return new Jd(hd.MORTON,e,t,r,i,n)}(f,new Nd(a,s,l),c,u,h))}function op(e,t,r){const i=new Int32Array(e.length+1);let n=0;i[0]=n;let o=0;for(let a=0;a<e.length;a++)n=i[a+1]=n+(e[a]>r?t[o++]:1);return i}function ap(e,t,r,i){const n=new Int32Array(t[t.length-1]+1);let o=0;n[0]=o;let a=1,s=0;for(let l=0;l<e.length;l++){const c=e[l],u=t[l+1]-t[l];if(5===c||2===c||i&&(4===c||1===c))for(let e=0;e<u;e++)o=n[a++]=o+r[s++];else for(let e=0;e<u;e++)n[a++]=++o}return n}class sp extends Zh{dataVector;constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class lp extends Hh{getValueFromBuffer(e){return this.dataBuffer[e]}}class cp extends Zh{constructor(e,t,r){super(e,BigInt64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}function up(e,t,r){return hp(e,Math.ceil(t/8),r)}function hp(e,t,r){const i=new Uint8Array(t);let n=0;for(;n<t;){const t=e[r.increment()];if(t<=127){const o=t+3,a=e[r.increment()],s=n+o;i.fill(a,n,s),n=s}else{const o=256-t;for(let t=0;t<o;t++)i[n++]=e[r.increment()]}}return i}const dp=new TextDecoder;function pp(e,t,r){return r-t>=12?dp.decode(e.subarray(t,r)):function(e,t,r){let i="",n=t;for(;n<r;){const t=e[n];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>r)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(e,t,r)}class fp extends Zh{offsetBuffer;constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}}class mp extends fp{textEncoder;constructor(e,t,r,i){super(e,t,r,i??t.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(e){return pp(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class gp extends fp{indexBuffer;textEncoder;constructor(e,t,r,i,n){super(e,r,i,n??t.length),this.indexBuffer=t,this.indexBuffer=t,this.textEncoder=new TextEncoder}getValueFromBuffer(e){const t=this.indexBuffer[e];return pp(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class yp extends fp{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(e,t,r,i,n,o,a){super(e,r,i,a),this.indexBuffer=t,this.symbolOffsetBuffer=n,this.symbolTableBuffer=o,this.textEncoder=new TextEncoder}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(e,t,r){const i=[],n=new Array(t.length).fill(0);for(let o=1;o<t.length;o++)n[o]=n[o-1]+t[o-1];for(let o=0;o<r.length;o++)if(255===r[o])i.push(r[++o]);else{const a=t[r[o]],s=n[r[o]];for(let t=0;t<a;t++)i.push(e[s+t])}return new Uint8Array(i)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e];return pp(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let r=e[0];for(let i=1;i<e.length;i++){const n=e[i];t[i-1]=n-r,r=n}return t}}function _p(e,t,r,i,n,o){return"scalarType"===r.type?function(e,t,r,i,n,o){let a=null,s=0;if(0===e)return null;if(o.nullable){const e=Ed(t,r);s=e.numValues;const i=r.get(),n=up(t,s,r);r.set(i+e.byteLength),a=new Id(n,e.numValues)}const l=a??i;switch(n.physicalType){case 4:case 3:return function(e,t,r,i,n){const o=Ed(e,t),a=Fd(o,n,e,t),s=3===i.physicalType;if(a===ld.FLAT){const i=vp(n)?Ld(e,t,o,s,n):Pd(e,t,o,s);return new Xh(r.name,i,n)}if(a===ld.SEQUENCE){const i=Md(e,t,o);return new Jh(r.name,i[0],i[1],o.numRleValues)}{const i=Cd(e,t,o,s);return new Qh(r.name,i,n)}}(t,r,o,n,l);case 9:return function(e,t,r,i,n){let o=null,a=null,s=null,l=null,c=null,u=null,h=null,d=null;for(let p=0;p<i;p++){const e=Ed(t,r);if(0!==e.byteLength)switch(e.physicalStreamType){case nd.PRESENT:{const i=up(t,e.numValues,r);u=new Id(i,e.numValues);break}case nd.OFFSET:a=null!=n||null!=u?Ld(t,r,e,!1,n??u):Pd(t,r,e,!1);break;case nd.LENGTH:{const i=kd(t,r,e);sd.DICTIONARY===e.logicalStreamType.lengthType?o=i:sd.SYMBOL===e.logicalStreamType.lengthType?l=i:h=i;break}case nd.DATA:{const i=t.subarray(r.get(),r.get()+e.byteLength);r.add(e.byteLength);const n=e.logicalStreamType.dictionaryType;od.FSST===n?c=i:od.SINGLE===n||od.SHARED===n?s=i:od.NONE===n&&(d=i);break}}}return function(e,t,r,i,n,o,a){return t?new yp(e,r,i,n,o,t,a):null}(e,c,a,o,s,l,n??u)??function(e,t,r,i,n){return t?n?new gp(e,r,i,t,n):new gp(e,r,i,t):null}(e,s,a,o,n??u)??function(e,t,r,i,n){if(!t||!r)return null;if(i)return n?new gp(e,i,t,r,n):new gp(e,i,t,r);if(n&&n.size()!==t.length-1){const i=new Int32Array(n.size());let o=0;for(let e=0;e<n.size();e++)i[e]=n.get(e)?o++:0;return new gp(e,i,t,r,n)}return n?new mp(e,t,r,n):new mp(e,t,r)}(e,h,d,a,n??u)}(o.name,t,r,o.nullable?e-1:e,a);case 0:return function(e,t,r,i,n){const o=Ed(e,t),a=o.numValues,s=t.get(),l=vp(n)?function(e,t,r,i){const n=hp(e,Math.ceil(t/8),r),o=new Id(n,t),a=i.size(),s=new Id(new Uint8Array(a),a);let l=0;for(let c=0;c<i.size();c++){const e=!!i.get(c)&&o.get(l++);s.set(c,e)}return s.getBuffer()}(e,a,t,n):up(e,a,t);t.set(s+o.byteLength);const c=new Id(l,a);return new sp(r.name,c,n)}(t,r,o,0,l);case 6:case 5:return function(e,t,r,i,n){const o=Ed(e,t),a=Fd(o,i,e,t),s=5===n.physicalType;if(a===ld.FLAT){const n=vp(i)?function(e,t,r,i,n){return function(e,t,r,i){switch(t.logicalLevelTechnique1){case rd.DELTA:return t.logicalLevelTechnique2===rd.RLE&&(e=bd(e,t.runs,t.numRleValues)),function(e,t){const r=new BigInt64Array(e.size());let i=0;e.get(0)?(r[0]=e.get(0)?t[0]>>1n^-(1n&t[0]):0n,i=1):r[0]=0n;let n=1;for(;n!=r.length;++n)r[n]=e.get(n)?r[n-1]+(t[i]>>1n^-(1n&t[i++])):r[n-1];return r}(i,e);case rd.RLE:return function(e,t,r,i){const n=t;return r?function(e,t,r){const i=new BigInt64Array(e.size());let n=0;for(let o=0;o<r;o++){const a=Number(t[o]);let s=t[o+r];s=s>>1n^-(1n&s);for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0n,n++);n+=a}return i}(i,e,n.runs):function(e,t,r){const i=new BigInt64Array(e.size());let n=0;for(let o=0;o<r;o++){const a=Number(t[o]),s=t[o+r];for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0n,n++);n+=a}return i}(i,e,n.runs)}(e,t,r,i);case rd.NONE:return e=r?function(e,t){const r=new BigInt64Array(e.size());let i=0,n=0;for(;n!=r.length;++n)if(e.get(n)){const e=t[i++];r[n]=e>>1n^-(1n&e)}else r[n]=0n;return r}(i,e):function(e,t){const r=new BigInt64Array(e.size());let i=0,n=0;for(;n!=r.length;++n)r[n]=e.get(n)?t[i++]:0n;return r}(i,e),e;default:throw new Error("The specified Logical level technique is not supported")}}(pd(e,t,r.numValues),r,i,n)}(e,t,o,s,i):Rd(e,t,o,s);return new zd(r.name,n,i)}if(a===ld.SEQUENCE){const i=Dd(e,t,o);return new Bd(r.name,i[0],i[1],o.numRleValues)}{const n=Od(e,t,o,s);return new cp(r.name,n,i)}}(t,r,o,l,n);case 7:return function(e,t,r,i){const n=Ed(e,t),o=vp(i)?function(e,t,r,i){const n=t.get(),o=n+i*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(e.subarray(n,o)).buffer,s=new Float32Array(a);t.set(o);const l=r.size(),c=new Float32Array(l);let u=0;for(let h=0;h<l;h++)c[h]=r.get(h)?s[u++]:0;return c}(e,t,i,n.numValues):function(e,t,r){const i=t.get(),n=i+r*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,n)).buffer,a=new Float32Array(o);return t.set(n),a}(e,t,n.numValues);return new lp(r.name,o,i)}(t,r,o,l);case 8:return function(e,t,r,i){const n=Ed(e,t),o=vp(i)?function(e,t,r,i){const n=t.get(),o=n+i*Float64Array.BYTES_PER_ELEMENT,a=new Uint8Array(e.subarray(n,o)).buffer,s=new Float64Array(a);t.set(o);const l=r.size(),c=new Float64Array(l);let u=0;for(let h=0;h<l;h++)c[h]=r.get(h)?s[u++]:0;return c}(e,t,i,n.numValues):function(e,t,r){const i=t.get(),n=i+r*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,n)).buffer,a=new Float64Array(o);return t.set(n),a}(e,t,n.numValues);return new Kh(r.name,o,i)}(t,r,o,l);default:throw new Error(`The specified data type for the field is currently not supported: ${n}`)}}(i,e,t,n,r.scalarType,r):1!=i?null:function(e,t,r,i){let n=null,o=null,a=null,s=null,l=!1;for(;!l;){const r=Ed(e,t);switch(r.physicalStreamType){case nd.LENGTH:sd.DICTIONARY===r.logicalStreamType.lengthType?n=kd(e,t,r):a=kd(e,t,r);break;case nd.DATA:od.SINGLE===r.logicalStreamType.dictionaryType||od.SHARED===r.logicalStreamType.dictionaryType?(o=e.subarray(t.get(),t.get()+r.byteLength),l=!0):s=e.subarray(t.get(),t.get()+r.byteLength),t.add(r.byteLength)}}const c=r.complexType.children,u=[];let h=0;for(const d of c){const l=dd(e,t,1)[0];if(0==l)continue;const c=`${r.name}${"default"===d.name?"":":"+d.name}`;if(2!==l||"scalarField"!==d.type||9!==d.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const p=Ed(e,t),f=up(e,p.numValues,t),m=Ed(e,t),g=m.decompressedCount!==i?Ld(e,t,m,!1,new Id(f,p.numValues)):Pd(e,t,m,!1);u[h++]=s?new yp(c,g,n,o,a,s,new Id(f,p.numValues)):new gp(c,g,n,o,new Id(f,p.numValues))}return u}(e,t,r,n)}function vp(e){return e instanceof Id}function bp(e){if("id"===e.name)return!1;if("scalarType"===e.type){const t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if("logicalType"===t.type)return!1}else if("complexType"===e.type){const t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}const xp=new TextDecoder;function wp(e,t){const r=dd(e,t,1)[0];if(0===r)return"";const i=t.get(),n=e.subarray(i,i+r);return t.add(r),xp.decode(n)}function Tp(e,t){const r=dd(e,t,1)[0]>>>0,i=!!(4&r),n=!!(2&r),o=dd(e,t,1)[0]>>>0,a={};if(1&r&&(a.nullable=!0),n){const n={};if(i?(n.type="logicalType",n.logicalType=o):(n.type="physicalType",n.physicalType=o),8&r){const r=dd(e,t,1)[0]>>>0;n.children=new Array(r);for(let i=0;i<r;i++)n.children[i]=Tp(e,t)}a.type="complexField",a.complexField=n}else{const e={};i?(e.type="logicalType",e.logicalType=o):(e.type="physicalType",e.physicalType=o),a.type="scalarField",a.scalarField=e}return a}function Sp(e,t){const r=dd(e,t,1)[0]>>>0,i=function(e){switch(e){case 0:case 1:case 2:case 3:{const t={};t.nullable=!!(1&e),t.columnScope=0;const r={};return r.physicalType=e>1?6:4,r.type="physicalType",t.scalarType=r,t.type="scalarType",t}case 4:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=t,e}case 30:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=t,e}default:return function(e){let t=null;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}const r={};r.nullable=!!(1&e),r.columnScope=0;const i={type:"physicalType"};return i.physicalType=t,r.type="scalarType",r.scalarType=i,r}(e)}}(r);if(!i)throw new Error(`Unsupported column type code: ${r}`);if(function(e){return e>=10}(r)?i.name=wp(e,t):r>=0&&r<=3?i.name="id":4===r&&(i.name="geometry"),function(e){return 30===e}(r)){const r=dd(e,t,1)[0]>>>0,n=i.complexType;n.children=new Array(r);for(let i=0;i<r;i++)n.children[i]=Tp(e,t)}return i}function Ep(e,t){const r={featureTables:[]},i={};i.name=wp(e,t);const n=dd(e,t,1)[0]>>>0,o=dd(e,t,1)[0]>>>0;i.columns=new Array(o);for(let a=0;a<o;a++)i.columns[a]=Sp(e,t);return r.featureTables.push(i),[r,n]}function Ip(e,t,r,i,n,o,a=!1){const s=t.scalarType.physicalType,l=Fd(n,o,e,r);if(4===s)switch(l){case ld.FLAT:{const t=Pd(e,r,n,!1);return new Xh(i,t,o)}case ld.SEQUENCE:{const t=Md(e,r,n);return new Jh(i,t[0],t[1],n.numRleValues)}case ld.CONST:{const t=Cd(e,r,n,!1);return new Qh(i,t,o)}}else switch(l){case ld.FLAT:{if(a){const t=function(e,t,r){const i=function(e,t,r){const i=new Float64Array(t);for(let n=0;n<t;n++)i[n]=fd(e,r);return i}(e,r.numValues,t);return function(e,t){switch(t.logicalLevelTechnique1){case rd.DELTA:return t.logicalLevelTechnique2===rd.RLE&&(e=xd(e,t.runs,t.numRleValues)),function(e){e[0]=e[0]%2==1?(e[0]+1)/-2:e[0]/2;const t=e.length/4*4;let r=1;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t%2==1?(t+1)/-2:t/2)+e[r-1],e[r+1]=(i%2==1?(i+1)/-2:i/2)+e[r],e[r+2]=(n%2==1?(n+1)/-2:n/2)+e[r+1],e[r+3]=(o%2==1?(o+1)/-2:o/2)+e[r+2]}for(;r!=e.length;++r)e[r]=(e[r]%2==1?(e[r]+1)/-2:e[r]/2)+e[r-1]}(e),e;case rd.RLE:return function(e,t){return xd(e,t.runs,t.numRleValues)}(e,t);case rd.NONE:return e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(i,r)}(e,r,n);return new Kh(i,t,o)}const t=Rd(e,r,n,!1);return new zd(i,t,o)}case ld.SEQUENCE:{const t=Dd(e,r,n);return new Bd(i,t[0],t[1],n.numRleValues)}case ld.CONST:{const t=Od(e,r,n,!1);return new cp(i,t,o)}}throw new Error("Vector type not supported for id column.")}class Pp{constructor(e,t){var r;switch(this._featureData=e,this.properties=this._featureData.properties||{},null===(r=this._featureData.geometry)||void 0===r?void 0:r.type){case cd.POINT:case cd.MULTIPOINT:this.type=1;break;case cd.LINESTRING:case cd.MULTILINESTRING:this.type=2;break;case cd.POLYGON:case cd.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const i=[];for(const e of t)i.push(new r(e.x,e.y));e.push(i)}return e}}class kp{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Pp(this.features[e],this.extent)}}class Ap{constructor(e){this.layers={};const t=function(e,t,r=!0){const i=new td(0),n=[];for(;i.get()<e.length;){const t=dd(e,i,1)[0]>>>0,o=i.get()+t;if(o>e.length)throw new Error(`Block overruns tile: ${o} > ${e.length}`);if(1!=dd(e,i,1)[0]>>>0){i.set(o);continue}const a=Ep(e,i),s=a[1],l=a[0].featureTables[0];let c=null,u=null;const h=[];let d=0;for(const n of l.columns){const t=n.name;if("id"===t){let o=null;if(n.nullable){const t=Ed(e,i),r=i.get(),n=up(e,t.numValues,i);i.set(r+t.byteLength),o=new Id(n,t.numValues)}const a=Ed(e,i);d=a.decompressedCount,c=Ip(e,n,i,t,a,o??d,r)}else if("geometry"===t){const t=dd(e,i,1)[0];if(0===d){const t=i.get();d=Ed(e,i).decompressedCount,i.set(t)}u=np(e,t,i,d)}else{const t=bp(n)?dd(e,i,1)[0]:1;if(0===t&&"scalarType"===n.type)continue;const r=_p(e,i,n,t,d);if(r)if(Array.isArray(r))for(const e of r)h.push(e);else h.push(r)}}const p=new ed(l.name,u,c,h,s);n.push(p),i.set(o)}return n}(new Uint8Array(e));this.layers=t.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new kp(t)}),{})}}class Cp{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"!=typeof e.id||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of t){const t=[];for(const e of i)t.push(new r(e[0],e[1]));e.push(t)}return e}}const Mp="_geojsonTileLayer";function Dp(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);const r={keys:[],values:[],keycache:{},valuecache:{}};for(let o=0;o<e.length;o++)r.feature=e.feature(o),t.writeMessage(2,Rp,r);const i=r.keys;for(const o of i)t.writeStringField(3,o);const n=r.values;for(const o of n)t.writeMessage(4,Bp,o)}function Rp(e,t){if(!e.feature)return;const r=e.feature;void 0!==r.id&&t.writeVarintField(1,r.id),t.writeMessage(2,Op,e),t.writeVarintField(3,r.type),t.writeMessage(4,zp,r)}function Op(e,t){for(const r in e.feature?.properties){let i=e.feature.properties[r],n=e.keycache[r];if(null==i)continue;void 0===n&&(e.keys.push(r),n=e.keys.length-1,e.keycache[r]=n),t.writeVarint(n),"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i&&(i=JSON.stringify(i));const o=typeof i+":"+i;let a=e.valuecache[o];void 0===a&&(e.values.push(i),a=e.values.length-1,e.valuecache[o]=a),t.writeVarint(a)}}function Lp(e,t){return(t<<3)+(7&e)}function Fp(e){return e<<1^e>>31}function zp(e,t){const r=e.loadGeometry(),i=e.type;let n=0,o=0;for(const a of r){let r=1;1===i&&(r=a.length),t.writeVarint(Lp(1,r));const s=3===i?a.length-1:a.length;for(let e=0;e<s;e++){1===e&&1!==i&&t.writeVarint(Lp(2,s-1));const r=a[e].x-n,l=a[e].y-o;t.writeVarint(Fp(r)),t.writeVarint(Fp(l)),n+=r,o+=l}3===e.type&&t.writeVarint(Lp(7,1))}}function Bp(e,t){const r=typeof e;"string"===r?t.writeStringField(1,e):"boolean"===r?t.writeBooleanField(7,e):"number"===r&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}class Np{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new uo(A,16,0),this.grid3D=new uo(A,16,0),this.featureIndexArray=new Va,this.promoteId=t}insert(e,t,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<t.length;l++){const e=t[l],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<e.length;t++){const i=e[t];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]<A&&r[1]<A&&r[2]>=0&&r[3]>=0&&s.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Lc(new Pu(this.rawTileData)).layers:new Ap(this.rawTileData).layers,this.sourceLayerCoder=new $h(this.vtLayers?Object.keys(this.vtLayers).sort():[Mp])),this.vtLayers}query(e,t,i,n){this.loadVTLayers();const o=e.params,a=A/e.tileSize/e.scale,s=pn(o.filter,o.globalState),l=e.queryGeometry,c=e.queryPadding*a,u=qh.fromPoints(l),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=qh.fromPoints(e.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,(t,i,n,o)=>function(e,t,i,n,o){for(const r of e)if(t<=r.x&&i<=r.y&&n>=r.x&&o>=r.y)return!0;const a=[new r(t,i),new r(t,o),new r(n,o),new r(n,i)];if(e.length>2)for(const r of a)if(el(e,r))return!0;for(let r=0;r<e.length-1;r++)if(tl(e[r],e[r+1],a))return!0;return!1}(e.cameraQueryGeometry,t-c,i-c,n+c,o+c));for(const r of p)h.push(r);h.sort(Vp);const f={};let m;for(let r=0;r<h.length;r++){const c=h[r];if(c===m)continue;m=c;const u=this.featureIndexArray.get(c);let d=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,o.layers,o.availableImages,t,i,n,(t,r,i)=>(d||(d=js(t)),r.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:i,geometry:d,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}loadMatchingFeature(e,t,r,i,n,o,a,s,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some(e=>o.has(e)))return;const d=this.sourceLayerCoder.decode(r),p=this.vtLayers[d].feature(i);if(n.needGeometry){const e=Vs(p,!0);if(!n.filter(new Oo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new Oo(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let m=0;m<h.length;m++){const t=h[m];if(o&&!o.has(t))continue;const r=s[t];if(!r)continue;let n={};f&&c&&(n=c.getState(r.sourceLayer||Mp,f));const d=B({},l[t]);d.paint=jp(d.paint,r.paint,p,n,a),d.layout=jp(d.layout,r.layout,p,n,a);const g=!u||u(p,r,n);if(!g)continue;const y=new Wh(p,this.z,this.x,this.y,f);y.layer=d;let _=e[t];void 0===_&&(_=e[t]=[]),_.push({featureIndex:i,feature:y,intersectionZ:g})}}lookupSymbolFeatures(e,t,r,i,n,o,a,s){const l={};this.loadVTLayers();const c=pn(n.filterSpec,n.globalState);for(const u of e)this.loadMatchingFeature(l,r,i,u,c,o,a,s,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const r of t)if(e===r)return!0;return!1}getId(e,t){var r;let i=e.id;return this.promoteId&&(i=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof i&&(i=Number(i)),void 0===i&&(null===(r=e.properties)||void 0===r?void 0:r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))),i}}function jp(e,t,r,i,n){return j(e,(e,o)=>{const a=t instanceof qo?t.get(o):null;return a&&a.evaluate?a.evaluate(r,i,n):a})}function Vp(e,t){return t-e}function Up(e,t,i,n,o){const a=[];for(let s=0;s<e.length;s++){const l=e[s];let c;for(let e=0;e<l.length-1;e++){let s=l[e],u=l[e+1];s.x<t&&u.x<t||(s.x<t?s=new r(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<t&&(u=new r(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<i&&u.y<i||(s.y<i?s=new r(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y<i&&(u=new r(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),s.x>=n&&u.x>=n||(s.x>=n?s=new r(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=n&&(u=new r(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=o&&u.y>=o||(s.y>=o?s=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round():u.y>=o&&(u=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(u)))))}}return a}function Gp(e,t,r,i,n){switch(t){case 1:return function(e,t,r,i){const n=[];for(const o of e)for(const e of o){const o=0===i?e.x:e.y;o>=t&&o<=r&&n.push([e])}return n}(e,r,i,n);case 2:return $p(e,r,i,n,!1);case 3:return $p(e,r,i,n,!0)}return[]}function qp(e,t,i,n,o){const a=0===n?Wp:Zp;let s=[];const l=[];for(let r=0;r<e.length-1;r++){const c=e[r],u=e[r+1],h=0===n?c.x:c.y,d=0===n?u.x:u.y;let p=!1;h<t?d>t&&s.push(a(c,u,t)):h>i?d<i&&s.push(a(c,u,i)):s.push(c),d<t&&h>=t&&(s.push(a(c,u,t)),p=!0),d>i&&h<=i&&(s.push(a(c,u,i)),p=!0),!o&&p&&(l.push(s),s=[])}const c=e.length-1,u=0===n?e[c].x:e[c].y;return u>=t&&u<=i&&s.push(e[c]),o&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new r(s[0].x,s[0].y)),s.length>0&&l.push(s),l}function $p(e,t,r,i,n){const o=[];for(const a of e){const e=qp(a,t,r,i,n);e.length>0&&o.push(...e)}return o}function Wp(e,t,i){return new r(i,e.y+(i-e.x)/(t.x-e.x)*(t.y-e.y))}function Zp(e,t,i){return new r(e.x+(i-e.y)/(t.y-e.y)*(t.x-e.x),i)}po("FeatureIndex",Np,{omit:["rawTileData","sourceLayerCoder"]});class Hp extends r{constructor(e,t,r,i){super(e,t),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new Hp(this.x,this.y,this.angle,this.segment)}}function Xp(e,t,r,i,n){if(void 0===t.segment||0===r)return!0;let o=t,a=t.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;const l=[];let c=0;for(;s<r/2;){const t=e[a],r=e[a+1];if(!r)return!1;let o=e[a-1].angleTo(t)-t.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+=t.dist(r)}return!0}function Kp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Yp(e,t,r){return e?.6*t*r:0}function Jp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Qp(e,t,r,i,n,o){const a=Yp(r,n,o),s=Jp(r,i)*o;let l=0;const c=Kp(e)/2;for(let u=0;u<e.length-1;u++){const r=e[u],i=e[u+1],n=r.dist(i);if(l+n>c){const o=(c-l)/n,h=mr.number(r.x,i.x,o),d=mr.number(r.y,i.y,o),p=new Hp(h,d,i.angleTo(r),u);return p._round(),!a||Xp(e,p,s,a,t)?p:void 0}l+=n}}function ef(e,t,r,i,n,o,a,s,l){const c=Yp(i,o,a),u=Jp(i,n),h=u*a,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),tf(e,d?t/2*s%t:(u/2+2*o)*a*s%t,t,c,r,h,d,!1,l)}function tf(e,t,r,i,n,o,a,s,l){const c=o/2,u=Kp(e);let h=0,d=t-r,p=[];for(let f=0;f<e.length-1;f++){const t=e[f],a=e[f+1],s=t.dist(a),m=a.angleTo(t);for(;d+r<h+s;){d+=r;const g=(d-h)/s,y=mr.number(t.x,a.x,g),_=mr.number(t.y,a.y,g);if(y>=0&&y<l&&_>=0&&_<l&&d-c>=0&&d+c<=u){const t=new Hp(y,_,m,f);t._round(),i&&!Xp(e,t,o,i,n)||p.push(t)}}h+=s}return s||p.length||a||(p=tf(e,h/2,r,i,n,o,a,!0,l)),p}function rf(e,t,i,n){const o=[],a=e.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=a.stretchX||[[0,l]],d=a.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),m=d.reduce(p,0),g=l-f,y=c-m;let _=0,v=f,b=0,x=m,w=0,T=g,S=0,E=y;if(a.content&&n){const t=a.content,r=t[2]-t[0],i=t[3]-t[1];(a.textFitWidth||a.textFitHeight)&&(u=th(e)),_=nf(h,0,t[0]),b=nf(d,0,t[1]),v=nf(h,t[0],t[2]),x=nf(d,t[1],t[3]),w=t[0]-_,S=t[1]-b,T=r-v,E=i-x}const I=u.x1,P=u.y1,k=u.x2-I,A=u.y2-P,C=(e,n,o,l)=>{const c=af(e.stretch-_,v,k,I),u=sf(e.fixed-w,T,e.stretch,f),h=af(n.stretch-b,x,A,P),d=sf(n.fixed-S,E,n.stretch,m),p=af(o.stretch-_,v,k,I),g=sf(o.fixed-w,T,o.stretch,f),y=af(l.stretch-b,x,A,P),C=sf(l.fixed-S,E,l.stretch,m),M=new r(c,h),D=new r(p,h),R=new r(p,y),O=new r(c,y),L=new r(u/s,d/s),F=new r(g/s,C/s),z=t*Math.PI/180;if(z){const e=Math.sin(z),t=Math.cos(z),r=[t,-e,e,t];M._matMult(r),D._matMult(r),O._matMult(r),R._matMult(r)}const B=e.stretch+e.fixed,N=n.stretch+n.fixed;return{tl:M,tr:D,bl:O,br:R,tex:{x:a.paddedRect.x+1+B,y:a.paddedRect.y+1+N,w:o.stretch+o.fixed-B,h:l.stretch+l.fixed-N},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:F,minFontScaleX:T/s/k,minFontScaleY:E/s/A,isSDF:i}};if(n&&(a.stretchX||a.stretchY)){const e=of(h,g,f),t=of(d,y,m);for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)o.push(C(i,t[e],n,t[e+1]))}}else o.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function nf(e,t,r){let i=0;for(const n of e)i+=Math.max(t,Math.min(r,n[1]))-Math.max(t,Math.min(r,n[0]));return i}function of(e,t,r){const i=[{fixed:-1,stretch:0}];for(const[n,o]of e){const e=i[i.length-1];i.push({fixed:n-e.stretch,stretch:e.stretch}),i.push({fixed:n-e.stretch,stretch:e.stretch+(o-n)})}return i.push({fixed:t+1,stretch:r}),i}function af(e,t,r,i){return e/t*r+i}function sf(e,t,r,i){return e-t*r/i}po("Anchor",Hp);class lf{constructor(e,t,i,n,o,a,s,l,c,u){var h;if(this.boxStartIndex=e.length,c){let e=a.top,t=a.bottom;const r=a.collisionPadding;r&&(e-=r[1],t+=r[3]);let i=t-e;i>0&&(i=Math.max(10,i),this.circleDiameter=i)}else{const c=(null===(h=a.image)||void 0===h?void 0:h.content)&&(a.image.textFitWidth||a.image.textFitHeight)?th(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-l[0],c.y2=c.y2*s+l[2],c.x1=c.x1*s-l[3],c.x2=c.x2*s+l[1];const d=a.collisionPadding;if(d&&(c.x1-=d[0]*s,c.y1-=d[1]*s,c.x2+=d[2]*s,c.y2+=d[3]*s),u){const e=new r(c.x1,c.y1),t=new r(c.x2,c.y1),i=new r(c.x1,c.y2),n=new r(c.x2,c.y2),o=u*Math.PI/180;e._rotate(o),t._rotate(o),i._rotate(o),n._rotate(o),c.x1=Math.min(e.x,t.x,i.x,n.x),c.x2=Math.max(e.x,t.x,i.x,n.x),c.y1=Math.min(e.y,t.y,i.y,n.y),c.y2=Math.max(e.y,t.y,i.y,n.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,n,o)}this.boxEndIndex=e.length}}class cf{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(r(i,o)>=0)break;t[e]=o,e=n}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1);const o=i+1;if(o<this.length&&r(t[o],t[i])<0&&(i=o),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}}function uf(e,t=1,i=!1){const n=qh.fromPoints(e[0]),o=Math.min(n.width(),n.height());let a=o/2;const s=new cf([],hf),{minX:l,minY:c,maxX:u,maxY:h}=n;if(0===o)return new r(l,c);for(let r=l;r<u;r+=o)for(let t=c;t<h;t+=o)s.push(new df(r+a,t+a,a,e));let d=function(e){let t=0,r=0,i=0;const n=e[0];for(let o=0,a=n.length,s=a-1;o<a;s=o++){const e=n[o],a=n[s],l=e.x*a.y-a.x*e.y;r+=(e.x+a.x)*l,i+=(e.y+a.y)*l,t+=3*l}return new df(r/t,i/t,0,e)}(e),p=s.length;for(;s.length;){const r=s.pop();(r.d>d.d||!d.d)&&(d=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=t||(a=r.h/2,s.push(new df(r.p.x-a,r.p.y-a,a,e)),s.push(new df(r.p.x+a,r.p.y-a,a,e)),s.push(new df(r.p.x-a,r.p.y+a,a,e)),s.push(new df(r.p.x+a,r.p.y+a,a,e)),p+=4)}return i&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}function hf(e,t){return t.max-e.max}function df(e,t,i,n){this.p=new r(e,t),this.h=i,this.d=function(e,t){let r=!1,i=1/0;for(let n=0;n<t.length;n++){const o=t[n];for(let t=0,n=o.length,a=n-1;t<n;a=t++){const n=o[t],s=o[a];n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(r=!r),i=Math.min(i,Js(e,n,s))}}return(r?1:-1)*Math.sqrt(i)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var pf;e.aP=void 0,(pf=e.aP||(e.aP={}))[pf.center=1]="center",pf[pf.left=2]="left",pf[pf.right=3]="right",pf[pf.top=4]="top",pf[pf.bottom=5]="bottom",pf[pf["top-left"]=6]="top-left",pf[pf["top-right"]=7]="top-right",pf[pf["bottom-left"]=8]="bottom-left",pf[pf["bottom-right"]=9]="bottom-right";const ff=Number.POSITIVE_INFINITY;function mf(e,t){return t[1]!==ff?function(e,t,r){let i=0,n=0;switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":i=-t;break;case"top-left":case"bottom-left":case"left":i=t}return[i,n]}(e,t[0],t[1]):function(e,t){let r=0,i=0;t<0&&(t=0);const n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-t;break;case"top":i=t-7}switch(e){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=t;break;case"right":r=-t}return[r,i]}(e,t[0])}function gf(e,t,r){var i;const n=e.layout,o=null===(i=n.get("text-variable-anchor-offset"))||void 0===i?void 0:i.evaluate(t,{},r);if(o){const e=o.values,t=[];for(let r=0;r<e.length;r+=2){const i=t[r]=e[r],n=e[r+1].map(e=>e*fu);i.startsWith("top")?n[1]-=7:i.startsWith("bottom")&&(n[1]+=7),t[r+1]=n}return new zt(t)}const a=n.get("text-variable-anchor");if(a){let i;i=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},r)*fu,ff]:n.get("text-offset").evaluate(t,{},r).map(e=>e*fu);const o=[];for(const e of a)o.push(e,mf(e,i));return new zt(o)}return null}function yf(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function _f(t,r,i,n,o,a,s,l,c,u,h,d){let p=a.textMaxSize.evaluate(r,{});void 0===p&&(p=s);const f=t.layers[0].layout,m=f.get("icon-offset").evaluate(r,{},h),g=bf(i.horizontal),y=s/24,_=t.tilePixelRatio*y,v=t.tilePixelRatio*p/24,b=t.tilePixelRatio*l,x=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,T=function(e,t,r,i=1){const n=e.get("icon-padding").evaluate(t,{},r),o=n&&n.values;return[o[0]*i,o[1]*i,o[2]*i,o[3]*i]}(f,r,h,t.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,E="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),I="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 M;n&&"none"!==C&&(t.allowVerticalPlacement&&i.vertical&&(M=rh(n,i.vertical,C,f.get("icon-text-fit-padding"),m,y)),g&&(n=rh(n,g,C,f.get("icon-text-fit-padding"),m,y)));const D=h?d.line.getGranularityForZoomLevel(h.z):1,R=(l,d)=>{d.x<0||d.x>=A||d.y<0||d.y>=A||function(t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,S,E){const I=t.addToLineVertexArray(r,i);let P,k,A,C,M=0,D=0,R=0,O=0,L=-1,F=-1;const z={};let B=gs("");if(t.allowVerticalPlacement&&n.vertical){const e=l.layout.get("text-rotate").evaluate(x,{},S)+90;A=new lf(c,r,u,h,d,n.vertical,p,f,m,e),s&&(C=new lf(c,r,u,h,d,s,y,_,m,e))}if(o){const i=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),a=rf(o,i,T,n),p=s?rf(s,i,T,n):void 0;k=new lf(c,r,u,h,d,o,y,_,!1,i),M=4*a.length;const f=t.iconSizeData;let m=null;"source"===f.kind?(m=[ih*l.layout.get("icon-size").evaluate(x,{})],m[0]>nh&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[ih*w.compositeIconSizes[0].evaluate(x,{},S),ih*w.compositeIconSizes[1].evaluate(x,{},S)],(m[0]>nh||m[1]>nh)&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,m,b,v,x,e.az.none,r,I.lineStartIndex,I.lineLength,-1,S),L=t.icon.placedSymbolArray.length-1,p&&(D=4*p.length,t.addSymbols(t.icon,p,m,b,v,x,e.az.vertical,r,I.lineStartIndex,I.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1)}const N=Object.keys(n.horizontal);for(const q of N){const i=n.horizontal[q];if(!P){B=gs(i.text);const e=l.layout.get("text-rotate").evaluate(x,{},S);P=new lf(c,r,u,h,d,i,p,f,m,e)}const o=1===i.positionedLines.length;if(R+=vf(t,r,i,a,l,m,x,g,I,n.vertical?e.az.horizontal:e.az.horizontalOnly,o?N:[q],z,L,w,S),o)break}n.vertical&&(O+=vf(t,r,n.vertical,a,l,m,x,g,I,e.az.vertical,["vertical"],z,F,w,S));const j=P?P.boxStartIndex:t.collisionBoxArray.length,V=P?P.boxEndIndex:t.collisionBoxArray.length,U=A?A.boxStartIndex:t.collisionBoxArray.length,G=A?A.boxEndIndex:t.collisionBoxArray.length,$=k?k.boxStartIndex:t.collisionBoxArray.length,W=k?k.boxEndIndex:t.collisionBoxArray.length,Z=C?C.boxStartIndex:t.collisionBoxArray.length,H=C?C.boxEndIndex:t.collisionBoxArray.length;let X=-1;const K=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;X=K(P,X),X=K(A,X),X=K(k,X),X=K(C,X);const Y=X>-1?1:0;Y&&(X*=E/fu),t.glyphOffsetArray.length>=ph.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);const J=gf(l,x,S),[Q,ee]=function(t,r){const i=t.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];t.emplaceBack(e.aP[n[o]],r[0],r[1])}return[i,t.length]}(t.textAnchorOffsets,J);t.symbolInstances.emplaceBack(r.x,r.y,z.right>=0?z.right:-1,z.center>=0?z.center:-1,z.left>=0?z.left:-1,z.vertical||-1,L,F,B,j,V,U,G,$,W,Z,H,u,R,O,M,D,Y,0,p,X,Q,ee)}(t,d,l,i,n,o,M,t.layers[0],t.collisionBoxArray,r.index,r.sourceLayerIndex,t.index,_,[w,w,w,w],E,c,b,T,I,m,r,a,u,h,s)};if("line"===P)for(const e of Up(r.geometry,0,0,A,A)){const r=yc(e,D),o=ef(r,x,S,i.vertical||g,n,24,v,t.overscaling,A);for(const e of o)g&&xf(t,g.text,k,e)||R(r,e)}else if("line-center"===P){for(const e of r.geometry)if(e.length>1){const t=yc(e,D),r=Qp(t,S,i.vertical||g,n,24,v);r&&R(t,r)}}else if("Polygon"===r.type)for(const e of ei(r.geometry,0)){const t=uf(e,16);R(yc(e[0],D,!0),new Hp(t.x,t.y,0))}else if("LineString"===r.type)for(const e of r.geometry){const t=yc(e,D);R(t,new Hp(t[0].x,t[0].y,0))}else if("Point"===r.type)for(const e of r.geometry)for(const t of e)R([t],new Hp(t.x,t.y,0))}function vf(e,t,i,n,o,a,s,l,c,u,h,d,p,f,m){const g=function(e,t,i,n,o,a,s,l){const c=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(const h of t.positionedLines)for(const e of h.positionedGlyphs){if(!e.rect)continue;const n=e.rect||{};let a=4,d=!0,p=1,f=0;const m=(o||l)&&e.vertical,g=e.metrics.advance*e.scale/2;if(l&&t.verticalizable&&(f=h.lineOffset/2-(e.imageName?-(fu-e.metrics.width*e.scale)/2:(e.scale-1)*fu)),e.imageName){const t=s[e.imageName];d=t.sdf,p=t.pixelRatio,a=1/p}const y=o?[e.x+g,e.y]:[0,0];let _=o?[0,0]:[e.x+g+i[0],e.y+i[1]-f],v=[0,0];m&&(v=_,_=[0,0]);const b=e.metrics.isDoubleResolution?2:1,x=(e.metrics.left-a)*e.scale-g+_[0],w=(-e.metrics.top-a)*e.scale+_[1],T=x+n.w/b*e.scale/p,S=w+n.h/b*e.scale/p,E=new r(x,w),I=new r(T,w),P=new r(x,S),k=new r(T,S);if(m){const t=new r(-g,g- -17),i=-Math.PI/2,n=12-g,o=new r(22-n,-(e.imageName?n:0)),a=new r(...v);E._rotateAround(i,t)._add(o)._add(a),I._rotateAround(i,t)._add(o)._add(a),P._rotateAround(i,t)._add(o)._add(a),k._rotateAround(i,t)._add(o)._add(a)}if(c){const e=Math.sin(c),t=Math.cos(c),r=[t,-e,e,t];E._matMult(r),I._matMult(r),P._matMult(r),k._matMult(r)}const A=new r(0,0),C=new r(0,0);u.push({tl:E,tr:I,bl:P,br:k,tex:n,writingMode:t.writingMode,glyphOffset:y,sectionIndex:e.sectionIndex,isSDF:d,pixelOffsetTL:A,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,l,o,a,s,n,e.allowVerticalPlacement),y=e.textSizeData;let _=null;"source"===y.kind?(_=[ih*o.layout.get("text-size").evaluate(s,{})],_[0]>nh&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===y.kind&&(_=[ih*f.compositeTextSizes[0].evaluate(s,{},m),ih*f.compositeTextSizes[1].evaluate(s,{},m)],(_[0]>nh||_[1]>nh)&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,_,l,a,s,u,t,c.lineStartIndex,c.lineLength,p,m);for(const r of h)d[r]=e.text.placedSymbolArray.length-1;return 4*g.length}function bf(e){for(const t in e)return e[t];return null}function xf(e,t,r,i){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(i.dist(e[t])<r)return!0}else n[t]=[];return n[t].push(i),!1}const wf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Tf{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,r]=new Uint8Array(e,0,2);if(219!==t)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=wf[15&r];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new Tf(a,o,n,e)}constructor(e,t=64,r=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=wf.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*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,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Sf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,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>=e&&s<=r&&c>=t&&c<=i&&l.push(n[a])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=r&&f>=t&&f<=i&&l.push(n[d]),(0===c?e<=p:t<=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(e,t,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++)kf(n[2*r],n[2*r+1],e,t)<=l&&s.push(i[r]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];kf(p,f,e,t)<=l&&s.push(i[d]),(0===c?e-r<=p:t-r<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?e+r>=p:t+r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return s}}function Sf(e,t,r,i,n,o){if(n-i<=r)return;const a=i+n>>1;Ef(e,t,a,i,n,o),Sf(e,t,r,i,a-1,1-o),Sf(e,t,r,a+1,n,1-o)}function Ef(e,t,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);Ef(e,t,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=t[2*r+o];let s=i,l=n;for(If(e,t,i,r),t[2*n+o]>a&&If(e,t,i,n);s<l;){for(If(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*i+o]===a?If(e,t,i,l):(l++,If(e,t,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function If(e,t,r,i){Pf(e,r,i),Pf(t,2*r,2*i),Pf(t,2*r+1,2*i+1)}function Pf(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function kf(e,t,r,i){const n=e-r,o=t-i;return n*n+o*o}var Af;e.cH=void 0,(Af=e.cH||(e.cH={})).create="create",Af.load="load",Af.fullLoad="fullLoad";let Cf=null,Mf=[];const Df=1e3/60,Rf="loadTime",Of="fullLoadTime",Lf={mark(e){performance.mark(e)},frame(e){const t=e;null!=Cf&&Mf.push(t-Cf),Cf=t},clearMetrics(){Cf=null,Mf=[],performance.clearMeasures(Rf),performance.clearMeasures(Of);for(const t in e.cH)performance.clearMarks(e.cH[t])},getPerformanceMetrics(){performance.measure(Rf,e.cH.create,e.cH.load),performance.measure(Of,e.cH.create,e.cH.fullLoad);const t=performance.getEntriesByName(Rf)[0].duration,r=performance.getEntriesByName(Of)[0].duration,i=Mf.length,n=1/(Mf.reduce((e,t)=>e+t,0)/i/1e3),o=Mf.filter(e=>e>Df).reduce((e,t)=>e+(t-Df)/Df,0);return{loadTime:t,fullLoadTime:r,fps:n,percentDroppedFrames:o/(i+o)*100,totalFrames:i}}};e.$=u,e.A=p,e.B=co,e.C=no,e.D=$o,e.E=_e,e.F=function([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(r),y:e*Math.sin(t)*Math.sin(r),z:e*Math.cos(r)}},e.G=mr,e.H=Oo,e.I=Gu,e.J=ao,e.K=function(e){if(null==Z){const t=e.navigator?e.navigator.userAgent:null;Z=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Z},e.L=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Th(()=>this.process()),this.subscription=Q(this.target,"message",e=>this.receive(e),!1),this.globalScope=W(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,i)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?Q(t.signal,"abort",()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const t={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)},Sh):null;this.resolveRejects[n]={resolve:e=>{null==o||o.unsubscribe(),r(e)},reject:e=>{null==o||o.unsubscribe(),i(e)}};const a=[],s=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:yo(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){const t=e.data,r=t.id;if(!("file://"!==t.origin&&"file://"!==location.origin&&"resource://android"!==t.origin&&"resource://android"!==location.origin&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[r];const e=this.abortControllers[r];return delete this.abortControllers[r],void(e&&e.abort())}if(W(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,r){return t(this,void 0,void 0,function*(){if("<response>"===r.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(r.error?t.reject(_o(r.error)):t.resolve(_o(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=_o(r.data),i=new AbortController;this.abortControllers[e]=i;try{const n=yield this.messageHandlers[r.type](r.sourceMapId,t,i);this.completeTask(e,null,n)}catch(t){this.completeTask(e,t)}})}completeTask(e,t,r){const i=[];delete this.abortControllers[e];const n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?yo(t):null,data:yo(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.M=ce,e.N=function(){var e=new p(16);return p!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.O=function(e,t,r){var i,n,o,a,s,l,c,u,h,d,p,f,m=r[0],g=r[1],y=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*y+t[12],e[13]=t[1]*m+t[5]*g+t[9]*y+t[13],e[14]=t[2]*m+t[6]*g+t[10]*y+t[14],e[15]=t[3]*m+t[7]*g+t[11]*y+t[15]):(n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=i=t[0],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]=i*m+s*g+h*y+t[12],e[13]=n*m+l*g+d*y+t[13],e[14]=o*m+c*g+p*y+t[14],e[15]=a*m+u*g+f*y+t[15]),e},e.P=r,e.Q=function(e,t,r){var i=r[0],n=r[1],o=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.R=Tl,e.S=function(e,t,r){var i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],y=t[14],_=t[15],v=r[0],b=r[1],x=r[2],w=r[3];return e[0]=v*i+b*s+x*h+w*m,e[1]=v*n+b*l+x*d+w*g,e[2]=v*o+b*c+x*p+w*y,e[3]=v*a+b*u+x*f+w*_,e[4]=(v=r[4])*i+(b=r[5])*s+(x=r[6])*h+(w=r[7])*m,e[5]=v*n+b*l+x*d+w*g,e[6]=v*o+b*c+x*p+w*y,e[7]=v*a+b*u+x*f+w*_,e[8]=(v=r[8])*i+(b=r[9])*s+(x=r[10])*h+(w=r[11])*m,e[9]=v*n+b*l+x*d+w*g,e[10]=v*o+b*c+x*p+w*y,e[11]=v*a+b*u+x*f+w*_,e[12]=(v=r[12])*i+(b=r[13])*s+(x=r[14])*h+(w=r[15])*m,e[13]=v*n+b*l+x*d+w*g,e[14]=v*o+b*c+x*p+w*y,e[15]=v*a+b*u+x*f+w*_,e},e.T=Dl,e.U=function(e,t){const r={};for(let i=0;i<t.length;i++){const n=t[i];n in e&&(r[n]=e[n])}return r},e.V=Ih,e.W=z,e.X=Ch,e.Y=Ah,e.Z=ae,e._=t,e.a=oe,e.a$=b,e.a0=h,e.a1=K,e.a2=Nh,e.a3=Dh,e.a4=Rh,e.a5=A,e.a6=function(e,t,r){if(!e)return t||{};if(!t)return e||{};const i=Gh(e),n=Gh(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(const r of t.remove)e.add.delete(r),e.update.delete(r);for(const[r,i]of t.update){const n=e.update.get(r);n&&(t.update.set(r,Uh(n,i)),e.update.delete(r))}}(i,n);const o={};if((i.removeAll||n.removeAll)&&(o.removeAll=!0),o.remove=new Set([...i.remove,...n.remove]),o.add=new Map([...i.add,...n.add]),o.update=new Map([...i.update,...n.update]),o.remove.size&&o.add.size)for(const a of o.add.keys())o.remove.delete(a);return function(e){const t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(o)},e.a7=function(e,t){const r=new Map;if(null==e)return r;if(null==e.type)return r;if("Feature"===e.type){const i=Vh(e,t);if(null==i)return;return r.set(i,e),r}if("FeatureCollection"===e.type){const i=new Set;for(const n of e.features){const e=Vh(n,t);if(null==e)return;if(i.has(e))return;i.add(e),r.set(e,n)}return r}},e.a8=function(e,t,r){var i,n;const o=[];if(t.removeAll)e.clear();else if(t.remove)for(const a of t.remove){const t=e.get(a);t&&(o.push(t.geometry),e.delete(a))}if(t.add)for(const a of t.add){const t=Vh(a,r);if(null==t)continue;const i=e.get(t);i&&o.push(i.geometry),o.push(a.geometry),e.set(t,a)}if(t.update)for(const a of t.update){const t=e.get(a.id);if(!t)continue;const r=!!a.newGeometry,s=a.removeAllProperties||(null===(i=a.removeProperties)||void 0===i?void 0:i.length)>0||(null===(n=a.addOrUpdateProperties)||void 0===n?void 0:n.length)>0;if(!r&&!s)continue;o.push(t.geometry);const l=Object.assign({},t);if(e.set(a.id,l),r&&(o.push(a.newGeometry),l.geometry=a.newGeometry),s){if(l.properties=a.removeAllProperties?{}:Object.assign({},l.properties||{}),a.removeProperties)for(const e of a.removeProperties)delete l.properties[e];if(a.addOrUpdateProperties)for(const{key:e,value:t}of a.addOrUpdateProperties)l.properties[e]=t}}return o},e.a9=Lh,e.aA=function(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===e.kind?i/ih:"composite"===e.kind?mr.number(i/ih,n/ih,r):t},e.aB=function(e,t){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],m=t[13],g=t[14],y=t[15],_=r*s-i*a,v=r*l-n*a,b=r*c-o*a,x=i*l-n*s,w=i*c-o*s,T=n*c-o*l,S=u*m-h*f,E=u*g-d*f,I=u*y-p*f,P=h*g-d*m,k=h*y-p*m,A=d*y-p*g,C=_*A-v*k+b*P+x*I-w*E+T*S;return C?(e[0]=(s*A-l*k+c*P)*(C=1/C),e[1]=(n*k-i*A-o*P)*C,e[2]=(m*T-g*w+y*x)*C,e[3]=(d*w-h*T-p*x)*C,e[4]=(l*I-a*A-c*E)*C,e[5]=(r*A-n*I+o*E)*C,e[6]=(g*b-f*T-y*v)*C,e[7]=(u*T-d*b+p*v)*C,e[8]=(a*k-s*I+c*S)*C,e[9]=(i*I-r*k-o*S)*C,e[10]=(f*w-m*b+y*_)*C,e[11]=(h*b-u*w-p*_)*C,e[12]=(s*E-a*P-l*S)*C,e[13]=(r*P-i*E+n*S)*C,e[14]=(m*v-f*x-g*_)*C,e[15]=(u*x-h*v+d*_)*C,e):null},e.aC=P,e.aD=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},e.aE=function(e){return e[0]=0,e[1]=0,e},e.aF=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},e.aG=ch,e.aH=S,e.aI=function(e,t,i,n){const o=t.y-e.y,a=t.x-e.x,s=n.y-i.y,l=n.x-i.x,c=s*a-l*o;if(0===c)return null;const u=(l*(e.y-i.y)-s*(e.x-i.x))/c;return new r(e.x+u*a,e.y+u*o)},e.aJ=Up,e.aK=$s,e.aL=function(e){let t=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return[t,r,i,n]},e.aM=fu,e.aN=C,e.aO=function(e,t,r,i,n=!1){if(!r[0]&&!r[1])return[0,0];const o=n?"map"===i?-e.bearingInRadians:0:"viewport"===i?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}return[n?r[0]:C(t,r[0],e.zoom),n?r[1]:C(t,r[1],e.zoom)]},e.aQ=ah,e.aR=yf,e.aS=Zu,e.aT=Tf,e.aU=na,e.aV=dc,e.aW=Ua,e.aX=os,e.aY=ts,e.aZ=te,e.a_=Oh,e.aa=qh,e.ab=25,e.ac=zh,e.ad=e=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const i of e){const e=window.document.createElement("source");pe(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}})},e.ae=Me,e.af=function(){return N++},e.ag=Ma,e.ah=ph,e.ai=Mp,e.aj=pn,e.ak=Vs,e.al=Wh,e.am=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,i,n)=>{const o=i||n;return t[r]=!o||o.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.an=F,e.ao=85.051129,e.ap=ee,e.aq=function(e){return Math.pow(2,e)},e.ar=m,e.as=Mh,e.at=function(e){return Math.log(e)/Math.LN2},e.au=function(e){var t=e[0],r=e[1];return t*t+r*r},e.av=function(e){if(!e.length)return new Set;const t=Math.max(...e.map(e=>e.canonical.z));let r=1/0,i=-1/0,n=1/0,o=-1/0;const a=[];for(const l of e){const{x:e,y:s,z:c}=l.canonical,u=Math.pow(2,t-c),h=e*u,d=s*u;a.push({id:l,x:h,y:d}),h<r&&(r=h),h>i&&(i=h),d<n&&(n=d),d>o&&(o=d)}const s=new Set;for(const l of a)l.x!==r&&l.x!==i&&l.y!==n&&l.y!==o||s.add(l.id);return s},e.aw=function(e,t){const r=Math.abs(2*e.wrap)-+(e.wrap<0),i=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.ax=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){const i=e.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);const n={value:t,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const r=e.wrapped().key,i=void 0===t?0:this.data[r].indexOf(t),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(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const r in this.data)for(const i of this.data[r])e(i.value)||t.push(i);for(const r of t)this.remove(r.value.tileID,r)}},e.ay=function(e,t){let r=0,i=0;if("constant"===e.kind)i=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=e,s=n?F(pr.interpolationFactor(n,t,o,a),0,1):0;"camera"===e.kind?i=mr.number(e.minSize,e.maxSize,s):r=s}return{uSizeT:r,uSize:i}},e.b=H,e.b$=Ss,e.b0=v,e.b1=function(e){var t=new p(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.b2=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e},e.b3=function(e,t){var r=t[0],i=t[1],n=t[2],o=r*r+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},e.b4=x,e.b5=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b6=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e},e.b7=y,e.b8=function(e,t,r){const i=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return 0===i?null:(-(e[0]*r[0]+e[1]*r[1]+e[2]*r[2])-r[3])/i},e.b9=T,e.bA=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e},e.bB=I,e.bC=function(e,t,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=t[0],l=t[1],c=t[2],u=n*c-o*l,h=o*s-i*c,d=i*l-n*s;return e[0]=s+a*(u+=u)+n*(d+=d)-o*(h+=h),e[1]=l+a*h+o*u-i*d,e[2]=c+a*d+i*h-n*u,e},e.bD=function(e,t,r){const i=function(e){var t=e[3],r=e[4],i=e[5],n=e[6],o=e[7],a=e[8];return e[0]*(a*r-i*o)+e[1]*(-a*t+i*n)+e[2]*(o*t-r*n)}([e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2]]);if(0===i)return null;const n=x([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),o=x([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),a=x([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=b([],n,-e[3]);return v(s,s,b([],o,-t[3])),v(s,s,b([],a,-r[3])),b(s,s,1/i),s},e.bE=Eh,e.bF=function(){return new Float64Array(4)},e.bG=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[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],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},e.bH=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[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),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},e.bI=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[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),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},e.bJ=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*i,e[1]=a*n-u*i,e[2]=s*n-h*i,e[3]=l*n-d*i,e[8]=o*i+c*n,e[9]=a*i+u*n,e[10]=s*i+h*n,e[11]=l*i+d*n,e},e.bK=function(e,t){const r=M(e,360),i=M(t,360),n=i-r,o=i>r?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},e.bL=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bM=function(e,t,r,i){const n=Math.sqrt(e*e+t*t),o=Math.sqrt(r*r+i*i);e/=n,t/=n,r/=o,i/=o;const a=Math.acos(e*r+t*i);return-t*r+e*i>0?a:-a},e.bN=function(e,t){const r=M(e,2*Math.PI),i=M(t,2*Math.PI);return Math.min(Math.abs(r-i),Math.abs(r-i+2*Math.PI),Math.abs(r-i-2*Math.PI))},e.bO=function(){const e={},t=ve.$version;for(const r in ve.$root){const i=ve.$root[r];if(i.required){let n=null;n="version"===r?t:"array"===i.type?[]:{},null!=n&&(e[r]=n)}}return e},e.bP=he,e.bQ=vo,e.bR=function e(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(!e(t[i],r[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(!e(t[i],r[i]))return!1;return!0}return t===r},e.bS=function(e){e=e.slice();const t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=xe(e[r],t[e[r].ref]));return e},e.bT=function(e,t){if("custom"===e.type)return new wh(e,t);switch(e.type){case"background":return new xh(e,t);case"circle":return new ml(e,t);case"color-relief":return new Ll(e,t);case"fill":return new Ec(e,t);case"fill-extrusion":return new $c(e,t);case"heatmap":return new Il(e,t);case"hillshade":return new Al(e,t);case"line":return new au(e,t);case"raster":return new ea(e,t);case"symbol":return new _h(e,t)}},e.bU=e=>"raster"===e.type,e.bV=U,e.bW=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let r=[];try{if(!we(e.version,t.version))return[{command:"setStyle",args:[t]}];we(e.center,t.center)||r.push({command:"setCenter",args:[t.center]}),we(e.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),we(e.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),we(e.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),we(e.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),we(e.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),we(e.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),we(e.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),we(e.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),we(e.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),we(e.light,t.light)||r.push({command:"setLight",args:[t.light]}),we(e.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),we(e.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),we(e.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const i={},n=[];!function(e,t,r,i){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||Ee(n,r,i));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?we(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&Pe(e,t,n)?Te(r,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):Ie(n,t,r,i)):Se(n,t,r))}(e.sources,t.sources,n,i);const o=[];e.layers&&e.layers.forEach(e=>{"source"in e&&i[e.source]?r.push({command:"removeLayer",args:[e.id]}):o.push(e)}),r=r.concat(n),function(e,t,r){t=t||[];const i=(e=e||[]).map(Ae),n=t.map(Ae),o=e.reduce(Ce,{}),a=t.reduce(Ce,{}),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++:(Te(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)?(Te(r,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-m),1)):m++,d=s[s.length-f],Te(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]&&!we(u,h))if(we(u.source,h.source)&&we(u["source-layer"],h["source-layer"])&&we(u.type,h.type)){for(p in ke(u.layout,h.layout,r,c,null,"setLayoutProperty"),ke(u.paint,h.paint,r,c,null,"setPaintProperty"),we(u.filter,h.filter)||Te(r,{command:"setFilter",args:[c,h.filter]}),we(u.minzoom,h.minzoom)&&we(u.maxzoom,h.maxzoom)||Te(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.")?ke(u[p],h[p],r,c,p.slice(6),"setPaintProperty"):we(u[p],h[p])||Te(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.")?ke(u[p],h[p],r,c,p.slice(6),"setPaintProperty"):we(u[p],h[p])||Te(r,{command:"setLayerProperty",args:[c,p,h[p]]}))}else Te(r,{command:"removeLayer",args:[c]}),d=s[s.lastIndexOf(c)+1],Te(r,{command:"addLayer",args:[h,d]})}(o,t.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:"setStyle",args:[t]}]}return r},e.bX=function(e){const t=[],r=e.id;return void 0===r&&t.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bY=j,e.bZ=V,e.b_=class extends xs{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},e.bb=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bc=Bh,e.bd=jh,e.be=function(e,t,r,i,n){var o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){var a=1/(i-n);e[10]=(n+i)*a,e[14]=2*n*i*a}else e[10]=-1,e[14]=-2*i;return e},e.bf=function(e){var t=new p(16);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},e.bg=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(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[0]=o*n+c*i,e[1]=a*n+u*i,e[2]=s*n+h*i,e[3]=l*n+d*i,e[4]=c*n-o*i,e[5]=u*n-a*i,e[6]=h*n-s*i,e[7]=d*n-l*i,e},e.bh=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*i,e[5]=a*n+u*i,e[6]=s*n+h*i,e[7]=l*n+d*i,e[8]=c*n-o*i,e[9]=u*n-a*i,e[10]=h*n-s*i,e[11]=d*n-l*i,e},e.bi=function(){const e=new Float32Array(16);return m(e),e},e.bj=function(){const e=new Float64Array(16);return m(e),e},e.bk=function(){return new Float64Array(16)},e.bl=function(e,t,r){const i=new Float64Array(4);return I(i,e,t-90,r),i},e.bm=function(e,t,r,i){var n,o,a,s,l,c=t[0],u=t[1],h=t[2],p=t[3],f=r[0],m=r[1],g=r[2],y=r[3];return(o=c*f+u*m+h*g+p*y)<0&&(o=-o,f=-f,m=-m,g=-g,y=-y),1-o>d?(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),e[0]=s*c+l*f,e[1]=s*u+l*m,e[2]=s*h+l*g,e[3]=s*p+l*y,e},e.bn=function(e){const t=new Float64Array(9);!function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],a=r+r,s=i+i,l=n+n,c=r*a,u=i*a,h=i*s,d=n*a,p=n*s,f=n*l,m=o*a,g=o*s,y=o*l;e[0]=1-h-f,e[3]=u-y,e[6]=d+g,e[1]=u+y,e[4]=1-c-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-c-h}(t,e);const r=te(-Math.asin(F(t[2],-1,1)));let i,n;return Math.hypot(t[5],t[8])<.001?(i=0,n=-te(Math.atan2(t[3],t[4]))):(i=te(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),n=te(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:i,pitch:r+90,bearing:n}},e.bo=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bp=Pt,e.bq=ws,e.br=pc,e.bs=fc,e.bt=hc,e.bu=D,e.bv=R,e.bw=Nt,e.bx=function(e,t,r,i,n){return D(i,n,F((e-t)/(r-t),0,1))},e.by=M,e.bz=function(){return new Float64Array(3)},e.c=se,e.c$=function(e,r,i,n,o){return t(this,void 0,void 0,function*(){if(h())try{return yield K(e,r,i,n,o)}catch(e){}return function(e,t,r,i,n){const o=e.width,a=e.height;Y&&J||(Y=new OffscreenCanvas(o,a),J=Y.getContext("2d",{willReadFrequently:!0})),Y.width=o,Y.height=a,J.drawImage(e,0,0,o,a);const s=J.getImageData(t,r,i,n);return J.clearRect(0,0,o,a),s.data}(e,r,i,n,o)})},e.c0=class extends xs{constructor(e,t){super(e,t),this.current=Es}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=Ts,e.c2=class extends xs{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.c3=class extends xs{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.c4=f,e.c5=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c6=function(e,t,r){var i=t[0],n=t[1],o=t[2];return e[0]=i*r[0]+n*r[3]+o*r[6],e[1]=i*r[1]+n*r[4]+o*r[7],e[2]=i*r[2]+n*r[5]+o*r[8],e},e.c7=function(e,t,r,i,n,o,a){var s=1/(t-r),l=1/(i-n),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=(a+o)*c,e[15]=1,e},e.c8=class extends xs{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(4*e.length);for(let r=0;r<e.length;r++)t[4*r]=e[r].r,t[4*r+1]=e[r].g,t[4*r+2]=e[r].b,t[4*r+3]=e[r].a;this.gl.uniform4fv(this.location,t)}}},e.c9=class extends xs{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.cA=function(e,t){return re[t]&&"touches"in e},e.cB=function(e){return re[e]||ie[e]},e.cC=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e},e.cD=function(e,t){const{x:r,y:i}=Lh.fromLngLat(t);return!(e<0||e>25||i<0||i>=1||r<0||r>=1)},e.cE=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cF=class extends sa{},e.cG=Lf,e.cI=ue,e.cJ=function(e,t){se.REGISTERED_PROTOCOLS[e]=t},e.cK=function(e){delete se.REGISTERED_PROTOCOLS[e]},e.cL=function(e,t){const r={};for(let n=0;n<e.length;n++){const i=t&&t[e[n].id]||wn(e[n]);t&&(t[e[n].id]=i);let o=r[i];o||(o=r[i]=[]),o.push(e[n])}const i=[];for(const n in r)i.push(r[n]);return i},e.cM=po,e.cN=$h,e.cO=Np,e.cP=qu,e.cQ=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=A/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,o={layoutIconSize:n["icon-size"].possiblyEvaluate(new Oo(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Oo(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Oo(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.textSizeData;o.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Oo(e),t.canonical),n["text-size"].possiblyEvaluate(new Oo(r),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.iconSizeData;o.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Oo(e),t.canonical),n["icon-size"].possiblyEvaluate(new Oo(r),t.canonical)]}const a=i.get("text-line-height")*fu,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 t.bucket.features){const n=i.get("text-font").evaluate(u,{},t.canonical).join(","),h=c.evaluate(u,{},t.canonical),d=o.layoutTextSize.evaluate(u,{},t.canonical),p=o.layoutIconSize.evaluate(u,{},t.canonical),f={horizontal:{},vertical:void 0},m=u.text;let g,y=[0,0];if(m){const o=m.toString(),c=i.get("text-letter-spacing").evaluate(u,{},t.canonical)*fu,p=So(o)?c:0,g=i.get("text-anchor").evaluate(u,{},t.canonical),_=gf(r,u,t.canonical);if(!_){const e=i.get("text-radial-offset").evaluate(u,{},t.canonical);y=e?mf(g,[e*fu,ff]):i.get("text-offset").evaluate(u,{},t.canonical).map(e=>e*fu)}let v=s?"center":i.get("text-justify").evaluate(u,{},t.canonical);const b="point"===i.get("symbol-placement")?i.get("text-max-width").evaluate(u,{},t.canonical)*fu:1/0,x=()=>{t.bucket.allowVerticalPlacement&&To(o)&&(f.vertical=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,g,"left",p,y,e.az.vertical,!0,d,h))};if(!s&&_){const r=new Set;if("auto"===v)for(let e=0;e<_.values.length;e+=2)r.add(yf(_.values[e]));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=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,"center",o,p,y,e.az.horizontal,!1,d,h);r&&(f.horizontal[o]=r,i=1===r.positionedLines.length)}x()}else{"auto"===v&&(v=yf(g));const r=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,g,v,p,y,e.az.horizontal,!1,d,h);r&&(f.horizontal[v]=r),x(),To(o)&&s&&l&&(f.vertical=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,g,v,p,y,e.az.vertical,!1,d,h))}}let _=!1;if(u.icon&&u.icon.name){const e=t.imageMap[u.icon.name];e&&(g=eh(t.imagePositions[u.icon.name],i.get("icon-offset").evaluate(u,{},t.canonical),i.get("icon-anchor").evaluate(u,{},t.canonical)),_=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=_:t.bucket.sdfIcons!==_&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const v=bf(f.horizontal)||f.vertical;t.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&_f(t.bucket,u,f,g,t.imageMap,o,d,p,y,_,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cR=xc,e.cS=Nc,e.cT=eu,e.cU=function(e){const t=new Pu;return function(e,t){for(const r in e.layers)t.writeMessage(3,Dp,e.layers[r])}(e,t),t.finish()},e.cV=function(e,t,r,i,n,o){let a=Gp(e,t,r,n,0);return a=Gp(a,t,i,o,1),a},e.cW=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){const t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cX=Lc,e.cY=Pu,e.cZ=Ap,e.c_=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.ca=class extends va{},e.cb=du,e.cc=class extends xa{},e.cd=El,e.ce=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.cf=Sl,e.cg=function(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/(a=a||1),e[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,e[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,e},e.ch=class extends la{},e.ci=class extends ka{},e.cj=function(e,t){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.ck=function(e,t){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],p=e[10],f=e[11],m=e[12],g=e[13],y=e[14],_=e[15],v=t[0],b=t[1],x=t[2],w=t[3],T=t[4],S=t[5],E=t[6],I=t[7],P=t[8],k=t[9],A=t[10],C=t[11],M=t[12],D=t[13],R=t[14],O=t[15];return Math.abs(r-v)<=d*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-b)<=d*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(n-x)<=d*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-w)<=d*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=d*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=d*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-E)<=d*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-I)<=d*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(u-P)<=d*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(h-k)<=d*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(p-A)<=d*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(f-C)<=d*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(m-M)<=d*Math.max(1,Math.abs(m),Math.abs(M))&&Math.abs(g-D)<=d*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(y-R)<=d*Math.max(1,Math.abs(y),Math.abs(R))&&Math.abs(_-O)<=d*Math.max(1,Math.abs(_),Math.abs(O))},e.cl=function(e,t){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},e.cm=e=>"symbol"===e.type,e.cn=e=>"circle"===e.type,e.co=e=>"heatmap"===e.type,e.cp=e=>"line"===e.type,e.cq=e=>"fill"===e.type,e.cr=e=>"fill-extrusion"===e.type,e.cs=e=>"hillshade"===e.type,e.ct=e=>"color-relief"===e.type,e.cu=e=>"background"===e.type,e.cv=e=>"custom"===e.type,e.cw=O,e.cx=function(e,t,r){const i=k(t.x-r.x,t.y-r.y),n=k(e.x-r.x,e.y-r.y),o=Math.atan2(i[0]*n[1]-i[1]*n[0],function(e,t){return e[0]*t[0]+e[1]*t[1]}(i,n));return te(o)},e.cy=L,e.cz=function(e,t){return ie[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.d=pe,e.d0=Rl,e.d1=i,e.d2=class{constructor(e,t){this.layers={[Mp]:this},this.name=Mp,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Cp(this.features[e],this.extent)}},e.d3=rn,e.d4=Ro,e.e=B,e.f=e=>t(void 0,void 0,void 0,function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),e.g=le,e.h=e=>new Promise((t,r)=>{const i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=X})},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(e)],{type:"image/png"});i.src=e.byteLength?URL.createObjectURL(n):X}),e.i=W,e.j=(e,t)=>de(B(e,{type:"json"}),t),e.k=ye,e.l=ge,e.m=de,e.n=(e,t)=>de(B(e,{type:"arrayBuffer"}),t),e.o=function(e){return new Pu(e).readFields(Nu,[])},e.p=Uu,e.q=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.r=wl,e.s=Q,e.t=Ko,e.u=ve,e.v=io,e.w=q,e.x=No,e.y=oo,e.z=Fo}),r("worker",["./shared"],function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,r,i){for(const o of t){this._layerConfigs[o.id]=o;const t=this._layers[o.id]=e.bT(o,i);t._featureFilter=e.aj(t.filter,i),this.keyCache[o.id]&&delete this.keyCache[o.id]}for(const e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const n=e.cL(Object.values(this._layerConfigs),this.keyCache);for(const o of n){const t=o.map(e=>this._layers[e.id]),r=t[0];if(r.isHidden())continue;const i=r.source||"";let n=this.familiesBySource[i];n||(n=this.familiesBySource[i]={});const a=r.sourceLayer||e.ai;let s=n[a];s||(s=n[a]=[]),s.push(t)}}}class r{constructor(t){const r={},i=[];for(const e in t){const n=t[e],o=r[e]={};for(const e in n){const t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const r={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(r),o[e]={rect:r,metrics:t.metrics}}}const{w:n,h:o}=e.p(i),a=new e.r({width:n||1,height:o||1});for(const s in t){const i=t[s];for(const t in i){const n=i[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const o=r[s][t].rect;e.r.copy(n.bitmap,a,{x:0,y:0},{x:o.x+1,y:o.y+1},n.bitmap)}}this.image=a,this.positions=r}}e.cM("GlyphAtlas",r);class i{constructor(t){this.tileID=new e.a2(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,i,o,a,s){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ag;const l=new e.cN(Object.keys(t.layers).sort()),c=new e.cO(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:o,subdivisionGranularity:s},d=i.familiesBySource[this.source];for(const r in d){const i=t.layers[r];if(!i)continue;1===i.version&&e.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 e=0;e<i.length;e++){const t=i.feature(e),n=c.getId(t,r);s.push({feature:t,id:n,index:e,sourceLayerIndex:a})}for(const t of d[r]){const r=t[0];r.source!==this.source&&e.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.isHidden(this.zoom,!0)||(n(t,this.zoom,o),(u[r.id]=r.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map(e=>e.id)))}}const p=e.bY(h.glyphDependencies,e=>Object.keys(e).map(Number));this.inFlightDependencies.forEach(e=>null==e?void 0:e.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const e=new AbortController;this.inFlightDependencies.push(e),f=a.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const m=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(m.length){const e=new AbortController;this.inFlightDependencies.push(e),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},e)}const y=Object.keys(h.patternDependencies);let _=Promise.resolve({});if(y.length){const e=new AbortController;this.inFlightDependencies.push(e),_=a.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const v=h.dashDependencies;let b=Promise.resolve({});if(Object.keys(v).length){const e=new AbortController;this.inFlightDependencies.push(e),b=a.sendAsync({type:"GDA",data:{dashes:v}},e)}const[x,w,T,S]=yield Promise.all([f,g,_,b]),E=new r(x),I=new e.cP(w,T);for(const t in u){const r=u[t];r instanceof e.ah?(n(r.layers,this.zoom,o),e.cQ({bucket:r,glyphMap:x,glyphPositions:E.positions,imageMap:w,imagePositions:I.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):r.hasDependencies&&(r instanceof e.cR||r instanceof e.cS||r instanceof e.cT)&&(n(r.layers,this.zoom,o),r.addFeatures(h,this.tileID.canonical,I.patternPositions,S))}return this.status="done",{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:E.image,imageAtlas:I,dashPositions:S,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?E.positions:null}})}}function n(t,r,i){const n=new e.H(r);for(const e of t)e.recalculate(n,i)}class o{constructor(e,t,r,i,n){this.type=e,this.properties=r||{},this.extent=n,this.pointsArray=t,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(t=>new e.P(t.x,t.y)))}}class a{constructor(e,t,r){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=r}feature(e){return this._myFeatures[e]}}class s{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function l(t){let r=e.cU(t);return 0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),{vectorTile:t,rawData:r.buffer}}function c(t,r,i){const{extent:n}=t,s=Math.pow(2,i.z-r.z),l=(i.x-r.x*s)*n,c=(i.y-r.y*s)*n,u=[];for(let a=0;a<t.length;a++){const r=t.feature(a);let i=r.loadGeometry();for(const e of i)for(const t of e)t.x=t.x*s-l,t.y=t.y*s-c;const h=128;i=e.cV(i,r.type,-h,-h,n+h,n+h),0!==i.length&&u.push(new o(r.type,i,r.properties,r.id,n))}return new a(u,t.name,n)}class u{constructor(t,r,i){this.actor=t,this.layerIndex=r,this.availableImages=i,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new e.cW(1e3)}loadVectorTile(t,r){return e._(this,void 0,void 0,function*(){const i=yield e.n(t.request,r);try{return{vectorTile:"mlt"!==t.encoding?new e.cX(new e.cY(i.data)):new e.cZ(i.data),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires}}catch(e){const n=new Uint8Array(i.data);let o=`Unable to parse the tile at ${t.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: ${e.message}`,new Error(o)}})}loadTile(t){return e._(this,void 0,void 0,function*(){const{uid:r,overzoomParameters:n}=t;n&&(t.request=n.overzoomRequest);const o=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.c_(t.request),a=new i(t);this.loading[r]=a;const s=new AbortController;a.abort=s;try{const i=yield this.loadVectorTile(t,s);if(delete this.loading[r],!i)return null;if(n){const e=this._getOverzoomTile(t,i.vectorTile);i.rawData=e.rawData,i.vectorTile=e.vectorTile}const l=i.rawData,c={};i.expires&&(c.expires=i.expires),i.cacheControl&&(c.cacheControl=i.cacheControl);const u={};if(o){const e=o.finish();e&&(u.resourceTiming=JSON.parse(JSON.stringify(e)))}a.vectorTile=i.vectorTile;const h=a.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[r]=a,this.fetching[r]={rawTileData:l,cacheControl:c,resourceTiming:u};try{const r=yield h;return e.e({rawTileData:l.slice(0),encoding:t.encoding},r,c,u)}finally{delete this.fetching[r]}}catch(e){throw delete this.loading[r],a.status="done",this.loaded[r]=a,e}})}_getOverzoomTile(e,t){const{tileID:r,source:i,overzoomParameters:n}=e,{maxZoomTileID:o}=n,a=`${o.key}_${r.key}`,u=this.overzoomedTileResultCache.get(a);if(u)return u;const h=new s,d=this.layerIndex.familiesBySource[i];for(const s in d){const e=t.layers[s];if(!e)continue;const i=c(e,o,r.canonical);i.length>0&&h.addLayer(i)}const p=l(h);return this.overzoomedTileResultCache.set(a,p),p}reloadTile(t){return e._(this,void 0,void 0,function*(){const r=t.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=t.showCollisionBoxes,"parsing"===i.status){const n=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);let o;if(this.fetching[r]){const{rawTileData:i,cacheControl:a,resourceTiming:s}=this.fetching[r];delete this.fetching[r],o=e.e({rawTileData:i.slice(0),encoding:t.encoding},n,a,s)}else o=n;return o}if("done"===i.status&&i.vectorTile)return i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)})}abortTile(t){return e._(this,void 0,void 0,function*(){const e=this.loading,r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort.abort(),delete e[r])})}removeTile(t){return e._(this,void 0,void 0,function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]})}}class h{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,function*(){const{uid:r,encoding:i,rawImageData:n,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=t,c=n.width+2,u=n.height+2,h=e.b(n)?new e.R({width:c,height:u},yield e.c$(n,-1,-1,c,u)):n,d=new e.d0(r,h,i,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=d,d})}removeTile(e){const t=this.loaded,r=e.uid;t&&t[r]&&delete t[r]}}var d,p,f=function(){if(p)return d;function e(e,r){if(0!==e.length){t(e[0],r);for(var i=1;i<e.length;i++)t(e[i],!r)}}function t(e,t){for(var r=0,i=0,n=0,o=e.length,a=o-1;n<o;a=n++){var s=(e[n][0]-e[a][0])*(e[a][1]+e[n][1]),l=r+s;i+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+i>=0!=!!t&&e.reverse()}return p=1,d=function t(r,i){var n,o=r&&r.type;if("FeatureCollection"===o)for(n=0;n<r.features.length;n++)t(r.features[n],i);else if("GeometryCollection"===o)for(n=0;n<r.geometries.length;n++)t(r.geometries[n],i);else if("Feature"===o)t(r.geometry,i);else if("Polygon"===o)e(r.coordinates,i);else if("MultiPolygon"===o)for(n=0;n<r.coordinates.length;n++)e(r.coordinates[n],i);return r}}(),m=e.d1(f);const g={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},y=Math.fround||(_=new Float32Array(1),e=>(_[0]=+e,_[0]));var _;class v{constructor(e){this.options=Object.assign(Object.create(g),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:r,maxZoom:i}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let s=0;s<e.length;s++){const t=e[s];if(!t.geometry)continue;const[r,i]=t.geometry.coordinates,n=y(w(r)),a=y(T(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);t&&console.timeEnd(n);for(let s=i;s>=r;s--){const e=+Date.now();a=this.trees[s]=this._createTree(this._cluster(a,s)),t&&console.log("z%d: %d clusters in %dms",s,a.numItems,+Date.now()-e)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let r=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){const e=this.getClusters([r,i,180,o],t),a=this.getClusters([-180,i,n,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(w(r),T(o),w(n),T(i)),l=a.data,c=[];for(const u of s){const e=this.stride*u;c.push(l[e+5]>1?b(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(e){const t=this._getOriginId(e),r=this._getOriginZoom(e),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);const o=n.data;if(t*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[t*this.stride],o[t*this.stride+1],a),l=[];for(const c of s){const t=c*this.stride;o[t+4]===e&&l.push(o[t+5]>1?b(o,t,this.clusterProps):this.points[o[t+3]])}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,r){const i=[];return this._appendLeaves(i,e,t=t||10,r=r||0,0),i}getTile(e,t,r){const i=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{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((t-s)/n,l,(t+1+s)/n,c),i.data,t,r,n,u),0===t&&this._addTileFeatures(i.range(1-s/n,l,1,c),i.data,n,r,n,u),t===n-1&&this._addTileFeatures(i.range(0,l,s/n,c),i.data,-1,r,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const r=this.getChildren(e);if(t++,1!==r.length)break;e=r[0].properties.cluster_id}return t}_appendLeaves(e,t,r,i,n){const o=this.getChildren(t);for(const a of o){const t=a.properties;if(t&&t.cluster?n+t.point_count<=i?n+=t.point_count:n=this._appendLeaves(e,t.cluster_id,r,i,n):n<i?n++:e.push(a),e.length===r)break}return n}_createTree(t){const r=new e.aT(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)r.add(t[e],t[e+1]);return r.finish(),r.data=t,r}_addTileFeatures(e,t,r,i,n,o){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,u;if(s)l=x(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const r=this.points[t[e+3]];l=r.properties;const[i,n]=r.geometry.coordinates;c=w(i),u=T(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?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:r,extent:i,reduce:n,minPoints:o}=this.options,a=r/(i*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let u=0;u<s.length;u+=c){if(s[u+2]<=t)continue;s[u+2]=t;const r=s[u],i=s[u+1],h=e.within(s[u],s[u+1],a),d=s[u+5];let p=d;for(const e of h){const r=e*c;s[r+2]>t&&(p+=s[r+5])}if(p>d&&p>=o){let e,o=r*d,a=i*d,f=-1;const m=(u/c<<5)+(t+1)+this.points.length;for(const r of h){const i=r*c;if(s[i+2]<=t)continue;s[i+2]=t;const l=s[i+5];o+=s[i]*l,a+=s[i+1]*l,s[i+4]=m,n&&(e||(e=this._map(s,u,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,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 e=0;e<c;e++)l.push(s[u+e]);if(p>1)for(const e of h){const r=e*c;if(!(s[r+2]<=t)){s[r+2]=t;for(let e=0;e<c;e++)l.push(s[r+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,r){if(e[t+5]>1){const i=this.clusterProps[e[t+6]];return r?Object.assign({},i):i}const i=this.points[e[t+3]].properties,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}}function b(e,t,r){return{type:"Feature",id:e[t+3],properties:x(e,t,r),geometry:{type:"Point",coordinates:[(i=e[t],360*(i-.5)),S(e[t+1])]}};var i}function x(e,t,r){const i=e[t+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,o=e[t+6],a=-1===o?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:i,point_count_abbreviated:n})}function w(e){return e/360+.5}function T(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function S(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function E(e,t,r,i){let n=i;const o=t+(r-t>>1);let a,s=r-t;const l=e[t],c=e[t+1],u=e[r],h=e[r+1];for(let d=t+3;d<r;d+=3){const t=I(e[d],e[d+1],l,c,u,h);if(t>n)a=d,n=t;else if(t===n){const e=Math.abs(d-o);e<s&&(a=d,s=e)}}n>i&&(a-t>3&&E(e,t,a,i),e[a+2]=n,r-a>3&&E(e,a,r,i))}function I(e,t,r,i,n,o){let a=n-r,s=o-i;if(0!==a||0!==s){const l=((e-r)*a+(t-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return a=e-r,s=t-i,a*a+s*s}function P(e,t,r,i){const n={id:null==e?null:e,type:t,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)k(n,r);else if("Polygon"===t)k(n,r[0]);else if("MultiLineString"===t)for(const o of r)k(n,o);else if("MultiPolygon"===t)for(const o of r)k(n,o[0]);return n}function k(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function A(e,t,r,i){if(!t.geometry)return;const n=t.geometry.coordinates;if(n&&0===n.length)return;const o=t.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let s=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=i||0),"Point"===o)C(n,s);else if("MultiPoint"===o)for(const c of n)C(c,s);else if("LineString"===o)M(n,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(const r of n)s=[],M(r,s,a,!1),e.push(P(l,"LineString",s,t.properties));return}D(n,s,a,!1)}else if("Polygon"===o)D(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of t.geometry.geometries)A(e,{id:l,geometry:n,properties:t.properties},r,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of n){const t=[];D(e,t,a,!0),s.push(t)}}e.push(P(l,o,s,t.properties))}function C(e,t){t.push(R(e[0]),O(e[1]),0)}function M(e,t,r,i){let n,o,a=0;for(let l=0;l<e.length;l++){const r=R(e[l][0]),s=O(e[l][1]);t.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=t.length-3;t[2]=1,E(t,0,s,r),t[s+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function D(e,t,r,i){for(let n=0;n<e.length;n++){const o=[];M(e[n],o,r,i),t.push(o)}}function R(e){return e/360+.5}function O(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function L(e,t,r,i,n,o,a,s){if(i/=t,o>=(r/=t)&&a<i)return e;if(a<r||o>=i)return null;const l=[];for(const c of e){const e=c.geometry;let t=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"===t||"MultiPoint"===t)F(e,u,r,i,n);else if("LineString"===t)z(e,u,r,i,n,!1,s.lineMetrics);else if("MultiLineString"===t)N(e,u,r,i,n,!1);else if("Polygon"===t)N(e,u,r,i,n,!0);else if("MultiPolygon"===t)for(const s of e){const e=[];N(s,e,r,i,n,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&"LineString"===t){for(const e of u)l.push(P(c.id,t,e,c.tags));continue}"LineString"!==t&&"MultiLineString"!==t||(1===u.length?(t="LineString",u=u[0]):t="MultiLineString"),"Point"!==t&&"MultiPoint"!==t||(t=3===u.length?"Point":"MultiPoint"),l.push(P(c.id,t,u,c.tags))}}return l.length?l:null}function F(e,t,r,i,n){for(let o=0;o<e.length;o+=3){const a=e[o+n];a>=r&&a<=i&&j(t,e[o],e[o+1],e[o+2])}}function z(e,t,r,i,n,o,a){let s=B(e);const l=0===n?V:U;let c,u,h=e.start;for(let g=0;g<e.length-3;g+=3){const d=e[g],p=e[g+1],f=e[g+2],m=e[g+3],y=e[g+4],_=0===n?d:p,v=0===n?m:y;let b=!1;a&&(c=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-y,2))),_<r?v>r&&(u=l(s,d,p,m,y,r),a&&(s.start=h+c*u)):_>i?v<i&&(u=l(s,d,p,m,y,i),a&&(s.start=h+c*u)):j(s,d,p,f),v<r&&_>=r&&(u=l(s,d,p,m,y,r),b=!0),v>i&&_<=i&&(u=l(s,d,p,m,y,i),b=!0),!o&&b&&(a&&(s.end=h+c*u),t.push(s),s=B(e)),a&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],m=0===n?p:f;m>=r&&m<=i&&j(s,p,f,e[d+2]),d=s.length-3,o&&d>=3&&(s[d]!==s[0]||s[d+1]!==s[1])&&j(s,s[0],s[1],s[2]),s.length&&t.push(s)}function B(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function N(e,t,r,i,n,o){for(const a of e)z(a,t,r,i,n,o,!1)}function j(e,t,r,i){e.push(t,r,i)}function V(e,t,r,i,n,o){const a=(o-t)/(i-t);return j(e,o,r+(n-r)*a,1),a}function U(e,t,r,i,n,o){const a=(o-r)/(n-r);return j(e,t+(i-t)*a,o,1),a}function G(e,t){const r=[];for(let i=0;i<e.length;i++){const n=e[i],o=n.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=q(n.geometry,t);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const e of n.geometry)a.push(q(e,t))}else if("MultiPolygon"===o){a=[];for(const e of n.geometry){const r=[];for(const i of e)r.push(q(i,t));a.push(r)}}r.push(P(n.id,o,a,n.tags))}return r}function q(e,t){const r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let i=0;i<e.length;i+=3)r.push(e[i]+t,e[i+1],e[i+2]);return r}function $(e,t){if(e.transformed)return e;const r=1<<e.z,i=e.x,n=e.y;for(const o of e.features){const e=o.geometry,a=o.type;if(o.geometry=[],1===a)for(let s=0;s<e.length;s+=2)o.geometry.push(W(e[s],e[s+1],t,r,i,n));else for(let s=0;s<e.length;s++){const a=[];for(let o=0;o<e[s].length;o+=2)a.push(W(e[s][o],e[s][o+1],t,r,i,n));o.geometry.push(a)}}return e.transformed=!0,e}function W(e,t,r,i,n,o){return[Math.round(r*(e*i-n)),Math.round(r*(t*i-o))]}function Z(e,t,r,i,n){const o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:r,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const s of e)H(a,s,o,n);return a}function H(e,t,r,i){const n=t.geometry,o=t.type,a=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===o||"MultiPoint"===o)for(let s=0;s<n.length;s+=3)a.push(n[s],n[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)X(a,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let s=0;s<n.length;s++)X(a,n[s],e,r,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(let s=0;s<n.length;s++){const t=n[s];for(let i=0;i<t.length;i++)X(a,t[i],e,r,!0,0===i)}if(a.length){let r=t.tags||null;if("LineString"===o&&i.lineMetrics){r={};for(const e in t.tags)r[e]=t.tags[e];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!==t.id&&(s.id=t.id),e.features.push(s)}}function X(e,t,r,i,n,o){const a=i*i;if(i>0&&t.size<(n?a:i))return void(r.numPoints+=t.length/3);const s=[];for(let l=0;l<t.length;l+=3)(0===i||t[l+2]>a)&&(r.numSimplified++,s.push(t[l],t[l+1])),r.numPoints++;n&&function(e,t){let r=0;for(let i=0,n=e.length,o=n-2;i<n;o=i,i+=2)r+=(e[i]-e[o])*(e[i+1]+e[o+1]);if(r>0===t)for(let i=0,n=e.length;i<n/2;i+=2){const t=e[i],r=e[i+1];e[i]=e[n-2-i],e[i+1]=e[n-1-i],e[n-2-i]=t,e[n-1-i]=r}}(s,o),e.push(s)}const K={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Y{constructor(e,t){const r=(t=this.options=function(e,t){for(const r in t)e[r]=t[r];return e}(Object.create(K),t)).debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(e,t){const r=[];if("FeatureCollection"===e.type)for(let i=0;i<e.features.length;i++)A(r,e.features[i],t,i);else A(r,"Feature"===e.type?e:{geometry:e},t);return r}(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(e,t){const r=t.buffer/t.extent;let i=e;const n=L(e,1,-1-r,r,0,-1,2,t),o=L(e,1,1-r,2+r,0,-1,2,t);return(n||o)&&(i=L(e,1,-r,1+r,0,-1,2,t)||[],n&&(i=G(n,1).concat(i)),o&&(i=i.concat(G(o,-1)))),i}(i,t),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(e,t,r,i,n,o,a){const s=[e,t,r,i],l=this.options,c=l.debug;for(;s.length;){i=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();const u=1<<t,h=J(t,r,i);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=Z(e,t,r,i,l),this.tileCoords.push({z:t,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(r!==o>>e||i!==a>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,g=1+p;let y=null,_=null,v=null,b=null,x=L(e,u,r-p,r+m,0,d.minX,d.maxX,l),w=L(e,u,r+f,r+g,0,d.minX,d.maxX,l);e=null,x&&(y=L(x,u,i-p,i+m,1,d.minY,d.maxY,l),_=L(x,u,i+f,i+g,1,d.minY,d.maxY,l),x=null),w&&(v=L(w,u,i-p,i+m,1,d.minY,d.maxY,l),b=L(w,u,i+f,i+g,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd("clipping"),s.push(y||[],t+1,2*r,2*i),s.push(_||[],t+1,2*r,2*i+1),s.push(v||[],t+1,2*r+1,2*i),s.push(b||[],t+1,2*r+1,2*i+1)}}getTile(e,t,r){e=+e,t=+t,r=+r;const i=this.options,{extent:n,debug:o}=i;if(e<0||e>24)return null;const a=1<<e,s=J(e,t=t+a&a-1,r);if(this.tiles[s])return $(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let l,c=e,u=t,h=r;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[J(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,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?$(this.tiles[s],n):null):null}}function J(e,t,r){return 32*((1<<e)*r+t)+e}class Q extends u{constructor(e,t,r,i=ee){super(e,t,r),this._dataUpdateable=new Map,this._createGeoJSONIndex=i}loadVectorTile(t,r){return e._(this,void 0,void 0,function*(){const r=t.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);return i?l(new e.d2(i.features,{version:2,extent:e.a5})):null})}loadData(t){return e._(this,void 0,void 0,function*(){var r;null===(r=this._pendingRequest)||void 0===r||r.abort();const i=this._startPerformance(t);this._pendingRequest=new AbortController;try{(!this._pendingData||t.request||t.data||t.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest));const e=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(e,t),this.loaded={};const r={};return t.request&&(r.data=e),this._finishPerformance(i,t,r),r}catch(t){if(delete this._pendingRequest,e.Z(t))return{abandoned:!0};throw t}})}_startPerformance(t){var r;if(null===(r=null==t?void 0:t.request)||void 0===r?void 0:r.collectResourceTiming)return new e.c_(t.request)}_finishPerformance(e,t,r){if(!e)return;const i=e.finish();i&&(r.resourceTiming={},r.resourceTiming[t.source]=JSON.parse(JSON.stringify(i)))}getData(){return e._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(e){const t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,r){return e._(this,void 0,void 0,function*(){let e;if(t.request?e=yield this.loadGeoJSONFromUrl(t.request,t.promoteId,r):t.data?e=this._loadGeoJSONFromObject(t.data,t.promoteId):t.dataDiff&&(e=this._loadGeoJSONFromDiff(t.dataDiff,t.promoteId,t.source)),delete this._pendingRequest,"object"!=typeof e)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);return m(e,!0),t.filter&&(e=this._filterGeoJSON(e,t.filter)),e})}loadGeoJSONFromUrl(t,r,i){return e._(this,void 0,void 0,function*(){const n=yield e.j(t,i);return this._dataUpdateable=e.a7(n.data,r),n.data})}_loadGeoJSONFromObject(t,r){return this._dataUpdateable=e.a7(t,r),t}_loadGeoJSONFromDiff(t,r,i){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${i}`);e.a8(this._dataUpdateable,t,r);const n=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(n)}_filterGeoJSON(t,r){const i=e.d3(r,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));const n=t.features.filter(e=>i.value.evaluate({zoom:0},e));return this._toFeatureCollection(n)}_toFeatureCollection(e){return{type:"FeatureCollection",features:e}}removeSource(t){return e._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}function ee(t,r){return r.cluster?new v(function({superclusterOptions:t,clusterProperties:r}){if(!r||!t)return t;const i={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(r);for(const l of s){const[t,o]=r[l],a=e.d3(o),s=e.d3("string"==typeof t?[t,["accumulated"],["get",l]]:t);i[l]=a.value,n[l]=s.value}return t.map=e=>{a.properties=e;const t={};for(const r of s)t[r]=i[r].evaluate(o,a);return t},t.reduce=(e,t)=>{a.properties=t;for(const r of s)o.accumulated=e[r],e[r]=n[r].evaluate(o,a)},t}(r)).load(t.features):function(e,t){return new Y(e,t)}(t,r.geojsonVtOptions)}class te{constructor(t){this.self=t,this.actor=new e.L(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cJ,this.self.removeProtocol=e.cK,this.self.registerRTLTextPlugin=t=>{e.d4.setMethods(t)},this.actor.registerMessageHandler("LDT",(e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t)),this.actor.registerMessageHandler("RDT",(t,r)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(t,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(t,r)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(t,r)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(t,r)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t)),this.actor.registerMessageHandler("GD",(e,t)=>this._getWorkerSource(e,t.type,t.source).getData()),this.actor.registerMessageHandler("LT",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t)),this.actor.registerMessageHandler("RT",(e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t)),this.actor.registerMessageHandler("AT",(e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t)),this.actor.registerMessageHandler("RMT",(e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t)),this.actor.registerMessageHandler("RS",(t,r)=>e._(this,void 0,void 0,function*(){if(!this.workerSources[t]||!this.workerSources[t][r.type]||!this.workerSources[t][r.type][r.source])return;const e=this.workerSources[t][r.type][r.source];delete this.workerSources[t][r.type][r.source],void 0!==e.removeSource&&e.removeSource(r)})),this.actor.registerMessageHandler("RM",t=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})),this.actor.registerMessageHandler("SR",(t,r)=>e._(this,void 0,void 0,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(e,t)=>this._syncRTLPluginState(e,t)),this.actor.registerMessageHandler("IS",(t,r)=>e._(this,void 0,void 0,function*(){this.self.importScripts(r)})),this.actor.registerMessageHandler("SI",(e,t)=>this._setImages(e,t)),this.actor.registerMessageHandler("UL",(t,r)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).update(r.layers,r.removedIds,this._getGlobalState(t))})),this.actor.registerMessageHandler("UGS",(t,r)=>e._(this,void 0,void 0,function*(){const e=this._getGlobalState(t);for(const t in r)e[t]=r[t]})),this.actor.registerMessageHandler("SL",(t,r)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).replace(r,this._getGlobalState(t))}))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,r){return e._(this,void 0,void 0,function*(){this.availableImages[t]=r;for(const e in this.workerSources[t]){const i=this.workerSources[t][e];for(const e in i)i[e].availableImages=r}})}_syncRTLPluginState(t,r){return e._(this,void 0,void 0,function*(){return yield e.d4.syncState(r,this.self.importScripts)})}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new t),r}_getWorkerSource(e,t,r){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][r]){const i={sendAsync:(t,r)=>(t.targetMapId=e,this.actor.sendAsync(t,r))};switch(t){case"vector":this.workerSources[e][t][r]=new u(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][r]=new Q(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][r]=new this.externalWorkerSourceTypes[t](i,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][r]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new h),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new te(self)),te}),r("index",["exports","./shared"],function(e,t){var r="5.15.0";function i(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let n,o,a;const s={frame(e,r,i){const n=requestAnimationFrame(e=>{o(),r(e)}),{unsubscribe:o}=t.s(e.signal,"abort",()=>{o(),cancelAnimationFrame(n),i(new t.a(e.signal.reason))},!1)},frameAsync(e){return new Promise((t,r)=>{this.frame(e,t,r)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){const t=window.document.createElement("canvas"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL:e=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==a?a:!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)},set prefersReducedMotion(e){a=e}},l=new class{constructor(){this._realTime="undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:this._realTime()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function c(){return l.getCurrentTime()}class u{static testProp(e){if(!u.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in u.docStyle)return e[t];return e[0]}static create(e,t,r){const i=window.document.createElement(e);return void 0!==t&&(i.className=t),r&&r.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){u.docStyle&&u.selectProp&&(u.userSelect=u.docStyle[u.selectProp],u.docStyle[u.selectProp]="none")}static enableDrag(){u.docStyle&&u.selectProp&&(u.docStyle[u.selectProp]=u.userSelect)}static setTransform(e,t){e.style[u.transformProp]=t}static addEventListener(e,t,r,i={}){e.addEventListener(t,r,"passive"in i?i:i.capture)}static removeEventListener(e,t,r,i={}){e.removeEventListener(t,r,"passive"in i?i:i.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",u.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",u.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",u.suppressClickInternal,!0)},0)}static getScale(e){const t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,r,i){const n=r.boundingClientRect;return new t.P((i.clientX-n.left)/r.x-e.clientLeft,(i.clientY-n.top)/r.y-e.clientTop)}static mousePos(e,t){const r=u.getScale(e);return u.getPoint(e,r,t)}static touchPos(e,t){const r=[],i=u.getScale(e);for(let n=0;n<t.length;n++)r.push(u.getPoint(e,i,t[n]));return r}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const t=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),r=t.querySelectorAll("script");for(const i of r)i.remove();return u.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){const r=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!r.includes("javascript:")&&!r.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const t=e.children;for(const r of t)u.removeAttributes(r),u.clean(r)}static removeAttributes(e){for(const{name:t,value:r}of e.attributes)u.isPossiblyDangerous(t,r)&&e.removeAttribute(t)}}u.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,u.selectProp=u.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),u.transformProp=u.testProp(["transform","WebkitTransform"]);const h={supported:!1,testSupport:function(e){!f&&p&&(m?g(e):d=e)}};let d,p,f=!1,m=!1;function g(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p),e.isContextLost())return;h.supported=!0}catch(e){}e.deleteTexture(t),f=!0}var y;"undefined"!=typeof document&&(p=document.createElement("img"),p.onload=()=>{d&&g(d),d=null,m=!0},p.onerror=()=>{f=!0,d=null},p.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let r,i,n,o;e.resetRequestQueue=()=>{r=[],i=0,n=0,o={}},e.addThrottleControl=e=>{const t=n++;return o[t]=e,t},e.removeThrottleControl=e=>{delete o[e],s()},e.getImage=(e,i,n=!0)=>new Promise((o,a)=>{h.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),r.push({abortController:i,requestParameters:e,supportImageRefresh:n,state:"queued",onError:e=>{a(e)},onSuccess:e=>{o(e)}}),s()});const a=e=>t._(this,void 0,void 0,function*(){e.state="running";const{requestParameters:r,supportImageRefresh:n,onError:o,onSuccess:a,abortController:c}=e,u=!1===n&&!t.i(self)&&!t.g(r.url)&&(!r.headers||Object.keys(r.headers).reduce((e,t)=>e&&"accept"===t,!0));i++;const h=u?l(r,c):t.m(r,c);try{const r=yield h;delete e.abortController,e.state="completed",r.data instanceof HTMLImageElement||t.b(r.data)?a(r):r.data&&a({data:yield(d=r.data,"function"==typeof createImageBitmap?t.f(d):t.h(d)),cacheControl:r.cacheControl,expires:r.expires})}catch(t){delete e.abortController,o(t)}finally{i--,s()}var d}),s=()=>{const e=(()=>{for(const e of Object.keys(o))if(o[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=i;t<e&&r.length>0;t++){const e=r.shift();e.abortController.signal.aborted?t--:a(e)}},l=(e,r)=>new Promise((i,n)=>{const o=new Image,a=e.url,s=e.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!t.d(a))&&(o.crossOrigin="anonymous"),r.signal.addEventListener("abort",()=>{o.src="",n(new t.a(r.signal.reason))}),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})}(y||(y={})),y.resetRequestQueue();class _{constructor(e){this._transformRequestFn=null!=e?e:null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function v(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const r=[];for(const{id:i,url:n}of e){const e=`${i}${n}`;-1===r.indexOf(e)&&(r.push(e),t.push({id:i,url:n}))}}return t}function b(e,t,r){try{const i=new URL(e);return i.pathname+=`${t}${r}`,i.toString()}catch(t){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function x(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class w extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const r=this.images[e];if(r&&!r.data&&r.spriteData){const e=r.spriteData;r.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),r.spriteData=null}return r}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,r){let i=!0;const n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let r=0;for(const i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;const r=t.spriteData,i=r&&r.width||t.data.width,n=r&&r.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||n<e[1]||e[2]<0||i<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,r=!0){const i=this.getImage(e);if(r&&(i.data.width!==t.data.width||i.data.height!==t.data.height))throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=i.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){const t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,r)=>{let i=!0;if(!this.isLoaded())for(const n of e)this.images[n]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){const r={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.l("styleimagemissing",{id:i})),e=this.getImage(i)),e?r[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.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:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const r=this.patterns[e],i=this.getImage(e);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 t.I(r,i);this.patterns[e]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.T(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:r,h:i}=t.p(e),n=this.atlasImage;n.resize({width:r||1,height:i||1});for(const o in this.patterns){const{bin:e}=this.patterns[o],r=e.x+1,i=e.y+1,a=this.getImage(o).data,s=a.width,l=a.height;t.R.copy(a,n,{x:0,y:0},{x:r,y:i},{width:s,height:l}),t.R.copy(a,n,{x:0,y:l-1},{x:r,y:i-1},{width:s,height:1}),t.R.copy(a,n,{x:0,y:0},{x:r,y:i+l},{width:s,height:1}),t.R.copy(a,n,{x:s-1,y:0},{x:r-1,y:i},{width:1,height:l}),t.R.copy(a,n,{x:0,y:0},{x:r+s,y:i},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const r of e){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;const e=this.getImage(r);e||t.w(`Image with ID: "${r}" was not found`),x(e)&&this.updateImage(r,e)}}cloneImages(){const e={};for(const t in this.images){const r=this.images[t];e[t]=Object.assign(Object.assign({},r),{data:r.data?r.data.clone():null})}return e}}const T=1e20;function S(e,t,r,i,n,o,a,s,l){for(let c=t;c<t+i;c++)E(e,r*o+c,o,n,a,s,l);for(let c=r;c<r+n;c++)E(e,c*o+t,1,i,a,s,l)}function E(e,t,r,i,n,o,a){o[0]=0,a[0]=-T,a[1]=T,n[0]=e[t];for(let s=1,l=0,c=0;s<i;s++){n[s]=e[t+s*r];const i=s*s;do{const e=o[l];c=(n[s]-n[e]+i-e*e)/(s-e)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=T}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;const i=o[l],c=s-i;e[t+s*r]=n[i]+c*c}}const I=t.v.layout_symbol["text-font"].default.join(",");class P{constructor(e,t,r){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=r}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,function*(){const t=[];for(const n in e)for(const r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));const r=yield Promise.all(t),i={};for(const{stack:e,id:n,glyph:o}of r)i[e]||(i[e]={}),i[e][n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return i})}_getAndCacheGlyphsPromise(e,r){return t._(this,void 0,void 0,function*(){let t=this.entries[e];t||(t=this.entries[e]={glyphs:{},requests:{},ranges:{}});let i=t.glyphs[r];return void 0!==i?{stack:e,id:r,glyph:i}:!this.url||this._charUsesLocalIdeographFontFamily(r)?(i=t.glyphs[r]=this._drawGlyph(t,e,r),{stack:e,id:r,glyph:i}):yield this._downloadAndCacheRangePromise(e,r)})}_downloadAndCacheRangePromise(e,r){return t._(this,void 0,void 0,function*(){const t=this.entries[e],i=Math.floor(r/256);if(t.ranges[i])return{stack:e,id:r,glyph:null};if(!t.requests[i]){const r=P.loadGlyphRange(e,i,this.url,this.requestManager);t.requests[i]=r}try{const n=yield t.requests[i];for(const e in n)t.glyphs[+e]=n[+e];return t.ranges[i]=!0,{stack:e,id:r,glyph:n[r]||null}}catch(n){const a=t.glyphs[r]=this._drawGlyph(t,e,r);return this._warnOnMissingGlyphRange(a,i,r,n),{stack:e,id:r,glyph:a}}})}_warnOnMissingGlyphRange(e,r,i,n){const o=256*r,a=o+255,s=i.toString(16).padStart(4,"0").toUpperCase();t.w(`Unable to load glyph range ${r}, ${o}-${a}. Rendering codepoint U+${s} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.q(e)}_drawGlyph(e,r,i){const n=r===I&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i),o=n?"ideographTinySDF":"tinySDF";e[o]||(e[o]=this._createTinySDF(n?this.localIdeographFontFamily:r));const a=e[o].draw(String.fromCodePoint(i));return{id:i,bitmap:new t.r({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}}}_createTinySDF(e){const t=e?e.split(","):[];t.push("sans-serif");const r=t.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(",");return new P.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:r,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){const t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let r;for(const[i,n]of Object.entries(t))new RegExp(`\\b${i}\\b`,"i").test(e)&&(r=`${n}`);return r}destroy(){for(const e in this.entries){const t=this.entries[e];t.tinySDF&&(t.tinySDF=null),t.ideographTinySDF&&(t.ideographTinySDF=null),t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}P.loadGlyphRange=function(e,r,i,n){return t._(this,void 0,void 0,function*(){const o=256*r,a=o+255,s=n.transformRequest(i.replace("{fontstack}",e).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield t.n(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${r}, ${o}-${a}`);const c={};for(const e of t.o(l.data))c[e.id]=e;return c})},P.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal",lang:s=null}={}){this.buffer=t,this.cutoff=i,this.radius=r,this.lang=s;const l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),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:t};if(0===s||0===l)return p;const{ctx:f,buffer:m,gridInner:g,gridOuter:y}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,s,l),f.fillText(e,m,m+a);const _=f.getImageData(m,m,s,l);y.fill(T,0,h),g.fill(0,0,h);for(let v=0;v<l;v++)for(let e=0;e<s;e++){const t=_.data[4*(v*s+e)+3]/255;if(0===t)continue;const r=(v+m)*c+e+m;if(1===t)y[r]=0,g[r]=T;else{const e=.5-t;y[r]=e>0?e*e:0,g[r]=e<0?e*e:0}}S(y,0,0,c,u,c,this.f,this.v,this.z),S(g,m,m,s,l,c,this.f,this.v,this.z);for(let v=0;v<h;v++){const e=Math.sqrt(y[v])-Math.sqrt(g[v]);d[v]=Math.round(255-255*(e/this.radius+this.cutoff))}return p}};class k{constructor(){this.specification=t.u.light.position}possiblyEvaluate(e,r){return t.F(e.expression.evaluate(r))}interpolate(e,r,i){return{x:t.G.number(e.x,r.x,i),y:t.G.number(e.y,r.y,i),z:t.G.number(e.z,r.z,i)}}}let A;class C extends t.E{constructor(e){super(),A=A||new t.t({anchor:new t.D(t.u.light.anchor),position:new k,color:new t.D(t.u.light.color),intensity:new t.D(t.u.light.intensity)}),this._transitionable=new t.x(A,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(t.y,e,r))for(const i in e){const r=e[i];i.endsWith(t.z)?this._transitionable.setTransition(i.slice(0,-t.z.length),r):this._transitionable.setValue(i,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,r,i){return(!i||!1!==i.validate)&&t.B(this,e.call(t.C,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.u}))}}const M=new t.t({"sky-color":new t.D(t.u.sky["sky-color"]),"horizon-color":new t.D(t.u.sky["horizon-color"]),"fog-color":new t.D(t.u.sky["fog-color"]),"fog-ground-blend":new t.D(t.u.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.u.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.u.sky["atmosphere-blend"])});class D extends t.E{constructor(e){super(),this._transitionable=new t.x(M,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.H(0))}setSky(e,r={}){if(!this._validate(t.J,e,r)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const r in e){const i=e[r];r.endsWith(t.z)?this._transitionable.setTransition(r.slice(0,-t.z.length),i):this._transitionable.setValue(r,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,r,i={}){return!1!==(null==i?void 0:i.validate)&&t.B(this,e.call(t.C,t.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.u})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class R{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){const r=e.join(",")+String(t);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,r){const i=[];let n=e.length%2==1?-e[e.length-1]*r:0,o=e[0]*r,a=!0;i.push({left:n,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let l=1;l<e.length;l++){a=!a;const t=e[l];n=s*r,s+=t,o=s*r,i.push({left:n,right:o,isDash:a,zeroLength:0===t})}return i}addRoundDash(e,t,r){const i=t/2;for(let n=-r;n<=r;n++){const t=this.width*(this.nextRow+r+n);let o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++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 e=i-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=i-Math.sqrt(u*u+d*d);this.data[t+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let a=e.length-1;a>=0;--a){const t=e[a],r=e[a+1];t.zeroLength?e.splice(a,1):r&&r.isDash===t.isDash&&(r.left=t.left,e.splice(a,1))}const t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);const i=this.width*this.nextRow;let n=0,o=e[n];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++n]);const t=Math.abs(a-o.left),r=Math.abs(a-o.right),s=Math.min(t,r);this.data[i+a]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,r){const i=r?7:0,n=2*i+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,n=this.getDashRanges(e,this.width,t);r?this.addRoundDash(n,t,i):this.addRegularDash(n)}const a={y:this.nextRow+i,height:2*i,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(e){const t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}const O="maplibre_preloaded_worker_pool";class L{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<L.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[O]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(s.hardwareConcurrency/2);let z,B;function N(){return z||(z=new L),z}L.workerCount=t.K(globalThis)?Math.max(Math.min(F,3),1):1;class j{constructor(e,r){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=r;const i=this.workerPool.acquire(r);for(let n=0;n<i.length;n++){const e=new t.L(i[n],r);e.name=`Worker ${n}`,this.actors.push(e)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){const r=[];for(const i of this.actors)r.push(i.sendAsync({type:e,data:t}));return Promise.all(r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(e=>{e.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(const r of this.actors)r.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(const t of this.actors)t.unregisterMessageHandler(e)}}function V(){return B||(B=new j(N(),t.M),B.registerMessageHandler("GR",(e,r,i)=>t.m(r,i))),B}function U(e,r){const i=t.N();return t.O(i,i,[1,1,0]),t.Q(i,i,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.S(i,i,e.calculatePosMatrix(r.toUnwrapped())):i}function G(e,t,r,i,n,o,a){var s;const l=function(e,t,r){if(e)for(const i of e){const e=t[i];if(e&&e.source===r&&"fill-extrusion"===e.type)return!0}else for(const i in t){const e=t[i];if(e.source===r&&"fill-extrusion"===e.type)return!0}return!1}(null!==(s=null==n?void 0:n.layers)&&void 0!==s?s:null,t,e.id),c=o.maxPitchScaleFactor(),u=e.tilesIn(i,c,l);u.sort(q);const h=[];for(const d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,r,e.getState(),d.queryGeometry,d.cameraQueryGeometry,d.scale,n,o,c,U(o,d.tileID),a?(e,t)=>a(d.tileID,e,t):void 0)});return function(e,t){for(const r in e)for(const i of e[r])$(i,t);return e}(function(e){const t={},r={};for(const i of e){const e=i.queryResults,n=i.wrappedTileID,o=r[n]=r[n]||{};for(const r in e){const i=e[r],n=o[r]=o[r]||{},a=t[r]=t[r]||[];for(const e of i)n[e.featureIndex]||(n[e.featureIndex]=!0,a.push(e))}}return t}(h),e)}function q(e,t){const r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function $(e,t){const r=e.feature,i=t.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 W(e,r,i){return t._(this,void 0,void 0,function*(){let n=e;if(e.url?n=(yield t.j(r.transformRequest(e.url,"Source"),i)).data:yield s.frameAsync(i),!n)return null;const o=t.U(t.e(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map(e=>e.id)),o})}class Z{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.V?new t.V(e.lng,e.lat):t.V.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.V?new t.V(e.lng,e.lat):t.V.convert(e),this}extend(e){const r=this._sw,i=this._ne;let n,o;if(e instanceof t.V)n=e,o=e;else{if(!(e instanceof Z))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Z.convert(e)):this.extend(t.V.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.V.convert(e)):this;if(n=e._sw,o=e._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 t.V(n.lng,n.lat),this._ne=new t.V(o.lng,o.lat)),this}getCenter(){return new t.V((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new t.V(this.getWest(),this.getNorth())}getSouthEast(){return new t.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:i}=t.V.convert(e);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}intersects(e){if(!((e=Z.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;const r=Math.abs(this.getEast()-this.getWest()),i=Math.abs(e.getEast()-e.getWest());if(r>=360||i>=360)return!0;const n=t.W(this.getWest(),-180,180),o=t.W(this.getEast(),-180,180),a=t.W(e.getWest(),-180,180),s=t.W(e.getEast(),-180,180),l=n>=o,c=a>=s;return!(!l||!c)||(l?s>=n||a<=o:c?o>=a||n<=s:a<=o&&s>=n)}static convert(e){return e instanceof Z?e:e?new Z(e):e}static fromLngLat(e,r=0){const i=360*r/40075017,n=i/Math.cos(Math.PI/180*e.lat);return new Z(new t.V(e.lng-n,e.lat-i),new t.V(e.lng+n,e.lat+i))}adjustAntiMeridian(){const e=new t.V(this._sw.lng,this._sw.lat),r=new t.V(this._ne.lng,this._ne.lat);return new Z(e,e.lng>r.lng?new t.V(r.lng+360,r.lat):r)}}class H{constructor(e,t,r){this.bounds=Z.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const r=Math.pow(2,e.z),i=Math.floor(t.Y(this.bounds.getWest())*r),n=Math.floor(t.X(this.bounds.getNorth())*r),o=Math.ceil(t.Y(this.bounds.getEast())*r),a=Math.ceil(t.X(this.bounds.getSouth())*r);return e.x>=i&&e.x<o&&e.y>=n&&e.y<a}}class X extends t.E{constructor(e,r,i,n){if(super(),this.id=e,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,t.e(this,t.U(r,["url","scheme","tileSize","promoteId","encoding"])),this._options=t.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 t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield W(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new H(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.Z(e)||this.fire(new t.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(e)};r.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,r)=>{e.reloadPromise={resolve:t,reject:r}})}else e.actor=this.dispatcher.getActor(),i="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:i,data:r},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}})}_getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const t=e.tileID.scaledTo(this.maxzoom).canonical,r=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){const t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class K extends t.E{constructor(e,r,i,n){super(),this.id=e,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=t.e({type:"raster"},r),t.e(this,t.U(r,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield W(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(t.e(this,r),r.bounds&&(this.tileBounds=new H(r.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.Z(e)||this.fire(new t.k(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,function*(){const r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const i=yield y.getImage(this.map._requestManager.transformRequest(r,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const r=this.map.painter.context,n=r.gl,o=i.data;e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.T(r,o,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Y extends K{constructor(e,r,i,n){super(e,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=t.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(e){return t._(this,void 0,void 0,function*(){const r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const r=yield y.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(r&&r.data){const i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});const n=t.b(i)&&t.$()?i:yield this.readImageNow(i),o={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();const t=yield e.actor.sendAsync({type:"LDT",data:o});e.dem=t,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}})}readImageNow(e){return t._(this,void 0,void 0,function*(){if("undefined"!=typeof VideoFrame&&t.a0()){const r=e.width+2,i=e.height+2;try{return new t.R({width:r,height:i},yield t.a1(e,-1,-1,r,i))}catch(e){}}return s.getImageData(e,1)})}_getNeighboringTiles(e){const r=e.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?e.wrap-1:e.wrap,a=(r.x+1+i)%i,s=r.x+1===i?e.wrap+1:e.wrap,l={};return l[new t.a2(e.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new t.a2(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new t.a2(e.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new t.a2(e.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),l}unloadTile(e){return t._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}function J(e){return"GeometryCollection"===e.type?e.geometries.map(e=>e.coordinates).flat(1/0):e.coordinates.flat(1/0)}function Q(e){const t=new Z;let r;switch(e.type){case"FeatureCollection":r=e.features.map(e=>J(e.geometry)).flat(1/0);break;case"Feature":r=J(e.geometry);break;default:r=J(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}class ee extends t.E{constructor(e,r,i,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:r.data},this.actor=i.getActor(),this.setEventedParent(n),this._data="string"==typeof r.data?{url:r.data}:{geojson:r.data},this._options=t.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&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=t.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:t.a5,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:t.a5,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)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(e){return e*(t.a5/this.tileSize)}_getClusterMaxZoom(e){const r=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${r}"`),r}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e,t){this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};const r=this._updateWorkerData();return t?r:this}updateData(e,r){this._pendingWorkerUpdate.diff=t.a6(this._pendingWorkerUpdate.diff,e);const i=this._updateWorkerData();return r?i:this}getData(){return t._(this,void 0,void 0,function*(){const e=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getBounds(){return t._(this,void 0,void 0,function*(){return Q(yield this.getData())})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:r}})}_updateWorkerData(){return t._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:e,diff:r}=this._pendingWorkerUpdate,i=t.e({type:this.type},this.workerOptions);void 0!==e?("string"==typeof e?(i.request=this.map._requestManager.transformRequest(s.resolveURL(e),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=e,this._pendingWorkerUpdate.data=void 0):r&&(i.dataDiff=r,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new t.l("dataloading",{dataType:"source"}));try{const e=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||e.abandoned)return void this.fire(new t.l("dataabort",{dataType:"source"}));e.data&&(this._data={geojson:e.data});const n=this._applyDiffToSource(r),o=this._getShouldReloadTileOptions(n);let a=null;e.resourceTiming&&e.resourceTiming[this.id]&&(a=e.resourceTiming[this.id].slice(0));const s={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&t.e(s,{resourceTiming:a}),this.fire(new t.l("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},s),{sourceDataType:"content",shouldReloadTileOptions:o})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(e))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyDiffToSource(e){if(!e)return;const r="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const e=t.a7(this._data.geojson,r);if(!e)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;const i=t.a8(this._data.updateable,e,r);return e.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>Q(e))}}shouldReloadTile(e,{affectedBounds:r}){if("loading"===e.state)return!0;if("unloaded"===e.state)return!1;const{buffer:i,extent:n}=this.workerOptions.geojsonVtOptions,o=function({x:e,y:r,z:i},n=0){const o=t.a3((e-n)/Math.pow(2,i)),a=t.a4((r+1+n)/Math.pow(2,i)),s=t.a3((e+1+n)/Math.pow(2,i)),l=t.a4((r-n)/Math.pow(2,i));return new Z([o,a],[s,l])}(e.tileID.canonical,i/n);for(const t of r)if(o.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.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};e.abortController=new AbortController;const i=yield this.actor.sendAsync({type:t,data:r},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,this.map.painter,"RT"===t)})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.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 t.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class te extends t.E{constructor(e,t,r,i){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=t}load(e){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const t=yield y.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.Z(e)||this.fire(new t.k(e))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const r=e.map(t.a9.fromLngLat);var i;return this.tileID=function(e){const r=t.aa.fromPoints(e),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 t.ac(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(e=>this.tileID.getTilePoint(e)._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 t.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,r=e.gl;this.texture||(this.texture=new t.T(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){const{minX:r,minY:i,maxX:n,maxY:o}=t.aa.fromPoints(e),a={};for(let s=0;s<=t.ab;s++){const e=Math.pow(2,s),t=Math.floor(r*e),l=Math.floor(i*e),c=Math.floor(n*e),u=Math.floor(o*e);a[s]={minTileX:t,minTileY:l,maxTileX:c,maxTileY:u}}return a}}class re extends te{constructor(e,t,r,i){super(e,t,r,i),this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{const e=yield t.ad(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.k(e))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new t.k(new t.ae(`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=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,r=e.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 t.T(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new t.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 ie extends te{constructor(e,r,i,n){super(e,r,i,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new t.k(new t.ae(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.ae(`sources.${e}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t.k(new t.ae(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new t.k(new t.ae(`sources.${e}`,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 t.k(new t.ae(`sources.${e}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){return t._(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 t.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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const r=this.map.painter.context,i=r.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(r,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ne={},oe=e=>{switch(e){case"geojson":return ee;case"image":return te;case"raster":return K;case"raster-dem":return Y;case"vector":return X;case"video":return re;case"canvas":return ie}return ne[e]},ae="RTLPluginLoaded";class se extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=V()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=s.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return t._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.l(ae))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let le=null;function ce(){return le||(le=new se),le}var ue,he;!function(e){e[e.Base=0]="Base",e[e.Parent=1]="Parent"}(ue||(ue={})),function(e){e[e.Departing=0]="Departing",e[e.Incoming=1]="Incoming"}(he||(he={}));class de{constructor(e,r){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.af(),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"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:r,fadeEndTime:i}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=r,this.fadeEndTime=i}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=c(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,r,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){const r={};if(!t)return r;for(const i of e){const e=i.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){i.layers=e,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)r[t.id]=i}}return r}(e.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const r=this.buckets[e];if(r instanceof t.ah){if(this.hasSymbolBuckets=!0,!i)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const r=this.buckets[e];if(r instanceof t.ah&&r.hasRTLText){this.hasRTLText=!0,ce().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ag}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const r=this.buckets[t];r.uploadPending()&&r.upload(e)}const r=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,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},e,t,r):{}}querySourceFeatures(e,r){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=r&&r.sourceLayer?r.sourceLayer:"",a=n[t.ai]||n[o];if(!a)return;const s=t.aj(null==r?void 0:r.filter,null==r?void 0:r.globalState),{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 e=t.ak(r,!0);if(!s.filter(new t.H(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.H(this.tileID.overscaledZ),r))continue;const n=i.getId(r,o),p=new t.al(r,l,c,u,n);p.tile=h,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const r=this.expirationTime;if(e.cacheControl){const r=t.am(e.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(r)if(this.expirationTime<r)t=!0;else{const i=this.expirationTime-r;i?this.expirationTime=e+Math.max(i,3e4):t=!0}else t=!0;t?(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(e,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!r.style.hasLayer(n))continue;const o=this.buckets[n],a=o.layers[0].sourceLayer||t.ai,s=i[a],l=e[a];if(!s||!l||0===Object.keys(l).length)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const c=r&&r.style&&r.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=c()+e}setDependencies(e,t){const r={};for(const i of t)r[i]=!0;this.dependencies[e]=r}hasDependency(e,t){for(const r of e){const e=this.dependencies[r];if(e)for(const r of t)if(e[r])return!0}return!1}}class pe{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,r,i){const n=String(r);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.e(this.stateChanges[e][n],i),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])i[t]||(this.deletedStates[e][n][t]=null)}else for(const t in i)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,r){if(null===this.deletedStates[e])return;const i=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==t)null!==this.deletedStates[e][i]&&(this.deletedStates[e][i]=this.deletedStates[e][i]||{},this.deletedStates[e][i][r]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,r){const i=String(r),n=t.e({},(this.state[e]||{})[i],(this.stateChanges[e]||{})[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][r];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,r){const i={};for(const n in this.stateChanges){this.state[n]=this.state[n]||{};const e={};for(const r in this.stateChanges[n])this.state[n][r]||(this.state[n][r]={}),t.e(this.state[n][r],this.stateChanges[n][r]),e[r]=this.state[n][r];i[n]=e}for(const n in this.deletedStates){this.state[n]=this.state[n]||{};const e={};if(null===this.deletedStates[n])for(const t in this.state[n])e[t]={},this.state[n][t]={};else for(const t in this.deletedStates[n]){if(null===this.deletedStates[n][t])this.state[n][t]={};else for(const e of Object.keys(this.deletedStates[n][t]))delete this.state[n][t][e];e[t]=this.state[n][t]}i[n]=i[n]||{},t.e(i[n],e)}this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length&&e.setFeatureState(i,r)}}const fe=89.25;function me(e,r){const i=t.an(r.lat,-t.ao,t.ao);return new t.P(t.Y(r.lng)*e,t.X(i)*e)}function ge(e,r){return new t.a9(r.x/e,r.y/e).toLngLat()}function ye(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ap(90-e.pitch)),Math.tan(t.ap(fe-e.pitch)))}function _e(e,r){const i=e.canonical,n=r/t.aq(i.z),o=i.x+Math.pow(2,i.z)*e.wrap,a=t.ar(new Float64Array(16));return t.O(a,a,[o*n,i.y*n,0]),t.Q(a,a,[n/t.a5,n/t.a5,1]),a}function ve(e,r,i,n,o){const a=t.a9.fromLngLat(e,r),s=o*t.as(1,e.lat),{x:l,y:c,z:u}=be(i,n);return new t.a9(a.x+s*-l,a.y+s*-c,a.z+s*-u)}function be(e,r){const i=t.ap(e),n=t.ap(r),o=Math.cos(-i),a=Math.sin(i);return{x:a*Math.sin(n),y:-a*Math.cos(n),z:o}}function xe(e,t,r){const i=t.intersectsFrustum(e);if(!r||0===i)return i;const n=t.intersectsPlane(r);return 0===n?0:2===i&&2===n?2:1}function we(e,t,r){let i=0;const n=(r-t)/10;for(let o=0;o<10;o++)i+=n*Math.pow(Math.cos(t+(o+.5)/10*(r-t)),e);return i}function Te(e,r){return function(i,n,o,a,s){const l=2*((e-1)/t.at(Math.cos(t.ap(fe-s))/Math.cos(t.ap(fe)))-1),c=Math.acos(o/a),u=2*we(l-1,0,t.ap(s/2)),h=Math.min(t.ap(fe),c+t.ap(s/2)),d=we(l-1,Math.min(h,c-t.ap(s/2)),h),p=Math.atan(n/o),f=Math.hypot(n,o);let m=i;return m+=t.at(a/f/Math.max(.5,Math.cos(t.ap(s/2)))),m+=l*t.at(Math.cos(p))/2,m-=t.at(Math.max(1,d/u/r))/2,m}}const Se=Te(9.314,3);function Ee(e,r){const i=(r.roundZoom?Math.round:Math.floor)(e.zoom+t.at(e.tileSize/r.tileSize));return Math.max(0,i)}function Ie(e,r){const i=e.getCameraFrustum(),n=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=t.a9.fromLngLat(e.center,e.elevation);o.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;const s=e.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(e,r),c=Ee(e,r),u=r.minzoom||0,h=void 0!==r.maxzoom?r.maxzoom:e.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),y=Math.abs(a.z-o.z),_=Math.hypot(g,y),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let t=1;t<=3;t++)b.push(v(-t)),b.push(v(t));for(b.push(v(0));b.length>0;){const p=b.pop(),g=p.x,v=p.y;let w=p.fullyVisible;const T={x:g,y:v,z:p.zoom},S=s.getTileBoundingVolume(T,p.wrap,e.elevation,r);if(!w){const e=xe(i,S,n);if(0===e)continue;w=2===e}const E=s.distanceToTile2d(o.x,o.y,T,S);let I=c;l&&(I=(r.calculateTileZoom||Se)(e.zoom+t.at(e.tileSize/r.tileSize),E,y,_,e.fov)),I=(r.roundZoom?Math.round:Math.floor)(I),I=Math.max(0,I);const P=Math.min(I,h);if(p.wrap=s.getWrap(a,T,p.wrap),p.zoom>=P){if(p.zoom<u)continue;const e=d-p.zoom,i=f[0]-.5-(g<<e),n=f[1]-.5-(v<<e),o=r.reparseOverscaled?Math.max(p.zoom,I):p.zoom;x.push({tileID:new t.a2(p.zoom===h?o:p.zoom,p.wrap,p.zoom,g,v),distanceSq:t.au([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let e=0;e<4;e++)b.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:p.wrap,fullyVisible:w})}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}const Pe=t.aa.fromPoints([new t.P(0,0),new t.P(t.a5,t.a5)]);function ke(e){return"raster"===e||"image"===e||"video"===e}function Ae(e,t,r,i,n,o,a){if(!t.hasData())return!1;const{tileID:s,fadingRole:l,fadingDirection:c,fadingParentID:u}=t;if(l===ue.Base&&c===he.Incoming&&u)return r[u.key]=u,!0;const h=Math.max(s.overscaledZ-n,o);for(let d=s.overscaledZ-1;d>=h;d--){const n=s.scaledTo(d),o=e.getLoadedTile(n);if(o)return t.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Incoming,fadingParentID:o.tileID,fadeEndTime:i+a}),o.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Departing,fadeEndTime:i+a}),r[n.key]=n,!0}return!1}function Ce(e,t,r,i,n,o){if(!t.hasData())return!1;const a=t.tileID.children(n);let s=Me(e,t,a,r,i,n,o);if(s)return!0;for(const l of a)Me(e,t,l.children(n),r,i,n,o)&&(s=!0);return s}function Me(e,t,r,i,n,o,a){if(r[0].overscaledZ>=o)return!1;let s=!1;for(const l of r){const r=e.getLoadedTile(l);if(!r)continue;const{fadingRole:o,fadingDirection:c,fadingParentID:u}=r;o===ue.Base&&c===he.Departing&&u||(r.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Departing,fadingParentID:t.tileID,fadeEndTime:n+a}),t.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Incoming,fadeEndTime:n+a})),i[l.key]=l,s=!0}return s}function De(e,t,r,i){const n=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(n)&&(e.setSelfFadeLogic(r+i),!0)}function Re(e,t){var r;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x;const n=t.tileID.canonical.y-e.tileID.canonical.y,o=Math.pow(2,e.tileID.canonical.z),a=t.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),(null===(r=e.neighboringTiles)||void 0===r?void 0:r[a])&&(e.neighboringTiles[a].backfilled=!0)))}class Oe{constructor(){this._tiles={}}handleWrapJump(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}setFeatureState(e,t){for(const r in this._tiles)this._tiles[r].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(t.aw).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){const t=this.getTileById(e.key);return(null==t?void 0:t.hasData())?t:null}isIdRenderable(e,t=!1){var r;return null===(r=this.getTileById(e))||void 0===r?void 0:r.isRenderable(t)}getRenderableIds(e=0,r){const i=[];for(const t of this.getAllIds())this.isIdRenderable(t,r)&&i.push(this.getTileById(t));return r?i.sort((r,i)=>{const n=r.tileID,o=i.tileID,a=new t.P(n.canonical.x,n.canonical.y)._rotate(-e),s=new t.P(o.canonical.x,o.canonical.y)._rotate(-e);return n.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x}).map(e=>e.tileID.key):i.map(e=>e.tileID).sort(t.aw).map(e=>e.key)}}class Le extends t.E{constructor(e,r,i){super(),this.id=e,this.dispatcher=i,this.on("data",e=>this._dataHandler(e)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,r,i)=>{const n=new(oe(t.type))(e,t,r,i);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,r,i,this),this._inViewTiles=new Oe,this._outOfViewCache=new t.ax(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new pe,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){for(const t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e),this._inViewTiles=new Oe}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 e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,r,i){return t._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,r,i)}catch(r){e.state="errored",404!==r.status?this._source.fire(new t.k(r,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){var t;return this._inViewTiles.getRenderableIds(null===(t=this.transform)||void 0===t?void 0:t.bearingInRadians,e)}hasRenderableParent(e){const t=e.overscaledZ-1;if(t>=this._source.minzoom){const r=this.getLoadedTile(e.scaledTo(t));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const r of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(r);t&&!this._source.shouldReloadTile(i,t)||(e?this._reloadTile(r,"expired"):"errored"!==i.state&&this._reloadTile(r,"reloading"))}}}_reloadTile(e,r){return t._(this,void 0,void 0,function*(){const t=this._inViewTiles.getTileById(e);t&&("loading"!==t.state&&(t.state=r),yield this._loadTile(t,e,r))})}_tileLoaded(e,r,i){e.timeAdded=c(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),"raster-dem"===this.getSource().type&&e.dem&&function(e,t){var r,i;const n=t.getRenderableIds();for(const o of n){if(!e.neighboringTiles||!e.neighboringTiles[o])continue;const n=t.getTileById(o);e.neighboringTiles[o].backfilled||Re(e,n),(null===(i=null===(r=n.neighboringTiles)||void 0===r?void 0:r[e.tileID.key])||void 0===i?void 0:i.backfilled)||Re(n,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.l("data",{dataType:"source",tile:e,coord:e.tileID}))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){const r=this._getLoadedDescendents(t),i=new Set;for(const n of t){const t=r[n.key];if(!(null==t?void 0:t.length)){i.add(n);continue}const o=n.overscaledZ+Le.maxOverzooming,a=t.filter(e=>e.tileID.overscaledZ<=o);if(!a.length){i.add(n);continue}const s=Math.min(...a.map(e=>e.tileID.overscaledZ)),l=a.filter(e=>e.tileID.overscaledZ===s).map(e=>e.tileID);for(const r of l)e[r.key]=r;this._areDescendentsComplete(l,s,n.overscaledZ)||i.add(n)}return i}_getLoadedDescendents(e){var t;const r={};for(const i of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(const n of e)i.tileID.isChildOf(n)&&(r[t=n.key]||(r[t]=[])).push(i);return r}_areDescendentsComplete(e,t,r){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:Math.pow(4,t-r)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){const r=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(r*i*(null===this._maxTileCacheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._outOfViewCache.setMaxSize(o)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,r){if(!this._sourceLoaded||this._paused)return;let i;this.transform=e,this.terrain=r,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.a2(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(i=Ie(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale: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(e=>this._source.hasTile(e)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));const n=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const o=Ee(e,this._source),a=this._updateRetainedTiles(i,o),s=ke(this._source.type);s&&this._rasterFadeDuration>0&&!r&&function(e,r,i,n,o,a,s){const l=c(),u=t.av(r);for(const t of r){const r=e.getTileById(t.key);r.fadingDirection!==he.Departing&&0!==r.fadeOpacity||r.resetFadeLogic(),Ae(e,r,i,l,n,o,s)||Ce(e,r,i,l,a,s)||De(r,u,l,s)||r.resetFadeLogic()}}(this._inViewTiles,i,a,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(e){for(const t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(const t of this._inViewTiles.getAllIds()){const r=this._inViewTiles.getTileById(t);e[t]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(t):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){const t=[];for(const r of e)if(r.canonical.z>this._source.minzoom){const e=r.scaledTo(r.canonical.z-1);t.push(e);const i=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));t.push(i)}return e.concat(t)}releaseSymbolFadeTiles(){for(const e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var r;const i=new Set;for(const l of e)this._addTile(l).hasData()||i.add(l);const n=e.reduce((e,t)=>(e[t.key]=t,e),{}),o=this._retainLoadedChildren(n,i),a={},s=Math.max(t-Le.maxUnderzooming,this._source.minzoom);for(const l of o){let e=this._inViewTiles.getTileById(l.key),t=null==e?void 0:e.wasRequested();for(let i=l.overscaledZ-1;i>=s;--i){const o=l.scaledTo(i);if(a[o.key])break;if(a[o.key]=!0,e=this.getTile(o),!e&&t&&(e=this._addTile(o)),e){const i=e.hasData();if((i||!(null===(r=this.map)||void 0===r?void 0:r.cancelPendingTileRequestsWhileZooming)||t)&&(n[o.key]=o),t=e.wasRequested(),i)break}}}return n}_addTile(e){let r=this._inViewTiles.getTileById(e.key);if(r)return r;r=this._outOfViewCache.getAndRemove(e),r&&(r.resetFadeLogic(),this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null));const i=r;return r||(r=new de(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,e.key,r.state)),r.uses++,this._inViewTiles.setTile(e.key,r),i||this._source.fire(new t.l("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);const r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},r))}_clearTileReloadTimer(e){const t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e of this._inViewTiles.getAllIds()){const t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(const t of this._inViewTiles.getAllIds()){const r=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==r.state)&&e.some(e=>e.equals(r.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){const t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,r,i){const n=[],o=this.transform;if(!o)return n;const a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?o.getCameraQueryGeometry(e):e,l=e=>o.screenPointToMercatorCoordinate(e,this.terrain),c=this.transformBbox(e,l,!a),u=this.transformBbox(s,l,!a),h=this.getIds(),d=t.aa.fromPoints(u);for(let p=0;p<h.length;p++){const e=this._inViewTiles.getTileById(h[p]);if(e.holdingForSymbolFade())continue;const i=a?[e.tileID]:[e.tileID.unwrapTo(-1),e.tileID.unwrapTo(0)],s=Math.pow(2,o.zoom-e.tileID.overscaledZ),l=r*e.queryPadding*t.a5/e.tileSize/s;for(const r of i){const i=d.map(e=>r.getTilePoint(new t.a9(e.x,e.y)));if(i.expandBy(l),i.intersects(Pe)){const t=c.map(e=>r.getTilePoint(e)),i=u.map(e=>r.getTilePoint(e));n.push({tile:e,tileID:a?r:r.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:s})}}}return n}transformBbox(e,r,i){let n=e.map(r);if(i){const i=t.aa.fromPoints(e);i.shrinkBy(.001*Math.min(i.width(),i.height()));const o=i.map(r);t.aa.fromPoints(n).covers(o)||(n=n.map(e=>e.x>.5?new t.a9(e.x-1,e.y,e.z):e))}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||!(!ke(this._source.type)||!function(e,t){if(t<=0)return!1;const r=c();for(const i of e.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,r,i){this._state.updateState(e=e||t.ai,r,i)}removeFeatureState(e,r,i){this._state.removeFeatureState(e=e||t.ai,r,i)}getFeatureState(e,r){return this._state.getState(e=e||t.ai,r)}setDependencies(e,t,r){const i=this._inViewTiles.getTileById(e);i&&i.setDependencies(t,r)}reloadTilesForDependencies(e,t){for(const r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(e,t)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(e,t))}areTilesLoaded(){for(const e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}}Le.maxUnderzooming=10,Le.maxOverzooming=3;class Fe{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],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(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.an(e,0,1);let r=1,i=this._distances[r];const n=e*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 ze(e,t){let r=!0;return"always"===e||"never"!==e&&"never"!==t||(r=!1),r}class Be{constructor(e,t,r){const i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/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=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,r,i,n,o){this.circleCells[n].push(o)}_query(e,t,r,i,n,o,a){if(r<0||e>this.width||i<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(n)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],r=this.circles[3*e+1],i=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-i,y1:r-i,x2:t+i,y2:r+i})}}else this._forEachCell(e,t,r,i,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,n,o){return this._query(e,t,r,i,!0,n,o).length>0}hitTestCircle(e,t,r,i,n){const o=e-r,a=e+r,s=t-r,l=t+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:e,y:t,radius:r},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(e,t,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(e<=n[h+2]&&t<=n[h+3]&&r>=n[h+0]&&i>=n[h+1]&&(!s||s(d))&&(!c||!ze(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],e,t,r,i)&&(!s||s(d))&&(!c||!ze(u,d.overlapMode))){const e=n[h],t=n[h+1],r=n[h+2];if(o.push({key:d,x1:e-r,y1:t-r,x2:e+r,y2:t+r}),c)return!0}}}return!1}_queryCellCircle(e,t,r,i,n,o,a,s){const{circle:l,seenUids:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const r=4*t,i=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!s||s(i))&&!ze(u,i.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const r=3*t,i=this.circleKeys[t];if(this._circlesCollide(e[r],e[r+1],e[r+2],l.x,l.y,l.radius)&&(!s||s(i))&&!ze(u,i.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,r,i,n,o,a,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),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,e,t,r,i,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,n,o){const a=i-e,s=n-t,l=r+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,r,i,n,o,a){const s=(o-i)/2,l=Math.abs(e-(i+s));if(l>s+r)return!1;const c=(a-n)/2,u=Math.abs(t-(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 Ne(e,r,n){const o=t.N();if(!e){const{vecSouth:e,vecEast:t}=Ve(r),n=i();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[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 t.Q(o,o,[1/n,1/n,1]),o}function je(e,r,i,n){if(e){const e=t.N();if(!r){const{vecSouth:t,vecEast:r}=Ve(i);e[0]=r[0],e[1]=r[1],e[4]=t[0],e[5]=t[1]}return t.Q(e,e,[n,n,1]),e}return i.pixelsToClipSpaceMatrix}function Ve(e){const r=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),s=t.aC();s[0]=-o*n*i-a*r,s[1]=-a*n*i+o*r;const l=t.aD(s);l<1e-9?t.aE(s):t.aF(s,s,1/l);const c=t.aC();c[0]=o*n*r-a*i,c[1]=a*n*r+o*i;const u=t.aD(c);return u<1e-9?t.aE(c):t.aF(c,c,1/u),{vecEast:c,vecSouth:s}}function Ue(e,r,i,n){let o;n?(o=[e,r,n(e,r),1],t.aH(o,o,i)):(o=[e,r,0,1],ot(o,o,i));const a=o[3];return{point:new t.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function Ge(e,t){return.5+e/t*.5}function qe(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function $e(e,r,i,n,o,a,s,l,c,u,h,d,p){const f=i?e.textSizeData:e.iconSizeData,m=t.ay(f,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],y=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();const _=e.lineVertexArray,v=i?e.text.placedSymbolArray:e.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===t.az.vertical&&!x){nt(i.numGlyphs,y);continue}x=!1;const T=new t.P(i.anchorX,i.anchorY),S={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:_,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:T,unwrappedTileID:c,width:u,height:h,translation:d},E=Qe(i.anchorX,i.anchorY,S);if(!qe(E.point,g)){nt(i.numGlyphs,y);continue}const I=Ge(r.transform.cameraToCenterDistance,E.signedDistanceFromCamera),P=t.aA(f,m,i),k=a?P*r.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,c)/I:P*I,A=He({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:i,fontSize:k,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l});x=A.useVertical,(A.notEnoughRoom||x||A.needsFlipping&&He({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:i,fontSize:k,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&nt(i.numGlyphs,y)}i?e.text.dynamicLayoutVertexBuffer.updateData(y):e.icon.dynamicLayoutVertexBuffer.updateData(y)}function We(e,t,r,i,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=t.getoffsetX(o.glyphStartIndex),d=t.getoffsetX(l-1),p=rt(e*h,r,i,n,o.segment,c,u,s,a);if(!p)return null;const f=rt(e*d,r,i,n,o.segment,c,u,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function Ze(e,r,i,n){return e===t.az.horizontal&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(e===t.az.vertical?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function He(e){const{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=o/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let m;if(n.numGlyphs>1){const e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=We(d,l,p,f,a,n,h,r);if(!c)return{notEnoughRoom:!0};const g=Je(c.first.point.x,c.first.point.y,r,i),y=Je(c.last.point.x,c.last.point.y,r,i);if(s&&!a){const e=Ze(n.writingMode,g,y,u);if(e)return e}m=[c.first];for(let i=n.glyphStartIndex+1;i<e-1;i++){const e=rt(d*l.getoffsetX(i),p,f,a,n.segment,t,o,r,h);if(!e)return{notEnoughRoom:!0};m.push(e)}m.push(c.last)}else{if(s&&!a){const e=Ye(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,o=n.lineStartIndex+n.segment+1,a=new t.P(r.lineVertexArray.getx(o),r.lineVertexArray.gety(o)),s=Ye(a.x,a.y,r),l=s.signedDistanceFromCamera>0?s.point:Xe(r.tileAnchorPoint,a,e,1,r),c=Je(e.x,e.y,r,i),h=Je(l.x,l.y,r,i),d=Ze(n.writingMode,c,h,u);if(d)return d}const e=rt(d*l.getoffsetX(n.glyphStartIndex),p,f,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,h);if(!e||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[e]}for(const g of m)t.aG(c,g.point,g.angle);return{}}function Xe(e,t,r,i,n){const o=e.add(e.sub(t)._unit()),a=Ye(o.x,o.y,n).point,s=r.sub(a);return r.add(s._mult(i/s.mag()))}function Ke(e,r,i){const n=r.projectionCache;if(n.projections[e])return n.projections[e];const o=new t.P(r.lineVertexArray.getx(e),r.lineVertexArray.gety(e)),a=Ye(o.x,o.y,r);if(a.signedDistanceFromCamera>0)return n.projections[e]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=e-i.direction;return Xe(0===i.distanceFromAnchor?r.tileAnchorPoint:new t.P(r.lineVertexArray.getx(s),r.lineVertexArray.gety(s)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,r)}function Ye(e,t,r){const i=e+r.translation[0],n=t+r.translation[1];let o;return r.pitchWithMap?(o=Ue(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 Je(e,r,i,n){if(i.pitchWithMap){const o=[e,r,0,1];return t.aH(o,o,n),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:e/i.width*2-1,y:1-r/i.height*2}}function Qe(e,t,r){return r.transform.projectTileCoordinates(e,t,r.unwrappedTileID,r.getElevation)}function et(e,t,r){return e._unit()._perp()._mult(t*r)}function tt(e,r,i,n,o,a,s,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=i.add(r);if(e+c.direction<n||e+c.direction>=o)return l.projectionCache.offsets[e]=u,u;const h=Ke(e+c.direction,l,c),d=et(h.sub(i),s,c.direction),p=i.add(d),f=h.add(d);return l.projectionCache.offsets[e]=t.aI(a,u,p,f)||u,l.projectionCache.offsets[e]}function rt(e,t,r,i,n,o,a,s,l){const c=i?e-t:e+t;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=Ye(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f,m,g=d,y=d,_=0,v=0;const b=Math.abs(c),x=[];let w;for(;_+v<=b;){if(p+=u,p<o||p>=a)return null;_+=v,y=g,m=f;const e={absOffsetX:b,direction:u,distanceFromAnchor:_,previousVertex:y};if(g=Ke(p,s,e),0===r)x.push(y),w=g.sub(y);else{let t;const i=g.sub(y);t=0===i.mag()?et(Ke(p+u,s,e).sub(g),r,u):et(i,r,u),m||(m=y.add(t)),f=tt(p,t,g,o,a,m,r,s,e),x.push(m),w=f.sub(m)}v=w.mag()}const T=w._mult((b-_)/v)._add(m||y),S=h+Math.atan2(g.y-y.y,g.x-y.x);return x.push(T),{point:T,angle:l?S:0,path:x}}const it=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function nt(e,t){for(let r=0;r<e;r++){const e=t.length;t.resize(e+4),t.float32.set(it,3*e)}}function ot(e,t,r){const i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e[3]=r[3]*i+r[7]*n+r[15],e}const at=100;class st{constructor(e,t=new Be(e.width+200,e.height+200,25),r=new Be(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+at,this.screenBottomBoundary=e.height+at,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,n,o,a,s,l,c,u,h){const d=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],n,c,h),p=r*d.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(e,p,i,n,o,a,s,d,c,u,h);else{const t=d.x+(u?u.x*p:0),r=d.y+(u?u.y*p:0);f={allPointsOccluded:!1,box:[t+e.x1*p,r+e.y1*p,t+e.x2*p,r+e.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"!==t&&this.grid.hitTest(m,g,y,_,t,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(e,r,i,n,o,a,s,l,c,u,h,d,p,f){const m=[],g=new t.P(r.anchorX,r.anchorY),y=this.getPerspectiveRatio(g.x,g.y,a,f),_=(c?o*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,a)/y:o*y)/t.aM,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=We(_,n,r.lineOffsetX*_,r.lineOffsetY*_,!1,r,!1,v);let x=!1,w=!1,T=!0;if(b){const r=.5*h*y+d,i=new t.P(-100,-100),n=new t.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Fe,a=b.first,s=b.last;let p=[];for(let e=a.path.length-1;e>=1;e--)p.push(a.path[e]);for(let e=1;e<s.path.length;e++)p.push(s.path[e]);const f=2.5*r;if(c){const e=this.projectPathToScreenSpace(p,v);p=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(p.length>0){const e=p[0].clone(),r=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),r.x=Math.max(r.x,p[t].x),r.y=Math.max(r.y,p[t].y);g=e.x>=i.x&&r.x<=n.x&&e.y>=i.y&&r.y<=n.y?[p]:r.x<i.x||e.x>n.x||r.y<i.y||e.y>n.y?[]:t.aJ([p],i.x,i.y,n.x,n.y)}for(const t of g){o.reset(t,.25*r);let i=0;i=o.length<=.5*r?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t<i;t++){const n=t/Math.max(i-1,1),a=o.lerp(n),s=a.x+at,c=a.y+at;m.push(s,c,r,0);const h=s-r,d=c-r,p=s+r,f=c+r;if(T=T&&this.isOffscreen(h,d,p,f),w=w||this.isInsideGrid(h,d,p,f),"always"!==e&&this.grid.hitTestCircle(s,c,r,e,u)&&(x=!0,!l))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!l&&x||!w||y<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:x}}projectPathToScreenSpace(e,r){const i=function(e,r){const i=t.N();return t.aB(i,r.pitchedLabelPlaneMatrix),e.map(e=>{const t=Ue(e.x,e.y,i,r.getElevation),n=r.transform.projectTileCoordinates(t.point.x,t.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})}(e,r);return function(e){let t=0,r=0,i=0,n=0;for(let o=0;o<e.length;o++)e[o].isOccluded?(i=o+1,n=0):(n++,n>r&&(r=n,t=i));return e.slice(t,t+r)}(i)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const r=[],i=new t.aa;for(const h of e){const e=new t.P(h.x+at,h.y+at);i.extend(e),r.push(e)}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 e=h.key;if(void 0===c[e.bucketInstanceId]&&(c[e.bucketInstanceId]={}),c[e.bucketInstanceId][e.featureIndex])continue;const i=[new t.P(h.x1,h.y1),new t.P(h.x2,h.y1),new t.P(h.x2,h.y2),new t.P(h.x1,h.y2)];t.aK(r,i)&&(c[e.bucketInstanceId][e.featureIndex]=!0,void 0===u[e.bucketInstanceId]&&(u[e.bucketInstanceId]=[]),u[e.bucketInstanceId].push(e.featureIndex))}return u}insertCollisionBox(e,t,r,i,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,n,o){const a=r?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:t};for(let l=0;l<e.length;l+=4)a.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,r,i,n,o){if(o){let i;n?(i=[e,r,n(e,r),1],t.aH(i,i,o)):(i=[e,r,0,1],ot(i,i,o));const a=i[3];return{x:(i[0]/a+1)/2*this.transform.width+at,y:(-i[1]/a+1)/2*this.transform.height+at,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const t=this.transform.projectTileCoordinates(e,r,i,n);return{x:(t.point.x+1)/2*this.transform.width+at,y:(1-t.point.y)/2*this.transform.height+at,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,r,i){const n=this.transform.projectTileCoordinates(e,t,r,i);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(e,t,r,i){return r<at||e>=this.screenRightBoundary||i<at||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const e=t.ar([]);return t.O(e,e,[-100,-100,0]),e}_projectCollisionBox(e,r,i,n,o,a,s,l,c,u,h){let d=1,p=0,f=0,m=1;const g=e.anchorPointX+s[0],y=e.anchorPointY+s[1];if(a&&!o){const e=this.projectAndGetPerspectiveRatio(g+1,y,n,c,h),t=e.x-l.x,r=Math.atan((e.y-l.y)/t)+(t<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 e=Ve(this.transform);d=e.vecEast[0],p=e.vecEast[1],f=e.vecSouth[0],m=e.vecSouth[1]}let _=l.x,v=l.y,b=r;o&&(_=g,v=y,b=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),b*=this.transform.getPitchedTextCorrection(g,y,n),u||(b*=t.an(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(_+=d*u.x*b+f*u.y*b,v+=p*u.x*b+m*u.y*b);const x=e.x1*b,w=e.x2*b,T=(x+w)/2,S=e.y1*b,E=e.y2*b,I=(S+E)/2,P=[{offsetX:x,offsetY:S},{offsetX:T,offsetY:S},{offsetX:w,offsetY:S},{offsetX:w,offsetY:I},{offsetX:w,offsetY:E},{offsetX:T,offsetY:E},{offsetX:x,offsetY:E},{offsetX:x,offsetY:I}];let k=[];for(const{offsetX:C,offsetY:M}of P)k.push(new t.P(_+d*C+f*M,v+p*C+m*M));let A=!1;if(o){const e=k.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,c,h));A=e.some(e=>!e.isOccluded),k=e.map(e=>new t.P(e.x,e.y))}else A=!0;return{box:t.aL(k),allPointsOccluded:!A}}}class lt{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class ct{constructor(e,t,r,i,n){this.text=new lt(e?e.text:null,t,r,n),this.icon=new lt(e?e.icon:null,t,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ut{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}}class ht{constructor(e,t,r,i,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}}class dt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function pt(e,r,i,n,o){const{horizontalAlign:a,verticalAlign:s}=t.aS(e);return new t.P(-(a-.5)*r+n[0]*o,-(s-.5)*i+n[1]*o)}class ft{constructor(e,t,r,i,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new st(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new dt(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(r,i)=>t.getElevation(e,r,i):null}getBucketParts(e,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/t.a5,d=i.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.aN(i,1,this.transform.zoom),m=t.aO(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),g=t.aO(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),y=Ne(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new ht(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const _={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatrix:y,scale:u,textPixelRatio:h,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.ay(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=t;e.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b){const x=t.aP[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=pt(x,i,n,w,o),S=this.collisionIndex.placeCollisionBox(r,d,l,c,u,s,a,g,h.predicate,v,T,b);if((!_||this.collisionIndex.placeCollisionBox(_,d,l,c,u,s,a,y,h.predicate,v,T,b).placeable)&&S.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=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:e},this.markUsedJustification(f,x,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(e,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}=e.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),y=t.aQ(o,"text-overlap","text-allow-overlap"),_="always"===y,v=t.aQ(o,"icon-overlap","icon-allow-overlap"),b="always"===v,x="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),E=_&&(b||!n.hasIconData()||g),I=b&&(_||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const P=this.retainedQueryData[n.bucketInstanceId].tileID,k=this._getTerrainElevationFunc(P),A=this.transform.getFastPathSimpleProjectionMatrix(P),C=(e,d,b)=>{var S,C;if(r[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new ut(!1,!1,!1));let M=!1,D=!1,R=!0,O=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},F={placeable:!1},z=null,B=null,N=null,j=0,V=0,U=0;d.textFeatureIndex?j=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(j=e.featureIndex),d.verticalTextFeatureIndex&&(V=d.verticalTextFeatureIndex);const G=d.textBox;if(G){const r=r=>{let i=t.az.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,i=t,this.markUsedOrientation(n,i,e))}return i},o=(r,i)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of n.writingModes)if(e===t.az.vertical?(L=i(),F=L):L=r(),L&&L.placeable)break}else L=r()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const i=(t,r)=>{const i=this.collisionIndex.placeCollisionBox(t,y,u,P,l,w,x,a,f.predicate,k,void 0,A);return i&&i.placeable&&(this.markUsedOrientation(n,r,e),this.placedOrientations[e.crossTileID]=r),i};o(()=>i(G,t.az.horizontal),()=>{const r=d.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?i(r,t.az.vertical):{box:null,offscreen:null}}),r(L&&L.placeable)}else{let p=t.aP[null===(C=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[e.crossTileID])||void 0===C?void 0:C.anchor];const m=(t,r,o)=>{const d=t.x2-t.x1,m=t.y2-t.y1,g=e.textBoxScale,_=T&&"never"===v?r:null;let b=null,S="never"===y?1:2,E="never";p&&S++;for(let i=0;i<S;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,t,d,m,g,x,w,u,P,l,f,E,e,n,o,a,s,_,k);if(c&&(b=c.placedGlyphBoxes,b&&b.placeable))return M=!0,O=c.shift,b}p?p=null:E=y}return i&&!b&&(b={box:this.collisionIndex.placeCollisionBox(G,"always",u,P,l,w,x,a,f.predicate,k,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),b};o(()=>m(G,d.iconBox,t.az.horizontal),()=>{const r=d.verticalTextBox;return n.allowVerticalPlacement&&(!L||!L.placeable)&&e.numVerticalGlyphVertices>0&&r?m(r,d.verticalIconBox,t.az.vertical):{box:null,occluded:!0,offscreen:null}}),L&&(M=L.placeable,R=L.offscreen);const g=r(L&&L.placeable);if(!M&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(z=L,M=z&&z.placeable,R=z&&z.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){const r=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.aA(n.textSizeData,p,r),u=o.get("text-padding");B=this.collisionIndex.placeCollisionCircles(y,r,n.lineVertexArray,n.glyphOffsetArray,s,l,c,i,w,f.predicate,e.collisionCircleDiameter,u,a,k),B.circles.length&&B.collisionDetected&&!i&&t.w("Collisions detected, but collision boxes are not shown"),M=_||B.circles.length>0&&!B.collisionDetected,R=R&&B.offscreen}if(d.iconFeatureIndex&&(U=d.iconFeatureIndex),d.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,v,u,P,l,w,x,s,f.predicate,k,T&&O?O:void 0,A);F&&F.placeable&&d.verticalIconBox?(N=e(d.verticalIconBox),D=N.placeable):(N=e(d.iconBox),D=N.placeable),R=R&&N.offscreen}const q=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,$=g||0===e.numIconVertices;q||$?$?q||(D=D&&M):M=D&&M:D=M=D&&M;const W=D&&N.placeable;if(M&&z.placeable&&this.collisionIndex.insertCollisionBox(z.box,y,o.get("text-ignore-placement"),n.bucketInstanceId,F&&F.placeable&&V?V:j,f.ID),W&&this.collisionIndex.insertCollisionBox(N.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,U,f.ID),B&&M&&this.collisionIndex.insertCollisionCircles(B.circles,y,o.get("text-ignore-placement"),n.bucketInstanceId,j,f.ID),i&&this.storeCollisionData(n.bucketInstanceId,b,d,z,N,B),0===e.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[e.crossTileID]=new ut((M||E)&&!(null==z?void 0:z.occluded),(D||I)&&!(null==N?void 0:N.occluded),R||n.justReloaded),r[e.crossTileID]=!0};if(S){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){const r=t[e];C(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)C(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,r,i,n,o){if(r.textBox||r.iconBox){let o,a;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o)),o.has(t)?a=o.get(t):(a={text:null,icon:null},o.set(t,a)),r.textBox&&(a.text=i.box),r.iconBox&&(a.icon=n.box)}if(o){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<o.circles.length;e+=4)t.push(o.circles[e+0]-at),t.push(o.circles[e+1]-at),t.push(o.circles[e+2]),t.push(o.collisionDetected?1:0)}}markUsedJustification(e,r,i,n){let o;o=n===t.az.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[t.aR(r)];const a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:i.crossTileID)}markUsedOrientation(e,r,i){const n=r===t.az.horizontal||r===t.az.horizontalOnly?r:0,o=r===t.az.vertical?r:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const i=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const s in this.placements){const e=this.placements[s],t=n[s];t?(this.opacities[s]=new ct(t,i,e.text,e.icon),r=r||e.text!==t.text.placed||e.icon!==t.icon.placed):(this.opacities[s]=new ct(null,i,e.text,e.icon,e.skipFade),r=r||e.text||e.icon)}for(const s in n){const e=n[s];if(!this.opacities[s]){const t=new ct(e,i,!1,!1);t.isHidden()||(this.opacities[s]=t,r=r||e.text.placed||e.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(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const r={};for(const i of t){const t=i.getBucket(e);t&&i.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(e,r,i,n){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const o=e.layers[0],a=o.layout,s=new ct(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 ct(null,0,l&&(c||!e.hasIconData()||a.get("icon-optional")),c&&(l||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const m=(e,t,r)=>{for(let i=0;i<t/4;i++)e.opacityVertexArray.emplaceBack(r);e.hasVisibleVertices=e.hasVisibleVertices||r!==St},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let y=0;y<e.symbolInstances.length;y++){const r=e.symbolInstances.get(y),{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,_=this.placedOrientations[r.crossTileID],v=_===t.az.vertical,b=_===t.az.horizontal||_===t.az.horizontalOnly;if(n>0||o>0){const t=Tt(l.text);m(e.text,n,v?St:t),m(e.text,o,b?St:t);const i=l.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||b?1:0);const a=this.variableOffsets[r.crossTileID];a&&this.markUsedJustification(e,a.anchor,r,_);const s=this.placedOrientations[r.crossTileID];s&&(this.markUsedJustification(e,"left",r,s),this.markUsedOrientation(e,s,r))}if(c){const t=Tt(l.icon),i=!(p&&r.verticalPlacedIconSymbolIndex&&v);r.placedIconSymbolIndex>=0&&(m(e.icon,r.numIconVertices,i?t:St),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=l.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,r.numVerticalIconVertices,i?St:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}const x=g&&g.has(y)?g.get(y):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const r=e.collisionArrays[y];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[a];e?(i=pt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=b),mt(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||n,x.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const t=Boolean(!b&&r.verticalIconBox);let n;r.iconBox&&(n=t),r.verticalIconBox&&(n=!t),mt(e.iconCollisionBox.collisionVertexArray,l.icon.placed,n,x.icon,p?i.x:0,p?i.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function mt(e,t,r,i,n,o){i&&0!==i.length||(i=[0,0,0,0]);const a=i[0]-at,s=i[1]-at,l=i[2]-at,c=i[3]-at;e.emplaceBack(t?1:0,r?1:0,n||0,o||0,a,s),e.emplaceBack(t?1:0,r?1:0,n||0,o||0,l,s),e.emplaceBack(t?1:0,r?1:0,n||0,o||0,l,c),e.emplaceBack(t?1:0,r?1:0,n||0,o||0,a,c)}const gt=Math.pow(2,25),yt=Math.pow(2,24),_t=Math.pow(2,17),vt=Math.pow(2,16),bt=Math.pow(2,9),xt=Math.pow(2,8),wt=Math.pow(2,1);function Tt(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,r=Math.floor(127*e.opacity);return r*gt+t*yt+r*_t+t*vt+r*bt+t*xt+r*wt+t}const St=0;class Et{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,r,i,n){const o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(o,i,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<o.length;)if(t.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0;return!1}}class It{constructor(e,t,r,i,n,o,a,s){this.placement=new ft(e,t,o,a,s),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){const i=c(),n=()=>!this._forceFullPlacement&&c()-i>2;for(;this._currentPlacementIndex>=0;){const i=t[e[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 Et(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Pt=512/t.a5/2;class kt{constructor(e,r,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};const n=new Map;for(let t=0;t<r.length;t++){const e=r.get(t),i=e.key,o=n.get(i);o?o.push(e):n.set(i,[e])}for(const[o,a]of n){const e={positions:a.map(e=>({x:Math.floor(e.anchorX*Pt),y:Math.floor(e.anchorY*Pt)})),crossTileIDs:a.map(e=>e.crossTileID)};if(e.positions.length>128){const r=new t.aT(e.positions.length,16,Uint16Array);for(const{x:t,y:i}of e.positions)r.add(t,i);r.finish(),delete e.positions,e.index=r}this._symbolsByKey[o]=e}}getScaledCoordinates(e,r){const{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=r.canonical,c=Pt/Math.pow(2,l-o),u=(s*t.a5+e.anchorY)*c,h=n*t.a5*Pt;return{x:Math.floor((a*t.a5+e.anchorX)*c-i*t.a5*Pt),y:Math.floor(u-h)}}findMatches(e,t,r){const i=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){const o=e.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,t);if(a.index){const e=a.index.range(s.x-i,s.y-i,s.x+i,s.y+i).sort();for(const t of e){const e=a.crossTileIDs[t];if(!r[e]){r[e]=!0,o.crossTileID=e;break}}}else if(a.positions)for(let e=0;e<a.positions.length;e++){const t=a.positions[e],n=a.crossTileIDs[e];if(Math.abs(t.x-s.x)<=i&&Math.abs(t.y-s.y)<=i&&!r[n]){r[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class At{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ct{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const r in this.indexes){const e=this.indexes[r],i={};for(const r in e){const n=e[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),i[n.tileID.key]=n}this.indexes[r]=i}this.lng=e}addBucket(e,t,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let n=0;n<t.symbolInstances.length;n++)t.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const i=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const r=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in r){const o=r[n];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,i)}else{const o=r[e.scaledTo(Number(n)).key];o&&o.findMatches(t.symbolInstances,e,i)}}for(let n=0;n<t.symbolInstances.length;n++){const e=t.symbolInstances.get(n);e.crossTileID||(e.crossTileID=r.generate(),i[e.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new kt(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const r of t.getCrossTileIDsLists())for(const t of r)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(const r in this.indexes){const i=this.indexes[r];for(const n in i)e[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],t=!0)}return t}}class Mt{constructor(){this.layerIndexes={},this.crossTileIDs=new At,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];void 0===i&&(i=this.layerIndexes[e.id]=new Ct);let n=!1;const o={};i.handleWrapJump(r);for(const a of t){const t=a.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(a.tileID,t,this.crossTileIDs)&&(n=!0),o[t.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const r in this.layerIndexes)t[r]||delete this.layerIndexes[r]}}var Dt="void main() {fragColor=vec4(1.0);}";const Rt={prelude:Ot("#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:Ot("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Ot("","#define GLOBE_RADIUS 6371008.8\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:Ot("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:Ot("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\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:Ot("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:Ot(Dt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Ot("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:Ot("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\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:Ot("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ot("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Ot("#ifdef GL_ES\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:Ot("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Ot(Dt,"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:Ot("#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:Ot("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:Ot("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\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:Ot("#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:Ot("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:Ot("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\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:Ot("#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:Ot("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\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:Ot("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:Ot("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\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:Ot("#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:Ot("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\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\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\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);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\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_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\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\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Ot("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin 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 width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\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);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\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;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\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\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_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;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Ot("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\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:Ot("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:Ot("#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:Ot("#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:Ot("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && 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:Ot("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Ot("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Ot("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Ot("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:Ot("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Ot(e,t){const r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:e=e.replace(r,(e,t,r,i,n)=>(s[n]=!0,"define"===t?`\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:t=t.replace(r,(e,t,r,i,n)=>{const o="float"===i?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===t?`\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"===t?`\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 Lt{constructor(e,t,r){this.vertexBuffer=e,this.indexBuffer=t,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Ft=t.aU([{name:"a_pos",type:"Int16",components:2}]);const zt="#define PROJECTION_MERCATOR",Bt="mercator";class Nt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Bt}get shaderDefine(){return zt}get shaderPreludeCode(){return Rt.projectionMercator}get vertexShaderPreludeCode(){return Rt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,r,i,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new t.aW;a.emplaceBack(0,0),a.emplaceBack(t.a5,0),a.emplaceBack(0,t.a5),a.emplaceBack(t.a5,t.a5);const s=e.createVertexBuffer(a,Ft.members),l=t.aX.simpleSegment(0,0,4,2),c=new t.aY;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new Lt(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class jt{constructor(e=0,t=0,r=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<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=e,this.bottom=t,this.left=r,this.right=i}interpolate(e,r,i){return null!=r.top&&null!=e.top&&(this.top=t.G.number(e.top,r.top,i)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.G.number(e.bottom,r.bottom,i)),null!=r.left&&null!=e.left&&(this.left=t.G.number(e.left,r.left,i)),null!=r.right&&null!=e.right&&(this.right=t.G.number(e.right,r.right,i)),this}getCenter(e,r){const i=t.an((this.left+e-this.right)/2,0,e),n=t.an((this.top+r-this.bottom)/2,0,r);return new t.P(i,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new jt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Vt(e,t){if(!e.renderWorldCopies||e.lngRange)return;const r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}function Ut(e){return Math.max(0,Math.floor(e))}class Gt{constructor(e,r){var i;this.applyConstrain=(e,t)=>null!==this._constrainOverride?this._constrainOverride(e,t):this._callbacks.defaultConstrain(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===(null==r?void 0:r.renderWorldCopies)||!!(null==r?void 0:r.renderWorldCopies),this._minZoom=(null==r?void 0:r.minZoom)||0,this._maxZoom=(null==r?void 0:r.maxZoom)||22,this._minPitch=null==(null==r?void 0:r.minPitch)?0:null==r?void 0:r.minPitch,this._maxPitch=null==(null==r?void 0:r.maxPitch)?60:null==r?void 0:r.maxPitch,this._constrainOverride=null!==(i=null==r?void 0:r.constrainOverride)&&void 0!==i?i:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ut(this._zoom),this._scale=t.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new jt,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,r,i){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Ut(this._zoom),this._scale=t.aq(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new jt(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!i&&e.autoCalculateNearFarZ,r&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}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(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const r=t.W(e,-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(e){const r=t.an(e,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(e){const t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aZ(this._fovInRadians)}setFov(e){e=t.an(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ap(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const r=this.applyConstrain(this._center,e).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=t.aq(r),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,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(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this.constrainInternal(),this._calcMatrices()}resize(e,t,r=!0){this._width=e,this._height=t,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new Z([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-t.ao,t.ao])}getCameraQueryGeometry(e,r){if(1===r.length)return[r[0],e];{const{minX:i,minY:n,maxX:o,maxY:a}=t.aa.fromPoints(r).extend(e);return[new t.P(i,n),new t.P(o,n),new t.P(o,a),new t.P(i,a),new t.P(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(r),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ar(new Float64Array(16));t.Q(e,e,[this._width/2,-this._height/2,1]),t.O(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ar(new Float64Array(16)),t.Q(e,e,[1,-1,1]),t.O(e,e,[-1,-1,0]),t.Q(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,r,i,n){const o=void 0!==i?i:this.bearing,a=n=void 0!==n?n:this.pitch,{distanceToCenter:s,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,a),{x:c,y:u}=be(a,o),h=t.a9.fromLngLat(e,r);let d,p,f=t.a_(1,h.y),m=0;do{if(m+=1,m>10)break;p=s/f,d=new t.a9(h.x+c*p,h.y+u*p),f=1/d.meterInMercatorCoordinateUnits()}while(Math.abs(s-p*f)>1e-12);return{center:d.toLngLat(),elevation:l,zoom:t.at(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const r=1/this.worldSize,i=t.as(1,this.center.lat)*this.worldSize,n=t.a9.fromLngLat(this.center,this.elevation),o=n.x/r,a=n.y/r,s=n.z/r,l=this.pitch,c=this.bearing,{x:u,y:h,z:d}=be(l,c),p=this.cameraToCenterDistance,f=o+p*-u,m=a+p*-h,g=s+p*d,{distanceToCenter:y,clampedElevation:_}=this._distanceToCenterFromAltElevationPitch(g/i,e,l),v=y*i,b=new t.a9((f+u*v)*r,(m+h*v)*r,0).toLngLat(),x=t.as(1,b.lat),w=t.at(this.height/2/Math.tan(this.fovInRadians/2)/y/x/this.tileSize);this._elevation=_,this._center=b,this.setZoom(w)}_distanceToCenterFromAltElevationPitch(e,r,i){const n=-Math.cos(t.ap(i)),o=e-r;let a,s=r;return n*o>=0||Math.abs(n)<.1?(a=1e4,s=e+a*n):a=-o/n,{distanceToCenter:a,clampedElevation:s}}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=t.as(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const r=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/r,e.canonical.y/r,1/r/t.a5,1/r/t.a5]}}class qt{constructor(e,r){this.min=e,this.max=r,this.center=t.a$([],t.b0([],this.min,this.max),.5)}quadrant(e){const r=[e%2==0,e<2],i=t.b1(this.min),n=t.b1(this.max);for(let t=0;t<r.length;t++)i[t]=r[t]?this.min[t]:this.center[t],n[t]=r[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new qt(i,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let r=0;r<e.planes.length;r++){const i=this.intersectsPlane(e.planes[r]);if(0===i)return 0;1===i&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],r=e[3];for(let i=0;i<3;i++)e[i]>0?(t+=e[i]*this.min[i],r+=e[i]*this.max[i]):(r+=e[i]*this.min[i],t+=e[i]*this.max[i]);return t>=0?2:r<0?0:1}}class $t{distanceToTile2d(e,t,r,i){const n=i.distanceX([e,t]),o=i.distanceY([e,t]);return Math.hypot(n,o)}getWrap(e,t,r){return r}getTileBoundingVolume(e,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new t.a2(e.z,r,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,i)}const c=1<<e.z;return new qt([r+e.x/c,e.y/c,s],[r+(e.x+1)/c,(e.y+1)/c,l])}allowVariableZoom(e,r){const i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,n=t.an(78.5-i/2,0,60);return!!r.terrain||e.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class Wt{constructor(e,t,r){this.points=e,this.planes=t,this.aabb=r}static fromInvProjectionMatrix(e,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(e,r,i,n){const o=t.aH([],e,r),a=1/o[3]/i*n;return t.b6(o,o,[a,a,1/o[3],a])}(i,e,r,s));n&&function(e,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=t.b2([],e[d+a],e[d+o]),i=t.b7(r);t.a$(r,r,1/i),l.push(i),c.push(r)}for(let d=0;d<4;d++){const r=t.b8(e[d+o],c[d],i);s=null!==r&&r>=0?Math.max(s,r):Math.max(s,l[d])}const u=function(e,r){const i=t.b2([],e[r[0]],e[r[1]]),n=t.b2([],e[r[2]],e[r[1]]),o=[0,0,0,0];return t.b3(o,t.b4([],i,n)),o[3]=-t.b5(o,e[r[0]]),o}(e,r),h=function(e,r){const i=t.b9(e),n=t.ba([],e,1/i),o=t.b2([],r,t.a$([],n,t.b5(r,n))),a=t.b9(o);if(a>0){const e=Math.sqrt(1-n[3]*n[3]),i=t.a$([],n,-n[3]),s=t.b0([],i,t.a$([],o,e/a));return t.bb(r,s)}return null}(i,u);if(null!==h){const e=h/t.b5(c[0],u);s=Math.min(s,e)}for(let t=0;t<4;t++){const r=Math.min(s,l[t]);e[t+a]=[e[t+o][0]+c[t][0]*r,e[t+o][1]+c[t][1]*r,e[t+o][2]+c[t][2]*r,1]}}(l,a[0],n,o);const c=a.map(e=>{const r=t.b2([],l[e[0]],l[e[1]]),i=t.b2([],l[e[2]],l[e[1]]),n=t.b3([],t.b4([],r,i)),o=-t.b5(n,l[e[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 t of l)for(let e=0;e<3;e++)u[e]=Math.min(u[e],t[e]),h[e]=Math.max(h[e],t[e]);return new Wt(l,c,new qt(u,h))}}class Zt{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,r){return this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,r=!0){this._helper.resize(e,t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,r)=>{r=t.an(+r,this.minZoom,this.maxZoom);const i={center:new t.V(e.lng,e.lat),zoom:r};let n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===n){const e=180-1e-10;n=[-e,e]}const o=this.tileSize*t.aq(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 e=this._helper._latRange;a=t.X(e[1])*o,s=t.X(e[0])*o,s-a<p&&(u=p/(s-a))}n&&(l=t.W(t.Y(n[0])*o,0,o),c=t.W(t.Y(n[1])*o,0,o),c<l&&(c+=o),c-l<d&&(h=d/(c-l)));const{x:f,y:m}=me(o,e);let g,y;const _=Math.max(h||0,u||0);if(_){const e=new t.P(h?(c+l)/2:f,u?(s+a)/2:m);return i.center=ge(o,e).wrap(),i.zoom+=t.at(_),i}if(this._helper._latRange){const e=p/2;m-e<a&&(y=a+e),m+e>s&&(y=s-e)}if(n){const e=(l+c)/2;let r=f;this._helper._renderWorldCopies&&(r=t.W(f,e-o/2,e+o/2));const i=d/2;r-i<l&&(g=l+i),r+i>c&&(g=c-i)}if(void 0!==g||void 0!==y){const e=new t.P(null!=g?g:f,null!=y?y:m);i.center=ge(o,e).wrap()}return i},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new Gt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new $t}clone(){const e=new Zt;return e.apply(this),e}apply(e,t,r){this._helper.apply(e,t,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(e){const r=[new t.bc(0,e)];if(this._helper._renderWorldCopies){const i=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new t.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 t.bc(u,e))}return r}getCameraFrustum(){return Wt.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),r=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(e,r){const i=t.as(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,i),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),a=t.a9.fromLngLat(e),s=new t.a9(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(e,r){return r?this.coordinatePoint(t.a9.fromLngLat(e),r.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(t.a9.fromLngLat(e))}screenPointToLocation(e,t){var r;return null===(r=this.screenPointToMercatorCoordinate(e,t))||void 0===r?void 0:r.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const r=t.pointCoordinate(e);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,r){const i=r||0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.aH(n,n,this._pixelMatrixInverse),t.aH(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 t.a9(t.G.number(n[0]/a,o[0]/s,d)/this.worldSize,t.G.number(l,c,d)/this.worldSize,i)}coordinatePoint(e,r=0,i=this._pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,r,1];return t.aH(n,n,i),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this._helper._height/2-ye(this));return(new Z).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-ye(this)}calculatePosMatrix(e,r=!1,i){var n;const o=null!==(n=e.key)&&void 0!==n?n:t.bd(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const e=a.get(o);return i?e.f32:e.f64}const s=_e(e,this.worldSize);t.S(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(e){const r=e.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);const n=_e(e,this.worldSize);return t.S(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}_calculateNearFarZIfNeeded(e,r,i){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-n*this._helper._pixelPerMeter/Math.cos(r),a=n<0?o:e,s=Math.PI/2+this.pitchInRadians,l=t.ap(this.fov)*(Math.abs(Math.cos(t.ap(this.roll)))*this.height+Math.abs(Math.sin(t.ap(this.roll)))*this.width)/this.height*(.5+i.y/this.height),c=Math.sin(l)*a/Math.sin(t.an(Math.PI-s-l,.01,Math.PI-.01)),u=ye(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=t.ap(.75),p=h>d?2*h*(.5+i.y/(2*u)):d,f=Math.sin(p)*a/Math.sin(t.an(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 e=this.centerOffset,r=me(this.worldSize,this.center),i=r.x,n=r.y;this._helper._pixelPerMeter=t.as(1,this.center.lat)*this.worldSize;const o=t.ap(Math.min(this.pitch,fe)),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,e),s=new Float64Array(16),t.be(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.aB(this._invProjMatrix,s),s[8]=2*-e.x/this._helper._width,s[9]=2*e.y/this._helper._height,this._projectionMatrix=t.bf(s),t.Q(s,s,[1,-1,1]),t.O(s,s,[0,0,-this._helper.cameraToCenterDistance]),t.bg(s,s,-this.rollInRadians),t.bh(s,s,this.pitchInRadians),t.bg(s,s,-this.bearingInRadians),t.O(s,s,[-i,-n,0]),this._mercatorMatrix=t.Q([],s,[this.worldSize,this.worldSize,this.worldSize]),t.Q(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),t.O(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=t.aB([],s);const l=[0,0,-1,1];t.aH(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.be(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.O(this._fogMatrix,this._fogMatrix,[-i,-n,0]),t.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.S(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(t.O(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=t.aB(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 e=this.screenPointToMercatorCoordinate(new t.P(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aH(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.as(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,r){const i=t.a9.fromLngLat(e),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return t.aH(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){const{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=e,o=this._helper.getMercatorTileCoordinates(r),a=r?this.calculatePosMatrix(r,i,!0):null;let s;return s=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:a||t.bi(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,r){return 1}transformLightDirection(e){return t.b1(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,r,i,n){const o=this.calculatePosMatrix(i);let a;n?(a=[e,r,n(e,r),1],t.aH(a,a,o)):(a=[e,r,0,1],ot(a,a,o));const s=a[3];return{point:new t.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(const t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,r){const i=t.a9.fromLngLat(e,r),n=i.meterInMercatorCoordinateUnits(),o=t.bj();return t.O(o,o,[i.x,i.y,i.z]),t.bg(o,o,Math.PI),t.bh(o,o,Math.PI/2),t.Q(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const r=new t.a2(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:e}),n=_e(r,this.worldSize);t.S(n,this._viewProjMatrix,n),i.tileMercatorCoords=[0,0,1,1];const o=[t.a5,t.a5,this.worldSize/this._helper.pixelsPerMeter],a=t.bk();return t.Q(a,n,o),i.fallbackMatrix=a,i.mainMatrix=a,i}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Ht(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Xt(e){if(e.useSlerp)if(e.k<1){const r=t.bl(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=t.bl(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.bm(n,r,i,e.k);const o=t.bn(n);e.tr.setRoll(o.roll),e.tr.setPitch(o.pitch),e.tr.setBearing(o.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.G.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.G.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.G.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Kt(e,r,i,n,o){const a=o.padding,s=me(o.worldSize,i.getNorthWest()),l=me(o.worldSize,i.getNorthEast()),c=me(o.worldSize,i.getSouthEast()),u=me(o.worldSize,i.getSouthWest()),h=t.ap(-n),d=s.rotate(h),p=l.rotate(h),f=c.rotate(h),m=u.rotate(h),g=new t.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),y=new t.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),_=g.sub(y),v=(o.width-(a.left+a.right+r.left+r.right))/_.x,b=(o.height-(a.top+a.bottom+r.top+r.bottom))/_.y;if(b<0||v<0)return void Ht();const x=Math.min(t.at(o.scale*Math.min(v,b)),e.maxZoom),w=t.P.convert(e.offset),T=new t.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(t.ap(n)),S=w.add(T).mult(o.scale/t.aq(x));return{center:ge(o.worldSize,s.add(c).div(2).sub(S)),zoom:x,bearing:n}}class Yt{get useGlobeControls(){return!1}handlePanInertia(e,t){const r=e.mag(),i=Math.abs(ye(t));return{easingOffset:e.mult(Math.min(.75*i/r,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,r){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(r,e.around)}cameraForBoxAndBearing(e,t,r,i,n){return Kt(e,t,r,i,n)}handleJumpToCenterZoom(e,r){e.zoom!==(void 0!==r.zoom?+r.zoom:e.zoom)&&e.setZoom(+r.zoom),void 0!==r.center&&e.setCenter(t.V.convert(r.center))}handleEaseTo(e,r){const i=e.zoom,n=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===r.roll?e.roll:r.roll,pitch:void 0===r.pitch?e.pitch:r.pitch,bearing:void 0===r.bearing?e.bearing:r.bearing},s=void 0!==r.zoom,l=!e.isPaddingEqual(r.padding);let c=!1;const u=s?+r.zoom:e.zoom;let h=e.centerPoint.add(r.offsetAsPoint);const d=e.screenPointToLocation(h),{center:p,zoom:f}=e.applyConstrain(t.V.convert(r.center||d),null!=u?u:i);Vt(e,p);const m=me(e.worldSize,d),g=me(e.worldSize,p).sub(m),y=t.aq(f-i);return c=f!==i,{easeFunc:s=>{if(c&&e.setZoom(t.G.number(i,f,s)),t.bo(o,a)||Xt({startEulerAngles:o,endEulerAngles:a,tr:e,k:s,useSlerp:o.roll!=a.roll}),l&&(e.interpolatePadding(n,r.padding,s),h=e.centerPoint.add(r.offsetAsPoint)),r.around)e.setLocationAtPoint(r.around,r.aroundPoint);else{const r=t.aq(e.zoom-i),n=f>i?Math.min(2,y):Math.max(.5,y),o=Math.pow(n,1-s),a=ge(e.worldSize,m.add(g.mult(s*o)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(e,r){const i=void 0!==r.zoom,n=e.zoom,o=e.applyConstrain(t.V.convert(r.center||r.locationAtOffset),i?+r.zoom:n),a=o.center,s=o.zoom;Vt(e,a);const l=me(e.worldSize,r.locationAtOffset),c=me(e.worldSize,a).sub(l),u=c.mag(),h=t.aq(s-n);let d;if(void 0!==r.minZoom){const i=Math.min(+r.minZoom,n,s),o=e.applyConstrain(a,i).zoom;d=t.aq(o-n)}return{easeFunc:(r,i,o,u)=>{e.setZoom(1===r?s:n+t.at(i));const h=1===r?a:ge(e.worldSize,l.add(c.mult(o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:d,pixelPathLength:u}}}class Jt{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}}Jt.Replace=[1,0],Jt.disabled=new Jt(Jt.Replace,t.bp.transparent,[!1,!1,!1,!1]),Jt.unblended=new Jt(Jt.Replace,t.bp.transparent,[!0,!0,!0,!0]),Jt.alphaBlended=new Jt([1,771],t.bp.transparent,[!0,!0,!0,!0]);const Qt=2305;class er{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}}er.disabled=new er(!1,1029,Qt),er.backCCW=new er(!0,1029,Qt),er.frontCCW=new er(!0,1028,Qt);class tr{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}}tr.ReadOnly=!1,tr.ReadWrite=!0,tr.disabled=new tr(519,tr.ReadOnly,[0,1]);const rr=7680;class ir{constructor(e,t,r,i,n,o){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o}}ir.disabled=new ir({func:519,mask:0},0,0,rr,rr,rr);const nr=new WeakMap;function or(e){var t;if(nr.has(e))return nr.get(e);{const r=null===(t=e.getParameter(e.VERSION))||void 0===t?void 0:t.startsWith("WebGL 2.0");return nr.set(e,r),r}}class ar{get awaitingQuery(){return!!this._readbackQueue}constructor(e){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=e;const r=e.context,i=r.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;const n=new t.aW;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new t.aY;o.emplaceBack(0,1,2),this._fullscreenTriangle=new Lt(r.createVertexBuffer(n,Ft.members),r.createIndexBuffer(o),t.aX.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),or(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 e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){const r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,r){const i=this._cachedRenderContext.context,n=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:t.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,n.TRIANGLES,tr.disabled,ir.disabled,Jt.unblended,er.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&or(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 e=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&or(e)){const r=e.clientWaitSync(this._readbackQueue.sync,0,0);if(r===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ar._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}const sr=t.a5/128;function lr(e,r){const i=void 0!==e.granularity?Math.max(e.granularity,1):1,n=i+(e.generateBorders?2:0),o=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=n+1,s=o+1,l=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,u=i+(e.generateBorders?1:0),h=i+(e.generateBorders||e.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 y=0;for(let b=c;b<=h;b++)for(let r=l;r<=u;r++){let n=r/i*t.a5;-1===r&&(n=-sr),r===i+1&&(n=t.a5+sr);let o=b/i*t.a5;-1===b&&(o=e.extendToNorthPole?t.br:-sr),b===i+1&&(o=e.extendToSouthPole?t.bs:t.a5+sr),g[y++]=n,g[y++]=o}const _=m?new Uint32Array(p):new Uint16Array(p);let v=0;for(let t=0;t<o;t++)for(let e=0;e<n;e++){const r=e+1+t*a,i=e+(t+1)*a,n=e+1+(t+1)*a;_[v++]=e+t*a,_[v++]=i,_[v++]=r,_[v++]=r,_[v++]=i,_[v++]=n}return{vertices:g.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:m}}const cr=new t.aV({fill:new t.bt(128,2),line:new t.bt(512,0),tile:new t.bt(128,32),stencil:new t.bt(128,1),circle:3});class ur{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 Rt.projectionGlobe}get vertexShaderPreludeCode(){return Rt.projectionMercator.vertexSource}get subdivisionGranularity(){return cr}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new ar(e));const r=t.X(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,i),o=c();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const a=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bv(a))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,r,i,n){const o=("stencil"===n?cr.stencil:cr.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:o,generateBorders:r,extendToNorthPole:0===t.y&&i,extendToSouthPole:t.y===(1<<t.z)-1&&i})}_getMesh(e,r){const i=this._getMeshKey(r);if(i in this._tileMeshCache)return this._tileMeshCache[i];const n=function(e,r){const i=lr(r,"16bit"),n=t.aW.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),o=t.aY.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new Lt(e.createVertexBuffer(n,Ft.members),e.createIndexBuffer(o),t.aX.simpleSegment(0,0,n.length,o.length))}(e,r);return this._tileMeshCache[i]=n,n}recalculate(e){}hasTransition(){const e=c();let t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<.7,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const hr=new t.t({type:new t.D(t.u.projection.type)});class dr extends t.E{constructor(e){super(),this._transitionable=new t.x(hr,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.H(0)),this._mercatorProjection=new Nt,this._verticalPerspectiveProjection=new ur}get transitionState(){const e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof t.bw){if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.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(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,r,i,n){return this.currentProjection.getMeshFromTileID(e,t,r,i,n)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function pr(e){const t=gr(e.worldSize,e.center.lat);return 2*Math.PI*t}function fr(e,r,i,n,o){const a=1/(1<<o),s=r/t.a5*a+n*a,l=t.by((e/t.a5*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 mr(e){return function(e,t){const r=Math.cos(t),i=new Float64Array(3);return i[0]=Math.sin(e)*r,i[1]=Math.sin(t),i[2]=Math.cos(e)*r,i}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function gr(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function yr(e){const r=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){const n=e[0]/i,o=Math.acos(e[2]/i),a=(n>0?o:-o)/Math.PI*180;return new t.V(t.W(a,-180,180),r)}return new t.V(0,r)}function _r(e){return Math.cos(e*Math.PI/180)}function vr(e,r){const i=_r(e),n=_r(r);return t.at(n/i)}function br(e,r){const i=e.rotate(r.bearingInRadians),n=r.zoom+vr(r.center.lat,0),o=t.bu(1/_r(r.center.lat),1/_r(Math.min(Math.abs(r.center.lat),60)),t.bx(n,7,3,0,1)),a=360/pr({worldSize:r.worldSize,center:{lat:r.center.lat}});return new t.V(r.center.lng-i.x*a*o,t.an(r.center.lat+i.y*a,-t.ao,t.ao))}function xr(e){const t=.5*e,r=Math.sin(t),i=Math.cos(t);return Math.log(r+i)-Math.log(i-r)}function wr(e,r,i,n){const o=e.lat+i*n;if(Math.abs(i)>1){const a=(Math.sign(e.lat+i)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+i)*Math.PI/180,l=xr(a+n*(s-a)),c=xr(a),u=xr(s);return new t.V(e.lng+r*((l-c)/(u-c)),o)}return new t.V(e.lng+r*n,o)}class Tr{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,r,i){const n=`${e.z}_${e.x}_${e.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(e,t,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}class Sr{constructor(e,t,r,i){this.min=r,this.max=i,this.points=e,this.planes=t}static fromAabb(e,t){const r=[];for(let i=0;i<8;i++)r.push([1&~i?e[0]:t[0],1==(i>>1&1)?t[1]:e[1],1==(i>>2&1)?t[2]:e[2]]);return new Sr(r,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,r,i){const n=t.bB([],i[0],i[1],i[2]),o=t.bC([],[r[0],0,0],n),a=t.bC([],[0,r[1],0],n),s=t.bC([],[0,0,r[2]],n),l=[...e],c=[...e];for(let t=0;t<8;t++)for(let r=0;r<3;r++){const i=e[r]+o[r]*(1&~t?-1:1)+a[r]*(1==(t>>1&1)?1:-1)+s[r]*(1==(t>>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=[...e];t.b0(r,r,t.a$([],o,1&~h?-1:1)),t.b0(r,r,t.a$([],a,1==(h>>1&1)?1:-1)),t.b0(r,r,t.a$([],s,1==(h>>2&1)?1:-1)),u.push(r)}return new Sr(u,[[...o,-t.b5(o,u[0])],[...a,-t.b5(a,u[0])],[...s,-t.b5(s,u[0])],[-o[0],-o[1],-o[2],-t.b5(o,u[7])],[-a[0],-a[1],-a[2],-t.b5(a,u[7])],[-s[0],-s[1],-s[2],-t.b5(s,u[7])]],l,c)}intersectsFrustum(e){let t=!0;const r=this.points.length,i=this.planes.length,n=e.planes.length,o=e.points.length;for(let a=0;a<n;a++){const i=e.planes[a];let n=0;for(let e=0;e<r;e++){const t=this.points[e];i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0&&n++}if(0===n)return 0;n<r&&(t=!1)}if(t)return 2;for(let a=0;a<i;a++){const t=this.planes[a];let r=0;for(let i=0;i<o;i++){const n=e.points[i];t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(e){const t=this.points.length;let r=0;for(let i=0;i<t;i++){const t=this.points[i];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&r++}return r===t?2:0===r?0:1}}function Er(e,t,r){const i=e-t;return i<0?-i:Math.max(0,i-r)}function Ir(e,t,r,i,n){const o=e-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,Er(t,i,n))}class Pr{constructor(){this._boundingVolumeCache=new Tr(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,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,Ir(e,t,a,s,o)),l=Math.min(l,Ir(e,t,a+.5,-s-o,o)),l=Math.min(l,Ir(e,t,a+.5,2-s-o,o)),l}getWrap(e,t,r){const i=1<<t.z,n=1/i,o=t.x/i,a=Er(e.x,o,n),s=Er(e.x,o-1,n),l=Er(e.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(e,t){return Ee(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,r,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,r,i)}_computeTileBoundingVolume(e,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new t.a2(e.z,r,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,i)}if(s/=t.bE,l/=t.bE,s+=1,l+=1,e.z<=0)return Sr.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return Sr.fromAabb([0===e.x?-l:0,0===e.y?0:-l,-l],[0===e.x?0:l,0===e.y?l:0,l]);{const r=[fr(0,0,e.x,e.y,e.z),fr(t.a5,0,e.x,e.y,e.z),fr(t.a5,t.a5,e.x,e.y,e.z),fr(0,t.a5,e.x,e.y,e.z)],i=[];for(const e of r)i.push(t.a$([],e,l));if(l!==s)for(const e of r)i.push(t.a$([],e,s));0===e.y&&i.push([0,1,0]),e.y===(1<<e.z)-1&&i.push([0,-1,0]);const n=[1,1,1],o=[-1,-1,-1];for(const e of i)for(let t=0;t<3;t++)n[t]=Math.min(n[t],e[t]),o[t]=Math.max(o[t],e[t]);const a=fr(t.a5/2,t.a5/2,e.x,e.y,e.z),c=t.b4([],[0,1,0],a);t.b3(c,c);const u=t.b4([],a,c);t.b3(u,u);const h=t.b4([],r[2],r[1]);t.b3(h,h);const d=t.b4([],r[0],r[3]);t.b3(d,d),i.push(t.a$([],a,l)),e.y>=(1<<e.z)/2&&i.push(t.a$([],fr(t.a5/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&i.push(t.a$([],fr(t.a5/2,t.a5,e.x,e.y,e.z),l));const p=kr(a,i),f=kr(u,i),m=[-a[0],-a[1],-a[2],p.max],g=[a[0],a[1],a[2],-p.min],y=[-u[0],-u[1],-u[2],f.max],_=[u[0],u[1],u[2],-f.min],v=[...h,0],b=[...d,0],x=[];return 0===e.y?x.push(t.bD(b,v,m),t.bD(b,v,g)):x.push(t.bD(y,v,m),t.bD(y,v,g),t.bD(y,b,m),t.bD(y,b,g)),e.y===(1<<e.z)-1?x.push(t.bD(b,v,m),t.bD(b,v,g)):x.push(t.bD(_,v,m),t.bD(_,v,g),t.bD(_,b,m),t.bD(_,b,g)),new Sr(x,[m,g,y,_,v,b],n,o)}}}function kr(e,r){let i=1/0,n=-1/0;for(const o of r){const r=t.b5(e,o);i=Math.min(i,r),n=Math.max(n,r)}return{min:i,max:n}}class Ar{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,r){return this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bF(),this._projectionMatrix=t.bj(),this._globeViewProjMatrix32f=t.bi(),this._globeViewProjMatrixNoCorrection=t.bj(),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),this._globeProjMatrixInverted=t.bj(),this._cameraPosition=t.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,r)=>{const i=t.an(e.lat,-t.ao,t.ao),n=t.an(+r,this.minZoom+vr(0,i),this.maxZoom);return{center:new t.V(e.lng,i),zoom:n}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new Gt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Pr}clone(){const e=new Ar;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=t.bz();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:t,applyGlobeMatrix:r}=e,i=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const r=this.pitchInRadians,i=this.cameraToCenterDistance/e,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];t.bG(u,u,[0,0,0],-this.bearingInRadians),t.bH(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bI(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/t.b7(u);return t.a$(u,u,h),[...u,-a*h]}isLocationOccluded(e){return!this.isSurfacePointVisible(mr(e))}transformLightDirection(e){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];t.b4(s,a,o),t.b3(a,a),t.b3(s,s);const l=[0,0,0];return t.b3(l,[a[0]*e[0]+s[0]*e[1]+o[0]*e[2],a[1]*e[0]+s[1]*e[1]+o[1]*e[2],a[2]*e[0]+s[2]*e[1]+o[2]*e[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(e,r,i){const n=function(e,r,i){const n=1/(1<<i.z);return new t.a9(e/t.a5*n+i.x*n,r/t.a5*n+i.y*n)}(e,r,i.canonical),o=(a=n.y,[t.by(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(e,r,i,n){const o=i.canonical,a=fr(e,r,o.x,o.y,o.z),s=1+(n?n(e,r):0)/t.bE,l=[a[0]*s,a[1]*s,a[2]*s,1];t.aH(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 t.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=gr(this.worldSize,this.center.lat),r=t.bk(),i=t.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.be(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=t.bf(r),this._globeProjMatrixInverted=t.bk(),t.aB(this._globeProjMatrixInverted,r),t.O(r,r,[0,0,-this.cameraToCenterDistance]),t.bg(r,r,this.rollInRadians),t.bh(r,r,-this.pitchInRadians),t.bg(r,r,this.bearingInRadians),t.O(r,r,[0,0,-e]);const o=t.bz();o[0]=e,o[1]=e,o[2]=e,t.bh(i,r,this.center.lat*Math.PI/180),t.bJ(i,i,-this.center.lng*Math.PI/180),t.Q(i,i,o),this._globeViewProjMatrixNoCorrection=i,t.bh(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bJ(r,r,-this.center.lng*Math.PI/180),t.Q(r,r,o),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=t.bk(),t.aB(this._globeViewProjMatrixNoCorrectionInverted,i);const a=t.bz();this._cameraPosition=t.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bG(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),t.bH(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),t.bG(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),t.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bH(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),t.bI(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const s=t.bf(this._globeViewProjMatrixNoCorrectionInverted);t.Q(s,s,[1,1,-1]),this._cachedFrustum=Wt.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");const r=t.bk();return t.ar(r),r}getVisibleUnwrappedCoordinates(e){return[new t.bc(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.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(e,r){if(!this._globeViewProjMatrixNoCorrection)return 1;const i=mr(e);t.a$(i,i,1+r/t.bE);const n=t.bF();return t.aH(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(e){}getBounds(){const e=.5*this.width,r=.5*this.height,i=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,r),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,r)],n=[];for(const t of i)n.push(this.unprojectScreenPoint(t));let o=0,a=0,s=0,l=0;const c=this.center;for(const h of n){const e=t.bK(c.lng,h.lng),r=t.bK(c.lat,h.lat);e<a&&(a=e),e>o&&(o=e),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 Z(u)}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}setLocationAtPoint(e,r){const i=mr(this.unprojectScreenPoint(r)),n=mr(e),o=t.bz();t.bL(o);const a=t.bz();t.bI(a,i,o,-this.center.lng*Math.PI/180),t.bH(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=t.bM(n[0],n[2],a[0],c),d=t.bM(n[0],n[2],a[0],u),p=t.bz();t.bI(p,n,o,-h);const f=t.bM(p[1],p[2],a[1],a[2]),m=t.bz();t.bI(m,n,o,-d);const g=t.bM(m[1],m[2],a[1],a[2]),y=.5*Math.PI,_=f>=-y&&f<=y,v=g>=-y&&g<=y;let b,x;if(_&&v){const e=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;t.bN(h,e)+t.bN(f,r)<t.bN(d,e)+t.bN(g,r)?(b=h,x=f):(b=d,x=g)}else if(_)b=h,x=f;else{if(!v)return;b=d,x=g}const w=b/Math.PI*180,T=x/Math.PI*180,S=this.center.lat;this.setCenter(new t.V(w,t.an(T,-90,90))),this.setZoom(this.zoom+vr(S,this.center.lat))}locationToScreenPoint(e,r){const i=mr(e);if(r){const n=r.getElevationForLngLatZoom(e,this._helper._tileZoom);t.a$(i,i,1+n/t.bE)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(e){const r=t.bF();return t.aH(r,[...e,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new t.P((.5*r[0]+.5)*this.width,(.5*-r[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,r){if(r){const t=r.pointCoordinate(e);if(t)return t}return t.a9.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var r;return null===(r=this.screenPointToMercatorCoordinate(e,t))||void 0===r?void 0:r.toLngLat()}isPointOnMapSurface(e,t){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(r,i)}getRayDirectionFromPixel(e){const r=t.bF();r[0]=e.x/this.width*2-1,r[1]=-1*(e.y/this.height*2-1),r[2]=1,r[3]=1,t.aH(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];const i=t.bz();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];const n=t.bz();return t.b3(n,i),n}isSurfacePointVisible(e){const t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const r=t.bF();return t.aH(r,[...e,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(e,r){const i=t.b5(e,r),n=t.bz(),o=t.bz();t.a$(o,r,i),t.b2(n,e,o);const a=1-t.b5(n,n);if(a<0)return null;const s=t.b5(e,e)-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(e){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(r,i);if(n){const e=t.bz();t.b0(e,r,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);const o=t.bz();return t.b3(o,e),yr(o)}const o=this._cachedClippingPlane,a=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],s=-t.bb(o,r)/a,l=t.bz();if(s>0)t.b0(l,r,[i[0]*s,i[1]*s,i[2]*s]);else{const e=t.bz();t.b0(e,r,[2*i[0],2*i[1],2*i[2]]);const n=t.bb(this._cachedClippingPlane,e);t.b2(l,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(e){const r=t.bz();return r[0]=e[0]*-e[3],r[1]=e[1]*-e[3],r[2]=e[2]*-e[3],{center:r,radius:Math.sqrt(1-e[3]*e[3])}}(o);return yr(function(e,r,i){const n=t.bz();t.b2(n,i,e);const o=t.bz();return t.bA(o,e,n,r/t.b9(n)),o}(c.center,c.radius,l))}getMatrixForModel(e,r){const i=t.V.convert(e),n=1/t.bE,o=t.bj();return t.bJ(o,o,i.lng/180*Math.PI),t.bh(o,o,-i.lat/180*Math.PI),t.O(o,o,[0,0,1+r/t.bE]),t.bh(o,o,.5*Math.PI),t.Q(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const r=this.getProjectionData({overscaledTileID:new t.a2(0,0,0,0,0),applyGlobeMatrix:e});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(e){}}class Cr{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,r){return this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,r=!0){this._helper.resize(e,t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new Gt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new Zt,this._verticalPerspectiveTransform=new Ar}clone(){const e=new Cr;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),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(e){const t=this._mercatorTransform.getProjectionData(e),r=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:t.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,r,i){const n=this._mercatorTransform.getPitchedTextCorrection(e,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,r,i);return t.bu(n,o,this._globeness)}projectTileCoordinates(e,t,r,i){return this.currentTransform.projectTileCoordinates(e,t,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(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){const t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;const r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return r.fallbackMatrix=t.mainMatrix,r}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Mr{get useGlobeControls(){return!0}handlePanInertia(e,r){const i=br(e,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 t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,r){const i=e.around,n=r.screenPointToLocation(i);e.bearingDelta&&r.setBearing(r.bearing+e.bearingDelta),e.pitchDelta&&r.setPitch(r.pitch+e.pitchDelta),e.rollDelta&&r.setRoll(r.roll+e.rollDelta);const o=r.zoom;e.zoomDelta&&r.setZoom(r.zoom+e.zoomDelta);const a=r.zoom-o;if(0===a)return;const s=t.bK(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=t.bK(r.center.lat,n.lat),u=r.getRayDirectionFromPixel(i),h=r.cameraPosition,d=-1*t.b5(h,u),p=t.bz();t.b0(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=t.b7(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=gr(r.worldSize,r.center.lat)/Math.min(r.width,r.height),y=t.bx(g,.9,.5,1,.25),_=(1-t.aq(-a))*Math.min(m,y),v=r.center.lat,b=r.zoom,x=new t.V(r.center.lng+l*_,t.an(r.center.lat+c*_,-t.ao,t.ao));r.setLocationAtPoint(n,i);const w=r.center,T=t.bx(Math.abs(s),45,85,0,1),S=t.bx(g,.75,.35,0,1),E=Math.pow(Math.max(T,S),.25),I=t.bK(w.lng,x.lng),P=t.bK(w.lat,x.lat);r.setCenter(new t.V(w.lng+I*E,w.lat+P*E).wrap()),r.setZoom(b+vr(v,r.center.lat))}handleMapControlsPan(e,t,r){if(!e.panDelta)return;const i=t.center.lat,n=t.zoom;t.setCenter(br(e.panDelta,t).wrap()),t.setZoom(n+vr(i,t.center.lat))}cameraForBoxAndBearing(e,r,i,n,o){const a=Kt(e,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=t.bK(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*t.bK(d,p),y=f+.5*t.bK(f,m),_=o.clone();_.setCenter(a.center),_.setBearing(a.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(a.zoom);const v=_.modelViewProjectionMatrix,b=[mr(i.getNorthWest()),mr(i.getNorthEast()),mr(i.getSouthWest()),mr(i.getSouthEast()),mr(new t.V(p,y)),mr(new t.V(d,y)),mr(new t.V(g,f)),mr(new t.V(g,m))],x=mr(a.center);let w=Number.POSITIVE_INFINITY;for(const t of b)s<0&&(w=Mr.getLesserNonNegativeNonNull(w,Mr.solveVectorScale(t,x,v,"x",s))),l>0&&(w=Mr.getLesserNonNegativeNonNull(w,Mr.solveVectorScale(t,x,v,"x",l))),c>0&&(w=Mr.getLesserNonNegativeNonNull(w,Mr.solveVectorScale(t,x,v,"y",c))),u<0&&(w=Mr.getLesserNonNegativeNonNull(w,Mr.solveVectorScale(t,x,v,"y",u)));if(Number.isFinite(w)&&0!==w)return a.zoom=_.zoom+t.at(w),a;Ht()}handleJumpToCenterZoom(e,r){const i=e.center.lat,n=e.applyConstrain(r.center?t.V.convert(r.center):e.center,e.zoom).center;e.setCenter(n.wrap());const o=void 0!==r.zoom?+r.zoom:e.zoom+vr(i,n.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,r){const i=e.zoom,n=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===r.roll?e.roll:r.roll,pitch:void 0===r.pitch?e.pitch:r.pitch,bearing:void 0===r.bearing?e.bearing:r.bearing},l=void 0!==r.zoom,c=!e.isPaddingEqual(r.padding);let u=!1;const h=r.center?t.V.convert(r.center):n,d=e.applyConstrain(h,i).center;Vt(e,d);const p=e.clone();p.setCenter(d),p.setZoom(l?+r.zoom:i+vr(n.lat,h.lat)),p.setBearing(r.bearing);const f=new t.P(t.an(e.centerPoint.x+r.offsetAsPoint.x,0,e.width),t.an(e.centerPoint.y+r.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);const m=(r.offset&&r.offsetAsPoint.mag())>0?p.center:d,g=l?+r.zoom:i+vr(n.lat,m.lat),y=i+vr(n.lat,0),_=g+vr(m.lat,0),v=t.bK(n.lng,m.lng),b=t.bK(n.lat,m.lat),x=t.aq(_-y);return u=g!==i,{easeFunc:i=>{if(t.bo(a,s)||Xt({startEulerAngles:a,endEulerAngles:s,tr:e,k:i,useSlerp:a.roll!=s.roll}),c&&e.interpolatePadding(o,r.padding,i),r.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(r.around,r.aroundPoint);else{const t=_>y?Math.min(2,x):Math.max(.5,x),r=Math.pow(t,1-i),o=wr(n,v,b,i*r);e.setCenter(o.wrap())}if(u){const r=t.G.number(y,_,i)+vr(0,e.center.lat);e.setZoom(r)}},isZooming:u,elevationCenter:m}}handleFlyTo(e,r){const i=void 0!==r.zoom,n=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(r.padding),l=e.applyConstrain(t.V.convert(r.center||r.locationAtOffset),o).center,c=i?+r.zoom:e.zoom+vr(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(r.bearing);const h=new t.P(t.an(e.centerPoint.x+r.offsetAsPoint.x,0,e.width),t.an(e.centerPoint.y+r.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const d=u.center;Vt(e,d);const p=function(e,r,i){const n=mr(r),o=mr(i),a=t.b5(n,o),s=Math.acos(a),l=pr(e);return s/(2*Math.PI)*l}(e,n,d),f=o+vr(n.lat,0),m=c+vr(d.lat,0),g=t.aq(m-f);let y;if("number"==typeof r.minZoom){const i=+r.minZoom+vr(d.lat,0),n=Math.min(i,f,m)+vr(0,d.lat),o=e.applyConstrain(d,n).zoom+vr(d.lat,0);y=t.aq(o-f)}const _=t.bK(n.lng,d.lng),v=t.bK(n.lat,d.lat);return{easeFunc:(i,o,l,u)=>{const h=wr(n,_,v,l);s&&e.interpolatePadding(a,r.padding,i);const p=1===i?d:h;e.setCenter(p.wrap());const m=f+t.at(o);e.setZoom(1===i?c:m+vr(0,p.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:y,pixelPathLength:p}}static solveVectorScale(e,t,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=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*a[0]+e[1]*a[1]+e[2]*a[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*a[0]+t[1]*a[1]+t[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(e,t){return null!==t&&t>=0&&t<e?t:e}}class Dr{constructor(e){this._globe=e,this._mercatorCameraHelper=new Yt,this._verticalPerspectiveCameraHelper=new Mr}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,r){this.currentHelper.handleMapControlsPan(e,t,r)}cameraForBoxAndBearing(e,t,r,i,n){return this.currentHelper.cameraForBoxAndBearing(e,t,r,i,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}}const Rr=(e,r)=>t.B(e,r&&r.filter(e=>"source.canvas"!==e.identifier)),Or=t.bO();class Lr extends t.E{constructor(e,r={}){var i,n;super(),this._rtlPluginLoaded=()=>{for(const e in this.tileManagers){const t=this.tileManagers[e].getSource().type;"vector"!==t&&"geojson"!==t||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new j(N(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new w,this.imageManager.setEventedParent(this);const o=(null===(i=e._container)||void 0===i?void 0:i.lang)||"undefined"!=typeof document&&(null===(n=document.documentElement)||void 0===n?void 0:n.lang)||void 0;this.glyphManager=new P(e._requestManager,r.localIdeographFontFamily,o),this.lineAtlas=new R(256,512),this.crossTileSymbolIndex=new Mt,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t.bP()),ce().on(ae,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.tileManagers[e.sourceId];if(!t)return;const r=t.getSource();if(r&&r.vectorLayerIds)for(const i in this._layers){const e=this._layers[i];e.source===r.id&&this._validateLayer(e)}})}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bQ,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(e=this.crossTileSymbolIndex)||void 0===e?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,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[e])||void 0===n?void 0:n.default)&&void 0!==o?o:null:r;if(t.bR(a,this._globalState[e]))return this;this._globalState[e]=a,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const r=[];for(const i in e)!t.bR(this._globalState[i],e[i].default)&&(r.push(i),this._globalState[i]=e[i].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(e){if(0===e.length)return;const t=new Set,r={};for(const i of e){r[i]=this._globalState[i];for(const e in this._layers){const r=this._layers[e],n=r.getLayoutAffectingGlobalStateRefs(),o=r.getPaintAffectingGlobalStateRefs(),a=r.getVisibilityAffectingGlobalStateRefs();if(n.has(i)&&t.add(r.source),o.has(i))for(const{name:e,value:t}of o.get(i))this._updatePaintProperty(r,e,t);(null==a?void 0:a.has(i))&&(r.recalculateVisibility(),this._updateLayer(r))}}this.dispatcher.broadcast("UGS",r);for(const i in this.tileManagers)t.has(i)&&(this._reloadSource(i),this._changed=!0)}loadURL(e,r={},i){this.fire(new t.l("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.validate;const n=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;t.j(n,this._loadStyleRequest).then(e=>{this._loadStyleRequest=null,this._load(e.data,r,i)}).catch(e=>{this._loadStyleRequest=null,e&&!o.signal.aborted&&this.fire(new t.k(e))})}loadJSON(e,r={},i){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(e,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(Or,{validate:!1})}_load(e,r,i){var n,o;let a=r.transformStyle?r.transformStyle(i,e):e;if(!r.validate||!Rr(this,t.C(a))){a=Object.assign({},a),this._loaded=!0,this.stylesheet=a;for(const e in a.sources)this.addSource(e,a.sources[e],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new C(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new D(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new t.l("data",{dataType:"style"})),this.fire(new t.l("style.load"))}}_createLayers(){var e,r,i;const n=t.bS(this.stylesheet.layers);this.setGlobalState(null!==(e=this.stylesheet.state)&&void 0!==e?e:null),this.dispatcher.broadcast("SL",n),this._order=n.map(e=>e.id),this._layers={},this._serializedLayers=null;for(const o of n){const e=t.bT(o,this._globalState);if(e.setEventedParent(this,{layer:{id:o.id}}),this._layers[o.id]=e,t.bU(e)&&this.tileManagers[e.source]){const t=null!==(i=null===(r=o.paint)||void 0===r?void 0:r["raster-fade-duration"])&&void 0!==i?i:e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(t)}}}_loadSprite(e,r=!1,i=void 0){this.imageManager.setLoaded(!1);const n=new AbortController;let o;this._spriteRequest=n,function(e,r,i,n){return t._(this,void 0,void 0,function*(){const o=v(e),a=i>1?"@2x":"",l={},c={};for(const{id:e,url:i}of o){const o=r.transformRequest(b(i,a,".json"),"SpriteJSON");l[e]=t.j(o,n);const s=r.transformRequest(b(i,a,".png"),"SpriteImage");c[e]=y.getImage(s,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,r){return t._(this,void 0,void 0,function*(){const t={};for(const i in e){t[i]={};const n=s.getImageCanvasContext((yield r[i]).data),o=(yield e[i]).data;for(const e 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[e];t[i][e]={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 t})}(l,c)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(e=>{if(this._spriteRequest=null,e)for(const t in e){this._spritesImagesIds[t]=[];const i=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter(t=>!(t in e)):[];for(const e of i)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const n in e[t]){const i="default"===t?n:`${t}:${n}`;this._spritesImagesIds[t].push(i),i in this.imageManager.images?this.imageManager.updateImage(i,e[t][n],!1):this.imageManager.addImage(i,e[t][n]),r&&(this._changedImages[i]=!0)}}}).catch(e=>{this._spriteRequest=null,o=e,n.signal.aborted||this.fire(new t.k(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}_validateLayer(e){const r=this.tileManagers[e.source];if(!r)return;const i=e.sourceLayer;if(!i)return;const n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new t.k(new Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,r=!1){const i=this._serializedAllLayers();if(!e||0===e.length)return Object.values(r?t.bV(i):i);const n=[];for(const o of e)if(i[o]){const e=r?t.bV(i[o]):i[o];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const t=Object.keys(this._layers);for(const r of t){const t=this._layers[r];"custom"!==t.type&&(e[r]=t.serialize())}return e}hasTransitions(){var e,t,r;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(t=this.sky)||void 0===t?void 0:t.hasTransition())return!0;if(null===(r=this.projection)||void 0===r?void 0:r.hasTransition())return!0;for(const i in this.tileManagers)if(this.tileManagers[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(e){if(!this._loaded)return;const r=this._changed;if(r){const t=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(t.length||r.length)&&this._updateWorkerLayers(t,r);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const i in this._updatedPaintProps)this._layers[i].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const i={};for(const t in this.tileManagers){const e=this.tileManagers[t];i[t]=e.used,e.used=!1}for(const t of this._order){const r=this._layers[t];r.recalculate(e,this._availableImages),!r.isHidden(e.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(const n in i){const e=this.tileManagers[n];!!i[n]!=!!e.used&&e.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:n}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,r&&this.fire(new t.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,r={}){var i;this._checkLoaded();const n=this.serialize();if(e=r.transformStyle?r.transformStyle(n,e):e,(null===(i=r.validate)||void 0===i||i)&&Rr(this,t.C(e)))return!1;(e=t.bV(e)).layers=t.bS(e.layers);const o=t.bW(n,e),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 t of a.operations)t();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const t=[],r=[];for(const i of e)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":t.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":t.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,i.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":t.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":t.push(()=>{});break;default:r.push(i.command)}return{operations:t,unimplemented:r}}addImage(e,r){if(this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,r),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,r,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw new Error(`Source "${e}" 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(t.C.source,`sources.${e}`,r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const n=this.tileManagers[e]=new Le(e,r,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e})),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.k(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const r=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],r.fire(new t.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);const r=this.tileManagers[e].getSource();if("geojson"!==r.type)throw new Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]&&this.tileManagers[e].getSource()}addLayer(e,r,i={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===e.type){if(Rr(this,t.bX(e)))return;o=t.bT(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bV(e),e=t.e(e,{source:n})),this._validate(t.C.layer,`layers.${n}`,e,{arrayIndex:-1},i))return;o=t.bT(e,this._globalState),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 t.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 e=this._removedLayers[n];delete this._removedLayers[n],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.tileManagers[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,r){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===r)return;const i=this._order.indexOf(e);this._order.splice(i,1);const n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new t.k(new Error(`Cannot move layer "${e}" before non-existing layer "${r}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const r=this._layers[e];if(!r)return void this.fire(new t.k(new Error(`Cannot remove non-existing layer "${e}".`)));r.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,r,i){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new t.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,r,i={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.bR(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(t.C.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(t.bV(r)),this._updateLayer(n)))}else this.fire(new t.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bV(this.getLayer(e).filter)}setLayoutProperty(e,r,i,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bR(o.getLayoutProperty(r),i)||(o.setLayoutProperty(r,i,n),this._updateLayer(o)):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,r){const i=this.getLayer(e);if(i)return i.getLayoutProperty(r);this.fire(new t.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,r,i,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bR(o.getPaintProperty(r),i)||this._updatePaintProperty(o,r,i,n):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,r,i,n={}){e.setPaintProperty(r,i,n)&&this._updateLayer(e),t.bU(e)&&"raster-fade-duration"===r&&this.tileManagers[e.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,r){this._checkLoaded();const i=e.source,n=e.sourceLayer,o=this.tileManagers[i];if(void 0===o)return void this.fire(new t.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 t.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,r)):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,r){this._checkLoaded();const i=e.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new t.k(new Error(`The source '${i}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,e.id,r):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const r=e.source,i=e.sourceLayer,n=this.tileManagers[r];if(void 0!==n)return"vector"!==n.getSource().type||i?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,e.id)):void this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.bY(this.tileManagers,e=>e.serialize()),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bZ({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:e,layers:r,terrain:i},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,r={},i=[];for(let o=this._order.length-1;o>=0;o--){const n=this._order[o];if(t(n)){r[n]=o;for(const t of e){const e=t[n];if(e)for(const t of e)i.push(t)}}}i.sort((e,t)=>t.intersectionZ-e.intersectionZ);const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(t(a))for(let e=i.length-1;e>=0;e--){const t=i[e].feature;if(r[t.layer.id]<o)break;n.push(t),i.pop()}else for(const t of e){const e=t[a];if(e)for(const t of e)n.push(t.feature)}}return n}queryRenderedFeatures(e,r,i){r&&r.filter&&this._validate(t.C.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 t.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const e of r.layers){const r=this._layers[e];if(!r)return this.fire(new t.k(new Error(`The layer '${e}' 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,globalState:this._globalState});for(const t in this.tileManagers)r.layers&&!n[t]||o.push(G(this.tileManagers[t],this._layers,a,e,l,i,this.map.terrain?(e,t,r)=>this.map.terrain.getElevation(e,t,r):void 0));return this.placement&&o.push(function(e,t,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(q);for(const u of c){const r=u.featureIndex.lookupSymbolFeatures(l[u.bucketInstanceId],t,u.bucketIndex,u.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,e);for(const e in r){const t=s[e]=s[e]||[],i=r[e];i.sort((e,t)=>{const r=u.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex});for(const e of i)t.push(e)}}return function(e,t,r){for(const i in e)for(const n of e[i])$(n,r[t[i].source]);return e}(s,e,r)}(this._layers,a,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,r){(null==r?void 0:r.filter)&&this._validate(t.C.filter,"querySourceFeatures.filter",r.filter,null,r);const i=this.tileManagers[e];return i?function(e,t){const r=e.getRenderableIds().map(t=>e.getTileByID(t)),i=[],n={};for(let o=0;o<r.length;o++){const e=r[o],a=e.tileID.canonical.key;n[a]||(n[a]=!0,e.querySourceFeatures(i,t))}return i}(i,r?Object.assign(Object.assign({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,r={}){this._checkLoaded();const i=this.light.getLight();let n=!1;for(const a in e)if(!t.bR(e[a],i[a])){n=!0;break}if(!n)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(o)}getProjection(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.sky}setSky(e,r={}){this._checkLoaded();const i=this.getSky();let n=!1;if(!e&&!i)return;if(e&&!i)n=!0;else if(!e&&i)n=!0;else for(const a in e)if(!t.bR(e[a],i[a])){n=!0;break}if(!n)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,r),this.sky.updateTransitions(o)}_setProjectionInternal(e){const r=function(e,r){const i={constrainOverride:r};if(Array.isArray(e)){const t=new dr({type:e});return{projection:t,transform:new Cr(i),cameraHelper:new Dr(t)}}switch(e){case"mercator":return{projection:new Nt,transform:new Zt(i),cameraHelper:new Yt};case"globe":{const e=new dr({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Cr(i),cameraHelper:new Dr(e)}}case"vertical-perspective":return{projection:new ur,transform:new Ar(i),cameraHelper:new Mr};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Nt,transform:new Zt(i),cameraHelper:new Yt}}}(e,this.map.transformConstrain);this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper);for(const t in this.tileManagers)this.tileManagers[t].reload()}_validate(e,r,i,n,o={}){return(!o||!1!==o.validate)&&Rr(this,e.call(t.C,t.e({key:r,style:this.serialize(),value:i,styleSpec:t.u},n)))}_remove(e=!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),ce().off(ae,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(const t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,r,i,n=!1){let o=!1,a=!1;const s={};for(const l of this._order){const t=this._layers[l];if("symbol"!==t.type)continue;if(!s[t.source]){const e=this.tileManagers[t.source];s[t.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const r=this.crossTileSymbolIndex.addLayer(t,s[t.source],e.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(c(),e.zoom))&&(this.pauseablePlacement=new It(e,this.map.terrain,this._order,n,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const l of this._order){const e=this._layers[l];"symbol"===e.type&&this.placement.updateLayerOpacities(e,s[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,r){return t._(this,void 0,void 0,function*(){const e=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();const t=this.tileManagers[r.source];return t&&t.setDependencies(r.tileID.key,r.type,r.icons),e})}getGlyphs(e,r){return t._(this,void 0,void 0,function*(){const e=yield this.glyphManager.getGlyphs(r.stacks),t=this.tileManagers[r.source];return t&&t.setDependencies(r.tileID.key,r.type,[""]),e})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,r={}){this._checkLoaded(),e&&this._validate(t.C.glyphs,"glyphs",e,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,r){return t._(this,void 0,void 0,function*(){const e={};for(const[t,i]of Object.entries(r.dashes))e[t]=this.lineAtlas.getDash(i.dasharray,i.round);return e})}addSprite(e,r,i={},n){this._checkLoaded();const o=[{id:e,url:r}],a=[...v(this.stylesheet.sprite),...o];this._validate(t.C.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const r=v(this.stylesheet.sprite);if(r.find(t=>t.id===e)){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;r.splice(r.findIndex(t=>t.id===e),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}else this.fire(new t.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return v(this.stylesheet.sprite)}setSprite(e,r={},i){this._checkLoaded(),e&&this._validate(t.C.sprite,"sprite",e,null,r)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const e in this.tileManagers){const t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const e in this._layers){const t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Fr=t.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class zr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,n,o,a,s,l){this.context=e;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!==t||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,n,o,a,s,l):(e.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,r,i,n,o,a,s){const l=e.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,t.enableAttributes(u,e);for(const h of r)h.enableAttributes(u,e);o&&o.enableAttributes(u,e),a&&a.enableAttributes(u,e),s&&s.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,n);for(const h of r)h.bind(),h.setVertexAttribPointers(u,e,n);o&&(o.bind(),o.setVertexAttribPointers(u,e,n)),i&&i.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,e,n)),s&&(s.bind(),s.setVertexAttribPointers(u,e,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Br=(e,r,i,n,o)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):t.bp.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"):t.bp.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Nr={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 jr(e){const t=[];for(let r=0;r<e.length;r++){if(null===e[r])continue;const i=e[r].split(" ");t.push(i.pop())}return t}class Vr{constructor(e,r,i,n,o,a,s,l,c=[]){const u=e.gl;this.program=u.createProgram();const h=jr(r.staticAttributes),d=i?i.getBinderAttributes():[],p=h.concat(d),f=Rt.prelude.staticUniforms?jr(Rt.prelude.staticUniforms):[],m=s.staticUniforms?jr(s.staticUniforms):[],g=r.staticUniforms?jr(r.staticUniforms):[],y=i?i.getBinderUniforms():[],_=f.concat(m).concat(g).concat(y),v=[];for(const t of _)v.indexOf(t)<0&&v.push(t);const b=i?i.defines():[];or(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(Rt.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join("\n"),w=b.concat(Rt.prelude.vertexSource,s.vertexSource,r.vertexSource).join("\n");or(u)||(x=function(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),w=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,x),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);const S=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S),this.attributes={};const E={};this.numAttributes=p.length;for(let t=0;t<this.numAttributes;t++)p[t]&&(u.bindAttribLocation(this.program,t,p[t]),this.attributes[p[t]]=t);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(S),u.deleteShader(T);for(let t=0;t<v.length;t++){const e=v[t];if(e&&!E[e]){const t=u.getUniformLocation(this.program,e);t&&(E[e]=t)}}this.fixedUniforms=n(e,E),this.terrainUniforms=((e,r)=>({u_depth:new t.b_(e,r.u_depth),u_terrain:new t.b_(e,r.u_terrain),u_terrain_dim:new t.bq(e,r.u_terrain_dim),u_terrain_matrix:new t.c0(e,r.u_terrain_matrix),u_terrain_unpack:new t.c1(e,r.u_terrain_unpack),u_terrain_exaggeration:new t.bq(e,r.u_terrain_exaggeration)}))(e,E),this.projectionUniforms=((e,r)=>({u_projection_matrix:new t.c0(e,r.u_projection_matrix),u_projection_tile_mercator_coords:new t.c1(e,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c1(e,r.u_projection_clipping_plane),u_projection_transition:new t.bq(e,r.u_projection_transition),u_projection_fallback_matrix:new t.c0(e,r.u_projection_fallback_matrix)}))(e,E),this.binderUniforms=i?i.getUniforms(e,E):[]}draw(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_){const v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(n),e.setCullFace(o),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}if(l)for(const x in l)this.projectionUniforms[Nr[x]].set(l[x]);if(a)for(const x in this.fixedUniforms)this.fixedUniforms[x].set(a[x]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let b=0;switch(t){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 zr)).bind(e,this,u,m?m.getPaintVertexBuffers():[],h,x.vertexOffset,g,y,_),v.drawElements(t,x.primitiveLength*b,v.UNSIGNED_SHORT,x.primitiveOffset*b*2)}}}function Ur(e,r,i){const n=1/t.aN(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,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Gr=(e,r,i,n)=>{const o=e.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.c4();"viewport"===o.properties.get("anchor")&&t.c5(l,e.transform.bearingInRadians),t.c6(s,s,l);const c=e.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}},qr=(e,r,i,n,o,a,s)=>t.e(Gr(e,r,i,n),Ur(a,e,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),$r=(e,r,i,n)=>t.e(Ur(r,e,i),{u_fill_translate:n}),Wr=(e,t)=>({u_world:e,u_fill_translate:t}),Zr=(e,r,i,n,o)=>t.e($r(e,r,i,o),{u_world:n}),Hr=(e,r,i,n,o)=>{const a=e.transform;let s,l,c=0;if("map"===i.paint.get("circle-pitch-alignment")){const e=t.aN(r,1,a.zoom);s=!0,l=[e,e],c=e/(t.a5*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:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},Xr=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),Kr=e=>({u_viewport_size:[e.width,e.height]}),Yr=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Jr=(e,r,i,n)=>{const o=t.aN(e,1,r)/(t.a5*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.aN(e,1,r),u_intensity:i,u_globe_extrude_scale:o}},Qr=(e,r,i,n)=>{const o=t.N();t.c7(o,0,e.width,e.height,0,0,1);const a=e.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")}},ei=(e,t,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]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:ri(0,t.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}},ti=(e,r)=>{const i=r.stride,n=t.N();return t.c7(n,0,t.a5,-t.a5,0,0,1),t.O(n,n,[0,-t.a5,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}};function ri(e,r){const i=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new t.a9(0,n/i).toLngLat().lat,new t.a9(0,(n+1)/i).toLngLat().lat]}const ii=(e,t,r=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:e.paint.get("color-relief-opacity")}),ni=(e,r,i,n)=>{const o=e.transform;return{u_translation:ui(e,r,i),u_ratio:n/t.aN(r,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},oi=(e,r,i,n,o)=>t.e(ni(e,r,i,n),{u_image:0,u_image_height:o}),ai=(e,r,i,n,o)=>{const a=e.transform,s=ci(r,a);return{u_translation:ui(e,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/t.aN(r,1,a.zoom),u_device_pixel_ratio:e.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]]}},si=(e,r,i,n,o)=>{const a=ci(r,e.transform);return t.e(ni(e,r,i,n),{u_tileratio:a,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},li=(e,r,i,n,o,a)=>{const s=ci(r,e.transform);return t.e(ni(e,r,i,n),{u_image:0,u_image_height:a,u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function ci(e,r){return 1/t.aN(e,1,r.tileZoom)}function ui(e,r,i){return t.aO(e.transform,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const hi=(e,t,r,i,n)=>{return{u_tl_parent:e,u_scale_parent:t,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:di(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 di(e){e*=Math.PI/180;const t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}const pi=(e,t,r,i,n,o,a,s,l,c,u,h,d)=>{const p=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.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}},fi=(e,r,i,n,o,a,s,l,c,u,h,d,p,f)=>{const m=s.transform;return t.e(pi(e,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})},mi=(e,r,i,n,o,a,s,l,c,u,h,d,p)=>t.e(fi(e,r,i,n,o,a,s,l,c,u,!0,h,0,p),{u_texsize_icon:d,u_texture_icon:1}),gi=(e,t)=>({u_opacity:e,u_color:t}),yi=(e,r,i,n,o)=>t.e(function(e,r,i,n){const o=i.imageManager.getPattern(e.from.toString()),a=i.imageManager.getPattern(e.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/t.aN(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:e}),_i=(e,t)=>{},vi={fillExtrusion:(e,r)=>({u_lightpos:new t.c2(e,r.u_lightpos),u_lightpos_globe:new t.c2(e,r.u_lightpos_globe),u_lightintensity:new t.bq(e,r.u_lightintensity),u_lightcolor:new t.c2(e,r.u_lightcolor),u_vertical_gradient:new t.bq(e,r.u_vertical_gradient),u_opacity:new t.bq(e,r.u_opacity),u_fill_translate:new t.c3(e,r.u_fill_translate)}),fillExtrusionPattern:(e,r)=>({u_lightpos:new t.c2(e,r.u_lightpos),u_lightpos_globe:new t.c2(e,r.u_lightpos_globe),u_lightintensity:new t.bq(e,r.u_lightintensity),u_lightcolor:new t.c2(e,r.u_lightcolor),u_vertical_gradient:new t.bq(e,r.u_vertical_gradient),u_height_factor:new t.bq(e,r.u_height_factor),u_opacity:new t.bq(e,r.u_opacity),u_fill_translate:new t.c3(e,r.u_fill_translate),u_image:new t.b_(e,r.u_image),u_texsize:new t.c3(e,r.u_texsize),u_pixel_coord_upper:new t.c3(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,r.u_pixel_coord_lower),u_scale:new t.c2(e,r.u_scale),u_fade:new t.bq(e,r.u_fade)}),fill:(e,r)=>({u_fill_translate:new t.c3(e,r.u_fill_translate)}),fillPattern:(e,r)=>({u_image:new t.b_(e,r.u_image),u_texsize:new t.c3(e,r.u_texsize),u_pixel_coord_upper:new t.c3(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,r.u_pixel_coord_lower),u_scale:new t.c2(e,r.u_scale),u_fade:new t.bq(e,r.u_fade),u_fill_translate:new t.c3(e,r.u_fill_translate)}),fillOutline:(e,r)=>({u_world:new t.c3(e,r.u_world),u_fill_translate:new t.c3(e,r.u_fill_translate)}),fillOutlinePattern:(e,r)=>({u_world:new t.c3(e,r.u_world),u_image:new t.b_(e,r.u_image),u_texsize:new t.c3(e,r.u_texsize),u_pixel_coord_upper:new t.c3(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,r.u_pixel_coord_lower),u_scale:new t.c2(e,r.u_scale),u_fade:new t.bq(e,r.u_fade),u_fill_translate:new t.c3(e,r.u_fill_translate)}),circle:(e,r)=>({u_camera_to_center_distance:new t.bq(e,r.u_camera_to_center_distance),u_scale_with_map:new t.b_(e,r.u_scale_with_map),u_pitch_with_map:new t.b_(e,r.u_pitch_with_map),u_extrude_scale:new t.c3(e,r.u_extrude_scale),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_globe_extrude_scale:new t.bq(e,r.u_globe_extrude_scale),u_translate:new t.c3(e,r.u_translate)}),collisionBox:(e,r)=>({u_pixel_extrude_scale:new t.c3(e,r.u_pixel_extrude_scale)}),collisionCircle:(e,r)=>({u_viewport_size:new t.c3(e,r.u_viewport_size)}),debug:(e,r)=>({u_color:new t.b$(e,r.u_color),u_overlay:new t.b_(e,r.u_overlay),u_overlay_scale:new t.bq(e,r.u_overlay_scale)}),depth:_i,clippingMask:_i,heatmap:(e,r)=>({u_extrude_scale:new t.bq(e,r.u_extrude_scale),u_intensity:new t.bq(e,r.u_intensity),u_globe_extrude_scale:new t.bq(e,r.u_globe_extrude_scale)}),heatmapTexture:(e,r)=>({u_matrix:new t.c0(e,r.u_matrix),u_world:new t.c3(e,r.u_world),u_image:new t.b_(e,r.u_image),u_color_ramp:new t.b_(e,r.u_color_ramp),u_opacity:new t.bq(e,r.u_opacity)}),hillshade:(e,r)=>({u_image:new t.b_(e,r.u_image),u_latrange:new t.c3(e,r.u_latrange),u_exaggeration:new t.bq(e,r.u_exaggeration),u_altitudes:new t.c9(e,r.u_altitudes),u_azimuths:new t.c9(e,r.u_azimuths),u_accent:new t.b$(e,r.u_accent),u_method:new t.b_(e,r.u_method),u_shadows:new t.c8(e,r.u_shadows),u_highlights:new t.c8(e,r.u_highlights)}),hillshadePrepare:(e,r)=>({u_matrix:new t.c0(e,r.u_matrix),u_image:new t.b_(e,r.u_image),u_dimension:new t.c3(e,r.u_dimension),u_zoom:new t.bq(e,r.u_zoom),u_unpack:new t.c1(e,r.u_unpack)}),colorRelief:(e,r)=>({u_image:new t.b_(e,r.u_image),u_unpack:new t.c1(e,r.u_unpack),u_dimension:new t.c3(e,r.u_dimension),u_elevation_stops:new t.b_(e,r.u_elevation_stops),u_color_stops:new t.b_(e,r.u_color_stops),u_color_ramp_size:new t.b_(e,r.u_color_ramp_size),u_opacity:new t.bq(e,r.u_opacity)}),line:(e,r)=>({u_translation:new t.c3(e,r.u_translation),u_ratio:new t.bq(e,r.u_ratio),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,r.u_units_to_pixels)}),lineGradient:(e,r)=>({u_translation:new t.c3(e,r.u_translation),u_ratio:new t.bq(e,r.u_ratio),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,r.u_units_to_pixels),u_image:new t.b_(e,r.u_image),u_image_height:new t.bq(e,r.u_image_height)}),linePattern:(e,r)=>({u_translation:new t.c3(e,r.u_translation),u_texsize:new t.c3(e,r.u_texsize),u_ratio:new t.bq(e,r.u_ratio),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_image:new t.b_(e,r.u_image),u_units_to_pixels:new t.c3(e,r.u_units_to_pixels),u_scale:new t.c2(e,r.u_scale),u_fade:new t.bq(e,r.u_fade)}),lineSDF:(e,r)=>({u_translation:new t.c3(e,r.u_translation),u_ratio:new t.bq(e,r.u_ratio),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,r.u_units_to_pixels),u_image:new t.b_(e,r.u_image),u_mix:new t.bq(e,r.u_mix),u_tileratio:new t.bq(e,r.u_tileratio),u_crossfade_from:new t.bq(e,r.u_crossfade_from),u_crossfade_to:new t.bq(e,r.u_crossfade_to),u_lineatlas_width:new t.bq(e,r.u_lineatlas_width),u_lineatlas_height:new t.bq(e,r.u_lineatlas_height)}),lineGradientSDF:(e,r)=>({u_translation:new t.c3(e,r.u_translation),u_ratio:new t.bq(e,r.u_ratio),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,r.u_units_to_pixels),u_image:new t.b_(e,r.u_image),u_image_height:new t.bq(e,r.u_image_height),u_tileratio:new t.bq(e,r.u_tileratio),u_crossfade_from:new t.bq(e,r.u_crossfade_from),u_crossfade_to:new t.bq(e,r.u_crossfade_to),u_image_dash:new t.b_(e,r.u_image_dash),u_mix:new t.bq(e,r.u_mix),u_lineatlas_width:new t.bq(e,r.u_lineatlas_width),u_lineatlas_height:new t.bq(e,r.u_lineatlas_height)}),raster:(e,r)=>({u_tl_parent:new t.c3(e,r.u_tl_parent),u_scale_parent:new t.bq(e,r.u_scale_parent),u_buffer_scale:new t.bq(e,r.u_buffer_scale),u_fade_t:new t.bq(e,r.u_fade_t),u_opacity:new t.bq(e,r.u_opacity),u_image0:new t.b_(e,r.u_image0),u_image1:new t.b_(e,r.u_image1),u_brightness_low:new t.bq(e,r.u_brightness_low),u_brightness_high:new t.bq(e,r.u_brightness_high),u_saturation_factor:new t.bq(e,r.u_saturation_factor),u_contrast_factor:new t.bq(e,r.u_contrast_factor),u_spin_weights:new t.c2(e,r.u_spin_weights),u_coords_top:new t.c1(e,r.u_coords_top),u_coords_bottom:new t.c1(e,r.u_coords_bottom)}),symbolIcon:(e,r)=>({u_is_size_zoom_constant:new t.b_(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,r.u_is_size_feature_constant),u_size_t:new t.bq(e,r.u_size_t),u_size:new t.bq(e,r.u_size),u_camera_to_center_distance:new t.bq(e,r.u_camera_to_center_distance),u_pitch:new t.bq(e,r.u_pitch),u_rotate_symbol:new t.b_(e,r.u_rotate_symbol),u_aspect_ratio:new t.bq(e,r.u_aspect_ratio),u_fade_change:new t.bq(e,r.u_fade_change),u_label_plane_matrix:new t.c0(e,r.u_label_plane_matrix),u_coord_matrix:new t.c0(e,r.u_coord_matrix),u_is_text:new t.b_(e,r.u_is_text),u_pitch_with_map:new t.b_(e,r.u_pitch_with_map),u_is_along_line:new t.b_(e,r.u_is_along_line),u_is_variable_anchor:new t.b_(e,r.u_is_variable_anchor),u_texsize:new t.c3(e,r.u_texsize),u_texture:new t.b_(e,r.u_texture),u_translation:new t.c3(e,r.u_translation),u_pitched_scale:new t.bq(e,r.u_pitched_scale)}),symbolSDF:(e,r)=>({u_is_size_zoom_constant:new t.b_(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,r.u_is_size_feature_constant),u_size_t:new t.bq(e,r.u_size_t),u_size:new t.bq(e,r.u_size),u_camera_to_center_distance:new t.bq(e,r.u_camera_to_center_distance),u_pitch:new t.bq(e,r.u_pitch),u_rotate_symbol:new t.b_(e,r.u_rotate_symbol),u_aspect_ratio:new t.bq(e,r.u_aspect_ratio),u_fade_change:new t.bq(e,r.u_fade_change),u_label_plane_matrix:new t.c0(e,r.u_label_plane_matrix),u_coord_matrix:new t.c0(e,r.u_coord_matrix),u_is_text:new t.b_(e,r.u_is_text),u_pitch_with_map:new t.b_(e,r.u_pitch_with_map),u_is_along_line:new t.b_(e,r.u_is_along_line),u_is_variable_anchor:new t.b_(e,r.u_is_variable_anchor),u_texsize:new t.c3(e,r.u_texsize),u_texture:new t.b_(e,r.u_texture),u_gamma_scale:new t.bq(e,r.u_gamma_scale),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_is_halo:new t.b_(e,r.u_is_halo),u_translation:new t.c3(e,r.u_translation),u_pitched_scale:new t.bq(e,r.u_pitched_scale)}),symbolTextAndIcon:(e,r)=>({u_is_size_zoom_constant:new t.b_(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,r.u_is_size_feature_constant),u_size_t:new t.bq(e,r.u_size_t),u_size:new t.bq(e,r.u_size),u_camera_to_center_distance:new t.bq(e,r.u_camera_to_center_distance),u_pitch:new t.bq(e,r.u_pitch),u_rotate_symbol:new t.b_(e,r.u_rotate_symbol),u_aspect_ratio:new t.bq(e,r.u_aspect_ratio),u_fade_change:new t.bq(e,r.u_fade_change),u_label_plane_matrix:new t.c0(e,r.u_label_plane_matrix),u_coord_matrix:new t.c0(e,r.u_coord_matrix),u_is_text:new t.b_(e,r.u_is_text),u_pitch_with_map:new t.b_(e,r.u_pitch_with_map),u_is_along_line:new t.b_(e,r.u_is_along_line),u_is_variable_anchor:new t.b_(e,r.u_is_variable_anchor),u_texsize:new t.c3(e,r.u_texsize),u_texsize_icon:new t.c3(e,r.u_texsize_icon),u_texture:new t.b_(e,r.u_texture),u_texture_icon:new t.b_(e,r.u_texture_icon),u_gamma_scale:new t.bq(e,r.u_gamma_scale),u_device_pixel_ratio:new t.bq(e,r.u_device_pixel_ratio),u_is_halo:new t.b_(e,r.u_is_halo),u_translation:new t.c3(e,r.u_translation),u_pitched_scale:new t.bq(e,r.u_pitched_scale)}),background:(e,r)=>({u_opacity:new t.bq(e,r.u_opacity),u_color:new t.b$(e,r.u_color)}),backgroundPattern:(e,r)=>({u_opacity:new t.bq(e,r.u_opacity),u_image:new t.b_(e,r.u_image),u_pattern_tl_a:new t.c3(e,r.u_pattern_tl_a),u_pattern_br_a:new t.c3(e,r.u_pattern_br_a),u_pattern_tl_b:new t.c3(e,r.u_pattern_tl_b),u_pattern_br_b:new t.c3(e,r.u_pattern_br_b),u_texsize:new t.c3(e,r.u_texsize),u_mix:new t.bq(e,r.u_mix),u_pattern_size_a:new t.c3(e,r.u_pattern_size_a),u_pattern_size_b:new t.c3(e,r.u_pattern_size_b),u_scale_a:new t.bq(e,r.u_scale_a),u_scale_b:new t.bq(e,r.u_scale_b),u_pixel_coord_upper:new t.c3(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bq(e,r.u_tile_units_to_pixels)}),terrain:(e,r)=>({u_texture:new t.b_(e,r.u_texture),u_ele_delta:new t.bq(e,r.u_ele_delta),u_fog_matrix:new t.c0(e,r.u_fog_matrix),u_fog_color:new t.b$(e,r.u_fog_color),u_fog_ground_blend:new t.bq(e,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bq(e,r.u_fog_ground_blend_opacity),u_horizon_color:new t.b$(e,r.u_horizon_color),u_horizon_fog_blend:new t.bq(e,r.u_horizon_fog_blend),u_is_globe_mode:new t.bq(e,r.u_is_globe_mode)}),terrainDepth:(e,r)=>({u_ele_delta:new t.bq(e,r.u_ele_delta)}),terrainCoords:(e,r)=>({u_texture:new t.b_(e,r.u_texture),u_terrain_coords_id:new t.bq(e,r.u_terrain_coords_id),u_ele_delta:new t.bq(e,r.u_ele_delta)}),projectionErrorMeasurement:(e,r)=>({u_input:new t.bq(e,r.u_input),u_output_expected:new t.bq(e,r.u_output_expected)}),atmosphere:(e,r)=>({u_sun_pos:new t.c2(e,r.u_sun_pos),u_atmosphere_blend:new t.bq(e,r.u_atmosphere_blend),u_globe_position:new t.c2(e,r.u_globe_position),u_globe_radius:new t.bq(e,r.u_globe_radius),u_inv_proj_matrix:new t.c0(e,r.u_inv_proj_matrix)}),sky:(e,r)=>({u_sky_color:new t.b$(e,r.u_sky_color),u_horizon_color:new t.b$(e,r.u_horizon_color),u_horizon:new t.c3(e,r.u_horizon),u_horizon_normal:new t.c3(e,r.u_horizon_normal),u_sky_horizon_blend:new t.bq(e,r.u_sky_horizon_blend),u_sky_blend:new t.bq(e,r.u_sky_blend)})};class bi{constructor(e,t,r){this.context=e;const i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const xi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class wi{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r=0;r<this.attributes.length;r++){const i=t.attributes[this.attributes[r].name];void 0!==i&&e.enableVertexAttribArray(i)}}setVertexAttribPointers(e,t,r){for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],o=t.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[xi[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ti{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Si extends Ti{getDefault(){return t.bp.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ei extends Ti{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Ii extends Ti{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Pi extends Ti{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ki extends Ti{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Ai extends Ti{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Ci extends Ti{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Mi extends Ti{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Di extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class Ri extends Ti{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Oi extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Li extends Ti{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Fi extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class zi extends Ti{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Bi extends Ti{getDefault(){return t.bp.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ni extends Ti{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class ji extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Vi extends Ti{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Ui extends Ti{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Gi extends Ti{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class qi extends Ti{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class $i extends Ti{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Wi extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Zi extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Hi extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Xi extends Ti{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ki extends Ti{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Yi extends Ti{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;const r=this.gl;or(r)?r.bindVertexArray(e):null===(t=r.getExtension("OES_vertex_array_object"))||void 0===t||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Ji extends Ti{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Qi extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class en extends Ti{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class tn extends Ti{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class rn extends tn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class nn extends tn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class on extends tn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const an="Framebuffer is not complete";class sn{constructor(e,t,r,i,n){this.context=e,this.width=t,this.height=r;const o=e.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new rn(e,a),i)this.depthAttachment=n?new on(e,a):new nn(e,a);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(an)}destroy(){const e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class ln{constructor(e){var t,r;if(this.gl=e,this.clearColor=new Si(this),this.clearDepth=new Ei(this),this.clearStencil=new Ii(this),this.colorMask=new Pi(this),this.depthMask=new ki(this),this.stencilMask=new Ai(this),this.stencilFunc=new Ci(this),this.stencilOp=new Mi(this),this.stencilTest=new Di(this),this.depthRange=new Ri(this),this.depthTest=new Oi(this),this.depthFunc=new Li(this),this.blend=new Fi(this),this.blendFunc=new zi(this),this.blendColor=new Bi(this),this.blendEquation=new Ni(this),this.cullFace=new ji(this),this.cullFaceSide=new Vi(this),this.frontFace=new Ui(this),this.program=new Gi(this),this.activeTexture=new qi(this),this.viewport=new $i(this),this.bindFramebuffer=new Wi(this),this.bindRenderbuffer=new Zi(this),this.bindTexture=new Hi(this),this.bindVertexBuffer=new Xi(this),this.bindElementBuffer=new Ki(this),this.bindVertexArray=new Yi(this),this.pixelStoreUnpack=new Ji(this),this.pixelStoreUnpackPremultiplyAlpha=new Qi(this),this.pixelStoreUnpackFlipY=new en(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),or(e)){this.HALF_FLOAT=e.HALF_FLOAT;const i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(t=e.RGBA16F)&&void 0!==t?t:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!==(r=e.RGB16F)&&void 0!==r?r:null==i?void 0:i.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.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(e,t){return new bi(this,e,t)}createVertexBuffer(e,t,r){return new wi(this,e,t,r)}createRenderbuffer(e,t,r){const i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,r,i){return new sn(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){const i=this.gl;let n=0;e&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==r&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bR(e.blendFunction,Jt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return or(this.gl)?this.gl.createVertexArray():null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return or(this.gl)?this.gl.deleteVertexArray(e):null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let cn;function un(e,r,i,n,o){const a=e.context,s=e.transform,l=a.gl,c=e.useProgram("collisionBox"),u=[];let h=0,d=0;for(let t=0;t<n.length;t++){const p=n[t],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,tr.disabled,ir.disabled,e.colorModeForRenderPass(),er.disabled,Xr(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),s.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,e.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!u.length)return;const p=e.useProgram("collisionCircle"),f=new t.ca;f.resize(4*h),f._trim();let m=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const r=4*e,i=t.circleArray[r+0],n=t.circleArray[r+1],o=t.circleArray[r+2],a=t.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)}(!cn||cn.length<2*h)&&(cn=function(e){const r=2*e,i=new t.cc;i.resize(r),i._trim();for(let t=0;t<r;t++){const e=6*t;i.uint16[e+0]=4*t+0,i.uint16[e+1]=4*t+1,i.uint16[e+2]=4*t+2,i.uint16[e+3]=4*t+2,i.uint16[e+4]=4*t+3,i.uint16[e+5]=4*t+0}return i}(h));const g=a.createIndexBuffer(cn,!0),y=a.createVertexBuffer(f,t.cb.members,!0);for(const _ of u){const r=Kr(e.transform);p.draw(a,l.TRIANGLES,tr.disabled,ir.disabled,e.colorModeForRenderPass(),er.disabled,r,e.style.map.terrain&&e.style.map.terrain.getTerrainData(_.coord),null,i.id,y,g,t.aX.simpleSegment(0,2*_.circleOffset,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null)}y.destroy(),g.destroy()}const hn=t.ar(new Float32Array(16));function dn(e,r,i,n,o,a){const{horizontalAlign:s,verticalAlign:l}=t.aS(e);return new t.P((-(s-.5)*r/o+n[0])*a,(-(l-.5)*i/o+n[1])*a)}function pn(e,r,i,n,o,a){const s=r.tileAnchorPoint.add(new t.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let e=n.mult(a);i||(e=e.rotate(-o));const t=s.add(e);return Ue(t.x,t.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(i){const t=Ye(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(e),i=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(n.rotate(i))}return e.add(n)}function fn(e,r,i,n,o,a,s,l,c,u,h,d){const p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let y=0;y<p.length;y++){const m=p.get(y),_=m.hidden||!m.crossTileID||e.allowVerticalPlacement&&!m.placedOrientation?null:n[m.crossTileID];if(_){const n=new t.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},y=i?Qe(n.x,n.y,p):Ye(n.x,n.y,p),v=Ge(o.cameraToCenterDistance,y.signedDistanceFromCamera);let b=t.aA(e.textSizeData,l,m)*v/t.aM;i&&(b*=e.tilePixelRatio/s);const{width:x,height:w,anchor:T,textOffset:S,textBoxScale:E}=_,I=dn(T,x,w,S,E,b),P=o.getPitchedTextCorrection(n.x+u[0],n.y+u[1],h),k=pn(y.point,p,r,I,-o.bearingInRadians,P),A=e.allowVerticalPlacement&&m.placedOrientation===t.az.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)t.aG(f,k,A);c&&m.associatedIconIndex>=0&&(g[m.associatedIconIndex]={shiftedAnchor:k,angle:A})}else nt(m.numGlyphs,f)}if(c){m.clear();const r=e.icon.placedSymbolArray;for(let e=0;e<r.length;e++){const i=r.get(e);if(i.hidden)nt(i.numGlyphs,m);else{const r=g[e];if(r)for(let e=0;e<i.numGlyphs;e++)t.aG(m,r.shiftedAnchor,r.angle);else nt(i.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function mn(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function gn(e,r,i,n,o,a,s,l,c,u,h,d,p){const f=e.context,m=f.gl,g=e.transform,y="map"===l,_="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 T=e.getDepthModeForSublayer(0,tr.ReadOnly),S=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],I=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,T=_||0!==g.pitch,k=e.useProgram(mn(d,o,l),h),A=t.ay(f,g.zoom),C=e.style.map.terrain&&e.style.map.terrain.getTerrainData(P);let M,D,R,O,L=[0,0],F=null;if(o)D=n.glyphAtlasTexture,R=m.LINEAR,M=n.glyphAtlasTexture.size,l.iconsInText&&(L=n.imageAtlasTexture.size,F=n.imageAtlasTexture,O=T||e.options.rotating||e.options.zooming||"composite"===f.kind||"camera"===f.kind?m.LINEAR:m.NEAREST);else{const t=1!==i.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;D=n.imageAtlasTexture,R=d||e.options.rotating||e.options.zooming||t||T?m.LINEAR:m.NEAREST,M=n.imageAtlasTexture.size}const z=t.aN(n,1,e.transform.zoom),B=Ne(y,e.transform,z),N=t.N();t.aB(N,B);const j=je(_,y,e.transform,z),V=t.aO(g,n,a,s),U=g.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),G=S&&l.hasTextData(),q="none"!==i.layout.get("icon-text-fit")&&G&&l.hasIconData();if(v){const t=e.style.map.terrain?(t,r)=>e.style.map.terrain.getElevation(P,t,r):null,r="map"===i.layout.get("text-rotation-alignment");$e(l,e,o,B,N,_,u,r,P.toUnwrapped(),g.width,g.height,V,t)}const $=o&&S||q,W=v||$?hn:_?B:e.transform.clipSpaceToPixelsMatrix,Z=d&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=d?l.iconsInText?mi(f.kind,A,b,_,v,$,e,W,j,V,M,L,I):fi(f.kind,A,b,_,v,$,e,W,j,V,o,M,0,I):pi(f.kind,A,b,_,v,$,e,W,j,V,o,M,I);const X={program:k,buffers:c,uniformValues:H,projectionData:U,atlasTexture:D,atlasTextureIcon:F,atlasInterpolation:R,atlasInterpolationIcon:O,isSDF:d,hasHalo:Z};if(x&&l.canOverlap){w=!0;const e=c.segments.get();for(const r of e)E.push({segments:new t.aX([r]),sortKey:r.sortKey,state:X,terrainData:C})}else E.push({segments:c.segments,sortKey:0,state:X,terrainData:C})}w&&E.sort((e,t)=>e.sortKey-t.sortKey);for(const t of E){const r=t.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,yn(r.buffers,t.segments,i,e,r.program,T,h,d,n,r.projectionData,t.terrainData)),n.u_is_halo=0}yn(r.buffers,t.segments,i,e,r.program,T,h,d,r.uniformValues,r.projectionData,t.terrainData)}}function yn(e,t,r,i,n,o,a,s,l,c,u){const h=i.context;n.draw(h,h.gl.TRIANGLES,o,a,s,er.backCCW,l,u,c,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function _n(e,r,i,n,o){const a=e.context,s=a.gl,l=ir.disabled,c=new Jt([s.ONE,s.ONE],t.bp.transparent,[!0,!0,!0,!0]),u=r.getBucket(i);if(!u)return;const h=n.key;let d=i.heatmapFbos.get(h);d||(d=bn(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:t.bp.transparent});const p=u.programConfigurations.get(i.id),f=e.useProgram("heatmap",p,!o),m=e.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);f.draw(a,s.TRIANGLES,tr.disabled,l,c,er.disabled,Jr(r,e.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,p)}function vn(e,t,r,i,n){const o=e.context,a=o.gl,s=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=xn(o,t),c=r.key,u=t.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});e.useProgram("heatmapTexture").draw(o,a.TRIANGLES,tr.disabled,ir.disabled,e.colorModeForRenderPass(),er.disabled,Qr(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(c)}function bn(e,t,r){var i,n;const o=e.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=e.HALF_FLOAT)&&void 0!==i?i:o.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,r,0,o.RGBA,s,null);const c=e.createFramebuffer(t,r,!1,!1);return c.colorAttachment.set(a),c}function xn(e,r){return r.colorRampTexture||(r.colorRampTexture=new t.T(e,r.colorRamp,e.gl.RGBA)),r.colorRampTexture}function wn(e,r,i,n,o,a,s,l){let c=256;if(o.stepInterpolant){const n=r.getSource().maxzoom,o=s.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;c=t.an(t.ce(a.maxLineLength/t.a5*1024*o),256,i.maxTextureSize)}return l.gradient=t.cf({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:l.gradient||void 0,clips:a.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new t.T(i,l.gradient,n.RGBA),l.version=o.gradientVersion,l.texture}function Tn(e,t,r,i,n){e.activeTexture.set(t.TEXTURE0),r.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),i.updatePaintBuffers(n)}function Sn(e,t,r,i,n,o){(n||e.lineAtlas.dirty)&&(t.activeTexture.set(r.TEXTURE0),e.lineAtlas.bind(t)),i.updatePaintBuffers(o)}function En(e,t,r,i,n,o,a){const s=o.gradients[n.id];let l=s.texture;n.gradientVersion!==s.version&&(l=wn(e,t,r,i,n,o,a,s)),r.activeTexture.set(i.TEXTURE0),l.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function In(e,t,r,i,n,o,a,s,l){const c=o.gradients[n.id];let u=c.texture;n.gradientVersion!==c.version&&(u=wn(e,t,r,i,n,o,a,c)),r.activeTexture.set(i.TEXTURE0),u.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE),r.activeTexture.set(i.TEXTURE1),e.lineAtlas.bind(r),s.updatePaintBuffers(l)}function Pn(e,t,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 e=n.getPaintProperty(t);a=o[e],s=o[e]}a&&s&&e.setConstantPatternPositions(a,s)}function kn(e,r,i,n,o,a,s,l){const c=e.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=e.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 T of n){const n=r.getTile(T);if(d&&!n.patternsLoaded())continue;const h=n.getBucket(i);if(!h)continue;const S=h.programConfigurations.get(i.id),E=e.useProgram(m,S),I=e.style.map.terrain&&e.style.map.terrain.getTerrainData(T);d&&(e.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers(p)),Pn(S,u,w,n,i);const P=v.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),k=t.aO(v,n,b,x);if(s){y=h.indexBuffer2,_=h.segments2;const t=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&d?Zr(e,p,n,t,k):Wr(t,k)}else y=h.indexBuffer,_=h.segments,g=d?$r(e,p,n,k):{u_fill_translate:k};const A=e.stencilModeForClipping(T);E.draw(e.context,f,o,A,a,er.backCCW,g,I,P,i.id,h.layoutVertexBuffer,y,_,i.paint,e.transform.zoom,S)}}function An(e,r,i,n,o,a,s,l){const c=e.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),y=e.transform;for(const _ of n){const n=r.getTile(_),d=n.getBucket(i);if(!d)continue;const v=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),b=d.programConfigurations.get(i.id),x=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",b);p&&(e.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),b.updatePaintBuffers(f));const w=y.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!l,applyTerrainMatrix:!0});Pn(b,h,g,n,i);const T=t.aO(y,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),S=i.paint.get("fill-extrusion-vertical-gradient"),E=p?qr(e,S,m,T,_,f,n):Gr(e,S,m,T);x.draw(c,c.gl.TRIANGLES,o,a,s,er.backCCW,E,v,w,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,e.transform.zoom,b,e.style.map.terrain&&d.centroidVertexBuffer)}}function Cn(e,t,r,i,n,o,a,s,l){var c;const u=e.style.projection,h=e.context,d=e.transform,p=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,f),g=!e.options.moving;for(const y of i){const i=t.getTile(y),f=i.fbo;if(!f)continue;const _=u.getMeshFromTileID(h,y.canonical,s,!0,"raster"),v=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(y);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,f.colorAttachment.get());const b=d.getProjectionData({overscaledTileID:y,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,p.TRIANGLES,o,n[y.overscaledZ],a,er.backCCW,ei(e,i,r),v,b,r.id,_.vertexBuffer,_.indexBuffer,_.segments)}}function Mn(e,r,i,n,o,a,s,l,c){var u;const h=e.style.projection,d=e.context,p=e.transform,f=d.gl,m=e.useProgram("colorRelief"),g=!e.options.moving;let y=!0,_=0;for(const v of n){const n=r.getTile(v),b=n.dem;if(y){const e=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:t,colorTexture:r}=i.getColorRampTextures(d,e,b.getUnpackVector());d.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),y=!1,_=t.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||e.getTileTexture(x),n.demTexture){const e=n.demTexture;e.update(w,{premultiply:!1}),e.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else n.demTexture=new t.T(d,w,f.RGBA,{premultiply:!1}),n.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const T=h.getMeshFromTileID(d,v.canonical,l,!0,"raster"),S=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(v),E=p.getProjectionData({overscaledTileID:v,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,a,o[v.overscaledZ],s,er.backCCW,ii(i,n.dem,_),S,E,i.id,T.vertexBuffer,T.indexBuffer,T.segments)}}const Dn=[new t.P(0,0),new t.P(t.a5,0),new t.P(t.a5,t.a5),new t.P(0,t.a5)];function Rn(e,t,r,i,n,o,a,s,l=!1,c=!1){const u=i[i.length-1].overscaledZ,h=e.context,d=h.gl,p=e.useProgram("raster"),f=e.transform,m=e.style.projection,g=e.colorModeForRenderPass(),y=!e.options.moving,_=r.paint.get("raster-opacity"),v=r.paint.get("raster-resampling"),b=r.paint.get("raster-fade-duration"),x=!!e.style.map.terrain;for(const w of i){const i=e.getDepthModeForSublayer(w.overscaledZ-u,1===_?tr.ReadWrite:tr.ReadOnly,d.LESS),T=t.getTile(w),S="nearest"===v?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),T.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1);const{parentTile:E,parentScaleBy:I,parentTopLeft:P,fadeValues:k}=On(T,t,b,x);T.fadeOpacity=k.tileOpacity,E?(E.fadeOpacity=k.parentTileOpacity,E.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST)):T.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&h.extTextureFilterAnisotropic&&e.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(w),C=f.getProjectionData({overscaledTileID:w,aligned:y,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),M=hi(P,I,k.fadeMix,r,s),D=m.getMeshFromTileID(h,w.canonical,o,a,"raster");p.draw(h,d.TRIANGLES,i,n?n[w.overscaledZ]:ir.disabled,g,l?er.frontCCW:er.backCCW,M,A,C,r.id,D.vertexBuffer,D.indexBuffer,D.segments)}}function On(e,r,i,n){const o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||n)return o;if(e.fadingParentID){const n=r.getLoadedTile(e.fadingParentID);if(!n)return o;const a=Math.pow(2,n.tileID.overscaledZ-e.tileID.overscaledZ),s=[e.tileID.canonical.x*a%1,e.tileID.canonical.y*a%1],l=function(e,r,i){const n=c(),o=(n-r.timeAdded)/i,a=e.fadingDirection===he.Incoming,s=t.an((n-e.timeAdded)/i,0,1),l=t.an(1-o,0,1),u=a?s:l;return{tileOpacity:u,parentTileOpacity:a?l:s,fadeMix:{opacity:1,mix:1-u}}}(e,n,i);return{parentTile:n,parentScaleBy:a,parentTopLeft:s,fadeValues:l}}if(e.selfFading){const r=function(e,r){const i=(c()-e.timeAdded)/r,n=t.an(i,0,1);return{tileOpacity:n,fadeMix:{opacity:n,mix:0}}}(e,i);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:r}}return o}const Ln=new t.bp(1,0,0,1),Fn=new t.bp(0,1,0,1),zn=new t.bp(0,0,1,1),Bn=new t.bp(1,0,1,1),Nn=new t.bp(0,1,1,1);function jn(e,t,r,i){Un(e,0,t+r/2,e.transform.width,r,i)}function Vn(e,t,r,i){Un(e,t-r/2,0,r,e.transform.height,i)}function Un(e,t,r,i,n,o){const a=e.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,n*e.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Gn(e,r,i){const n=e.context,o=n.gl,a=e.useProgram("debug"),s=tr.disabled,l=ir.disabled,c=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.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/e.transform.zoom)*.5;let g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const r=e.debugOverlayCanvas,i=e.context.gl,n=e.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(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(e,`${g} ${p}kB`);const y=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,Jt.alphaBlended,er.disabled,Yr(t.bp.transparent,m),null,y,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,er.disabled,Yr(t.bp.red),h,y,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function qn(e,t,r,i){const{isRenderingGlobe:n}=i,o=e.context,a=o.gl,s=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(const h of r){const r=t.getTerrainMesh(h.tileID),i=e.renderToTexture.getTexture(h),d=t.getTerrainData(h.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i.texture);const p=t.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(h.tileID.toUnwrapped()),m=Br(p,f,e.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,a.TRIANGLES,c,ir.disabled,l,er.backCCW,m,d,g,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function $n(e,r){if(!r.mesh){const i=new t.aW;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const n=new t.aY;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new Lt(e.createVertexBuffer(i,Ft.members),e.createIndexBuffer(n),t.aX.simpleSegment(0,0,i.length,n.length))}return r.mesh}class Wn{constructor(e,r){this.context=new ln(e),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Le.maxOverzooming+Le.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Mt}resize(e,t,r){if(this.width=Math.floor(e*r),this.height=Math.floor(t*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 e=this.context,r=new t.aW;r.emplaceBack(0,0),r.emplaceBack(t.a5,0),r.emplaceBack(0,t.a5),r.emplaceBack(t.a5,t.a5),this.tileExtentBuffer=e.createVertexBuffer(r,Ft.members),this.tileExtentSegments=t.aX.simpleSegment(0,0,4,2);const i=new t.aW;i.emplaceBack(0,0),i.emplaceBack(t.a5,0),i.emplaceBack(0,t.a5),i.emplaceBack(t.a5,t.a5),this.debugBuffer=e.createVertexBuffer(i,Ft.members),this.debugSegments=t.aX.simpleSegment(0,0,4,5);const n=new t.ch;n.emplaceBack(0,0,0,0),n.emplaceBack(t.a5,0,t.a5,0),n.emplaceBack(0,t.a5,0,t.a5),n.emplaceBack(t.a5,t.a5,t.a5,t.a5),this.rasterBoundsBuffer=e.createVertexBuffer(n,Fr.members),this.rasterBoundsSegments=t.aX.simpleSegment(0,0,4,2);const o=new t.aW;o.emplaceBack(0,0),o.emplaceBack(t.a5,0),o.emplaceBack(0,t.a5),o.emplaceBack(t.a5,t.a5),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,Ft.members),this.rasterBoundsSegmentsPosOnly=t.aX.simpleSegment(0,0,4,5);const a=new t.aW;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Ft.members),this.viewportSegments=t.aX.simpleSegment(0,0,4,2);const s=new t.ci;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const l=new t.aY;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new ir({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new Lt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const i=t.N();t.c7(i,0,this.width,this.height,0,0,1),t.Q(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(e,r.TRIANGLES,tr.disabled,this.stencilClearMode,Jt.disabled,er.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,r){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const i=this.context;i.setColorMode(Jt.disabled),i.setDepthMode(tr.disabled);const n={};for(const o of t)n[o.key]=this.nextStencilID++;this._renderTileMasks(n,t,r,!0),this._renderTileMasks(n,t,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,r,i){const n=this.context,o=n.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of t){const t=e[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,tr.disabled,new ir({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),Jt.disabled,r?er.disabled:er.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const e=this.context,t=e.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=Ie(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(e,t.TRIANGLES,o,ir.disabled,Jt.disabled,er.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new ir({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new ir({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,r=e.sort((e,t)=>t.overscaledZ-e.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 e={};for(let r=0;r<n;r++)e[r+i]=new ir({func:t.GEQUAL,mask:255},r+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[i]:ir.disabled},r]}stencilConfigForOverlapTwoPass(e){const t=this.context.gl,r=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){const e={},o={};for(let r=0;r<n;r++)e[r+i]=new ir({func:t.GREATER,mask:255},n+1+r,255,t.KEEP,t.KEEP,t.REPLACE),o[r+i]=new ir({func:t.GREATER,mask:255},1+r,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*n+1,[e,o,r]}return this.nextStencilID=3,[{[i]:new ir({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[i]:new ir({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},r]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const r=1/8;return new Jt([e.CONSTANT_COLOR,e.ONE],new t.bp(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Jt.unblended:Jt.alphaBlended}getDepthModeForSublayer(e,t,r){if(!this.opaquePassEnabledForLayer())return tr.disabled;const i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new tr(r||this.context.gl.LEQUAL,t,[i,i])}getDepthModeFor3D(){return new tr(this.context.gl.LEQUAL,tr.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,r){var i,n;this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(c()),this.imageManager.beginFrame();const o=this.style._order,a=this.style.tileManagers,s={},l={},u={},h={isRenderingToTexture:!1,isRenderingGlobe:(null===(i=e.projection)||void 0===i?void 0:i.transitionState)>0};for(const t in a){const e=a[t];e.used&&e.prepare(this.context),s[t]=e.getVisibleCoordinates(!1),l[t]=s[t].slice().reverse(),u[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of o){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=l[e.source];("custom"===e.type||r.length)&&this.renderLayer(this,a[e.source],e,r,h)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?t.bp.black:t.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,t){const r=e.context,i=r.gl,n=((e,t,r)=>{const i=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),o=ye(t),a=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-o*n)*r,(t.height/2+o*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*r,u_sky_blend:a}})(t,e.style.map.transform,e.pixelRatio),o=new tr(i.LEQUAL,tr.ReadWrite,[0,1]),a=ir.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=$n(r,t);l.draw(r,i.TRIANGLES,o,a,s,er.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[o[this.currentLayer]],t=a[e.source],r=s[e.source];this._renderTileClippingMasks(e,r,!1),this.renderLayer(this,t,e,r,h)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const e=this.style._layers[o[this.currentLayer]],t=a[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e,h))continue;this.opaquePassEnabledForLayer()||d||(d=!0,h.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const r=("symbol"===e.type?u:l)[e.source];this._renderTileClippingMasks(e,s[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,r,h)}if(h.isRenderingGlobe&&function(e,r,i){const n=e.context,o=n.gl,a=e.useProgram("atmosphere"),s=new tr(o.LEQUAL,tr.ReadOnly,[0,1]),l=e.transform,c=function(e,r){const i=e.properties.get("position"),n=[-i.x,-i.y,-i.z],o=t.ar(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.bg(o,o,r.rollInRadians),t.bh(o,o,-r.pitchInRadians),t.bg(o,o,r.bearingInRadians),t.bh(o,o,r.center.lat*Math.PI/180),t.bJ(o,o,-r.center.lng*Math.PI/180)),t.cg(n,n,o),n}(i,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=r.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const d=gr(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,t.aH(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,t.aH(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((e,t,r,i,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],d,p),g=$n(n,r);a.draw(n,o.TRIANGLES,s,ir.disabled,Jt.alphaBlended,er.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,t){let r=null;const i=Object.values(e._layers).flatMap(r=>r.source&&!r.isHidden(t)?[e.tileManagers[r.source]]:[]),n=i.filter(e=>"vector"===e.getSource().type),o=i.filter(e=>"vector"!==e.getSource().type),a=e=>{(!r||r.getSource().maxzoom<e.getSource().maxzoom)&&(r=e)};return n.forEach(e=>a(e)),r||o.forEach(e=>a(e)),r}(this.style,this.transform.zoom);e&&function(e,t,r){for(let i=0;i<r.length;i++)Gn(e,t,r[i])}(this,e,e.getVisibleCoordinates())}this.options.showPadding&&function(e){const t=e.transform.padding;jn(e,e.transform.height-(t.top||0),3,Ln),jn(e,t.bottom||0,3,Fn),Vn(e,t.left||0,3,zn),Vn(e,e.transform.width-(t.right||0),3,Bn);const r=e.transform.centerPoint;!function(e,t,r,i){Un(e,t-1,r-10,2,20,i),Un(e,t-10,r-1,20,2,i)}(e,r.x,e.transform.height-r.y,Nn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){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=e?!t.cj(r,i):!t.ck(r,i)),n||(n=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(t.cl(r,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,r){const i=e.context,n=i.gl,o=e.transform,a=Jt.unblended,s=new tr(n.LEQUAL,tr.ReadWrite,[0,1]),l=r.tileManager.getRenderableTiles(),c=e.useProgram("terrainDepth");i.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:t.bp.transparent,depth:1});for(const t of l){const e=r.getTerrainMesh(t.tileID),l=r.getTerrainData(t.tileID),u=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:r.getMeshFrameDelta(o.zoom)};c.draw(i,n.TRIANGLES,s,ir.disabled,a,er.backCCW,h,l,u,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,r){const i=e.context,n=i.gl,o=e.transform,a=Jt.unblended,s=new tr(n.LEQUAL,tr.ReadWrite,[0,1]),l=r.getCoordsTexture(),c=r.tileManager.getRenderableTiles(),u=e.useProgram("terrainCoords");i.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:t.bp.transparent,depth:1}),r.coordsIndex=[];for(const t of c){const e=r.getTerrainMesh(t.tileID),c=r.getTerrainData(t.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:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,n.TRIANGLES,s,ir.disabled,a,er.backCCW,h,c,d,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),r.coordsIndex.push(t.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}renderLayer(e,r,i,n,o){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(n||[]).length)&&(this.id=i.id,t.cm(i)?function(e,r,i,n,o,a){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=a,l=ir.disabled,c=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,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 e){const e=n.getTile(f),o=e.getBucket(i);if(!o||!o.text||!o.text.segments.get().length)continue;const a=t.ay(o.textSizeData,u.zoom),m=t.aN(e,1,r.transform.zoom),g=Ne(d,r.transform,m),y="none"!==i.layout.get("icon-text-fit")&&o.hasIconData();if(a){const r=Math.pow(2,u.zoom-e.tileID.overscaledZ),i=h?(e,t)=>h.getElevation(f,e,t):null;fn(o,d,p,c,u,g,r,a,y,t.aO(u,e,s,l),f.toUnwrapped(),i)}}}(n,e,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)&&gn(e,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)&&gn(e,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&&(un(e,r,i,n,!0),un(e,r,i,n,!1))}(e,r,i,n,this.style.placement.variableOffsets,o):t.cn(i)?function(e,r,i,n,o){if("translucent"!==e.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=e.context,d=h.gl,p=e.transform,f=e.getDepthModeForSublayer(0,tr.ReadOnly),m=ir.disabled,g=e.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=t.aO(p,s,c,h),f=l.programConfigurations.get(i.id),m=e.useProgram("circle",f),g=l.layoutVertexBuffer,b=l.indexBuffer,x=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),w={programConfiguration:f,program:m,layoutVertexBuffer:g,indexBuffer:b,uniformValues:Hr(e,s,i,d,_),terrainData:x,projectionData:p.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){const e=l.segments.get();for(const r of e)y.push({segments:new t.aX([r]),sortKey:r.sortKey,state:w})}else y.push({segments:l.segments,sortKey:0,state:w})}u&&y.sort((e,t)=>e.sortKey-t.sortKey);for(const t of y){const{programConfiguration:r,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=t.state;n.draw(h,d.TRIANGLES,f,m,g,er.backCCW,s,l,c,i.id,o,a,t.segments,i.paint,e.transform.zoom,r)}}(e,r,i,n,o):t.co(i)?function(e,r,i,n,o){if(0===i.paint.get("heatmap-opacity"))return;const a=e.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(e.style.map.terrain){for(const t of n){const n=r.getTile(t);r.hasRenderableParent(t)||("offscreen"===e.renderPass?_n(e,n,i,t,l):"translucent"===e.renderPass&&vn(e,i,t,s,l))}a.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,r,i,n){const o=e.context,a=o.gl,s=e.transform,l=ir.disabled,c=new Jt([a.ONE,a.ONE],t.bp.transparent,[!0,!0,!0,!0]);(function(e,r,i){const n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,r.width/4,r.height/4]);let o=i.heatmapFbos.get(t.cd);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=bn(e,r.width/4,r.height/4),i.heatmapFbos.set(t.cd,o))})(o,e,i),o.clear({color:t.bp.transparent});for(let t=0;t<n.length;t++){const u=n[t];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=e.useProgram("heatmap",p),m=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,tr.disabled,l,c,er.backCCW,Jr(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,e.width,e.height])}(e,r,i,n):"translucent"===e.renderPass&&function(e,r){const i=e.context,n=i.gl;i.setColorMode(e.colorModeForRenderPass());const o=r.heatmapFbos.get(t.cd);o&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),xn(i,r).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,n.TRIANGLES,tr.disabled,ir.disabled,e.colorModeForRenderPass(),er.disabled,Qr(e,r,0,1),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom))}(e,i)}(e,r,i,n,o):t.cp(i)?function(e,t,r,i,n){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:o}=n,a=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===a.constantOr(1)||0===s.constantOr(1))return;const l=e.getDepthModeForSublayer(0,tr.ReadOnly),c=e.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),h=u.constantOr(1),d=r.paint.get("line-pattern"),p=d.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters();let g;g=p?"linePattern":h&&f?"lineGradientSDF":h?"lineSDF":f?"lineGradient":"line";const y=e.context,_=y.gl,v=e.transform;let b=!0;for(const x of i){const i=t.getTile(x);if(p&&!i.patternsLoaded())continue;const n=i.getBucket(r);if(!n)continue;const a=n.programConfigurations.get(r.id),s=e.context.program.get(),w=e.useProgram(g,a),T=b||w.program!==s,S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(x),E=d.constantOr(null),I=u&&u.constantOr(null);if(E&&i.imageAtlas){const e=i.imageAtlas,t=e.patternPositions[E.to.toString()],r=e.patternPositions[E.from.toString()];t&&r&&a.setConstantPatternPositions(t,r)}else if(I){const t="round"===r.layout.get("line-cap"),i=e.lineAtlas.getDash(I.to,t),n=e.lineAtlas.getDash(I.from,t);a.setConstantDashPositions(i,n)}const P=v.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),k=v.getPixelScale();let A;p?(A=ai(e,i,r,k,m),Tn(y,_,i,a,m)):h&&f?(A=li(e,i,r,k,m,n.lineClipsArray.length),In(e,t,y,_,r,n,x,a,m)):h?(A=si(e,i,r,k,m),Sn(e,y,_,a,T,m)):f?(A=oi(e,i,r,k,n.lineClipsArray.length),En(e,t,y,_,r,n,x)):A=ni(e,i,r,k);const C=e.stencilModeForClipping(x);w.draw(y,_.TRIANGLES,l,C,c,er.disabled,A,S,P,r.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,r.paint,e.transform.zoom,a,n.layoutVertexBuffer2),b=!1}}(e,r,i,n,o):t.cq(i)?function(e,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=e.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===a.constantOr(t.bp.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===h){const t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?tr.ReadWrite:tr.ReadOnly);kn(e,r,i,n,t,c,!1,l)}if("translucent"===e.renderPass&&i.paint.get("fill-antialias")){const t=e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,tr.ReadOnly);kn(e,r,i,n,t,c,!0,l)}}(e,r,i,n,o):t.cr(i)?function(e,t,r,i,n){const o=r.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===e.renderPass){const n=new tr(e.context.gl.LEQUAL,tr.ReadWrite,e.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))An(e,t,r,i,n,ir.disabled,Jt.disabled,a),An(e,t,r,i,n,e.stencilModeFor3D(),e.colorModeForRenderPass(),a);else{const o=e.colorModeForRenderPass();An(e,t,r,i,n,ir.disabled,o,a)}}}(e,r,i,n,o):t.cs(i)?function(e,r,i,n,o){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=e.context,l=e.style.projection.useSubdivision,c=e.getDepthModeForSublayer(0,tr.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)!function(e,r,i,n,o,a,s){const l=e.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||e.getTileTexture(p),i.demTexture){const e=i.demTexture;e.update(f,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else i.demTexture=new t.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 e=new t.T(l,{width:d,height:d,data:null},c.RGBA);e.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=i.fbo=l.createFramebuffer(d,d,!0,!1),m.colorAttachment.set(e.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,a,s,er.disabled,ti(i.tileID,h),null,null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(e,r,n,i,c,ir.disabled,u),s.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(l){const[t,o,s]=e.stencilConfigForOverlapTwoPass(n);Cn(e,r,i,s,t,c,u,!1,a),Cn(e,r,i,s,o,c,u,!0,a)}else{const[t,o]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Cn(e,r,i,o,t,c,u,!1,a)}}(e,r,i,n,o):t.ct(i)?function(e,t,r,i,n){if("translucent"!==e.renderPass)return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,tr.ReadOnly),l=e.colorModeForRenderPass();if(a){const[n,a,c]=e.stencilConfigForOverlapTwoPass(i);Mn(e,t,r,c,n,s,l,!1,o),Mn(e,t,r,c,a,s,l,!0,o)}else{const[n,a]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Mn(e,t,r,a,n,s,l,!1,o)}}(e,r,i,n,o):t.bU(i)?function(e,t,r,i,n){if("translucent"!==e.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=t.getSource(),s=e.style.projection.useSubdivision;if(a instanceof te)Rn(e,t,r,i,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=e.stencilConfigForOverlapTwoPass(i);Rn(e,t,r,s,n,!1,!0,Dn,!1,o),Rn(e,t,r,s,a,!0,!0,Dn,!1,o)}else{const[n,a]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Rn(e,t,r,a,n,!1,!0,Dn,!1,o)}}(e,r,i,n,o):t.cu(i)?function(e,t,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=e.context,c=l.gl,u=e.style.projection,h=e.transform,d=h.tileSize,p=r.paint.get("background-pattern");if(e.isPatternMissing(p))return;const f=!p&&1===o.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;const m=ir.disabled,g=e.getDepthModeForSublayer(0,"opaque"===f?tr.ReadWrite:tr.ReadOnly),y=e.colorModeForRenderPass(),_=e.useProgram(p?"backgroundPattern":"background"),v=i||Ie(h,{tileSize:d,terrain:e.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),e.imageManager.bind(e.context));const b=r.getCrossfadeParameters();for(const x of v){const t=h.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),i=p?yi(a,e,p,{tileID:x,tileSize:d},b):gi(a,o),n=e.style.map.terrain&&e.style.map.terrain.getTerrainData(x),f=u.getMeshFromTileID(l,x.canonical,!1,!0,"raster");_.draw(l,c.TRIANGLES,g,m,y,er.backCCW,i,n,t,r.id,f.vertexBuffer,f.indexBuffer,f.segments)}}(e,0,i,n,o):t.cv(i)&&function(e,t,r,i){const{isRenderingGlobe:n}=i,o=e.context,a=r.implementation,s=e.style.projection,l=e.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"===e.renderPass){const t=a.prerender;t&&(e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),t.call(a,o.gl,u),o.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),o.setStencilMode(ir.disabled);const t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,tr.ReadOnly);o.setDepthMode(t),a.render(o.gl,u),o.setDirty(),e.setBaseState(),o.bindFramebuffer.set(null)}}(e,0,i,o))}saveTileTexture(e){const t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),r=this.imageManager.getPattern(e.to.toString());return!t||!r}useProgram(e,t,r=!1,i=[]){this.cache=this.cache||{};const n=!!this.style.map.terrain,o=this.style.projection,a=r?Rt.projectionMercator:o.shaderPreludeCode,s=r?zt:o.shaderDefine,l=e+(t?t.cacheKey:"")+`/${r?Bt:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(i?`/${i.join("/")}`:"");return this.cache[l]||(this.cache[l]=new Vr(this.context,Rt[e],t,vi[e],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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,t;if(this._tileTextures){for(const e in this._tileTextures){const t=this._tileTextures[e];if(t)for(const e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.vertexBuffer)||void 0===e||e.destroy()),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.indexBuffer)||void 0===t||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const e in this.cache){const t=this.cache[e];t&&t.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Zn(e,t){let r,i=!1,n=null,o=null;const a=()=>{n=null,i&&(e.apply(o,r),n=setTimeout(a,t),i=!1)};return(...e)=>(i=!0,o=this,r=e,n||a(),n)}class Hn{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const t=e.join("/");let r=t;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${t}`);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=Zn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){const t=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(t.lng*n)/n,a=Math.round(t.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${o}/${a}/${r}`:`${r}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const e=this._hashName;let t=!1;const r=window.location.hash.slice(1).split("&").map(r=>{const i=r.split("=")[0];return i===e?(t=!0,`${i}=${c}`):r}).filter(e=>e);return t||r.push(`${e}=${c}`),`#${r.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.V(+e[2],+e[1])}catch(e){return!1}const r=+e[0],i=+(e[3]||0),n=+(e[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Xn={linearity:.3,easing:t.cw(0,0,.3,1)},Kn=t.e({deceleration:2500,maxSpeed:1400},Xn),Yn=t.e({deceleration:20,maxSpeed:1400},Xn),Jn=t.e({deceleration:1e3,maxSpeed:360},Xn),Qn=t.e({deceleration:1e3,maxSpeed:90},Xn),eo=t.e({deceleration:1e3,maxSpeed:360},Xn);class to{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=c();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const r={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta),t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){const o=io(r.pan.mag(),i,t.e({},Kn,e||{})),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,ro(n,o)}if(r.zoom){const e=io(r.zoom,i,Yn);n.zoom=this._map.transform.zoom+e.amount,ro(n,e)}if(r.bearing){const e=io(r.bearing,i,Jn);n.bearing=this._map.transform.bearing+t.an(e.amount,-179,179),ro(n,e)}if(r.pitch){const e=io(r.pitch,i,Qn);n.pitch=this._map.transform.pitch+e.amount,ro(n,e)}if(r.roll){const e=io(r.roll,i,eo);n.roll=this._map.transform.roll+t.an(e.amount,-179,179),ro(n,e)}if(n.zoom||n.bearing){const e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function ro(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function io(e,r,i){const{maxSpeed:n,linearity:o,deceleration:a}=i,s=t.an(e*o/(r/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:i.easing,duration:1e3*l,amount:s*(l/2)}}class no extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);const o=u.mousePos(r.getCanvas(),i),a=r.unproject(o);super(e,t.e({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}}class oo extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,i){const n="touchend"===e?i.changedTouches:i.touches,o=u.touchPos(r.getCanvasContainer(),n),a=o.map(e=>r.unproject(e)),s=o.reduce((e,t,r,i)=>e.add(t.div(i.length)),new t.P(0,0));super(e,{points:o,point:s,lngLats:a,lngLat:r.unproject(s),originalEvent:i}),this._defaultPrevented=!1}}class ao extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){super(e,{originalEvent:r}),this._defaultPrevented=!1}}class so{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ao(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new no(e.type,this._map,e))}mouseup(e){this._map.fire(new no(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new no(e.type,this._map,e))}dblclick(e){return this._firePreventable(new no(e.type,this._map,e))}mouseover(e){this._map.fire(new no(e.type,this._map,e))}mouseout(e){this._map.fire(new no(e.type,this._map,e))}touchstart(e){return this._firePreventable(new oo(e.type,this._map,e))}touchmove(e){this._map.fire(new oo(e.type,this._map,e))}touchend(e){this._map.fire(new oo(e.type,this._map,e))}touchcancel(e){this._map.fire(new oo(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class lo{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new no(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new no("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new no(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class co{constructor(e){this._map=e}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(e){return this.transform.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class uo{constructor(e,t){this._map=e,this._tr=new co(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const r=t;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=u.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const n=Math.min(i.x,r.x),o=Math.max(i.x,r.x),a=Math.min(i.y,r.y),s=Math.max(i.y,r.y);u.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"}mouseupWindow(e,r){if(!this._active)return;if(0!==e.button)return;const i=this._startPos,n=r;if(this.reset(),u.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new t.l("boxzoomend",{originalEvent:e})),{cameraAnimation:e=>e.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(u.remove(this._box),this._box=null),u.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,r){return this._map.fire(new t.l(e,{originalEvent:r}))}}function ho(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}class po{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){const r=new t.P(0,0);for(const t of e)r._add(t);return r.div(e.length)}(r),this.touches=ho(i,r)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;const i=ho(r,t);for(const n in this.touches){const e=i[n];(!e||e.dist(this.touches[n])>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class fo{constructor(e){this.singleTap=new po(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){const i=this.singleTap.touchend(e,t,r);if(i){const t=e.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if(t&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class mo{constructor(e){this._tr=new co(e),this._zoomIn=new fo({numTouches:1,numTaps:2}),this._zoomOut=new fo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){const i=this._zoomIn.touchend(e,t,r),n=this._zoomOut.touchend(e,t,r),o=this._tr;return i?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(i)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class go{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;const r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const i=Array.isArray(t)?t[0]:t;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&u.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const yo=0,_o=2,vo={[yo]:1,[_o]:2};class bo{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const t=u.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){const r=vo[t];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton)}isValidEndEvent(e){return u.mouseButton(e)===this._eventButton}}class xo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class wo{constructor(e=new bo({checkCorrectEvent:()=>!0}),t=new xo){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,r){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?r(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.startMove(e),e=>this.oneFingerTouchMoveStateManager.startMove(e))}endMove(e){this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.endMove(e),e=>this.oneFingerTouchMoveStateManager.endMove(e))}isValidStartEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}}const To=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class So{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active){if(!this._shouldBePrevented(r.length))return e.preventDefault(),this._calculateTransform(e,t,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,r,i){i.length>0&&(this._active=!0);const n=ho(i,r),o=new t.P(0,0),a=new t.P(0,0);let s=0;for(const t in n){const e=n[t],r=this._touches[t];r&&(o._add(e),a._add(e.sub(r)),s++,n[t]=e)}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 Eo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();const[i,n]=this._firstTwoTouches,o=Io(r,t,i),a=Io(r,t,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;const[i,n]=this._firstTwoTouches,o=Io(r,t,i),a=Io(r,t,n);o&&a||(this._active&&u.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Io(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}function Po(e,t){return Math.log(e/t)/Math.LN2}class ko extends Eo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Po(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Po(this._distance,r),pinchAround:t}}}function Ao(e,t){return 180*e.angleWith(t)/Math.PI}class Co extends Eo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,r){const i=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Ao(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,r=Ao(e,this._startVector);return Math.abs(r)<t}}function Mo(e){return Math.abs(e.y)>Math.abs(e.x)}class Do extends Eo{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,Mo(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const i=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,r){if(void 0!==this._valid)return this._valid;const i=e.mag()>=2,n=t.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=e.y>0==t.y>0;return Mo(e)&&Mo(t)&&o}}const Ro={panStep:100,bearingStep:15,pitchStep:10};class Oo{constructor(e){this._tr=new co(e);const t=Ro;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?i=-1:(e.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:Lo,zoom:t?Math.round(s.zoom)+t*(e.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:e})}}}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 Lo(e){return e*(2-e)}const Fo=4.000244140625,zo=1/450;class Bo{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new co(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=zo}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const r=c(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==t&&t%Fo==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){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=u.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(t.V.convert(i.center)):r,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){const r="wheel"===this._type&&Math.abs(this._delta)>Fo?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?e.scale:t.aq(this._targetZoom);this._targetZoom=e.applyConstrain(e.getCameraLngLat(),t.at(n*i)).zoom,"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,i=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&i&&n){const e=c()-this._lastWheelEventTime,s=Math.min((e+5)/200,1),l=n(s);o=t.G.number(i,r,l),s<1?this._frameId||(this._frameId=!0):a=!0}else o=r,a=!0;return this._active=!0,a&&(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:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let r=t.cy;if(this._prevEase){const e=this._prevEase,i=(c()-e.start)/e.duration,n=e.easing(i+.01)-e.easing(i),o=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-o*o);r=t.cw(o,a,.25,1)}return this._prevEase={start:c(),duration:e,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 No{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 jo{constructor(e){this._tr=new co(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vo{constructor(){this._tap=new fo({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(e,t,r){if(!this._swipePoint)if(this._tapTime){const i=t[0],n=e.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(e,t,r)}touchmove(e,t,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const i=t[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,r)}touchend(e,t,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{const i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.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 Uo{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},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 Go{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,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 qo{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 $o{constructor(e,t){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=u.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,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&&(u.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,r){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Wo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Zo extends t.l{}function Ho(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class Xo{constructor(e,r){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,r)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},o={},a={};for(const{handlerName:c,handler:h,allowed:d}of this._handlers){if(!h.isEnabled())continue;let s;if(this._blockedByActive(a,d,c))h.reset();else if(h[r||e.type]){if(t.cz(e,r||e.type)){const t=u.mousePos(this._map.getCanvas(),e);s=h[r||e.type](e,t)}else if(t.cA(e,r||e.type)){const t=this._getMapTouches(e.touches),i=u.touchPos(this._map.getCanvas(),t);s=h[r||e.type](e,i,t)}else t.cB(r||e.type)||(s=h[r||e.type](e));this.mergeHandlerResult(n,o,s,c,i),s&&s.needsRenderFrame&&this._triggerRenderFrame()}(s||h.isActive())&&(a[c]=h)}const s={};for(const t in this._previousActiveHandlers)a[t]||(s[t]=i);this._previousActiveHandlers=a,(Object.keys(s).length||Ho(n))&&(this._changes.push([n,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||Ho(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:l}=n;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new to(e),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[t,n,o]of this._listeners)u.addEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(const[e,t,r]of this._listeners)u.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){const r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new so(r,e));const n=r.boxZoom=new uo(r,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();const o=r.cooperativeGestures=new $o(r,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const a=new mo(r),s=new jo(r);r.doubleClickZoom=new No(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&r.doubleClickZoom.enable();const l=new Vo;this._add("tapDragZoom",l);const c=r.touchPitch=new Do(r);this._add("touchPitch",c),e.interactive&&e.touchPitch&&r.touchPitch.enable(e.touchPitch);const h=()=>r.project(r.getCenter()),d=function({enable:e,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const s=new bo({checkCorrectEvent:e=>0===u.mouseButton(e)&&e.ctrlKey||2===u.mouseButton(e)&&!e.ctrlKey});return new go({clickTolerance:r,move:(e,r)=>{const s=a();if(i&&Math.abs(s.y-e.y)>n)return{bearingDelta:t.cx(new t.P(e.x,r.y),r,s)};let l=(r.x-e.x)*o;return i&&r.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:s,enable:e,assignEvents:To})}(e,h),p=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:r=-.5}){const i=new bo({checkCorrectEvent:e=>0===u.mouseButton(e)&&e.ctrlKey||2===u.mouseButton(e)});return new go({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*r}),moveStateManager:i,enable:e,assignEvents:To})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){const n=new bo({checkCorrectEvent:e=>2===u.mouseButton(e)&&e.ctrlKey});return new go({clickTolerance:t,move:(e,t)=>{const n=i();let o=(t.x-e.x)*r;return t.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:e,assignEvents:To})}(e,h);r.dragRotate=new Go(e,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&r.dragRotate.enable();const m=function({enable:e,clickTolerance:t}){const r=new bo({checkCorrectEvent:e=>0===u.mouseButton(e)&&!e.ctrlKey});return new go({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:r,enable:e,assignEvents:To})}(e),g=new So(e,r);r.dragPan=new Uo(i,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&r.dragPan.enable(e.dragPan);const y=new Co,_=new ko;r.touchZoomRotate=new qo(i,_,y,l),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&r.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new lo(r));const v=r.scrollZoom=new Bo(r,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&r.scrollZoom.enable(e.scrollZoom);const b=r.keyboard=new Oo(r);this._add("keyboard",b),e.interactive&&e.keyboard&&r.keyboard.enable()}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Wo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,r){for(const i in e)if(i!==r&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){const t=[];for(const r of e)this._el.contains(r.target)&&t.push(r);return t}mergeHandlerResult(e,r,i,n,o){if(!i)return;t.e(e,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 e={},r={},i={};for(const[n,o,a]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(r,o),t.e(i,a);this._updateMapTransform(e,r,i),this._changes=[]}_updateMapTransform(e,t,r){const i=this._map,n=i._getTransformForUpdate(),o=i.terrain;if(!(Ho(e)||o&&this._terrainMovement))return this._fireEvents(t,r,!0);i._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=e;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);this._handleMapControls({terrain:o,tr:n,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:a}),i._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:n,panDelta:o}){const a=this._map.cameraHelper;if(a.handleMapControlsRollPitchBearingZoom(r,t),e)return a.useGlobeControls?(this._terrainMovement||!n.drag&&!n.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void a.handleMapControlsPan(r,t,i)):this._terrainMovement||!n.drag&&!n.zoom?void(n.drag&&this._terrainMovement&&o?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(o))):a.handleMapControlsPan(r,t,i)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void a.handleMapControlsPan(r,t,i));a.handleMapControlsPan(r,t,i)}_fireEvents(e,r,i){const n=Wo(this._eventsInProgress),o=Wo(e),a={};for(const t in e){const{originalEvent:r}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=r),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:r}=e[t];this._fireEvent(t,r)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=r[e]||i,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const u=Wo(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(i&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&s.prefersReducedMotion?(this._map.fire(new t.l("moveend",{originalEvent:c})),r(this._map.getBearing())&&this._map.resetNorth()):(r(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(e,r){this._map.fire(new t.l(e,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Zo("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Ko extends t.E{constructor(e,t,r){super(),this._renderFrameCallback=()=>{const e=Math.min((c()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=r.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new t.V(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,r,i){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},r),i)}panTo(e,r,i){return this.easeTo(t.e({center:e},r),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,r,i){return this.easeTo(t.e({zoom:e},r),i)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,r){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",r)).fire(new t.l("move",r)).fire(new t.l("moveend",r))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,r,i){return this.easeTo(t.e({bearing:e},r),i)}resetNorth(e,r){return this.rotateTo(0,t.e({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),r),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Z.convert(e).adjustAntiMeridian();const r=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,r,i,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const e=n.padding;n.padding={top:e,bottom:e,right:e,left:e}}const a=t.e(o,n.padding);n.padding=a;const s=this.transform,l=new Z(e,r);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,i,s)}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,r,i,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(r)),i,n),n,o)}_fitInternal(e,r,i){return e?(delete(r=t.e(e,r)).padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(e,r){this.stop();const i=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,e);const l=i.zoom!==s;return"elevation"in e&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),"bearing"in e&&i.bearing!==+e.bearing&&(n=!0,i.setBearing(+e.bearing)),"pitch"in e&&i.pitch!==+e.pitch&&(o=!0,i.setPitch(+e.pitch)),"roll"in e&&i.roll!==+e.roll&&(a=!0,i.setRoll(+e.roll)),null==e.padding||i.isPaddingEqual(e.padding)||i.setPadding(e.padding),this._applyUpdatedTransform(i),this.fire(new t.l("movestart",r)).fire(new t.l("move",r)),l&&this.fire(new t.l("zoomstart",r)).fire(new t.l("zoom",r)).fire(new t.l("zoomend",r)),n&&this.fire(new t.l("rotatestart",r)).fire(new t.l("rotate",r)).fire(new t.l("rotateend",r)),o&&this.fire(new t.l("pitchstart",r)).fire(new t.l("pitch",r)).fire(new t.l("pitchend",r)),a&&this.fire(new t.l("rollstart",r)).fire(new t.l("roll",r)).fire(new t.l("rollend",r)),this.fire(new t.l("moveend",r))}calculateCameraOptionsFromTo(e,r,i,n=0){const o=t.a9.fromLngLat(e,r),a=t.a9.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=t.at(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(e,t,r,i,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:r,pitch:i,roll:n}}easeTo(e,r){this._stop(!1,e.easeId),(!1===(e=t.e({offset:[0,0],duration:500,easing:t.cy},e)).animate||!e.essential&&s.prefersReducedMotion)&&(e.duration=0);const i=this._getTransformForUpdate(),n=this.getBearing(),o=i.pitch,a=i.roll,l="bearing"in e?this._normalizeBearing(e.bearing,n):n,c="pitch"in e?+e.pitch:o,u="roll"in e?this._normalizeBearing(e.roll,a):a,h="padding"in e?e.padding:i.padding,d=t.P.convert(e.offset);let p,f;e.around&&(p=t.V.convert(e.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:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||u!==a,this._padding=!i.isPaddingEqual(h),this._zooming=this._zooming||g.isZooming,this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r,t)},e),this}_prepareEase(e,r,i={}){this._moving=!0,r||i.moving||this.fire(new t.l("movestart",e)),this._zooming&&!i.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new t.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&r!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(r-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=r}this.transform.setElevation(t.G.number(this._elevationStart,this._elevationTarget,e))}_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(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const t=e.getCameraLngLat(),r=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(r<i){const r=this.calculateCameraOptionsFromTo(t,i,e.center,e.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(e){const t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;const r=e.clone();for(const i of t){const e=r.clone(),{center:t,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=i(e);t&&e.setCenter(t),void 0!==l&&e.setElevation(l),void 0!==n&&e.setZoom(n),void 0!==o&&e.setRoll(o),void 0!==a&&e.setPitch(a),void 0!==s&&e.setBearing(s),r.apply(e)}this.transform.apply(r)}_fireMoveEvents(e){this.fire(new t.l("move",e)),this._zooming&&this.fire(new t.l("zoom",e)),this._rotating&&this.fire(new t.l("rotate",e)),this._pitching&&this.fire(new t.l("pitch",e)),this._rolling&&this.fire(new t.l("roll",e))}_afterEase(e,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 t.l("zoomend",e)),n&&this.fire(new t.l("rotateend",e)),o&&this.fire(new t.l("pitchend",e)),a&&this.fire(new t.l("rollend",e)),this.fire(new t.l("moveend",e))}flyTo(e,r){if(!e.essential&&s.prefersReducedMotion){const i=t.U(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,r)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cy},e);const i=this._getTransformForUpdate(),n=i.bearing,o=i.pitch,a=i.roll,l=i.padding,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="roll"in e?this._normalizeBearing(e.roll,a):a,d="padding"in e?e.padding:i.padding,p=t.P.convert(e.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:e.center,minZoom:e.minZoom,zoom:e.zoom});let y=e.curve;const _=Math.max(i.width,i.height),v=_/g.scaleOfZoom,b=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(y=Math.sqrt(_/g.scaleOfMinZoom/b*2));const x=y*y;function w(e){const t=(v*v-_*_+(e?-1:1)*x*x*b*b)/(2*(e?v:_)*x*b);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function S(e){return(Math.exp(e)+Math.exp(-e))/2}const E=w(!1);let I=function(e){return S(E)/S(E+y*e)},P=function(e){return _*((S(E)*(T(t=E+y*e)/S(t))-T(E))/x)/b;var t},k=(w(!0)-E)/y;if(Math.abs(b)<2e-6||!isFinite(k)){if(Math.abs(_-v)<1e-6)return this.easeTo(e,r);const t=v<_?-1:1;k=Math.abs(Math.log(v/_))/y,P=()=>0,I=e=>Math.exp(t*y*e)}return e.duration="duration"in e?+e.duration:1e3*k/("screenSpeed"in e?+e.screenSpeed/y:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==a,this._padding=!i.isPaddingEqual(d),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(s=>{const m=s*k,y=1/I(m),_=P(m);this._rotating&&i.setBearing(t.G.number(n,c,s)),this._pitching&&i.setPitch(t.G.number(o,u,s)),this._rolling&&i.setRoll(t.G.number(a,h,s)),this._padding&&(i.interpolatePadding(l,d,s),f=i.centerPoint.add(p)),g.easeFunc(s,y,_,f),this.terrain&&!e.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(r=this.handlers)||void 0===r||r.stop(!1),this}_ease(e,t,r){!1===r.animate||0===r.duration?(e(1),t()):(this._easeStart=c(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=t.W(e,-180,180);const i=Math.abs(e-r);return Math.abs(e-360-r)<i&&(e-=360),Math.abs(e+360-r)<i&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(t.V.convert(e),this.transform):null}}const Yo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Jo{constructor(e=Yo){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=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=u.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=u.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u.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(){u.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(e,t){const r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"!=typeof e?"":e)):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.tileManagers;for(const i in t){const r=t[i];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,r)=>{for(let i=r+1;i<e.length;i++)if(e[i].indexOf(t)>=0)return!1;return!0});const r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=u.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qo{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=u.create("div","maplibregl-ctrl");const t=u.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){u.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ea{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(const i of r)if(i.id===e)return void(i.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ta=t.aU([{name:"a_pos3d",type:"Int16",components:3}]);class ra extends t.E{constructor(e){super(),this._lastTilesetChange=c(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,r){this.tileManager.update(e,r),this._renderableTilesKeys=[];const i={};for(const n of Ie(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.c7(n.terrainRttPosMatrix32f,0,t.a5,t.a5,0,0,1),this._tiles[n.key]=new de(n,this.tileSize),this._lastTilesetChange=c());for(const t in this._tiles)i[t]||delete this._tiles[t]}freeRtt(e){for(const t in this._tiles){const r=this._tiles[t];(!e||r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const r={};for(const i of this._renderableTilesKeys){const n=this._tiles[i].tileID,o=e.clone(),a=t.bk();if(n.canonical.equals(e.canonical))t.c7(a,0,t.a5,t.a5,0,0,1);else if(n.canonical.isChildOf(e.canonical)){const r=n.canonical.z-e.canonical.z,i=n.canonical.x-(n.canonical.x>>r<<r),o=n.canonical.y-(n.canonical.y>>r<<r),s=t.a5>>r;t.c7(a,0,s,s,0,0,1),t.O(a,a,[-i*s,-o*s,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{const r=e.canonical.z-n.canonical.z,i=e.canonical.x-(e.canonical.x>>r<<r),o=e.canonical.y-(e.canonical.y>>r<<r),s=t.a5>>r;t.c7(a,0,t.a5,t.a5,0,0,1),t.O(a,a,[i*s,o*s,0]),t.Q(a,a,[1/2**r,1/2**r,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),r[i]=o}return r}_getTerrainCoordsForTileRanges(e,r){const i={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,r))continue;const a=e.clone(),s=t.bk();if(o.canonical.z===e.canonical.z){const r=e.canonical.x-o.canonical.x,i=e.canonical.y-o.canonical.y;t.c7(s,0,t.a5,t.a5,0,0,1),t.O(s,s,[r*t.a5,i*t.a5,0])}else if(o.canonical.z>e.canonical.z){const r=o.canonical.z-e.canonical.z,i=o.canonical.x-(o.canonical.x>>r<<r),n=o.canonical.y-(o.canonical.y>>r<<r),a=e.canonical.x-(o.canonical.x>>r),l=e.canonical.y-(o.canonical.y>>r),c=t.a5>>r;t.c7(s,0,c,c,0,0,1),t.O(s,s,[-i*c+a*t.a5,-n*c+l*t.a5,0])}else{const r=e.canonical.z-o.canonical.z,i=e.canonical.x-(e.canonical.x>>r<<r),n=e.canonical.y-(e.canonical.y>>r<<r),a=(e.canonical.x>>r)-o.canonical.x,l=(e.canonical.y>>r)-o.canonical.y,c=t.a5<<r;t.c7(s,0,c,c,0,0,1),t.O(s,s,[i*t.a5+a*c,n*t.a5+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),i[n]=a}return i}getSourceTile(e,t){const r=this.tileManager._source;let i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(i).key);let n=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(null==n?void 0:n.dem)&&t)for(;i>=r.minzoom&&!(null==n?void 0:n.dem);)n=this.findTileInCaches(e.scaledTo(i--).key);return n}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}}class ia{constructor(e,t,r){this._meshCache={},this.painter=e,this.tileManager=new ra(t),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(e,r,i,n=t.a5){var o;if(!(r>=0&&r<n&&i>=0&&i<n))return 0;const a=this.getTerrainData(e),s=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!s)return 0;const l=t.cC([],[r/n*t.a5,i/n*t.a5],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(e,r){if(!t.cD(r,e.wrap()))return 0;const{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,r);return this.getElevation(i,n%t.a5,o%t.a5,t.a5)}getElevationForLngLat(e,t){const r=Ie(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let i=0;for(const n of r)n.canonical.z>i&&(i=Math.min(n.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,i)}getElevation(e,r,i,n=t.a5){return this.getDEMElevation(e,r,i,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,r=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,r,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ar([])}const r=this.tileManager.getSourceTile(e,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){const e=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new t.T(e,r.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),r.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}const i=r&&r.toString()+r.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){const i=this.tileManager.getSource().maxzoom;let n=e.canonical.z-r.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?n=e.canonical.z-i:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>n<<n),a=e.canonical.y-(e.canonical.y>>n<<n),s=t.cE(new Float64Array(16),[1/(t.a5<<n),1/(t.a5<<n),0]);t.O(s,s,[o*t.a5,a*t.a5,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[e.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(e){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 t.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 t.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"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,o=0;t<this._coordsTextureSize;t++)for(let e=0;e<this._coordsTextureSize;e++,o+=4)r[o+0]=255&e,r[o+1]=255&t,r[o+2]=e>>8<<4|t>>8,r[o+3]=0;const i=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new t.T(e,i,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const r=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.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.tileManager.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*d;return new t.a9((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(e){const t=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var r;const i=(null===(r=this.painter.style.projection)||void 0===r?void 0:r.transitionState)>0,n=i&&0===e.canonical.y,o=i&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new t.cF,c=new t.aY,u=this.meshSize,h=t.a5/u,d=u*u;for(let t=0;t<=u;t++)for(let e=0;e<=u;e++)l.emplaceBack(e*h,t*h,0);for(let t=0;t<d;t+=u+1)for(let e=0;e<u;e++)c.emplaceBack(e+t,u+e+t+1,u+e+t+2),c.emplaceBack(e+t,u+e+t+2,e+t+1);const p=l.length,f=p+(u+1),m=(u+1)*u,g=n?t.br:0,y=n?0:1,_=o?t.bs:t.a5,v=o?0:1;for(let t=0;t<=u;t++)l.emplaceBack(t*h,g,y);for(let t=0;t<=u;t++)l.emplaceBack(t*h,_,v);for(let t=0;t<u;t++)c.emplaceBack(m+t,f+t,f+t+1),c.emplaceBack(m+t,f+t+1,m+t+1),c.emplaceBack(0+t,p+t+1,p+t),c.emplaceBack(0+t,0+t+1,p+t+1);const b=l.length,x=b+2*(u+1);for(const T of[0,1])for(let e=0;e<=u;e++)for(const r of[0,1])l.emplaceBack(T*t.a5,e*h,r);for(let t=0;t<2*u;t+=2)c.emplaceBack(b+t,b+t+1,b+t+3),c.emplaceBack(b+t,b+t+3,b+t+2),c.emplaceBack(x+t,x+t+3,x+t+1),c.emplaceBack(x+t,x+t+2,x+t+3);const w=new Lt(s.createVertexBuffer(l,ta.members),s.createIndexBuffer(c),t.aX.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.bE/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,r){var i;if(!t.cD(r,e.wrap()))return 0;const{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,r);return null!==(i=this.getMinMaxElevation(n).minElevation)&&void 0!==i?i:0}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,r={minElevation:null,maxElevation:null};return t&&t.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(e,r){const i=t.a9.fromLngLat(e.wrap()),n=(1<<r)*t.a5,o=i.x*n,a=i.y*n,s=Math.floor(o/t.a5),l=Math.floor(a/t.a5);return{tileID:new t.a2(r,0,r,s,l),mercatorX:o,mercatorY:a}}}class na{constructor(e,t,r){this._context=e,this._size=t,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new t.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:e,fbo:r,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(e=>!e.inUse)}}const oa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class aa{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new na(e.context,30,t.tileManager.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(r=>!e._layers[r].isHidden(t)),this._coordsAscending={};for(const r in e.tileManagers){this._coordsAscending[r]={};const t=e.tileManagers[r].getVisibleCoordinates(),i=e.tileManagers[r].getSource(),n=i instanceof te?i.terrainTileRanges:null;for(const e of t){const t=this.terrain.tileManager.getTerrainCoords(e,n);for(const e in t)this._coordsAscending[r][e]||(this._coordsAscending[r][e]=[]),this._coordsAscending[r][e].push(t[e])}}this._coordsAscendingStr={};for(const r of e._order){const t=e._layers[r],i=t.source;if(oa[t.type]&&!this._coordsAscendingStr[i]){this._coordsAscendingStr[i]={};for(const e in this._coordsAscending[i])this._coordsAscendingStr[i][e]=this._coordsAscending[i][e].map(e=>e.key).sort().join()}}for(const r of this._renderableTiles)for(const e in this._coordsAscendingStr){const t=this._coordsAscendingStr[e][r.tileID.key];t&&t!==r.rttCoords[e]&&(r.rtt=[])}}renderLayer(e,r){if(e.isHidden(this.painter.transform.zoom))return!1;const i=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(oa[n]&&(this._prevType&&oa[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(oa[this._prevType]||oa[n]&&a){this._prevType=n;const e=this._stacks.length-1,r=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(qn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){const t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),n.rtt[e]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:t.bp.transparent,stencil:0}),o.currentStencilSource=void 0;for(let e=0;e<r.length;e++){const t=o.style._layers[r[e]],s=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(t,s,!0),o.renderLayer(o,o.style.tileManagers[t.source],t,s,i),t.source&&(n.rttCoords[t.source]=this._coordsAscendingStr[t.source][n.tileID.key])}}return qn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),oa[n]}return!1}}const sa={"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"},la=r,ca={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Yo,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:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},ua={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class ha{constructor(e,r,i=!1){this.mousedown=e=>{this.startMove(e,u.mousePos(this.element,e)),u.addEventListener(window,"mousemove",this.mousemove),u.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,u.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),u.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=u.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;const n=new wo;this._rotatePitchHandler=new go({clickTolerance:3,move:(e,n)=>{const o=r.getBoundingClientRect(),a=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:t.cx(new t.P(e.x,n.y),n,a),pitchDelta:i?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,u.addEventListener(r,"mousedown",this.mousedown),u.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),u.addEventListener(r,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),u.disableDrag()}move(e,t){const r=this.map,{bearingDelta:i,pitchDelta:n}=this._rotatePitchHandler.dragMove(e,t)||{};i&&r.setBearing(r.getBearing()+i),n&&r.setPitch(r.getPitch()+n)}off(){const e=this.element;u.removeEventListener(e,"mousedown",this.mousedown),u.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend),u.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){u.enableDrag(),u.removeEventListener(window,"mousemove",this.mousemove),u.removeEventListener(window,"mouseup",this.mouseup),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend)}}let da;function pa(e,r,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const o=new t.V(e.lng,e.lat);if(e=new t.V(e.lng,e.lat),r){const n=new t.V(e.lng-360,e.lat),o=new t.V(e.lng+360,e.lat),a=i.locationToScreenPoint(e).distSqr(r);i.locationToScreenPoint(n).distSqr(r)<a?e=n:i.locationToScreenPoint(o).distSqr(r)<a&&(e=o)}for(;Math.abs(e.lng-i.center.lng)>180;){const t=i.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(e))?e:o}const fa={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 ma(e,t,r){const i=e.classList;for(const n in fa)i.remove(`maplibregl-${r}-anchor-${n}`);i.add(`maplibregl-${r}-anchor-${t}`)}class ga extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{const t=e.code,r=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==r&&13!==r||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,r=this._element;this._popup&&(t===r||r.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const t=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!t)&&this._map.once("render",this._update),this._lngLat=pa(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||e&&"moveend"!==e.type||(this._pos=this._pos.round()),u.setTransform(this._element,`${fa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),s.frameAsync(new AbortController).then(()=>{this._updateOpacity(e&&"moveend"===e.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.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 t.l("dragstart"))),this.fire(new t.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 t.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=u.create("div");const r=u.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=u.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=u.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const s=u.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");const l=[{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 e of l){const t=u.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),s.appendChild(t)}const c=u.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=u.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"),c.appendChild(h);const d=u.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=u.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=u.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=u.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=u.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 y=u.createNS("http://www.w3.org/2000/svg","circle");y.setAttributeNS(null,"fill","#FFFFFF"),y.setAttributeNS(null,"cx","5.5"),y.setAttributeNS(null,"cy","5.5"),y.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(y),a.appendChild(s),a.appendChild(c),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=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),ma(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.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),u.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.V.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,r=13.5,i=Math.abs(r)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[i,-1*(t-r+i)],"bottom-right":[-i,-1*(t-r+i)],left:[r,-1*(t-r)],right:[-r,-1*(t-r)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!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 e=o?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)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.getElevationForLngLat(this._lngLat,a.transform);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 t.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(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==t&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}const ya={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let _a=0,va=!1;const ba={maxWidth:100,unit:"metric"};function xa(e,t,r){const i=r&&r.maxWidth||100,n=e._container.clientHeight/2,o=e._container.clientWidth/2,a=e.unproject([o-i/2,n]),s=e.unproject([o+i/2,n]),l=Math.round(e.project(s).x-e.project(a).x),c=Math.min(i,l,e._container.clientWidth),u=a.distanceTo(s);if(r&&"imperial"===r.unit){const r=3.2808*u;r>5280?wa(t,c,r/5280,e._getUIString("ScaleControl.Miles")):wa(t,c,r,e._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?wa(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?wa(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):wa(t,c,u,e._getUIString("ScaleControl.Meters"))}function wa(e,t,r,i){const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let r=e/t;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(r),t*r}(r);e.style.width=t*(n/r)+"px",e.innerHTML=`${n} ${i}`}const Ta={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Sa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ea(e){if(e){if("number"==typeof e){const r=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(r,r),"top-right":new t.P(-r,r),bottom:new t.P(0,-e),"bottom-left":new t.P(r,-r),"bottom-right":new t.P(-r,-r),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const r=t.P.convert(e);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:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Ea(new t.P(0,0))}const Ia=r;e.AJAXError=t.cI,e.Event=t.l,e.Evented=t.E,e.LngLat=t.V,e.MercatorCoordinate=t.a9,e.Point=t.P,e.addProtocol=t.cJ,e.config=t.c,e.removeProtocol=t.cK,e.AttributionControl=Jo,e.BoxZoomHandler=uo,e.CanvasSource=ie,e.CooperativeGesturesHandler=$o,e.DoubleClickZoomHandler=No,e.DragPanHandler=Uo,e.DragRotateHandler=Go,e.EdgeInsets=jt,e.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(e=null==t?void 0:t.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.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(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){u.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=u.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);u.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_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 t.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.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()}},e.GeoJSONSource=ee,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const r=new t.V(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,n=this._map.getBearing(),o=t.e({bearing:n},this.options.fitBoundsOptions),a=Z.fromLngLat(r,i);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const r=new t.V(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.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 e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&va)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=u.create("button","maplibregl-ctrl-geolocate",this._container),u.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ga({element:this._dotElement}),this._circleElement=u.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ga({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{const r=(null==e?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.l("trackuserlocationend")),this.fire(new t.l("userlocationlostfocus")))})}},this.options=t.e({},ya,e)}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,function*(e=!1){if(void 0!==da&&!e)return da;if(void 0===window.navigator.permissions)return da=!!window.navigator.geolocation,da;try{const e=yield window.navigator.permissions.query({name:"geolocation"});da="denied"!==e.state}catch(e){da=!!window.navigator.geolocation}return da})}().then(e=>this._finishSetupUI(e)),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(),u.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,_a=0,va=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),r=e.coords;return t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;const t=this._map.project(e),r=this._map.unproject([t.x+100,t.y]),i=e.distanceTo(r)/100,n=2*this._accuracy/i;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return t.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 t.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":_a--,va=!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 t.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 t.l("trackuserlocationstart")),this.fire(new t.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 e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),_a++,_a>1?(e={maximumAge:6e5,timeout:0},va=!0):(e=this.options.positionOptions,va=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.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(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=u.create("button","maplibregl-ctrl-globe",this._container),u.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(){u.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Hn,e.ImageSource=te,e.KeyboardHandler=Oo,e.LngLatBounds=Z,e.LogoControl=Qo,e.Map=class extends Ko{constructor(e){var r,i;t.cG.mark(t.cH.create);const n=Object.assign(Object.assign(Object.assign({},ca),e),{canvasContextAttributes:Object.assign(Object.assign({},ca.canvasContextAttributes),e.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 Zt,a=new Yt;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),null!==n.transformConstrain&&o.setConstrainOverride(n.transformConstrain),super(o,a,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ea,this._controls=[],this._mapId=t.af(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(const[e]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${e}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._setupPainter(),this.resize(),this._update(),this.fire(new t.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.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({},sa),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this._zoomLevelsToOverscale=n.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=n.transformCameraUpdate,this.transformConstrain=n.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,void 0!==n.reduceMotion&&(s.prefersReducedMotion=n.reduceMotion),this._imageQueueHandle=y.addThrottleControl(()=>this.isMoving()),this._requestManager=new _(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 e=!1;const t=Zn(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50);this._resizeObserver=new ResizeObserver(r=>{e?t(r):e=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Xo(this,n),this._hash=n.hash&&new Hn("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,t.e({},n.fitBoundsOptions,{duration:0}))));const l="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,l),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Jo("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Qo,n.logoPosition),this.on("style.load",()=>{if(l||this._resizeTransform(),this.transform.unmodified){const e=t.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.l(`${e.dataType}data`,e))}),this.on("dataloading",e=>{this.fire(new t.l(`${e.dataType}dataloading`,e))}),this.on("dataabort",e=>{this.fire(new t.l("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,r){if(void 0===r&&(r=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}coveringTiles(e){return Ie(this.transform,e)}calculateCameraOptionsFromTo(e,t,r,i){return null==i&&this.terrain&&(i=this.terrain.getElevationForLngLat(r,this.transform)),super.calculateCameraOptionsFromTo(e,t,r,i)}resize(e,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 e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const t=this._getClampedPixelRatio(i,n);this._resizeCanvas(i,n,t),this.painter.resize(i,n,t)}this._resizeTransform(r);const a=!this._moving;return a&&(this.stop(),this.fire(new t.l("movestart",e)).fire(new t.l("move",e))),this.fire(new t.l("resize",e)),a&&this.fire(new t.l("moveend",e)),this}_resizeTransform(e=!0){var t;const[r,i]=this._containerDimensions();this.transform.resize(r,i,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(r,i,e)}_getClampedPixelRatio(e,t){const{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),o=e*n,a=t*n;return Math.min(o>r?r/o:1,a>i?i/a:1)*n}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(Z.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom){const t=this._getTransformForUpdate();return t.setMinZoom(e),this._applyUpdatedTransform(t),this._update(),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom){const t=this._getTransformForUpdate();return t.setMaxZoom(e),this._applyUpdatedTransform(t),this._update(),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.V.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,t,r){if("mouseenter"===e||"mouseover"===e){let i=!1;const n=n=>{const o=t.filter(e=>this.getLayer(e)),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?i||(i=!0,r.call(this,new no(e,this,n.originalEvent,{features:a}))):i=!1};return{layers:t,listener:r,delegates:{mousemove:n,mouseout:()=>{i=!1}}}}if("mouseleave"===e||"mouseout"===e){let i=!1;const n=n=>{const o=t.filter(e=>this.getLayer(e));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?i=!0:i&&(i=!1,r.call(this,new no(e,this,n.originalEvent)))},o=t=>{i&&(i=!1,r.call(this,new no(e,this,t.originalEvent)))};return{layers:t,listener:r,delegates:{mousemove:n,mouseout:o}}}{const i=e=>{const i=t.filter(e=>this.getLayer(e)),n=0!==i.length?this.queryRenderedFeatures(e.point,{layers:i}):[];n.length&&(e.features=n,r.call(this,e),delete e.features)};return{layers:t,listener:r,delegates:{[e]:i}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,r){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const i=this._delegatedListeners[e];for(let n=0;n<i.length;n++){const e=i[n];if(e.listener===r&&e.layers.length===t.length&&e.layers.every(e=>t.includes(e))){for(const t in e.delegates)this.off(t,e.delegates[t]);return void i.splice(n,1)}}}on(e,t,r){if(void 0===r)return super.on(e,t);const i="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,i,r);this._saveDelegatedListener(e,n);for(const o in n.delegates)this.on(o,n.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(void 0===r)return super.once(e,t);const i="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,i,r);for(const o in n.delegates){const t=n.delegates[o];n.delegates[o]=(...n)=>{this._removeDelegatedListener(e,i,r),t(...n)}}this._saveDelegatedListener(e,n);for(const o in n.delegates)this.once(o,n.delegates[o]);return this}off(e,t,r){return void 0===r?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,r),this)}queryRenderedFeatures(e,r){if(!this.style)return[];let i;const n=e instanceof t.P||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:e)||{},o instanceof t.P||"number"==typeof o[0])i=[t.P.convert(o)];else{const e=t.P.convert(o[0]),r=t.P.convert(o[1]);i=[e,new t.P(r.x,e.y),r,new t.P(e.x,r.y),e]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,r){return!1!==(r=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var r,i;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Lr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,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 Lr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){if("string"==typeof e){const i=this._requestManager.transformRequest(e,"Style");t.j(i,new AbortController).then(e=>{this._updateDiff(e.data,r)}).catch(e=>{e&&this.fire(new t.k(e))})}else"object"==typeof e&&this._updateDiff(e,r)}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(i){t.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){const r=this.style&&this.style.tileManagers[e];if(void 0!==r)return r.loaded();this.fire(new t.k(new Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const r=this.style.tileManagers[e.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&r.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.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===e.source&&t.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 ia(this.painter,r,e),this.painter.renderToTexture=new aa(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=t=>{var r;"style"===t.dataType?this.terrain.tileManager.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.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=t.source)||void 0===r?void 0:r.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.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 t.l("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}areTilesLoaded(){const e=this.style&&this.style.tileManagers;for(const t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,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=Te(Math.max(1,e),Math.max(1,t))}else for(const i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=Te(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,r){const i=this.style.tileManagers[e];if(!i)throw new Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(e=>new t.ac(e.z,e.x,e.y)))}addImage(e,r,i={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=i;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||t.b(r))){if(void 0===r.width||void 0===r.height)return this.fire(new t.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:s,data:d}=r,p=r;return this.style.addImage(e,{data:new t.R({width:i,height:s},new Uint8Array(d)),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{const{width:i,height:d,data:p}=s.getImageData(r);this.style.addImage(e,{data:new t.R({width:i,height:d},p),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,r){const i=this.style.getImage(e);if(!i)return this.fire(new t.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||t.b(r)?s.getImageData(r):r,{width:o,height:a,data:l}=n;if(void 0===o||void 0===a)return this.fire(new t.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||a!==i.data.height)return this.fire(new t.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||t.b(r));return i.data.replace(l,c),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.k(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return y.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const t=this._canvasContainer=u.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=u.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);const n=this._controlContainer=u.create("div","maplibregl-control-container",e),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{o[e]=u.create("div",`maplibregl-ctrl-${e} `,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,r){this._canvas.width=Math.floor(r*e),this._canvas.height=Math.floor(r*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)},{once:!0});let r=null;if(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!r){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new Wn(r,this.transform),h.testSupport(r)}migrateProjection(e,r){super.migrateProjection(e,r),this.painter.transform=e,this.fire(new t.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var r,i,n,o,a;const s=this._idleTriggered?this._fadeDuration:0,l=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,r=c();this.style.zoomHistory.update(e,r);const i=new t.H(e,{now:r,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),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!==l;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===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cG.mark(t.cH.load),this.fire(new t.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 t.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,t.cG.mark(t.cH.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.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),y.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.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),u.remove(this._canvasContainer),u.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cG.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,e=>{t.cG.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!t.Z(e)&&!function(e){return e.message===an}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return la}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=no,e.MapTouchEvent=oo,e.MapWheelEvent=ao,e.Marker=ga,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),r=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",t.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=(e,t)=>{const r=this._map._getUIString(`NavigationControl.${t}`);e.title=r,e.setAttribute("aria-label",r)},this.options=t.e({},ua,e),this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),u.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),u.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=u.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,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 ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){u.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(e,t){const r=u.create("button",e,this._container);return r.type="button",r.addEventListener("click",t),r}},e.Popup=class extends t.E{constructor(e){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&&u.remove(this._content),this._container&&(u.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 t.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=u.create("div","maplibregl-popup",this._map.getContainer()),this._tip=u.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=pa(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const t=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor;const i=Ea(this.options.offset);if(!r){const e=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=t.y+i.bottom.y<n?["top"]:t.y>this._map.transform.height-n?["bottom"]:[],t.x<e/2?o.push("left"):t.x>this._map.transform.width-e/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}let n=t.add(i[r]);this.options.subpixelPositioning||(n=n.round()),u.setTransform(this._container,`${fa[r]} translate(${n.x}px,${n.y}px)`),ma(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Ta),e)}addTo(e){return this._map&&this.remove(),this._map=e,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 t.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.V.convert(e),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(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),r=document.createElement("body");let i;for(r.innerHTML=e;i=r.firstChild,i;)t.appendChild(i);return this.setDOMContent(t)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=u.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=u.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 e=this._container.querySelector(Sa);e&&e.focus()}},e.RasterDEMTileSource=Y,e.RasterTileSource=K,e.ScaleControl=class{constructor(e){this._onMove=()=>{xa(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,xa(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ba),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){u.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=Bo,e.Style=Lr,e.TerrainControl=class{constructor(e){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=e}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=u.create("button","maplibregl-ctrl-terrain",this._container),u.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(){u.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=Do,e.TwoFingersTouchRotateHandler=Co,e.TwoFingersTouchZoomHandler=ko,e.TwoFingersTouchZoomRotateHandler=qo,e.VectorTileSource=X,e.VideoSource=re,e.addSourceType=(e,r)=>t._(void 0,void 0,void 0,function*(){if(oe(e))throw new Error(`A source type called "${e}" already exists.`);((e,t)=>{ne[e]=t})(e,r)}),e.clearPrewarmedResources=function(){const e=z;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(O),z=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()"))},e.createTileMesh=lr,e.getMaxParallelImageRequests=function(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ce().getRTLTextPluginStatus()},e.getVersion=function(){return Ia},e.getWorkerCount=function(){return L.workerCount},e.getWorkerUrl=function(){return t.c.WORKER_URL},e.importScriptInWorkers=function(e){return V().broadcast("IS",e)},e.isTimeFrozen=function(){return l.isFrozen()},e.now=c,e.prewarm=function(){N().acquire(O)},e.restoreNow=function(){l.restoreNow()},e.setMaxParallelImageRequests=function(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){l.setNow(e)},e.setRTLTextPlugin=function(e,t){return ce().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){L.workerCount=e},e.setWorkerUrl=function(e){t.c.WORKER_URL=e}}),e}()),ye.exports}var ve,be=me?ge.exports:(me=1,self,ve=e=>(()=>{var t={105:function(e,t){!function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}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 y(e){var t=[];if(void 0!==e.options)for(var r=0;r<e.options.length;r++)e.options[r].selected&&t.push(e.options[r].value);return t.join(", ")}function _(){var e="xxxxxxxx";return(e=b(e,"[x]"))+Date.now().toString()}function v(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";return e=b(e,"[xy]")}function b(e,t){var r=(new Date).getTime(),i=new RegExp(t,"g");return e.replace(i,function(e){var t=(r+16*Math.random())%16|0;return("x"===e?t:3&t|8).toString(16)})}function x(){return Math.floor((new Date).getTime()/1e3)}var w=0;function T(){var e=(new Date).getTime();return w>=e?w++:w=e,w}function S(e,t,r){if(t&&Object.keys(t).length){if(void 0!==t[e])return t[e]}else if(void 0!==g[e])return g[e];return r}function E(e,t,r){for(var i in g.i)g.i[i].tracking_crashes&&g.i[i].recordError(e,t,r)}function I(e){var t=[];for(var r in e)t.push(r+"="+encodeURIComponent(e[r]));return t.join("&")}function P(e){return"string"==typeof e&&"/"===e.substring(e.length-1)?e.substring(0,e.length-1):e}function k(e,t){for(var r,i={},n=0,o=t.length;n<o;n++)void 0!==e[r=t[n]]&&(i[r]=e[r]);return i}function A(e,t,r){if(r){for(var i,n=0,o=r.length;n<o;n++)void 0!==t[i=r[n]]&&(e[i]=t[i]);return e}}function C(e,t,r,i,n,o){var a={};if(e){if(Object.keys(e).length>i){var s={},l=0;for(var c in e)l<i&&(s[c]=e[c],l++);e=s}for(var u in e){var h=M(u,t,n,o),d=M(e[u],r,n,o);a[h]=d}}return a}function M(e,t,r,i){var n=e;return"number"==typeof e&&(e=e.toString()),"string"==typeof e&&e.length>t&&(n=e.substring(0,t),i(s.DEBUG,r+", Key: [ "+e+" ] is longer than accepted length. It will be truncated.")),n}function D(e,t){for(t=t.toUpperCase();e;){if(e.nodeName.toUpperCase()===t)return e;e=e.parentElement}}function R(e,t,r){m&&(null!=e?void 0!==e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r):H()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+t+"] event to nonexisting element"))}function O(e){return e?void 0!==e.target?e.target:e.srcElement:window.event.srcElement}function L(e){if(e)return e;var t=navigator.userAgent;return t||(t=F()),t}function F(e){if(e)return e;var t="";return navigator.userAgentData&&(t=navigator.userAgentData.brands.map(function(e){return e.brand+":"+e.version}).join(),t+=navigator.userAgentData.mobile?" mobi ":" ",t+=navigator.userAgentData.platform),t}function z(e){var t;if(e)t=e;else{if(navigator.userAgentData&&navigator.userAgentData.mobile)return"phone";t=L()}t=t.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(t)?r="tablet":i.test(t)&&(r="phone"),r}function B(e){var t=/(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(e)return t.test(e);var r=t.test(L()),i=t.test(F());return r||i}function N(e){return void 0===e.pageY&&"number"==typeof e.clientX&&document.documentElement&&(e.pageX=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e.pageY=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),e}function j(){var e=document;return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}function V(){var e=document;return Math.max(Math.max(e.body.scrollWidth,e.documentElement.scrollWidth),Math.max(e.body.offsetWidth,e.documentElement.offsetWidth),Math.max(e.body.clientWidth,e.documentElement.clientWidth))}function U(){var e=document;return Math.min(Math.min(e.body.clientHeight,e.documentElement.clientHeight),Math.min(e.body.offsetHeight,e.documentElement.offsetHeight),window.innerHeight)}function G(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function q(e,t,r,i,n,o){var a,s=document.createElement(e);s.setAttribute(t,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 $(e,t){q("script","type","text/javascript","src",e,t)}function W(e,t){q("link","rel","stylesheet","href",e,t)}function Z(){if(m){var e=document.getElementById("cly-loader");if(!e){var t="#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=t:i.appendChild(document.createTextNode(t)),r.appendChild(i),(e=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(e)}catch(de){H()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+de)}}}e.style.display="block"}}function H(){return!(!g||!g.debug||"undefined"==typeof console)}function X(){if(m){g.showLoaderProtection=!0;var e=document.getElementById("cly-loader");e&&(e.style.display="none")}}var K=i(function e(i){r(this,e);var u,b=this,w=!g.i,q=!1,K="/i",Y="/o/sdk",J=S("interval",i,c.BEAT_INTERVAL),Q=S("queue_size",i,c.QUEUE_SIZE),ee=[],te=[],re={},ie=[],ne={},oe=S("ignore_referrers",i,[]),ae=null,se=!0,le=0,ce=null,ue=0,he=0,pe=0,fe=S("fail_timeout",i,c.FAIL_TIMEOUT_AMOUNT),me=S("inactivity_time",i,c.INACTIVITY_TIME),ge=0,ye=S("session_update",i,c.SESSION_UPDATE),_e=S("max_events",i,c.MAX_EVENT_BATCH),ve=S("max_logs",i,null),be=S("use_session_cookie",i,!0),xe=S("session_cookie_timeout",i,c.SESSION_COOKIE_TIMEOUT),we=!0,Te=!1,Se=S("offline_mode",i,!1),Ee={},Ie=!0,Pe=x(),ke=!0,Ae=null,Ce=l.SDK_GENERATED,Me=!1,De=0,Re=!1,Oe=null,Le=null,Fe=null,ze=S("sdk_name",i,p),Be=S("sdk_version",i,d);try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(de){ct(s.ERROR,"Local storage test failed, Halting local storage support: "+de),ke=!1}for(var Ne,je={},Ve=0;Ve<g.features.length;Ve++)je[g.features[Ve]]={};this.initialize=function(){if(this.serialize=S("serialize",i,g.serialize),this.deserialize=S("deserialize",i,g.deserialize),this.getViewName=S("getViewName",i,g.getViewName),this.getViewUrl=S("getViewUrl",i,g.getViewUrl),this.getSearchQuery=S("getSearchQuery",i,g.getSearchQuery),this.DeviceIdType=g.DeviceIdType,this.namespace=S("namespace",i,""),this.clearStoredId=S("clear_stored_id",i,!1),this.app_key=S("app_key",i,null),this.onload=S("onload",i,[]),this.utm=S("utm",i,{source:!0,medium:!0,campaign:!0,term:!0,content:!0}),this.ignore_prefetch=S("ignore_prefetch",i,!0),this.rcAutoOptinAb=S("rc_automatic_optin_for_ab",i,!0),this.useExplicitRcApi=S("use_explicit_rc_api",i,!1),this.debug=S("debug",i,!1),this.test_mode=S("test_mode",i,!1),this.test_mode_eq=S("test_mode_eq",i,!1),this.metrics=S("metrics",i,{}),this.headers=S("headers",i,{}),this.url=P(S("url",i,"")),this.app_version=S("app_version",i,"0.0"),this.country_code=S("country_code",i,null),this.city=S("city",i,null),this.ip_address=S("ip_address",i,null),this.ignore_bots=S("ignore_bots",i,!0),this.force_post=S("force_post",i,!1),this.remote_config=S("remote_config",i,!1),this.ignore_visitor=S("ignore_visitor",i,!1),this.require_consent=S("require_consent",i,!1),this.track_domains=m?S("track_domains",i,!0):void 0,this.storage=S("storage",i,"default"),this.enableOrientationTracking=m?S("enable_orientation_tracking",i,!0):void 0,this.maxKeyLength=S("max_key_length",i,c.MAX_KEY_LENGTH),this.maxValueSize=S("max_value_size",i,c.MAX_VALUE_SIZE),this.maxSegmentationValues=S("max_segmentation_values",i,c.MAX_SEGMENTATION_VALUES),this.maxBreadcrumbCount=S("max_breadcrumb_count",i,null),this.maxStackTraceLinesPerThread=S("max_stack_trace_lines_per_thread",i,c.MAX_STACKTRACE_LINES_PER_THREAD),this.maxStackTraceLineLength=S("max_stack_trace_line_length",i,c.MAX_STACKTRACE_LINE_LENGTH),this.heatmapWhitelist=S("heatmap_whitelist",i,[]),b.hcErrorCount=St(h.errorCount)||0,b.hcWarningCount=St(h.warningCount)||0,b.hcStatusCode=St(h.statusCode)||-1,b.hcErrorMessage=St(h.errorMessage)||"",ve&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=ve,ct(s.WARNING,"initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!")):ve||this.maxBreadcrumbCount||(this.maxBreadcrumbCount=100),"cookie"===this.storage&&(ke=!1),this.rcAutoOptinAb||this.useExplicitRcApi||(ct(s.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),this.useExplicitRcApi=!0),Array.isArray(oe)||(oe=[]),""===this.url&&(ct(s.ERROR,"initialize, Please provide server URL"),this.ignore_visitor=!0),St("cly_ignore")&&(this.ignore_visitor=!0),Pt(),ee=St("cly_queue")||[],te=St("cly_event")||[],re=St("cly_remote_configs")||{},this.clearStoredId&&(St("cly_id")&&!y&&(this.device_id=St("cly_id"),ct(s.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),(Ce=St("cly_id_type"))||(ct(s.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),Ce=l.DEVELOPER_SUPPLIED),He(),this.device_id=void 0,Ce=l.SDK_GENERATED),ct(s.INFO,"initialize, Clearing the device ID storage"),It("cly_id"),It("cly_id_type"),It("cly_session")),Ze(),m)if(window.name&&0===window.name.indexOf("cly:"))try{this.passed_data=JSON.parse(window.name.replace("cly:",""))}catch(x){ct(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){ct(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!==St("cly_old_token")&&(_t(this.passed_data.token),Et("cly_old_token",this.passed_data.token));var e=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),e=this.heatmapWhitelist.map(function(e){return P(e)})):e=[this.url],e.includes(this.passed_data.url)&&"heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,Z(),$(this.passed_data.url+"/views/heatmap.js",X))}if(this.ignore_visitor)ct(s.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{ct(s.DEBUG,ze===p&&Be===d?"initialize, SDK name:["+ze+"], version:["+Be+"]":"initialize, SDK name:["+ze+"], version:["+Be+"], default name:["+p+"] and default version:["+d+"]"),ct(s.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]"),ct(s.DEBUG,"initialize, device_id:["+S("device_id",i,void 0)+"]"),ct(s.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{ct(s.DEBUG,"initialize, metric override:["+JSON.stringify(this.metrics)+"]"),ct(s.DEBUG,"initialize, header override:["+JSON.stringify(this.headers)+"]"),ct(s.DEBUG,"initialize, number of onload callbacks provided:["+this.onload.length+"]"),ct(s.DEBUG,"initialize, utm tags:["+JSON.stringify(this.utm)+"]"),oe&&ct(s.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(oe)+"]")}catch(de){ct(s.ERROR,"initialize, Could not stringify some config object values")}ct(s.DEBUG,"initialize, app_version:["+this.app_version+"]"),ct(s.DEBUG,"initialize, provided location info; country_code:["+this.country_code+"], city:["+this.city+"], ip_address:["+this.ip_address+"]"),""!==this.namespace&&ct(s.DEBUG,"initialize, namespace given:["+this.namespace+"]"),this.clearStoredId&&ct(s.DEBUG,"initialize, clearStoredId flag set to:["+this.clearStoredId+"]"),this.ignore_prefetch&&ct(s.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+this.ignore_prefetch+"]"),this.test_mode&&ct(s.WARNING,"initialize, test_mode:["+this.test_mode+"], request queue won't be processed"),this.test_mode_eq&&ct(s.WARNING,"initialize, test_mode_eq:["+this.test_mode_eq+"], event queue won't be processed"),this.heatmapWhitelist&&ct(s.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(this.heatmapWhitelist)+"], these domains will be whitelisted"),"default"!==this.storage&&ct(s.DEBUG,"initialize, storage is set to:["+this.storage+"]"),this.ignore_bots&&ct(s.DEBUG,"initialize, ignore traffic from bots :["+this.ignore_bots+"]"),this.force_post&&ct(s.DEBUG,"initialize, forced post method for all requests:["+this.force_post+"]"),this.remote_config&&ct(s.DEBUG,"initialize, remote_config callback provided:["+!!this.remote_config+"]"),"boolean"==typeof this.rcAutoOptinAb&&ct(s.DEBUG,"initialize, automatic RC optin is enabled:["+this.rcAutoOptinAb+"]"),this.useExplicitRcApi||ct(s.WARNING,"initialize, will use legacy RC API. Consider enabling new API during init with use_explicit_rc_api flag"),this.track_domains&&ct(s.DEBUG,"initialize, tracking domain info:["+this.track_domains+"]"),this.enableOrientationTracking&&ct(s.DEBUG,"initialize, enableOrientationTracking:["+this.enableOrientationTracking+"]"),be||ct(s.WARNING,"initialize, use_session_cookie is enabled:["+be+"]"),Se&&ct(s.DEBUG,"initialize, offline_mode:["+Se+"], user info won't be send to the servers"),Se&&ct(s.DEBUG,"initialize, stored remote configs:["+JSON.stringify(re)+"]"),ct(s.DEBUG,"initialize, 'getViewName' callback override provided:["+(this.getViewName!==g.getViewName)+"]"),ct(s.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+(this.getSearchQuery!==g.getSearchQuery)+"]"),this.maxKeyLength!==c.MAX_KEY_LENGTH&&ct(s.DEBUG,"initialize, maxKeyLength set to:["+this.maxKeyLength+"] characters"),this.maxValueSize!==c.MAX_VALUE_SIZE&&ct(s.DEBUG,"initialize, maxValueSize set to:["+this.maxValueSize+"] characters"),this.maxSegmentationValues!==c.MAX_SEGMENTATION_VALUES&&ct(s.DEBUG,"initialize, maxSegmentationValues set to:["+this.maxSegmentationValues+"] key/value pairs"),this.maxBreadcrumbCount!==c.MAX_BREADCRUMB_COUNT&&ct(s.DEBUG,"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries"),this.maxStackTraceLinesPerThread!==c.MAX_STACKTRACE_LINES_PER_THREAD&&ct(s.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+this.maxStackTraceLinesPerThread+"] lines"),this.maxStackTraceLineLength!==c.MAX_STACKTRACE_LINE_LENGTH&&ct(s.DEBUG,"initialize, maxStackTraceLineLength set to:["+this.maxStackTraceLineLength+"] characters"),J!==c.BEAT_INTERVAL&&ct(s.DEBUG,"initialize, interval for heartbeats set to:["+J+"] milliseconds"),Q!==c.QUEUE_SIZE&&ct(s.DEBUG,"initialize, queue_size set to:["+Q+"] items max"),fe!==c.FAIL_TIMEOUT_AMOUNT&&ct(s.DEBUG,"initialize, fail_timeout set to:["+fe+"] seconds of wait time after a failed connection to server"),me!==c.INACTIVITY_TIME&&ct(s.DEBUG,"initialize, inactivity_time set to:["+me+"] minutes to consider a user as inactive after no observable action"),ye!==c.SESSION_UPDATE&&ct(s.DEBUG,"initialize, session_update set to:["+ye+"] seconds to check if extending a session is needed while the user is active"),_e!==c.MAX_EVENT_BATCH&&ct(s.DEBUG,"initialize, max_events set to:["+_e+"] events to send in one batch"),ve&&ct(s.WARNING,"initialize, max_logs set to:["+ve+"] breadcrumbs to store for crash logs max, deprecated "),xe!==c.SESSION_COOKIE_TIMEOUT&&ct(s.DEBUG,"initialize, session_cookie_timeout set to:["+xe+"] minutes to expire a cookies session");var t=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]?Et("cly_cmp_id",f[1]):"cly_uid"===f[0]?Et("cly_cmp_uid",f[1]):"cly_device_id"===f[0]?t=f[1]:0===(f[0]+"").indexOf("utm_")&&this.utm[f[0].replace("utm_","")]&&(o[f[0].replace("utm_","")]=f[1],n=!0)}}var y="[CLY]_temp_id"===St("cly_id"),_=S("device_id",i,void 0);if("number"==typeof _&&(_=_.toString()),St("cly_id")&&!y?(this.device_id=St("cly_id"),ct(s.INFO,"initialize, Set the stored device ID"),(Ce=St("cly_id_type"))||(ct(s.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),Ce=l.DEVELOPER_SUPPLIED)):null!==t?(ct(s.INFO,"initialize, Device ID set by URL"),this.device_id=t,Ce=l.URL_PROVIDED):_?(ct(s.INFO,"initialize, Device ID set by developer"),this.device_id=_,i&&Object.keys(i).length?void 0!==i.device_id&&(Ce=l.DEVELOPER_SUPPLIED):void 0!==g.device_id&&(Ce=l.DEVELOPER_SUPPLIED)):Se||y?(this.device_id="[CLY]_temp_id",Ce=l.TEMPORARY_ID,Se&&y?ct(s.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):Se&&!y?ct(s.INFO,"initialize, Temp ID set, entering offline mode"):(Se=!0,ct(s.INFO,"initialize, Temp ID set, enabling offline mode"))):(ct(s.INFO,"initialize, Generating the device ID"),this.device_id=S("device_id",i,nt()),i&&Object.keys(i).length?void 0!==i.device_id&&(Ce=l.DEVELOPER_SUPPLIED):void 0!==g.device_id&&(Ce=l.DEVELOPER_SUPPLIED)),Et("cly_id",this.device_id),Et("cly_id_type",Ce),n){for(var v in Fe={},this.utm)o[v]?(this.userData.set("utm_"+v,o[v]),Fe[v]=o[v]):this.userData.unset("utm_"+v);this.userData.save()}Ke(),setTimeout(function(){g.noHeartBeat?ct(s.WARNING,"initialize, Heartbeat disabled. This is for testing purposes only!"):rt(),b.remote_config&&b.fetch_remote_config(b.remote_config)},1),m&&document.documentElement.setAttribute("data-countly-useragent",L()),kt.sendInstantHCRequest(),ct(s.INFO,"initialize, Countly initialized")}},this.halt=function(){ct(s.WARNING,"halt, Resetting Countly"),g.i=void 0,g.q=[],g.noHeartBeat=void 0,w=!g.i,q=!1,K="/i",Y="/o/sdk",J=500,Q=1e3,ee=[],te=[],re={},ie=[],ne={},oe=[],ae=null,se=!0,le=0,ce=null,ue=0,he=0,pe=0,fe=60,me=20,ge=0,ye=60,_e=100,ve=null,be=!0,xe=30,we=!0,Te=!1,Se=!1,Ee={},Ie=!0,Pe=x(),ke=!0,Ae=null,Ce=l.SDK_GENERATED,Me=!1,De=0,Re=!1,Oe=null,Le=null,Fe=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(de){ct(s.ERROR,"halt, Local storage test failed, will fallback to cookies"),ke=!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],je={};for(var e=0;e<g.features.length;e++)je[g.features[e]]={};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(e){if(ct(s.INFO,"group_features, Grouping features"),e)for(var t in e)je[t]?ct(s.WARNING,"group_features, Feature name ["+t+"] is already reserved"):"string"==typeof e[t]?je[t]={features:[e[t]]}:e[t]&&Array.isArray(e[t])&&e[t].length?je[t]={features:e[t]}:ct(s.ERROR,"group_features, Incorrect feature list for ["+t+"] value: ["+e[t]+"]");else ct(s.ERROR,"group_features, Incorrect features:["+e+"]")},this.check_consent=function(e){return ct(s.INFO,"check_consent, Checking if consent is given for specific feature:["+e+"]"),this.require_consent?je[e]?!(!je[e]||!je[e].optin):(ct(s.ERROR,"check_consent, No feature available for ["+e+"]"),!1):(ct(s.INFO,"check_consent, require_consent is off, no consent is necessary"),!0)},this.get_device_id_type=function(){var e;switch(ct(s.INFO,"check_device_id_type, Retrieving the current device id type.["+Ce+"]"),Ce){case l.SDK_GENERATED:e=b.DeviceIdType.SDK_GENERATED;break;case l.URL_PROVIDED:case l.DEVELOPER_SUPPLIED:e=b.DeviceIdType.DEVELOPER_SUPPLIED;break;case l.TEMPORARY_ID:e=b.DeviceIdType.TEMPORARY_ID;break;default:e=-1}return e},this.get_device_id=function(){return ct(s.INFO,"get_device_id, Retrieving the device id: ["+b.device_id+"]"),b.device_id},this.check_any_consent=function(){if(ct(s.INFO,"check_any_consent, Checking if any consent is given"),!this.require_consent)return ct(s.INFO,"check_any_consent, require_consent is off, no consent is necessary"),!0;for(var e in je)if(je[e]&&je[e].optin)return!0;return ct(s.INFO,"check_any_consent, No consents given"),!1},this.add_consent=function(e){if(ct(s.INFO,"add_consent, Adding consent for ["+e+"]"),Array.isArray(e))for(var t=0;t<e.length;t++)this.add_consent(e[t]);else je[e]?je[e].features?(je[e].optin=!0,this.add_consent(je[e].features)):!0!==je[e].optin&&(je[e].optin=!0,Ue(),setTimeout(function(){e===n.SESSIONS&&Ee.begin_session?(b.begin_session.apply(b,Ee.begin_session),Ee.begin_session=null):e===n.VIEWS&&Ee.track_pageview&&(ce=null,b.track_pageview.apply(b,Ee.track_pageview),Ee.track_pageview=null)},1)):ct(s.ERROR,"add_consent, No feature available for ["+e+"]")},this.remove_consent=function(e){ct(s.INFO,"remove_consent, Removing consent for ["+e+"]"),this.remove_consent_internal(e,!0)},this.remove_consent_internal=function(e,t){if(t=t||!1,Array.isArray(e))for(var r=0;r<e.length;r++)this.remove_consent_internal(e[r],t);else je[e]?je[e].features?this.remove_consent_internal(je[e].features,t):(je[e].optin=!1,t&&!1!==je[e].optin&&Ue()):ct(s.WARNING,"remove_consent, No feature available for ["+e+"]")};var Ue=function(){Ne&&(clearTimeout(Ne),Ne=null),Ne=setTimeout(function(){for(var e={},t=0;t<g.features.length;t++)!0===je[g.features[t]].optin?e[g.features[t]]=!0:e[g.features[t]]=!1;tt({consent:JSON.stringify(e)}),ct(s.DEBUG,"Consent update request has been sent to the queue.")},1e3)};function Ge(e,t){if(b.ignore_visitor)ct(s.ERROR,"Adding event failed. Possible bot or user opt out");else if(e.key){e.count||(e.count=1),a.includes(e.key)||(e.key=M(e.key,b.maxKeyLength,"add_cly_event",ct)),e.segmentation=C(e.segmentation,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"add_cly_event",ct);var r=k(e,["key","count","sum","dur","segmentation"]);r.timestamp=T();var i=new Date;r.hour=i.getHours(),r.dow=i.getDay(),r.id=t||_(),r.key===o.VIEW?r.pvid=Le||"":r.cvid=Oe||"",te.push(r),Et("cly_event",te),ct(s.INFO,"With event ID: ["+r.id+"], successfully adding the last event:",r)}else ct(s.ERROR,"Adding event failed. Event must have a key property")}this.enable_offline_mode=function(){ct(s.INFO,"enable_offline_mode, Enabling offline mode"),this.remove_consent_internal(g.features,!1),Se=!0,this.device_id="[CLY]_temp_id",b.device_id=this.device_id,Ce=l.TEMPORARY_ID},this.disable_offline_mode=function(e){if(Se){ct(s.INFO,"disable_offline_mode, Disabling offline mode"),Se=!1,e&&this.device_id!==e?(this.device_id=e,b.device_id=this.device_id,Ce=l.DEVELOPER_SUPPLIED,Et("cly_id",this.device_id),Et("cly_id_type",l.DEVELOPER_SUPPLIED),ct(s.INFO,"disable_offline_mode, Changing id to: "+this.device_id)):(this.device_id=nt(),"[CLY]_temp_id"===this.device_id&&(this.device_id=v()),b.device_id=this.device_id,this.device_id!==St("cly_id")&&(Et("cly_id",this.device_id),Et("cly_id_type",l.SDK_GENERATED)));var t=!1;if(ee.length>0)for(var r=0;r<ee.length;r++)"[CLY]_temp_id"===ee[r].device_id&&(ee[r].device_id=this.device_id,t=!0);t&&Et("cly_queue",ee,!0)}else ct(s.WARNING,"disable_offline_mode, Countly was not in offline mode.")},this.begin_session=function(e,t){if(ct(s.INFO,"begin_session, Starting the session. There was an ongoing session: ["+q+"]"),e&&ct(s.INFO,"begin_session, Heartbeats are disabled"),t&&ct(s.INFO,"begin_session, Session starts irrespective of session cookie"),this.check_consent(n.SESSIONS)){if(!q){this.enableOrientationTracking&&(this.report_orientation(),R(window,"resize",function(){b.report_orientation()})),u=x(),q=!0,se=!e;var r=St("cly_session");if(ct(s.VERBOSE,"begin_session, Session state, forced: ["+t+"], useSessionCookie: ["+be+"], seconds to expire: ["+(r-u)+"], expired: ["+(parseInt(r)<=x())+"] "),t||!be||!r||parseInt(r)<=x()){ct(s.INFO,"begin_session, Session started"),null===Ae&&(Ae=!0);var i={begin_session:1};i.metrics=JSON.stringify(st()),tt(i)}Et("cly_session",x()+60*xe)}}else Ee.begin_session=arguments},this.session_duration=function(e){ct(s.INFO,"session_duration, Reporting session duration"),this.check_consent(n.SESSIONS)&&q&&(ct(s.INFO,"session_duration, Session extended: ",e),tt({session_duration:e}),Qe())},this.end_session=function(e,t){ct(s.INFO,"end_session, Ending the current session. There was an on going session:["+q+"]"),this.check_consent(n.SESSIONS)&&q&&(e=e||x()-u,Ye(),!be||t?(ct(s.INFO,"end_session, Session ended"),tt({end_session:1,session_duration:e})):this.session_duration(e),q=!1)},this.change_id=function(e,t){if(ct(s.INFO,"change_id, Changing the ID"),t&&ct(s.INFO,"change_id, Will merge the IDs"),e&&"string"==typeof e&&0!==e.length){if(Se)return ct(s.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),void this.disable_offline_mode(e);if(this.device_id!=e){t||(it(),He(),this.end_session(null,!0),ne={},this.remove_consent_internal(g.features,!1));var r=this.device_id;this.device_id=e,b.device_id=this.device_id,Ce=l.DEVELOPER_SUPPLIED,Et("cly_id",this.device_id),Et("cly_id_type",l.DEVELOPER_SUPPLIED),ct(s.INFO,"change_id, Changing ID from:["+r+"] to ["+e+"]"),t?tt({old_device_id:r}):this.begin_session(!se,!0),this.remote_config&&(Et("cly_remote_configs",re={}),this.fetch_remote_config(this.remote_config))}}else ct(s.ERROR,"change_id, The provided ID: ["+e+"] is not a valid ID")},this.add_event=function(e){ct(s.INFO,"add_event, Adding event: ",e);var t=!1;switch(e.key){case o.NPS:case o.SURVEY:t=this.check_consent(n.FEEDBACK);break;case o.STAR_RATING:t=this.check_consent(n.STAR_RATING);break;case o.VIEW:t=this.check_consent(n.VIEWS);break;case o.ORIENTATION:t=this.check_consent(n.USERS);break;case o.ACTION:t=this.check_consent(n.CLICKS)||this.check_consent(n.SCROLLS);break;default:t=this.check_consent(n.EVENTS)}t&&Ge(e)},this.start_event=function(e){e&&"string"==typeof e?(ct(s.INFO,"start_event, Starting timed event with key: ["+e+"]"),e=M(e,b.maxKeyLength,"start_event",ct),ne[e]?ct(s.WARNING,"start_event, Timed event with key: ["+e+"] already started"):ne[e]=x()):ct(s.WARNING,"start_event, you have to provide a valid string key instead of: ["+e+"]")},this.cancel_event=function(e){return e&&"string"==typeof e?(ct(s.INFO,"cancel_event, Canceling timed event with key: ["+e+"]"),e=M(e,b.maxKeyLength,"cancel_event",ct),ne[e]?(delete ne[e],ct(s.INFO,"cancel_event, Timed event with key: ["+e+"] is canceled"),!0):(ct(s.WARNING,"cancel_event, Timed event with key: ["+e+"] was not found"),!1)):(ct(s.WARNING,"cancel_event, you have to provide a valid string key instead of: ["+e+"]"),!1)},this.end_event=function(e){e?(ct(s.INFO,"end_event, Ending timed event"),"string"==typeof e&&(e={key:e=M(e,b.maxKeyLength,"end_event",ct)}),e.key?ne[e.key]?(e.dur=x()-ne[e.key],this.add_event(e),delete ne[e.key]):ct(s.ERROR,"end_event, Timed event with key: ["+e.key+"] was not started"):ct(s.ERROR,"end_event, Timed event must have a key property")):ct(s.WARNING,"end_event, you have to provide a valid string key or event object instead of: ["+e+"]")},this.report_orientation=function(e){ct(s.INFO,"report_orientation, Reporting orientation"),this.check_consent(n.USERS)&&Ge({key:o.ORIENTATION,segmentation:{mode:e||G()}})},this.report_conversion=function(e,t){ct(s.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!"),this.recordDirectAttribution(e,t)},this.recordDirectAttribution=function(e,t){ct(s.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+e+"] and the user ID: ["+t+"]"),this.check_consent(n.ATTRIBUTION)&&(e=e||St("cly_cmp_id")||"cly_organic",tt((t=t||St("cly_cmp_uid"))?{campaign_id:e,campaign_user:t}:{campaign_id:e}))},this.user_details=function(e){if(ct(s.INFO,"user_details, Trying to add user details: ",e),this.check_consent(n.USERS)){it(),He(),ct(s.INFO,"user_details, flushed the event queue"),e.name=M(e.name,b.maxValueSize,"user_details",ct),e.username=M(e.username,b.maxValueSize,"user_details",ct),e.email=M(e.email,b.maxValueSize,"user_details",ct),e.organization=M(e.organization,b.maxValueSize,"user_details",ct),e.phone=M(e.phone,b.maxValueSize,"user_details",ct),e.picture=M(e.picture,4096,"user_details",ct),e.gender=M(e.gender,b.maxValueSize,"user_details",ct),e.byear=M(e.byear,b.maxValueSize,"user_details",ct),e.custom=C(e.custom,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"user_details",ct);var t=["name","username","email","organization","phone","picture","gender","byear","custom"];tt({user_details:JSON.stringify(k(e,t))})}};var qe={},$e=function(e,t,r){b.check_consent(n.USERS)&&(qe[e]||(qe[e]={}),"$push"===r||"$pull"===r||"$addToSet"===r?(qe[e][r]||(qe[e][r]=[]),qe[e][r].push(t)):qe[e][r]=t)};function We(e,t,r,i,o){ct(s.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var a,l={method:"rc",av:b.app_version};e&&(l.keys=JSON.stringify(e)),t&&(l.omit_keys=JSON.stringify(t)),"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(st())),b.check_consent(n.REMOTE_CONFIG)?(et(l),ut("fetch_remote_config_explicit",b.url+Y,l,function(e,t,r){if(!e){try{var i=JSON.parse(r);if(l.keys||l.omit_keys)for(var n in i)re[n]=i[n];else re=i;Et("cly_remote_configs",re)}catch(o){ct(s.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+o)}a&&(ct(s.INFO,"fetch_remote_config_explicit, Callback function is provided"),a(e,re))}},!0)):(ct(s.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),a&&a(new Error("Remote config requires explicit consent"),re))}function Ze(){ct(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,ct(s.DEBUG,"checkIgnore, Ignoring visit due to prerendering")),b.ignore_bots&&B()&&(b.ignore_visitor=!0,ct(s.DEBUG,"checkIgnore, Ignoring visit due to bot"))}function He(){te.length>0&&(ct(s.DEBUG,"Flushing events"),tt({events:JSON.stringify(te)}),Et("cly_event",te=[]))}function Xe(e,t){if(m)if(document.getElementById("countly-feedback-sticker-"+e._id))ct(s.ERROR,"Widget with same ID exists");else try{var r=document.createElement("div");r.className="countly-iframe-wrapper",r.id="countly-iframe-wrapper-"+e._id;var i=document.createElement("span");i.className="countly-feedback-close-icon",i.id="countly-feedback-close-icon-"+e._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="+e._id+"&app_key="+b.app_key+"&device_id="+b.device_id+"&sdk_version="+Be,document.body.appendChild(r),r.appendChild(i),r.appendChild(n),R(document.getElementById("countly-feedback-close-icon-"+e._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+e._id).style.display="none",document.getElementById("cfbg").style.display="none"}),t){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=e.trigger_button_text;var c=document.createElement("div");c.style.color=e.trigger_font_color.length<7?"#"+e.trigger_font_color:e.trigger_font_color,c.style.backgroundColor=e.trigger_bg_color.length<7?"#"+e.trigger_bg_color:e.trigger_bg_color,c.className="countly-feedback-sticker "+e.trigger_position+"-"+e.trigger_size,c.id="countly-feedback-sticker-"+e._id,o.appendChild(a),c.appendChild(o),c.appendChild(l),document.body.appendChild(c);var u=document.getElementById("smileyPathInStickerSvg");u&&(u.style.fill=e.trigger_font_color.length<7?"#"+e.trigger_font_color:e.trigger_font_color),R(document.getElementById("countly-feedback-sticker-"+e._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+e._id).style.display="block",document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+e._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(de){ct(s.ERROR,"Somethings went wrong while element injecting process: "+de)}else ct(s.WARNING,"processWidget, window object is not available. Not processing widget.")}function Ke(){var e;if(void 0!==b.onload&&b.onload.length>0){for(e=0;e<b.onload.length;e++)"function"==typeof b.onload[e]&&b.onload[e](b);b.onload=[]}}function Ye(){if(ce){var e={name:ce};b.check_consent(n.VIEWS)&&(Ge({key:o.VIEW,dur:Ie?x()-ue:he,segmentation:e},Oe),ce=null)}}function Je(){return ce}function Qe(){if(be){var e=St("cly_session");(!e||parseInt(e)<=x())&&(q=!1,b.begin_session(!se)),Et("cly_session",x()+60*xe)}}function et(e){e.app_key=b.app_key,e.device_id=b.device_id,e.sdk_name=ze,e.sdk_version=Be,e.t=Ce,e.av=b.app_version;var t=at();if(e.metrics){var r=JSON.parse(e.metrics);r._ua||(r._ua=t,e.metrics=JSON.stringify(r))}else e.metrics=JSON.stringify({_ua:t});b.check_consent(n.LOCATION)?(b.country_code&&(e.country_code=b.country_code),b.city&&(e.city=b.city),null!==b.ip_address&&(e.ip_address=b.ip_address)):e.location="",e.timestamp=T();var i=new Date;e.hour=i.getHours(),e.dow=i.getDay()}function tt(e){b.ignore_visitor?ct(s.WARNING,"User is opt_out will ignore the request: "+e):b.app_key&&b.device_id?(et(e),ee.length>Q&&ee.shift(),ee.push(e),Et("cly_queue",ee,!0)):ct(s.ERROR,"app_key or device_id is missing ",b.app_key,b.device_id)}function rt(){if(Ke(),b.ignore_visitor)return Te=!1,void ct(s.WARNING,"User opt_out, no heartbeat");if(Te=!0,w&&void 0!==g.q&&g.q.length>0&&it(),q&&se&&Ie){var e=x();e-u>ye&&(b.session_duration(e-u),u=e,b.hcErrorCount>0&&Et(h.errorCount,b.hcErrorCount),b.hcWarningCount>0&&Et(h.warningCount,b.hcWarningCount))}if(te.length>0&&!b.test_mode_eq){if(te.length<=_e)tt({events:JSON.stringify(te)}),te=[];else{var t=te.splice(0,_e);tt({events:JSON.stringify(t)})}Et("cly_event",te)}if(!Se&&ee.length>0&&we&&x()>pe){we=!1;var r=ee[0];r.rr=ee.length,ct(s.DEBUG,"Processing request",r),Et("cly_queue",ee,!0),b.test_mode||ut("send_request_queue",b.url+K,r,function(e,t){e?pe=x()+fe:ee.shift(),Et("cly_queue",ee,!0),we=!0},!1)}setTimeout(rt,J)}function it(){if(void 0!==g&&void 0!==g.i){var e=g.q;g.q=[];for(var t=0;t<e.length;t++){var r=e[t];if(ct(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){ct(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 ct(s.DEBUG,"Countly is not finished initialization yet, will process the queue after initialization is done")}function nt(){var e=St("cly_id");return e?(Ce=St("cly_id_type"),e):v()}function ot(e){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(e)}function at(){return b.metrics._ua||L()}function st(){var e=JSON.parse(JSON.stringify(b.metrics||{}));if(e._app_version=e._app_version||b.app_version,e._ua=e._ua||L(),m&&screen.width){var t=screen.width?parseInt(screen.width):0,r=screen.height?parseInt(screen.height):0;if(0!==t&&0!==r){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)t=Math.round(t*window.devicePixelRatio),r=Math.round(r*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var i=t;t=r,r=i}e._resolution=e._resolution||t+"x"+r}}m&&window.devicePixelRatio&&(e._density=e._density||window.devicePixelRatio);var n=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;return void 0!==n&&(e._locale=e._locale||n),lt()&&(e._store=e._store||document.referrer),ct(s.DEBUG,"Got metrics",e),e}function lt(e){if(!m)return!1;var t=e||document.referrer,r=!1;if(void 0===t||0===t.length)ct(s.DEBUG,"Invalid referrer:["+t+"], ignoring.");else{var i=f.exec(t);if(i)if(i[11])if(i[11]===window.location.hostname)ct(s.DEBUG,"Referrer is current host:["+t+"], ignoring.");else if(oe&&oe.length){r=!0;for(var n=0;n<oe.length;n++)if(t.indexOf(oe[n])>=0){ct(s.DEBUG,"Referrer in ignore list:["+t+"], ignoring."),r=!1;break}}else ct(s.DEBUG,"Valid referrer:["+t+"]"),r=!0;else ct(s.DEBUG,"No path found in referrer:["+t+"], ignoring.");else ct(s.DEBUG,"Referrer is corrupt:["+t+"], ignoring.")}return r}function ct(e,r){if(b.debug&&"undefined"!=typeof console){arguments[2]&&"object"===t(arguments[2])&&(arguments[2]=JSON.stringify(arguments[2])),w||(r="["+b.app_key+"] "+r),e||(e=s.DEBUG);for(var i="",n=2;n<arguments.length;n++)i+=arguments[n];var o=e+"[Countly] "+r+i;e===s.ERROR?(console.error(o),kt.incrementErrorCount()):e===s.WARNING?(console.warn(o),kt.incrementWarningCount()):e===s.INFO?console.info(o):e===s.VERBOSE?console.log(o):console.debug(o)}}function ut(e,t,r,i,n){m?ht(e,t,r,i,n):dt(e,t,r,i,n)}function ht(e,t,r,i,n){n=n||!1;try{ct(s.DEBUG,"Sending XML HTTP request");var o=new XMLHttpRequest,a=I(r=r||{}),l="GET";for(var c in(b.force_post||a.length>=2e3)&&(l="POST"),"GET"===l?o.open("GET",t+"?"+a,!0):(o.open("POST",t,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded")),b.headers)o.setRequestHeader(c,b.headers[c]);o.onreadystatechange=function(){4===this.readyState&&(ct(s.DEBUG,e+" HTTP request completed with status code: ["+this.status+"] and response: ["+this.responseText+"]"),(n?ft(this.status,this.responseText):pt(this.status,this.responseText))?"function"==typeof i&&i(!1,r,this.responseText):(ct(s.ERROR,e+" Invalid response from server"),"send_request_queue"===e&&kt.saveRequestCounters(this.status,this.responseText),"function"==typeof i&&i(!0,r,this.status,this.responseText)))},"GET"===l?o.send():o.send(a)}catch(de){ct(s.ERROR,e+" Something went wrong while making an XML HTTP request: "+de),"function"==typeof i&&i(!0,r)}}function dt(e,t,r,i,n){var o;n=n||!1;try{ct(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||I(r).length>=2e3?(a="POST",c=I(r)):t+="?"+I(r),b.headers)l[u]=b.headers[u];fetch(t,{method:a,headers:l,body:c}).then(function(e){return(o=e).text()}).then(function(t){ct(s.DEBUG,e+" Fetch request completed wit status code: ["+o.status+"] and response: ["+t+"]"),(n?ft(o.status,t):pt(o.status,t))?"function"==typeof i&&i(!1,r,t):(ct(s.ERROR,e+" Invalid response from server"),"send_request_queue"===e&&kt.saveRequestCounters(o.status,t),"function"==typeof i&&i(!0,r,o.status,t))}).catch(function(t){ct(s.ERROR,e+" Failed Fetch request: "+t),"function"==typeof i&&i(!0,r)})}catch(de){ct(s.ERROR,e+" Something went wrong with the Fetch request attempt: "+de),"function"==typeof i&&i(!0,r)}}function pt(e,t){if(!(e>=200&&e<300))return ct(s.ERROR,"Http response status code:["+e+"] is not within the expected range"),!1;try{var r=JSON.parse(t);return"[object Object]"!==Object.prototype.toString.call(r)?(ct(s.ERROR,"Http response is not JSON Object"),!1):!!r.result}catch(de){return ct(s.ERROR,"Http response is not JSON: "+de),!1}}function ft(e,t){if(!(e>=200&&e<300))return ct(s.ERROR,"Http response status code:["+e+"] is not within the expected range"),!1;try{var r=JSON.parse(t);return!("[object Object]"!==Object.prototype.toString.call(r)&&!Array.isArray(r)&&(ct(s.ERROR,"Http response is not JSON Object nor JSON Array"),1))}catch(de){return ct(s.ERROR,"Http response is not JSON: "+de),!1}}function mt(){m?De=Math.max(De,window.scrollY,document.body.scrollTop,document.documentElement.scrollTop):ct(s.WARNING,"processScroll, window object is not available. Not processing scroll.")}function gt(){if(m){if(Me){Me=!1;var e=j(),t=V(),r=U();if(b.check_consent(n.SCROLLS)){var i={type:"scroll",y:De+r,width:t,height:e,view:b.getViewUrl()};i=C(i,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"processScrollView",ct),b.track_domains&&(i.domain=window.location.hostname),Ge({key:o.ACTION,segmentation:i})}}}else ct(s.WARNING,"processScrollView, window object is not available. Not processing scroll view.")}function yt(){return Ce}function _t(e){Et("cly_token",e)}function vt(){var e=St("cly_token");return It("cly_token"),e}function bt(){return te}function xt(){return ee}function wt(e){for(var t=e+"=",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(t))return o.substring(t.length,o.length)}return null}function Tt(e,t,r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3);var n="; expires="+i.toGMTString();document.cookie=e+"="+t+n+"; path=/"}function St(e,r,i){var n;if("none"!==b.storage&&("object"===t(b.storage)||m))return i||(e=b.app_key+"/"+e,b.namespace&&(e=P(b.namespace)+"/"+e)),"object"===t(b.storage)&&"function"==typeof b.storage.getItem?(n=b.storage.getItem(e),e.endsWith("cly_id")?n:b.deserialize(n)):(void 0===r&&(r=ke),r?n=localStorage.getItem(e):"localstorage"!==b.storage&&(n=wt(e)),e.endsWith("cly_id")?n:b.deserialize(n));ct(s.DEBUG,"Storage is disabled. Value with key: ["+e+"] won't be retrieved")}function Et(e,r,i,n){if("none"===b.storage||"object"!==t(b.storage)&&!m)ct(s.DEBUG,"Storage is disabled. Value with key: "+e+" won't be stored");else if(n||(e=b.app_key+"/"+e,b.namespace&&(e=P(b.namespace)+"/"+e)),null!=r){if("object"===t(b.storage)&&"function"==typeof b.storage.setItem)return void b.storage.setItem(e,r);void 0===i&&(i=ke),r=b.serialize(r),i?localStorage.setItem(e,r):"localstorage"!==b.storage&&Tt(e,r,30)}}function It(e,r,i){"none"===b.storage||"object"!==t(b.storage)&&!m?ct(s.DEBUG,"Storage is disabled. Value with key: "+e+" won't be removed"):(i||(e=b.app_key+"/"+e,b.namespace&&(e=P(b.namespace)+"/"+e)),"object"!==t(b.storage)||"function"!=typeof b.storage.removeItem?(void 0===r&&(r=ke),r?localStorage.removeItem(e):"localstorage"!==b.storage&&Tt(e,"",-1)):b.storage.removeItem(e))}function Pt(){if(St(b.namespace+"cly_id",!1,!0)){Et("cly_id",St(b.namespace+"cly_id",!1,!0)),Et("cly_id_type",St(b.namespace+"cly_id_type",!1,!0)),Et("cly_event",St(b.namespace+"cly_event",!1,!0)),Et("cly_session",St(b.namespace+"cly_session",!1,!0));var e=St(b.namespace+"cly_queue",!1,!0);Array.isArray(e)&&Et("cly_queue",e=e.filter(function(e){return e.app_key===b.app_key})),St(b.namespace+"cly_cmp_id",!1,!0)&&(Et("cly_cmp_id",St(b.namespace+"cly_cmp_id",!1,!0)),Et("cly_cmp_uid",St(b.namespace+"cly_cmp_uid",!1,!0))),St(b.namespace+"cly_ignore",!1,!0)&&Et("cly_ignore",St(b.namespace+"cly_ignore",!1,!0)),It("cly_id",!1,!0),It("cly_id_type",!1,!0),It("cly_event",!1,!0),It("cly_session",!1,!0),It("cly_queue",!1,!0),It("cly_cmp_id",!1,!0),It("cly_cmp_uid",!1,!0),It("cly_ignore",!1,!0)}}this.userData={set:function(e,t){ct(s.INFO,"[userData] set, Setting user's custom property value: ["+t+"] under the key: ["+e+"]"),e=M(e,b.maxKeyLength,"userData set",ct),t=M(t,b.maxValueSize,"userData set",ct),qe[e]=t},unset:function(e){ct(s.INFO,"[userData] unset, Resetting user's custom property with key: ["+e+"] "),qe[e]=""},set_once:function(e,t){ct(s.INFO,"[userData] set_once, Setting user's unique custom property value: ["+t+"] under the key: ["+e+"] "),e=M(e,b.maxKeyLength,"userData set_once",ct),t=M(t,b.maxValueSize,"userData set_once",ct),$e(e,t,"$setOnce")},increment:function(e){ct(s.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+e+"] by one"),e=M(e,b.maxKeyLength,"userData increment",ct),$e(e,1,"$inc")},increment_by:function(e,t){ct(s.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+e+"] by: ["+t+"]"),e=M(e,b.maxKeyLength,"userData increment_by",ct),t=M(t,b.maxValueSize,"userData increment_by",ct),$e(e,t,"$inc")},multiply:function(e,t){ct(s.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+e+"] by: ["+t+"]"),e=M(e,b.maxKeyLength,"userData multiply",ct),t=M(t,b.maxValueSize,"userData multiply",ct),$e(e,t,"$mul")},max:function(e,t){ct(s.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+t+"] under the key: ["+e+"]"),e=M(e,b.maxKeyLength,"userData max",ct),t=M(t,b.maxValueSize,"userData max",ct),$e(e,t,"$max")},min:function(e,t){ct(s.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+t+"] under the key: ["+e+"]"),e=M(e,b.maxKeyLength,"userData min",ct),t=M(t,b.maxValueSize,"userData min",ct),$e(e,t,"$min")},push:function(e,t){ct(s.INFO,"[userData] push, Pushing a value: ["+t+"] under the key: ["+e+"] to user's custom property array"),e=M(e,b.maxKeyLength,"userData push",ct),t=M(t,b.maxValueSize,"userData push",ct),$e(e,t,"$push")},push_unique:function(e,t){ct(s.INFO,"[userData] push_unique, Pushing a unique value: ["+t+"] under the key: ["+e+"] to user's custom property array"),e=M(e,b.maxKeyLength,"userData push_unique",ct),t=M(t,b.maxValueSize,"userData push_unique",ct),$e(e,t,"$addToSet")},pull:function(e,t){ct(s.INFO,"[userData] pull, Removing the value: ["+t+"] under the key: ["+e+"] from user's custom property array"),$e(e,t,"$pull")},save:function(){ct(s.INFO,"[userData] save, Saving changes to user's custom property"),b.check_consent(n.USERS)&&(it(),He(),ct(s.INFO,"user_details, flushed the event queue"),tt({user_details:JSON.stringify({custom:qe})})),qe={}}},this.report_trace=function(e){if(ct(s.INFO,"report_trace, Reporting performance trace"),this.check_consent(n.APM)){for(var t=["type","name","stz","etz","apm_metrics","apm_attr"],r=0;r<t.length;r++)if("apm_attr"!==t[r]&&void 0===e[t[r]])return void ct(s.WARNING,"report_trace, APM trace don't have the property: "+t[r]);e.name=M(e.name,b.maxKeyLength,"report_trace",ct),e.app_metrics=C(e.app_metrics,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"report_trace",ct);var i=k(e,t);i.timestamp=e.stz;var o=new Date;i.hour=o.getHours(),i.dow=o.getDay(),tt({apm:JSON.stringify(i)}),ct(s.INFO,"report_trace, Successfully adding APM trace: ",i)}},this.track_errors=function(e){m?(ct(s.INFO,"track_errors, Started tracking errors"),g.i[this.app_key].tracking_crashes=!0,window.cly_crashes||(window.cly_crashes=!0,ae=e,window.onerror=function e(t,r,i,n,o){if(null!=o)E(o,!1);else{var a="";void 0!==t&&(a+=t+"\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=e.caller;c;)l.push(c.name),c=c.caller;a+=l.join("\n")}catch(u){ct(s.ERROR,"track_errors, Call stack generation experienced a problem: "+u)}E(a,!1)}},window.addEventListener("unhandledrejection",function(e){E(new Error("Unhandled rejection (reason: "+(e.reason&&e.reason.stack?e.reason.stack:e.reason)+")."),!0)}))):ct(s.WARNING,"track_errors, window object is not available. Not tracking errors.")},this.log_error=function(e,t){ct(s.INFO,"log_error, Logging errors"),this.recordError(e,!0,t)},this.add_log=function(e){if(ct(s.INFO,"add_log, Adding a new log of breadcrumbs: [ "+e+" ]"),this.check_consent(n.CRASHES)){for(e=M(e,b.maxValueSize,"add_log",ct);ie.length>=b.maxBreadcrumbCount;)ie.shift(),ct(s.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");ie.push(e)}},this.fetch_remote_config=function(e,t,r){var i=null,n=null,o=null;if(e&&(r||"function"!=typeof e?Array.isArray(e)&&(i=e):o=e),t&&(r||"function"!=typeof t?Array.isArray(t)&&(n=t):o=t),o||"function"!=typeof r||(o=r),this.useExplicitRcApi)return ct(s.INFO,"fetch_remote_config, Fetching remote config"),void We(i,n,this.rcAutoOptinAb?1:0,null,o);ct(s.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),We(i,n,null,"legacy",o)},this.enrollUserToAb=function(e){if(ct(s.INFO,"enrollUserToAb, Providing AB test keys to opt in for"),e&&Array.isArray(e)&&0!==e.length){var t={method:"ab",keys:JSON.stringify(e),av:b.app_version};et(t),ut("enrollUserToAb",this.url+Y,t,function(e,t,r){if(!e)try{var i=JSON.parse(r);ct(s.DEBUG,"enrollUserToAb, Parsed the response's result: ["+i.result+"]")}catch(n){ct(s.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+n)}},!0)}else ct(s.ERROR,"enrollUserToAb, No keys provided")},this.get_remote_config=function(e){return ct(s.INFO,"get_remote_config, Getting remote config from storage"),void 0!==e?re[e]:re},this.stop_time=function(){ct(s.INFO,"stop_time, Stopping tracking duration"),Ie&&(Ie=!1,le=x()-u,he=x()-ue)},this.start_time=function(){ct(s.INFO,"start_time, Starting tracking duration"),Ie||(Ie=!0,u=x()-le,ue=x()-he,he=0,Qe())},this.track_sessions=function(){if(m){ct(s.INFO,"track_session, Starting tracking user session"),this.begin_session(),this.start_time(),R(window,"beforeunload",function(){it(),He(),b.end_session()});var e="hidden";R(window,"focus",t),R(window,"blur",t),R(window,"pageshow",t),R(window,"pagehide",t),"onfocusin"in document&&(R(window,"focusin",t),R(window,"focusout",t)),e in document?document.addEventListener("visibilitychange",t):"mozHidden"in document?(e="mozHidden",document.addEventListener("mozvisibilitychange",t)):"webkitHidden"in document?(e="webkitHidden",document.addEventListener("webkitvisibilitychange",t)):"msHidden"in document&&(e="msHidden",document.addEventListener("msvisibilitychange",t)),R(window,"mousemove",r),R(window,"click",r),R(window,"keydown",r),R(window,"scroll",r),setInterval(function(){++ge>=me&&b.stop_time()},6e4)}else ct(s.WARNING,"track_sessions, window object is not available. Not tracking sessions.");function t(){document[e]||!document.hasFocus()?b.stop_time():b.start_time()}function r(){ge>=me&&b.start_time(),ge=0}},this.track_pageview=function(e,t,r){if(m||e)if(ct(s.INFO,"track_pageview, Tracking page views"),ct(s.VERBOSE,"track_pageview, last view is:["+ce+"], current view ID is:["+Oe+"], previous view ID is:["+Le+"]"),ce&&Re&&(ct(s.DEBUG,"track_pageview, Scroll registry triggered"),gt(),Me=!0,De=0),Ye(),Le=Oe,Oe=_(),(e=M(e,b.maxKeyLength,"track_pageview",ct))&&Array.isArray(e)&&(t=e,e=null),e||(e=this.getViewName()),void 0!==e&&""!==e)if(null!==e){if(t&&t.length)for(var i=0;i<t.length;i++)try{if(new RegExp(t[i]).test(e))return void ct(s.INFO,"track_pageview, Ignoring the page: "+e)}catch(d){ct(s.ERROR,"track_pageview, Problem with finding ignore list item: "+t[i]+", error: "+d)}ce=e,ue=x(),ct(s.VERBOSE,"track_pageview, last view is assigned:["+ce+"], current view ID is:["+Oe+"], previous view ID is:["+Le+"]");var a={name:e,visit:1,view:b.getViewUrl()};if(a=C(a,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"track_pageview",ct),this.track_domains&&(a.domain=window.location.hostname),be)if(q)Ae&&(Ae=!1,a.start=1);else{var l=St("cly_session");(!l||parseInt(l)<=x())&&(Ae=!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(Fe&&Object.keys(Fe).length)for(var u in ct(s.INFO,"track_pageview, Adding fresh utm tags to segmentation:["+JSON.stringify(Fe)+"]"),Fe)void 0===a["utm_"+u]&&(a["utm_"+u]=Fe[u]);if(m&<()&&(ct(s.INFO,"track_pageview, Adding referrer to segmentation:["+document.referrer+"]"),a.referrer=document.referrer),r)for(var h in r=C(r,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"track_pageview",ct))void 0===a[h]&&(a[h]=r[h]);this.check_consent(n.VIEWS)?Ge({key:o.VIEW,segmentation:a},Oe):Ee.track_pageview=arguments}else ct(s.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else ct(s.ERROR,"track_pageview, No page name to track (it is either undefined or empty string). No page view can be tracked.");else ct(s.WARNING,"track_pageview, window object is not available. Not tracking page views is page is not provided.")},this.track_view=function(e,t,r){ct(s.INFO,"track_view, Initiating tracking page views"),this.track_pageview(e,t,r)},this.track_clicks=function(e){if(m){ct(s.INFO,"track_clicks, Starting to track clicks"),e&&ct(s.INFO,"track_clicks, Tracking the specified children:["+e+"]"),e=e||document;var t=!0;R(e,"click",r)}else ct(s.WARNING,"track_clicks, window object is not available. Not tracking clicks.");function r(e){if(t){if(t=!1,N(e),void 0!==e.pageX&&void 0!==e.pageY){var r=j(),i=V();if(b.check_consent(n.CLICKS)){var a={type:"click",x:e.pageX,y:e.pageY,width:i,height:r,view:b.getViewUrl()};a=C(a,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"processClick",ct),b.track_domains&&(a.domain=window.location.hostname),Ge({key:o.ACTION,segmentation:a})}}setTimeout(function(){t=!0},1e3)}}},this.track_scrolls=function(e){m?(ct(s.INFO,"track_scrolls, Starting to track scrolls"),e&&ct(s.INFO,"track_scrolls, Tracking the specified children"),e=e||window,Me=!0,Re=!0,R(e,"scroll",mt),R(e,"beforeunload",gt)):ct(s.WARNING,"track_scrolls, window object is not available. Not tracking scrolls.")},this.track_links=function(e){function t(e){var t=D(O(e),"a");t&&(N(e),b.check_consent(n.CLICKS)&&Ge({key:"linkClick",segmentation:{href:t.href,text:t.innerText,id:t.id,view:b.getViewUrl()}}))}m?(ct(s.INFO,"track_links, Starting to track clicks to links"),e&&ct(s.INFO,"track_links, Tracking the specified children"),R(e=e||document,"click",t)):ct(s.WARNING,"track_links, window object is not available. Not tracking links.")},this.track_forms=function(e,t){function r(e){return e.name||e.id||e.type||e.nodeName}function i(e){var i,o=O(e),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(y(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()||t)&&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)&&Ge({key:"formSubmit",segmentation:a})}m?(ct(s.INFO,"track_forms, Starting to track form submissions. DOM object provided:["+!!e+"] Tracking hidden inputs :["+!!t+"]"),R(e=e||document,"submit",i)):ct(s.WARNING,"track_forms, window object is not available. Not tracking forms.")},this.collect_from_forms=function(e,t){function r(r){var i,n=O(r),o={},a=!1;if(void 0!==n.elements){var l,c,u={},h=e.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?y(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&&(ct(s.INFO,"collect_from_forms, Gathered user data",o),t?b.user_details({custom:o}):b.user_details(o))}m?(ct(s.INFO,"collect_from_forms, Starting to collect possible user data. DOM object provided:["+!!e+"] Submitting custom user property:["+!!t+"]"),R(e=e||document,"submit",r)):ct(s.WARNING,"collect_from_forms, window object is not available. Not collecting from forms.")},this.collect_from_facebook=function(e){m?"undefined"!=typeof FB&&FB&&FB.api?(ct(s.INFO,"collect_from_facebook, Starting to collect possible user data"),FB.api("/me",function(t){var r={};if(t.name&&(r.name=t.name),t.email&&(r.email=t.email),"male"===t.gender?r.gender="M":"female"===t.gender&&(r.gender="F"),t.birthday){var i=t.birthday.split("/").pop();i&&4===i.length&&(r.byear=i)}if(t.work&&t.work[0]&&t.work[0].employer&&t.work[0].employer.name&&(r.organization=t.work[0].employer.name),e)for(var n in r.custom={},e){for(var o=e[n].split("."),a=t,s=0;s<o.length&&void 0!==(a=a[o[s]]);s++);void 0!==a&&(r.custom[n]=a)}b.user_details(r)})):ct(s.ERROR,"collect_from_facebook, Facebook SDK is not available"):ct(s.WARNING,"collect_from_facebook, window object is not available. Not collecting from Facebook.")},this.opt_out=function(){ct(s.INFO,"opt_out, Opting out the user"),this.ignore_visitor=!0,Et("cly_ignore",!0)},this.opt_in=function(){ct(s.INFO,"opt_in, Opting in the user"),Et("cly_ignore",!1),this.ignore_visitor=!1,Ze(),this.ignore_visitor||Te||rt()},this.report_feedback=function(e){ct(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(e)},this.recordRatingWidgetWithID=function(e){if(ct(s.INFO,"recordRatingWidgetWithID, Providing information about user with ID: [ "+e.widget_id+" ]"),this.check_consent(n.STAR_RATING))if(e.widget_id)if(e.rating){var t=["widget_id","contactMe","platform","app_version","rating","email","comment"],r={key:o.STAR_RATING,count:1,segmentation:{}};r.segmentation=k(e,t),r.segmentation.app_version||(r.segmentation.app_version=this.metrics._app_version||this.app_version),r.segmentation.rating>5?(ct(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&&(ct(s.WARNING,"recordRatingWidgetWithID, You have entered a rating lower than 1. Changing it back to 1 now."),r.segmentation.rating=1),ct(s.INFO,"recordRatingWidgetWithID, Reporting Rating Widget: ",r),Ge(r)}else ct(s.ERROR,"recordRatingWidgetWithID, Rating Widget must contain rating property");else ct(s.ERROR,"recordRatingWidgetWithID, Rating Widget must contain widget_id property")},this.reportFeedbackWidgetManually=function(e,t,r){if(this.check_consent(n.FEEDBACK))if(e&&t)if(e._id)if(Se)ct(s.ERROR,"reportFeedbackWidgetManually, Feedback Widgets can not be reported in offline mode");else{ct(s.INFO,"reportFeedbackWidgetManually, Providing information about user with, provided result of the widget with ID: [ "+e._id+" ] and type: ["+e.type+"]");var i,a=[],l=e.type;if("nps"===l){if(r){if(!r.rating)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");r.rating=Math.round(r.rating),r.rating>10?(ct(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 10. Changing it back to 10 now."),r.rating=10):r.rating<0&&(ct(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 ct(s.ERROR,"reportFeedbackWidgetManually, Widget should have answers to be reported");a=Object.keys(r)}i=o.SURVEY}else{if("rating"!==l)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget has an unacceptable type");if(r){if(!r.rating)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");r.rating=Math.round(r.rating),r.rating>5?(ct(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 5. Changing it back to 5 now."),r.rating=5):r.rating<1&&(ct(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:e._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};null===r?c.segmentation.closed=1:c.segmentation=A(c.segmentation,r,a),ct(s.INFO,"reportFeedbackWidgetManually, Reporting "+l+": ",c),Ge(c)}else ct(s.ERROR,"reportFeedbackWidgetManually, Feedback Widgets must contain _id property");else ct(s.ERROR,"reportFeedbackWidgetManually, Widget data and/or Widget object not provided. Aborting.")},this.show_feedback_popup=function(e){m?(ct(s.WARNING,"show_feedback_popup, Deprecated function call! Use 'presentRatingWidgetWithID' in place of this call. Call will be redirected now!"),this.presentRatingWidgetWithID(e)):ct(s.WARNING,"show_feedback_popup, window object is not available. Not showing feedback popup.")},this.presentRatingWidgetWithID=function(e){m?(ct(s.INFO,"presentRatingWidgetWithID, Showing rating widget popup for the widget with ID: [ "+e+" ]"),this.check_consent(n.STAR_RATING)&&(Se?ct(s.ERROR,"presentRatingWidgetWithID, Cannot show ratingWidget popup in offline mode"):ut("presentRatingWidgetWithID,",this.url+"/o/feedback/widget",{widget_id:e,av:b.app_version},function(e,t,r){if(!e)try{Xe(JSON.parse(r),!1)}catch(i){ct(s.ERROR,"presentRatingWidgetWithID, JSON parse failed: "+i)}},!0))):ct(s.WARNING,"presentRatingWidgetWithID, window object is not available. Not showing rating widget popup.")},this.initialize_feedback_popups=function(e){m?(ct(s.WARNING,"initialize_feedback_popups, Deprecated function call! Use 'initializeRatingWidgets' in place of this call. Call will be redirected now!"),this.initializeRatingWidgets(e)):ct(s.WARNING,"initialize_feedback_popups, window object is not available. Not initializing feedback popups.")},this.initializeRatingWidgets=function(e){if(m){if(ct(s.INFO,"initializeRatingWidgets, Initializing rating widget with provided widget IDs:[ "+e+"]"),this.check_consent(n.STAR_RATING)){e||(e=St("cly_fb_widgets"));for(var t=document.getElementsByClassName("countly-feedback-sticker");t.length>0;)t[0].remove();ut("initializeRatingWidgets,",this.url+"/o/feedback/multiple-widgets-by-id",{widgets:JSON.stringify(e),av:b.app_version},function(e,t,r){if(!e)try{for(var i=JSON.parse(r),n=0;n<i.length;n++)if("true"===i[n].is_active&&i[n].target_devices[z()])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&&Xe(i[n],!0)}else Xe(i[n],!0)}catch(u){ct(s.ERROR,"initializeRatingWidgets, JSON parse error: "+u)}},!0)}}else ct(s.WARNING,"initializeRatingWidgets, window object is not available. Not initializing rating widgets.")},this.enable_feedback=function(e){m?(ct(s.WARNING,"enable_feedback, Deprecated function call! Use 'enableRatingWidgets' in place of this call. Call will be redirected now!"),this.enableRatingWidgets(e)):ct(s.WARNING,"enable_feedback, window object is not available. Not enabling feedback.")},this.enableRatingWidgets=function(e){if(m){if(ct(s.INFO,"enableRatingWidgets, Enabling rating widget with params:",e),this.check_consent(n.STAR_RATING))if(Se)ct(s.ERROR,"enableRatingWidgets, Cannot enable rating widgets in offline mode");else{Et("cly_fb_widgets",e.popups||e.widgets),W(this.url+"/star-rating/stylesheets/countly-feedback-web.css");var t=e.popups||e.widgets;t.length>0?(document.body.insertAdjacentHTML("beforeend",'<div id="cfbg"></div>'),this.initializeRatingWidgets(t)):ct(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 ct(s.WARNING,"enableRatingWidgets, window object is not available. Not enabling rating widgets.")},this.get_available_feedback_widgets=function(e){ct(s.INFO,"get_available_feedback_widgets, Getting the feedback list, callback function is provided:["+!!e+"]"),this.check_consent(n.FEEDBACK)?Se?ct(s.ERROR,"get_available_feedback_widgets, Cannot enable feedback widgets in offline mode."):ut("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(t,r,i){if(t)e&&e(null,t);else try{var n=JSON.parse(i).result||[];e&&e(n,null)}catch(o){ct(s.ERROR,"get_available_feedback_widgets, Error while parsing feedback widgets list: "+o),e&&e(null,o)}},!1):e&&e(null,new Error("Consent for feedback not provided."))},this.getFeedbackWidgetData=function(e,t){if(e.type)if(ct(s.INFO,"getFeedbackWidgetData, Retrieving data for: ["+JSON.stringify(e)+"], callback function is provided:["+!!t+"]"),this.check_consent(n.FEEDBACK))if(Se)ct(s.ERROR,"getFeedbackWidgetData, Cannot enable feedback widgets in offline mode.");else{var r=this.url,i={widget_id:e._id,shown:1,sdk_version:Be,sdk_name:ze,platform:this.platform,app_version:this.app_version};if("nps"===e.type)r+="/o/surveys/nps/widget";else if("survey"===e.type)r+="/o/surveys/survey/widget";else{if("rating"!==e.type)return void ct(s.ERROR,"getFeedbackWidgetData, Unknown type info: ["+e.type+"]");r+="/o/surveys/rating/widget"}ut("getFeedbackWidgetData,",r,i,o,!0)}else t&&t(null,new Error("Consent for feedback not provided."));else ct(s.ERROR,"getFeedbackWidgetData, Expected the provided widget object to have a type but got: ["+JSON.stringify(e)+"], aborting.");function o(e,r,i){if(e)t&&t(null,e);else try{var n=JSON.parse(i);t&&t(n,null)}catch(o){ct(s.ERROR,"getFeedbackWidgetData, Error while parsing feedback widgets list: "+o),t&&t(null,o)}}},this.present_feedback_widget=function(e,r,i,o){if(m){if(ct(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(e&&"object"===t(e)&&!Array.isArray(e)){ct(s.INFO,"present_feedback_widget, Adding segmentation to feedback widgets:["+JSON.stringify(o)+"]"),o&&"object"===t(o)&&0!==Object.keys(o).length||(ct(s.DEBUG,"present_feedback_widget, Segmentation is not an object or empty"),o=null);try{var a=this.url;if("nps"===e.type)ct(s.DEBUG,"present_feedback_widget, Widget type: nps."),a+="/feedback/nps";else if("survey"===e.type)ct(s.DEBUG,"present_feedback_widget, Widget type: survey."),a+="/feedback/survey";else{if("rating"!==e.type)return void ct(s.ERROR,"present_feedback_widget, Feedback widget only accepts nps, rating and survey types.");ct(s.DEBUG,"present_feedback_widget, Widget type: rating."),a+="/feedback/rating"}var l,c=window.origin||window.location.origin;if("rating"===e.type?(ct(s.DEBUG,"present_feedback_widget, Loading css for rating widget."),l="ratings",W(this.url+"/star-rating/stylesheets/countly-feedback-web.css")):(ct(s.DEBUG,"present_feedback_widget, Loading css for survey or nps."),W(this.url+"/surveys/stylesheets/countly-surveys.css"),l="surveys"),a+="?widget_id="+e._id,a+="&app_key="+this.app_key,a+="&device_id="+this.device_id,a+="&sdk_name="+ze,a+="&platform="+this.platform,a+="&app_version="+this.app_version,a+="&sdk_version="+Be,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-"+e._id).style.display="none",document.getElementById("csbg").style.display="none"),d=!0,ct(s.DEBUG,"present_feedback_widget, Loaded iframe.")};for(var p=document.getElementById("csbg");p;)p.remove(),p=document.getElementById("csbg"),ct(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(),ct(s.DEBUG,"present_feedback_widget, Removed a wrapper.");(f=document.createElement("div")).className="countly-"+l+"-wrapper",f.id="countly-"+l+"-wrapper-"+e._id,"survey"===e.type&&(f.className=f.className+" "+e.appearance.position);var y=document.body,_=!1;if(r&&(document.getElementById(r)?(y=document.getElementById(r),_=!0):ct(s.ERROR,"present_feedback_widget, Provided ID not found.")),_||i&&(document.getElementsByClassName(i)[0]?y=document.getElementsByClassName(i)[0]:ct(s.ERROR,"present_feedback_widget, Provided class not found.")),y.insertAdjacentHTML("beforeend",'<div id="csbg"></div>'),y.appendChild(f),"rating"===e.type){var v=document.createElement("div");v.className="countly-ratings-overlay",v.id="countly-ratings-overlay-"+e._id,f.appendChild(v),ct(s.DEBUG,"present_feedback_widget, appended the rating overlay to wrapper"),R(document.getElementById("countly-ratings-overlay-"+e._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+e._id).style.display="none"})}if(f.appendChild(h),ct(s.DEBUG,"present_feedback_widget, Appended the iframe"),R(window,"message",function(t){var r={};try{r=JSON.parse(t.data),ct(s.DEBUG,"present_feedback_widget, Parsed response message "+r)}catch(i){ct(s.ERROR,"present_feedback_widget, Error while parsing message body "+i)}r.close?(document.getElementById("countly-"+l+"-wrapper-"+e._id).style.display="none",document.getElementById("csbg").style.display="none"):ct(s.DEBUG,"present_feedback_widget, Closing signal not sent yet")}),"survey"===e.type){var b=!1;switch(e.showPolicy){case"afterPageLoad":"complete"===document.readyState?b||(b=!0,w(e)):R(document,"readystatechange",function(t){"complete"===t.target.readyState&&(b||(b=!0,w(e)))});break;case"afterConstantDelay":setTimeout(function(){b||(b=!0,w(e))},1e4);break;case"onAbandon":"complete"===document.readyState?R(document,"mouseleave",function(){b||(b=!0,w(e))}):R(document,"readystatechange",function(t){"complete"===t.target.readyState&&R(document,"mouseleave",function(){b||(b=!0,w(e))})});break;case"onScrollHalfwayDown":R(window,"scroll",function(){b||Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)>=j()/2&&(b=!0,w(e))});break;default:b||(b=!0,w(e))}}else if("nps"===e.type)document.getElementById("countly-"+l+"-wrapper-"+e._id).style.display="block",document.getElementById("csbg").style.display="block";else if("rating"===e.type){var x=!1;"complete"===document.readyState?x||(x=!0,T(e)):R(document,"readystatechange",function(t){"complete"===t.target.readyState&&(x||(x=!0,T(e)))})}}catch(de){ct(s.ERROR,"present_feedback_widget, Something went wrong while presenting the widget: "+de)}}else ct(s.ERROR,"present_feedback_widget, Please provide at least one feedback widget object.")}else ct(s.WARNING,"present_feedback_widget, window object is not available. Not presenting feedback widget.");function w(e){document.getElementById("countly-surveys-wrapper-"+e._id).style.display="block",document.getElementById("csbg").style.display="block"}function T(e){if(!e.appearance.hideS){ct(s.DEBUG,"present_feedback_widget, handling the sticker as it was not set to hidden");var t=document.createElement("div");t.innerText=e.appearance.text,t.style.color=e.appearance.text_color.length<7?"#"+e.appearance.text_color:e.appearance.text_color,t.style.backgroundColor=e.appearance.bg_color.length<7?"#"+e.appearance.bg_color:e.appearance.bg_color,t.className="countly-feedback-sticker "+e.appearance.position+"-"+e.appearance.size,t.id="countly-feedback-sticker-"+e._id,document.body.appendChild(t),R(document.getElementById("countly-feedback-sticker-"+e._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+e._id).style.display="flex",document.getElementById("csbg").style.display="block"})}R(document.getElementById("countly-feedback-close-icon-"+e._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+e._id).style.display="none",document.getElementById("csbg").style.display="none"})}},this.recordError=function(e,r,i){if(ct(s.INFO,"recordError, Recording error"),this.check_consent(n.CRASHES)&&e){i=i||ae;var o="";if("object"===t(e)?void 0!==e.stack?o=e.stack:(void 0!==e.name&&(o+=e.name+":"),void 0!==e.message&&(o+=e.message+"\n"),void 0!==e.fileName&&(o+="in "+e.fileName+"\n"),void 0!==e.lineNumber&&(o+="on "+e.lineNumber),void 0!==e.columnNumber&&(o+=":"+e.columnNumber)):o=e+"",o.length>b.maxStackTraceLineLength*b.maxStackTraceLinesPerThread){ct(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=st(),h={_resolution:u._resolution,_error:o,_app_version:u._app_version,_run:x()-Pe,_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()),ie.length>0&&(h._logs=ie.join("\n")),ie=[],h._nonfatal=r,h._view=this.getViewName(),void 0!==i&&(i=C(i,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"record_error",ct),h._custom=i);try{var p=document.createElement("canvas").getContext("experimental-webgl");h._opengl=p.getParameter(p.VERSION)}catch(g){ct(s.ERROR,"Could not get the experimental-webgl context: "+g)}var f={};f.crash=JSON.stringify(h),f.metrics=JSON.stringify({_ua:u._ua}),tt(f)}},this.onStorageChange=function(e,t){switch(ct(s.DEBUG,"onStorageChange, Applying storage changes for key:",e),ct(s.DEBUG,"onStorageChange, Applying storage changes for value:",t),e){case"cly_queue":ee=b.deserialize(t||"[]");break;case"cly_event":te=b.deserialize(t||"[]");break;case"cly_remote_configs":re=b.deserialize(t||"{}");break;case"cly_ignore":b.ignore_visitor=b.deserialize(t);break;case"cly_id":b.device_id=t;break;case"cly_id_type":Ce=b.deserialize(t)}},this._internals={store:Et,getDocWidth:V,getDocHeight:j,getViewportHeight:U,get_page_coord:N,get_event_target:O,add_event_listener:R,createNewObjectFromProperties:k,truncateObject:C,truncateSingleValue:M,stripTrailingSlash:P,prepareParams:I,sendXmlHttpRequest:ht,isResponseValid:pt,getInternalDeviceIdType:yt,getMsTimestamp:T,getTimestamp:x,isResponseValidBroad:ft,secureRandom:_,log:ct,checkIfLoggingIsOn:H,getMetrics:st,getUA:at,prepareRequest:et,generateUUID:v,sendEventsForced:He,isUUID:ot,isReferrerUsable:lt,getId:nt,heartBeat:rt,toRequestQueue:tt,reportViewDuration:Ye,loadJS:$,loadCSS:W,getLastView:Je,setToken:_t,getToken:vt,showLoader:Z,hideLoader:X,setValueInStorage:Et,getValueFromStorage:St,removeValueFromStorage:It,add_cly_events:Ge,processScrollView:gt,processScroll:mt,currentUserAgentString:L,currentUserAgentDataString:F,userAgentDeviceDetection:z,userAgentSearchBotDetection:B,getRequestQueue:xt,getEventQueue:bt,sendFetchRequest:dt,processAsyncQueue:it,makeNetworkRequest:ut,clearQueue:function(){ee=[],Et("cly_queue",[]),te=[],Et("cly_event",[])},getLocalQueues:function(){return{eventQ:te,requestQ:ee}}};var kt={};function At(){b.hcErrorCount++}function Ct(){b.hcWarningCount++}function Mt(){b.hcErrorCount=0,b.hcWarningCount=0,b.hcStatusCode=-1,b.hcErrorMessage=""}function Dt(e,t){b.hcStatusCode=e,b.hcErrorMessage=t,Et(h.statusCode,b.hcStatusCode),Et(h.errorMessage,b.hcErrorMessage)}function Rt(){kt.resetCounters(),Et(h.errorCount,b.hcErrorCount),Et(h.warningCount,b.hcWarningCount),Et(h.statusCode,b.hcStatusCode),Et(h.errorMessage,b.hcErrorMessage)}function Ot(){var e=M(b.hcErrorMessage,1e3,"healthCheck",ct),t={el:b.hcErrorCount,wl:b.hcWarningCount,sc:b.hcStatusCode,em:JSON.stringify(e)},r={hc:JSON.stringify(t),metrics:JSON.stringify({_app_version:b.app_version})};et(r),ut("[healthCheck]",b.url+K,r,function(e){e||kt.resetAndSaveCounters()},!0)}kt.sendInstantHCRequest=Ot,kt.resetAndSaveCounters=Rt,kt.incrementErrorCount=At,kt.incrementWarningCount=Ct,kt.resetCounters=Mt,kt.saveRequestCounters=Dt,this.initialize()}),Y=!0;function J(e){var t=document.createElement("script"),r=document.createElement("script");t.async=!0,r.async=!0,t.src=g.customSourceBoomerang||u.BOOMERANG_SRC,r.src=g.customSourceCountlyBoomerang||u.CLY_BOOMERANG_SRC,document.getElementsByTagName("head")[0].appendChild(t),document.getElementsByTagName("head")[0].appendChild(r);var i=!1,n=!1;t.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 t="BoomerangJS loaded:["+i+"], countly_boomerang loaded:["+n+"].";i&&n?(t="[DEBUG] "+t,console.log(t)):(t="[WARNING] "+t+" Initializing without APM.",console.warn(t))}g.init(e),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=K,g.init=function(e){if(e=e||{},g.loadAPMScriptsAsync&&Y)return Y=!1,void J(e);var t=e.app_key||g.app_key;if(!g.i||!g.i[t]){var r=new K(e);if(!g.i)for(var i in g.i={},r)g[i]=r[i];g.i[t]=r}return g.i[t]},g.serialize=function(e){return"object"===t(e)&&(e=JSON.stringify(e)),e},g.deserialize=function(e){if(""===e)return e;try{e=JSON.parse(e)}catch(de){H()&&console.warn("[WARNING] [Countly] deserialize, Could not parse the file:["+e+"], error: "+de)}return e},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(e){var t=(e.key+"").split("/"),r=t.pop(),i=t.pop();g.i&&g.i[i]&&g.i[i].onStorageChange(r,e.newValue)}),e.default=g,Object.defineProperty(e,"__esModule",{value:!0})}(t)},565:t=>{t.exports=e},916:function(e){!function(t,r){e.exports=r()}(0,()=>{return e={276:function(){!function(e){e.console||(e.console={});for(var t,r,i=e.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(",");t=o.pop();)i[t]||(i[t]={});for(;r=a.pop();)i[r]||(i[r]=n)}("undefined"==typeof window?this:window)},180:function(e,t,r){var i,n,o;n=[r(124)],void 0===(o="function"==typeof(i=function(e){var t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var r=t.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 e({functionName:a,fileName:s,lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e({functionName:t});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(r),n=i&&i[1]?i[1]:void 0,o=this.extractLocation(t.replace(r,""));return new e({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],o=2,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],o=0,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({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(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.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 e({functionName:a,args:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:t})},this)}}})?i.apply(t,n):i)||(e.exports=o)},124:function(e,t){var r,i;void 0===(i="function"==typeof(r=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=i.concat(n,o,["args"],["evalOrigin"]);function s(e){if(e)for(var r=0;r<a.length;r++)void 0!==e[a[r]]&&this["set"+t(a[r])](e[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:i?i+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},s.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),i=e.substring(0,t),n=e.substring(t+1,r).split(","),o=e.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"+t(i[l])]=r(i[l]),s.prototype["set"+t(i[l])]=function(e){return function(t){this[e]=Boolean(t)}}(i[l]);for(var c=0;c<n.length;c++)s.prototype["get"+t(n[c])]=r(n[c]),s.prototype["set"+t(n[c])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+t(o[u])]=r(o[u]),s.prototype["set"+t(o[u])]=function(e){return function(t){this[e]=String(t)}}(o[u]);return s})?r.apply(t,[]):r)||(e.exports=i)},815:(e,t,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(e,t,r,i,n){this.options=e,this.transport=t,this.url=r,this.truncation=i,this.jsonBackup=n,this.accessToken=e.accessToken,this.transportOptions=s(e,r)}function s(e,t){return n.getTransportFromOptions(e,o,t)}a.prototype.postItem=function(e,t){var r=n.transportOptions(this.transportOptions,"POST"),i=n.buildPayload(this.accessToken,e,this.jsonBackup),o=this;setTimeout(function(){o.transport.post(o.accessToken,r,i,t)},0)},a.prototype.buildJsonPayload=function(e,t){var r,o=n.buildPayload(this.accessToken,e,this.jsonBackup);return(r=this.truncation?this.truncation.truncate(o):i.stringify(o)).error?(t&&t(r.error),null):r.value},a.prototype.postJsonPayload=function(e,t){var r=n.transportOptions(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,e,t)},a.prototype.configure=function(e){var t=this.oldOptions;return this.options=i.merge(t,e),this.transportOptions=s(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this},e.exports=a},817:(e,t,r)=>{var i=r(702);e.exports={buildPayload:function(e,t,r){if(!i.isType(t.context,"string")){var n=i.stringify(t.context,r);n.error?t.context="Error: could not serialize 'context'":t.context=n.value||"",t.context.length>255&&(t.context=t.context.substr(0,255))}return{access_token:e,data:t}},getTransportFromOptions:function(e,t,r){var i=t.hostname,n=t.protocol,o=t.port,a=t.path,s=t.search,l=e.timeout,c=function(e){var t="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=e.defaultTransport||"xhr";return void 0===t.fetch&&(r="xhr"),void 0===t.XMLHttpRequest&&(r="fetch"),r}(e),u=e.proxy;if(e.endpoint){var h=r.parse(e.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(e,t){var r=e.protocol||"https:",i=e.port||("http:"===r?80:"https:"===r?443:void 0),n=e.hostname,o=e.path,a=e.timeout,s=e.transport;return e.search&&(o+=e.search),e.proxy&&(o=r+"//"+n+o,n=e.proxy.host||e.proxy.hostname,i=e.proxy.port,r=e.proxy.protocol||r),{timeout:a,protocol:r,hostname:n,path:o,port:i,method:t,transport:s}},appendPathToPath:function(e,t){var r=/\/$/.test(e),i=/^\//.test(t);return r&&i?t=t.substring(1):r||i||(t="/"+t),e+t}}},409:(e,t,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);e.exports=i},403:(e,t,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(e,t){this.options=n.handleOptions(w,e,null,a),this.options._configuredOptions=e;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),y=new o(this.options,g,c,m);r&&(this.telemeter=new r(this.options)),this.client=t||new i(this.options,y,a,this.telemeter,"browser");var _=v(),b="undefined"!=typeof document&&document;this.isChrome=_.chrome&&_.chrome.runtime,this.anonymousErrorsPending=0,function(e,t,r){e.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(t.scrub)).addTransform(h.addPayloadOptions).addTransform(h.userTransform(a)).addTransform(h.addConfiguredOptions).addTransform(h.addDiagnosticKeys).addTransform(h.itemToPayload)}(this.client.notifier,this,_),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,_,b),this.instrumenter.instrument()),n.setupJSON(f),this.rollbar=this}var g=null;function y(e){var t="Rollbar is not initialized";a.error(t),e&&e(new Error(t))}function _(e){for(var t=0,r=e.length;t<r;++t)if(n.isFunction(e[t]))return e[t]}function v(){return"undefined"!=typeof window&&window||"undefined"!=typeof self&&self}m.init=function(e,t){return g?g.global(e).configure(e):g=new m(e,t)},m.prototype.components={},m.setComponents=function(e){m.prototype.components=e},m.prototype.global=function(e){return this.client.global(e),this},m.global=function(e){if(g)return g.global(e);y()},m.prototype.configure=function(e,t){var r=this.options,i={};return t&&(i={payload:t}),this.options=n.handleOptions(r,e,i,a),this.options._configuredOptions=n.handleOptions(r._configuredOptions,e,i),this.client.configure(this.options,t),this.instrumenter&&this.instrumenter.configure(this.options),this.setupUnhandledCapture(),this},m.configure=function(e,t){if(g)return g.configure(e,t);y()},m.prototype.lastError=function(){return this.client.lastError},m.lastError=function(){if(g)return g.lastError();y()},m.prototype.log=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.log(e),{uuid:t}},m.log=function(){if(g)return g.log.apply(g,arguments);y(_(arguments))},m.prototype.debug=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.debug(e),{uuid:t}},m.debug=function(){if(g)return g.debug.apply(g,arguments);y(_(arguments))},m.prototype.info=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.info(e),{uuid:t}},m.info=function(){if(g)return g.info.apply(g,arguments);y(_(arguments))},m.prototype.warn=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warn(e),{uuid:t}},m.warn=function(){if(g)return g.warn.apply(g,arguments);y(_(arguments))},m.prototype.warning=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warning(e),{uuid:t}},m.warning=function(){if(g)return g.warning.apply(g,arguments);y(_(arguments))},m.prototype.error=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.error(e),{uuid:t}},m.error=function(){if(g)return g.error.apply(g,arguments);y(_(arguments))},m.prototype.critical=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.critical(e),{uuid:t}},m.critical=function(){if(g)return g.critical.apply(g,arguments);y(_(arguments))},m.prototype.buildJsonPayload=function(e){return this.client.buildJsonPayload(e)},m.buildJsonPayload=function(){if(g)return g.buildJsonPayload.apply(g,arguments);y()},m.prototype.sendJsonPayload=function(e){return this.client.sendJsonPayload(e)},m.sendJsonPayload=function(){if(g)return g.sendJsonPayload.apply(g,arguments);y()},m.prototype.setupUnhandledCapture=function(){var e=v();this.unhandledExceptionsInitialized||(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(s.captureUncaughtExceptions(e,this),this.wrapGlobals&&this.options.wrapGlobalEventHandlers&&this.wrapGlobals(e,this),this.unhandledExceptionsInitialized=!0),this.unhandledRejectionsInitialized||(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&(s.captureUnhandledRejections(e,this),this.unhandledRejectionsInitialized=!0)},m.prototype.handleUncaughtException=function(e,t,r,i,o,a){if(this.options.captureUncaught||this.options.handleUncaughtExceptions){if(this.options.inspectAnonymousErrors&&this.isChrome&&null===o&&""===t)return"anonymous";var s,l=n.makeUnhandledStackInfo(e,t,r,i,o,"onerror","uncaught exception",f);n.isError(o)?(s=this._createItem([e,o,a]))._unhandledStackInfo=l:n.isError(t)?(s=this._createItem([e,t,a]))._unhandledStackInfo=l:(s=this._createItem([e,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 e=this;try{Error.prepareStackTrace=function(t,r){if(e.options.inspectAnonymousErrors&&e.anonymousErrorsPending){if(e.anonymousErrorsPending-=1,!t)return;t._isAnonymous=!0,e.handleUncaughtException(t.message,null,null,null,t)}return t.stack}}catch(e){this.options.inspectAnonymousErrors=!1,this.error("anonymous error handler failed",e)}}},m.prototype.handleUnhandledRejection=function(e,t){if(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections){var r="unhandled rejection was null or undefined!";if(e)if(e.message)r=e.message;else{var i=n.stringify(e);i.value&&(r=i.value)}var o,a=e&&e._rollbarContext||t&&t._rollbarContext;n.isError(e)?o=this._createItem([r,e,a]):(o=this._createItem([r,e,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(t),this.client.log(o)}},m.prototype.wrap=function(e,t,r){try{var i;if(i=n.isFunction(t)?t:function(){return t||{}},!n.isFunction(e))return e;if(e._isWrap)return e;if(!e._rollbar_wrapped&&(e._rollbar_wrapped=function(){r&&n.isFunction(r)&&r.apply(this,arguments);try{return e.apply(this,arguments)}catch(r){var t=r;throw t&&window._rollbarWrappedError!==t&&(n.isType(t,"string")&&(t=new String(t)),t._rollbarContext=i()||{},t._rollbarContext._wrappedSource=e.toString(),window._rollbarWrappedError=t),t}},e._rollbar_wrapped._isWrap=!0,e.hasOwnProperty))for(var o in e)e.hasOwnProperty(o)&&"_rollbar_wrapped"!==o&&(e._rollbar_wrapped[o]=e[o]);return e._rollbar_wrapped}catch(t){return e}},m.wrap=function(e,t){if(g)return g.wrap(e,t);y()},m.prototype.captureEvent=function(){var e=n.createTelemetryEvent(arguments);return this.client.captureEvent(e.type,e.metadata,e.level)},m.captureEvent=function(){if(g)return g.captureEvent.apply(g,arguments);y()},m.prototype.captureDomContentLoaded=function(e,t){return t||(t=new Date),this.client.captureDomContentLoaded(t)},m.prototype.captureLoad=function(e,t){return t||(t=new Date),this.client.captureLoad(t)},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(e){return n.createItem(e,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};e.exports=m},677:e=>{e.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:e=>{var t={ieVersion:function(){var e;if("undefined"==typeof document)return e;for(var t=3,r=document.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",i[0];);return t>4?t:e}};e.exports=t},300:e=>{function t(e){return(e.getAttribute("type")||"").toLowerCase()}function r(e){if(!e||!e.tagName)return"";var t=[e.tagName];e.id&&t.push("#"+e.id),e.classes&&t.push("."+e.classes.join("."));for(var r=0;r<e.attributes.length;r++)t.push("["+e.attributes[r].key+'="'+e.attributes[r].value+'"]');return t.join("")}function i(e){if(!e||!e.tagName)return null;var t,r,i,n,o={};o.tagName=e.tagName.toLowerCase(),e.id&&(o.id=e.id),(t=e.className)&&"string"==typeof t&&(o.classes=t.split(/\s+/));var a=["type","name","title","alt"];for(o.attributes=[],n=0;n<a.length;n++)r=a[n],(i=e.getAttribute(r))&&o.attributes.push({key:r,value:i});return o}e.exports={describeElement:i,descriptionToString:r,elementArrayToString:function(e){for(var t,i,n=[],o=0,a=e.length-1;a>=0;a--){if(t=r(e[a]),i=o+3*n.length+t.length,a<e.length-1&&i>=83){n.unshift("...");break}n.unshift(t),o+=t.length}return n.join(" > ")},treeToArray:function(e){for(var t,r=[],n=0;e&&n<5&&"html"!==(t=i(e)).tagName;n++)r.unshift(t),e=e.parentNode;return r},getElementFromEvent:function(e,t){return e.target?e.target:t&&t.elementFromPoint?t.elementFromPoint(e.clientX,e.clientY):void 0},isDescribedElement:function(e,r,i){if(e.tagName.toLowerCase()!==r.toLowerCase())return!1;if(!i)return!0;e=t(e);for(var n=0;n<i.length;n++)if(i[n]===e)return!0;return!1},getElementType:t}},349:e=>{e.exports={captureUncaughtExceptions:function(e,t,r){if(e){var i;if("function"==typeof t._rollbarOldOnError)i=t._rollbarOldOnError;else if(e.onerror){for(i=e.onerror;i._rollbarOldOnError;)i=i._rollbarOldOnError;t._rollbarOldOnError=i}t.handleAnonymousErrors();var n=function(){var r=Array.prototype.slice.call(arguments,0);!function(e,t,r,i){e._rollbarWrappedError&&(i[4]||(i[4]=e._rollbarWrappedError),i[5]||(i[5]=e._rollbarWrappedError._rollbarContext),e._rollbarWrappedError=null);var n=t.handleUncaughtException.apply(t,i);r&&r.apply(e,i),"anonymous"===n&&(t.anonymousErrorsPending+=1)}(e,t,i,r)};r&&(n._rollbarOldOnError=i),e.onerror=n}},captureUnhandledRejections:function(e,t,r){if(e){"function"==typeof e._rollbarURH&&e._rollbarURH.belongsToShim&&e.removeEventListener("unhandledrejection",e._rollbarURH);var i=function(e){var r,i,n;try{r=e.reason}catch(e){r=void 0}try{i=e.promise}catch(e){i="[unhandledrejection] error getting `promise` from event"}try{n=e.detail,!r&&n&&(r=n.reason,i=n.promise)}catch(e){}r||(r="[unhandledrejection] error getting `reason` from event"),t&&t.handleUnhandledRejection&&t.handleUnhandledRejection(r,i)};i.belongsToShim=r,e._rollbarURH=i,e.addEventListener("unhandledrejection",i)}}}},802:(e,t,r)=>{r(276);var i=r(616),n=r(702);e.exports={error:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.error(n.formatArgsAsString(e)):console.error.apply(console,e)},info:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.info(n.formatArgsAsString(e)):console.info.apply(console,e)},log:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.log(n.formatArgsAsString(e)):console.log.apply(console,e)}}},172:(e,t,r)=>{var i=r(702);e.exports={checkIgnore:function(e,t){return!i.get(t,"plugins.jquery.ignoreAjaxErrors")||!i.get(e,"body.message.extra.isAjax")}}},343:(e,t,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}),e.exports=i},568:(e,t,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(e,t){for(var r;e[t].length;)(r=e[t].shift())[0][r[1]]=r[2]}function h(e,t,r,n,o){this.options=e;var a=e.autoInstrument;!1===e.enabled||!1===a?this.autoInstrument={}:(i.isType(a,"object")||(a=c),this.autoInstrument=i.merge(c,a)),this.scrubTelemetryInputs=!!e.scrubTelemetryInputs,this.telemetryScrubber=e.telemetryScrubber,this.defaultValueScrubber=function(e){for(var t=[],r=0;r<e.length;++r)t.push(new RegExp(e[r],"i"));return function(e){var r=function(e){if(!e||!e.attributes)return null;for(var t=e.attributes,r=0;r<t.length;++r)if("name"===t[r].key)return t[r].value;return null}(e);if(!r)return!1;for(var i=0;i<t.length;++i)if(t[i].test(r))return!0;return!1}}(e.scrubFields),this.telemeter=t,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(e){return"undefined"!=typeof URL&&e instanceof URL}h.prototype.configure=function(e){this.options=i.merge(this.options,e);var t=e.autoInstrument,r=i.merge(this.autoInstrument);!1===e.enabled||!1===t?this.autoInstrument={}:(i.isType(t,"object")||(t=c),this.autoInstrument=i.merge(c,t)),this.instrument(r),void 0!==e.scrubTelemetryInputs&&(this.scrubTelemetryInputs=!!e.scrubTelemetryInputs),void 0!==e.telemetryScrubber&&(this.telemetryScrubber=e.telemetryScrubber)},h.prototype.instrument=function(e){!this.autoInstrument.network||e&&e.network?!this.autoInstrument.network&&e&&e.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||e&&e.log?!this.autoInstrument.log&&e&&e.log&&this.deinstrumentConsole():this.instrumentConsole(),!this.autoInstrument.dom||e&&e.dom?!this.autoInstrument.dom&&e&&e.dom&&this.deinstrumentDom():this.instrumentDom(),!this.autoInstrument.navigation||e&&e.navigation?!this.autoInstrument.navigation&&e&&e.navigation&&this.deinstrumentNavigation():this.instrumentNavigation(),!this.autoInstrument.connectivity||e&&e.connectivity?!this.autoInstrument.connectivity&&e&&e.connectivity&&this.deinstrumentConnectivity():this.instrumentConnectivity(),!this.autoInstrument.contentSecurityPolicy||e&&e.contentSecurityPolicy?!this.autoInstrument.contentSecurityPolicy&&e&&e.contentSecurityPolicy&&this.deinstrumentContentSecurityPolicy():this.instrumentContentSecurityPolicy()},h.prototype.deinstrumentNetwork=function(){u(this.replacements,"network")},h.prototype.instrumentNetwork=function(){var e=this;function t(t,r){t in r&&i.isFunction(r[t])&&o(r,t,function(t){return e.rollbar.wrap(t)})}if("XMLHttpRequest"in this._window){var r=this._window.XMLHttpRequest.prototype;o(r,"open",function(e){return function(t,r){var n=d(r);return(i.isType(r,"string")||n)&&(r=n?r.toString():r,this.__rollbar_xhr?(this.__rollbar_xhr.method=t,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:t,url:r,status_code:null,start_time_ms:i.now(),end_time_ms:null}),e.apply(this,arguments)}},this.replacements,"network"),o(r,"setRequestHeader",function(t){return function(r,n){return this.__rollbar_xhr||(this.__rollbar_xhr={}),i.isType(r,"string")&&i.isType(n,"string")&&(e.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)),t.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,e.autoInstrument.networkRequestBody&&(a.__rollbar_xhr.request=n),a.__rollbar_event=e.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 t=null;if(a.__rollbar_xhr.response_content_type=a.getResponseHeader("Content-Type"),e.autoInstrument.networkResponseHeaders){var r=e.autoInstrument.networkResponseHeaders;t={};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(": "),t[o]=u}}else for(s=0;s<r.length;s++)t[o=r[s]]=a.getResponseHeader(o)}catch(e){}}var d=null;if(e.autoInstrument.networkResponseBody)try{d=a.responseText}catch(e){}var p=null;(d||t)&&(p={},d&&(e.isJsonContentType(a.__rollbar_xhr.response_content_type)?p.body=e.scrubJson(d):p.body=d),t&&(p.headers=t)),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=e.telemeter.levelFromStatus(f),e.errorOnHttpStatus(a.__rollbar_xhr)}catch(e){}}}return t("onload",a),t("onerror",a),t("onprogress",a),"onreadystatechange"in a&&i.isFunction(a.onreadystatechange)?o(a,"onreadystatechange",function(t){return e.rollbar.wrap(t,void 0,s)}):a.onreadystatechange=s,a.__rollbar_xhr&&e.trackHttpErrors()&&(a.__rollbar_xhr.stack=(new Error).stack),r.apply(this,arguments)}},this.replacements,"network")}"fetch"in this._window&&o(this._window,"fetch",function(t){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"),e.autoInstrument.networkRequestHeaders&&(f.request_headers=e.fetchHeaders(m,e.autoInstrument.networkRequestHeaders))}return e.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)),e.captureNetwork(f,"fetch",void 0),e.trackHttpErrors()&&(f.stack=(new Error).stack),t.apply(this,a).then(function(t){f.end_time_ms=i.now(),f.status_code=t.status,f.response_content_type=t.headers.get("Content-Type");var r=null;e.autoInstrument.networkResponseHeaders&&(r=e.fetchHeaders(t.headers,e.autoInstrument.networkResponseHeaders));var n=null;return e.autoInstrument.networkResponseBody&&"function"==typeof t.text&&(n=t.clone().text()),(r||n)&&(f.response={},n&&("function"==typeof n.then?n.then(function(t){t&&e.isJsonContentType(f.response_content_type)?f.response.body=e.scrubJson(t):f.response.body=t}):f.response.body=n),r&&(f.response.headers=r)),e.errorOnHttpStatus(f),t})}},this.replacements,"network")},h.prototype.captureNetwork=function(e,t,r){return e.request&&this.isJsonContentType(e.request_content_type)&&(e.request=this.scrubJson(e.request)),this.telemeter.captureNetwork(e,t,r)},h.prototype.isJsonContentType=function(e){return!!(e&&i.isType(e,"string")&&e.toLowerCase().includes("json"))},h.prototype.scrubJson=function(e){return JSON.stringify(a(JSON.parse(e),this.options.scrubFields))},h.prototype.fetchHeaders=function(e,t){var r={};try{var i;if(!0===t){if("function"==typeof e.entries)for(var n=e.entries(),o=n.next();!o.done;)r[o.value[0]]=o.value[1],o=n.next()}else for(i=0;i<t.length;i++){var a=t[i];r[a]=e.get(a)}}catch(e){}return r},h.prototype.trackHttpErrors=function(){return this.autoInstrument.networkErrorOnHttp5xx||this.autoInstrument.networkErrorOnHttp4xx||this.autoInstrument.networkErrorOnHttp0},h.prototype.errorOnHttpStatus=function(e){var t=e.status_code;if(t>=500&&this.autoInstrument.networkErrorOnHttp5xx||t>=400&&this.autoInstrument.networkErrorOnHttp4xx||0===t&&this.autoInstrument.networkErrorOnHttp0){var r=new Error("HTTP request failed with Status "+t);r.stack=e.stack,this.rollbar.error(r,{skipFrames:1})}},h.prototype.deinstrumentConsole=function(){if("console"in this._window&&this._window.console.log)for(var e;this.replacements.log.length;)e=this.replacements.log.shift(),this._window.console[e[0]]=e[1]},h.prototype.instrumentConsole=function(){if("console"in this._window&&this._window.console.log){var e=this,t=this._window.console,r=["debug","info","warn","error","log"];try{for(var n=0,o=r.length;n<o;n++)a(r[n])}catch(e){this.diagnostic.instrumentConsole={error:e.message}}}function a(r){var n=t[r],o=t,a="warn"===r?"warning":r;t[r]=function(){var t=Array.prototype.slice.call(arguments),r=i.formatArgsAsString(t);e.telemeter.captureLog(r,a),n&&Function.prototype.apply.call(n,o,t)},e.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 e=this.handleClick.bind(this),t=this.handleBlur.bind(this);this.addListener("dom",this._window,"click","onclick",e,!0),this.addListener("dom",this._window,"blur","onfocusout",t,!0)}},h.prototype.handleClick=function(e){try{var t=l.getElementFromEvent(e,this._document),r=t&&t.tagName,i=l.isDescribedElement(t,"a")||l.isDescribedElement(t,"button");r&&(i||l.isDescribedElement(t,"input",["button","submit"]))?this.captureDomEvent("click",t):l.isDescribedElement(t,"input",["checkbox","radio"])&&this.captureDomEvent("input",t,t.value,t.checked)}catch(e){}},h.prototype.handleBlur=function(e){try{var t=l.getElementFromEvent(e,this._document);t&&t.tagName&&(l.isDescribedElement(t,"textarea")?this.captureDomEvent("input",t,t.value):l.isDescribedElement(t,"select")&&t.options&&t.options.length?this.handleSelectInputChanged(t):l.isDescribedElement(t,"input")&&!l.isDescribedElement(t,"input",["button","submit","hidden","checkbox","radio"])&&this.captureDomEvent("input",t,t.value))}catch(e){}},h.prototype.handleSelectInputChanged=function(e){if(e.multiple)for(var t=0;t<e.options.length;t++)e.options[t].selected&&this.captureDomEvent("input",e,e.options[t].value);else e.selectedIndex>=0&&e.options[e.selectedIndex]&&this.captureDomEvent("input",e,e.options[e.selectedIndex].value)},h.prototype.captureDomEvent=function(e,t,r,i){if(void 0!==r)if(this.scrubTelemetryInputs||"password"===l.getElementType(t))r="[scrubbed]";else{var n=l.describeElement(t);this.telemetryScrubber?this.telemetryScrubber(n)&&(r="[scrubbed]"):this.defaultValueScrubber(n)&&(r="[scrubbed]")}var o=l.elementArrayToString(l.treeToArray(t));this.telemeter.captureDom(e,o,r,i)},h.prototype.deinstrumentNavigation=function(){var e=this._window.chrome;!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState&&u(this.replacements,"navigation")},h.prototype.instrumentNavigation=function(){var e=this._window.chrome;if(!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState){var t=this;o(this._window,"onpopstate",function(e){return function(){var r=t._location.href;t.handleUrlChange(t._lastHref,r),e&&e.apply(this,arguments)}},this.replacements,"navigation"),o(this._window.history,"pushState",function(e){return function(){var r=arguments.length>2?arguments[2]:void 0;return r&&t.handleUrlChange(t._lastHref,r+""),e.apply(this,arguments)}},this.replacements,"navigation")}},h.prototype.handleUrlChange=function(e,t){var r=s.parse(this._location.href),i=s.parse(t),n=s.parse(e);this._lastHref=t,r.protocol===i.protocol&&r.host===i.host&&(t=i.path+(i.hash||"")),r.protocol===n.protocol&&r.host===n.host&&(e=n.path+(n.hash||"")),this.telemeter.captureNavigation(e,t)},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 e=this;o(this._document.body,"ononline",function(t){return function(){e.telemeter.captureConnectivityChange("online"),t&&t.apply(this,arguments)}},this.replacements,"connectivity"),o(this._document.body,"onoffline",function(t){return function(){e.telemeter.captureConnectivityChange("offline"),t&&t.apply(this,arguments)}},this.replacements,"connectivity")}},h.prototype.handleCspEvent=function(e){var t="Security Policy Violation: blockedURI: "+e.blockedURI+", violatedDirective: "+e.violatedDirective+", effectiveDirective: "+e.effectiveDirective+", ";e.sourceFile&&(t+="location: "+e.sourceFile+", line: "+e.lineNumber+", col: "+e.columnNumber+", "),t+="originalPolicy: "+e.originalPolicy,this.telemeter.captureLog(t,"error"),this.handleCspError(t)},h.prototype.handleCspError=function(e){this.autoInstrument.errorOnContentSecurityPolicy&&this.rollbar.error(e)},h.prototype.deinstrumentContentSecurityPolicy=function(){"addEventListener"in this._document&&this.removeListeners("contentsecuritypolicy")},h.prototype.instrumentContentSecurityPolicy=function(){if("addEventListener"in this._document){var e=this.handleCspEvent.bind(this);this.addListener("contentsecuritypolicy",this._document,"securitypolicyviolation",null,e,!1)}},h.prototype.addListener=function(e,t,r,i,n,o){t.addEventListener?(t.addEventListener(r,n,o),this.eventRemovers[e].push(function(){t.removeEventListener(r,n,o)})):i&&(t.attachEvent(i,n),this.eventRemovers[e].push(function(){t.detachEvent(i,n)}))},h.prototype.removeListeners=function(e){for(;this.eventRemovers[e].length;)this.eventRemovers[e].shift()()},e.exports=h},860:(e,t,r)=>{var i=r(702),n=r(303),o=r(802);function a(e,t,r){var n=e.message,o=e.custom;n||(n="Item sent with null or missing arguments.");var a={body:n};o&&(a.extra=i.merge(o)),i.set(e,"data.body",{message:a}),r(null,e)}function s(e){var t=e.stackInfo.stack;return t&&0===t.length&&e._unhandledStackInfo&&e._unhandledStackInfo.stack&&(t=e._unhandledStackInfo.stack),t}function l(e,t,r){var o=e&&e.data.description,a=e&&e.custom,l=s(e),u=n.guessErrorClass(t.message),h={exception:{class:c(t,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=t.rawStack,h.exception.raw=String(t.rawException)),h.frames=[],_=0;_<l.length;++_)p={filename:(d=l[_]).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,(y=d.context?d.context.length:0)&&(v=Math.floor(y/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(e,t,r){return e.name?e.name:r.guessErrorClass?t:"(unknown)"}e.exports={handleDomException:function(e,t,r){if(e.err&&"DOMException"===n.Stack(e.err).name){var i=new Error;i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack,i.nested=e.err,e.err=i}r(null,e)},handleItemWithError:function(e,t,r){if(e.data=e.data||{},e.err)try{e.stackInfo=e.err._savedStackTrace||n.parse(e.err,e.skipFrames),t.addErrorContext&&function(e){var t=[],r=e.err;for(t.push(r);r.nested||r.cause;)r=r.nested||r.cause,t.push(r);i.addErrorContext(e,t)}(e)}catch(t){o.error("Error while parsing the error object.",t);try{e.message=e.err.message||e.err.description||e.message||String(e.err)}catch(t){e.message=String(e.err)||String(t)}delete e.err}r(null,e)},ensureItemHasSomethingToSay:function(e,t,r){e.message||e.stackInfo||e.custom||r(new Error("No message, stack info, or custom data"),null),r(null,e)},addBaseInfo:function(e,t,r){var n=t.payload&&t.payload.environment||t.environment;e.data=i.merge(e.data,{environment:n,level:e.level,endpoint:t.endpoint,platform:"browser",framework:"browser-js",language:"javascript",server:{},uuid:e.uuid,notifier:{name:"rollbar-browser-js",version:t.version},custom:e.custom}),r(null,e)},addRequestInfo:function(e){return function(t,r,n){var o={};e&&e.location&&(o.url=e.location.href,o.query_string=e.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(t,"data.request",o),n(null,t)}},addClientInfo:function(e){return function(t,r,n){if(!e)return n(null,t);var o=e.navigator||{},a=e.screen||{};i.set(t,"data.client",{runtime_ms:t.timestamp-e._rollbarStartTime,timestamp:Math.round(t.timestamp/1e3),javascript:{browser:o.userAgent,language:o.language,cookie_enabled:o.cookieEnabled,screen:{width:a.width,height:a.height}}}),n(null,t)}},addPluginInfo:function(e){return function(t,r,n){if(!e||!e.navigator)return n(null,t);for(var o,a=[],s=e.navigator.plugins||[],l=0,c=s.length;l<c;++l)o=s[l],a.push({name:o.name,description:o.description});i.set(t,"data.client.javascript.plugins",a),n(null,t)}},addBody:function(e,t,r){e.stackInfo?e.stackInfo.traceChain?function(e,t,r){for(var n=e.stackInfo.traceChain,o=[],a=n.length,s=0;s<a;s++){var c=l(e,n[s],t);o.push(c)}i.set(e,"data.body",{trace_chain:o}),r(null,e)}(e,t,r):function(e,t,r){if(s(e)){var o=l(e,e.stackInfo,t);i.set(e,"data.body",{trace:o}),r(null,e)}else{var u=e.stackInfo,h=n.guessErrorClass(u.message),d=c(u,h[0],t),p=h[1];e.message=d+": "+p,a(e,0,r)}}(e,t,r):a(e,0,r)},addScrubber:function(e){return function(t,r,i){if(e){var n=r.scrubFields||[],o=r.scrubPaths||[];t.data=e(t.data,n,o)}i(null,t)}}}},477:(e,t,r)=>{var i=r(702),n=r(656),o=r(86);function a(e){this.truncation=e}a.prototype.get=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){}),i.addParamsAndAccessTokenToPath(e,t,r);var a=i.formatUrl(t);this._makeZoneRequest(e,a,"GET",null,n,o,t.timeout,t.transport)},a.prototype.post=function(e,t,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(t);this._makeZoneRequest(e,l,"POST",s,n,o,t.timeout,t.transport)},a.prototype.postJsonPayload=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){});var a=i.formatUrl(t);this._makeZoneRequest(e,a,"POST",r,n,o,t.timeout,t.transport)},a.prototype._makeZoneRequest=function(){var e="undefined"!=typeof window&&window||void 0!==n&&n,t=e&&e.Zone&&e.Zone.current,r=Array.prototype.slice.call(arguments);if(t&&"angular"===t._name){var i=t._parent,n=this;i.run(function(){n._makeRequest.apply(void 0,r)})}else this._makeRequest.apply(void 0,r)},a.prototype._makeRequest=function(e,t,r,i,a,s,l,c){if("undefined"!=typeof RollbarProxy)return function(e,t){(new RollbarProxy).sendJsonPayload(e,function(e){},function(e){t(new Error(e))})}(i,a);"fetch"===c?n(e,t,r,i,a,l):o(e,t,r,i,a,s,l)},e.exports=a},656:(e,t,r)=>{var i=r(802),n=r(702);e.exports=function(e,t,r,o,a,s){var l,c;n.isFiniteNumber(s)&&(l=new AbortController,c=setTimeout(function(){l.abort()},s)),fetch(t,{method:r,headers:{"Content-Type":"application/json","X-Rollbar-Access-Token":e,signal:l&&l.signal},body:o}).then(function(e){return c&&clearTimeout(c),e.json()}).then(function(e){a(null,e)}).catch(function(e){i.error(e.message),a(e)})}},86:(e,t,r)=>{var i=r(702),n=r(802);function o(e,t){var r=new Error(e);return r.code=t||"ENOTFOUND",r}e.exports=function(e,t,r,a,s,l,c){var u;if(!(u=l?l():function(){var e,t,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(t=0;t<i;t++)try{e=r[t]();break}catch(e){}return e}()))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 e=i.jsonParse(u.responseText);if((a=u)&&a.status&&200===a.status)return void s(e.error,e.value);if(function(e){return e&&i.isType(e.status,"number")&&e.status>=400&&e.status<600}(u)){if(403===u.status){var t=e.value&&e.value.message;n.error(t)}s(new Error(String(u.status)))}else s(o("XHR response had no status code (likely connection failure)"))}}catch(e){var r;r=e&&e.stack?e:new Error(e),s(r)}var a};u.open(r,t,!0),u.setRequestHeader&&(u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("X-Rollbar-Access-Token",e)),i.isFiniteNumber(c)&&(u.timeout=c),u.onreadystatechange=h,u.send(a)}catch(e){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"===t.substring(0,5)&&(t="http"+t.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 e=i.jsonParse(d.responseText);s(e.error,e.value)},d.open(r,t,!0),d.send(a)}else s(new Error("Cannot find a method to transport a request"))}}catch(e){s(e)}}},509:e=>{e.exports={parse:function(e){var t,r,i={protocol:null,auth:null,host:null,path:null,hash:null,href:e,hostname:null,port:null,pathname:null,search:null,query:null};if(-1!==(t=e.indexOf("//"))?(i.protocol=e.substring(0,t),r=t+2):r=0,-1!==(t=e.indexOf("@",r))&&(i.auth=e.substring(r,t),r=t+1),-1===(t=e.indexOf("/",r))){if(-1===(t=e.indexOf("?",r)))return-1===(t=e.indexOf("#",r))?i.host=e.substring(r):(i.host=e.substring(r,t),i.hash=e.substring(t)),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),i;i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t}else i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t;if(-1===(t=e.indexOf("#",r))?i.path=e.substring(r):(i.path=e.substring(r,t),i.hash=e.substring(t)),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:e=>{function t(e,t,r){if(t.hasOwnProperty&&t.hasOwnProperty("addEventListener")){for(var i=t.addEventListener;i._rollbarOldAdd&&i.belongsToShim;)i=i._rollbarOldAdd;var n=function(t,r,n){i.call(this,t,e.wrap(r),n)};n._rollbarOldAdd=i,n.belongsToShim=r,t.addEventListener=n;for(var o=t.removeEventListener;o._rollbarOldRemove&&o.belongsToShim;)o=o._rollbarOldRemove;var a=function(e,t,r){o.call(this,e,t&&t._rollbar_wrapped||t,r)};a._rollbarOldRemove=o,a.belongsToShim=r,t.removeEventListener=a}}e.exports=function(e,r,i){if(e){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)e[o=a[n]]&&e[o].prototype&&t(r,e[o].prototype,i)}}},948:e=>{e.exports={version:"2.26.4",endpoint:"api.rollbar.com/api/1/item/",logLevel:"debug",reportLevel:"debug",uncaughtErrorLevel:"error",maxItems:0,itemsPerMin:60}},303:(e,t,r)=>{var i=r(180),n=new RegExp("^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ");function o(e){var t={};return t._stackFrame=e,t.url=e.fileName,t.line=e.lineNumber,t.func=e.functionName,t.column=e.columnNumber,t.args=e.args,t.context=null,t}function a(e,t){return{stack:function(){var r=[];t=t||0;try{r=i.parse(e)}catch(e){r=[]}for(var n=[],a=t;a<r.length;a++)n.push(new o(r[a]));return n}(),message:e.message,name:(r=e,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:e.stack,rawException:e};var r,n,a}e.exports={guessFunctionName:function(){return"?"},guessErrorClass:function(e){if(!e||!e.match)return["Unknown error. There was no error message to display.",""];var t=e.match(n),r="(unknown)";return t&&(r=t[t.length-1],e=(e=e.replace((t[t.length-2]||"")+r+":","")).replace(/(^[\s]+|[\s]+$)/g,"")),[r,e]},gatherContext:function(){return null},parse:function(e,t){var r=e;if(r.nested||r.cause){for(var i=[];r;)i.push(new a(r,t)),r=r.nested||r.cause,t=0;return i[0].traceChain=i,i[0]}return new a(r,t)},Stack:a,Frame:o}},420:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var i,n=t.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(i in e);return void 0===i||t.call(e,i)};e.exports=function e(){var t,r,n,o,a,s={},l=null,c=arguments.length;for(t=0;t<c;t++)if(null!=(l=arguments[t]))for(a in l)r=s[a],s!==(n=l[a])&&(n&&i(n)?(o=r&&i(r)?r:{},s[a]=e(o,n)):void 0!==n&&(s[a]=n));return s}},314:(e,t,r)=>{var i=r(702);function n(e,t){this.queue=e,this.options=t,this.transforms=[],this.diagnostic={}}n.prototype.configure=function(e){this.queue&&this.queue.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addTransform=function(e){return i.isFunction(e)&&this.transforms.push(e),this},n.prototype.log=function(e,t){if(t&&i.isFunction(t)||(t=function(){}),!this.options.enabled)return t(new Error("Rollbar is not enabled"));this.queue.addPendingItem(e);var r=e.err;this._applyTransforms(e,function(i,n){if(i)return this.queue.removePendingItem(e),t(i,null);this.queue.addItem(n,t,r,e)}.bind(this))},n.prototype._applyTransforms=function(e,t){var r=-1,i=this.transforms.length,n=this.transforms,o=this.options,a=function(e,s){e?t(e,null):++r!==i?n[r](s,o,a):t(null,s)};a(null,e)},e.exports=n},61:(e,t,r)=>{var i=r(702);function n(e,t,r){if(!e)return!r;var n,o,a=e.frames;if(!a||0===a.length)return!r;for(var s=t.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=t[u],new RegExp(o).test(n))return!0}return!1}function o(e,t,r,o){var a,s,l=!1;"blocklist"===r&&(l=!0);try{if(a=l?t.hostBlockList:t.hostSafeList,s=i.get(e,"body.trace_chain")||[i.get(e,"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(e){l?t.hostBlockList=null:t.hostSafeList=null;var h=l?"hostBlockList":"hostSafeList";return o.error("Error while reading your configuration's "+h+" option. Removing custom "+h+".",e),!l}return!1}e.exports={checkLevel:function(e,t){var r=e.level,n=i.LEVELS[r]||0,o=t.reportLevel;return!(n<(i.LEVELS[o]||0))},userCheckIgnore:function(e){return function(t,r){var n=!!t._isUncaught;delete t._isUncaught;var o=t._originalArgs;delete t._originalArgs;try{i.isFunction(r.onSendCallback)&&r.onSendCallback(n,o,t)}catch(t){r.onSendCallback=null,e.error("Error while calling onSendCallback, removing",t)}try{if(i.isFunction(r.checkIgnore)&&r.checkIgnore(n,o,t))return!1}catch(t){r.checkIgnore=null,e.error("Error while calling custom checkIgnore(), removing",t)}return!0}},urlIsNotBlockListed:function(e){return function(t,r){return!o(t,r,"blocklist",e)}},urlIsSafeListed:function(e){return function(t,r){return o(t,r,"safelist",e)}},messageIsIgnored:function(e){return function(t,r){var n,o,a,s,l,c;try{if(!(a=r.ignoredMessages)||0===a.length)return!0;if(c=function(e){var t=e.body,r=[];if(t.trace_chain)for(var n=t.trace_chain,o=0;o<n.length;o++){var a=n[o];r.push(i.get(a,"exception.message"))}return t.trace&&r.push(i.get(t,"trace.exception.message")),t.message&&r.push(i.get(t,"message.body")),r}(t),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(t){r.ignoredMessages=null,e.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}}},358:(e,t,r)=>{var i=r(702);function n(e,t,r,i){this.rateLimiter=e,this.api=t,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(e){this.api&&this.api.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addPredicate=function(e){return i.isFunction(e)&&this.predicates.push(e),this},n.prototype.addPendingItem=function(e){this.pendingItems.push(e)},n.prototype.removePendingItem=function(e){var t=this.pendingItems.indexOf(e);-1!==t&&this.pendingItems.splice(t,1)},n.prototype.addItem=function(e,t,r,n){t&&i.isFunction(t)||(t=function(){});var o=this._applyPredicates(e);if(o.stop)return this.removePendingItem(n),void t(o.err);if(this._maybeLog(e,r),this.removePendingItem(n),this.options.transmit){this.pendingRequests.push(e);try{this._makeApiRequest(e,function(r,i){this._dequeuePendingRequest(e),t(r,i)}.bind(this))}catch(r){this._dequeuePendingRequest(e),t(r)}}else t(new Error("Transmit disabled"))},n.prototype.wait=function(e){i.isFunction(e)&&(this.waitCallback=e,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){this._maybeCallWait()}.bind(this),500)))},n.prototype._applyPredicates=function(e){for(var t=null,r=0,i=this.predicates.length;r<i;r++)if(!(t=this.predicates[r](e,this.options))||void 0!==t.err)return{stop:!0,err:t.err};return{stop:!1,err:null}},n.prototype._makeApiRequest=function(e,t){var r=this.rateLimiter.shouldSend(e);r.shouldSend?this.api.postItem(e,function(r,i){r?this._maybeRetry(r,e,t):t(r,i)}.bind(this)):r.error?t(r.error):this.api.postItem(r.payload,t)};var o=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"];n.prototype._maybeRetry=function(e,t,r){var n=!1;if(this.options.retryInterval){for(var a=0,s=o.length;a<s;a++)if(e.code===o[a]){n=!0;break}n&&i.isFiniteNumber(this.options.maxRetries)&&(t.retries=t.retries?t.retries+1:1,t.retries>this.options.maxRetries&&(n=!1))}n?this._retryApiRequest(t,r):r(e)},n.prototype._retryApiRequest=function(e,t){this.retryQueue.push({item:e,callback:t}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;this.retryQueue.length;){var e=this.retryQueue.shift();this._makeApiRequest(e.item,e.callback)}}.bind(this),this.options.retryInterval))},n.prototype._dequeuePendingRequest=function(e){var t=this.pendingRequests.indexOf(e);-1!==t&&(this.pendingRequests.splice(t,1),this._maybeCallWait())},n.prototype._maybeLog=function(e,t){if(this.logger&&this.options.verbose){var r=t;if(r=(r=r||i.get(e,"body.trace.exception.message"))||i.get(e,"body.trace_chain.0.exception.message"))return void this.logger.error(r);(r=i.get(e,"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))},e.exports=n},790:(e,t,r)=>{var i=r(702);function n(e){this.startTime=i.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}function o(e,t,r){return!e.ignoreRateLimit&&t>=1&&r>t}function a(e,t,r,i,n,o,a){var s=null;return r&&(r=new Error(r)),r||i||(s=function(e,t,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:t.environment||t.payload&&t.payload.environment,notifier:{version:t.notifier&&t.notifier.version||t.version}};return"browser"===e?(o.platform="browser",o.framework="browser-js",o.notifier.name="rollbar-browser-js"):"server"===e?(o.framework=t.framework||"node-js",o.notifier.name=t.notifier.name):"react-native"===e&&(o.framework=t.framework||"react-native",o.notifier.name=t.notifier.name),o}(e,t,n,o,a)),{error:r,shouldSend:i,payload:s}}n.globalSettings={startTime:i.now(),maxItems:void 0,itemsPerMinute:void 0},n.prototype.configureGlobal=function(e){void 0!==e.startTime&&(n.globalSettings.startTime=e.startTime),void 0!==e.maxItems&&(n.globalSettings.maxItems=e.maxItems),void 0!==e.itemsPerMinute&&(n.globalSettings.itemsPerMinute=e.itemsPerMinute)},n.prototype.shouldSend=function(e,t){var r=(t=t||i.now())-this.startTime;(r<0||r>=6e4)&&(this.startTime=t,this.perMinCounter=0);var s=n.globalSettings.maxItems,l=n.globalSettings.itemsPerMinute;if(o(e,s,this.counter))return a(this.platform,this.platformOptions,s+" max items reached",!1);if(o(e,l,this.perMinCounter))return a(this.platform,this.platformOptions,l+" items per minute reached",!1);this.counter++,this.perMinCounter++;var c=!o(e,s,this.counter),u=c;return c=c&&!o(e,l,this.perMinCounter),a(this.platform,this.platformOptions,null,c,s,l,u)},n.prototype.setPlatformOptions=function(e,t){this.platform=e,this.platformOptions=t},e.exports=n},562:(e,t,r)=>{var i=r(790),n=r(358),o=r(314),a=r(702);function s(e,t,r,i,u){this.options=a.merge(e),this.logger=r,s.rateLimiter.configureGlobal(this.options),s.rateLimiter.setPlatformOptions(u,this.options),this.api=t,this.queue=new n(s.rateLimiter,t,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(e),this.lastError=null,this.lastErrorHash="none"}function l(e){e.stackTraceLimit&&(Error.stackTraceLimit=e.stackTraceLimit)}function c(e){if(!e)return!1;if(!e.scope||"function"!=typeof e.scope)return!1;var t=e.scope();return!(!t||!t.active||"function"!=typeof t.active)}s.rateLimiter=new i({maxItems:0,itemsPerMinute:60}),s.prototype.global=function(e){return s.rateLimiter.configureGlobal(e),this},s.prototype.configure=function(e,t){var r=this.options,i={};t&&(i={payload:t}),this.options=a.merge(r,e,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(e),this.global(this.options),c(e.tracer)&&(this.tracer=e.tracer),this},s.prototype.log=function(e){var t=this._defaultLogLevel();return this._log(t,e)},s.prototype.debug=function(e){this._log("debug",e)},s.prototype.info=function(e){this._log("info",e)},s.prototype.warn=function(e){this._log("warning",e)},s.prototype.warning=function(e){this._log("warning",e)},s.prototype.error=function(e){this._log("error",e)},s.prototype.critical=function(e){this._log("critical",e)},s.prototype.wait=function(e){this.queue.wait(e)},s.prototype.captureEvent=function(e,t,r){return this.telemeter&&this.telemeter.captureEvent(e,t,r)},s.prototype.captureDomContentLoaded=function(e){return this.telemeter&&this.telemeter.captureDomContentLoaded(e)},s.prototype.captureLoad=function(e){return this.telemeter&&this.telemeter.captureLoad(e)},s.prototype.buildJsonPayload=function(e){return this.api.buildJsonPayload(e)},s.prototype.sendJsonPayload=function(e){this.api.postJsonPayload(e)},s.prototype._log=function(e,t){var r;if(t.callback&&(r=t.callback,delete t.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(t)){if(r){var i=new Error("ignored identical item");i.item=t,r(i)}}else try{this._addTracingInfo(t),t.level=t.level||e,this.telemeter&&this.telemeter._captureRollbarItem(t),t.telemetryEvents=this.telemeter&&this.telemeter.copyEvents()||[],this.notifier.log(t,r)}catch(e){r&&r(e),this.logger.error(e)}},s.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},s.prototype._sameAsLastError=function(e){if(!e._isUncaught)return!1;var t=function(e){return(e.message||"")+"::"+((e.err||{}).stack||String(e.err))}(e);return this.lastErrorHash===t||(this.lastError=e.err,this.lastErrorHash=t,!1)},s.prototype._addTracingInfo=function(e){if(this.tracer){var t=this.tracer.scope().active();if(function(e){if(!e||!e.context||"function"!=typeof e.context)return!1;var t=e.context();return!!(t&&t.toSpanId&&t.toTraceId&&"function"==typeof t.toSpanId&&"function"==typeof t.toTraceId)}(t)){t.setTag("rollbar.error_uuid",e.uuid),t.setTag("rollbar.has_error",!0),t.setTag("error",!0),t.setTag("rollbar.item_url",`https://rollbar.com/item/uuid/?uuid=${e.uuid}`),t.setTag("rollbar.occurrence_url",`https://rollbar.com/occurrence/uuid/?uuid=${e.uuid}`);var r=t.context().toSpanId(),i=t.context().toTraceId();e.custom?(e.custom.opentracing_span_id=r,e.custom.opentracing_trace_id=i):e.custom={opentracing_span_id:r,opentracing_trace_id:i}}}},e.exports=s},369:(e,t,r)=>{var i=r(702),n=r(267);function o(e,t){var r=t.split("."),n=r.length-1;try{for(var o=0;o<=n;++o)o<n?e=e[r[o]]:e[r[o]]=i.redact()}catch(e){}}e.exports=function(e,t,r){if(t=t||[],r)for(var a=0;a<r.length;++a)o(e,r[a]);var s=function(e){for(var t,r=[],i=0;i<e.length;++i)t="^\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?$",r.push(new RegExp(t,"i"));return r}(t),l=function(e){for(var t,r=[],i=0;i<e.length;++i)t="\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?",r.push(new RegExp("("+t+"=)([^&\\n]+)","igm"));return r}(t);function c(e,t){return t+i.redact()}return n(e,function e(t,r,o){var a=function(e,t){var r;for(r=0;r<s.length;++r)if(s[r].test(e)){t=i.redact();break}return t}(t,r);return a===r?i.isType(r,"object")||i.isType(r,"array")?n(r,e,o):function(e){var t;if(i.isType(e,"string"))for(t=0;t<l.length;++t)e=e.replace(l[t],c);return e}(a):a})}},773:(e,t,r)=>{var i=r(702),n=100;function o(e){this.queue=[],this.options=i.merge(e);var t=this.options.maxTelemetryEvents||n;this.maxQueueSize=Math.max(0,Math.min(t,n))}function a(e,t){return t||{error:"error",manual:"info"}[e]||"info"}o.prototype.configure=function(e){var t=this.options;this.options=i.merge(t,e);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 e=Array.prototype.slice.call(this.queue,0);if(i.isFunction(this.options.filterTelemetry))try{for(var t=e.length;t--;)this.options.filterTelemetry(e[t])&&e.splice(t,1)}catch(e){this.options.filterTelemetry=null}return e},o.prototype.capture=function(e,t,r,n,o){var s={level:a(e,r),type:e,timestamp_ms:o||i.now(),body:t,source:"client"};n&&(s.uuid=n);try{if(i.isFunction(this.options.filterTelemetry)&&this.options.filterTelemetry(s))return!1}catch(e){this.options.filterTelemetry=null}return this.push(s),s},o.prototype.captureEvent=function(e,t,r,i){return this.capture(e,t,r,i)},o.prototype.captureError=function(e,t,r,i){var n={message:e.message||String(e)};return e.stack&&(n.stack=e.stack),this.capture("error",n,t,r,i)},o.prototype.captureLog=function(e,t,r,i){return this.capture("log",{message:e},t,r,i)},o.prototype.captureNetwork=function(e,t,r,i){t=t||"xhr",e.subtype=e.subtype||t,i&&(e.request=i);var n=this.levelFromStatus(e.status_code);return this.capture("network",e,n,r)},o.prototype.levelFromStatus=function(e){return e>=200&&e<400?"info":0===e||e>=400?"error":"info"},o.prototype.captureDom=function(e,t,r,i,n){var o={subtype:e,element:t};return void 0!==r&&(o.value=r),void 0!==i&&(o.checked=i),this.capture("dom",o,"info",n)},o.prototype.captureNavigation=function(e,t,r){return this.capture("navigation",{from:e,to:t},"info",r)},o.prototype.captureDomContentLoaded=function(e){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,e&&e.getTime())},o.prototype.captureLoad=function(e){return this.capture("navigation",{subtype:"load"},"info",void 0,e&&e.getTime())},o.prototype.captureConnectivityChange=function(e,t){return this.captureNetwork({change:e},"connectivity",t)},o.prototype._captureRollbarItem=function(e){if(this.options.includeItemsInTelemetry)return e.err?this.captureError(e.err,e.level,e.uuid,e.timestamp):e.message?this.captureLog(e.message,e.level,e.uuid,e.timestamp):e.custom?this.capture("log",e.custom,e.level,e.uuid,e.timestamp):void 0},o.prototype.push=function(e){this.queue.push(e),this.queue.length>this.maxQueueSize&&this.queue.shift()},e.exports=o},417:(e,t,r)=>{var i=r(702);function n(e,t){i.isFunction(e[t])&&(e[t]=e[t].toString())}e.exports={itemToPayload:function(e,t,r){var i=e.data;e._isUncaught&&(i._isUncaught=!0),e._originalArgs&&(i._originalArgs=e._originalArgs),r(null,i)},addPayloadOptions:function(e,t,r){var n=t.payload||{};n.body&&delete n.body,e.data=i.merge(e.data,n),r(null,e)},addTelemetryData:function(e,t,r){e.telemetryEvents&&i.set(e,"data.body.telemetry",e.telemetryEvents),r(null,e)},addMessageWithError:function(e,t,r){if(e.message){var n="data.body.trace_chain.0",o=i.get(e,n);if(o||(n="data.body.trace",o=i.get(e,n)),o){if(!o.exception||!o.exception.description)return i.set(e,n+".exception.description",e.message),void r(null,e);var a=i.get(e,n+".extra")||{},s=i.merge(a,{message:e.message});i.set(e,n+".extra",s)}r(null,e)}else r(null,e)},userTransform:function(e){return function(t,r,n){var o=i.merge(t),a=null;try{i.isFunction(r.transform)&&(a=r.transform(o.data,t))}catch(i){return r.transform=null,e.error("Error while calling custom transform() function. Removing custom transform().",i),void n(null,t)}i.isPromise(a)?a.then(function(e){e&&(o.data=e),n(null,o)},function(e){n(e,t)}):n(null,o)}},addConfigToPayload:function(e,t,r){if(!t.sendConfig)return r(null,e);var n=i.get(e,"data.custom")||{};n._rollbarConfig=t,e.data.custom=n,r(null,e)},addConfiguredOptions:function(e,t,r){var i=t._configuredOptions;n(i,"transform"),n(i,"checkIgnore"),n(i,"onSendCallback"),delete i.accessToken,e.data.notifier.configured_options=i,r(null,e)},addDiagnosticKeys:function(e,t,r){var n=i.merge(e.notifier.client.notifier.diagnostic,e.diagnostic);if(i.get(e,"err._isAnonymous")&&(n.is_anonymous=!0),e._isUncaught&&(n.is_uncaught=e._isUncaught),e.err)try{n.raw_error={message:e.err.message,name:e.err.name,constructor_name:e.err.constructor&&e.err.constructor.name,filename:e.err.fileName,line:e.err.lineNumber,column:e.err.columnNumber,stack:e.err.stack}}catch(e){n.raw_error={failed:String(e)}}e.data.notifier.diagnostic=i.merge(e.data.notifier.diagnostic,n),r(null,e)}}},473:(e,t,r)=>{var i=r(702),n=r(267);function o(e,t){return[e,i.stringify(e,t)]}function a(e,t){var r=e.length;return r>2*t?e.slice(0,t).concat(e.slice(r-t)):e}function s(e,t,r){r=void 0===r?30:r;var n,o=e.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[e,i.stringify(e,t)]}function l(e,t){return t&&t.length>e?t.slice(0,e-3).concat("..."):t}function c(e,t,r){return t=n(t,function t(r,o,a){switch(i.typeName(o)){case"string":return l(e,o);case"object":case"array":return n(o,t,a);default:return o}}),[t,i.stringify(t,r)]}function u(e){return e.exception&&(delete e.exception.description,e.exception.message=l(255,e.exception.message)),e.frames=a(e.frames,1),e}function h(e,t){var r=e.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[e,i.stringify(e,t)]}function d(e,t){return i.maxByteSize(e)>t}e.exports={truncate:function(e,t,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(e=(n=i(e,t))[0],(a=n[1]).error||!d(a.value,r))return a;return a},raw:o,truncateFrames:s,truncateStrings:c,maybeTruncateValue:l}},702:(e,t,r)=>{var i=r(420),n={};function o(e,t){return t===a(e)}function a(e){var t=typeof e;return"object"!==t?t:e?e instanceof Error?"error":{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(e){return o(e,"function")}function l(e){var t=Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),r=RegExp("^"+t+"$");return c(e)&&r.test(e)}function c(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function u(){var e=_();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?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(e,t){var r,i;try{r=n.stringify(e)}catch(n){if(t&&s(t))try{r=t(e)}catch(e){i=e}else i=n}return{error:i,value:r}}function p(e,t){return function(r,i){try{t(r,i)}catch(t){e.error(t)}}}function f(e){return function e(t,r){var i,n,s,l={};try{for(n in t)(i=t[n])&&(o(i,"object")||o(i,"array"))?r.includes(i)?l[n]="Removed circular reference: "+a(i):((s=r.slice()).push(i),l[n]=e(i,s)):l[n]=i}catch(e){l="Failed cloning custom data: "+e.message}return l}(e,[e])}var m=["log","network","dom","navigation","error","manual"],g=["critical","error","warning","info","debug"];function y(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1}function _(){return Date.now?+Date.now():+new Date}e.exports={addParamsAndAccessTokenToPath:function(e,t,r){(r=r||{}).access_token=e;var i,n=[];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push([i,r[i]].join("="));var o="?"+n.sort().join("&");(t=t||{}).path=t.path||"";var a,s=t.path.indexOf("?"),l=t.path.indexOf("#");-1!==s&&(-1===l||l>s)?(a=t.path,t.path=a.substring(0,s)+o+"&"+a.substring(s+1)):-1!==l?(a=t.path,t.path=a.substring(0,l)+o+a.substring(l)):t.path=t.path+o},createItem:function(e,t,r,i,n){for(var o,s,l,c,h,d,m=[],g=[],y=0,v=e.length;y<v;++y){var b=a(d=e[y]);switch(g.push(b),b){case"undefined":break;case"string":o?m.push(d):o=d;break;case"function":c=p(t,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 T={message:o,err:s,custom:l,timestamp:_(),callback:c,notifier:r,diagnostic:{},uuid:u()};return function(e,t){t&&void 0!==t.level&&(e.level=t.level,delete t.level),t&&void 0!==t.skipFrames&&(e.skipFrames=t.skipFrames,delete t.skipFrames)}(T,l),i&&h&&(T.request=h),n&&(T.lambdaContext=n),T._originalArgs=e,T.diagnostic.original_arg_types=g,T},addErrorContext:function(e,t){var r=e.data.custom||{},n=!1;try{for(var o=0;o<t.length;++o)t[o].hasOwnProperty("rollbarContext")&&(r=i(r,f(t[o].rollbarContext)),n=!0);n&&(e.data.custom=r)}catch(t){e.diagnostic.error_context="Failed: "+t.message}},createTelemetryEvent:function(e){for(var t,r,i,n,o=0,s=e.length;o<s;++o)switch(a(n=e[o])){case"string":!t&&y(m,n)?t=n:!i&&y(g,n)&&(i=n);break;case"object":r=n}return{type:t||"manual",metadata:r||{},level:i}},filterIp:function(e,t){if(e&&e.user_ip&&!0!==t){var r=e.user_ip;if(t)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(e){r=null}else r=null;e.user_ip=r}},formatArgsAsString:function(e){var t,r,i,n=[];for(t=0,r=e.length;t<r;++t){switch(a(i=e[t])){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(e,t){if(!(t=t||e.protocol)&&e.port&&(80===e.port?t="http:":443===e.port&&(t="https:")),t=t||"https:",!e.hostname)return null;var r=t+"//"+e.hostname;return e.port&&(r=r+":"+e.port),e.path&&(r+=e.path),r},get:function(e,t){if(e){var r=t.split("."),i=e;try{for(var n=0,o=r.length;n<o;++n)i=i[r[n]]}catch(e){i=void 0}return i}},handleOptions:function(e,t,r,n){var o=i(e,t,r);return o=function(e,t){return e.hostWhiteList&&!e.hostSafeList&&(e.hostSafeList=e.hostWhiteList,e.hostWhiteList=void 0,t&&t.log("hostWhiteList is deprecated. Use hostSafeList.")),e.hostBlackList&&!e.hostBlockList&&(e.hostBlockList=e.hostBlackList,e.hostBlackList=void 0,t&&t.log("hostBlackList is deprecated. Use hostBlockList.")),e}(o,n),!t||t.overwriteScrubFields||t.scrubFields&&(o.scrubFields=(e.scrubFields||[]).concat(t.scrubFields)),o},isError:function(e){return o(e,"error")||o(e,"exception")},isFiniteNumber:function(e){return Number.isFinite(e)},isFunction:s,isIterable:function(e){var t=a(e);return"object"===t||"array"===t},isNativeFunction:l,isObject:c,isString:function(e){return"string"==typeof e||e instanceof String},isType:o,isPromise:function(e){return c(e)&&o(e.then,"function")},jsonParse:function(e){var t,r;try{t=n.parse(e)}catch(e){r=e}return{error:r,value:t}},LEVELS:{debug:0,info:1,warning:2,error:3,critical:4},makeUnhandledStackInfo:function(e,t,r,i,n,o,a,s){var l={url:t||"",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):e||a,url:c,stack:[l],useragent:u}},merge:i,now:_,redact:function(){return"********"},RollbarJSON:n,sanitizeUrl:function(e){var t=function(e){if(o(e,"string")){for(var t=h,r=t.parser[t.strictMode?"strict":"loose"].exec(e),i={},n=0,a=t.key.length;n<a;++n)i[t.key[n]]=r[n]||"";return i[t.q.name]={},i[t.key[12]].replace(t.q.parser,function(e,r,n){r&&(i[t.q.name][r]=n)}),i}}(e);return t?(""===t.anchor&&(t.source=t.source.replace("#","")),e=t.source.replace("?"+t.query,"")):"(unknown)"},set:function(e,t,r){if(e){var i=t.split("."),n=i.length;if(!(n<1))if(1!==n)try{for(var o=e[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,e[i[0]]=a}catch(e){return}else e[i[0]]=r}},setupJSON:function(e){s(n.stringify)&&s(n.parse)||(o(JSON,"undefined")||(e?(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)||e&&e(n))},stringify:d,maxByteSize:function(e){for(var t=0,r=e.length,i=0;i<r;i++){var n=e.charCodeAt(i);n<128?t+=1:n<2048?t+=2:n<65536&&(t+=3)}return t},typeName:a,uuid4:u}},650:e=>{function t(e){return"string"!=typeof e&&(e=String(e)),e.toLowerCase()}function r(e){this.map={},e instanceof r?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}r.prototype.append=function(e,r){e=t(e),r=function(e){return"string"!=typeof e&&(e=String(e)),e}(r);var i=this.map[e];this.map[e]=i?i+", "+r:r},r.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},r.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),function(e){return{next:function(){var t=e.shift();return{done:void 0===t,value:t}}}}(e)},e.exports=function(e){return"undefined"==typeof Headers?new r(e):new Headers(e)}},876:(e,t,r)=>{var i=r(708);e.exports=i},297:e=>{e.exports=function(e,t,r,i,n){var o=e[t];e[t]=r(o),i&&i[n].push([e,t,o])}},267:(e,t,r)=>{var i=r(702);e.exports=function(e,t,r){var n,o,a,s,l=i.isType(e,"object"),c=i.isType(e,"array"),u=[];if(r=r||{obj:[],mapped:[]},l){if(s=r.obj.indexOf(e),l&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(e),s=r.obj.length-1}if(l)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&u.push(n);else if(c)for(a=0;a<e.length;++a)u.push(a);var h=l?{}:[],d=!0;for(a=0;a<u.length;++a)o=e[n=u[a]],h[n]=t(n,o,r),d=d&&h[n]===e[n];return l&&!d&&(r.mapped[s]=h),d?e:h}},708:e=>{e.exports=function(e){var t,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(e){return e<10?"0"+e:e}function g(){return this.valueOf()}function y(e){return f.lastIndex=0,f.test(e)?'"'+e.replace(f,function(e){var t=i[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function _(e,i){var o,a,s,l,c,u=t,h=i[e];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(e)),"function"==typeof n&&(h=n.call(i,e,h)),typeof h){case"string":return y(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(t+=r,c=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,o=0;o<l;o+=1)c[o]=_(o,h)||"null";return s=0===c.length?"[]":t?"[\n"+t+c.join(",\n"+t)+"\n"+u+"]":"["+c.join(",")+"]",t=u,s}if(n&&"object"==typeof n)for(l=n.length,o=0;o<l;o+=1)"string"==typeof n[o]&&(s=_(a=n[o],h))&&c.push(y(a)+(t?": ":":")+s);else for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(s=_(a,h))&&c.push(y(a)+(t?": ":":")+s);return s=0===c.length?"{}":t?"{\n"+t+c.join(",\n"+t)+"\n"+u+"}":"{"+c.join(",")+"}",t=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 e.stringify&&(i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e.stringify=function(e,i,o){var a;if(t="",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 _("",{"":e})}),"function"!=typeof e.parse&&(e.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 e=a.pop();c=s,s=e.container,l=e.key,o=e.state},ocomma:function(){var e=a.pop();s[l]=c,c=s,s=e.container,l=e.key,o=e.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 e=a.pop();c=s,s=e.container,l=e.key,o=e.state},acomma:function(){var e=a.pop();s.push(c),c=s,s=e.container,l=e.key,o=e.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(e,t){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(e);)r[1]?p[r[1]][o]():r[2]?(c=+r[2],d[o]()):(i=r[3],c=i.replace(/\\(?:u(.{4})|([^u]))/g,function(e,t,r){return t?String.fromCharCode(parseInt(t,16)):u[r]}),h[o]()),e=e.slice(r[0].length)}catch(e){o=e}if("ok"!==o||/[^\u0020\t\n\r]/.test(e))throw o instanceof SyntaxError?o:new SyntaxError("JSON");return"function"==typeof t?function e(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=e(a,n))?a[n]=o:delete a[n]);return t.call(r,i,a)}({"":c},""):c}))}}},t={},function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}(409);var e,t})}},r={};function i(e){var n=r[e];if(void 0!==n)return n.exports;var o=r[e]={exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{AnimationConfig:()=>a.AnimationConfig,AnimationDrawingConfig:()=>a.AnimationDrawingConfig,AnimationStatus:()=>a.AnimationStatus,Banner:()=>Xt,BasicCategory:()=>h.BasicCategory,BasicWithIcon:()=>h.BasicWithIcon,BasicWithLogo:()=>h.BasicWithLogo,CacheManager:()=>J,CameraAnimation:()=>v.CameraAnimation,Category:()=>h.Category,Configuration:()=>d.Configuration,CountlyLogger:()=>Pe,CssComponent:()=>f.CssComponent,CssCustomization:()=>f.CssCustomization,CssDefinitions:()=>f.CssDefinitions,CssElement:()=>f.CssElement,CssScreen:()=>f.CssScreen,CssTheme:()=>f.CssTheme,DEFAULT_CACHE_CONFIGS:()=>z,DEFAULT_MAX_STORAGE_BYTES:()=>F,DaysOfTheWeek:()=>x.DaysOfTheWeek,DrawRouteConfiguration:()=>o.DrawRouteConfiguration,FetchHttpClient:()=>ce,FitOptions:()=>m.FitOptions,GetRouteConfiguration:()=>o.GetRouteConfiguration,GradientStyle:()=>w.GradientStyle,HealthResponse:()=>e.HealthResponse,IdLocation:()=>o.IdLocation,InnerFloor:()=>g.InnerFloor,Institution:()=>lr,InternalLinkCategory:()=>h.InternalLinkCategory,LRUCache:()=>M,LatLng:()=>y.LatLng,LazarilloMap:()=>u.LazarilloMap,LazarilloSDK:()=>T.LazarilloSDK,LzLocation:()=>_.LzLocation,LzPlace:()=>rr,LzRoute:()=>qt,LzRouteLeg:()=>$t,LzRouteStep:()=>Wt,LzTransport:()=>ur,MapCamera:()=>v.MapCamera,MapConfig:()=>s.MapConfig,MapTileCacheConfig:()=>s.MapTileCacheConfig,MarkerConfig:()=>r.MarkerConfig,MultiLanguage:()=>b.MultiLanguage,NestedCategory:()=>h.NestedCategory,OpeningHours:()=>x.OpeningHours,OpeningHoursHelper:()=>Ni,OpeningTime:()=>x.OpeningTime,PersistentCache:()=>q,PhoneCategory:()=>h.PhoneCategory,PlaceCategory:()=>h.PlaceCategory,ProductCategory:()=>h.ProductCategory,Property:()=>l.Property,RealtimeSchedule:()=>c.RealtimeSchedule,RouteAnimationIconConfig:()=>t.RouteAnimationIconConfig,RouteLocation:()=>o.RouteLocation,RouteStyle:()=>w.RouteStyle,SDKConfig:()=>p.SDKConfig,Schedule:()=>c.Schedule,SolidStyle:()=>w.SolidStyle,TextCategory:()=>h.TextCategory,TextPosition:()=>Ge,UrlCategory:()=>h.UrlCategory,createRouteAnimationIconDataUrl:()=>Me,initializeSDK:()=>Ii,isBasicWithIcon:()=>ci,isBasicWithLogo:()=>li,loadCustomization:()=>Ci,loadStyles:()=>Vi});var e={};i.r(e);var t={};i.r(t),i.d(t,{Kb:()=>Me,fZ:()=>De,sU:()=>Ce});var r={};i.r(r),i.d(r,{D:()=>$e,x:()=>Ge});var o={};i.r(o),i.d(o,{D_:()=>xt,lc:()=>bt,sZ:()=>vt});var a={};i.r(a),i.d(a,{o:()=>It,U:()=>Pt});var s={};i.r(s),i.d(s,{z:()=>Rt});var l={};i.r(l),i.d(l,{n:()=>ar});var c={};i.r(c),i.d(c,{Q:()=>ur});var u={};i.r(u),i.d(u,{O:()=>si});var h={};i.r(h),i.d(h,{Y:()=>ci,c:()=>li});var d={};i.r(d);var p={};i.r(p);var f={};i.r(f);var m={};i.r(m);var g={};i.r(g);var y={};i.r(y);var _={};i.r(_);var v={};i.r(v);var b={};i.r(b);var x={};i.r(x);var w={};i.r(w);var T={};function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||I(e,t)||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 I(e,t){if(e){if("string"==typeof e)return P(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function k(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,C(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function A(e,t,r){return(t=C(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(e){var t=function(e,t){if("object"!=S(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=S(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==S(t)?t:t+""}i.r(T),i.d(T,{m:()=>Pi,f:()=>Ii});var M=function(){return k(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),A(this,"hits",0),A(this,"misses",0),A(this,"accessCounter",0),this.cache=new Map,this.maxItems=t.maxItems,this.ttlMs=t.ttlMs},[{key:"get",value:function(e){var t=this.cache.get(e);if(t)return this.ttlMs>0&&this.isExpired(t)?(this.cache.delete(e),void this.misses++):(t.accessTime=++this.accessCounter,this.hits++,t.value);this.misses++}},{key:"set",value:function(e,t){var r=Date.now(),i=++this.accessCounter;this.cache.has(e)||this.cache.size>=this.maxItems&&this.evictLRU(),this.cache.set(e,{value:t,timestamp:r,accessTime:i})}},{key:"has",value:function(e){var t=this.cache.get(e);return!(!t||this.ttlMs>0&&this.isExpired(t)&&(this.cache.delete(e),1))}},{key:"delete",value:function(e){return this.cache.delete(e)}},{key:"clear",value:function(){this.cache.clear(),this.hits=0,this.misses=0}},{key:"keys",value:function(){return Array.from(this.cache.keys())}},{key:"getStats",value:function(){var e=this.hits+this.misses,t=e>0?this.hits/e*100:void 0;return{size:this.cache.size,maxItems:this.maxItems,hitRate:t}}},{key:"isExpired",value:function(e){return Date.now()-e.timestamp>this.ttlMs}},{key:"evictLRU",value:function(){var e,t=null,r=1/0,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=I(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(this.cache);try{for(i.s();!(e=i.n()).done;){var n=E(e.value,2),o=n[0],a=n[1];a.accessTime<r&&(r=a.accessTime,t=o)}}catch(s){i.e(s)}finally{i.f()}null!==t&&this.cache.delete(t)}}])}();function D(e){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach(function(t){L(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function L(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=D(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=D(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==D(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F=5242880,z={places:{maxItems:500,ttlMs:18e5,persistenceKey:"lz_places"},routes:{maxItems:100,ttlMs:3e5,persistenceKey:"lz_routes"},accessibleRoutes:{maxItems:100,ttlMs:3e5,persistenceKey:"lz_accessible_routes"},configurations:{maxItems:10,ttlMs:36e5,persistenceKey:"lz_configurations"},categories:{maxItems:20,ttlMs:36e5,persistenceKey:"lz_categories"},vehicles:{maxItems:50,ttlMs:6e4,persistenceKey:"lz_vehicles"},stops:{maxItems:100,ttlMs:6e4,persistenceKey:"lz_stops"},subPlaces:{maxItems:200,ttlMs:9e5,persistenceKey:"lz_subplaces"}};function B(e,t){return O(O({},z[e]),t)}function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function j(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return V(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?V(e,t):void 0}}(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function U(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,G(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function G(e){var t=function(e,t){if("object"!=N(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=N(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==N(t)?t:t+""}var q=function(){return U(function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,r){(t=G(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"storageAvailable",!0),this.lruCache=new M(t),this.persistenceKey=t.persistenceKey||"lz_cache",this.maxStorageBytes=null!=r?r:F,this.ttlMs=t.ttlMs,this.hydrate()},[{key:"get",value:function(e){return this.lruCache.get(e)}},{key:"set",value:function(e,t){this.lruCache.set(e,t),this.persist()}},{key:"has",value:function(e){return this.lruCache.has(e)}},{key:"delete",value:function(e){var t=this.lruCache.delete(e);return t&&this.persist(),t}},{key:"clear",value:function(){this.lruCache.clear(),this.removeFromStorage()}},{key:"keys",value:function(){return this.lruCache.keys()}},{key:"getStats",value:function(){return this.lruCache.getStats()}},{key:"hydrate",value:function(){if(this.isStorageAvailable())try{var e=localStorage.getItem(this.persistenceKey);if(!e)return;var t=JSON.parse(e);if(!t.entries||!Array.isArray(t.entries))return;var r,i=Date.now(),n=j(t.entries);try{for(n.s();!(r=n.n()).done;){var o=r.value;this.ttlMs>0&&i-o.timestamp>this.ttlMs||this.lruCache.set(o.key,o.value)}}catch(a){n.e(a)}finally{n.f()}}catch(s){this.storageAvailable=this.isStorageAvailable()}else this.storageAvailable=!1}},{key:"persist",value:function(){if(this.storageAvailable)try{var e,t=[],r=j(this.lruCache.keys());try{for(r.s();!(e=r.n()).done;){var i=e.value,n=this.lruCache.get(i);void 0!==n&&t.push({key:i,value:n,timestamp:Date.now(),accessTime:Date.now()})}}catch(s){r.e(s)}finally{r.f()}var o={entries:t},a=JSON.stringify(o);if(a.length>this.maxStorageBytes)return;localStorage.setItem(this.persistenceKey,a)}catch(l){this.storageAvailable=!1}}},{key:"removeFromStorage",value:function(){if(this.storageAvailable)try{localStorage.removeItem(this.persistenceKey)}catch(e){}}},{key:"isStorageAvailable",value:function(){try{var e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(t){return!1}}}])}();function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||H(e,t)||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 Z(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=H(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function H(e,t){if(e){if("string"==typeof e)return X(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?X(e,t):void 0}}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function K(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Y(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Y(e){var t=function(e,t){if("object"!=$(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=$(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==$(t)?t:t+""}var J=function(){return K(function e(t){var r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.caches=new Map,this.persistent=null!==(r=null==t?void 0:t.persistent)&&void 0!==r&&r,this.maxStorageBytes=null!==(i=null==t?void 0:t.maxStorageBytes)&&void 0!==i?i:F;for(var n=0,o=["places","routes","accessibleRoutes","configurations","categories","vehicles","stops","subPlaces"];n<o.length;n++){var a,s=o[n],l=B(s,null==t||null===(a=t.configs)||void 0===a?void 0:a[s]);this.caches.set(s,this.createCache(l))}},[{key:"createCache",value:function(e){return this.persistent&&e.persistenceKey?new q(e,this.maxStorageBytes):new M(e)}},{key:"makeKey",value:function(e,t){return"".concat(e,"_").concat(t)}},{key:"makeConfigKey",value:function(e,t,r){return"".concat(e||"default","_").concat(t||"default","_").concat(r)}},{key:"getPlace",value:function(e,t){return this.caches.get("places").get(this.makeKey(e,t))}},{key:"setPlace",value:function(e,t,r){this.caches.get("places").set(this.makeKey(e,r),t)}},{key:"hasPlace",value:function(e,t){return this.caches.get("places").has(this.makeKey(e,t))}},{key:"getRoute",value:function(e){return this.caches.get("routes").get(e)}},{key:"setRoute",value:function(e,t){this.caches.get("routes").set(e,t)}},{key:"cleanRoutesCache",value:function(){this.caches.get("routes").clear()}},{key:"getAccessibleRoute",value:function(e){return this.caches.get("accessibleRoutes").get(e)}},{key:"setAccessibleRoute",value:function(e,t){this.caches.get("accessibleRoutes").set(e,t)}},{key:"cleanAccessibleRoutesCache",value:function(){this.caches.get("accessibleRoutes").clear()}},{key:"getConfiguration",value:function(e,t,r){return this.caches.get("configurations").get(this.makeConfigKey(e,t,r))}},{key:"setConfiguration",value:function(e,t,r,i){this.caches.get("configurations").set(this.makeConfigKey(e,t,r),i)}},{key:"getCategories",value:function(e,t){return this.caches.get("categories").get(this.makeKey(e||"default",t))}},{key:"setCategories",value:function(e,t,r){this.caches.get("categories").set(this.makeKey(e||"default",t),r)}},{key:"getVehicle",value:function(e,t){return this.caches.get("vehicles").get(this.makeKey(e,t))}},{key:"setVehicle",value:function(e,t,r){this.caches.get("vehicles").set(this.makeKey(e,r),t)}},{key:"getStops",value:function(e,t){return this.caches.get("stops").get(this.makeKey(e,t))}},{key:"setStops",value:function(e,t,r){this.caches.get("stops").set(this.makeKey(e,r),t)}},{key:"getSubPlaces",value:function(e,t){return this.caches.get("subPlaces").get(this.makeKey(e,t))}},{key:"setSubPlaces",value:function(e,t,r){this.caches.get("subPlaces").set(this.makeKey(e,t),r)}},{key:"cleanAllCache",value:function(){var e,t=Z(this.caches.values());try{for(t.s();!(e=t.n()).done;)e.value.clear()}catch(r){t.e(r)}finally{t.f()}}},{key:"cleanLanguageCache",value:function(e){for(var t="_".concat(e),r=0,i=["places","configurations","categories","vehicles","stops","subPlaces"];r<i.length;r++){var n,o=i[r],a=this.caches.get(o),s=Z(a.keys());try{for(s.s();!(n=s.n()).done;){var l=n.value;l.endsWith(t)&&a.delete(l)}}catch(c){s.e(c)}finally{s.f()}}}},{key:"getCacheStats",value:function(e){var t=this.caches.get(e);return t?t.getStats():{size:0,maxItems:0}}},{key:"getAllCacheStats",value:function(){var e,t={},r=Z(this.caches);try{for(r.s();!(e=r.n()).done;){var i=W(e.value,2),n=i[0],o=i[1];t[n]=o.getStats()}}catch(a){r.e(a)}finally{r.f()}return t}}])}();function Q(e){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q(e)}function ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function te(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(r),!0).forEach(function(t){re(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ee(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function re(e,t,r){return(t=le(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return ne(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(ne(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,ne(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,ne(h,"constructor",c),ne(c,"constructor",l),l.displayName="GeneratorFunction",ne(c,n,"GeneratorFunction"),ne(h),ne(h,n,"Generator"),ne(h,i,function(){return this}),ne(h,"toString",function(){return"[object Generator]"}),(ie=function(){return{w:o,m:d}})()}function ne(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}ne=function(e,t,r,i){function o(t,r){ne(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},ne(e,t,r,i)}function oe(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function ae(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){oe(o,i,n,a,s,"next",e)}function s(e){oe(o,i,n,a,s,"throw",e)}a(void 0)})}}function se(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,le(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function le(e){var t=function(e,t){if("object"!=Q(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Q(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Q(t)?t:t+""}var ce=function(){return se(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},[{key:"get",value:(n=ae(ie().m(function e(t,r){return ie().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"GET",void 0,r))},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"post",value:(i=ae(ie().m(function e(t,r,i){return ie().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"POST",r,i))},e,this)})),function(e,t,r){return i.apply(this,arguments)})},{key:"put",value:(r=ae(ie().m(function e(t,r,i){return ie().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"PUT",r,i))},e,this)})),function(e,t,i){return r.apply(this,arguments)})},{key:"delete",value:(t=ae(ie().m(function e(t,r){return ie().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"DELETE",void 0,r))},e,this)})),function(e,r){return t.apply(this,arguments)})},{key:"request",value:(e=ae(ie().m(function e(t,r,i,n){var o,a,s,l;return ie().w(function(e){for(;;)switch(e.n){case 0:return o=te({},null==n?void 0:n.headers),void 0===i||o["Content-Type"]||(o["Content-Type"]="application/json"),a={method:r,headers:o},void 0!==i&&(a.body=JSON.stringify(i)),e.n=1,fetch(t,a);case 1:return s=e.v,e.n=2,s.json();case 2:return l=e.v,e.a(2,{ok:s.ok,status:s.status,statusText:s.statusText,data:l})}},e)})),function(t,r,i,n){return e.apply(this,arguments)})}]);var e,t,r,i,n}(),ue=i(105),he=i.n(ue),de=i(916),pe=i.n(de),fe={accessToken:"1e7e62a3edc14868b4098d653d0f33b9",captureUncaught:!0,captureUnhandledRejections:!0,payload:{environment:"testenv",client:{javascript:{code_version:"1.0"}}}};function me(e){return me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},me(e)}function ge(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ye(i.key),i)}}function ye(e){var t=function(e,t){if("object"!=me(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=me(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==me(t)?t:t+""}var _e="f0c8d3b96d336e857a8628f49dd1baf7d7add0e9",ve="https://countly.lazarillo.app",be=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rollbar=new(pe())(fe),he().init({app_key:_e,url:ve,app_version:"3.0.4",session_update:10,debug:!1,require_consent:!1,namespace:"SDK JS"}),this.countly=null!==he()&&void 0!==he()?he():{},this.countly.q=null!==(t=he().q)&&void 0!==t?t:[],this.countly.q.push(["track_sessions","track_pageview","track_clicks","track_scrolls","track_errors","track_links","track_forms","collect_from_forms"])}return function(e,t,r){return t&&ge(e.prototype,t),r&&ge(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"logEvent",value:function(e,t){this.countly.q.push(["add_event",{key:e,segmentation:t}])}},{key:"logDebug",value:function(){}},{key:"logWarning",value:function(){}},{key:"logError",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i;null===(i=this.rollbar)||void 0===i||i.error.apply(i,t)}},{key:"debugLog",value:function(){}}],[{key:"getInstance",value:function(){return null==e.instance&&(e.instance=new e),e.instance}}])}();function xe(e){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xe(e)}function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Te(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?we(Object(r),!0).forEach(function(t){Se(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Se(e,t,r){return(t=Ie(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ee(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ie(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ie(e){var t=function(e,t){if("object"!=xe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=xe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==xe(t)?t:t+""}var Pe=function(){return Ee(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logger=be.getInstance()},[{key:"logEvent",value:function(e,t){var r=this.enrichSegmentation(t);this.logger.logEvent(e,r)}},{key:"logError",value:function(e,t){e instanceof Error?this.logger.logError(e,t):this.logger.logError(String(e),t)}},{key:"logWarning",value:function(e,t){e instanceof Error?this.logger.logWarning(e,t):this.logger.logWarning(String(e),t)}},{key:"logDebug",value:function(){var e;(e=this.logger).debugLog.apply(e,arguments)}},{key:"setToken",value:function(e){this.token=e}},{key:"enrichSegmentation",value:function(e){var t=null!=e?e:{};return this.token?Te(Te({},t),{},{token:this.token}):t}}])}(),ke=i(565),Ae=i.n(ke),Ce="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22false%22%20role%3D%22img%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%226%22%20fill%3D%22var(--icon-fill%2C%20%23007aff)%22%20stroke%3D%22var(--icon-stroke%2C%20%23ffffff)%22%20stroke-width%3D%222%22/%3E%3C/svg%3E";function Me(e){var t,r,i,n,o,a,s=null!==(t=null==e?void 0:e.backgroundColor)&&void 0!==t?t:"#0076B6",l=null!==(r=null==e?void 0:e.arrowColor)&&void 0!==r?r:"#FFFFFF",c=null!==(i=null==e?void 0:e.arrowWidth)&&void 0!==i?i:0,u=null!==(n=null==e?void 0:e.borderWidth)&&void 0!==n?n:0,h=null!==(o=null==e?void 0:e.borderColor)&&void 0!==o?o:"#000000",d=null!==(a=null==e?void 0:e.blur)&&void 0!==a?a:0,p="fill:".concat(s,";"),f=u>0?"stroke:".concat(h,";stroke-width:").concat(u,";"):"",m="fill:".concat(l,";"),g=c>0?"stroke:".concat(l,";stroke-width:").concat(c,";"):"",y=d>0?"blurFilter":"",_=d>0?'<defs><filter id="'.concat(y,'"><feGaussianBlur in="SourceGraphic" stdDeviation="').concat(d,'"/></filter></defs>'):"",v=d>0?'filter="url(#'.concat(y,')"'):"",b='<?xml version="1.0" encoding="utf-8"?>\n<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve">\n'.concat(_,"\n<g ").concat(v,'>\n\t<circle cx="20" cy="20" r="20" style="').concat(p).concat(f,'"/>\n\t<path style="').concat(m).concat(g,'" d="M12.4,29.7c-0.2,0.1-0.4,0.1-0.6,0.1c-0.2,0-0.4-0.1-0.5-0.3c-0.2-0.1-0.2-0.3-0.3-0.5c0-0.2,0-0.4,0.1-0.6\n\t\tl8.2-17.8c0.2-0.4,0.5-0.6,0.9-0.6c0.4,0,0.7,0.2,0.9,0.6l7.9,17.9c0.1,0.2,0.1,0.4,0.1,0.6c0,0.2-0.1,0.4-0.3,0.5\n\t\tc-0.1,0.1-0.3,0.2-0.5,0.3c-0.2,0-0.4,0-0.6-0.1L20,26.5L12.4,29.7z M13.9,27l6.1-2.6l6.1,2.7l-6-13.8L13.9,27z"/>\n</g>\n</svg>'),x=encodeURIComponent(b);return"data:image/svg+xml,".concat(x)}var De=Me();function Re(e){var t={lat:-1/0,lng:-1/0},r={lat:1/0,lng:1/0};return e.forEach(function(e){e.lat>t.lat&&(t.lat=e.lat),e.lng>t.lng&&(t.lng=e.lng),e.lat<r.lat&&(r.lat=e.lat),e.lng<r.lng&&(r.lng=e.lng)}),[r,t]}function Oe(e,t,r){return t=Fe(t),function(e,t){if(t&&("object"==Be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Le()?Reflect.construct(t,r||[],Fe(e).constructor):t.apply(e,r))}function Le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Le=function(){return!!e})()}function Fe(e){return Fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Fe(e)}function ze(e,t){return ze=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ze(e,t)}function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function Ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function je(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ue(i.key),i)}}function Ve(e,t,r){return t&&je(e.prototype,t),r&&je(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ue(e){var t=function(e,t){if("object"!=Be(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Be(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Be(t)?t:t+""}var Ge=function(e){return e[e.left=0]="left",e[e.right=1]="right",e[e.top=2]="top",e[e.bottom=3]="bottom",e}({}),qe=function(){return Ve(function e(){Ne(this,e)},null,[{key:"createMarkerElement",value:function(e){var t,r,i,n,o=document.createElement("div"),a=null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:40,s=null!==(i=null===(n=e.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:40;if(o.className="lazarillo-marker",e.text)switch(e.textPosition){case Ge.top:case Ge.bottom:o.classList.add("text-column"),o.style.width="".concat(Math.max(a,200),"px"),o.style.height="auto";break;case Ge.left:case Ge.right:default:o.classList.add("text-row"),o.style.width="auto",o.style.height="".concat(s,"px")}else o.classList.add("no-text"),o.style.width="".concat(a,"px"),o.style.height="".concat(s,"px");if(o.addEventListener("click",function(){var t;null===(t=e.onClick)||void 0===t||t.call(e)}),e.element)return o.appendChild(e.element),this.setAndCreateText(e,o,"".concat(s,"px"),"".concat(a,"px"));var l=this.createIconElement(e,a,s),c=e.text?this.createTextContainer("string"==typeof e.text?this.createTextElement(e.text,e.textProperties):e.text,e.textPosition):null;return e.textPosition===Ge.top||e.textPosition===Ge.left?(c&&o.appendChild(c),o.appendChild(l)):(o.appendChild(l),c&&o.appendChild(c)),o}},{key:"setAndCreateText",value:function(e,t,r,i){if(e.text){var n="string"==typeof e.text?this.createTextElement(e.text,e.textProperties):e.text,o=this.createTextContainer(n,e.textPosition);t.appendChild(o)}return t}},{key:"createIconElement",value:function(e,t,r){if("string"==typeof e.icon)return this.createIcon(e);if(e.icon instanceof HTMLImageElement)return e.icon.style.width="".concat(t,"px"),e.icon.style.height="".concat(r,"px"),e.icon;if(e.icon)return e.icon;var i=document.createElement("div");return i.className="icon-default",i.style.width="".concat(t,"px"),i.style.height="".concat(r,"px"),i}},{key:"createTextContainer",value:function(e,t){var r=document.createElement("div");switch(r.className="text-container",t){case Ge.top:r.classList.add("top");break;case Ge.bottom:r.classList.add("bottom");break;case Ge.left:r.classList.add("left");break;default:r.classList.add("right")}return e.style.display="block",e.style.margin="0",r.appendChild(e),r}},{key:"createIcon",value:function(e){var t,r,i,n,o=document.createElement("img");return o.src="string"==typeof e.icon?e.icon:"",o.width=null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:40,o.height=null!==(i=null===(n=e.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(e,t){var r,i,n,o,a,s,l,c=document.createElement("p");return c.textContent=e,c.style.fontSize=null!==(r=null==t?void 0:t.fontSize)&&void 0!==r?r:"14px",c.style.padding=null!==(i=null==t?void 0:t.padding)&&void 0!==i?i:"0px",c.style.margin=null!==(n=null==t?void 0:t.margin)&&void 0!==n?n:"0px",c.style.fontWeight=null!==(o=null==t?void 0:t.fontWeight)&&void 0!==o?o:"600",c.style.fontFamily=null!==(a=null==t?void 0:t.fontFamily)&&void 0!==a?a:"'Open Sans', sans-serif",c.style.color=null!==(s=null==t?void 0:t.color)&&void 0!==s?s:"#000000",c.style.textShadow=null!==(l=null==t?void 0:t.textShadow)&&void 0!==l?l:"-1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff",c}}])}(),$e=function(e){function t(e){var r,i,n,o,a;return Ne(this,t),(a=Oe(this,t,[{element:qe.createMarkerElement(e),draggable:!1,anchor:null!==(r=e.anchor)&&void 0!==r?r:"center",offset:[0,0]}])).setLngLat([e.coordinate.lng,e.coordinate.lat]),a.setRotationAlignment(null!==(i=e.rotationAlignment)&&void 0!==i?i:"viewport"),a.setPitchAlignment("viewport"),a.id=null!==(n=e.id)&&void 0!==n?n:function(){for(var e="",t="0123456789ABCDEF",r=0;r<10;r++)e+=t.charAt(Math.floor(16*Math.random()));return e}(),a.coordinate=e.coordinate,a.floorId=null!==(o=e.floorId)&&void 0!==o?o:"",a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ze(e,t)}(t,e),Ve(t,[{key:"addToMap",value:function(e){e&&this.addTo(e)}},{key:"updateIcon",value:function(e){var t;if(e.element)this._element.innerHTML="",this._element.appendChild(e.element);else{var r,i=qe.createMarkerElement(e),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!==(t=e.rotationAlignment)&&void 0!==t?t:"viewport"),this.setPitchAlignment("viewport")}},{key:"setFloor",value:function(e){this.floorId=e}},{key:"hide",value:function(){this.remove()}},{key:"show",value:function(e){e&&this.addTo(e)}},{key:"changeFloor",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e==this.floorId||r&&!this.floorId?this.show(t):this.hide()}}])}(ke.Marker);function We(e){return We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(e)}function Ze(e,t,r){return r&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,He(i.key),i)}}(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function He(e){var t=function(e,t){if("object"!=We(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=We(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==We(t)?t:t+""}var Xe=Math.asin,Ke=Math.atan2,Ye=Math.cos,Je=Math.sin,Qe=Math.pow,et=Math.sqrt,tt=Math.PI;function rt(e){return Je(e/2)*Je(e/2)}function it(e){return e*(tt/180)}function nt(e){return e*(180/tt)}function ot(e,t){return e.lat===t.lat&&e.lng===t.lng}var at=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return Ze(e,0,[{key:"distance",value:function(t,r){var i=it(t.lat),n=it(r.lat),o=it(t.lng),a=it(r.lng)-o,s=rt(n-i)+Ye(i)*Ye(n)*rt(a);return 2*e.EARTH_RADIUS*Xe(et(s))}},{key:"intermediatePointBetween",value:function(t,r,i){var n=it(t.lat),o=it(r.lat),a=it(t.lng),s=it(r.lng),l=e.distance(t,r)/e.EARTH_RADIUS,c=Je((1-i)*l)/Je(l),u=Je(i*l)/Je(l),h=c*Ye(n)*Ye(a)+u*Ye(o)*Ye(s),d=c*Ye(n)*Je(a)+u*Ye(o)*Je(s),p=c*Je(n)+u*Je(o),f=Ke(p,et(Qe(h,2)+Qe(d,2))),m=Ke(d,h);return{lat:nt(f),lng:nt(m)}}},{key:"bearingInDegBetween",value:function(t,r){return nt(e.bearingInRadBetween(t,r))}},{key:"bearingInRadBetween",value:function(e,t){var r=t.lng-e.lng,i=t.lat-e.lat;return(tt/2-Ke(i,r)+2*tt)%(2*tt)}},{key:"intermediateAngleBetween",value:function(e,t,r){var i=(t-e+180)%360-180;return i<-180&&(i+=360),(e+360+i*r)%360}}])}();function st(e){return st="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},st(e)}function lt(e){return function(e){if(Array.isArray(e))return ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ct(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ct(e,t):void 0}}(e)||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 ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function ut(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,dt(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ht(e,t,r){return(t=dt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dt(e){var t=function(e,t){if("object"!=st(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=st(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==st(t)?t:t+""}!function(e,t,r){(t=He(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(at,"EARTH_RADIUS",6378e3);var pt=function(){return ut(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ht(this,"AHEAD_ID","AHEAD_ID"),ht(this,"BEHIND_ID","BEHIND_ID"),ht(this,"CURRENT_ID","CURRENT_ID"),ht(this,"aheadSourceData",{type:"FeatureCollection",features:[]}),ht(this,"behindSourceData",{type:"FeatureCollection",features:[]}),ht(this,"currentSourceData",{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}),ht(this,"animationStatus","NO_ROUTE"),ht(this,"stepAnimationStatus","NO_ROUTE"),this.lazarilloMap=t},[{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(e,t){this.setSourceData(this.AHEAD_ID,e.steps),this.setLayerPaint(this.AHEAD_ID,t),this.updateLayerFilter(this.AHEAD_ID)}},{key:"setSourceData",value:function(e,t){var r=this.createFeaturesFrom(t),i=this.map.getSource(e);switch(e){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(e){this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(e)};var t=null==e?void 0:e.coordinates[0];this.currentSourceData.geometry.coordinates=null!=t?[[t.lng,t.lat]]:[];var r=this.map.getSource(this.CURRENT_ID);null==r||r.setData(this.currentSourceData)}},{key:"setLayerPaint",value:function(e,t){var r=this.preparePaintForLayer(t);for(var i in r)this.map.setPaintProperty(e,i,r[i])}},{key:"preparePaintForLayer",value:function(e){if("color"in e.routeStyle)return{"line-color":e.routeStyle.color,"line-gradient":null,"line-width":e.polylineWidth};var t=e.routeStyle,r=t.colors,i=t.positions;if(null==i&&(i=function(e){if(0===e)return[];if(1===e)return[0];var t=1/(e-1);return Array.from({length:e},function(e,r){return r*t})}(r.length)),i.length!==r.length)throw new Error("Error: position array has different length than colors array");var n=function(e,t){return e.flatMap(function(e,r){return[e,t[r]]})}(i,r);return{"line-color":null,"line-gradient":["interpolate",["linear"],["line-progress"]].concat(lt(n)),"line-width":e.polylineWidth}}},{key:"updateLayerFilter",value:function(e,t){var r=null!=t?t:this.lazarilloMap.getCurrentFloor();void 0!==r&&this.map.getStyle().layers.some(function(t){return t.id===e})&&this.map.setFilter(e,["==",["get","floor_key"],r])}},{key:"getFloorKeyForStep",value:function(e){var t,r,i,n,o,a,s;if(!e)return this.lazarilloMap.getCurrentFloor();if((null!==(t=null===(r=e.startInsideFloor)||void 0===r?void 0:r.length)&&void 0!==t?t:0)>0)return(null!==(a=null===(s=e.endInsideFloor)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0&&e.startInsideFloor!==e.endInsideFloor?e.endInsideFloor:e.startInsideFloor;if((null!==(i=null===(n=e.endInsideFloor)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0)return e.endInsideFloor;var l=this.lazarilloMap.getInnerFloors().find(function(e){return!0===e.reachableFromGPS});return null!==(o=null==l?void 0:l.key)&&void 0!==o?o:""}},{key:"createFeaturesFrom",value:function(e){var t=this;return e.map(function(e){return{type:"Feature",properties:{floor_key:t.getFloorKeyForStep(e)},geometry:{type:"LineString",coordinates:e.geoJsonCoordinates}}})}},{key:"updateRouteLayers",value:function(e){this.updateLayerFilter(this.AHEAD_ID,e),this.updateLayerFilter(this.BEHIND_ID,e),this.updateLayerFilter(this.CURRENT_ID,e)}},{key:"updateRouteMarkerVisibility",value:function(e){var t,r,i;(null===(t=this.routeMarker)||void 0===t?void 0:t.floorId)===e?null===(r=this.routeMarker)||void 0===r||r.show(this.map):null===(i=this.routeMarker)||void 0===i||i.hide()}},{key:"updatePlaceFloorForRouting",value:function(e,t){e&&t&&(this.lazarilloMap.updatePlaceAndFloorForRouting(e,t),this.updateRouteLayers(t),this.setMarkerFloor(t),this.updateRouteMarkerVisibility(t))}},{key:"startAnimating",value:function(e,t,r){var i,n,o=this;"NO_ROUTE"===this.animationStatus&&"NO_ROUTE"===this.stepAnimationStatus||this.clearForNextAnimation(),this.animationStatus="STARTED",this.route=e;var a=e.steps[0];this.updatePlaceFloorForRouting(a.startInsidePlace,a.startInsideFloor),this.setSourceData(this.AHEAD_ID,e.steps),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(a)},this.currentSourceData.geometry.coordinates=[[a.coordinates[0].lng,a.coordinates[0].lat]],this.setLayerPaint(this.AHEAD_ID,t.aheadConfig),this.setLayerPaint(this.BEHIND_ID,t.behindConfig),this.setLayerPaint(this.CURRENT_ID,t.behindConfig),this.animationConfig=r,this.routeMarker=new $e({coordinate:a.startLocation,floorId:a.startInsideFloor,icon:t.routeIcon,rotationAlignment:"map"}),this.routeMarker.addToMap(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(e){return o.animateStep(e)}),onFinish:function(e){return o.prepareForNextStep(e)}}}},{key:"clearForNextAnimation",value:function(){var e;null===(e=this.routeMarker)||void 0===e||e.remove(),this.routeMarker=void 0,this.setSourceData(this.AHEAD_ID,[]),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.geometry.coordinates=[];var t=this.map.getSource(this.CURRENT_ID);null==t||t.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 e=this;"PAUSED"==this.animationStatus&&null!=this.conditions&&(this.conditions.resetTime=!0,this.conditions.animationId=requestAnimationFrame(function(t){return e.animateStep(t)}),this.animationStatus="STARTED")}},{key:"resumeAnimation",value:function(){this.internalResume()}},{key:"restartAnimation",value:function(){var e,t,r,i=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 n=this.route.steps[0];this.updatePlaceFloorForRouting(n.startInsidePlace,n.startInsideFloor),this.setSourceData(this.AHEAD_ID,this.route.steps),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(n)},this.currentSourceData.geometry.coordinates=[[n.coordinates[0].lng,n.coordinates[0].lat]];var o=this.map.getSource(this.CURRENT_ID);null==o||o.setData(this.currentSourceData),null===(e=this.setRotation(0))||void 0===e||e.setLngLat(n.startLocation).addTo(this.map),null===(t=(r=this.animationConfig).callBack)||void 0===t||t.call(r,{isFinished:!1,step:n}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:requestAnimationFrame(function(e){return i.animateStep(e)}),onFinish:function(e){return i.prepareForNextStep(e)}}}},{key:"stopAnimation",value:function(){"FINISHED"!=this.animationStatus&&(this.animationStatus="FINISHED")}},{key:"addStepAnimation",value:function(e,t,r){var i,n=this;"NO_ROUTE"===this.animationStatus&&"NO_ROUTE"===this.stepAnimationStatus||this.clearForNextAnimation(),this.stepAnimationStatus="WAITING",this.route=e;var o=e.steps[0];this.updatePlaceFloorForRouting(o.startInsidePlace,o.startInsideFloor),this.setSourceData(this.AHEAD_ID,e.steps),this.setSourceData(this.BEHIND_ID,[]),this.setCurrentSourceData(o),this.setLayerPaint(this.AHEAD_ID,t.aheadConfig),this.setLayerPaint(this.BEHIND_ID,t.behindConfig),this.setLayerPaint(this.CURRENT_ID,t.behindConfig),this.animationConfig=r,this.routeMarker=new $e({coordinate:o.startLocation,floorId:o.startInsideFloor,icon:t.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 t=n.conditions.index;t++;var i=n.route.steps.slice(0,t),o=n.route.steps.slice(t),a=n.route.steps[t];if(n.setSourceData(n.BEHIND_ID,i),n.setSourceData(n.AHEAD_ID,o),n.setCurrentSourceData(a),n.conditions.index=t,t<e.steps.length){var s,l=e.steps[t];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 e=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(t){return e.animateStep(t)})}},{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 e,t,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=at.bearingInDegBetween(s[0],s[1]);this.setRotation(l)}else this.setRotation(0);null===(e=(t=this.animationConfig).callBack)||void 0===e||e.call(t,{isFinished:!1,step:o})}},{key:"centerOnCurrentStep",value:function(){var e;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 t=null===(e=this.routeMarker)||void 0===e?void 0:e.getLngLat();if(!t)throw new Error("Error: marker has no position set");this.map.panTo(t)}},{key:"prepareForNextStep",value:function(e){var t=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=this.route.steps[r+1];this.currentSourceData.geometry.coordinates.push([s.startLocation.lng,s.startLocation.lat]),this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(s)},this.conditions.startTime=e,this.conditions.index++,this.conditions.coordinatesIndex=0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,ot(this.route.steps[r].endLocation,s.startLocation)||(this.conditions.nextFloorFirstStepIndex=r+2),this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}),null===(o=(a=this.animationConfig).callBack)||void 0===o||o.call(a,{isFinished:!1,step:this.route.steps[r+1]})}else{var l,c;null===(l=(c=this.animationConfig).callBack)||void 0===l||l.call(c,{isFinished:!0,step:null}),this.animationStatus="FINISHED"}}},{key:"animateStep",value:function(e){var t=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,y=p.changeFloorTime;if(null==i)return this.conditions.startTime=e,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}));n?(i=e-o,this.conditions.startTime=i,n=!1,this.conditions.resetTime=n):(o=e-i,this.conditions.progress=o);var _=o/1e3,v=this.route.steps[c];if(v.coordinates.length<=0)null==u||u(e);else{var b=v.coordinates[s],x=v.coordinates[s+1];if(null!=b&&null!=x){var w;if(h){var T=at.bearingInDegBetween(b,x);if(0===g||this.conditions.nextFloorFirstStepIndex===c||Math.abs(T-this.conditions.iconRotation)<15)return this.conditions.nextFloorFirstStepIndex=void 0,this.setRotation(T),this.conditions.startTime=e,this.conditions.rotatingIcon=!1,this.conditions.iconRotation=T,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}));if(_<g){var S=at.intermediateAngleBetween(l,T,_/g);return this.setRotation(S),void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}return this.setRotation(T),this.conditions.startTime=e,this.conditions.rotatingIcon=!1,this.conditions.iconRotation=T,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}var E=at.distance(b,x),I=Math.max(v.distance/f,null!=m?m:0);if(I*_>E){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(!ot(x,k))if(this.conditions.isStepByStep)this.conditions.rotatingIcon=!0;else{var A,C=at.bearingInDegBetween(x,k);this.conditions.iconRotation=C,null===(A=this.routeMarker)||void 0===A||A.setRotation(C)}return this.conditions.startTime=e,this.conditions.progress=0,this.conditions.coordinatesIndex++,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}return v.startInsideFloor!==v.endInsideFloor?null==d?(this.conditions.waitStartTime=e,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))):e-d<1e3*y?void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)})):(this.updatePlaceFloorForRouting(v.endInsidePlace,v.endInsideFloor),this.setLngLat(v.endLocation),this.conditions.waitStartTime=void 0,void(null==u||u(e))):void(null==u||u(e))}var M=I*_/E,D=0===E?x:at.intermediatePointBetween(b,x,Math.min(M,1));this.currentSourceData.geometry.coordinates.push([D.lng,D.lat]);var R=this.map.getSource(this.CURRENT_ID);return null==R||R.setData(this.currentSourceData),this.setLngLat(D),null===(w=this.routeMarker)||void 0===w||w.addTo(this.map),void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}null==u||u(e)}}},{key:"setLngLat",value:function(e){var t,r;null!==(t=this.conditions)&&void 0!==t&&t.isStepByStep&&this.cameraFollow(e),null===(r=this.routeMarker)||void 0===r||r.setLngLat(e)}},{key:"setRotation",value:function(e){var t,r,i,n;return null!==(t=this.conditions)&&void 0!==t&&t.isStepByStep&&this.lazarilloMap.updateCamera({duration:null===(i=this.animationConfig)||void 0===i?void 0:i.iconRotationTime,animate:!0,bearing:e,center:null===(n=this.routeMarker)||void 0===n?void 0:n.getLngLat()}),null===(r=this.routeMarker)||void 0===r?void 0:r.setRotation(e)}},{key:"setMarkerFloor",value:function(e){var t;null===(t=this.routeMarker)||void 0===t||t.setFloor(e)}},{key:"cameraFollow",value:function(e){var t,r;this.lazarilloMap.updateCamera({center:e,animate:!0,bearing:null===(t=this.routeMarker)||void 0===t?void 0:t.getRotation(),duration:null===(r=this.animationConfig)||void 0===r?void 0:r.iconRotationTime})}}])}(),ft=["ar"];function mt(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function gt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var yt=function(e){return e.cardinal="CARDINAL",e.clock="CLOCK",e.relative="RELATIVE",e}({}),_t=function(e){return e.metric="METRIC",e.imperial="IMPERIAL",e.steps="STEPS",e}({}),vt=function(e){return e.walking="WALKING",e.driving="DRIVING",e.bicycling="BICYCLING",e.transit="TRANSIT",e}({}),bt=mt(function e(t){var r,i,n,o;gt(this,e),this.initialLocation=t.initialLocation,this.finalLocation=t.finalLocation,this.preferAccessibleRoute=null!==(r=t.preferAccessibleRoute)&&void 0!==r&&r,this.language=null!==(i=t.language)&&void 0!==i?i:"en",this.unitSystem=null!==(n=t.unitSystem)&&void 0!==n?n:_t.metric,this.announceFormat=null!==(o=t.announceFormat)&&void 0!==o?o:yt.relative}),xt=mt(function e(t){var r,i;gt(this,e),this.polylineWidth=null!==(r=t.polylineWidth)&&void 0!==r?r:10,this.routeStyle=null!==(i=t.routeStyle)&&void 0!==i?i:{type:"Solid",color:"#1257ED"}});function wt(e){return wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(e)}function Tt(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,St(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function St(e){var t=function(e,t){if("object"!=wt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=wt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==wt(t)?t:t+""}function Et(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var It=Tt(function e(t){var r,i,n,o;Et(this,e),this.stepTime=null!==(r=t.stepTime)&&void 0!==r?r:3,this.minimumSpeed=null!==(i=t.minimumSpeed)&&void 0!==i?i:40,this.changeFloorTime=null!==(n=t.changeFloorTime)&&void 0!==n?n:0,this.iconRotationTime=null!==(o=t.iconRotationTime)&&void 0!==o?o:0,this.callBack=t.callBack}),Pt=function(){return Tt(function e(t){var r,i,n;if(Et(this,e),this.aheadPathStyle=null!==(r=t.aheadPathStyle)&&void 0!==r?r:{type:"Solid",color:"#757575"},this.behindPathStyle=null!==(i=t.behindPathStyle)&&void 0!==i?i:{type:"Solid",color:"#0076B6"},this.polylineWidth=null!==(n=t.polylineWidth)&&void 0!==n?n:10,null!=t.routeIcon)this.routeIcon=t.routeIcon;else{var o=new Image(40,40);null!=t.routeIconConfig?o.src=Me(t.routeIconConfig):o.src=De,this.routeIcon=o}},[{key:"aheadConfig",get:function(){return new xt({polylineWidth:this.polylineWidth,routeStyle:this.aheadPathStyle})}},{key:"behindConfig",get:function(){return new xt({polylineWidth:this.polylineWidth,routeStyle:this.behindPathStyle})}}])}();function kt(e){if(e instanceof Error)return e;var t=String(e);return new Error(t)}function At(e){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},At(e)}function Ct(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Mt(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mt(e){var t=function(e,t){if("object"!=At(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=At(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==At(t)?t:t+""}var Dt=function(){return Ct(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logger=be.getInstance()},[{key:"logEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.logger.logEvent(e,this.prepareSegmentation(t))}},{key:"logError",value:function(e){for(var t,r=kt(e),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(t=this.logger).logError.apply(t,[r].concat(n))}},{key:"logWarning",value:function(e){for(var t,r=kt(e),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(t=this.logger).logWarning.apply(t,[r].concat(n))}},{key:"logDebug",value:function(){var e;(e=this.logger).logDebug.apply(e,arguments)}},{key:"debugLog",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debugLog(t)}}])}(),Rt={enabled:!0,maxTiles:400,ttlMs:18e5,persistToServiceWorker:!0,preloadAdjacentZooms:!1};const Ot={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Lt;const Ft=new Uint8Array(16);function zt(){if(!Lt&&(Lt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lt(Ft)}const Bt=[];for(let i=0;i<256;++i)Bt.push((i+256).toString(16).slice(1));const Nt=function(e,t,r){if(Ot.randomUUID&&!t&&!e)return Ot.randomUUID();const i=(e=e||{}).random||(e.rng||zt)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return Bt[e[t+0]]+Bt[e[t+1]]+Bt[e[t+2]]+Bt[e[t+3]]+"-"+Bt[e[t+4]]+Bt[e[t+5]]+"-"+Bt[e[t+6]]+Bt[e[t+7]]+"-"+Bt[e[t+8]]+Bt[e[t+9]]+"-"+Bt[e[t+10]]+Bt[e[t+11]]+Bt[e[t+12]]+Bt[e[t+13]]+Bt[e[t+14]]+Bt[e[t+15]]}(i)};function jt(e){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jt(e)}function Vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ut(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Gt(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gt(e){var t=function(e,t){if("object"!=jt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=jt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==jt(t)?t:t+""}var qt=function(){return Ut(function e(t){var r=this;Vt(this,e),this.id=Nt(),this.legs=[],t.legs.forEach(function(e){var t=new $t(e);r.legs.push(t)})},[{key:"steps",get:function(){return this.legs.flatMap(function(e){return e.steps})}},{key:"duration",get:function(){return this.legs.map(function(e){return e.duration}).reduce(function(e,t){return e+t},0)}},{key:"length",get:function(){return this.legs.map(function(e){return e.distance}).reduce(function(e,t){return e+t},0)}}])}(),$t=Ut(function e(t){var r=this;Vt(this,e),this.distance=t.distance.value,this.duration=t.duration.value,this.startLocation=t.start_location,this.endLocation=t.end_location,this.steps=[],t.steps.forEach(function(e){var t=new Wt(e);r.steps.push(t)})}),Wt=function(){return Ut(function e(t){Vt(this,e),this.distance=t.distance.value,this.duration=t.duration.value,this.startLocation=t.start_location,this.startInsideFloor=t.start_inside_floor,this.startInsidePlace=t.start_inside_place,this.endLocation=t.end_location,this.endInsideFloor=t.end_inside_floor,this.endInsidePlace=t.end_inside_place,this.htmlInstruction=t.html_instructions,this.plainInstruction=t.plain_instructions,this.maneuver=t.maneuver,this.elevatorStep=t.elevator_step,this.showPopup=t.show_popup,this.iconPrefix=t.icon_prefix,this.polyline=new Zt(t.polyline)},[{key:"geoJsonCoordinates",get:function(){return this.polyline.geoJsonCoordinates}},{key:"coordinates",get:function(){return this.polyline.coordinates}}])}(),Zt=function(){return Ut(function e(t){Vt(this,e),this.points=t.points,this.pointsLatLng=t.points_lat_lng,this.overviewPoints=t.overview_points,this.decodedPoints=function(e,t){void 0===t&&(t=5);for(var r=Math.pow(10,t),i=e.length,n=new Array(Math.floor(e.length/2)),o=0,a=0,s=0,l=0;o<i;++l){var c=1,u=0,h=void 0;do{c+=(h=e.charCodeAt(o++)-63-1)<<u,u+=5}while(h>=31);a+=1&c?~(c>>1):c>>1,c=1,u=0;do{c+=(h=e.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}(t.points).map(function(e){return{lat:e[0],lng:e[1]}})},[{key:"geoJsonCoordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints.map(function(e){return[e.lng,e.lat]}):this.decodedPoints.map(function(e){return[e.lng,e.lat]})}},{key:"coordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints:this.decodedPoints}}])}();function Ht(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var Xt=Ht(function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t.url,this.tags=null!==(r=t.tags)&&void 0!==r?r:[],this.urlAction=t.url_action,this.sameLink=t.sameLink,this.description=t.description});function Kt(e){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kt(e)}function Yt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Jt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yt(Object(r),!0).forEach(function(t){Qt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Qt(e,t,r){return(t=tr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function er(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,tr(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function tr(e){var t=function(e,t){if("object"!=Kt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Kt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Kt(t)?t:t+""}var rr=function(){return er(function e(t){var r,i,n,o,a,s,l,c,u,h;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var d=(null!==(r=t.tags)&&void 0!==r?r:[]).concat(null!==(i=t.keywords)&&void 0!==i?i:[]);for(var p in this.lazarilloId=t.id,this.clientId=null!==(n=t.alias)&&void 0!==n?n:t.externalId,this.title=t.title,this.hidePlace=d.includes("hide_search"),this.description=t.description,this.shortDescription=t.shortDescription,this.position={lat:t.lat,lng:t.lng||t.lon},this.category=t.category,this.tags=null!==(o=t.tags)&&void 0!==o?o:[],this.generalCategory=t.general_category,this.localizedCategory=null!==(a=t.localizedCategory)&&void 0!==a?a:"",this.parentInstitutionId=t.parent_institution,this.inFloors=t.inFloor,this.innerFloors=[],t.innerFloors)this.innerFloors.push(Jt(Jt({},t.innerFloors[p]),{},{key:p}));this.innerFloors.sort(function(e,t){return e.index-t.index}),this.openingHours=t.opening_hours,this.address=t.address,this.transportLine=null===(s=t.properties)||void 0===s?void 0:s.filter(function(e){return"transport_line"===e.type}),t.logo&&(this.logo="string"==typeof t.logo?t.logo:t.logo.light),this.images=null!==(l=t.images)&&void 0!==l?l:[],this.banners=(null!==(c=t.banners)&&void 0!==c?c:[]).map(function(e){return new Xt(e)}),this.properties=ar.parseProperties(null!==(u=t.properties)&&void 0!==u?u:[]),this.parentId=t.parent_id,this.parentType=t.parent_type,this.metadata=t.metadata,this.visibility=null!==(h=t.visibility)&&void 0!==h?h:"public"},[{key:"inFloor",value:function(e){var t=this;return this.inFloors&&0!==this.inFloors.length?e.find(function(e){var r;return e.key===(null===(r=t.inFloors)||void 0===r?void 0:r[0])}):e.find(function(e){return e.reachableFromGPS})}},{key:"toString",value:function(){return"LzPlace ".concat(this.lazarilloId)}}])}();function ir(e){return ir="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ir(e)}function nr(e,t,r){return r&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,or(i.key),i)}}(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function or(e){var t=function(e,t){if("object"!=ir(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=ir(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==ir(t)?t:t+""}var ar=function(){return nr(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},0,[{key:"parseProperties",value:function(e){var t=this;try{var r=[];return e&&e.forEach(function(e){if(e.child_places){var i,n=e.child_places,o={childPlaces:[],title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,imageUrl:e.imageUrl,iconPrefix:null!==(i=e.iconPrefix)&&void 0!==i?i:"fas",sortChildrenBy:e.sortChildrenBy};n.forEach(function(e){if("string"==typeof e)o.childPlaces.push(e);else{var t=new rr(e);o.childPlaces.push(t)}}),r.push(o)}else if(e.child_properties){var a,s=e.child_properties,l={childProperties:[],title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,imageUrl:e.imageUrl,iconPrefix:null!==(a=e.iconPrefix)&&void 0!==a?a:"fas",sortChildrenBy:e.sortChildrenBy},c=t.parseProperties(s);l.childProperties=c,r.push(l)}else if(e.url){var u={title:e.key,subtitle:e.text,icon:e.icon,imageUrl:e.imageUrl,iconPrefix:e.iconPrefix,url:e.url,type:e.type,sortChildrenBy:e.sortChildrenBy};r.push(u)}else{var h,d={title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,imageUrl:e.imageUrl,type:e.type,iconPrefix:null!==(h=e.iconPrefix)&&void 0!==h?h:"fas",sortChildrenBy:e.sortChildrenBy};r.push(d)}}),r}catch(i){return console.log(i),console.log(e),[]}}}])}();function sr(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var lr=sr(function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lazarilloId=t.id,this.country=t.country,this.title=t.title,this.category=t.category,this.icon=t.icon,this.description=t.description,this.hasPlaces=t.hasPlaces,this.properties=ar.parseProperties(null!==(r=t.properties)&&void 0!==r?r:[])});function cr(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var ur=cr(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schedule=t.schedules,this.routes=t.realtimeSchedules});function hr(e){return hr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hr(e)}function dr(e){return function(e){if(Array.isArray(e))return pr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return pr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pr(e,t):void 0}}(e)||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 pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function fr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return mr(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(mr(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,mr(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,mr(h,"constructor",c),mr(c,"constructor",l),l.displayName="GeneratorFunction",mr(c,n,"GeneratorFunction"),mr(h),mr(h,n,"Generator"),mr(h,i,function(){return this}),mr(h,"toString",function(){return"[object Generator]"}),(fr=function(){return{w:o,m:d}})()}function mr(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}mr=function(e,t,r,i){function o(t,r){mr(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},mr(e,t,r,i)}function gr(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function yr(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){gr(o,i,n,a,s,"next",e)}function s(e){gr(o,i,n,a,s,"throw",e)}a(void 0)})}}function _r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,vr(i.key),i)}}function vr(e){var t=function(e,t){if("object"!=hr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=hr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==hr(t)?t:t+""}var br=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://api.mapvx.com";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lang=t;var i=r.endsWith("/")?r.slice(0,-1):r;this.baseUrl="".concat(i,"/sdk/"),this.baseUrlMapVx="".concat(i,"/api/"),this.baseUrlPortal="".concat(i,"/api/portal/")}return function(e,t,r){return t&&_r(e.prototype,t),r&&_r(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"setLang",value:function(e){this.lang=e}},{key:"fetchTransport",value:(x=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,stopId:i,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/vehiclesWithSchedules",o,n))},t,this)})),function(e,t){return x.apply(this,arguments)})},{key:"fetchStops",value:(b=yr(fr().m(function t(r,i,n){var o,a;return fr().w(function(t){for(;;)if(0===t.n)return o={method:"GET",headers:{"content-type":"application/json"}},a={token:r,stopId:i,vehicleId:n,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/stops",a,o))},t,this)})),function(e,t,r){return b.apply(this,arguments)})},{key:"fetchMapStyle",value:(v=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},null!=i&&(o.place_id=i),t.a(2,e.fetchFromUrl(this.baseUrl+"mapStyleJson",o,n))},t,this)})),function(e,t){return v.apply(this,arguments)})},{key:"fetchAnyMapStyle",value:(_=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},o={lang:this.lang,institution_id:i},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"mapStyle",o,n))},t,this)})),function(e,t){return _.apply(this,arguments)})},{key:"fetchAllowedPlaces",value:(y=yr(fr().m(function t(r){var i,n;return fr().w(function(t){for(;;)if(0===t.n)return i={method:"GET",headers:{"content-type":"application/json"}},n={token:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/availablePlaces",n,i))},t,this)})),function(e){return y.apply(this,arguments)})},{key:"fetchPlacesFromAnyInstitution",value:(g=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(i)}},o={institution_id:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"availablePlaces",o,n))},t,this)})),function(e,t){return g.apply(this,arguments)})},{key:"fetchPlaceDetail",value:(m=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,place_id:i,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v3/place",o,n))},t,this)})),function(e,t){return m.apply(this,arguments)})},{key:"fetchAnyPlaceDetail",value:(f=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},o={place_id:i,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"place",o,n))},t,this)})),function(e,t){return f.apply(this,arguments)})},{key:"fetchSubPlaces",value:(p=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:i,targetPlace:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v3/subPlaces",o,n))},t,this)})),function(e,t){return p.apply(this,arguments)})},{key:"fetchAnySubPlaces",value:(d=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(i)}},o={place_id:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"subPlaces",o,n))},t,this)})),function(e,t){return d.apply(this,arguments)})},{key:"fetchRoute",value:(h=yr(fr().m(function t(r,i){var n,o,a,s,l,c,u,h,d,p,f,m,g,y,_;return fr().w(function(t){for(;;)if(0===t.n){for(y 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:vt.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,void 0!==r.initialLocation.level&&(o.fromFloor=r.initialLocation.level)):(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,void 0!==r.finalLocation.level&&(o.toFloor=r.finalLocation.level)):(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!=(_=o[y])&&(g[y]=_);return t.a(2,e.fetchFromUrl(this.baseUrl+"route",g,n))}},t,this)})),function(e,t){return h.apply(this,arguments)})},{key:"fetchRouteV2",value:(u=yr(fr().m(function t(r,i){var n,o,a,s,l,c,u,h,d,p,f,m,g,y,_;return fr().w(function(t){for(;;)if(0===t.n){for(y 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:vt.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,void 0!==r.initialLocation.level&&(o.fromFloor=r.initialLocation.level)):(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,void 0!==r.finalLocation.level&&(o.toFloor=r.finalLocation.level)):(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!=(_=o[y])&&(g[y]=_);return t.a(2,e.fetchFromUrl(this.baseUrl+"v2/route",g,n))}},t,this)})),function(e,t){return u.apply(this,arguments)})},{key:"fetchInstitutions",value:(c=yr(fr().m(function t(r){var i,n;return fr().w(function(t){for(;;)if(0===t.n)return i={method:"GET",headers:{"content-type":"application/json"}},n={token:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/institution",n,i))},t,this)})),function(e){return c.apply(this,arguments)})},{key:"fetchSearchResults",value:(l=yr(fr().m(function t(r,i,n,o,a,s,l,c){var u,h;return fr().w(function(t){for(;;)if(0===t.n)return u={method:"GET",headers:{"content-type":"application/json"}},h={institution_id:r,input:i,lang:this.lang,token:n},o&&(h.parentPlaces=dr(o)),a&&(h.origin=a),s&&(h.lat=s),l&&(h.lng=l),c&&(h.floor=c),t.a(2,e.fetchFromUrl(this.baseUrl+"v2/searchPlacesWithFilters",h,u))},t,this)})),function(e,t,r,i,n,o,a,s){return l.apply(this,arguments)})},{key:"fetchConfiguration",value:(s=yr(fr().m(function t(r,i,n){var o,a;return fr().w(function(t){for(;;)if(0===t.n)return o={method:"GET",headers:{"content-type":"application/json"}},a={token:r,lang:this.lang},i&&(a.place_id=i),n&&(a.product=n),t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"configuration",a,o))},t,this)})),function(e,t,r){return s.apply(this,arguments)})},{key:"fetchCategories",value:(a=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},i&&(o.id=i),t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"category",o,n))},t,this)})),function(e,t){return a.apply(this,arguments)})},{key:"fetchRoutesForOrigin",value:(o=yr(fr().m(function t(r,i,n,o,a,s){var l,c;return fr().w(function(t){for(;;)if(0===t.n)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},t.a(2,e.fetchFromUrl(this.baseUrl+"routes_for_origin",c,l))},t,this)})),function(e,t,r,i,n,a){return o.apply(this,arguments)})},{key:"fetchCacheTimestamp",value:(n=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,placeId:i},t.a(2,e.fetchFromUrl(this.baseUrl+"cache_timestamp",o,n))},t,this)})),function(e,t){return n.apply(this,arguments)})},{key:"fetchCssCustomization",value:(i=yr(fr().m(function t(r,i){var n,o;return fr().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,type:i},t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"styles/customStyles",o,n))},t,this)})),function(e,t){return i.apply(this,arguments)})},{key:"postHealth",value:(r=yr(fr().m(function t(r,i,n,o,a){var s,l,c;return fr().w(function(t){for(;;)if(0===t.n)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},t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"health",l,c))},t,this)})),function(e,t,i,n,o){return r.apply(this,arguments)})}],[{key:"fetchFromUrl",value:(t=yr(fr().m(function e(t,r,i){var n;return fr().w(function(e){for(;;)if(0===e.n)return(n=new URL(t)).search=new URLSearchParams(r).toString(),e.a(2,fetch(n.toString(),i))},e)})),function(e,r,i){return t.apply(this,arguments)})}]);var t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b,x}();function xr(e){return xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xr(e)}function wr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||Sr(e,t)||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 Tr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Sr(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Sr(e,t){if(e){if("string"==typeof e)return Er(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Er(e,t):void 0}}function Er(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Ir(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return Pr(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(Pr(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Pr(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,Pr(h,"constructor",c),Pr(c,"constructor",l),l.displayName="GeneratorFunction",Pr(c,n,"GeneratorFunction"),Pr(h),Pr(h,n,"Generator"),Pr(h,i,function(){return this}),Pr(h,"toString",function(){return"[object Generator]"}),(Ir=function(){return{w:o,m:d}})()}function Pr(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}Pr=function(e,t,r,i){function o(t,r){Pr(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},Pr(e,t,r,i)}function kr(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function Ar(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){kr(o,i,n,a,s,"next",e)}function s(e){kr(o,i,n,a,s,"throw",e)}a(void 0)})}}function Cr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Mr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cr(Object(r),!0).forEach(function(t){zr(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Dr(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Br(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rr(e,t,r){return t=Lr(t),function(e,t){if(t&&("object"==xr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Or()?Reflect.construct(t,[],Lr(e).constructor):t.apply(e,r))}function Or(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Or=function(){return!!e})()}function Lr(e){return Lr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lr(e)}function Fr(e,t){return Fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fr(e,t)}function zr(e,t,r){return(t=Br(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Br(e){var t=function(e,t){if("object"!=xr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=xr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==xr(t)?t:t+""}var Nr=function(e){function t(e,r,i,n){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),zr(o=Rr(this,t),"currentLang","en"),o.token=e,o.currentLang=r,o.requester=new br(r,i),o.lang=r,o.cache=null!=n?n:new J,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fr(e,t)}(t,e),Dr(t,[{key:"setLang",value:function(e){this.currentLang=e,this.requester.setLang(e)}},{key:"prepareSegmentation",value:function(e){return Mr(Mr({},e),{},{token:this.token})}},{key:"fetchAndParseMapStyle",value:(x=Ar(Ir().m(function e(t){var r,i,n,o,a;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(void 0!==t||!this.baseStyle){e.n=1;break}return e.a(2,this.baseStyle);case 1:return e.p=1,e.n=2,this.requester.fetchMapStyle(this.token,t);case 2:if((r=e.v).ok){e.n=4;break}return e.n=3,r.json();case 3:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 4:return e.n=5,r.json();case 5:return n=e.v,o=n.style,void 0===t&&(this.baseStyle=o),this.logEvent("fetchAndParseMapStyle"),e.a(2,o);case 6:throw e.p=6,a=e.v,this.logWarning(a,{functionName:"fetchAndParseMapStyle"}),new Error("Failed to fetch and parse map style");case 7:return e.a(2)}},e,this,[[1,6]])})),function(e){return x.apply(this,arguments)})},{key:"fetchAndParseAnyMapStyle",value:(b=Ar(Ir().m(function e(t,r){var i,n,o,a,s;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAnyMapStyle(r,t);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 3:return e.n=4,i.json();case 4:return o=e.v,a=o.style,this.logEvent("fetchAndParseAnyMapStyle"),e.a(2,a);case 5:throw e.p=5,s=e.v,this.logWarning(s,{functionName:"fetchAndParseAnyMapStyle"}),new Error("Failed to fetch and parse map style with bearer token");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return b.apply(this,arguments)})},{key:"fetchAndParseInstitutions",value:(v=Ar(Ir().m(function e(){var t,r,i,n,o,a,s,l,c,u;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchInstitutions(this.token);case 1:if((t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:throw r=e.v,new Error("Fetch failed with status ".concat(t.status,": ").concat(r));case 3:return e.n=4,t.json();case 4:i=e.v,n=[],o=Tr(i);try{for(o.s();!(a=o.n()).done;)s=a.value,l=new lr(s),n.push(l)}catch(h){o.e(h)}finally{o.f()}if(n.sort(function(e,t){return e.title.localeCompare(t.title)}),!(c=n)){e.n=5;break}return this.logEvent("fetchAndParseInstitutionsV2"),e.a(2,c);case 5:throw new Error("No institutions associated to this apiKey");case 6:e.n=8;break;case 7:throw e.p=7,u=e.v,this.logWarning(u,{functionName:"fetchAndParseInstitutionsV2"}),new Error("Failed to fetch and parse institution");case 8:return e.a(2)}},e,this,[[0,7]])})),function(){return v.apply(this,arguments)})},{key:"fetchAndParsePlaceDetail",value:(_=Ar(Ir().m(function e(t){var r,i,n,o,a,s;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getPlace(t,this.lang))){e.n=1;break}return this.logEvent("fetchAndParsePlaceDetail",{cached:"true"}),e.a(2,r);case 1:return e.n=2,this.requester.fetchPlaceDetail(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:return o=e.v,a=new rr(o),this.cache.setPlace(a.lazarilloId,a,this.lang),null!=a.clientId&&this.cache.setPlace(a.clientId,a,this.lang),this.logEvent("fetchAndParsePlaceDetail",{cached:"false"}),e.a(2,a);case 6:throw e.p=6,s=e.v,this.logWarning(s,{functionName:"fetchAndParsePlaceDetail"}),new Error("Failed to fetch and parse place detail");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return _.apply(this,arguments)})},{key:"fetchAndParseAnyPlaceDetail",value:(y=Ar(Ir().m(function e(t,r){var i,n,o,a,s,l;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(i=this.cache.getPlace(t,this.lang))){e.n=1;break}return this.logEvent("fetchAndParseAnyPlaceDetail",{cached:"true"}),e.a(2,i);case 1:return e.n=2,this.requester.fetchAnyPlaceDetail(r,t);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=new rr(a),this.cache.setPlace(s.lazarilloId,s,this.lang),null!=s.clientId&&this.cache.setPlace(s.clientId,s,this.lang),this.logEvent("fetchAndParseAnyPlaceDetail",{cached:"false"}),e.a(2,s);case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseAnyPlaceDetail"}),new Error("Failed to fetch and parse place detail with bearer token");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return y.apply(this,arguments)})},{key:"fetchAndParseSubPlaces",value:(g=Ar(Ir().m(function e(t){var r,i,n,o,a,s,l=this;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getSubPlaces(t,this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseSubPlaces",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchSubPlaces(t,this.token);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:return o=e.v,a=o.map(function(e){return new rr(e)}),this.cache.setSubPlaces(t,this.currentLang,{timestamp:Date.now(),data:a}),this.logEvent("fetchAndParseSubPlaces",{cached:"false"}),a.forEach(function(e){l.cache.hasPlace(e.lazarilloId,l.currentLang)||l.cache.setPlace(e.lazarilloId,e,l.currentLang),null==e.clientId||l.cache.hasPlace(e.clientId,l.currentLang)||l.cache.setPlace(e.clientId,e,l.currentLang)}),e.a(2,a);case 6:throw e.p=6,s=e.v,this.logWarning(s,{functionName:"fetchAndParseSubPlaces",parentPlaceId:t}),new Error("Failed to fetch and parse subplaces");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return g.apply(this,arguments)})},{key:"fetchAndParseAnySubPlaces",value:(m=Ar(Ir().m(function e(t,r){var i,n,o,a,s,l=this;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAnySubPlaces(t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 3:return e.n=4,i.json();case 4:return o=e.v,a=o.map(function(e){return new rr(e)}),this.logEvent("fetchAndParseAnySubPlaces"),a.forEach(function(e){l.cache.hasPlace(e.lazarilloId,l.lang)||l.cache.setPlace(e.lazarilloId,e,l.lang),null==e.clientId||l.cache.hasPlace(e.clientId,l.lang)||l.cache.setPlace(e.clientId,e,l.lang)}),e.a(2,a);case 5:throw e.p=5,s=e.v,this.logWarning(s,{functionName:"fetchAndParseAnySubPlaces",parentPlaceId:t}),new Error("Failed to fetch and parse any subplaces");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return m.apply(this,arguments)})},{key:"fetchAndParseAvailablePlaces",value:(f=Ar(Ir().m(function e(){var t,r,i,n,o,a=this;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAllowedPlaces(this.token);case 1:if((t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:throw r=e.v,new Error("Fetch failed with status ".concat(t.status,": ").concat(r));case 3:return e.n=4,t.json();case 4:return i=e.v,n=i.map(function(e){return new rr(e)}),this.logEvent("fetchAndParseAvailablePlaces"),n.forEach(function(e){a.cache.hasPlace(e.lazarilloId,a.lang)||a.cache.setPlace(e.lazarilloId,e,a.lang),null==e.clientId||a.cache.hasPlace(e.clientId,a.lang)||a.cache.setPlace(e.clientId,e,a.lang)}),e.a(2,n);case 5:throw e.p=5,o=e.v,this.logWarning(o,{functionName:"fetchAndParseAvailablePlaces"}),new Error("Failed to fetch and parse parent places");case 6:return e.a(2)}},e,this,[[0,5]])})),function(){return f.apply(this,arguments)})},{key:"fetchAndParsePlacesFromInstitution",value:(p=Ar(Ir().m(function e(t,r){var i,n,o,a,s,l=this;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchPlacesFromAnyInstitution(t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 3:return e.n=4,i.json();case 4:return o=e.v,a=o.map(function(e){return new rr(e)}),this.logEvent("fetchAndParsePlacesFromInstitution"),a.forEach(function(e){l.cache.hasPlace(e.lazarilloId,l.lang)||l.cache.setPlace(e.lazarilloId,e,l.lang),null==e.clientId||l.cache.hasPlace(e.clientId,l.lang)||l.cache.setPlace(e.clientId,e,l.lang)}),e.a(2,a);case 5:throw e.p=5,s=e.v,this.logWarning(s,{functionName:"fetchAndParsePlacesFromInstitution"}),new Error("Failed to fetch and parse parent places from institution");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return p.apply(this,arguments)})},{key:"getCachedPlaces",value:function(e){var t=this,r=[];return e.forEach(function(e){var i=t.cache.getPlace(e,t.lang);if(null!=i)r.push(i);else{var n=new Error("The id was not found on cache");"captureStackTrace"in Error&&Error.captureStackTrace(n),t.logWarning(n,{functionName:"getCachedPlaces",id:e})}}),r}},{key:"getCachedSubPlaces",value:function(e){var t=this.cache.getSubPlaces(e,this.currentLang);return null==t?void 0:t.data}},{key:"fetchAndParseRoute",value:(d=Ar(Ir().m(function e(t){var r,i,n,o,a,s,l;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r="","id"in t.finalLocation&&(r=t.finalLocation.id),null==(i=this.cache.getRoute(r))){e.n=1;break}return this.logEvent("fetchAndParseRoute",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchRoute(t,this.token);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=new qt(a[0]),this.logEvent("fetchAndParseRoute"),this.debugLog("Route cache testing. Fetched."),e.a(2,s);case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseRoute"}),new Error("Failed to fetch and parse route");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return d.apply(this,arguments)})},{key:"fetchAndParseRouteV2",value:(h=Ar(Ir().m(function e(t){var r,i,n,o,a,s,l;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r="","id"in t.finalLocation&&(r=t.finalLocation.id),null==(i=this.cache.getRoute(r))){e.n=1;break}return this.logEvent("fetchAndParseRouteV2",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchRouteV2(t,this.token);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=new qt(a[0]),this.logEvent("fetchAndParseRouteV2"),this.debugLog("Route cache testing. Fetched."),e.a(2,s);case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseRouteV2"}),new Error("Failed to fetch and parse route");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return h.apply(this,arguments)})},{key:"fetchAndParseTransport",value:(u=Ar(Ir().m(function e(t){var r,i,n,o,a,s,l,c,u,h,d=this;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getVehicle(t,this.lang))||!(Date.now()-r.timestamp<6e3||0===r.data.routes.length)){e.n=1;break}return this.logEvent("fetchAndParseTransport",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchTransport(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:if(!((o=e.v).realtimeSchedules.length>0)){e.n=7;break}return a=o.realtimeSchedules.map(function(e){return d.fetchAndParseStops(t,e.vehicleId)}),e.n=6,Promise.all(a);case 6:(s=e.v).length>0&&o.realtimeSchedules.forEach(function(e){var t,r;e.stops=null!==(t=null===(r=s.find(function(t){return t.id==e.vehicleId}))||void 0===r?void 0:r.places)&&void 0!==t?t:[]});case 7:return l=new ur(o),this.cache.setVehicle(t,{timestamp:Date.now(),data:l},this.lang),this.logEvent("fetchAndParseTransport",{cached:"false"}),e.a(2,l);case 8:if(e.p=8,h=e.v,this.logWarning(h,{functionName:"fetchAndParseTransport"}),null==(c=this.cache.getVehicle(t,this.lang))){e.n=9;break}return u=new ur({realtimeSchedules:[],schedules:c.data.schedule}),this.logEvent("fetchAndParseTransport",{cached:"true"}),e.a(2,u);case 9:throw new Error("Failed to fetch and parse transport");case 10:return e.a(2)}},e,this,[[0,8]])})),function(e){return u.apply(this,arguments)})},{key:"fetchAndParseStops",value:(c=Ar(Ir().m(function e(t,r){var i,n,o,a,s,l;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,!(null!=(i=this.cache.getStops(t+r,this.lang))&&Date.now()-i.timestamp<6e4)){e.n=1;break}return this.logEvent("fetchAndParseStops",{cached:"true"}),e.a(2,{id:r,places:i.data});case 1:return e.n=2,this.requester.fetchStops(this.token,t,r);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=a.map(function(e){return new rr(e)}),this.cache.setStops(t+r,{timestamp:Date.now(),data:s},this.lang),this.logEvent("fetchAndParseStops",{cached:"false"}),e.a(2,{id:r,places:s});case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseStops"}),new Error("Failed to fetch and parse stops");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return c.apply(this,arguments)})},{key:"fetchAndParseSearchResults",value:(l=Ar(Ir().m(function e(t,r,i,n,o,a,s){var l,c,u,h,d;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchSearchResults(t,r,this.token,i,n,o,a,s);case 1:if((l=e.v).ok){e.n=3;break}return e.n=2,l.json();case 2:throw c=e.v,new Error("Fetch failed with status ".concat(l.status,": ").concat(c));case 3:return e.n=4,l.json();case 4:return u=e.v,h=u.map(function(e){return new rr(e)}),e.a(2,h);case 5:throw e.p=5,d=e.v,this.logWarning(d,{functionName:"fetchAndParseSearchResults"}),new Error("Failed to fetch and parse search results");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i,n,o,a){return l.apply(this,arguments)})},{key:"fetchAndParseRoutesFromOrigin",value:(s=Ar(Ir().m(function e(t,r,i,n,o){var a,s,l,c,u,h,d=this;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchRoutesForOrigin(this.token,t,r,i,n,o);case 1:if((a=e.v).ok){e.n=3;break}return e.n=2,a.json();case 2:throw s=e.v,new Error("Fetch failed with status ".concat(a.status,": ").concat(s));case 3:return e.n=4,a.json();case 4:l=e.v,c=l.routes,u=l.accessibleRoutes,Object.entries(c).forEach(function(e){var t=wr(e,2),r=t[0],i=t[1],n=new qt(i[0]);d.cache.setRoute(r,{timestamp:Date.now(),data:n})}),Object.entries(u).forEach(function(e){var t=wr(e,2),r=t[0],i=t[1],n=new qt(i[0]);d.cache.setAccessibleRoute(r,{timestamp:Date.now(),data:n})}),this.debugLog("Route cache testing. Cache populated!"),e.n=6;break;case 5:throw e.p=5,h=e.v,this.logWarning(h,{functionName:"fetchAndParseRoutesFromOrigin"}),new Error("Failed to fetch and parse routes from origin results");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i,n){return s.apply(this,arguments)})},{key:"fetchAndParseCacheTimestamp",value:(a=Ar(Ir().m(function e(t){var r,i,n,o,a;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCacheTimestamp(this.token,t);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 3:return e.n=4,r.json();case 4:return n=e.v,o=n.lastUpdate,e.a(2,o);case 5:throw e.p=5,a=e.v,this.logWarning(a,{functionName:"fetchAndParseCacheTimestamp"}),new Error("Failed to fetch and parse cache timestamp");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return a.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.cache.cleanRoutesCache(),this.cache.cleanAccessibleRoutesCache()}},{key:"fetchAndParseConfiguration",value:(o=Ar(Ir().m(function e(t,r){var i,n,o,a,s;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(i=this.cache.getConfiguration(t||"default",r||"default",this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseConfiguration",{cached:"true"}),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchConfiguration(this.token,t,r);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,this.cache.setConfiguration(t||"default",r||"default",this.currentLang,{timestamp:Date.now(),data:a}),this.logEvent("fetchAndParseConfiguration",{cached:"false"}),e.a(2,a);case 6:throw e.p=6,s=e.v,this.logWarning(s,{functionName:"fetchAndParseConfiguration"}),new Error("Failed to fetch and parse configuration");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return o.apply(this,arguments)})},{key:"fetchAndParseCategories",value:(n=Ar(Ir().m(function e(t){var r,i,n,o,a;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getCategories(t||"default",this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseCategories",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchCategories(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:return o=e.v,this.cache.setCategories(t||"default",this.currentLang,{timestamp:Date.now(),data:o}),this.logEvent("fetchAndParseCategories",{cached:"false"}),e.a(2,o);case 6:throw e.p=6,a=e.v,this.logWarning(a,{functionName:"fetchAndParseCategories"}),new Error("Failed to fetch and parse categories");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return n.apply(this,arguments)})},{key:"fetchAndParseCssCustomization",value:(i=Ar(Ir().m(function e(t){var r,i,n,o;return Ir().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCssCustomization(this.token,t);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 3:return e.n=4,r.json();case 4:return n=e.v,e.a(2,n);case 5:throw e.p=5,o=e.v,this.logWarning(o,{functionName:"fetchAndParseCssCustomization"}),new Error("Failed to fetch and parse css customization");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return i.apply(this,arguments)})},{key:"postAndParseHealthPing",value:(r=Ar(Ir().m(function e(t,r,i,n){var o,a,s;return Ir().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.requester.postHealth(this.token,t,r,i,n);case 1:if((o=e.v).ok){e.n=3;break}return e.n=2,o.json();case 2:throw a=e.v,new Error("Post failed with status ".concat(o.status,": ").concat(a));case 3:return e.n=4,o.json();case 4:return s=e.v,e.a(2,s)}},e,this)})),function(e,t,i,n){return r.apply(this,arguments)})}]);var r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v,b,x}(Dt);function jr(e){return jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jr(e)}function Vr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return Ur(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(Ur(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ur(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,Ur(h,"constructor",c),Ur(c,"constructor",l),l.displayName="GeneratorFunction",Ur(c,n,"GeneratorFunction"),Ur(h),Ur(h,n,"Generator"),Ur(h,i,function(){return this}),Ur(h,"toString",function(){return"[object Generator]"}),(Vr=function(){return{w:o,m:d}})()}function Ur(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}Ur=function(e,t,r,i){function o(t,r){Ur(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},Ur(e,t,r,i)}function Gr(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function qr(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){Gr(o,i,n,a,s,"next",e)}function s(e){Gr(o,i,n,a,s,"throw",e)}a(void 0)})}}function $r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Hr(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Wr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||Hr(e,t)||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 Zr(e){return function(e){if(Array.isArray(e))return Xr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Hr(e)||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 Hr(e,t){if(e){if("string"==typeof e)return Xr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xr(e,t):void 0}}function Xr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Kr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Yr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kr(Object(r),!0).forEach(function(t){ii(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Jr(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ni(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qr(e,t,r){return t=ti(t),function(e,t){if(t&&("object"==jr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ei()?Reflect.construct(t,[],ti(e).constructor):t.apply(e,r))}function ei(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ei=function(){return!!e})()}function ti(e){return ti=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ti(e)}function ri(e,t){return ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ri(e,t)}function ii(e,t,r){return(t=ni(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ni(e){var t=function(e,t){if("object"!=jr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=jr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==jr(t)?t:t+""}var oi=!1;function ai(e){return null==e?e:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}var si=function(e){function t(e,r,i){var n,o,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ii(a=Qr(this,t),"potentialParentPlaces",[]),ii(a,"innerFloors",[]),ii(a,"subPlaces",[]),ii(a,"currentFloor",""),ii(a,"baseFilters",{}),ii(a,"markers",[]),ii(a,"enableHover",!1),ii(a,"hoveredId","unselected"),ii(a,"failedTiles",new Set),ii(a,"geoLocation",navigator.geolocation),ft.includes(null!==(n=e.lang)&&void 0!==n?n:"")&&a.setRTLSupport(),a.repository=new Nr(i,null!==(o=e.lang)&&void 0!==o?o:"en"),a.token=i,a.parentPlaceId=e.parentPlaceId,a.routeController=new pt(a),a.userLocationMarker=void 0,a.watchPositionID=void 0,a.onFloorChange=e.onFloorChange,a.onParentPlaceChange=e.onParentPlaceChange,a.tileCacheConfig=Yr(Yr({},Rt),e.tileCache),null!=e.parentPlaceId&&a.initialPlaceDetailSetUp(e.parentPlaceId,e.authToken),e.otherPotentialParentPlacesIds&&e.otherPotentialParentPlacesIds.length>0&&a.loadOtherPotentialParentPlaces(e.otherPotentialParentPlacesIds),a.enableHover=e.enableHover||!1,a.initialMapStyleSetUp(e,r),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ri(e,t)}(t,e),Jr(t,[{key:"setRTLSupport",value:function(){var e=this;(0,ke.setRTLTextPlugin)("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!1).catch(function(t){e.logWarning(t,{functionName:"setRTLSupport"})})}},{key:"transformStyleForCaching",value:function(e){if(!e)return e;var t=ai(e);if(null!=t&&t.sources)for(var r=0,i=Object.keys(t.sources);r<i.length;r++){var n=i[r],o=t.sources[n];o.tiles&&Array.isArray(o.tiles)&&(o.tiles=o.tiles.map(function(e){return e.startsWith("https://")?e.replace("https://","cached-tile://"):e}))}return t}},{key:"initialPlaceDetailSetUp",value:function(e,t){var r=this;t?this.repository.fetchAndParseAnyPlaceDetail(e,t).then(function(e){r.changeParentPlaceTo(e),r.potentialParentPlaces.push(e)}).catch(console.error):this.repository.fetchAndParsePlaceDetail(e).then(function(e){r.changeParentPlaceTo(e),r.potentialParentPlaces.push(e)}).catch(console.error)}},{key:"loadOtherPotentialParentPlaces",value:function(e){var t=this;Promise.all(e.map(function(e){return t.repository.fetchAndParsePlaceDetail(e)})).then(function(e){var r;(r=t.potentialParentPlaces).push.apply(r,Zr(e))}).catch(console.error)}},{key:"subPlacesLoad",value:function(e){var t=this;this.repository.fetchAndParseSubPlaces(e).then(function(e){t.subPlaces=e}).catch(console.error)}},{key:"initialMapStyleSetUp",value:function(e,t){var r=this;e.institutionId&&e.authToken?this.repository.fetchAndParseAnyMapStyle(e.institutionId,e.authToken).then(function(i){return r.onMapStyleLoaded(e,t,i)}).catch(console.error):this.repository.fetchAndParseMapStyle(e.parentPlaceId).then(function(i){return r.onMapStyleLoaded(e,t,i)}).catch(console.error)}},{key:"onMapStyleLoaded",value:function(e,t,r){var i,n,o,a=this,s=this.tileCacheConfig.enabled&&this.tileCacheConfig.persistToServiceWorker;s&&(oi||(Ae().addProtocol("cached-tile",function(e,t){var r=e.url.replace("cached-tile://","https://");return fetch(r,{signal:t.signal}).then(function(e){if(!e.ok)throw new Error("HTTP error! status: ".concat(e.status));return e.arrayBuffer()}).then(function(e){return{data:e}})}),oi=!0));var l={container:t,style:s?this.transformStyleForCaching(r):r,center:e.center,zoom:e.zoom,pitch:null!==(i=e.pitch)&&void 0!==i?i:0,attributionControl:!1,maplibreLogo:!1,bearingSnap:null!==(n=e.bearingSnap)&&void 0!==n?n:0,cancelPendingTileRequestsWhileZooming:!1,maxTileCacheSize:this.tileCacheConfig.maxTiles};if(e.maxZoom&&(l.maxZoom=e.maxZoom),e.minZoom&&(l.minZoom=e.minZoom),e.maxBounds&&e.maxBounds.length>1){var c=Re(e.maxBounds);l.maxBounds=new ke.LngLatBounds([c[0].lng,c[0].lat],[c[1].lng,c[1].lat])}return this.map=new ke.Map(l),this.map.addControl(new ke.NavigationControl({showCompass:void 0===e.showCompass||e.showCompass,showZoom:void 0===e.showZoom||e.showZoom}),null!==(o=e.navigationPosition)&&void 0!==o?o:"top-right"),this.map.on("load",function(){var t;a.whenStyleUpdates(r),e.lang&&a.setLayersForLanguage(e.lang),null===(t=e.onMapReady)||void 0===t||t.call(e),a.onHover(),a.subscribeToFailedTiles()}),this.map.on("zoomend",function(){var t;null===(t=e.onZoomEnd)||void 0===t||t.call(e,a.getZoomLevel())}),this.map.on("rotate",function(){var t;null===(t=e.onRotate)||void 0===t||t.call(e,a.map.getBearing())}),this.defaultClickListener(),this.map}},{key:"setBaseFilters",value:function(e){var t=this,r=["==",["get","public_place"],!0];e.layers.filter(function(e){return e.id.startsWith("indoor-")}).forEach(function(e){var i=t.baseFilters[e.id];if(null!=i){var n=["all",i,r];t.map.setFilter(e.id,n)}else t.map.setFilter(e.id,r);switch(e.type){case"line":case"symbol":case"fill-extrusion":case"fill":null!=e.filter&&(t.baseFilters[e.id]=e.filter)}})}},{key:"setLayersForLanguage",value:function(e){var t,r,i=this,n=["aerodrome_label","mountain_peak","park","place","poi","transportation_name","water_name","waterway"],o=null!==(t=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==t?t:[];o.filter(function(e){var t;return"symbol"===e.type&&"openmaptiles"===e.source&&n.includes(null!==(t=e["source-layer"])&&void 0!==t?t:"")}).map(function(e){return e.id}).forEach(function(t){try{var r=i.map.getLayoutProperty(t,"symbol-placement");i.map.setLayoutProperty(t,"text-field",["case",["has","name:".concat(e)],["get","name:".concat(e)],["format",["get","name:latin"],"line"===r?" ":"\n",["get","name:nonlatin"]]])}catch(n){i.logWarning(n,{functionName:"setLayersForLanguage"})}}),o.filter(function(e){var t;return"symbol"===e.type&&"indoorequal"===e.source&&void 0!==(null===(t=e.layout)||void 0===t?void 0:t["text-field"])}).map(function(e){return e.id}).forEach(function(t){try{i.map.setLayoutProperty(t,"text-field",["case",["has","name:".concat(e)],["get","name:".concat(e)],["get","name"]])}catch(r){i.logWarning(r,{functionName:"setLayersForLanguage"})}})}},{key:"prepareSegmentation",value:function(e){var t;return Yr(Yr({},e),{},{token:this.token,parentPlaceId:null!==(t=this.parentPlaceId)&&void 0!==t?t:"None"})}},{key:"destroyMap",value:function(){this.map.remove(),this.unsubscribeFromFailedTiles()}},{key:"clearTileCache",value:function(){try{this.failedTiles.clear(),this.map&&this.map.triggerRepaint(),this.logEvent("clearTileCache")}catch(e){this.logWarning(e,{functionName:"clearTileCache"})}}},{key:"getCurrentFloor",value:function(){var e;return null!==(e=this.currentFloor)&&void 0!==e?e:""}},{key:"changeParentPlaceTo",value:function(e){var t,r,i,n,o,a,s=this,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=arguments.length>2?arguments[2]:void 0;this.parentPlace=e,this.parentPlaceId=null==e?void 0:e.lazarilloId,this.innerFloors=null!==(t=null==e||null===(r=e.innerFloors)||void 0===r?void 0:r.sort(function(e,t){return e.index-t.index}))&&void 0!==t?t:[],this.currentFloor=null!==(i=null!==(n=null===(o=this.innerFloors.find(function(e){return e.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:"",e&&this.subPlacesLoad(e.lazarilloId),l&&this.repository.fetchAndParseMapStyle(null==e?void 0:e.lazarilloId).then(function(e){var t=s.tileCacheConfig.enabled&&s.tileCacheConfig.persistToServiceWorker?s.transformStyleForCaching(e):e;s.map.setStyle(t),s.whenStyleUpdates(t),null==c||c()}).catch(console.error)}},{key:"updatePlaceAndFloor",value:function(e,t){var r,i,n,o,a,s=this.potentialParentPlaces.find(function(t){return t.lazarilloId===e});this.parentPlace=s,this.parentPlaceId=null==s?void 0:s.lazarilloId,this.innerFloors=null!==(r=null==s?void 0:s.innerFloors.sort(function(e,t){return e.index-t.index}))&&void 0!==r?r:[],this.currentFloor=null!==(i=null!==(n=null!=t?t:null===(o=this.innerFloors.find(function(e){return e.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(e,t){try{var r,i,n;this.updatePlaceAndFloor(e,t),this.filterByFloorKey(this.currentFloor),null===(r=this.onParentPlaceChange)||void 0===r||r.call(this,e),null===(i=this.onFloorChange)||void 0===i||i.call(this,null!==(n=this.currentFloor)&&void 0!==n?n:""),this.logEvent("updateParentPlaceAndFloor")}catch(o){this.logWarning(o,{functionName:"updateParentPlaceAndFloor"})}}},{key:"setLang",value:function(e){this.repository.setLang(e)}},{key:"setParentPlace",value:function(e,t,r){this.changeParentPlaceTo(e,t,r)}},{key:"removeParentPlace",value:function(){this.changeParentPlaceTo(void 0,!0)}},{key:"whenStyleUpdates",value:function(e){this.setBaseFilters(e),this.routeController.addSourcesAndLayers(),this.filterByFloorKey(this.currentFloor)}},{key:"addMarker",value:function(e){var t=this;try{var r,i;if(e.id){var n=this.markers.findIndex(function(t){return t.id===e.id});-1!==n&&(this.markers[n].remove(),this.markers.splice(n,1),this.logEvent("removeMarker",{markerId:e.id,reason:"duplicate"}))}var o=new $e(e),a=!this.parentPlace||null!==(r=null===(i=this.innerFloors.find(function(e){return e.key===t.currentFloor}))||void 0===i?void 0:i.reachableFromGPS)&&void 0!==r&&r;return o.changeFloor(this.currentFloor,this.map,a),this.markers.push(o),this.logEvent("addMarker"),o.id}catch(s){throw this.logWarning(s,{functionName:"addMarker"}),new Error("Failed to add marker")}}},{key:"updateMarker",value:function(e){try{var t,r=this.markers.find(function(t){return t.id===e.id});return void 0!==r&&r.updateIcon(e),this.logEvent("updateMarker"),null!==(t=null==r?void 0:r.id)&&void 0!==t?t:""}catch(i){throw this.logWarning(i,{functionName:"updateMarker"}),new Error("Failed to update marker")}}},{key:"updateMarkerPosition",value:function(e,t){try{var r=this.markers.find(function(t){return t.id===e});void 0!==r&&r.setLngLat(t),this.logEvent("updateMarkerPosition")}catch(i){throw this.logWarning(i,{functionName:"updateMarkerPosition"}),new Error("Failed to update marker position")}}},{key:"showMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&this.map&&(null==t||t.show(this.map)),this.logEvent("showMarker")}catch(r){this.logWarning(r,{functionName:"showMarker"})}}},{key:"hideMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&(null==t||t.hide()),this.logEvent("hideMarker")}catch(r){this.logWarning(r,{functionName:"hideMarker"})}}},{key:"removeMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&(null==t||t.remove(),this.markers=this.markers.filter(function(t){return t.id!==e})),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(e){e.remove()}),this.markers=[],this.logEvent("removeAllMarkers")}catch(e){throw this.logWarning(e,{functionName:"removeAllMarkers"}),new Error("Failed to remove all markers")}}},{key:"filterByFloorKey",value:function(e){this.currentFloor=e;var t=null!=e?e:"";this.innerFloors.every(function(t){return t.key!==e})&&""!==e&&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(e){var t,r,i=this,n=!this.parentPlace||null!==(t=null===(r=this.innerFloors.find(function(t){return t.key===e}))||void 0===r?void 0:r.reachableFromGPS)&&void 0!==t&&t;this.markers.forEach(function(t){t.changeFloor(e,i.map,n)})}},{key:"updateFiltersTo",value:function(e){var t,r,i,n=this;if(this.map){var o=null!==(t=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==t?t:[];o.filter(function(e){return e.id.startsWith("base-indoor-")}).forEach(function(e){n.map.removeLayer(e.id)});var a=null===(i=this.innerFloors.find(function(t){return t.key===e}))||void 0===i?void 0:i.baseFloor,s=o.filter(function(e){return e.id.startsWith("indoor-")});if(null!=a){var l,c=null===(l=s[0])||void 0===l?void 0:l.id;s.filter(function(e){return"fill-extrusion"!==e.type}).forEach(function(e){var t=ai(e);t.id="base-"+e.id,n.baseFilters[t.id]=n.baseFilters[e.id],n.map.addLayer(t,c),n.applyLayerFilters(t,a)})}s.forEach(function(t){n.applyLayerFilters(t,e)})}}},{key:"applyLayerFilters",value:function(e,t){var r,i=this.baseFilters[e.id],n=null!=t?t:"",o=["any",["in",n,["get","floor_key"]]],a=["==",["get","public_place"],!0],s=["!",["in",null!==(r=this.parentPlaceId)&&void 0!==r?r:"noRef",["get","is_subplace"]]],l=["in",n,["get","show_in_floor"]],c=a;null!=this.parentPlaceId&&(c=["any",o,a]);var u=["all",c,["any",s,l]];if(e.id.includes("hover")?i=["in",this.hoveredId,["get","ref"]]:e.id.includes("colored")||"fill"!=e.type&&"fill-extrusion"!==e.type||u.push(["!",["in",this.hoveredId,["get","ref"]]]),null!=i){var h=["all",i,u];this.map.setFilter(e.id,h)}else this.map.setFilter(e.id,u)}},{key:"getInnerFloors",value:function(){return this.innerFloors}},{key:"updateCamera",value:function(e,t){this.map.once("moveend",t),this.map.easeTo(Yr({},e))}},{key:"setMaxZoom",value:function(e){this.map.setMaxZoom(e)}},{key:"setMinZoom",value:function(e){this.map.setMinZoom(e)}},{key:"isInsideBounds",value:function(e){var t=this.map.getMaxBounds();return null==t||t.contains(e)}},{key:"setMaxBounds",value:function(e){if(e.length>1){var t=Re(e);this.map.setMaxBounds(new ke.LngLatBounds([t[0].lng,t[0].lat],[t[1].lng,t[1].lat]))}}},{key:"fitCoordinates",value:function(e,t){if(1===e.length){var r=Wr(e,1)[0];this.map.setCenter({lat:r.lat,lng:r.lng})}else if(e.length>1){var i,n,o,a,s,l=$r(e);try{for(l.s();!(s=l.n()).done;){var c=s.value,u=c.lat,h=c.lng;i=void 0===i?u:Math.min(i,u),n=void 0===n?h:Math.min(n,h),o=void 0===o?u:Math.max(o,u),a=void 0===a?h:Math.max(a,h)}}catch(m){l.e(m)}finally{l.f()}var d=[null!=n?n:0,null!=i?i:0,null!=a?a:0,null!=o?o:0];if(t){var p=this.map.getBearing(),f=this.map.getPitch();t.bearing=void 0!==t.bearing?t.bearing:p,t.pitch=void 0!==t.pitch?t.pitch:f}this.map.fitBounds(d,t)}}},{key:"getZoomLevel",value:function(){return this.map.getZoom()}},{key:"updateFloor",value:function(e){try{var t;this.filterByFloorKey(e),null===(t=this.onFloorChange)||void 0===t||t.call(this,e),this.logEvent("updateFloor",{floorId:e})}catch(r){this.logWarning(r,{functionName:"updateFloor",floorId:e})}}},{key:"updatePlaceAndFloorForRouting",value:function(e,t){try{var r;this.updatePlaceAndFloor(e,t),this.updateFiltersTo(t),this.updateMarkersTo(t),null===(r=this.onFloorChange)||void 0===r||r.call(this,t),this.logEvent("updatePlaceAndFloorForRouting",{floorId:t})}catch(i){this.logWarning(i,{functionName:"updatePlaceAndFloorForRouting",floorId:t})}}},{key:"addRoute",value:(a=qr(Vr().m(function e(t){var r,i,n,o,a,s=arguments;return Vr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},e.p=1,this.logEvent("addRoute"),i=new bt(t),n=new xt(r),e.n=2,this.repository.fetchAndParseRoute(i);case 2:return o=e.v,this.routeController.addRoute(o,n),e.a(2,o);case 3:throw e.p=3,a=e.v,this.logWarning(a,{functionName:"addRoute"}),new Error("Error: Failed to add route");case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return a.apply(this,arguments)})},{key:"removeRoute",value:function(){try{this.logEvent("removeRoute"),this.routeController.removeRoute()}catch(e){this.logWarning(e,{functionName:"removeRoute"})}}},{key:"addPopOver",value:function(e){var t=e.placeId;if(void 0!==t){var r=this.subPlaces.find(function(e){return e.clientId===t||e.lazarilloId===t});void 0!==r&&(new(Ae().Popup)).setLngLat(r.position).setHTML(r.title).addTo(this.map)}return""}},{key:"removePopOver",value:function(e){throw Error("Not implemented")}},{key:"startClickListener",value:function(e){this.clickCallback=e}},{key:"stopClickListener",value:function(){this.clickCallback=void 0}},{key:"defaultClickListener",value:function(){var e=this;this.map.on("click",function(){var t=qr(Vr().m(function t(r){var i,n,o,a,s,l,c,u,h,d,p,f,m,g,y,_,v;return Vr().w(function(t){for(;;)switch(t.p=t.n){case 0:if(i=e.map.queryRenderedFeatures(r.point),n=i.filter(function(t){var r;return"room"===t.properties.class&&(null===(r=t.properties)||void 0===r?void 0:r.floor_key)===e.currentFloor}),o=n[0],!(null!=(a=null==o?void 0:o.properties.ref)&&"string"==typeof a&&a.length>0)){t.n=11;break}if(console.log("touchedFeature",a),void 0!==(d=e.subPlaces.find(function(e){return e.lazarilloId===a}))){t.n=7;break}p=$r(e.potentialParentPlaces),t.p=1,p.s();case 2:if((f=p.n()).done){t.n=4;break}if(m=f.value,!(g=e.repository.getCachedSubPlaces(m.lazarilloId))){t.n=3;break}if(void 0===(d=g.find(function(e){return e.lazarilloId===a}))){t.n=3;break}return t.a(3,4);case 3:t.n=2;break;case 4:t.n=6;break;case 5:t.p=5,v=t.v,p.e(v);case 6:return t.p=6,p.f(),t.f(6);case 7:if(void 0!==d){t.n=10;break}if(0!==(y=e.repository.getCachedPlaces([a])).length){t.n=9;break}return console.log("fetching place detail from server",a),t.n=8,e.repository.fetchAndParsePlaceDetail(a);case 8:d=t.v,t.n=10;break;case 9:console.log("using cached place detail",a),d=null==y?void 0:y[0];case 10:console.log("clickedPlace",null===(s=d)||void 0===s?void 0:s.title),_=null!==(l=null!==(c=null===(u=d)||void 0===u?void 0:u.lazarilloId)&&void 0!==c?c:null===(h=d)||void 0===h?void 0:h.clientId)&&void 0!==l?l:"",void 0!==d&&e.clickCallback&&e.clickCallback(_);case 11:return t.a(2)}},t,null,[[1,5,6,7]])}));return function(e){return t.apply(this,arguments)}}())}},{key:"onHover",value:function(){var e=this;this.enableHover&&(this.map.on("mousemove","hoverable",function(t){var r,i=null===(r=t.features)||void 0===r?void 0:r.find(function(t){var r,i;return(null===(r=t.properties.ref)||void 0===r?void 0:r.length)>0&&(null===(i=t.properties)||void 0===i?void 0:i.floor_key)===e.currentFloor}),n=null==i?void 0:i.properties.ref;null!=n&&"string"==typeof n&&n.length>0?(e.hoveredId=n,e.updateFiltersTo(e.currentFloor)):void 0===n&&"unselected"!==e.hoveredId&&(e.hoveredId="unselected",e.updateFiltersTo(e.currentFloor))}),this.map.on("mouseleave","hoverable",function(){e.hoveredId="unselected",e.updateFiltersTo(e.currentFloor)}))}},{key:"setPlacesAsSelected",value:function(e,t){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=e.map(function(e){return["==",["get","ref"],e]}),n=["any"].concat(Zr(i)),o=["all",n,r];if(this.map.setFilter("indoor-colored-places",o),this.baseFilters["indoor-colored-places"]=n,void 0!==t){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",t);break;case"fill-extrusion":this.map.setPaintProperty("indoor-colored-places","fill-extrusion-color",t)}}}catch(s){this.logWarning(s,{functionName:"setPlacesAsSelected"})}}},{key:"is3DStyle",value:function(){return this.map.getStyle().layers.some(function(e){return"fill-extrusion"===e.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 e,t,r=["==",["get","public_place"],!0],i=["!",["in",null!==(e=this.parentPlaceId)&&void 0!==e?e:"noRef",["get","is_subplace"]]],n=null!==(t=this.currentFloor)&&void 0!==t?t:"noRef",o=["in",n,["get","floor_key"]],a=["in",n,["get","show_in_floor"]],s=r;return null!=this.parentPlaceId&&(s=["any",o,r]),["all",s,["any",i,a]]}},{key:"hasLayer",value:function(e){return void 0!==this.map.getLayer(e)}},{key:"clearColoredPlaces",value:function(){if(this.hasLayer("indoor-colored-places")){var e=["==",["get","ref"],"unselected"];this.baseFilters["indoor-colored-places"]=e,this.map.setFilter("indoor-colored-places",e)}}},{key:"startAnimateRoute",value:(o=qr(Vr().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Vr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof qt)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new bt(t),e.n=3,this.repository.fetchAndParseRoute(o);case 3:n=e.v;case 4:return a=new Pt(r),s=new It(i),this.routeController.startAnimating(n,a,s),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"startAnimateRoute"}),new Error("Error: Failed to start animating route");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return o.apply(this,arguments)})},{key:"startAnimateRouteV2",value:(n=qr(Vr().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Vr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof qt)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new bt(t),e.n=3,this.repository.fetchAndParseRouteV2(o);case 3:n=e.v;case 4:return a=new Pt(r),s=new It(i),this.routeController.startAnimating(n,a,s),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"startAnimateRouteV2"}),new Error("Error: Failed to start animating route");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return n.apply(this,arguments)})},{key:"pauseAnimateRoute",value:function(){try{this.routeController.pauseAnimation(),this.logEvent("pauseAnimateRoute")}catch(e){this.logWarning(e,{functionName:"pauseAnimateRoute"})}}},{key:"resumeAnimateRoute",value:function(){try{this.routeController.resumeAnimation(),this.logEvent("resumeAnimateRoute")}catch(e){this.logWarning(e,{functionName:"resumeAnimateRoute"})}}},{key:"restartAnimateRoute",value:function(){try{this.routeController.restartAnimation(),this.logEvent("restartAnimateRoute")}catch(e){this.logWarning(e,{functionName:"restartAnimateRoute"})}}},{key:"stopAnimateRoute",value:function(){this.logWarning(new Error("Not implemented"),{functionName:"stopAnimateRoute"})}},{key:"addStepAnimation",value:(i=qr(Vr().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Vr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof qt)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new bt(t),e.n=3,this.repository.fetchAndParseRoute(o);case 3:n=e.v;case 4:return a=new Pt(r),s=new It(i),this.routeController.addStepAnimation(n,a,s),this.logEvent("addStepAnimation"),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"addStepAnimation"}),new Error("Error: Failed to add step animation");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return i.apply(this,arguments)})},{key:"addStepAnimationV2",value:(r=qr(Vr().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Vr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof qt)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new bt(t),e.n=3,this.repository.fetchAndParseRouteV2(o);case 3:n=e.v;case 4:return a=new Pt(r),s=new It(i),this.routeController.addStepAnimation(n,a,s),this.logEvent("addStepAnimationV2"),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"addStepAnimationV2"}),new Error("Error: Failed to add step animation");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return r.apply(this,arguments)})},{key:"nextStepAnimation",value:function(){try{this.routeController.nextStepAnimation(),this.logEvent("nextStepAnimation")}catch(e){throw this.logWarning(e,{functionName:"nextStepAnimation"}),new Error("Error: Failed to animate step")}}},{key:"previousStepAnimation",value:function(){try{this.routeController.previousStepAnimation(),this.logEvent("previousStepAnimation")}catch(t){this.logWarning(t,{functionName:"previousStepAnimation"});var e=t instanceof Error?t.message:String(t);throw new Error("Error: Failed to prepare to animate previous step, "+e)}}},{key:"centerOnCurrentStepAnimation",value:function(){try{this.routeController.centerOnCurrentStep(),this.logEvent("centerOnCurrentStepAnimation")}catch(t){this.logWarning(t,{functionName:"centerOnCurrentStepAnimation"});var e=t instanceof Error?t.message:String(t);throw new Error("Error: Failed to center on current step animation, "+e)}}},{key:"addUserLocationTracking",value:function(e,t){var r=new Image(40,40);r.src=Ce;var i=new $e({coordinate:{lat:0,lng:0},icon:r,text:""});i.addToMap(this.map),this.userLocationMarker=i,this.geoLocation=null!=t?t:navigator.geolocation,this.watchPositionID=this.geoLocation.watchPosition(function(e){i.setLngLat([e.coords.longitude,e.coords.latitude])},function(e){console.error("Error getting user location:",e)},{enableHighAccuracy:e})}},{key:"removeUserLocationTracking",value:function(){void 0!==this.userLocationMarker?(this.userLocationMarker.remove(),this.userLocationMarker=void 0,this.watchPositionID&&(this.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(e,t,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=e.map(function(e){return["==",["get","ref"],e]}),o=["any"].concat(Zr(n)),a=["all",o,i];this.map.setFilter("indoor-bordered-places",a),this.baseFilters["indoor-bordered-places"]=o,void 0!==t&&void 0!==r&&(this.map.setPaintProperty("indoor-bordered-places","line-color",t),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 e=["==",["get","ref"],"unselected"];this.baseFilters["indoor-bordered-places"]=e,this.map.setFilter("indoor-bordered-places",e)}}},{key:"onWebGLContextLost",value:function(e){var t=this;e.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"),t.map.triggerRepaint(),t.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(e){if("vector"===e.source.type&&"indoorequal"===e.sourceId&&e.tile&&!e.isSourceLoaded){var t,r=null===(t=e.tile)||void 0===t?void 0:t.state;"errored"!==r&&"expired"!==r||this.failedTiles.add(e.tile)}}},{key:"onSourceDataAbort",value:function(e){"vector"===e.source.type&&"indoorequal"===e.sourceId&&e.tile&&this.failedTiles.delete(e.tile)}},{key:"subscribeToFailedTiles",value:function(){var e=this;this.retryTimer||(this.boundOnSourceData=this.onSourceData.bind(this),this.boundOnSourceDataAbort=this.onSourceDataAbort.bind(this),this.boundOnWebGLContextLost=this.onWebGLContextLost.bind(this),this.boundOnWebGLContextRestored=this.onWebGLContextRestored.bind(this),this.retryTimer=setInterval(function(){if(e.map.getSource("indoorequal")){var t=e.map.getSource("indoorequal");if(t&&"vector"===t.type){var r=[],i=[];e.failedTiles.forEach(function(e){!e||"unloaded"===e.state||"loading"===e.state||"errored"!==e.state&&"expired"!==e.state?i.push(e):r.push(e)}),i.forEach(function(t){return e.failedTiles.delete(t)}),r.forEach(function(r){try{!r||"errored"!==r.state&&"expired"!==r.state||t.loadTile(r)}catch(i){e.failedTiles.delete(r),e.logWarning(i,{functionName:"subscribeToFailedTiles",tileState:null==r?void 0:r.state})}})}else e.failedTiles.clear()}else e.failedTiles.clear()},1e3),this.map.on("sourcedata",this.boundOnSourceData),this.map.on("sourcedataabort",this.boundOnSourceDataAbort),this.map.on("webglcontextlost",this.boundOnWebGLContextLost),this.map.on("webglcontextrestored",this.boundOnWebGLContextRestored))}},{key:"unsubscribeFromFailedTiles",value:function(){this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=void 0),this.boundOnSourceData&&(this.map.off("sourcedata",this.boundOnSourceData),this.boundOnSourceData=void 0),this.boundOnSourceDataAbort&&(this.map.off("sourcedataabort",this.boundOnSourceDataAbort),this.boundOnSourceDataAbort=void 0),this.boundOnWebGLContextLost&&(this.map.off("webglcontextlost",this.boundOnWebGLContextLost),this.boundOnWebGLContextLost=void 0),this.boundOnWebGLContextRestored&&(this.map.off("webglcontextrestored",this.boundOnWebGLContextRestored),this.boundOnWebGLContextRestored=void 0),this.failedTiles.clear()}}]);var r,i,n,o,a}(Dt);function li(e){return void 0!==e.logo}function ci(e){return void 0!==e.icon}function ui(e){return ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ui(e)}function hi(e){return function(e){if(Array.isArray(e))return di(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return di(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?di(e,t):void 0}}(e)||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 di(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function pi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return fi(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(fi(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,fi(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,fi(h,"constructor",c),fi(c,"constructor",l),l.displayName="GeneratorFunction",fi(c,n,"GeneratorFunction"),fi(h),fi(h,n,"Generator"),fi(h,i,function(){return this}),fi(h,"toString",function(){return"[object Generator]"}),(pi=function(){return{w:o,m:d}})()}function fi(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}fi=function(e,t,r,i){function o(t,r){fi(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},fi(e,t,r,i)}function mi(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function gi(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){mi(o,i,n,a,s,"next",e)}function s(e){mi(o,i,n,a,s,"throw",e)}a(void 0)})}}function yi(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ei(i.key),i)}}function _i(e,t,r){return t=bi(t),function(e,t){if(t&&("object"==ui(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,vi()?Reflect.construct(t,[],bi(e).constructor):t.apply(e,r))}function vi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(vi=function(){return!!e})()}function bi(e){return bi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bi(e)}function xi(e,t){return xi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xi(e,t)}function wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Ti(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wi(Object(r),!0).forEach(function(t){Si(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wi(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Si(e,t,r){return(t=Ei(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ei(e){var t=function(e,t){if("object"!=ui(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=ui(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ui(t)?t:t+""}function Ii(e,t){var r=Ti(Ti({},{lang:"en",apiUrl:"https://api.mapvx.com",cache:{persistent:!1}}),t);return new Pi(e,r)}var Pi=function(e){function t(e,r){var i,n,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Si(a=_i(this,t),"geoLocation",navigator.geolocation),Si(a,"headingListeners",[]),a.token=e,a.config=r;var s=new J({persistent:null===(i=r.cache)||void 0===i?void 0:i.persistent,maxStorageBytes:null===(n=r.cache)||void 0===n?void 0:n.maxStorageBytes,configs:null===(o=r.cache)||void 0===o?void 0:o.configs});return a.repository=new Nr(e,a.config.lang,a.config.apiUrl,s),a.cachePlaces(),a.logEvent("initSDK"),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xi(e,t)}(t,e),function(e,t,r){return t&&yi(e.prototype,t),r&&yi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"cachePlaces",value:function(){var e=this;this.repository.fetchAndParseAvailablePlaces().catch(function(t){e.logWarning(t)})}},{key:"setSdkLang",value:function(e){this.config.lang=e,this.repository.setLang(e)}},{key:"getPlaceDetail",value:(v=gi(pi().m(function e(t){var r,i;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParsePlaceDetail(t);case 1:return r=e.v,this.logEvent("getPlaceDetail",{id:t}),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getPlaceDetail",id:t}),Error("Error getPlaceDetail");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return v.apply(this,arguments)})},{key:"getAnyPlaceDetail",value:(_=gi(pi().m(function e(t,r){var i,n;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAnyPlaceDetail(t,r);case 1:return i=e.v,this.logEvent("getAnyPlaceDetail",{id:t}),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getAnyPlaceDetail",id:t}),Error("Error getAnyPlaceDetail");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return _.apply(this,arguments)})},{key:"prepareSegmentation",value:function(e){return Ti(Ti({},e),{},{token:this.token})}},{key:"createMap",value:function(e,t){try{t.lang=this.config.lang;var r=new si(t,e,this.token);return this.logEvent("createMap"),r}catch(i){throw this.logWarning(i,{functionName:"createMap"}),new Error("Failed to create map")}}},{key:"getConfiguration",value:(y=gi(pi().m(function e(t,r){var i,n;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseConfiguration(t,r);case 1:return i=e.v,this.logEvent("configuration"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getConfiguration"}),new Error("Failed to get configuration");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return y.apply(this,arguments)})},{key:"getCategories",value:(g=gi(pi().m(function e(t){var r,i;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCategories(t);case 1:return r=e.v,this.logEvent("categories"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getCategories"}),new Error("Failed to get categories");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return g.apply(this,arguments)})},{key:"getTransport",value:(m=gi(pi().m(function e(t){var r;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseTransport(t);case 1:return r=e.v,e.a(2,r);case 2:throw e.p=2,e.v,Error("Failed to get transport");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return m.apply(this,arguments)})},{key:"getCachedPlaces",value:function(e){try{var t=this.repository.getCachedPlaces(e);return this.logEvent("getCachedPlaces"),t}catch(r){throw this.logWarning(r,{functionName:"getCachedPlaces"}),Error("Failed to get cached places")}}},{key:"getAvailablePlaces",value:(f=gi(pi().m(function e(){var t,r;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAvailablePlaces();case 1:return t=e.v,this.logEvent("getAvailablePlaces"),e.a(2,t);case 2:throw e.p=2,r=e.v,this.logWarning(r,{functionName:"getAvailablePlaces"}),Error("Failed to get available places");case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return f.apply(this,arguments)})},{key:"getSubPlaces",value:(p=gi(pi().m(function e(t){var r,i;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseSubPlaces(t);case 1:return r=e.v,this.logEvent("getSubPlaces"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getSubPlaces"}),Error("Failed to get subplaces");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return p.apply(this,arguments)})},{key:"getPlacesFromInstitution",value:(d=gi(pi().m(function e(t,r){var i,n;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParsePlacesFromInstitution(t,r);case 1:return i=e.v,this.logEvent("getPlacesFromInstitution"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getPlacesFromInstitution"}),Error("Failed to get places from institution");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return d.apply(this,arguments)})},{key:"getAnySubPlaces",value:(h=gi(pi().m(function e(t,r){var i,n;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAnySubPlaces(t,r);case 1:return i=e.v,this.logEvent("getAnySubPlaces"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getAnySubPlaces"}),Error("Failed to get any sub-places");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return h.apply(this,arguments)})},{key:"getInstitutions",value:(u=gi(pi().m(function e(){var t,r;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseInstitutions();case 1:return t=e.v,this.logEvent("getInstitutions"),e.a(2,t);case 2:throw e.p=2,r=e.v,this.logWarning(r,{functionName:"getInstitution"}),Error("Error getInstitution");case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return u.apply(this,arguments)})},{key:"getRoute",value:(c=gi(pi().m(function e(t){var r,i,n;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new bt(t),e.n=1,this.repository.fetchAndParseRoute(r);case 1:return i=e.v,this.logEvent("getRoute"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getRoute"}),new Error("Failed to get route");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return c.apply(this,arguments)})},{key:"getRouteV2",value:(l=gi(pi().m(function e(t){var r,i,n;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new bt(t),e.n=1,this.repository.fetchAndParseRouteV2(r);case 1:return i=e.v,this.logEvent("getRouteV2"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getRouteV2"}),new Error("Failed to get route");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return l.apply(this,arguments)})},{key:"getPlacesByInput",value:(s=gi(pi().m(function e(t,r,i,n,o,a,s,l){var c,u,h;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,c=i?n?[i].concat(hi(n)):[i]:n,e.n=1,this.repository.fetchAndParseSearchResults(r,t,c,o,a,s,l);case 1:return u=e.v,this.logEvent("getPlacesByInput"),e.a(2,u);case 2:throw e.p=2,h=e.v,this.logWarning(h,{functionName:"getPlacesByInput"}),new Error("Failed to get places by input");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t,r,i,n,o,a,l){return s.apply(this,arguments)})},{key:"getPlacesByCategory",value:(a=gi(pi().m(function e(t){var r;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.logEvent("getPlacesByCategory"),e.a(2,[]);case 1:throw e.p=1,r=e.v,this.logWarning(r,{functionName:"getPlacesByCategory"}),new Error("Failed to get places by category");case 2:return e.a(2)}},e,this,[[0,1]])})),function(e){return a.apply(this,arguments)})},{key:"setGeoLocation",value:function(e){this.geoLocation=e}},{key:"getUserLocation",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e4};return new Promise(function(r,i){e.geoLocation.getCurrentPosition(function(e){r(e)},function(e){i(e)},t)})}},{key:"watchUserPosition",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e3};return this.geoLocation.watchPosition(function(t){e(t)},function(e){t(e)},r)}},{key:"unWatchUserPosition",value:function(e){this.geoLocation.clearWatch(e)}},{key:"watchUserHeading",value:function(e,t){var r=function(r){if(function(e){return e 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?e(i):t("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(e){window.removeEventListener("deviceorientationabsolute",e),window.removeEventListener("deviceorientation",e)}),this.headingListeners=[]}},{key:"loadRoutesForOriginCache",value:(o=gi(pi().m(function e(t,r,i,n,o){return pi().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.repository.fetchAndParseRoutesFromOrigin(t,r,i,n,o);case 1:return e.a(2)}},e,this)})),function(e,t,r,i,n){return o.apply(this,arguments)})},{key:"getCacheTimestamp",value:(n=gi(pi().m(function e(t){var r,i;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCacheTimestamp(t);case 1:return r=e.v,this.logEvent("getCacheTimestamp"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getCacheTimestamp"}),new Error("Failed to get cache timestamp");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return n.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.repository.cleanRoutesCache()}},{key:"getCssCustomization",value:(i=gi(pi().m(function e(t){var r,i;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCssCustomization(t);case 1:return r=e.v,this.logEvent("cssCustomization"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getCssCustomization"}),new Error("Failed to get css customization");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return i.apply(this,arguments)})},{key:"notifyHealth",value:(r=gi(pi().m(function e(t,r,i,n){var o,a;return pi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.postAndParseHealthPing(t,r,i,n);case 1:return o=e.v,e.a(2,o);case 2:throw e.p=2,a=e.v,this.logWarning(a,{functionName:"notifyHealth"}),new Error("Failed to notify health");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t,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,g,y,_,v}(Dt);function ki(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ai(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ai(e,t):void 0}}(e,t)||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 Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Ci(e){var t=document.createElement("style");t.textContent="";for(var r=0,i=Object.entries(e);r<i.length;r++){var n=ki(i[r],2),o=Mi(n[0],n[1]);t.textContent+=o}document.head.appendChild(t);var a=Object.keys(e).at(0);null!=a&&document.body.classList.add(a)}function Mi(e,t){var r=".".concat(e," {\n"),i=t.definitions;null!=i&&(r=function(e,t){for(var r=0,i=Object.entries(null!==(n=e.colors)&&void 0!==n?n:{});r<i.length;r++)for(var n,o=ki(i[r],2),a=o[0],s=o[1],l=0,c=Object.entries(s);l<c.length;l++){var u=ki(c[l],2),h=u[0],d=u[1];t+=" --definitions-colors-".concat(a,"-").concat(h,": ").concat(d,";\n")}for(var p=0,f=Object.entries(null!==(m=e.shadows)&&void 0!==m?m:{});p<f.length;p++){var m,g=ki(f[p],2),y=g[0],_=g[1];t+=" --definitions-shadows-".concat(y,": ").concat(_,";\n")}for(var v=0,b=Object.entries(null!==(x=e.textFonts)&&void 0!==x?x:{});v<b.length;v++){var x,w=ki(b[v],2),T=w[0],S=w[1];t+=" --definitions-textFonts-".concat(T,": ").concat(S,";\n")}return t}(i,r));for(var n=0,o=Object.entries(null!==(a=t.screens)&&void 0!==a?a:{});n<o.length;n++)for(var a,s=ki(o[n],2),l=s[0],c=s[1],u=0,h=Object.entries(c);u<h.length;u++)for(var d=ki(h[u],2),p=d[0],f=d[1],m=0,g=Object.entries(f);m<g.length;m++)for(var y=ki(g[m],2),_=y[0],v=y[1],b=0,x=Object.entries(v);b<x.length;b++){var w=ki(x[b],2),T=w[0],S=w[1];r+=" --".concat(l,"-").concat(p,"-").concat(_,"-").concat(T,": ").concat(S,";\n")}return r+="}\n"}function Di(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Li(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ri(e){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ri(e)}function Oi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||Li(e,t)||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 Li(e,t){if(e){if("string"==typeof e)return Fi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fi(e,t):void 0}}function Fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function zi(e,t,r){return r&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Bi(i.key),i)}}(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bi(e){var t=function(e,t){if("object"!=Ri(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ri(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ri(t)?t:t+""}var Ni=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return zi(e,0,[{key:"getDay",value:function(e){try{switch(e.getDay()){case 0:return"su";case 1:return"mo";case 2:return"tu";case 3:return"we";case 4:return"th";case 5:return"fr";case 6:return"sa";default:return null}}catch(t){return null}}},{key:"convertSingleTimeTo12Hour",value:function(e){try{var t;if(!e||"string"!=typeof e)return"";var r=Oi(null!==(t=e.split(":"))&&void 0!==t?t:[],2),i=r[0],n=r[1];if(!i||!n)return"";var o=parseInt(i,10),a=parseInt(n,10);if(isNaN(o)||isNaN(a)||o<0||o>23||a<0||a>59)return"";var s,l=o%24;return l<12?(s="a.m.",0===l&&(l=12)):(s="p.m.",12!==l&&(l-=12)),"".concat(l,":").concat(a<10?"0":"").concat(a," ").concat(s)}catch(c){return""}}},{key:"formatTimeSchedule",value:function(t){try{if(!t||!t.open||!t.close)return"";if(ji(t))return"24 hrs";var r=e.convertSingleTimeTo12Hour(t.open),i=e.convertSingleTimeTo12Hour(t.close);return""===r||""===i?"":"".concat(r," - ").concat(i)}catch(n){return""}}},{key:"getDayNumber",value:function(e){try{switch(e){case"mo":return 1;case"tu":return 2;case"we":return 3;case"th":return 4;case"fr":return 5;case"sa":return 6;case"su":return 7;default:return-1}}catch(t){return-1}}},{key:"getDayName",value:function(t){try{var r=e.getDayNumber(t);if(-1===r)return"";var i=new Date(2024,0,r);try{var n=Pi.getLang();return i.toLocaleDateString(n,{weekday:"long"})}catch(o){return i.toLocaleDateString("en",{weekday:"long"})}}catch(a){return""}}},{key:"sortDays",value:function(t){try{return Object.fromEntries(Object.entries(t).sort(function(t,r){var i=Oi(t,1)[0],n=Oi(r,1)[0];return e.getDayNumber(i)-e.getDayNumber(n)}))}catch(r){return t}}},{key:"isOpenFromPreviousDay",value:function(t,r){try{if(!t||"object"!==Ri(t))return!1;var i=r||new Date,n=new Date(i);e.previousDate(n);var o=e.getDay(n);if(null==o)return!1;var a=t[o];if(!a||!Array.isArray(a)||0===a.length)return!1;var s,l=Di(a);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(ji(c))return!0;if(c&&c.open&&c.close&&e.isValidTime(c.open)&&e.isValidTime(c.close)){var u=e.parseTimeAsDate(c.open,n),h=e.parseTimeAsDate(c.close,n);if(u>h&&e.nextDate(h),i>=u&&i<=h)return!0}}}catch(d){l.e(d)}finally{l.f()}return!1}catch(p){return!1}}},{key:"previousDate",value:function(e){try{var t=e.getDate();e.setDate(t-1)}catch(r){}}},{key:"nextDate",value:function(e){try{var t=e.getDate();e.setDate(t+1)}catch(r){}}},{key:"isWithinOpeningHours",value:function(t,r){try{if(!t||"object"!==Ri(t))return!1;var i=r||new Date,n=e.getDay(i);if(null==n)return!1;if(e.isOpenFromPreviousDay(t,i))return!0;var o=t[n];if(!o||!Array.isArray(o)||0===o.length)return!1;var a,s=Di(o);try{for(s.s();!(a=s.n()).done;){var l=a.value;if(ji(l))return!0;if(l&&l.open&&l.close&&e.isValidTime(l.open)&&e.isValidTime(l.close)){var c=e.parseTimeAsDate(l.open,i),u=e.parseTimeAsDate(l.close,i);if(c>=u&&e.nextDate(u),i>=c&&i<=u)return!0}}}catch(h){s.e(h)}finally{s.f()}return!1}catch(d){return!1}}},{key:"hasOpeningHoursToday",value:function(t){try{if(!t||"object"!==Ri(t))return!1;var r=new Date,i=e.getDay(r);if(null==i)return!1;var n=t[i];return!!(n&&n.length>0)}catch(o){return!1}}},{key:"isValidTime",value:function(e){try{return!(!e||"string"!=typeof e)&&/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e)}catch(t){return!1}}},{key:"parseTimeAsDate",value:function(e,t){try{var r=Oi(e.split(":").map(Number),2),i=r[0],n=r[1],o=t?new Date(t):new Date;return new Date(o.getFullYear(),o.getMonth(),o.getDate(),i,n,0,0)}catch(a){return new Date}}},{key:"flattenOpeningTimes",value:function(t){try{if(!t||!Array.isArray(t)||0===t.length)return{open:"00:00",close:"00:00"};e.sortOpeningTimesByOpen(t);var r=t[0],i=t[t.length-1];return r&&i&&r.open&&i.close?{open:r.open,close:i.close}:{open:"00:00",close:"00:00"}}catch(n){return{open:"00:00",close:"00:00"}}}},{key:"sortOpeningTimesByOpen",value:function(e){try{return e.sort(function(e,t){return e.open.localeCompare(t.open)})}catch(t){return e}}},{key:"formatCurrentDaySchedule",value:function(t){try{var r=new Date,i=e.getDay(r);if(null==i)return"";var n=t[i];if(n&&n.length>0){var o=e.flattenOpeningTimes(n);return e.formatTimeSchedule(o)}return""}catch(a){return""}}},{key:"formatPreviousDaySchedule",value:function(t){try{var r=new Date;e.previousDate(r);var i=e.getDay(r);if(null==i)return"";var n=t[i];if(n&&n.length>0){var o=e.flattenOpeningTimes(n);return e.formatTimeSchedule(o)}return""}catch(a){return""}}},{key:"isValidSchedule",value:function(t,r,i){try{if(!e.isValidTime(t)||!e.isValidTime(r)||!e.isValidTime(i))return!1;var n=e.toMinutes(t),o=e.toMinutes(r),a=e.toMinutes(i);return a>=n&&a<=o}catch(s){return!1}}},{key:"parseTimeToDate",value:function(e,t){try{if(!e||"string"!=typeof e)return new Date;var r=Oi(e.split(":"),2),i=r[0],n=r[1];if(!i||!n)return new Date;var o=parseInt(i,10),a=parseInt(n,10);if(isNaN(o)||isNaN(a))return new Date;var s=t?new Date(t):new Date;return s.setHours(o,a,0,0),s}catch(l){return new Date}}},{key:"getDaysRange",value:function(e){try{var t={Mo:"Monday",Tu:"Tuesday",We:"Wednesday",Th:"Thursday",Fr:"Friday",Sa:"Saturday",Su:"Sunday"};if(0===e.length)return"";var r=t[e[0]]||"Invalid day",i=t[e[e.length-1]]||"Invalid day";return 1===e.length?r:"".concat(r," - ").concat(i)}catch(n){return""}}},{key:"getNextClosestTime",value:function(t,r){try{var i=60*r.getHours()+r.getMinutes(),n=t.map(function(t){var r=e.toMinutes(t);return{time:t,diff:r-i+(r<i?1440:0)}});return n.sort(function(e,t){return e.diff-t.diff}),n.length>0?n[0].time:""}catch(o){return""}}},{key:"isPlaceOpen",value:function(t,r){try{if(!t||"object"!==Ri(t))return!1;var i=r||new Date,n=e.getDay(i);if(null==n||!t[n]||!Array.isArray(t[n])||0===t[n].length)return!1;var o=t[n][0];if(!o||!o.open||!o.close)return!1;var a=o.open,s=o.close;if(!e.isValidTime(a)||!e.isValidTime(s))return!1;var l=e.parseTimeToDate(a,i),c=e.parseTimeToDate(s,i);c<l&&c.setDate(c.getDate()+1);var u=new Date(i);return u.setSeconds(0,0),u>=l&&u<=c}catch(h){return!1}}},{key:"getNextSchedule",value:function(t,r){try{if(!t||"object"!==Ri(t))return"";var i=r||new Date,n=e.getDay(i);if(null==n||!t[n]||!Array.isArray(t[n])||0===t[n].length)return"";var o=t[n][0];if(!o||!o.open||!o.close)return"";var a=e.isPlaceOpen(t,i)?o.close:o.open;return a?e.convertSingleTimeTo12Hour(a):""}catch(s){return""}}},{key:"checkDayHasSchedule",value:function(t,r){try{var i=r||new Date,n=e.getDay(i);return null!=n&&!(!t||!t[n])}catch(o){return!1}}},{key:"toMinutes",value:function(e){try{if(!e||"string"!=typeof e)return 0;var t=Oi(e.split(":"),2),r=t[0],i=t[1];if(!r||!i)return 0;var n=parseInt(r,10),o=parseInt(i,10);return isNaN(n)||isNaN(o)?0:60*n+o}catch(a){return 0}}}])}();function ji(e){var t,r,i,n;if(null==e||!e.open||null==e||!e.close)return!1;var o=null!==(t=null==e||null===(r=e.open)||void 0===r?void 0:r.trim())&&void 0!==t?t:"",a=null!==(i=null==e||null===(n=e.close)||void 0===n?void 0:n.trim())&&void 0!==i?i:"";return"00:00"===o&&"24:00"===a||"00:00"===o&&"00:00"===a}var Vi=function(){if(!document.querySelector("link[data-lazarillo-styles]")){var e=document.createElement("link");e.rel="stylesheet",e.href="./styles.css",e.setAttribute("data-lazarillo-styles","true"),document.head.appendChild(e)}}})(),n})(),ge.exports=ve(_e())),xe=(e=>(e.youAreHere="youAreHere",e.placePopup="placePopup",e.pin="pin",e.default="default",e))(xe||{});const we="lazarillo-sdk";var Te,Se={exports:{}};var Ee,Ie=(Te||(Te=1,Ee=Se,function(e,t){Ee.exports=t()}(0,()=>{return e={12:(e,t,r)=>{var i=r(539);e.exports=function(e,t,r){var n,o,a,s,l=i.isType(e,"object"),c=i.isType(e,"array"),u=[];if(r=r||{obj:[],mapped:[]},l){if(s=r.obj.indexOf(e),l&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(e),s=r.obj.length-1}if(l)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&u.push(n);else if(c)for(a=0;a<e.length;++a)u.push(a);var h=l?{}:[],d=!0;for(a=0;a<u.length;++a)o=e[n=u[a]],h[n]=t(n,o,r),d=d&&h[n]===e[n];return l&&!d&&(r.mapped[s]=h),d?e:h}},61:e=>{e.exports={parse:function(e){var t,r,i={protocol:null,auth:null,host:null,path:null,hash:null,href:e,hostname:null,port:null,pathname:null,search:null,query:null};if(-1!==(t=e.indexOf("//"))?(i.protocol=e.substring(0,t),r=t+2):r=0,-1!==(t=e.indexOf("@",r))&&(i.auth=e.substring(r,t),r=t+1),-1===(t=e.indexOf("/",r))){if(-1===(t=e.indexOf("?",r)))return-1===(t=e.indexOf("#",r))?i.host=e.substring(r):(i.host=e.substring(r,t),i.hash=e.substring(t)),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),i;i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t}else i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t;if(-1===(t=e.indexOf("#",r))?i.path=e.substring(r):(i.path=e.substring(r,t),i.hash=e.substring(t)),i.path){var n=i.path.split("?");i.pathname=n[0],i.query=n[1],i.search=i.query?"?"+i.query:null}return i}}},67:(e,t,r)=>{var i=r(539),n=r(91),o={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443};function a(e,t,r,i,n){this.options=e,this.transport=t,this.url=r,this.truncation=i,this.jsonBackup=n,this.accessToken=e.accessToken,this.transportOptions=s(e,r)}function s(e,t){return n.getTransportFromOptions(e,o,t)}a.prototype.postItem=function(e,t){var r=n.transportOptions(this.transportOptions,"POST"),i=n.buildPayload(this.accessToken,e,this.jsonBackup),o=this;setTimeout(function(){o.transport.post(o.accessToken,r,i,t)},0)},a.prototype.buildJsonPayload=function(e,t){var r,o=n.buildPayload(this.accessToken,e,this.jsonBackup);return(r=this.truncation?this.truncation.truncate(o):i.stringify(o)).error?(t&&t(r.error),null):r.value},a.prototype.postJsonPayload=function(e,t){var r=n.transportOptions(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,e,t)},a.prototype.configure=function(e){var t=this.oldOptions;return this.options=i.merge(t,e),this.transportOptions=s(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this},e.exports=a},91:(e,t,r)=>{var i=r(539);e.exports={buildPayload:function(e,t,r){if(!i.isType(t.context,"string")){var n=i.stringify(t.context,r);n.error?t.context="Error: could not serialize 'context'":t.context=n.value||"",t.context.length>255&&(t.context=t.context.substr(0,255))}return{access_token:e,data:t}},getTransportFromOptions:function(e,t,r){var i=t.hostname,n=t.protocol,o=t.port,a=t.path,s=t.search,l=e.timeout,c=function(e){var t="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=e.defaultTransport||"xhr";return void 0===t.fetch&&(r="xhr"),void 0===t.XMLHttpRequest&&(r="fetch"),r}(e),u=e.proxy;if(e.endpoint){var h=r.parse(e.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(e,t){var r=e.protocol||"https:",i=e.port||("http:"===r?80:"https:"===r?443:void 0),n=e.hostname,o=e.path,a=e.timeout,s=e.transport;return e.search&&(o+=e.search),e.proxy&&(o=r+"//"+n+o,n=e.proxy.host||e.proxy.hostname,i=e.proxy.port,r=e.proxy.protocol||r),{timeout:a,protocol:r,hostname:n,path:o,port:i,method:t,transport:s}},appendPathToPath:function(e,t){var r=/\/$/.test(e),i=/^\//.test(t);return r&&i?t=t.substring(1):r||i||(t="/"+t),e+t}}},108:function(e,t){var r,i;void 0===(i="function"==typeof(r=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=i.concat(n,o,["args"],["evalOrigin"]);function s(e){if(e)for(var r=0;r<a.length;r++)void 0!==e[a[r]]&&this["set"+t(a[r])](e[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:i?i+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},s.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),i=e.substring(0,t),n=e.substring(t+1,r).split(","),o=e.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"+t(i[l])]=r(i[l]),s.prototype["set"+t(i[l])]=function(e){return function(t){this[e]=Boolean(t)}}(i[l]);for(var c=0;c<n.length;c++)s.prototype["get"+t(n[c])]=r(n[c]),s.prototype["set"+t(n[c])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+t(o[u])]=r(o[u]),s.prototype["set"+t(o[u])]=function(e){return function(t){this[e]=String(t)}}(o[u]);return s})?r.apply(t,[]):r)||(e.exports=i)},175:e=>{var t={ieVersion:function(){var e;if("undefined"==typeof document)return e;for(var t=3,r=document.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",i[0];);return t>4?t:e}};e.exports=t},183:(e,t,r)=>{var i=r(944);"undefined"==typeof window||window._rollbarStartTime||(window._rollbarStartTime=(new Date).getTime()),e.exports=i},197:(e,t,r)=>{var i=r(335),n=r(539),o=r(67),a=r(306),s=r(796),l=r(497),c=r(61),u=r(203),h=r(962),d=r(584),p=r(581),f=r(342);function m(e,t){this.options=n.handleOptions(w,e,null,a),this.options._configuredOptions=e;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),y=new o(this.options,g,c,m);r&&(this.telemeter=new r(this.options)),this.client=t||new i(this.options,y,a,this.telemeter,"browser");var _=v(),b="undefined"!=typeof document&&document;this.isChrome=_.chrome&&_.chrome.runtime,this.anonymousErrorsPending=0,function(e,t,r){e.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(t.scrub)).addTransform(h.addPayloadOptions).addTransform(h.userTransform(a)).addTransform(h.addConfiguredOptions).addTransform(h.addDiagnosticKeys).addTransform(h.itemToPayload)}(this.client.notifier,this,_),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,_,b),this.instrumenter.instrument()),n.setupJSON(f),this.rollbar=this}var g=null;function y(e){var t="Rollbar is not initialized";a.error(t),e&&e(new Error(t))}function _(e){for(var t=0,r=e.length;t<r;++t)if(n.isFunction(e[t]))return e[t]}function v(){return"undefined"!=typeof window&&window||"undefined"!=typeof self&&self}m.init=function(e,t){return g?g.global(e).configure(e):g=new m(e,t)},m.prototype.components={},m.setComponents=function(e){m.prototype.components=e},m.prototype.global=function(e){return this.client.global(e),this},m.global=function(e){if(g)return g.global(e);y()},m.prototype.configure=function(e,t){var r=this.options,i={};return t&&(i={payload:t}),this.options=n.handleOptions(r,e,i,a),this.options._configuredOptions=n.handleOptions(r._configuredOptions,e,i),this.client.configure(this.options,t),this.instrumenter&&this.instrumenter.configure(this.options),this.setupUnhandledCapture(),this},m.configure=function(e,t){if(g)return g.configure(e,t);y()},m.prototype.lastError=function(){return this.client.lastError},m.lastError=function(){if(g)return g.lastError();y()},m.prototype.log=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.log(e),{uuid:t}},m.log=function(){if(g)return g.log.apply(g,arguments);y(_(arguments))},m.prototype.debug=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.debug(e),{uuid:t}},m.debug=function(){if(g)return g.debug.apply(g,arguments);y(_(arguments))},m.prototype.info=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.info(e),{uuid:t}},m.info=function(){if(g)return g.info.apply(g,arguments);y(_(arguments))},m.prototype.warn=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warn(e),{uuid:t}},m.warn=function(){if(g)return g.warn.apply(g,arguments);y(_(arguments))},m.prototype.warning=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warning(e),{uuid:t}},m.warning=function(){if(g)return g.warning.apply(g,arguments);y(_(arguments))},m.prototype.error=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.error(e),{uuid:t}},m.error=function(){if(g)return g.error.apply(g,arguments);y(_(arguments))},m.prototype.critical=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.critical(e),{uuid:t}},m.critical=function(){if(g)return g.critical.apply(g,arguments);y(_(arguments))},m.prototype.buildJsonPayload=function(e){return this.client.buildJsonPayload(e)},m.buildJsonPayload=function(){if(g)return g.buildJsonPayload.apply(g,arguments);y()},m.prototype.sendJsonPayload=function(e){return this.client.sendJsonPayload(e)},m.sendJsonPayload=function(){if(g)return g.sendJsonPayload.apply(g,arguments);y()},m.prototype.setupUnhandledCapture=function(){var e=v();this.unhandledExceptionsInitialized||(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(s.captureUncaughtExceptions(e,this),this.wrapGlobals&&this.options.wrapGlobalEventHandlers&&this.wrapGlobals(e,this),this.unhandledExceptionsInitialized=!0),this.unhandledRejectionsInitialized||(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&(s.captureUnhandledRejections(e,this),this.unhandledRejectionsInitialized=!0)},m.prototype.handleUncaughtException=function(e,t,r,i,o,a){if(this.options.captureUncaught||this.options.handleUncaughtExceptions){if(this.options.inspectAnonymousErrors&&this.isChrome&&null===o&&""===t)return"anonymous";var s,l=n.makeUnhandledStackInfo(e,t,r,i,o,"onerror","uncaught exception",f);n.isError(o)?(s=this._createItem([e,o,a]))._unhandledStackInfo=l:n.isError(t)?(s=this._createItem([e,t,a]))._unhandledStackInfo=l:(s=this._createItem([e,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 e=this;try{Error.prepareStackTrace=function(t,r){if(e.options.inspectAnonymousErrors&&e.anonymousErrorsPending){if(e.anonymousErrorsPending-=1,!t)return;t._isAnonymous=!0,e.handleUncaughtException(t.message,null,null,null,t)}return t.stack}}catch(e){this.options.inspectAnonymousErrors=!1,this.error("anonymous error handler failed",e)}}},m.prototype.handleUnhandledRejection=function(e,t){if(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections){var r="unhandled rejection was null or undefined!";if(e)if(e.message)r=e.message;else{var i=n.stringify(e);i.value&&(r=i.value)}var o,a=e&&e._rollbarContext||t&&t._rollbarContext;n.isError(e)?o=this._createItem([r,e,a]):(o=this._createItem([r,e,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(t),this.client.log(o)}},m.prototype.wrap=function(e,t,r){try{var i;if(i=n.isFunction(t)?t:function(){return t||{}},!n.isFunction(e))return e;if(e._isWrap)return e;if(!e._rollbar_wrapped&&(e._rollbar_wrapped=function(){r&&n.isFunction(r)&&r.apply(this,arguments);try{return e.apply(this,arguments)}catch(r){var t=r;throw t&&window._rollbarWrappedError!==t&&(n.isType(t,"string")&&(t=new String(t)),t._rollbarContext=i()||{},t._rollbarContext._wrappedSource=e.toString(),window._rollbarWrappedError=t),t}},e._rollbar_wrapped._isWrap=!0,e.hasOwnProperty))for(var o in e)e.hasOwnProperty(o)&&"_rollbar_wrapped"!==o&&(e._rollbar_wrapped[o]=e[o]);return e._rollbar_wrapped}catch(t){return e}},m.wrap=function(e,t){if(g)return g.wrap(e,t);y()},m.prototype.captureEvent=function(){var e=n.createTelemetryEvent(arguments);return this.client.captureEvent(e.type,e.metadata,e.level)},m.captureEvent=function(){if(g)return g.captureEvent.apply(g,arguments);y()},m.prototype.captureDomContentLoaded=function(e,t){return t||(t=new Date),this.client.captureDomContentLoaded(t)},m.prototype.captureLoad=function(e,t){return t||(t=new Date),this.client.captureLoad(t)},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(e){return n.createItem(e,a,this)};var b=r(441),x=r(537),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};e.exports=m},203:(e,t,r)=>{var i=r(539),n=r(342),o=r(306);function a(e,t,r){var n=e.message,o=e.custom;n||(n="Item sent with null or missing arguments.");var a={body:n};o&&(a.extra=i.merge(o)),i.set(e,"data.body",{message:a}),r(null,e)}function s(e){var t=e.stackInfo.stack;return t&&0===t.length&&e._unhandledStackInfo&&e._unhandledStackInfo.stack&&(t=e._unhandledStackInfo.stack),t}function l(e,t,r){var o=e&&e.data.description,a=e&&e.custom,l=s(e),u=n.guessErrorClass(t.message),h={exception:{class:c(t,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=t.rawStack,h.exception.raw=String(t.rawException)),h.frames=[],_=0;_<l.length;++_)p={filename:(d=l[_]).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,(y=d.context?d.context.length:0)&&(v=Math.floor(y/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(e,t,r){return e.name?e.name:r.guessErrorClass?t:"(unknown)"}e.exports={handleDomException:function(e,t,r){if(e.err&&"DOMException"===n.Stack(e.err).name){var i=new Error;i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack,i.nested=e.err,e.err=i}r(null,e)},handleItemWithError:function(e,t,r){if(e.data=e.data||{},e.err)try{e.stackInfo=e.err._savedStackTrace||n.parse(e.err,e.skipFrames),t.addErrorContext&&function(e){var t=[],r=e.err;for(t.push(r);r.nested||r.cause;)r=r.nested||r.cause,t.push(r);i.addErrorContext(e,t)}(e)}catch(t){o.error("Error while parsing the error object.",t);try{e.message=e.err.message||e.err.description||e.message||String(e.err)}catch(t){e.message=String(e.err)||String(t)}delete e.err}r(null,e)},ensureItemHasSomethingToSay:function(e,t,r){e.message||e.stackInfo||e.custom||r(new Error("No message, stack info, or custom data"),null),r(null,e)},addBaseInfo:function(e,t,r){var n=t.payload&&t.payload.environment||t.environment;e.data=i.merge(e.data,{environment:n,level:e.level,endpoint:t.endpoint,platform:"browser",framework:"browser-js",language:"javascript",server:{},uuid:e.uuid,notifier:{name:"rollbar-browser-js",version:t.version},custom:e.custom}),r(null,e)},addRequestInfo:function(e){return function(t,r,n){var o={};e&&e.location&&(o.url=e.location.href,o.query_string=e.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(t,"data.request",o),n(null,t)}},addClientInfo:function(e){return function(t,r,n){if(!e)return n(null,t);var o=e.navigator||{},a=e.screen||{};i.set(t,"data.client",{runtime_ms:t.timestamp-e._rollbarStartTime,timestamp:Math.round(t.timestamp/1e3),javascript:{browser:o.userAgent,language:o.language,cookie_enabled:o.cookieEnabled,screen:{width:a.width,height:a.height}}}),n(null,t)}},addPluginInfo:function(e){return function(t,r,n){if(!e||!e.navigator)return n(null,t);for(var o,a=[],s=e.navigator.plugins||[],l=0,c=s.length;l<c;++l)o=s[l],a.push({name:o.name,description:o.description});i.set(t,"data.client.javascript.plugins",a),n(null,t)}},addBody:function(e,t,r){e.stackInfo?e.stackInfo.traceChain?function(e,t,r){for(var n=e.stackInfo.traceChain,o=[],a=n.length,s=0;s<a;s++){var c=l(e,n[s],t);o.push(c)}i.set(e,"data.body",{trace_chain:o}),r(null,e)}(e,t,r):function(e,t,r){if(s(e)){var o=l(e,e.stackInfo,t);i.set(e,"data.body",{trace:o}),r(null,e)}else{var u=e.stackInfo,h=n.guessErrorClass(u.message),d=c(u,h[0],t),p=h[1];e.message=d+": "+p,a(e,0,r)}}(e,t,r):a(e,0,r)},addScrubber:function(e){return function(t,r,i){if(e){var n=r.scrubFields||[],o=r.scrubPaths||[];t.data=e(t.data,n,o)}i(null,t)}}}},215:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var i,n=t.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(i in e);return void 0===i||t.call(e,i)};e.exports=function e(){var t,r,n,o,a,s=Object.create(null),l=null,c=arguments.length;for(t=0;t<c;t++)if(null!=(l=arguments[t]))for(a in l)r=s[a],s!==(n=l[a])&&(n&&i(n)?(o=r&&i(r)?r:{},s[a]=e(o,n)):void 0!==n&&(s[a]=n));return s}},263:function(e,t,r){var i,n,o;n=[r(108)],void 0===(o="function"==typeof(i=function(e){var t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var r=t.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 e({functionName:a,fileName:s,lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e({functionName:t});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(r),n=i&&i[1]?i[1]:void 0,o=this.extractLocation(t.replace(r,""));return new e({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],o=2,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],o=0,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({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(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.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 e({functionName:a,args:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:t})},this)}}})?i.apply(t,n):i)||(e.exports=o)},306:(e,t,r)=>{r(738);var i=r(175),n=r(539);e.exports={error:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.error(n.formatArgsAsString(e)):console.error.apply(console,e)},info:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.info(n.formatArgsAsString(e)):console.info.apply(console,e)},log:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.log(n.formatArgsAsString(e)):console.log.apply(console,e)}}},335:(e,t,r)=>{var i=r(513),n=r(744),o=r(777),a=r(539);function s(e,t,r,i,u){this.options=a.merge(e),this.logger=r,s.rateLimiter.configureGlobal(this.options),s.rateLimiter.setPlatformOptions(u,this.options),this.api=t,this.queue=new n(s.rateLimiter,t,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(e),this.lastError=null,this.lastErrorHash="none"}function l(e){e.stackTraceLimit&&(Error.stackTraceLimit=e.stackTraceLimit)}function c(e){if(!e)return!1;if(!e.scope||"function"!=typeof e.scope)return!1;var t=e.scope();return!(!t||!t.active||"function"!=typeof t.active)}s.rateLimiter=new i({maxItems:0,itemsPerMinute:60}),s.prototype.global=function(e){return s.rateLimiter.configureGlobal(e),this},s.prototype.configure=function(e,t){var r=this.options,i={};t&&(i={payload:t}),this.options=a.merge(r,e,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(e),this.global(this.options),c(e.tracer)&&(this.tracer=e.tracer),this},s.prototype.log=function(e){var t=this._defaultLogLevel();return this._log(t,e)},s.prototype.debug=function(e){this._log("debug",e)},s.prototype.info=function(e){this._log("info",e)},s.prototype.warn=function(e){this._log("warning",e)},s.prototype.warning=function(e){this._log("warning",e)},s.prototype.error=function(e){this._log("error",e)},s.prototype.critical=function(e){this._log("critical",e)},s.prototype.wait=function(e){this.queue.wait(e)},s.prototype.captureEvent=function(e,t,r){return this.telemeter&&this.telemeter.captureEvent(e,t,r)},s.prototype.captureDomContentLoaded=function(e){return this.telemeter&&this.telemeter.captureDomContentLoaded(e)},s.prototype.captureLoad=function(e){return this.telemeter&&this.telemeter.captureLoad(e)},s.prototype.buildJsonPayload=function(e){return this.api.buildJsonPayload(e)},s.prototype.sendJsonPayload=function(e){this.api.postJsonPayload(e)},s.prototype._log=function(e,t){var r;if(t.callback&&(r=t.callback,delete t.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(t)){if(r){var i=new Error("ignored identical item");i.item=t,r(i)}}else try{this._addTracingInfo(t),t.level=t.level||e,this.telemeter&&this.telemeter._captureRollbarItem(t),t.telemetryEvents=this.telemeter&&this.telemeter.copyEvents()||[],this.notifier.log(t,r)}catch(e){r&&r(e),this.logger.error(e)}},s.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},s.prototype._sameAsLastError=function(e){if(!e._isUncaught)return!1;var t=function(e){return(e.message||"")+"::"+((e.err||{}).stack||String(e.err))}(e);return this.lastErrorHash===t||(this.lastError=e.err,this.lastErrorHash=t,!1)},s.prototype._addTracingInfo=function(e){if(this.tracer){var t=this.tracer.scope().active();if(function(e){if(!e||!e.context||"function"!=typeof e.context)return!1;var t=e.context();return!!(t&&t.toSpanId&&t.toTraceId&&"function"==typeof t.toSpanId&&"function"==typeof t.toTraceId)}(t)){t.setTag("rollbar.error_uuid",e.uuid),t.setTag("rollbar.has_error",!0),t.setTag("error",!0),t.setTag("rollbar.item_url",`https://rollbar.com/item/uuid/?uuid=${e.uuid}`),t.setTag("rollbar.occurrence_url",`https://rollbar.com/occurrence/uuid/?uuid=${e.uuid}`);var r=t.context().toSpanId(),i=t.context().toTraceId();e.custom?(e.custom.opentracing_span_id=r,e.custom.opentracing_trace_id=i):e.custom={opentracing_span_id:r,opentracing_trace_id:i}}}},e.exports=s},342:(e,t,r)=>{var i=r(263),n=new RegExp("^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ");function o(e){var t={};return t._stackFrame=e,t.url=e.fileName,t.line=e.lineNumber,t.func=e.functionName,t.column=e.columnNumber,t.args=e.args,t.context=null,t}function a(e,t){return{stack:function(){var r=[];t=t||0;try{r=i.parse(e)}catch(e){r=[]}for(var n=[],a=t;a<r.length;a++)n.push(new o(r[a]));return n}(),message:e.message,name:(r=e,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:e.stack,rawException:e};var r,n,a}e.exports={guessFunctionName:function(){return"?"},guessErrorClass:function(e){if(!e||!e.match)return["Unknown error. There was no error message to display.",""];var t=e.match(n),r="(unknown)";return t&&(r=t[t.length-1],e=(e=e.replace((t[t.length-2]||"")+r+":","")).replace(/(^[\s]+|[\s]+$)/g,"")),[r,e]},gatherContext:function(){return null},parse:function(e,t){var r=e;if(r.nested||r.cause){for(var i=[];r;)i.push(new a(r,t)),r=r.nested||r.cause,t=0;return i[0].traceChain=i,i[0]}return new a(r,t)},Stack:a,Frame:o}},352:(e,t,r)=>{var i=r(539),n=100;function o(e){this.queue=[],this.options=i.merge(e);var t=this.options.maxTelemetryEvents||n;this.maxQueueSize=Math.max(0,Math.min(t,n))}function a(e,t){return t||{error:"error",manual:"info"}[e]||"info"}o.prototype.configure=function(e){var t=this.options;this.options=i.merge(t,e);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 e=Array.prototype.slice.call(this.queue,0);if(i.isFunction(this.options.filterTelemetry))try{for(var t=e.length;t--;)this.options.filterTelemetry(e[t])&&e.splice(t,1)}catch(e){this.options.filterTelemetry=null}return e},o.prototype.capture=function(e,t,r,n,o){var s={level:a(e,r),type:e,timestamp_ms:o||i.now(),body:t,source:"client"};n&&(s.uuid=n);try{if(i.isFunction(this.options.filterTelemetry)&&this.options.filterTelemetry(s))return!1}catch(e){this.options.filterTelemetry=null}return this.push(s),s},o.prototype.captureEvent=function(e,t,r,i){return this.capture(e,t,r,i)},o.prototype.captureError=function(e,t,r,i){var n={message:e.message||String(e)};return e.stack&&(n.stack=e.stack),this.capture("error",n,t,r,i)},o.prototype.captureLog=function(e,t,r,i){return this.capture("log",{message:e},t,r,i)},o.prototype.captureNetwork=function(e,t,r,i){t=t||"xhr",e.subtype=e.subtype||t,i&&(e.request=i);var n=this.levelFromStatus(e.status_code);return this.capture("network",e,n,r)},o.prototype.levelFromStatus=function(e){return e>=200&&e<400?"info":0===e||e>=400?"error":"info"},o.prototype.captureDom=function(e,t,r,i,n){var o={subtype:e,element:t};return void 0!==r&&(o.value=r),void 0!==i&&(o.checked=i),this.capture("dom",o,"info",n)},o.prototype.captureNavigation=function(e,t,r){return this.capture("navigation",{from:e,to:t},"info",r)},o.prototype.captureDomContentLoaded=function(e){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,e&&e.getTime())},o.prototype.captureLoad=function(e){return this.capture("navigation",{subtype:"load"},"info",void 0,e&&e.getTime())},o.prototype.captureConnectivityChange=function(e,t){return this.captureNetwork({change:e},"connectivity",t)},o.prototype._captureRollbarItem=function(e){if(this.options.includeItemsInTelemetry)return e.err?this.captureError(e.err,e.level,e.uuid,e.timestamp):e.message?this.captureLog(e.message,e.level,e.uuid,e.timestamp):e.custom?this.capture("log",e.custom,e.level,e.uuid,e.timestamp):void 0},o.prototype.push=function(e){this.queue.push(e),this.queue.length>this.maxQueueSize&&this.queue.shift()},e.exports=o},356:(e,t,r)=>{var i=r(539),n=r(12);function o(e,t){var r=t.split("."),n=r.length-1;try{for(var o=0;o<=n;++o)o<n?e=e[r[o]]:e[r[o]]=i.redact()}catch(e){}}e.exports=function(e,t,r){if(t=t||[],r)for(var a=0;a<r.length;++a)o(e,r[a]);var s=function(e){for(var t,r=[],i=0;i<e.length;++i)t="^\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?$",r.push(new RegExp(t,"i"));return r}(t),l=function(e){for(var t,r=[],i=0;i<e.length;++i)t="\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?",r.push(new RegExp("("+t+"=)([^&\\n]+)","igm"));return r}(t);function c(e,t){return t+i.redact()}return n(e,function e(t,r,o){var a=function(e,t){var r;for(r=0;r<s.length;++r)if(s[r].test(e)){t=i.redact();break}return t}(t,r);return a===r?i.isType(r,"object")||i.isType(r,"array")?n(r,e,o):function(e){var t;if(i.isType(e,"string"))for(t=0;t<l.length;++t)e=e.replace(l[t],c);return e}(a):a})}},364:e=>{e.exports=function(e,t,r,i,n){var o=e[t];e[t]=r(o),i&&i[n].push([e,t,o])}},424:e=>{function t(e,t,r){if(t.hasOwnProperty&&t.hasOwnProperty("addEventListener")){for(var i=t.addEventListener;i._rollbarOldAdd&&i.belongsToShim;)i=i._rollbarOldAdd;var n=function(t,r,n){i.call(this,t,e.wrap(r),n)};n._rollbarOldAdd=i,n.belongsToShim=r,t.addEventListener=n;for(var o=t.removeEventListener;o._rollbarOldRemove&&o.belongsToShim;)o=o._rollbarOldRemove;var a=function(e,t,r){o.call(this,e,t&&t._rollbar_wrapped||t,r)};a._rollbarOldRemove=o,a.belongsToShim=r,t.removeEventListener=a}}e.exports=function(e,r,i){if(e){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)e[o=a[n]]&&e[o].prototype&&t(r,e[o].prototype,i)}}},435:(e,t,r)=>{var i=r(538);e.exports=i},440:(e,t,r)=>{var i=r(539),n=r(306);function o(e,t){var r=new Error(e);return r.code=t||"ENOTFOUND",r}e.exports=function(e,t,r,a,s,l,c){var u;if(!(u=l?l():function(){var e,t,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(t=0;t<i;t++)try{e=r[t]();break}catch(e){}return e}()))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 e=i.jsonParse(u.responseText);if((a=u)&&a.status&&200===a.status)return void s(e.error,e.value);if(function(e){return e&&i.isType(e.status,"number")&&e.status>=400&&e.status<600}(u)){if(403===u.status){var t=e.value&&e.value.message;n.error(t)}s(new Error(String(u.status)))}else s(o("XHR response had no status code (likely connection failure)"))}}catch(e){var r;r=e&&e.stack?e:new Error(e),s(r)}var a};u.open(r,t,!0),u.setRequestHeader&&(u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("X-Rollbar-Access-Token",e)),i.isFiniteNumber(c)&&(u.timeout=c),u.onreadystatechange=h,u.send(a)}catch(e){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"===t.substring(0,5)&&(t="http"+t.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 e=i.jsonParse(d.responseText);s(e.error,e.value)},d.open(r,t,!0),d.send(a)}else s(new Error("Cannot find a method to transport a request"))}}catch(e){s(e)}}},441:e=>{e.exports={version:"2.26.5",endpoint:"api.rollbar.com/api/1/item/",logLevel:"debug",reportLevel:"debug",uncaughtErrorLevel:"error",maxItems:0,itemsPerMin:60}},497:(e,t,r)=>{var i=r(539),n=r(534),o=r(440);function a(e){this.truncation=e}a.prototype.get=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){}),i.addParamsAndAccessTokenToPath(e,t,r);var a=i.formatUrl(t);this._makeZoneRequest(e,a,"GET",null,n,o,t.timeout,t.transport)},a.prototype.post=function(e,t,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(t);this._makeZoneRequest(e,l,"POST",s,n,o,t.timeout,t.transport)},a.prototype.postJsonPayload=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){});var a=i.formatUrl(t);this._makeZoneRequest(e,a,"POST",r,n,o,t.timeout,t.transport)},a.prototype._makeZoneRequest=function(){var e="undefined"!=typeof window&&window||void 0!==i&&i,t=e&&e.Zone&&e.Zone.root,r=Array.prototype.slice.call(arguments);if(t){var i=this;t.run(function(){i._makeRequest.apply(void 0,r)})}else this._makeRequest.apply(void 0,r)},a.prototype._makeRequest=function(e,t,r,i,a,s,l,c){if("undefined"!=typeof RollbarProxy)return function(e,t){(new RollbarProxy).sendJsonPayload(e,function(e){},function(e){t(new Error(e))})}(i,a);"fetch"===c?n(e,t,r,i,a,l):o(e,t,r,i,a,s,l)},e.exports=a},513:(e,t,r)=>{var i=r(539);function n(e){this.startTime=i.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}function o(e,t,r){return!e.ignoreRateLimit&&t>=1&&r>t}function a(e,t,r,i,n,o,a){var s=null;return r&&(r=new Error(r)),r||i||(s=function(e,t,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:t.environment||t.payload&&t.payload.environment,notifier:{version:t.notifier&&t.notifier.version||t.version}};return"browser"===e?(o.platform="browser",o.framework="browser-js",o.notifier.name="rollbar-browser-js"):"server"===e?(o.framework=t.framework||"node-js",o.notifier.name=t.notifier.name):"react-native"===e&&(o.framework=t.framework||"react-native",o.notifier.name=t.notifier.name),o}(e,t,n,o,a)),{error:r,shouldSend:i,payload:s}}n.globalSettings={startTime:i.now(),maxItems:void 0,itemsPerMinute:void 0},n.prototype.configureGlobal=function(e){void 0!==e.startTime&&(n.globalSettings.startTime=e.startTime),void 0!==e.maxItems&&(n.globalSettings.maxItems=e.maxItems),void 0!==e.itemsPerMinute&&(n.globalSettings.itemsPerMinute=e.itemsPerMinute)},n.prototype.shouldSend=function(e,t){var r=(t=t||i.now())-this.startTime;(r<0||r>=6e4)&&(this.startTime=t,this.perMinCounter=0);var s=n.globalSettings.maxItems,l=n.globalSettings.itemsPerMinute;if(o(e,s,this.counter))return a(this.platform,this.platformOptions,s+" max items reached",!1);if(o(e,l,this.perMinCounter))return a(this.platform,this.platformOptions,l+" items per minute reached",!1);this.counter++,this.perMinCounter++;var c=!o(e,s,this.counter),u=c;return c=c&&!o(e,l,this.perMinCounter),a(this.platform,this.platformOptions,null,c,s,l,u)},n.prototype.setPlatformOptions=function(e,t){this.platform=e,this.platformOptions=t},e.exports=n},534:(e,t,r)=>{var i=r(306),n=r(539);e.exports=function(e,t,r,o,a,s){var l,c;n.isFiniteNumber(s)&&(l=new AbortController,c=setTimeout(function(){l.abort()},s)),fetch(t,{method:r,headers:{"Content-Type":"application/json","X-Rollbar-Access-Token":e,signal:l&&l.signal},body:o}).then(function(e){return c&&clearTimeout(c),e.json()}).then(function(e){a(null,e)}).catch(function(e){i.error(e.message),a(e)})}},537:e=>{e.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"]}},538:e=>{e.exports=function(e){var t,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(e){return e<10?"0"+e:e}function g(){return this.valueOf()}function y(e){return f.lastIndex=0,f.test(e)?'"'+e.replace(f,function(e){var t=i[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function _(e,i){var o,a,s,l,c,u=t,h=i[e];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(e)),"function"==typeof n&&(h=n.call(i,e,h)),typeof h){case"string":return y(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(t+=r,c=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,o=0;o<l;o+=1)c[o]=_(o,h)||"null";return s=0===c.length?"[]":t?"[\n"+t+c.join(",\n"+t)+"\n"+u+"]":"["+c.join(",")+"]",t=u,s}if(n&&"object"==typeof n)for(l=n.length,o=0;o<l;o+=1)"string"==typeof n[o]&&(s=_(a=n[o],h))&&c.push(y(a)+(t?": ":":")+s);else for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(s=_(a,h))&&c.push(y(a)+(t?": ":":")+s);return s=0===c.length?"{}":t?"{\n"+t+c.join(",\n"+t)+"\n"+u+"}":"{"+c.join(",")+"}",t=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 e.stringify&&(i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e.stringify=function(e,i,o){var a;if(t="",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 _("",{"":e})}),"function"!=typeof e.parse&&(e.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 e=a.pop();c=s,s=e.container,l=e.key,o=e.state},ocomma:function(){var e=a.pop();s[l]=c,c=s,s=e.container,l=e.key,o=e.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 e=a.pop();c=s,s=e.container,l=e.key,o=e.state},acomma:function(){var e=a.pop();s.push(c),c=s,s=e.container,l=e.key,o=e.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(e,t){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(e);)r[1]?p[r[1]][o]():r[2]?(c=+r[2],d[o]()):(i=r[3],c=i.replace(/\\(?:u(.{4})|([^u]))/g,function(e,t,r){return t?String.fromCharCode(parseInt(t,16)):u[r]}),h[o]()),e=e.slice(r[0].length)}catch(e){o=e}if("ok"!==o||/[^\u0020\t\n\r]/.test(e))throw o instanceof SyntaxError?o:new SyntaxError("JSON");return"function"==typeof t?function e(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=e(a,n))?a[n]=o:delete a[n]);return t.call(r,i,a)}({"":c},""):c}))}},539:(e,t,r)=>{var i=r(215),n={};function o(e,t){return t===a(e)}function a(e){var t=typeof e;return"object"!==t?t:e?e instanceof Error?"error":{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(e){return o(e,"function")}function l(e){var t=Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),r=RegExp("^"+t+"$");return c(e)&&r.test(e)}function c(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function u(){var e=_();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?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(e,t){var r,i;try{r=n.stringify(e)}catch(n){if(t&&s(t))try{r=t(e)}catch(e){i=e}else i=n}return{error:i,value:r}}function p(e,t){return function(r,i){try{t(r,i)}catch(t){e.error(t)}}}function f(e){return function e(t,r){var i,n,s,l={};try{for(n in t)(i=t[n])&&(o(i,"object")||o(i,"array"))?r.includes(i)?l[n]="Removed circular reference: "+a(i):((s=r.slice()).push(i),l[n]=e(i,s)):l[n]=i}catch(e){l="Failed cloning custom data: "+e.message}return l}(e,[e])}var m=["log","network","dom","navigation","error","manual"],g=["critical","error","warning","info","debug"];function y(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1}function _(){return Date.now?+Date.now():+new Date}e.exports={addParamsAndAccessTokenToPath:function(e,t,r){(r=r||{}).access_token=e;var i,n=[];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push([i,r[i]].join("="));var o="?"+n.sort().join("&");(t=t||{}).path=t.path||"";var a,s=t.path.indexOf("?"),l=t.path.indexOf("#");-1!==s&&(-1===l||l>s)?(a=t.path,t.path=a.substring(0,s)+o+"&"+a.substring(s+1)):-1!==l?(a=t.path,t.path=a.substring(0,l)+o+a.substring(l)):t.path=t.path+o},createItem:function(e,t,r,i,n){for(var o,s,l,c,h,d,m=[],g=[],y=0,v=e.length;y<v;++y){var b=a(d=e[y]);switch(g.push(b),b){case"undefined":break;case"string":o?m.push(d):o=d;break;case"function":c=p(t,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 T={message:o,err:s,custom:l,timestamp:_(),callback:c,notifier:r,diagnostic:{},uuid:u()};return function(e,t){t&&void 0!==t.level&&(e.level=t.level,delete t.level),t&&void 0!==t.skipFrames&&(e.skipFrames=t.skipFrames,delete t.skipFrames)}(T,l),i&&h&&(T.request=h),n&&(T.lambdaContext=n),T._originalArgs=e,T.diagnostic.original_arg_types=g,T},addErrorContext:function(e,t){var r=e.data.custom||{},n=!1;try{for(var o=0;o<t.length;++o)t[o].hasOwnProperty("rollbarContext")&&(r=i(r,f(t[o].rollbarContext)),n=!0);n&&(e.data.custom=r)}catch(t){e.diagnostic.error_context="Failed: "+t.message}},createTelemetryEvent:function(e){for(var t,r,i,n,o=0,s=e.length;o<s;++o)switch(a(n=e[o])){case"string":!t&&y(m,n)?t=n:!i&&y(g,n)&&(i=n);break;case"object":r=n}return{type:t||"manual",metadata:r||{},level:i}},filterIp:function(e,t){if(e&&e.user_ip&&!0!==t){var r=e.user_ip;if(t)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(e){r=null}else r=null;e.user_ip=r}},formatArgsAsString:function(e){var t,r,i,n=[];for(t=0,r=e.length;t<r;++t){switch(a(i=e[t])){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(e,t){if(!(t=t||e.protocol)&&e.port&&(80===e.port?t="http:":443===e.port&&(t="https:")),t=t||"https:",!e.hostname)return null;var r=t+"//"+e.hostname;return e.port&&(r=r+":"+e.port),e.path&&(r+=e.path),r},get:function(e,t){if(e){var r=t.split("."),i=e;try{for(var n=0,o=r.length;n<o;++n)i=i[r[n]]}catch(e){i=void 0}return i}},handleOptions:function(e,t,r,n){var o=i(e,t,r);return o=function(e,t){return e.hostWhiteList&&!e.hostSafeList&&(e.hostSafeList=e.hostWhiteList,e.hostWhiteList=void 0,t&&t.log("hostWhiteList is deprecated. Use hostSafeList.")),e.hostBlackList&&!e.hostBlockList&&(e.hostBlockList=e.hostBlackList,e.hostBlackList=void 0,t&&t.log("hostBlackList is deprecated. Use hostBlockList.")),e}(o,n),!t||t.overwriteScrubFields||t.scrubFields&&(o.scrubFields=(e.scrubFields||[]).concat(t.scrubFields)),o},isError:function(e){return o(e,"error")||o(e,"exception")},isFiniteNumber:function(e){return Number.isFinite(e)},isFunction:s,isIterable:function(e){var t=a(e);return"object"===t||"array"===t},isNativeFunction:l,isObject:c,isString:function(e){return"string"==typeof e||e instanceof String},isType:o,isPromise:function(e){return c(e)&&o(e.then,"function")},jsonParse:function(e){var t,r;try{t=n.parse(e)}catch(e){r=e}return{error:r,value:t}},LEVELS:{debug:0,info:1,warning:2,error:3,critical:4},makeUnhandledStackInfo:function(e,t,r,i,n,o,a,s){var l={url:t||"",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):e||a,url:c,stack:[l],useragent:u}},merge:i,now:_,redact:function(){return"********"},RollbarJSON:n,sanitizeUrl:function(e){var t=function(e){if(o(e,"string")){for(var t=h,r=t.parser[t.strictMode?"strict":"loose"].exec(e),i={},n=0,a=t.key.length;n<a;++n)i[t.key[n]]=r[n]||"";return i[t.q.name]={},i[t.key[12]].replace(t.q.parser,function(e,r,n){r&&(i[t.q.name][r]=n)}),i}}(e);return t?(""===t.anchor&&(t.source=t.source.replace("#","")),e=t.source.replace("?"+t.query,"")):"(unknown)"},set:function(e,t,r){if(e){Object.setPrototypeOf(e,null);var i=t.split("."),n=i.length;if(!(n<1))if(1!==n)try{for(var o=e[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,e[i[0]]=a}catch(e){return}else e[i[0]]=r}},setupJSON:function(e){s(n.stringify)&&s(n.parse)||(o(JSON,"undefined")||(e?(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)||e&&e(n))},stringify:d,maxByteSize:function(e){for(var t=0,r=e.length,i=0;i<r;i++){var n=e.charCodeAt(i);n<128?t+=1:n<2048?t+=2:n<65536&&(t+=3)}return t},typeName:a,uuid4:u}},581:(e,t,r)=>{var i=r(539);function n(e,t,r){if(!e)return!r;var n,o,a=e.frames;if(!a||0===a.length)return!r;for(var s=t.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=t[u],new RegExp(o).test(n))return!0}return!1}function o(e,t,r,o){var a,s,l=!1;"blocklist"===r&&(l=!0);try{if(a=l?t.hostBlockList:t.hostSafeList,s=i.get(e,"body.trace_chain")||[i.get(e,"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(e){l?t.hostBlockList=null:t.hostSafeList=null;var h=l?"hostBlockList":"hostSafeList";return o.error("Error while reading your configuration's "+h+" option. Removing custom "+h+".",e),!l}return!1}e.exports={checkLevel:function(e,t){var r=e.level,n=i.LEVELS[r]||0,o=t.reportLevel;return!(n<(i.LEVELS[o]||0))},userCheckIgnore:function(e){return function(t,r){var n=!!t._isUncaught;delete t._isUncaught;var o=t._originalArgs;delete t._originalArgs;try{i.isFunction(r.onSendCallback)&&r.onSendCallback(n,o,t)}catch(t){r.onSendCallback=null,e.error("Error while calling onSendCallback, removing",t)}try{if(i.isFunction(r.checkIgnore)&&r.checkIgnore(n,o,t))return!1}catch(t){r.checkIgnore=null,e.error("Error while calling custom checkIgnore(), removing",t)}return!0}},urlIsNotBlockListed:function(e){return function(t,r){return!o(t,r,"blocklist",e)}},urlIsSafeListed:function(e){return function(t,r){return o(t,r,"safelist",e)}},messageIsIgnored:function(e){return function(t,r){var n,o,a,s,l,c;try{if(!(a=r.ignoredMessages)||0===a.length)return!0;if(c=function(e){var t=e.body,r=[];if(t.trace_chain)for(var n=t.trace_chain,o=0;o<n.length;o++){var a=n[o];r.push(i.get(a,"exception.message"))}return t.trace&&r.push(i.get(t,"trace.exception.message")),t.message&&r.push(i.get(t,"message.body")),r}(t),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(t){r.ignoredMessages=null,e.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}}},584:(e,t,r)=>{var i=r(539);e.exports={checkIgnore:function(e,t){return!i.get(t,"plugins.jquery.ignoreAjaxErrors")||!i.get(e,"body.message.extra.isAjax")}}},683:(e,t,r)=>{var i=r(539),n=r(974),o=r(364),a=r(356),s=r(61),l=r(790),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(e,t){for(var r;e[t].length;)(r=e[t].shift())[0][r[1]]=r[2]}function h(e,t,r,n,o){this.options=e;var a=e.autoInstrument;!1===e.enabled||!1===a?this.autoInstrument={}:(i.isType(a,"object")||(a=c),this.autoInstrument=i.merge(c,a)),this.scrubTelemetryInputs=!!e.scrubTelemetryInputs,this.telemetryScrubber=e.telemetryScrubber,this.defaultValueScrubber=function(e){for(var t=[],r=0;r<e.length;++r)t.push(new RegExp(e[r],"i"));return function(e){var r=function(e){if(!e||!e.attributes)return null;for(var t=e.attributes,r=0;r<t.length;++r)if("name"===t[r].key)return t[r].value;return null}(e);if(!r)return!1;for(var i=0;i<t.length;++i)if(t[i].test(r))return!0;return!1}}(e.scrubFields),this.telemeter=t,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(e){return"undefined"!=typeof URL&&e instanceof URL}h.prototype.configure=function(e){this.options=i.merge(this.options,e);var t=e.autoInstrument,r=i.merge(this.autoInstrument);!1===e.enabled||!1===t?this.autoInstrument={}:(i.isType(t,"object")||(t=c),this.autoInstrument=i.merge(c,t)),this.instrument(r),void 0!==e.scrubTelemetryInputs&&(this.scrubTelemetryInputs=!!e.scrubTelemetryInputs),void 0!==e.telemetryScrubber&&(this.telemetryScrubber=e.telemetryScrubber)},h.prototype.instrument=function(e){!this.autoInstrument.network||e&&e.network?!this.autoInstrument.network&&e&&e.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||e&&e.log?!this.autoInstrument.log&&e&&e.log&&this.deinstrumentConsole():this.instrumentConsole(),!this.autoInstrument.dom||e&&e.dom?!this.autoInstrument.dom&&e&&e.dom&&this.deinstrumentDom():this.instrumentDom(),!this.autoInstrument.navigation||e&&e.navigation?!this.autoInstrument.navigation&&e&&e.navigation&&this.deinstrumentNavigation():this.instrumentNavigation(),!this.autoInstrument.connectivity||e&&e.connectivity?!this.autoInstrument.connectivity&&e&&e.connectivity&&this.deinstrumentConnectivity():this.instrumentConnectivity(),!this.autoInstrument.contentSecurityPolicy||e&&e.contentSecurityPolicy?!this.autoInstrument.contentSecurityPolicy&&e&&e.contentSecurityPolicy&&this.deinstrumentContentSecurityPolicy():this.instrumentContentSecurityPolicy()},h.prototype.deinstrumentNetwork=function(){u(this.replacements,"network")},h.prototype.instrumentNetwork=function(){var e=this;function t(t,r){t in r&&i.isFunction(r[t])&&o(r,t,function(t){return e.rollbar.wrap(t)})}if("XMLHttpRequest"in this._window){var r=this._window.XMLHttpRequest.prototype;o(r,"open",function(e){return function(t,r){var n=d(r);return(i.isType(r,"string")||n)&&(r=n?r.toString():r,this.__rollbar_xhr?(this.__rollbar_xhr.method=t,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:t,url:r,status_code:null,start_time_ms:i.now(),end_time_ms:null}),e.apply(this,arguments)}},this.replacements,"network"),o(r,"setRequestHeader",function(t){return function(r,n){return this.__rollbar_xhr||(this.__rollbar_xhr={}),i.isType(r,"string")&&i.isType(n,"string")&&(e.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)),t.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,e.autoInstrument.networkRequestBody&&(a.__rollbar_xhr.request=n),a.__rollbar_event=e.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 t=null;if(a.__rollbar_xhr.response_content_type=a.getResponseHeader("Content-Type"),e.autoInstrument.networkResponseHeaders){var r=e.autoInstrument.networkResponseHeaders;t={};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(": "),t[o]=u}}else for(s=0;s<r.length;s++)t[o=r[s]]=a.getResponseHeader(o)}catch(e){}}var d=null;if(e.autoInstrument.networkResponseBody)try{d=a.responseText}catch(e){}var p=null;(d||t)&&(p={},d&&(e.isJsonContentType(a.__rollbar_xhr.response_content_type)?p.body=e.scrubJson(d):p.body=d),t&&(p.headers=t)),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=e.telemeter.levelFromStatus(f),e.errorOnHttpStatus(a.__rollbar_xhr)}catch(e){}}}return t("onload",a),t("onerror",a),t("onprogress",a),"onreadystatechange"in a&&i.isFunction(a.onreadystatechange)?o(a,"onreadystatechange",function(t){return e.rollbar.wrap(t,void 0,s)}):a.onreadystatechange=s,a.__rollbar_xhr&&e.trackHttpErrors()&&(a.__rollbar_xhr.stack=(new Error).stack),r.apply(this,arguments)}},this.replacements,"network")}"fetch"in this._window&&o(this._window,"fetch",function(t){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"),e.autoInstrument.networkRequestHeaders&&(f.request_headers=e.fetchHeaders(m,e.autoInstrument.networkRequestHeaders))}return e.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)),e.captureNetwork(f,"fetch",void 0),e.trackHttpErrors()&&(f.stack=(new Error).stack),t.apply(this,a).then(function(t){f.end_time_ms=i.now(),f.status_code=t.status,f.response_content_type=t.headers.get("Content-Type");var r=null;e.autoInstrument.networkResponseHeaders&&(r=e.fetchHeaders(t.headers,e.autoInstrument.networkResponseHeaders));var n=null;return e.autoInstrument.networkResponseBody&&"function"==typeof t.text&&(n=t.clone().text()),(r||n)&&(f.response={},n&&("function"==typeof n.then?n.then(function(t){t&&e.isJsonContentType(f.response_content_type)?f.response.body=e.scrubJson(t):f.response.body=t}):f.response.body=n),r&&(f.response.headers=r)),e.errorOnHttpStatus(f),t})}},this.replacements,"network")},h.prototype.captureNetwork=function(e,t,r){return e.request&&this.isJsonContentType(e.request_content_type)&&(e.request=this.scrubJson(e.request)),this.telemeter.captureNetwork(e,t,r)},h.prototype.isJsonContentType=function(e){return!!(e&&i.isType(e,"string")&&e.toLowerCase().includes("json"))},h.prototype.scrubJson=function(e){return JSON.stringify(a(JSON.parse(e),this.options.scrubFields))},h.prototype.fetchHeaders=function(e,t){var r={};try{var i;if(!0===t){if("function"==typeof e.entries)for(var n=e.entries(),o=n.next();!o.done;)r[o.value[0]]=o.value[1],o=n.next()}else for(i=0;i<t.length;i++){var a=t[i];r[a]=e.get(a)}}catch(e){}return r},h.prototype.trackHttpErrors=function(){return this.autoInstrument.networkErrorOnHttp5xx||this.autoInstrument.networkErrorOnHttp4xx||this.autoInstrument.networkErrorOnHttp0},h.prototype.errorOnHttpStatus=function(e){var t=e.status_code;if(t>=500&&this.autoInstrument.networkErrorOnHttp5xx||t>=400&&this.autoInstrument.networkErrorOnHttp4xx||0===t&&this.autoInstrument.networkErrorOnHttp0){var r=new Error("HTTP request failed with Status "+t);r.stack=e.stack,this.rollbar.error(r,{skipFrames:1})}},h.prototype.deinstrumentConsole=function(){if("console"in this._window&&this._window.console.log)for(var e;this.replacements.log.length;)e=this.replacements.log.shift(),this._window.console[e[0]]=e[1]},h.prototype.instrumentConsole=function(){if("console"in this._window&&this._window.console.log){var e=this,t=this._window.console,r=["debug","info","warn","error","log"];try{for(var n=0,o=r.length;n<o;n++)a(r[n])}catch(e){this.diagnostic.instrumentConsole={error:e.message}}}function a(r){var n=t[r],o=t,a="warn"===r?"warning":r;t[r]=function(){var t=Array.prototype.slice.call(arguments),r=i.formatArgsAsString(t);e.telemeter.captureLog(r,a),n&&Function.prototype.apply.call(n,o,t)},e.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 e=this.handleClick.bind(this),t=this.handleBlur.bind(this);this.addListener("dom",this._window,"click","onclick",e,!0),this.addListener("dom",this._window,"blur","onfocusout",t,!0)}},h.prototype.handleClick=function(e){try{var t=l.getElementFromEvent(e,this._document),r=t&&t.tagName,i=l.isDescribedElement(t,"a")||l.isDescribedElement(t,"button");r&&(i||l.isDescribedElement(t,"input",["button","submit"]))?this.captureDomEvent("click",t):l.isDescribedElement(t,"input",["checkbox","radio"])&&this.captureDomEvent("input",t,t.value,t.checked)}catch(e){}},h.prototype.handleBlur=function(e){try{var t=l.getElementFromEvent(e,this._document);t&&t.tagName&&(l.isDescribedElement(t,"textarea")?this.captureDomEvent("input",t,t.value):l.isDescribedElement(t,"select")&&t.options&&t.options.length?this.handleSelectInputChanged(t):l.isDescribedElement(t,"input")&&!l.isDescribedElement(t,"input",["button","submit","hidden","checkbox","radio"])&&this.captureDomEvent("input",t,t.value))}catch(e){}},h.prototype.handleSelectInputChanged=function(e){if(e.multiple)for(var t=0;t<e.options.length;t++)e.options[t].selected&&this.captureDomEvent("input",e,e.options[t].value);else e.selectedIndex>=0&&e.options[e.selectedIndex]&&this.captureDomEvent("input",e,e.options[e.selectedIndex].value)},h.prototype.captureDomEvent=function(e,t,r,i){if(void 0!==r)if(this.scrubTelemetryInputs||"password"===l.getElementType(t))r="[scrubbed]";else{var n=l.describeElement(t);this.telemetryScrubber?this.telemetryScrubber(n)&&(r="[scrubbed]"):this.defaultValueScrubber(n)&&(r="[scrubbed]")}var o=l.elementArrayToString(l.treeToArray(t));this.telemeter.captureDom(e,o,r,i)},h.prototype.deinstrumentNavigation=function(){var e=this._window.chrome;!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState&&u(this.replacements,"navigation")},h.prototype.instrumentNavigation=function(){var e=this._window.chrome;if(!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState){var t=this;o(this._window,"onpopstate",function(e){return function(){var r=t._location.href;t.handleUrlChange(t._lastHref,r),e&&e.apply(this,arguments)}},this.replacements,"navigation"),o(this._window.history,"pushState",function(e){return function(){var r=arguments.length>2?arguments[2]:void 0;return r&&t.handleUrlChange(t._lastHref,r+""),e.apply(this,arguments)}},this.replacements,"navigation")}},h.prototype.handleUrlChange=function(e,t){var r=s.parse(this._location.href),i=s.parse(t),n=s.parse(e);this._lastHref=t,r.protocol===i.protocol&&r.host===i.host&&(t=i.path+(i.hash||"")),r.protocol===n.protocol&&r.host===n.host&&(e=n.path+(n.hash||"")),this.telemeter.captureNavigation(e,t)},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 e=this;o(this._document.body,"ononline",function(t){return function(){e.telemeter.captureConnectivityChange("online"),t&&t.apply(this,arguments)}},this.replacements,"connectivity"),o(this._document.body,"onoffline",function(t){return function(){e.telemeter.captureConnectivityChange("offline"),t&&t.apply(this,arguments)}},this.replacements,"connectivity")}},h.prototype.handleCspEvent=function(e){var t="Security Policy Violation: blockedURI: "+e.blockedURI+", violatedDirective: "+e.violatedDirective+", effectiveDirective: "+e.effectiveDirective+", ";e.sourceFile&&(t+="location: "+e.sourceFile+", line: "+e.lineNumber+", col: "+e.columnNumber+", "),t+="originalPolicy: "+e.originalPolicy,this.telemeter.captureLog(t,"error"),this.handleCspError(t)},h.prototype.handleCspError=function(e){this.autoInstrument.errorOnContentSecurityPolicy&&this.rollbar.error(e)},h.prototype.deinstrumentContentSecurityPolicy=function(){"addEventListener"in this._document&&this.removeListeners("contentsecuritypolicy")},h.prototype.instrumentContentSecurityPolicy=function(){if("addEventListener"in this._document){var e=this.handleCspEvent.bind(this);this.addListener("contentsecuritypolicy",this._document,"securitypolicyviolation",null,e,!1)}},h.prototype.addListener=function(e,t,r,i,n,o){t.addEventListener?(t.addEventListener(r,n,o),this.eventRemovers[e].push(function(){t.removeEventListener(r,n,o)})):i&&(t.attachEvent(i,n),this.eventRemovers[e].push(function(){t.detachEvent(i,n)}))},h.prototype.removeListeners=function(e){for(;this.eventRemovers[e].length;)this.eventRemovers[e].shift()()},e.exports=h},738:function(){!function(e){e.console||(e.console={});for(var t,r,i=e.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(",");t=o.pop();)i[t]||(i[t]={});for(;r=a.pop();)i[r]||(i[r]=n)}("undefined"==typeof window?this:window)},744:(e,t,r)=>{var i=r(539);function n(e,t,r,i){this.rateLimiter=e,this.api=t,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(e){this.api&&this.api.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addPredicate=function(e){return i.isFunction(e)&&this.predicates.push(e),this},n.prototype.addPendingItem=function(e){this.pendingItems.push(e)},n.prototype.removePendingItem=function(e){var t=this.pendingItems.indexOf(e);-1!==t&&this.pendingItems.splice(t,1)},n.prototype.addItem=function(e,t,r,n){t&&i.isFunction(t)||(t=function(){});var o=this._applyPredicates(e);if(o.stop)return this.removePendingItem(n),void t(o.err);if(this._maybeLog(e,r),this.removePendingItem(n),this.options.transmit){this.pendingRequests.push(e);try{this._makeApiRequest(e,function(r,i){this._dequeuePendingRequest(e),t(r,i)}.bind(this))}catch(r){this._dequeuePendingRequest(e),t(r)}}else t(new Error("Transmit disabled"))},n.prototype.wait=function(e){i.isFunction(e)&&(this.waitCallback=e,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){this._maybeCallWait()}.bind(this),500)))},n.prototype._applyPredicates=function(e){for(var t=null,r=0,i=this.predicates.length;r<i;r++)if(!(t=this.predicates[r](e,this.options))||void 0!==t.err)return{stop:!0,err:t.err};return{stop:!1,err:null}},n.prototype._makeApiRequest=function(e,t){var r=this.rateLimiter.shouldSend(e);r.shouldSend?this.api.postItem(e,function(r,i){r?this._maybeRetry(r,e,t):t(r,i)}.bind(this)):r.error?t(r.error):this.api.postItem(r.payload,t)};var o=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"];n.prototype._maybeRetry=function(e,t,r){var n=!1;if(this.options.retryInterval){for(var a=0,s=o.length;a<s;a++)if(e.code===o[a]){n=!0;break}n&&i.isFiniteNumber(this.options.maxRetries)&&(t.retries=t.retries?t.retries+1:1,t.retries>this.options.maxRetries&&(n=!1))}n?this._retryApiRequest(t,r):r(e)},n.prototype._retryApiRequest=function(e,t){this.retryQueue.push({item:e,callback:t}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;this.retryQueue.length;){var e=this.retryQueue.shift();this._makeApiRequest(e.item,e.callback)}}.bind(this),this.options.retryInterval))},n.prototype._dequeuePendingRequest=function(e){var t=this.pendingRequests.indexOf(e);-1!==t&&(this.pendingRequests.splice(t,1),this._maybeCallWait())},n.prototype._maybeLog=function(e,t){if(this.logger&&this.options.verbose){var r=t;if(r=(r=r||i.get(e,"body.trace.exception.message"))||i.get(e,"body.trace_chain.0.exception.message"))return void this.logger.error(r);(r=i.get(e,"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))},e.exports=n},777:(e,t,r)=>{var i=r(539);function n(e,t){this.queue=e,this.options=t,this.transforms=[],this.diagnostic={}}n.prototype.configure=function(e){this.queue&&this.queue.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addTransform=function(e){return i.isFunction(e)&&this.transforms.push(e),this},n.prototype.log=function(e,t){if(t&&i.isFunction(t)||(t=function(){}),!this.options.enabled)return t(new Error("Rollbar is not enabled"));this.queue.addPendingItem(e);var r=e.err;this._applyTransforms(e,function(i,n){if(i)return this.queue.removePendingItem(e),t(i,null);this.queue.addItem(n,t,r,e)}.bind(this))},n.prototype._applyTransforms=function(e,t){var r=-1,i=this.transforms.length,n=this.transforms,o=this.options,a=function(e,s){e?t(e,null):++r!==i?n[r](s,o,a):t(null,s)};a(null,e)},e.exports=n},790:e=>{function t(e){return(e.getAttribute("type")||"").toLowerCase()}function r(e){if(!e||!e.tagName)return"";var t=[e.tagName];e.id&&t.push("#"+e.id),e.classes&&t.push("."+e.classes.join("."));for(var r=0;r<e.attributes.length;r++)t.push("["+e.attributes[r].key+'="'+e.attributes[r].value+'"]');return t.join("")}function i(e){if(!e||!e.tagName)return null;var t,r,i,n,o={};o.tagName=e.tagName.toLowerCase(),e.id&&(o.id=e.id),(t=e.className)&&"string"==typeof t&&(o.classes=t.split(/\s+/));var a=["type","name","title","alt"];for(o.attributes=[],n=0;n<a.length;n++)r=a[n],(i=e.getAttribute(r))&&o.attributes.push({key:r,value:i});return o}e.exports={describeElement:i,descriptionToString:r,elementArrayToString:function(e){for(var t,i,n=[],o=0,a=e.length-1;a>=0;a--){if(t=r(e[a]),i=o+3*n.length+t.length,a<e.length-1&&i>=83){n.unshift("...");break}n.unshift(t),o+=t.length}return n.join(" > ")},treeToArray:function(e){for(var t,r=[],n=0;e&&n<5&&"html"!==(t=i(e)).tagName;n++)r.unshift(t),e=e.parentNode;return r},getElementFromEvent:function(e,t){return e.target?e.target:t&&t.elementFromPoint?t.elementFromPoint(e.clientX,e.clientY):void 0},isDescribedElement:function(e,r,i){if(e.tagName.toLowerCase()!==r.toLowerCase())return!1;if(!i)return!0;e=t(e);for(var n=0;n<i.length;n++)if(i[n]===e)return!0;return!1},getElementType:t}},796:e=>{e.exports={captureUncaughtExceptions:function(e,t,r){if(e){var i;if("function"==typeof t._rollbarOldOnError)i=t._rollbarOldOnError;else if(e.onerror){for(i=e.onerror;i._rollbarOldOnError;)i=i._rollbarOldOnError;t._rollbarOldOnError=i}t.handleAnonymousErrors();var n=function(){var r=Array.prototype.slice.call(arguments,0);!function(e,t,r,i){e._rollbarWrappedError&&(i[4]||(i[4]=e._rollbarWrappedError),i[5]||(i[5]=e._rollbarWrappedError._rollbarContext),e._rollbarWrappedError=null);var n=t.handleUncaughtException.apply(t,i);r&&r.apply(e,i),"anonymous"===n&&(t.anonymousErrorsPending+=1)}(e,t,i,r)};r&&(n._rollbarOldOnError=i),e.onerror=n}},captureUnhandledRejections:function(e,t,r){if(e){"function"==typeof e._rollbarURH&&e._rollbarURH.belongsToShim&&e.removeEventListener("unhandledrejection",e._rollbarURH);var i=function(e){var r,i,n;try{r=e.reason}catch(e){r=void 0}try{i=e.promise}catch(e){i="[unhandledrejection] error getting `promise` from event"}try{n=e.detail,!r&&n&&(r=n.reason,i=n.promise)}catch(e){}r||(r="[unhandledrejection] error getting `reason` from event"),t&&t.handleUnhandledRejection&&t.handleUnhandledRejection(r,i)};i.belongsToShim=r,e._rollbarURH=i,e.addEventListener("unhandledrejection",i)}}}},888:(e,t,r)=>{var i=r(539),n=r(12);function o(e,t){return[e,i.stringify(e,t)]}function a(e,t){var r=e.length;return r>2*t?e.slice(0,t).concat(e.slice(r-t)):e}function s(e,t,r){r=void 0===r?30:r;var n,o=e.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[e,i.stringify(e,t)]}function l(e,t){return t&&t.length>e?t.slice(0,e-3).concat("..."):t}function c(e,t,r){return t=n(t,function t(r,o,a){switch(i.typeName(o)){case"string":return l(e,o);case"object":case"array":return n(o,t,a);default:return o}}),[t,i.stringify(t,r)]}function u(e){return e.exception&&(delete e.exception.description,e.exception.message=l(255,e.exception.message)),e.frames=a(e.frames,1),e}function h(e,t){var r=e.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[e,i.stringify(e,t)]}function d(e,t){return i.maxByteSize(e)>t}e.exports={truncate:function(e,t,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(e=(n=i(e,t))[0],(a=n[1]).error||!d(a.value,r))return a;return a},raw:o,truncateFrames:s,truncateStrings:c,maybeTruncateValue:l}},944:(e,t,r)=>{var i=r(197),n=r(352),o=r(683),a=r(435),s=r(424),l=r(356),c=r(888);i.setComponents({telemeter:n,instrumenter:o,polyfillJSON:a,wrapGlobals:s,scrub:l,truncation:c}),e.exports=i},962:(e,t,r)=>{var i=r(539);function n(e,t){i.isFunction(e[t])&&(e[t]=e[t].toString())}e.exports={itemToPayload:function(e,t,r){var i=e.data;e._isUncaught&&(i._isUncaught=!0),e._originalArgs&&(i._originalArgs=e._originalArgs),r(null,i)},addPayloadOptions:function(e,t,r){var n=t.payload||{};n.body&&delete n.body,e.data=i.merge(e.data,n),r(null,e)},addTelemetryData:function(e,t,r){e.telemetryEvents&&i.set(e,"data.body.telemetry",e.telemetryEvents),r(null,e)},addMessageWithError:function(e,t,r){if(e.message){var n="data.body.trace_chain.0",o=i.get(e,n);if(o||(n="data.body.trace",o=i.get(e,n)),o){if(!o.exception||!o.exception.description)return i.set(e,n+".exception.description",e.message),void r(null,e);var a=i.get(e,n+".extra")||{},s=i.merge(a,{message:e.message});i.set(e,n+".extra",s)}r(null,e)}else r(null,e)},userTransform:function(e){return function(t,r,n){var o=i.merge(t),a=null;try{i.isFunction(r.transform)&&(a=r.transform(o.data,t))}catch(i){return r.transform=null,e.error("Error while calling custom transform() function. Removing custom transform().",i),void n(null,t)}i.isPromise(a)?a.then(function(e){e&&(o.data=e),n(null,o)},function(e){n(e,t)}):n(null,o)}},addConfigToPayload:function(e,t,r){if(!t.sendConfig)return r(null,e);var n=i.get(e,"data.custom")||{};n._rollbarConfig=t,e.data.custom=n,r(null,e)},addConfiguredOptions:function(e,t,r){var i=t._configuredOptions;n(i,"transform"),n(i,"checkIgnore"),n(i,"onSendCallback"),delete i.accessToken,e.data.notifier.configured_options=i,r(null,e)},addDiagnosticKeys:function(e,t,r){var n=i.merge(e.notifier.client.notifier.diagnostic,e.diagnostic);if(i.get(e,"err._isAnonymous")&&(n.is_anonymous=!0),e._isUncaught&&(n.is_uncaught=e._isUncaught),e.err)try{n.raw_error={message:e.err.message,name:e.err.name,constructor_name:e.err.constructor&&e.err.constructor.name,filename:e.err.fileName,line:e.err.lineNumber,column:e.err.columnNumber,stack:e.err.stack}}catch(e){n.raw_error={failed:String(e)}}e.data.notifier.diagnostic=i.merge(e.data.notifier.diagnostic,n),r(null,e)}}},974:e=>{function t(e){return"string"!=typeof e&&(e=String(e)),e.toLowerCase()}function r(e){this.map={},e instanceof r?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}r.prototype.append=function(e,r){e=t(e),r=function(e){return"string"!=typeof e&&(e=String(e)),e}(r);var i=this.map[e];this.map[e]=i?i+", "+r:r},r.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},r.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),function(e){return{next:function(){var t=e.shift();return{done:void 0===t,value:t}}}}(e)},e.exports=function(e){return"undefined"==typeof Headers?new r(e):new Headers(e)}}},t={},function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}(183);var e,t})),Se.exports);class Pe{static initialize(e){Pe.getInstance().rollbar=Ie.init({accessToken:"208cf50b805f409bb0b08d5c9f68ce61",captureUncaught:!0,captureUnhandledRejections:!0,payload:{environment:"production",component:e,client:{javascript:{code_version:void 0}}}})}static getInstance(){return Pe.instance||(Pe.instance=new Pe),Pe.instance}error(e,t){this.rollbar?.error(e,t)}info(e,t){this.rollbar?.info(e,t)}warning(e,t){this.rollbar?.warning(e,t)}critical(e,t){this.rollbar?.critical(e,t)}}class ke{constructor(){this.MEASUREMENT_ID="G-6XL8YD35QR",this.isInitialized=!1,this.sessionId=""}static getInstance(){return ke.instance||(ke.instance=new ke),ke.instance}generateSessionId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}initialize(e){if(this.isInitialized)return;ke.component=e,this.sessionId=this.generateSessionId();const t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtag/js?id=${this.MEASUREMENT_ID}`,document.head.appendChild(t),window.dataLayer=window.dataLayer||[];window.gtag=window.gtag||((...e)=>{window.dataLayer.push(e)}),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(e){this.isInitialized&&window.gtag("event","page_view",{page_title:e,page_location:window.location.href,page_path:e,component:ke.component,session_id:this.sessionId,send_to:"mapvx"})}trackEvent(e,t){this.isInitialized&&window.gtag("event",e,{...t,component:ke.component,session_id:this.sessionId,send_to:"mapvx"})}trackUserTiming(e,t,r){this.isInitialized&&window.gtag("event","timing_complete",{name:t,value:r,event_category:e,component:ke.component,session_id:this.sessionId,send_to:"mapvx"})}trackException(e,t=!1){this.isInitialized&&window.gtag("event","exception",{description:e,fatal:t,component:ke.component,session_id:this.sessionId,send_to:"mapvx"})}}exports.AnalyticsController=ke,exports.E=G,exports.MarkerStyle=xe,exports.RollbarController=Pe,exports.SDKController=class{constructor(e){this.connected=!1,this.enabledFloors=[],this.host=e,this.host.addController(this),this.contextProvider=new pe(this.host,{context:we,initialValue:{enabledFloors:[],markers:[],cameraInitialized:!1}})}async prewarm(e,t,r,i){if(!this.connected)return;const n=be.initializeSDK(e,{lang:t});this.contextProvider.setValue({...this.contextProvider.value,sdk:n,locale:t,parentPlaceId:r,originId:i?.originId??this.contextProvider.value.originId,destinationId:i?.destinationId??this.contextProvider.value.destinationId});try{const[e,t,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=t?.innerFloors||[];let l,c=s;if(o||a){const e=[o,a].map(e=>e?.inFloor(s)).filter(e=>void 0!==e);e.length>0&&(c=e),l=a?.inFloors?.[0]?s.find(e=>e.key===a.inFloors[0]):o?.inFloors?.[0]?s.find(e=>e.key===o.inFloors[0]):void 0}this.enabledFloors=c,this.contextProvider.setValue({...this.contextProvider.value,generalConfig:e??this.contextProvider.value.generalConfig,parentPlace:t??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:xe.youAreHere}]:[],...a?[{id:a.lazarilloId,data:a,style:xe.placePopup}]:[]]})}catch(o){Pe.getInstance().warning("Error prewarming SDK",{error:o,parentPlaceId:r})}}async initialize(e,t,r){if(!this.connected)return;const i=this.contextProvider.value;if(i.sdk&&i.locale===t&&i.parentPlaceId===r)return;await this.initializeSDK(e,t,r);const{originId:n,destinationId:o}=this.contextProvider.value;n&&o&&this.setOriginAndDestination(n,o)}async setOriginAndDestination(e,t){if(!this.connected)return;const r=this.contextProvider.value.sdk;if(this.contextProvider.setValue({...this.contextProvider.value,originId:e,destinationId:t}),r)try{const[i,n]=await Promise.all([e,t].map(e=>{if(e?.length>0)return r.getPlaceDetail(e).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(e=>!!e).map(e=>e.inFloor(a)).filter(e=>void 0!==e);this.enabledFloors=s,this.contextProvider.setValue({...this.contextProvider.value,enabledFloors:s})}catch(i){Pe.getInstance().warning("Error setting origin and destination",{error:i,originId:e,destinationId:t})}}getDestination(){return this.contextProvider.value.destination}async loadRoute(e,t,r=!1){if(!this.connected)return;const i=this.contextProvider.value.sdk;if(i)try{const n=await i.getRoute({initialLocation:{id:e},finalLocation:{id:t},preferAccessibleRoute:r});if(!n)return;const o=this.contextProvider.value.parentPlace?.innerFloors||[],a=n.legs.flatMap(e=>e.steps.flatMap(e=>[e.startInsideFloor,e.endInsideFloor])).map(e=>e?o.find(t=>t.key===e):void 0).filter(e=>void 0!==e);this.contextProvider.setValue({...this.contextProvider.value,route:n,enabledFloors:a,isRouteAnimating:!1})}catch(n){Pe.getInstance().warning("Error loading route",{error:n,originId:e,destinationId:t})}}async loadConfig(e){const t=this.contextProvider.value.sdk;if(t)try{const r=await t.getConfiguration(e);this.contextProvider.setValue({...this.contextProvider.value,generalConfig:r})}catch(r){Pe.getInstance().warning("Error loading config",{error:r,parentPlaceId:e})}}async initializeSDK(e,t,r){const i=be.initializeSDK(e,{lang:t});this.contextProvider.setValue({...this.contextProvider.value,sdk:i,locale:t,parentPlaceId:r});try{const[e,t]=await Promise.all([i.getConfiguration(r).catch(()=>{}),i.getPlaceDetail(r).catch(()=>{})]),{origin:n,destination:o}=this.contextProvider.value;let a=t?.innerFloors||[];const s=n?.inFloor(a)||o?.inFloor(a);(n||o)&&(a=[n,o].map(e=>e?.inFloor(a)).filter(e=>void 0!==e),this.enabledFloors=a),this.contextProvider.setValue({...this.contextProvider.value,generalConfig:e??this.contextProvider.value.generalConfig,parentPlace:t??this.contextProvider.value.parentPlace,enabledFloors:a,currentFloor:s})}catch(n){Pe.getInstance().warning("Error initializing SDK",{error:n,parentPlaceId:r})}}createOriginDestinationMarkers(e,t){const r=[];e&&r.push({id:e.lazarilloId,data:e,style:xe.youAreHere}),t&&r.push({id:t.lazarilloId,data:t,style:xe.placePopup}),this.contextProvider.setValue({...this.contextProvider.value,markers:r})}setAccessibleRoute(e){this.contextProvider.setValue({...this.contextProvider.value,accessibleRoute:e});const{originId:t,destinationId:r,route:i}=this.contextProvider.value;t&&r&&i&&this.loadRoute(t,r,e)}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:e,destinationId:t,accessibleRoute:r}=this.contextProvider.value;e&&t&&this.loadRoute(e,t,!!r)}setFloor(e){const{parentPlace:t,currentFloor:r}=this.contextProvider.value;if(!t)return;if(r?.key===e)return;const i=t.innerFloors.find(t=>t.key===e);i&&this.contextProvider.setValue({...this.contextProvider.value,currentFloor:i})}hostConnected(){this.connected=!0}hostDisconnected(){this.connected=!1}setMapReady(e){this.contextProvider.setValue({...this.contextProvider.value,mapReady:e})}setCameraInitialized(e){this.contextProvider.setValue({...this.contextProvider.value,cameraInitialized:e})}resetData(){this.contextProvider.setValue({...this.contextProvider.value,originId:void 0,destinationId:void 0,origin: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.b=U,exports.distExports=be,exports.i=ae,exports.i$1=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,r,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[i+1],e[0]);return new n(i,e,r)},exports.loadCompactFloorSelector=()=>Promise.resolve().then(()=>require("./compact-floor-selector-CjEWEJM8.cjs")),exports.loadCustomMap=()=>Promise.resolve().then(()=>require("./custom-map-D3dQQyOb.cjs")),exports.loadFloorSelector=()=>Promise.resolve().then(()=>require("./floor-selector-DFyRRyAb.cjs")),exports.loadQrModal=()=>Promise.resolve().then(()=>require("./qr-modal-B4BqIRX4.cjs")),exports.loadRouteOptions=()=>Promise.resolve().then(()=>require("./route-options-DQc0dugR.cjs")),exports.n=function(e){return(t,r)=>"object"==typeof r?ce(e,t,r):((e,t,r)=>{const i=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),i?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)},exports.preloadMaplibreCss=async()=>{try{await Promise.resolve().then(()=>require("./styles-Bt354u5n.cjs"))}catch{}},exports.r=o,exports.s=ue,exports.sdkContext=we,exports.t=e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};
|
|
56
|
+
//# sourceMappingURL=lazy-load-BE9-keHk.cjs.map
|