@opengis/bi 1.0.50 → 1.0.52
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/bi.js +1 -1
- package/dist/bi.umd.cjs +5 -5
- package/dist/{import-file-MuPNIOS3.js → import-file-4iqJ-UZ9.js} +8 -8
- package/dist/{vs-donut-CgRhH9p9.js → vs-donut-soXDKUAE.js} +1 -1
- package/dist/{vs-funnel-bar-BREiOqhJ.js → vs-funnel-bar-C6ZZZGnB.js} +1 -1
- package/dist/{vs-list-Dpwm-9Z1.js → vs-list-DYieCz31.js} +1 -1
- package/dist/{vs-map-n0AjqBCy.js → vs-map-C0oy-Z5M.js} +90 -82
- package/dist/{vs-map-cluster-CFX3Ega7.js → vs-map-cluster-Cz_pEGZ7.js} +2 -2
- package/dist/{vs-number-CdmpDELt.js → vs-number-DT-9by-h.js} +1 -1
- package/dist/{vs-table-CvcVgu34.js → vs-table-rcb3LWiR.js} +1 -1
- package/dist/{vs-text-YlYPwCzJ.js → vs-text-Bbo9hKH2.js} +1 -1
- package/package.json +1 -1
package/dist/bi.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(P,En){typeof exports=="object"&&typeof module<"u"?module.exports=En(require("vue")):typeof define=="function"&&define.amd?define(["vue"],En):(P=typeof globalThis<"u"?globalThis:P||self,P.bi=En(P.Vue))})(this,function(P){"use strict";var G_e=Object.defineProperty;var U_e=(P,En,rs)=>En in P?G_e(P,En,{enumerable:!0,configurable:!0,writable:!0,value:rs}):P[En]=rs;var bn=(P,En,rs)=>U_e(P,typeof En!="symbol"?En+"":En,rs);function En(r,e){return r!=null&&r.value?isNaN(r==null?void 0:r.value)?r==null?void 0:r.value:new Intl.NumberFormat("en",e||{notation:"compact"}).format(r==null?void 0:r.value):isNaN(r)?r:new Intl.NumberFormat("en",e||{notation:"compact"}).format(r)}function rs(r){if(!(r!=null&&r.includes("T")))return r;const[e,t,n]=r.split("T")[0].split("-");return`${n}.${t}.${e}`}function DG(r){return Intl.NumberFormat("en").format(r)}function TD(r,e){return function(){return r.apply(e,arguments)}}const{toString:MG}=Object.prototype,{getPrototypeOf:ax}=Object,mm=(r=>e=>{const t=MG.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ro=r=>(r=r.toLowerCase(),e=>mm(e)===r),ym=r=>e=>typeof e===r,{isArray:Bh}=Array,Qf=ym("undefined");function IG(r){return r!==null&&!Qf(r)&&r.constructor!==null&&!Qf(r.constructor)&&Ra(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const ED=Ro("ArrayBuffer");function kG(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&ED(r.buffer),e}const LG=ym("string"),Ra=ym("function"),CD=ym("number"),_m=r=>r!==null&&typeof r=="object",PG=r=>r===!0||r===!1,bm=r=>{if(mm(r)!=="object")return!1;const e=ax(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},RG=Ro("Date"),NG=Ro("File"),OG=Ro("Blob"),zG=Ro("FileList"),BG=r=>_m(r)&&Ra(r.pipe),VG=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Ra(r.append)&&((e=mm(r))==="formdata"||e==="object"&&Ra(r.toString)&&r.toString()==="[object FormData]"))},FG=Ro("URLSearchParams"),[$G,GG,UG,HG]=["ReadableStream","Request","Response","Headers"].map(Ro),WG=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ep(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),Bh(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const a=t?Object.getOwnPropertyNames(r):Object.keys(r),o=a.length;let s;for(n=0;n<o;n++)s=a[n],e.call(null,r[s],s,r)}}function AD(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const Uc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,DD=r=>!Qf(r)&&r!==Uc;function ox(){const{caseless:r}=DD(this)&&this||{},e={},t=(n,i)=>{const a=r&&AD(e,i)||i;bm(e[a])&&bm(n)?e[a]=ox(e[a],n):bm(n)?e[a]=ox({},n):Bh(n)?e[a]=n.slice():e[a]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&ep(arguments[n],t);return e}const qG=(r,e,t,{allOwnKeys:n}={})=>(ep(e,(i,a)=>{t&&Ra(i)?r[a]=TD(i,t):r[a]=i},{allOwnKeys:n}),r),ZG=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),jG=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},XG=(r,e,t,n)=>{let i,a,o;const s={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),a=i.length;a-- >0;)o=i[a],(!n||n(o,r,e))&&!s[o]&&(e[o]=r[o],s[o]=!0);r=t!==!1&&ax(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},YG=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},KG=r=>{if(!r)return null;if(Bh(r))return r;let e=r.length;if(!CD(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},JG=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&ax(Uint8Array)),QG=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const a=i.value;e.call(r,a[0],a[1])}},eU=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},tU=Ro("HTMLFormElement"),rU=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),MD=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),nU=Ro("RegExp"),ID=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};ep(t,(i,a)=>{let o;(o=e(i,a,r))!==!1&&(n[a]=o||i)}),Object.defineProperties(r,n)},iU=r=>{ID(r,(e,t)=>{if(Ra(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Ra(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},aU=(r,e)=>{const t={},n=i=>{i.forEach(a=>{t[a]=!0})};return Bh(r)?n(r):n(String(r).split(e)),t},oU=()=>{},sU=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function lU(r){return!!(r&&Ra(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const cU=r=>{const e=new Array(10),t=(n,i)=>{if(_m(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const a=Bh(n)?[]:{};return ep(n,(o,s)=>{const l=t(o,i+1);!Qf(l)&&(a[s]=l)}),e[i]=void 0,a}}return n};return t(r,0)},uU=Ro("AsyncFunction"),hU=r=>r&&(_m(r)||Ra(r))&&Ra(r.then)&&Ra(r.catch),kD=((r,e)=>r?setImmediate:e?((t,n)=>(Uc.addEventListener("message",({source:i,data:a})=>{i===Uc&&a===t&&n.length&&n.shift()()},!1),i=>{n.push(i),Uc.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ra(Uc.postMessage)),dU=typeof queueMicrotask<"u"?queueMicrotask.bind(Uc):typeof process<"u"&&process.nextTick||kD,Ze={isArray:Bh,isArrayBuffer:ED,isBuffer:IG,isFormData:VG,isArrayBufferView:kG,isString:LG,isNumber:CD,isBoolean:PG,isObject:_m,isPlainObject:bm,isReadableStream:$G,isRequest:GG,isResponse:UG,isHeaders:HG,isUndefined:Qf,isDate:RG,isFile:NG,isBlob:OG,isRegExp:nU,isFunction:Ra,isStream:BG,isURLSearchParams:FG,isTypedArray:JG,isFileList:zG,forEach:ep,merge:ox,extend:qG,trim:WG,stripBOM:ZG,inherits:jG,toFlatObject:XG,kindOf:mm,kindOfTest:Ro,endsWith:YG,toArray:KG,forEachEntry:QG,matchAll:eU,isHTMLForm:tU,hasOwnProperty:MD,hasOwnProp:MD,reduceDescriptors:ID,freezeMethods:iU,toObjectSet:aU,toCamelCase:rU,noop:oU,toFiniteNumber:sU,findKey:AD,global:Uc,isContextDefined:DD,isSpecCompliantForm:lU,toJSONObject:cU,isAsyncFn:uU,isThenable:hU,setImmediate:kD,asap:dU};function Sr(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Ze.inherits(Sr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ze.toJSONObject(this.config),code:this.code,status:this.status}}});const LD=Sr.prototype,PD={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{PD[r]={value:r}}),Object.defineProperties(Sr,PD),Object.defineProperty(LD,"isAxiosError",{value:!0}),Sr.from=(r,e,t,n,i,a)=>{const o=Object.create(LD);return Ze.toFlatObject(r,o,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),Sr.call(o,r.message,e,t,n,i),o.cause=r,o.name=r.name,a&&Object.assign(o,a),o};const fU=null;function sx(r){return Ze.isPlainObject(r)||Ze.isArray(r)}function RD(r){return Ze.endsWith(r,"[]")?r.slice(0,-2):r}function ND(r,e,t){return r?r.concat(e).map(function(i,a){return i=RD(i),!t&&a?"["+i+"]":i}).join(t?".":""):e}function pU(r){return Ze.isArray(r)&&!r.some(sx)}const gU=Ze.toFlatObject(Ze,{},null,function(e){return/^is[A-Z]/.test(e)});function xm(r,e,t){if(!Ze.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=Ze.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,w){return!Ze.isUndefined(w[x])});const n=t.metaTokens,i=t.visitor||d,a=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ze.isSpecCompliantForm(e);if(!Ze.isFunction(i))throw new TypeError("visitor must be a function");function c(_){if(_===null)return"";if(Ze.isDate(_))return _.toISOString();if(!l&&Ze.isBlob(_))throw new Sr("Blob is not supported. Use a Buffer instead.");return Ze.isArrayBuffer(_)||Ze.isTypedArray(_)?l&&typeof Blob=="function"?new Blob([_]):Buffer.from(_):_}function d(_,x,w){let C=_;if(_&&!w&&typeof _=="object"){if(Ze.endsWith(x,"{}"))x=n?x:x.slice(0,-2),_=JSON.stringify(_);else if(Ze.isArray(_)&&pU(_)||(Ze.isFileList(_)||Ze.endsWith(x,"[]"))&&(C=Ze.toArray(_)))return x=RD(x),C.forEach(function(L,O){!(Ze.isUndefined(L)||L===null)&&e.append(o===!0?ND([x],O,a):o===null?x:x+"[]",c(L))}),!1}return sx(_)?!0:(e.append(ND(w,x,a),c(_)),!1)}const f=[],g=Object.assign(gU,{defaultVisitor:d,convertValue:c,isVisitable:sx});function m(_,x){if(!Ze.isUndefined(_)){if(f.indexOf(_)!==-1)throw Error("Circular reference detected in "+x.join("."));f.push(_),Ze.forEach(_,function(C,M){(!(Ze.isUndefined(C)||C===null)&&i.call(e,C,Ze.isString(M)?M.trim():M,x,g))===!0&&m(C,x?x.concat(M):[M])}),f.pop()}}if(!Ze.isObject(r))throw new TypeError("data must be an object");return m(r),e}function OD(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function lx(r,e){this._pairs=[],r&&xm(r,this,e)}const zD=lx.prototype;zD.append=function(e,t){this._pairs.push([e,t])},zD.toString=function(e){const t=e?function(n){return e.call(this,n,OD)}:OD;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function vU(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function BD(r,e,t){if(!e)return r;const n=t&&t.encode||vU;Ze.isFunction(t)&&(t={serialize:t});const i=t&&t.serialize;let a;if(i?a=i(e,t):a=Ze.isURLSearchParams(e)?e.toString():new lx(e,t).toString(n),a){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+a}return r}class VD{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ze.forEach(this.handlers,function(n){n!==null&&e(n)})}}const FD={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},mU={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:lx,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cx=typeof window<"u"&&typeof document<"u",ux=typeof navigator=="object"&&navigator||void 0,yU=cx&&(!ux||["ReactNative","NativeScript","NS"].indexOf(ux.product)<0),_U=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bU=cx&&window.location.href||"http://localhost",Ni={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cx,hasStandardBrowserEnv:yU,hasStandardBrowserWebWorkerEnv:_U,navigator:ux,origin:bU},Symbol.toStringTag,{value:"Module"})),...mU};function xU(r,e){return xm(r,new Ni.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,a){return Ni.isNode&&Ze.isBuffer(t)?(this.append(n,t.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function wU(r){return Ze.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function SU(r){const e={},t=Object.keys(r);let n;const i=t.length;let a;for(n=0;n<i;n++)a=t[n],e[a]=r[a];return e}function $D(r){function e(t,n,i,a){let o=t[a++];if(o==="__proto__")return!0;const s=Number.isFinite(+o),l=a>=t.length;return o=!o&&Ze.isArray(i)?i.length:o,l?(Ze.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!s):((!i[o]||!Ze.isObject(i[o]))&&(i[o]=[]),e(t,n,i[o],a)&&Ze.isArray(i[o])&&(i[o]=SU(i[o])),!s)}if(Ze.isFormData(r)&&Ze.isFunction(r.entries)){const t={};return Ze.forEachEntry(r,(n,i)=>{e(wU(n),i,t,0)}),t}return null}function TU(r,e,t){if(Ze.isString(r))try{return(e||JSON.parse)(r),Ze.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(0,JSON.stringify)(r)}const tp={transitional:FD,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,a=Ze.isObject(e);if(a&&Ze.isHTMLForm(e)&&(e=new FormData(e)),Ze.isFormData(e))return i?JSON.stringify($D(e)):e;if(Ze.isArrayBuffer(e)||Ze.isBuffer(e)||Ze.isStream(e)||Ze.isFile(e)||Ze.isBlob(e)||Ze.isReadableStream(e))return e;if(Ze.isArrayBufferView(e))return e.buffer;if(Ze.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return xU(e,this.formSerializer).toString();if((s=Ze.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return xm(s?{"files[]":e}:e,l&&new l,this.formSerializer)}}return a||i?(t.setContentType("application/json",!1),TU(e)):e}],transformResponse:[function(e){const t=this.transitional||tp.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(Ze.isResponse(e)||Ze.isReadableStream(e))return e;if(e&&Ze.isString(e)&&(n&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(s){if(o)throw s.name==="SyntaxError"?Sr.from(s,Sr.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ni.classes.FormData,Blob:Ni.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ze.forEach(["delete","get","head","post","put","patch"],r=>{tp.headers[r]={}});const EU=Ze.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),CU=r=>{const e={};let t,n,i;return r&&r.split(`
|
|
1
|
+
(function(P,En){typeof exports=="object"&&typeof module<"u"?module.exports=En(require("vue")):typeof define=="function"&&define.amd?define(["vue"],En):(P=typeof globalThis<"u"?globalThis:P||self,P.bi=En(P.Vue))})(this,function(P){"use strict";var W_e=Object.defineProperty;var q_e=(P,En,rs)=>En in P?W_e(P,En,{enumerable:!0,configurable:!0,writable:!0,value:rs}):P[En]=rs;var bn=(P,En,rs)=>q_e(P,typeof En!="symbol"?En+"":En,rs);function En(r,e){return r!=null&&r.value?isNaN(r==null?void 0:r.value)?r==null?void 0:r.value:new Intl.NumberFormat("en",e||{notation:"compact"}).format(r==null?void 0:r.value):isNaN(r)?r:new Intl.NumberFormat("en",e||{notation:"compact"}).format(r)}function rs(r){if(!(r!=null&&r.includes("T")))return r;const[e,t,n]=r.split("T")[0].split("-");return`${n}.${t}.${e}`}function DG(r){return Intl.NumberFormat("en").format(r)}function TD(r,e){return function(){return r.apply(e,arguments)}}const{toString:MG}=Object.prototype,{getPrototypeOf:ax}=Object,mm=(r=>e=>{const t=MG.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ro=r=>(r=r.toLowerCase(),e=>mm(e)===r),ym=r=>e=>typeof e===r,{isArray:Bh}=Array,Qf=ym("undefined");function IG(r){return r!==null&&!Qf(r)&&r.constructor!==null&&!Qf(r.constructor)&&Ra(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const ED=Ro("ArrayBuffer");function kG(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&ED(r.buffer),e}const LG=ym("string"),Ra=ym("function"),CD=ym("number"),_m=r=>r!==null&&typeof r=="object",PG=r=>r===!0||r===!1,bm=r=>{if(mm(r)!=="object")return!1;const e=ax(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},RG=Ro("Date"),NG=Ro("File"),OG=Ro("Blob"),zG=Ro("FileList"),BG=r=>_m(r)&&Ra(r.pipe),VG=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Ra(r.append)&&((e=mm(r))==="formdata"||e==="object"&&Ra(r.toString)&&r.toString()==="[object FormData]"))},FG=Ro("URLSearchParams"),[$G,GG,UG,HG]=["ReadableStream","Request","Response","Headers"].map(Ro),WG=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ep(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),Bh(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const a=t?Object.getOwnPropertyNames(r):Object.keys(r),o=a.length;let s;for(n=0;n<o;n++)s=a[n],e.call(null,r[s],s,r)}}function AD(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const Uc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,DD=r=>!Qf(r)&&r!==Uc;function ox(){const{caseless:r}=DD(this)&&this||{},e={},t=(n,i)=>{const a=r&&AD(e,i)||i;bm(e[a])&&bm(n)?e[a]=ox(e[a],n):bm(n)?e[a]=ox({},n):Bh(n)?e[a]=n.slice():e[a]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&ep(arguments[n],t);return e}const qG=(r,e,t,{allOwnKeys:n}={})=>(ep(e,(i,a)=>{t&&Ra(i)?r[a]=TD(i,t):r[a]=i},{allOwnKeys:n}),r),ZG=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),jG=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},XG=(r,e,t,n)=>{let i,a,o;const s={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),a=i.length;a-- >0;)o=i[a],(!n||n(o,r,e))&&!s[o]&&(e[o]=r[o],s[o]=!0);r=t!==!1&&ax(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},YG=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},KG=r=>{if(!r)return null;if(Bh(r))return r;let e=r.length;if(!CD(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},JG=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&ax(Uint8Array)),QG=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const a=i.value;e.call(r,a[0],a[1])}},eU=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},tU=Ro("HTMLFormElement"),rU=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),MD=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),nU=Ro("RegExp"),ID=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};ep(t,(i,a)=>{let o;(o=e(i,a,r))!==!1&&(n[a]=o||i)}),Object.defineProperties(r,n)},iU=r=>{ID(r,(e,t)=>{if(Ra(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Ra(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},aU=(r,e)=>{const t={},n=i=>{i.forEach(a=>{t[a]=!0})};return Bh(r)?n(r):n(String(r).split(e)),t},oU=()=>{},sU=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function lU(r){return!!(r&&Ra(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const cU=r=>{const e=new Array(10),t=(n,i)=>{if(_m(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const a=Bh(n)?[]:{};return ep(n,(o,s)=>{const l=t(o,i+1);!Qf(l)&&(a[s]=l)}),e[i]=void 0,a}}return n};return t(r,0)},uU=Ro("AsyncFunction"),hU=r=>r&&(_m(r)||Ra(r))&&Ra(r.then)&&Ra(r.catch),kD=((r,e)=>r?setImmediate:e?((t,n)=>(Uc.addEventListener("message",({source:i,data:a})=>{i===Uc&&a===t&&n.length&&n.shift()()},!1),i=>{n.push(i),Uc.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ra(Uc.postMessage)),dU=typeof queueMicrotask<"u"?queueMicrotask.bind(Uc):typeof process<"u"&&process.nextTick||kD,Ze={isArray:Bh,isArrayBuffer:ED,isBuffer:IG,isFormData:VG,isArrayBufferView:kG,isString:LG,isNumber:CD,isBoolean:PG,isObject:_m,isPlainObject:bm,isReadableStream:$G,isRequest:GG,isResponse:UG,isHeaders:HG,isUndefined:Qf,isDate:RG,isFile:NG,isBlob:OG,isRegExp:nU,isFunction:Ra,isStream:BG,isURLSearchParams:FG,isTypedArray:JG,isFileList:zG,forEach:ep,merge:ox,extend:qG,trim:WG,stripBOM:ZG,inherits:jG,toFlatObject:XG,kindOf:mm,kindOfTest:Ro,endsWith:YG,toArray:KG,forEachEntry:QG,matchAll:eU,isHTMLForm:tU,hasOwnProperty:MD,hasOwnProp:MD,reduceDescriptors:ID,freezeMethods:iU,toObjectSet:aU,toCamelCase:rU,noop:oU,toFiniteNumber:sU,findKey:AD,global:Uc,isContextDefined:DD,isSpecCompliantForm:lU,toJSONObject:cU,isAsyncFn:uU,isThenable:hU,setImmediate:kD,asap:dU};function Sr(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Ze.inherits(Sr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ze.toJSONObject(this.config),code:this.code,status:this.status}}});const LD=Sr.prototype,PD={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{PD[r]={value:r}}),Object.defineProperties(Sr,PD),Object.defineProperty(LD,"isAxiosError",{value:!0}),Sr.from=(r,e,t,n,i,a)=>{const o=Object.create(LD);return Ze.toFlatObject(r,o,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),Sr.call(o,r.message,e,t,n,i),o.cause=r,o.name=r.name,a&&Object.assign(o,a),o};const fU=null;function sx(r){return Ze.isPlainObject(r)||Ze.isArray(r)}function RD(r){return Ze.endsWith(r,"[]")?r.slice(0,-2):r}function ND(r,e,t){return r?r.concat(e).map(function(i,a){return i=RD(i),!t&&a?"["+i+"]":i}).join(t?".":""):e}function pU(r){return Ze.isArray(r)&&!r.some(sx)}const gU=Ze.toFlatObject(Ze,{},null,function(e){return/^is[A-Z]/.test(e)});function xm(r,e,t){if(!Ze.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=Ze.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,w){return!Ze.isUndefined(w[x])});const n=t.metaTokens,i=t.visitor||d,a=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ze.isSpecCompliantForm(e);if(!Ze.isFunction(i))throw new TypeError("visitor must be a function");function c(_){if(_===null)return"";if(Ze.isDate(_))return _.toISOString();if(!l&&Ze.isBlob(_))throw new Sr("Blob is not supported. Use a Buffer instead.");return Ze.isArrayBuffer(_)||Ze.isTypedArray(_)?l&&typeof Blob=="function"?new Blob([_]):Buffer.from(_):_}function d(_,x,w){let C=_;if(_&&!w&&typeof _=="object"){if(Ze.endsWith(x,"{}"))x=n?x:x.slice(0,-2),_=JSON.stringify(_);else if(Ze.isArray(_)&&pU(_)||(Ze.isFileList(_)||Ze.endsWith(x,"[]"))&&(C=Ze.toArray(_)))return x=RD(x),C.forEach(function(L,O){!(Ze.isUndefined(L)||L===null)&&e.append(o===!0?ND([x],O,a):o===null?x:x+"[]",c(L))}),!1}return sx(_)?!0:(e.append(ND(w,x,a),c(_)),!1)}const f=[],g=Object.assign(gU,{defaultVisitor:d,convertValue:c,isVisitable:sx});function m(_,x){if(!Ze.isUndefined(_)){if(f.indexOf(_)!==-1)throw Error("Circular reference detected in "+x.join("."));f.push(_),Ze.forEach(_,function(C,M){(!(Ze.isUndefined(C)||C===null)&&i.call(e,C,Ze.isString(M)?M.trim():M,x,g))===!0&&m(C,x?x.concat(M):[M])}),f.pop()}}if(!Ze.isObject(r))throw new TypeError("data must be an object");return m(r),e}function OD(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function lx(r,e){this._pairs=[],r&&xm(r,this,e)}const zD=lx.prototype;zD.append=function(e,t){this._pairs.push([e,t])},zD.toString=function(e){const t=e?function(n){return e.call(this,n,OD)}:OD;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function vU(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function BD(r,e,t){if(!e)return r;const n=t&&t.encode||vU;Ze.isFunction(t)&&(t={serialize:t});const i=t&&t.serialize;let a;if(i?a=i(e,t):a=Ze.isURLSearchParams(e)?e.toString():new lx(e,t).toString(n),a){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+a}return r}class VD{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ze.forEach(this.handlers,function(n){n!==null&&e(n)})}}const FD={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},mU={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:lx,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cx=typeof window<"u"&&typeof document<"u",ux=typeof navigator=="object"&&navigator||void 0,yU=cx&&(!ux||["ReactNative","NativeScript","NS"].indexOf(ux.product)<0),_U=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bU=cx&&window.location.href||"http://localhost",Ni={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cx,hasStandardBrowserEnv:yU,hasStandardBrowserWebWorkerEnv:_U,navigator:ux,origin:bU},Symbol.toStringTag,{value:"Module"})),...mU};function xU(r,e){return xm(r,new Ni.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,a){return Ni.isNode&&Ze.isBuffer(t)?(this.append(n,t.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function wU(r){return Ze.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function SU(r){const e={},t=Object.keys(r);let n;const i=t.length;let a;for(n=0;n<i;n++)a=t[n],e[a]=r[a];return e}function $D(r){function e(t,n,i,a){let o=t[a++];if(o==="__proto__")return!0;const s=Number.isFinite(+o),l=a>=t.length;return o=!o&&Ze.isArray(i)?i.length:o,l?(Ze.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!s):((!i[o]||!Ze.isObject(i[o]))&&(i[o]=[]),e(t,n,i[o],a)&&Ze.isArray(i[o])&&(i[o]=SU(i[o])),!s)}if(Ze.isFormData(r)&&Ze.isFunction(r.entries)){const t={};return Ze.forEachEntry(r,(n,i)=>{e(wU(n),i,t,0)}),t}return null}function TU(r,e,t){if(Ze.isString(r))try{return(e||JSON.parse)(r),Ze.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(0,JSON.stringify)(r)}const tp={transitional:FD,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,a=Ze.isObject(e);if(a&&Ze.isHTMLForm(e)&&(e=new FormData(e)),Ze.isFormData(e))return i?JSON.stringify($D(e)):e;if(Ze.isArrayBuffer(e)||Ze.isBuffer(e)||Ze.isStream(e)||Ze.isFile(e)||Ze.isBlob(e)||Ze.isReadableStream(e))return e;if(Ze.isArrayBufferView(e))return e.buffer;if(Ze.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return xU(e,this.formSerializer).toString();if((s=Ze.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return xm(s?{"files[]":e}:e,l&&new l,this.formSerializer)}}return a||i?(t.setContentType("application/json",!1),TU(e)):e}],transformResponse:[function(e){const t=this.transitional||tp.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(Ze.isResponse(e)||Ze.isReadableStream(e))return e;if(e&&Ze.isString(e)&&(n&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(s){if(o)throw s.name==="SyntaxError"?Sr.from(s,Sr.ERR_BAD_RESPONSE,this,null,this.response):s}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ni.classes.FormData,Blob:Ni.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ze.forEach(["delete","get","head","post","put","patch"],r=>{tp.headers[r]={}});const EU=Ze.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),CU=r=>{const e={};let t,n,i;return r&&r.split(`
|
|
2
2
|
`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!t||e[t]&&EU[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},GD=Symbol("internals");function rp(r){return r&&String(r).trim().toLowerCase()}function wm(r){return r===!1||r==null?r:Ze.isArray(r)?r.map(wm):String(r)}function AU(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}const DU=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function hx(r,e,t,n,i){if(Ze.isFunction(n))return n.call(this,e,t);if(i&&(e=t),!!Ze.isString(e)){if(Ze.isString(n))return e.indexOf(n)!==-1;if(Ze.isRegExp(n))return n.test(e)}}function MU(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function IU(r,e){const t=Ze.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(i,a,o){return this[n].call(this,e,i,a,o)},configurable:!0})})}class ma{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function a(s,l,c){const d=rp(l);if(!d)throw new Error("header name must be a non-empty string");const f=Ze.findKey(i,d);(!f||i[f]===void 0||c===!0||c===void 0&&i[f]!==!1)&&(i[f||l]=wm(s))}const o=(s,l)=>Ze.forEach(s,(c,d)=>a(c,d,l));if(Ze.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Ze.isString(e)&&(e=e.trim())&&!DU(e))o(CU(e),t);else if(Ze.isHeaders(e))for(const[s,l]of e.entries())a(l,s,n);else e!=null&&a(t,e,n);return this}get(e,t){if(e=rp(e),e){const n=Ze.findKey(this,e);if(n){const i=this[n];if(!t)return i;if(t===!0)return AU(i);if(Ze.isFunction(t))return t.call(this,i,n);if(Ze.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=rp(e),e){const n=Ze.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||hx(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let i=!1;function a(o){if(o=rp(o),o){const s=Ze.findKey(n,o);s&&(!t||hx(n,n[s],s,t))&&(delete n[s],i=!0)}}return Ze.isArray(e)?e.forEach(a):a(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const a=t[n];(!e||hx(this,this[a],a,e,!0))&&(delete this[a],i=!0)}return i}normalize(e){const t=this,n={};return Ze.forEach(this,(i,a)=>{const o=Ze.findKey(n,a);if(o){t[o]=wm(i),delete t[a];return}const s=e?MU(a):String(a).trim();s!==a&&delete t[a],t[s]=wm(i),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ze.forEach(this,(n,i)=>{n!=null&&n!==!1&&(t[i]=e&&Ze.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
3
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[GD]=this[GD]={accessors:{}}).accessors,i=this.prototype;function a(o){const s=rp(o);n[s]||(IU(i,o),n[s]=!0)}return Ze.isArray(e)?e.forEach(a):a(e),this}}ma.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ze.reduceDescriptors(ma.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),Ze.freezeMethods(ma);function dx(r,e){const t=this||tp,n=e||t,i=ma.from(n.headers);let a=n.data;return Ze.forEach(r,function(s){a=s.call(t,a,i.normalize(),e?e.status:void 0)}),i.normalize(),a}function UD(r){return!!(r&&r.__CANCEL__)}function Vh(r,e,t){Sr.call(this,r??"canceled",Sr.ERR_CANCELED,e,t),this.name="CanceledError"}Ze.inherits(Vh,Sr,{__CANCEL__:!0});function HD(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new Sr("Request failed with status code "+t.status,[Sr.ERR_BAD_REQUEST,Sr.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function kU(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function LU(r,e){r=r||10;const t=new Array(r),n=new Array(r);let i=0,a=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),d=n[a];o||(o=c),t[i]=l,n[i]=c;let f=a,g=0;for(;f!==i;)g+=t[f++],f=f%r;if(i=(i+1)%r,i===a&&(a=(a+1)%r),c-o<e)return;const m=d&&c-d;return m?Math.round(g*1e3/m):void 0}}function PU(r,e){let t=0,n=1e3/e,i,a;const o=(c,d=Date.now())=>{t=d,i=null,a&&(clearTimeout(a),a=null),r.apply(null,c)};return[(...c)=>{const d=Date.now(),f=d-t;f>=n?o(c,d):(i=c,a||(a=setTimeout(()=>{a=null,o(i)},n-f)))},()=>i&&o(i)]}const Sm=(r,e,t=3)=>{let n=0;const i=LU(50,250);return PU(a=>{const o=a.loaded,s=a.lengthComputable?a.total:void 0,l=o-n,c=i(l),d=o<=s;n=o;const f={loaded:o,total:s,progress:s?o/s:void 0,bytes:l,rate:c||void 0,estimated:c&&s&&d?(s-o)/c:void 0,event:a,lengthComputable:s!=null,[e?"download":"upload"]:!0};r(f)},t)},WD=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},qD=r=>(...e)=>Ze.asap(()=>r(...e)),RU=Ni.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Ni.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Ni.origin),Ni.navigator&&/(msie|trident)/i.test(Ni.navigator.userAgent)):()=>!0,NU=Ni.hasStandardBrowserEnv?{write(r,e,t,n,i,a){const o=[r+"="+encodeURIComponent(e)];Ze.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ze.isString(n)&&o.push("path="+n),Ze.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function OU(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function zU(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function ZD(r,e,t){let n=!OU(e);return r&&(n||t==!1)?zU(r,e):e}const jD=r=>r instanceof ma?{...r}:r;function Hc(r,e){e=e||{};const t={};function n(c,d,f,g){return Ze.isPlainObject(c)&&Ze.isPlainObject(d)?Ze.merge.call({caseless:g},c,d):Ze.isPlainObject(d)?Ze.merge({},d):Ze.isArray(d)?d.slice():d}function i(c,d,f,g){if(Ze.isUndefined(d)){if(!Ze.isUndefined(c))return n(void 0,c,f,g)}else return n(c,d,f,g)}function a(c,d){if(!Ze.isUndefined(d))return n(void 0,d)}function o(c,d){if(Ze.isUndefined(d)){if(!Ze.isUndefined(c))return n(void 0,c)}else return n(void 0,d)}function s(c,d,f){if(f in e)return n(c,d);if(f in r)return n(void 0,c)}const l={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(c,d,f)=>i(jD(c),jD(d),f,!0)};return Ze.forEach(Object.keys(Object.assign({},r,e)),function(d){const f=l[d]||i,g=f(r[d],e[d],d);Ze.isUndefined(g)&&f!==s||(t[d]=g)}),t}const XD=r=>{const e=Hc({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:s}=e;e.headers=o=ma.from(o),e.url=BD(ZD(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),s&&o.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(Ze.isFormData(t)){if(Ni.hasStandardBrowserEnv||Ni.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...d]=l?l.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...d].join("; "))}}if(Ni.hasStandardBrowserEnv&&(n&&Ze.isFunction(n)&&(n=n(e)),n||n!==!1&&RU(e.url))){const c=i&&a&&NU.read(a);c&&o.set(i,c)}return e},BU=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const i=XD(r);let a=i.data;const o=ma.from(i.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:c}=i,d,f,g,m,_;function x(){m&&m(),_&&_(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let w=new XMLHttpRequest;w.open(i.method.toUpperCase(),i.url,!0),w.timeout=i.timeout;function C(){if(!w)return;const L=ma.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),F={data:!s||s==="text"||s==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:L,config:r,request:w};HD(function(U){t(U),x()},function(U){n(U),x()},F),w=null}"onloadend"in w?w.onloadend=C:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(C)},w.onabort=function(){w&&(n(new Sr("Request aborted",Sr.ECONNABORTED,r,w)),w=null)},w.onerror=function(){n(new Sr("Network Error",Sr.ERR_NETWORK,r,w)),w=null},w.ontimeout=function(){let O=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const F=i.transitional||FD;i.timeoutErrorMessage&&(O=i.timeoutErrorMessage),n(new Sr(O,F.clarifyTimeoutError?Sr.ETIMEDOUT:Sr.ECONNABORTED,r,w)),w=null},a===void 0&&o.setContentType(null),"setRequestHeader"in w&&Ze.forEach(o.toJSON(),function(O,F){w.setRequestHeader(F,O)}),Ze.isUndefined(i.withCredentials)||(w.withCredentials=!!i.withCredentials),s&&s!=="json"&&(w.responseType=i.responseType),c&&([g,_]=Sm(c,!0),w.addEventListener("progress",g)),l&&w.upload&&([f,m]=Sm(l),w.upload.addEventListener("progress",f),w.upload.addEventListener("loadend",m)),(i.cancelToken||i.signal)&&(d=L=>{w&&(n(!L||L.type?new Vh(null,r,w):L),w.abort(),w=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const M=kU(i.url);if(M&&Ni.protocols.indexOf(M)===-1){n(new Sr("Unsupported protocol "+M+":",Sr.ERR_BAD_REQUEST,r));return}w.send(a||null)})},VU=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,i;const a=function(c){if(!i){i=!0,s();const d=c instanceof Error?c:this.reason;n.abort(d instanceof Sr?d:new Vh(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,a(new Sr(`timeout ${e} of ms exceeded`,Sr.ETIMEDOUT))},e);const s=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),r=null)};r.forEach(c=>c.addEventListener("abort",a));const{signal:l}=n;return l.unsubscribe=()=>Ze.asap(s),l}},FU=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,i;for(;n<t;)i=n+e,yield r.slice(n,i),n=i},$U=async function*(r,e){for await(const t of GU(r))yield*FU(t,e)},GU=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},YD=(r,e,t,n)=>{const i=$U(r,e);let a=0,o,s=l=>{o||(o=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:c,value:d}=await i.next();if(c){s(),l.close();return}let f=d.byteLength;if(t){let g=a+=f;t(g)}l.enqueue(new Uint8Array(d))}catch(c){throw s(c),c}},cancel(l){return s(l),i.return()}},{highWaterMark:2})},Tm=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",KD=Tm&&typeof ReadableStream=="function",UU=Tm&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),JD=(r,...e)=>{try{return!!r(...e)}catch{return!1}},HU=KD&&JD(()=>{let r=!1;const e=new Request(Ni.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),QD=64*1024,fx=KD&&JD(()=>Ze.isReadableStream(new Response("").body)),Em={stream:fx&&(r=>r.body)};Tm&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Em[e]&&(Em[e]=Ze.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new Sr(`Response type '${e}' is not supported`,Sr.ERR_NOT_SUPPORT,n)})})})(new Response);const WU=async r=>{if(r==null)return 0;if(Ze.isBlob(r))return r.size;if(Ze.isSpecCompliantForm(r))return(await new Request(Ni.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(Ze.isArrayBufferView(r)||Ze.isArrayBuffer(r))return r.byteLength;if(Ze.isURLSearchParams(r)&&(r=r+""),Ze.isString(r))return(await UU(r)).byteLength},qU=async(r,e)=>{const t=Ze.toFiniteNumber(r.getContentLength());return t??WU(e)},px={http:fU,xhr:BU,fetch:Tm&&(async r=>{let{url:e,method:t,data:n,signal:i,cancelToken:a,timeout:o,onDownloadProgress:s,onUploadProgress:l,responseType:c,headers:d,withCredentials:f="same-origin",fetchOptions:g}=XD(r);c=c?(c+"").toLowerCase():"text";let m=VU([i,a&&a.toAbortSignal()],o),_;const x=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let w;try{if(l&&HU&&t!=="get"&&t!=="head"&&(w=await qU(d,n))!==0){let F=new Request(e,{method:"POST",body:n,duplex:"half"}),V;if(Ze.isFormData(n)&&(V=F.headers.get("content-type"))&&d.setContentType(V),F.body){const[U,H]=WD(w,Sm(qD(l)));n=YD(F.body,QD,U,H)}}Ze.isString(f)||(f=f?"include":"omit");const C="credentials"in Request.prototype;_=new Request(e,{...g,signal:m,method:t.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:C?f:void 0});let M=await fetch(_);const L=fx&&(c==="stream"||c==="response");if(fx&&(s||L&&x)){const F={};["status","statusText","headers"].forEach(Z=>{F[Z]=M[Z]});const V=Ze.toFiniteNumber(M.headers.get("content-length")),[U,H]=s&&WD(V,Sm(qD(s),!0))||[];M=new Response(YD(M.body,QD,U,()=>{H&&H(),x&&x()}),F)}c=c||"text";let O=await Em[Ze.findKey(Em,c)||"text"](M,r);return!L&&x&&x(),await new Promise((F,V)=>{HD(F,V,{data:O,headers:ma.from(M.headers),status:M.status,statusText:M.statusText,config:r,request:_})})}catch(C){throw x&&x(),C&&C.name==="TypeError"&&/fetch/i.test(C.message)?Object.assign(new Sr("Network Error",Sr.ERR_NETWORK,r,_),{cause:C.cause||C}):Sr.from(C,C&&C.code,r,_)}})};Ze.forEach(px,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const eM=r=>`- ${r}`,ZU=r=>Ze.isFunction(r)||r===null||r===!1,tM={getAdapter:r=>{r=Ze.isArray(r)?r:[r];const{length:e}=r;let t,n;const i={};for(let a=0;a<e;a++){t=r[a];let o;if(n=t,!ZU(t)&&(n=px[(o=String(t)).toLowerCase()],n===void 0))throw new Sr(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+a]=n}if(!n){const a=Object.entries(i).map(([s,l])=>`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?a.length>1?`since :
|
|
4
4
|
`+a.map(eM).join(`
|
|
@@ -97,7 +97,7 @@ echarts.use([`+ie+"]);":"Unknown series "+X))}return}if(f==="tooltip"){if(L){_d.
|
|
|
97
97
|
`}),w+="</div>",w}},xAxis:{data:e!=null&&e.length?e:null,type:e?"category":"value",name:((i=(n=this.styleData)==null?void 0:n.x_axis)==null?void 0:i.name)||"",axisLabel:{...c4((a=this.styleData)==null?void 0:a.x_axis),formatter:m=>{var x,w;const _=this.formatDate(m);return((w=(x=this.styleData)==null?void 0:x.x_axis)==null?void 0:w.overflow)==="ellipsis"&&_.length>10?`${_.slice(0,10)}...`:_}}},yAxis:{data:t!=null&&t.length?t:null,type:t?"category":"value",name:((s=(o=this.styleData)==null?void 0:o.y_axis)==null?void 0:s.name)||"",axisLabel:c4((l=this.styleData)==null?void 0:l.y_axis)},series:r!=null&&r.length?r:null,...sh(this.styleData),grid:{bottom:"0%",right:"0%",left:"0%",top:"20px",containLabel:!0,...((c=this.styleData)==null?void 0:c.grid)||{}}};await f.setOption(g),f.resize(),this.widgetInstance=f,this.$emit("update:currentWidget",f)}catch(d){console.error(d)}},async setSeriesOption(r,e){const t=r.getOption(),{series:n=[]}=t,i=n.map(a=>({...a,...e}));r.setOption({...t,series:i})},async changeOptionsByName(r,e){const t=document.getElementById(r);if(!t)return null;const n=xS(t);if(!n)return null;const i=n.getOption();e.seriesOptions&&this.setSeriesOption(n,e.seriesOptions),n.setOption({...i,...e.options,tooltip:{...Rce.getTooltipOptions(e.options.tooltip.show)}})},async changeData(r){var e;try{let t=this.dashboard?`${this.prefix||""}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`:`${this.prefix||""}/bi-data?&widget=${this.widget}`;(e=r==null?void 0:r.granularity)!=null&&e.length&&(t+=`&granularity=${r.granularity}`),r!=null&&r.metrics&&(t+=`&metrics=${r.metrics}`),this.getDataFromURL(t)}catch(t){console.error(t)}},async setFilter(r){const e=`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${r||""}`;await this.getDataFromURL(e)},async changeStyle(r,e){this.styleData[r]=e,this.onChangedData()},getMetricValue(r){var n;const e=(r==null?void 0:r.metric)||r;return parseFloat(e)?(n=En(e,{notation:"standard"}))==null?void 0:n.replaceAll(","," "):e}}},ur=(r,e)=>{const t=r.__vccOpts||r;for(const[n,i]of e)t[n]=i;return t},zce={name:"VsBar",mixins:[Ea],data(){return{resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var e;this.getData(),this.onChangedData();const r=(e=this.$refs)==null?void 0:e.chart;r&&(this.resizeObserver=new ResizeObserver(()=>{var t;this.widgetInstance&&((t=this.widgetInstance)==null||t.resize())}),this.resizeObserver.observe(r))},unmounted(){this.resizeObserver.disconnect()},methods:{async onChangedData(){try{if(this.sourceData){await this.$nextTick();const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e,t,n,i,a;try{if(!((r=this.sourceData)!=null&&r.length))return{series:[],xs:[],ys:void 0};const o=Array.from(new Set(this.sourceData.filter(g=>g[this.dimensions[0]]).map(g=>g[this.dimensions[0]])));let s;this.dimensions[0].includes("date")?s=o.map(g=>rs(g)):s=[...o];let l,c;((e=this.styleData)==null?void 0:e.horizontal)===!0?c=[...s]:l=[...s];const d=this.sourceData.filter(g=>parseFloat(g[this.dimensions[1]])&&g[this.dimensions[0]]).map(g=>parseFloat(g[this.dimensions[1]]));let f;return((t=this.styleData)==null?void 0:t.stack)!==!1?f=this.prepareStackData():((n=this.styleData)==null?void 0:n.negative_waterfall)===!0?f=this.prepareNegativeWaterfall():((i=this.styleData)==null?void 0:i.waterfall)===!0?f=this.prepareWaterfallData(d):((a=this.styleData)==null?void 0:a.accumulative)===!0?f=this.prepareAccumulative(d):f=this.dimensions.slice(1).map((m,_)=>({name:m,type:"bar",stack:`a${_}`,data:this.sourceData.filter(x=>parseFloat(x[m])&&m).map(x=>parseFloat(x[m]))})),{series:f,xs:l,ys:c}}catch(o){return console.error(o),{series:[],xs:[],ys:[]}}},prepareWaterfallData(r){let e=r.reduce((a,o)=>a+o,0);const t=[e,...r],n=t.map((a,o)=>{if(o===0)return 0;const s=e-a;return e-=a,s>=0?s:0});return[{type:"bar",stack:"Total",itemStyle:{borderColor:"transparent",color:"transparent"},data:n,tooltip:{show:!1}},{name:this.title?this.title:this.dimensions[0],type:"bar",stack:"Total",data:t}]},prepareStackData(){return this.dimensions.slice(1).map(t=>({name:t,type:"bar",stack:"a",data:this.sourceData.filter(n=>parseFloat(n[t])&&t).map(n=>parseFloat(n[t]))}))},prepareNegativeWaterfall(){const r=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[1]])?0:Number(a[this.dimensions[1]])),e=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[2]])?0:Number(a[this.dimensions[2]]));let t=0;const n=r.map((a,o)=>{const s=t;return t+=Number.isNaN(a)?0:a,o===0&&(t-=Number.isNaN(e[o])?0:e[o]),t-=Number.isNaN(e[o+1])?0:e[o+1],s>=0?s:0});return[{type:"bar",stack:"a",itemStyle:{borderColor:"transparent",color:"transparent"},data:n,tooltip:{show:!1}},{name:this.dimensions[1],type:"bar",stack:"a",data:r},{name:this.dimensions[2],type:"bar",stack:"a",data:e}]},prepareAccumulative(r){let e=0;const t=r.map(i=>(e+=i,e));return[{name:this.titleCharts,type:"bar",stack:"Total",data:t}]}}},Bce=["id"];function Vce(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full w-full min-h-[200px]"},null,8,Bce)}const q0=ur(zce,[["render",Vce]]),Fce=Object.freeze(Object.defineProperty({__proto__:null,default:q0},Symbol.toStringTag,{value:"Module"})),$ce={name:"VsPie",props:["currentWidget"],mixins:[Ea],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var t;await this.$nextTick(),await this.getData();const{series:r}=this.prepareData()||{};r&&this.initChart(r);const e=(t=this.$refs)==null?void 0:t.chart;e&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(e))},unmounted(){var r;(r=this.resizeObserver)==null||r.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&this.initChart(r,e,t)}}catch(r){console.error(r)}},buildTooltipForDonut(r,e){const{name:t,value:n,percent:i}=r;return`
|
|
98
98
|
<div style="background-color:${e[0]}; font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#ffff; padding:5px; border-radius:5px;">
|
|
99
99
|
${t==null?void 0:t.replace("null","Не визначено")}: ${En(n)} (${i}%)
|
|
100
|
-
</div>`},prepareData(){var r,e,t;try{const n=Array.from(new Set(this.sourceData.map(f=>f[this.dimensions[0]]))),i=Array.from(new Set(this.sourceData.map(f=>f[this.dimensions[1]]))),a=parseInt(this.sourceData.reduce((f,g)=>f+parseFloat(g==null?void 0:g.metric),0),10),o=n.map((f,g)=>{const m=(i[g]/a*100).toFixed(2);return{name:`${f} (${m}%)`,value:i[g]}}),s=((r=this.styleData)==null?void 0:r.innerRadius)||"0%",l=((e=this.styleData)==null?void 0:e.outerRadius)||"100%",c=[s,l];return this.styleData.legend=W0.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:f=>f==null?void 0:f.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...this.styleData.legend}),this.styleData.label=W0.getLabelOptions(this.styleData.label),this.styleData.show_legend=((t=this.styleData)==null?void 0:t.show_legend)||!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:c,center:["50%","60%"],height:"75%",...sh(this.styleData),data:o}]}}catch(n){return console.error(n),null}},async initChart(r){try{const e=this.$refs.chart;this.chartInstance=b_(e);const t={tooltip:{trigger:"item",formatter:n=>this.buildTooltipForDonut(n,[n.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:r,...sh({...this.styleData})};this.chartInstance.setOption(t),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{this.chartInstance.resize()})}catch(e){console.error(e)}}}},Gce=["id"];function Uce(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Gce)}const eC=ur($ce,[["render",Uce]]),Hce=Object.freeze(Object.defineProperty({__proto__:null,default:eC},Symbol.toStringTag,{value:"Module"})),Wce={name:"VsLine",mixins:[Ea],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:r,xs:e}=this.prepareData();r&&this.initChart(r,e)},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e;try{const t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]])));let n;this.dimensions[0].includes("date")?n=t.map(o=>rs(o)):n=[...t];const i=this.sourceData.map(o=>parseFloat(o[this.dimensions[1]]));let a;return(r=this.styleData)!=null&&r.stack?a=this.dimensions.slice(1).map(s=>({name:s,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(l=>parseFloat(l[s])).map(l=>parseFloat(l[s]))})):a=[{name:this.title,type:"line",areaStyle:(e=this.styleData)!=null&&e.area?{}:null,data:i,stack:"a"}],{series:a,xs:n}}catch(t){return console.error(t),null}}}},qce=["id"];function Zce(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",{id:i.uniqueID,ref:"chart",style:{height:"400px"}},null,8,qce)}const tC=ur(Wce,[["render",Zce]]),jce=Object.freeze(Object.defineProperty({__proto__:null,default:tC},Symbol.toStringTag,{value:"Module"})),Xce={name:"VsStat",mixins:[Ea],data(){return{restDimensions:[],sumValue:0,columns:null,showTooltip:-1}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){this.columns=Object.keys(this.sourceData[0]);const r=this.getValues();this.sumValue=r.reduce((e,t)=>e+t,0),this.sourceData.forEach((e,t)=>{e.color=t<u4.length-1?u4[t]:Oce()})},formattedValue(r){const e=parseFloat(r);return En(e)}}},Yce={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},Kce={class:"flex flex-col justify-between w-full h-full"},Jce={class:"w-full h-full pb-6 space-y-4"},Qce={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},eue=["onMouseover"],tue={key:0,class:"absolute top-[-1] left-1/2 transform -translate-x-1/2 -translate-y-full bg-black text-white rounded px-2 py-1"},rue={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},nue={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},iue={class:"flex items-center"},aue={class:"text-sm text-gray-800"},oue={class:"text-end"},sue={class:"text-sm text-gray-500"};function lue(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",Yce,[P.createElementVNode("div",Kce,[P.createElementVNode("div",Jce,[P.createElementVNode("div",Qce,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>{var l,c,d,f;return P.openBlock(),P.createElementBlock("div",{class:P.normalizeClass(["flex flex-col min-w-[5px] justify-center min-h-2.5 h-2.5 text-xs text-white text-center whitespace-nowrap",`bg-[${o.color}]`]),style:P.normalizeStyle({width:`${parseFloat(o==null?void 0:o[(l=i.columns)==null?void 0:l[1]])/i.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:g=>i.showTooltip=s,onMouseleave:e[0]||(e[0]=g=>i.showTooltip=-1)},[i.showTooltip>-1?(P.openBlock(),P.createElementBlock("div",tue,P.toDisplayString(r.sourceData[i.showTooltip][i.columns[0]])+" "+P.toDisplayString((parseFloat((f=(c=r.sourceData)==null?void 0:c[i.showTooltip])==null?void 0:f[(d=i.columns)==null?void 0:d[1]])/i.sumValue*100).toFixed(2))+"% ",1)):P.createCommentVNode("",!0)],46,eue)}),256))]),P.createElementVNode("ul",rue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,o=>{var s,l;return P.openBlock(),P.createElementBlock("li",nue,[P.createElementVNode("div",iue,[P.createElementVNode("span",{class:P.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${o.color}]`])},null,2),P.createElementVNode("span",aue,P.toDisplayString((o==null?void 0:o[(s=i.columns)==null?void 0:s[0]])||"Не визначено"),1)]),P.createElementVNode("div",oue,[P.createElementVNode("span",sue,P.toDisplayString(a.formattedValue(o==null?void 0:o[(l=i.columns)==null?void 0:l[1]])||"-"),1)])])}),256))])])])])}const rC=ur(Xce,[["render",lue]]),cue=Object.freeze(Object.defineProperty({__proto__:null,default:rC},Symbol.toStringTag,{value:"Module"})),uue={name:"VsProgressBar",mixins:[Ea],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var e;this.columns=Object.keys((e=this.sourceData)==null?void 0:e[0])||null;const r=this.getValues();this.maxValue=Math.max(...r)},formattedValue(r){return En(r)}}},hue={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},due={class:"h-full pt-0 pb-6 space-y-4"},fue={class:"h-full space-y-4 custom-scrollbar"},pue={class:"flex items-center justify-between mr-2 gap-x-2"},gue={class:"grid items-center w-full grid-cols-2 gap-x-2"},vue={class:"text-sm text-gray-800"},mue={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},yue={class:"min-w-[60px] text-end"},_ue={class:"text-sm text-gray-500"};function bue(r,e,t,n,i,a){return i.columns?(P.openBlock(),P.createElementBlock("div",hue,[P.createElementVNode("div",due,[P.createElementVNode("ul",fue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>(P.openBlock(),P.createElementBlock("li",pue,[P.createElementVNode("div",gue,[P.createElementVNode("span",vue,P.toDisplayString(o[i.columns[0]]),1),P.createElementVNode("div",mue,[P.createElementVNode("div",{class:"h-1.5 flex flex-col justify-center overflow-hidden bg-indigo-500 rounded-full text-xs text-white text-center whitespace-nowrap",style:P.normalizeStyle({width:`${parseFloat(o[i.columns[1]])/i.maxValue*100}%`})},null,4)])]),P.createElementVNode("div",yue,[P.createElementVNode("span",_ue,P.toDisplayString(a.formattedValue(o[i.columns[1]])),1)])]))),256))])])])):P.createCommentVNode("",!0)}const nC=ur(uue,[["render",bue]]),xue=Object.freeze(Object.defineProperty({__proto__:null,default:nC},Symbol.toStringTag,{value:"Module"})),wue={name:"VsListbar",mixins:[Ea],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(r){console.error(r)}},prepareData(){var e,t,n;this.columns=Object.keys(((e=this.sourceData)==null?void 0:e[0])||{});const r=(t=this.sourceData)==null?void 0:t.map(i=>{var a;return i==null?void 0:i[(a=this.columns)==null?void 0:a[1]]});this.maxValue=Math.max(...r||[]),this.restDimensions=(n=this.columns)==null?void 0:n.filter((i,a)=>a!==0)},formattedValue(r){return En(r)},getWidth(r){return`${r/this.maxValue*100}%`}}},Sue={class:"h-full pt-[20px] list-bar"},Tue={class:"space-y-2 custom-scrollbar h-full h-[calc(100%-20px)]"},Eue={class:"relative w-full truncate"},Cue={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},Aue={class:"text-[14px] text-gray-500"};function Due(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",Sue,[P.createElementVNode("ul",Tue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>{var l,c,d;return P.openBlock(),P.createElementBlock("li",{key:s,class:"flex items-center justify-between w-full gap-x-2"},[P.createElementVNode("div",Eue,[P.createElementVNode("span",Cue,P.toDisplayString((o==null?void 0:o[(l=i.columns)==null?void 0:l[0]])||"Без категорії"),1),P.createElementVNode("div",{class:P.normalizeClass(["absolute inset-y-0 h-full rounded start-0",o!=null&&o[(c=i.columns)==null?void 0:c[0]]?"bg-indigo-100":"bg-gray-100"]),style:P.normalizeStyle({width:a.getWidth(o==null?void 0:o[(d=i.columns)==null?void 0:d[1]])})},null,6)]),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.restDimensions,(f,g)=>(P.openBlock(),P.createElementBlock("div",{key:g,class:"w-20 mr-2 text-end"},[P.createElementVNode("span",Aue,P.toDisplayString(a.formattedValue(o==null?void 0:o[f])),1)]))),128))])}),128))])])}const iC=ur(wue,[["render",Due]]),Mue=Object.freeze(Object.defineProperty({__proto__:null,default:iC},Symbol.toStringTag,{value:"Module"})),aC={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},Iue=["onClick"],kue={class:"flex items-center justify-between w-full"},Lue={key:0},Pue={__name:"vs-bi-dropdown",props:{title:String,options:[Array,String],value:{type:String}},emits:["selected"],setup(r,{emit:e}){const t=r,n=e,i=P.ref(!1),a=P.ref(t.value||null),o=P.ref(null),s=P.computed(()=>typeof t.options=="string"?t.options.split(",").map((m,_)=>({id:_,text:m.trim()})):t.options),l=P.computed(()=>{const m=s.value.find(_=>(_.id||_)===a.value);return m?m.text||m:t.title}),c=m=>{a.value=m.id||m,i.value=!1,n("selected",(m==null?void 0:m.id)||m),document.removeEventListener("click",d)},d=m=>{o.value&&!o.value.contains(m.target)&&(i.value=!1,document.removeEventListener("click",d))},f=()=>{i.value=!i.value,i.value?setTimeout(()=>{document.addEventListener("click",d)},200):document.removeEventListener("click",d)},g=m=>(aC==null?void 0:aC[m])||m;return P.onUnmounted(()=>{document.removeEventListener("click",d)}),(m,_)=>(P.openBlock(),P.createElementBlock(P.Fragment,null,[P.createElementVNode("button",{type:"button","aria-expanded":"true",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative group pr-2 -ms-2 py-1.5 pl-2.5 inline-flex shrink-0 justify-center items-center gap-x-1.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 before:absolute before:inset-0 before:z-[1] dark:text-neutral-400 dark:hover:bg-neutral-800 dark:focus:bg-neutral-700",onClick:f},[P.createTextVNode(P.toDisplayString(g(l.value))+" ",1),_[0]||(_[0]=P.createElementVNode("svg",{class:"shrink-0 size-3.5 text-gray-600 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),i.value?(P.openBlock(),P.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:o,"data-hs-select-dropdown":"",class:"absolute mt-2 z-50 w-48 p-1 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-950 opened",role:"listbox",tabindex:"-1","aria-orientation":"vertical",style:{"margin-top":"10px"}},[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(s.value,x=>(P.openBlock(),P.createElementBlock("div",{key:x.id||x,class:"cursor-pointer selected hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-800 py-1.5 px-2 w-full text-[13px] text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:w=>c(x)},[P.createElementVNode("div",kue,[P.createElementVNode("span",null,P.toDisplayString(g(x.text||x)),1),a.value===(x.id||x)?(P.openBlock(),P.createElementBlock("span",Lue,_[1]||(_[1]=[P.createElementVNode("svg",{class:"shrink-0 h-3.5 w-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):P.createCommentVNode("",!0)])],8,Iue))),128))],512)):P.createCommentVNode("",!0)],64))}},Rue={"bi-bar":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Fce)),"bi-number":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Qge)),"bi-text":P.defineAsyncComponent(()=>Promise.resolve().then(()=>ive)),"bi-listbar":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Mue)),"bi-pie":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Hce)),"bi-donut":P.defineAsyncComponent(()=>Promise.resolve().then(()=>lve)),"bi-line":P.defineAsyncComponent(()=>Promise.resolve().then(()=>jce)),"bi-stat":P.defineAsyncComponent(()=>Promise.resolve().then(()=>cue)),"bi-pivot":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Ghe)),"bi-progress":P.defineAsyncComponent(()=>Promise.resolve().then(()=>xue)),"bi-funnel":P.defineAsyncComponent(()=>Promise.resolve().then(()=>dve)),"bi-map":P.defineAsyncComponent(()=>Promise.resolve().then(()=>fme)),"bi-cluster":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Ome)),"bi-table":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Xme))},Nue={class:"flex items-center space-x-2"},Oue=P.defineComponent({__name:"vs-bi-switch",props:P.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:P.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(r,{emit:e}){const t=e,n=P.useModel(r,"modelValue"),i=()=>{t("update:is-enabled",n)};return(a,o)=>(P.openBlock(),P.createElementBlock("div",Nue,[a.leftLabel?(P.openBlock(),P.createElementBlock("div",{key:0,class:P.normalizeClass(["transition-colors",{"text-blue-500":!n.value}])},P.toDisplayString(a.leftLabel),3)):P.createCommentVNode("",!0),P.withDirectives(P.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>n.value=s),type:"checkbox",class:"relative w-11 h-6 p-px bg-gray-100 border-transparent text-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:ring-blue-600 disabled:opacity-50 disabled:pointer-events-none checked:bg-none checked:text-blue-600 checked:border-blue-600 focus:checked:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-600 before:inline-block before:size-5 before:bg-white checked:before:bg-blue-200 before:translate-x-0 checked:before:translate-x-full before:rounded-full before:shadow before:h-5 before:w-5 before:transform before:ring-0 before:transition before:ease-in-out before:duration-200 dark:before:bg-neutral-400 dark:checked:before:bg-blue-200",onChange:i},null,544),[[P.vModelCheckbox,n.value]]),a.rightLabel?(P.openBlock(),P.createElementBlock("div",{key:1,class:P.normalizeClass(["transition-colors",{"text-blue-500":n.value}])},P.toDisplayString(a.rightLabel),3)):P.createCommentVNode("",!0)]))}}),zue={},Bue={class:"flex items-center justify-center h-full"};function Vue(r,e){return P.openBlock(),P.createElementBlock("div",Bue,e[0]||(e[0]=[P.createElementVNode("div",{class:"text-center text-gray-500"},[P.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Fue=ur(zue,[["render",Vue]]),$ue={},Gue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Uue(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("svg",Gue,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),P.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),P.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Hue={components:{VsBiDropdown:Pue,VsBiSwitch:Oue,VsNoDataChart:Fue,IconDownload:ur($ue,[["render",Uue]]),...Rue},props:{dashboard:{type:String},prefix:{type:String,default:""},widget:{type:String},filterURl:{type:String},dashboardWidgets:{type:Object},selectedWidget:{type:String}},data(){return{checked:[],selected:[],currentWidget:null,widgetData:[]}},computed:{computedTitle(){var e,t;const r=(e=this.dashboardWidgets)==null?void 0:e.find(n=>n.name===this.widget);return((t=r==null?void 0:r.data)==null?void 0:t.title)||(r==null?void 0:r.title)||""},computedType(){var e;const r=(e=this.dashboardWidgets)==null?void 0:e.find(t=>t.name===this.widget);return(r==null?void 0:r.type)||"text"},controls(){var e;return Object.keys(((e=this.widgetData)==null?void 0:e.controls)||{}).map(t=>{var n,i,a;return{name:t,options:typeof((n=this.widgetData)==null?void 0:n.controls)=="boolean"?!1:(a=(i=this.widgetData)==null?void 0:i.controls)==null?void 0:a[t]}})}},mounted(){this.prefix&&(yr.defaults.baseURL=this.prefix)},watch:{filterURl(r){var e,t;(t=(e=this.$refs)==null?void 0:e.chart)==null||t.setFilter(r)},selectedWidget(r,e){var t;r!==e&&r===((t=this.widgetData)==null?void 0:t.id)&&this.$emit("update:current-widget-data",this.widgetData)},widgetData(r,e){if((r==null?void 0:r.id)===(e==null?void 0:e.id))return;const n=new URLSearchParams(window.top.location.search).get("widget");n&&n===(r==null?void 0:r.id)&&this.$emit("update:current-widget-data",r)}},methods:{changeStyleHandler(r,e){var t;(t=this.$refs.chart)==null||t.changeStyle(r,e)},selectedOptionHandler(r,e){let t=!0;this.selected.forEach(n=>{n.name===e&&(n.option=r,t=!1)}),t&&this.selected.push({name:e,option:r}),this.makeUpUrl()},makeUpUrl(){var e;let r=`/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`;this.selected.forEach((t,n)=>{r+=`&${t.name}=${t.option}`}),(e=this.$refs.chart)==null||e.getDataFromURL(r)},exportChart(){if(this.currentWidget){const r=this.currentWidget.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),e=document.createElement("a");e.href=r,e.download="chart.png",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}}},Wue={key:0,class:"text-[16px] flex max-w-full items-center min-h-0 flex justify-between max-h-[50px] h-fit shrink-0"},que={class:"flex items-center justify-between w-full"},Zue={class:"grid"},jue={class:"text-gray-800 max-h-[30px] inline-block text-nowrap font-semibold"},Xue={class:"flex flex-col justify-end"},Yue={key:0,class:"flex items-center justify-end w-full gap-2"},Kue={class:"w-full h-full"};function Jue(r,e,t,n,i,a){var d,f,g,m,_,x,w,C,M;const o=P.resolveComponent("VsBiDropdown"),s=P.resolveComponent("VsBiSwitch"),l=P.resolveComponent("IconDownload"),c=P.resolveComponent("VsNoDataChart");return P.openBlock(),P.createElementBlock("div",{ref:"widget",class:P.normalizeClass(["box-border relative h-full p-4 bg-white border border-gray-200 select-auto rounded-xl",[(f=(d=i.widgetData)==null?void 0:d.style)!=null&&f.height?`max-h-[${(m=(g=i.widgetData)==null?void 0:g.style)==null?void 0:m.height}px] h-[${(x=(_=i.widgetData)==null?void 0:_.style)==null?void 0:x.height}px]`:"max-h-[460px]"]])},[["text","cluster"].includes(a.computedType)?P.createCommentVNode("",!0):(P.openBlock(),P.createElementBlock("div",Wue,[P.createElementVNode("div",que,[P.createElementVNode("div",Zue,[P.createElementVNode("span",jue,P.toDisplayString(a.computedTitle),1)]),P.createElementVNode("div",Xue,[(w=a.controls)!=null&&w.length?(P.openBlock(),P.createElementBlock("span",Yue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList((C=a.controls)==null?void 0:C.filter(L=>(L==null?void 0:L.options)&&(L==null?void 0:L.name)!=="export"),L=>{var O;return P.openBlock(),P.createElementBlock("div",null,[Array.isArray(L==null?void 0:L.options)?(P.openBlock(),P.createBlock(o,{key:0,title:L==null?void 0:L.name,options:L==null?void 0:L.options,value:(O=i.widgetData)==null?void 0:O.data[L==null?void 0:L.name],onSelected:F=>a.selectedOptionHandler(F,L==null?void 0:L.name)},null,8,["title","options","value","onSelected"])):typeof L.options=="boolean"?(P.openBlock(),P.createBlock(s,{key:1,"left-label":L==null?void 0:L.name,"is-enabled":L==null?void 0:L.options,"onUpdate:isEnabled":F=>a.changeStyleHandler(L==null?void 0:L.name,F)},null,8,["left-label","is-enabled","onUpdate:isEnabled"])):P.createCommentVNode("",!0)])}),256)),(M=a.controls)!=null&&M.some(L=>(L==null?void 0:L.name)==="export")?(P.openBlock(),P.createElementBlock("button",{key:0,onClick:e[0]||(e[0]=(...L)=>a.exportChart&&a.exportChart(...L)),class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center"},[P.createVNode(l,{height:"16",width:"16",class:"text-gray-800"})])):P.createCommentVNode("",!0)])):P.createCommentVNode("",!0)])])])),P.createElementVNode("div",Kue,[i.widgetData?(P.openBlock(),P.createBlock(P.resolveDynamicComponent("bi-"+a.computedType),{key:0,currentWidget:i.currentWidget,"onUpdate:currentWidget":e[1]||(e[1]=L=>i.currentWidget=L),widgetData:i.widgetData,"onUpdate:widgetData":e[2]||(e[2]=L=>i.widgetData=L),ref:"chart",dashboard:t.dashboard,title:a.computedTitle,widget:t.widget},null,40,["currentWidget","widgetData","dashboard","title","widget"])):(P.openBlock(),P.createBlock(c,{key:1,class:"w-full h-full"}))])],2)}const ev=ur(Hue,[["render",Jue]]),Que={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},ehe={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},the={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},rhe={class:"max-w-sm mx-auto mt-6"},nhe={class:"font-medium text-gray-800 dark:text-neutral-200"},ihe={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function ahe(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",ehe,[P.createElementVNode("div",null,[P.createElementVNode("div",the,[e[0]||(e[0]=P.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),P.createElementVNode("div",rhe,[P.createElementVNode("p",nhe,P.toDisplayString(t.title),1),P.createElementVNode("p",ihe,P.toDisplayString(t.text),1)])])])])}const Z0=ur(Que,[["render",ahe]]),ohe={},she={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function lhe(r,e){return P.openBlock(),P.createElementBlock("svg",she,e[0]||(e[0]=[P.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const che=ur(ohe,[["render",lhe]]),uhe={},hhe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-refresh"};function dhe(r,e){return P.openBlock(),P.createElementBlock("svg",hhe,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},null,-1),P.createElementVNode("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1)]))}const fhe={components:{filterIcon:che,refreshIcon:ur(uhe,[["render",dhe]])},props:["filterScheme"],emits:["filters:changed"],data(){return{rows:[],isFilterVisible:!1,rowList:[],activeFilters:"",filters:{}}},async mounted(){const e=await(await new URLSearchParams(window.top.location.search)).get("filter");this.filters.url=e||""},computed:{activeFiltersCount(){var r,e;return(r=this.filters)!=null&&r.url?((e=this.filters)==null?void 0:e.url.split("=").length)-1:0}},methods:{toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},handleFilterChange(r){var e,t;this.filters=r,this.activeFilters=(t=(e=this.$refs)==null?void 0:e.filter)==null?void 0:t.activeFilters,this.$emit("filters:changed",this.filters)},resetFilters(){this.$refs.filter&&this.$refs.filter.clearAll(),this.isFilterVisible=!1,this.$emit("filters:changed",""),this.activeFilters=null},closeFilter({target:r}){this.isFilterVisible&&r.classList.contains("filter-container")&&(this.isFilterVisible=!1)}}},phe={class:"flex items-center"},ghe={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"};function vhe(r,e,t,n,i,a){const o=P.resolveComponent("filterIcon"),s=P.resolveComponent("VsFilterList");return P.openBlock(),P.createElementBlock("div",phe,[t.filterScheme?(P.openBlock(),P.createBlock(s,{key:0,ref:"filter",scheme:t.filterScheme,closeFilterBtn:!0,onFilterClose:e[1]||(e[1]=l=>i.isFilterVisible=!1),layout:"default","apply-vue-router":"",history:"",view:"plain",token:r.table,name:"filter",footer:!0,background:!0,onFilterChange:a.handleFilterChange},{button:P.withCtx(()=>[P.createElementVNode("button",{type:"button",class:"py-2 px-2.5 ml-3 h-[38px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[0]||(e[0]=(...l)=>a.toggleFilterShown&&a.toggleFilterShown(...l))},[P.createVNode(o),e[2]||(e[2]=P.createTextVNode(" Фільтри ")),a.activeFiltersCount>=1?(P.openBlock(),P.createElementBlock("span",ghe,P.toDisplayString(a.activeFiltersCount),1)):P.createCommentVNode("",!0)])]),_:1},8,["scheme","token","onFilterChange"])):P.createCommentVNode("",!0)])}const mhe={props:["dashboardData","filters"],components:{VsFilterHeader:ur(fhe,[["render",vhe]])}},yhe={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 mt-2 rounded-xl mb-2 pt-[3px] justify-between items-center"},_he={class:"grow"},bhe={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},xhe={type:"button",class:"inline-flex items-center text-sm gap-x-2 text-stone-800 hover:text-stone-500 focus:outline-none focus:text-stone-500 dark:text-neutral-200 dark:hover:text-neutral-400 dark:focus:text-neutral-400","data-clipboard-target":"#hs-erc","data-clipboard-action":"copy","data-clipboard-success-text":"Copied"};function whe(r,e,t,n,i,a){var s,l;const o=P.resolveComponent("VsFilterHeader");return P.openBlock(),P.createElementBlock("div",yhe,[P.createElementVNode("div",_he,[P.createElementVNode("h1",bhe,P.toDisplayString((s=t.dashboardData)==null?void 0:s.title),1),P.createElementVNode("button",xhe,P.toDisplayString((l=t.dashboardData)==null?void 0:l.description),1)]),P.createVNode(o,{filterScheme:t.filters,"onFilters:changed":e[0]||(e[0]=c=>r.$emit("filters:changed",c))},null,8,["filterScheme"])])}const She={components:{VsWidget:ev,VsNewNodata:Z0,VsHeader:ur(mhe,[["render",whe]])},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){yr.defaults.baseURL=this.prefix||"/api",await this.fetchData()},methods:{async fetchData(){if(this.id)try{const{data:r}=await yr.get(`/bi-dashboard/${this.id}`);this.dashboardData=r}catch(r){console.error(r)}},columnClass(r){const e=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[e]||"w-full"},async filterHandler(r){var t;this.filterURl="";let e="&filter=";(t=r==null?void 0:r.url)!=null&&t.length&&(r.url.split("|").forEach(i=>{const a=i.split("=");e+=`${a[0]}=${a[1]}`}),this.filterURl+=e)}}},The={class:"w-full pb-8 overflow-y-auto"},Ehe={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function Che(r,e,t,n,i,a){var c,d,f;const o=P.resolveComponent("VsHeader"),s=P.resolveComponent("VsNewNodata"),l=P.resolveComponent("VsWidget");return P.openBlock(),P.createElementBlock("div",The,[P.createElementVNode("div",null,[(c=i.dashboardData)!=null&&c.filters?(P.openBlock(),P.createBlock(o,{key:0,filters:(d=i.dashboardData)==null?void 0:d.filters,dashboardData:i.dashboardData,"onFilters:changed":e[0]||(e[0]=g=>a.filterHandler(g))},null,8,["filters","dashboardData"])):P.createCommentVNode("",!0)]),P.createElementVNode("div",Ehe,[i.error||!i.dashboardData?(P.openBlock(),P.createBlock(s,{key:0,class:"col-span-12"})):P.createCommentVNode("",!0),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(((f=i.dashboardData)==null?void 0:f.panels)||[],(g,m)=>{var _;return P.openBlock(),P.createElementBlock("div",{key:m,class:P.normalizeClass([`col-span-${g.col||12}`,"flex flex-col gap-[10px]"])},[(_=g.widgets)!=null&&_.length?(P.openBlock(!0),P.createElementBlock(P.Fragment,{key:0},P.renderList(g.widgets,x=>(P.openBlock(),P.createBlock(l,{key:x,dashboard:t.id,widget:x,"dashboard-widgets":i.dashboardData.widgets,"filter-u-rl":i.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(P.openBlock(),P.createBlock(l,{key:1,class:"flex flex-col",dashboard:t.id,widget:g.widget,"dashboard-widgets":i.dashboardData.widgets,"filter-u-rl":i.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const oC=ur(She,[["render",Che]]),Ahe={name:"VsPivotTable",mixins:[Ea],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>rs(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(n=>parseFloat(n[e])).map(n=>En(parseFloat(n[e])))}))}catch(r){console.error(r)}}}},Dhe={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},Mhe={class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 custom-scrollbar"},Ihe={class:"inline-block min-w-full align-middle"},khe={class:"min-w-full divide-y divide-gray-200"},Lhe={class:"space-x-2"},Phe={scope:"col",class:"xl:min-w-[120px] min-w-48"},Rhe={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Nhe={class:"divide-y divide-gray-200 text-[12px]"},Ohe={class:"py-3 size-px whitespace-nowrap"},zhe={class:"flex items-center gap-x-3"},Bhe={class:"font-medium text-gray-800"},Vhe={class:"py-3 size-px whitespace-nowrap"},Fhe={class:"text-gray-600"};function $he(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",Dhe,[P.createElementVNode("div",Mhe,[P.createElementVNode("div",Ihe,[P.createElementVNode("table",khe,[P.createElementVNode("thead",null,[P.createElementVNode("tr",Lhe,[e[0]||(e[0]=P.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[P.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.xs,o=>(P.openBlock(),P.createElementBlock("th",Phe,[P.createElementVNode("div",Rhe,P.toDisplayString(o),1)]))),256))])]),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.values,o=>(P.openBlock(),P.createElementBlock("tbody",Nhe,[P.createElementVNode("tr",null,[P.createElementVNode("td",Ohe,[P.createElementVNode("div",zhe,[P.createElementVNode("span",Bhe,P.toDisplayString(o.name),1)])]),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.xs,(s,l)=>(P.openBlock(),P.createElementBlock("td",Vhe,[P.createElementVNode("span",Fhe,P.toDisplayString(o.data[l]),1)]))),256))])]))),256))])])])])}const sC=ur(Ahe,[["render",$he]]),Ghe=Object.freeze(Object.defineProperty({__proto__:null,default:sC},Symbol.toStringTag,{value:"Module"})),Uhe={},Hhe={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Whe(r,e){return P.openBlock(),P.createElementBlock("svg",Hhe,e[0]||(e[0]=[P.createElementVNode("path",{d:"M3.3335 8H12.6668",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),P.createElementVNode("path",{d:"M8 3.33325V12.6666",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const qhe=ur(Uhe,[["render",Whe]]),Zhe={},jhe={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"mr-3"};function Xhe(r,e){return P.openBlock(),P.createElementBlock("svg",jhe,e[0]||(e[0]=[P.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),P.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.7417",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const h4=ur(Zhe,[["render",Xhe]]),Yhe={},Khe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Jhe(r,e){return P.openBlock(),P.createElementBlock("svg",Khe,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),P.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),P.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Qhe=ur(Yhe,[["render",Jhe]]),ede={},tde={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-lock"};function rde(r,e){return P.openBlock(),P.createElementBlock("svg",tde,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"},null,-1),P.createElementVNode("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"},null,-1),P.createElementVNode("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"},null,-1)]))}const nde=ur(ede,[["render",rde]]),ide=[{type:"Text",key:"name",label:"Назва",validators:["required"],original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"title",label:"Заголовок",validators:["required"],original:{type:"Text",ua:"Титул",col:8}},{type:"Text",key:"description",label:"Опис",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"words",label:"Ключові слова",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],ade={components:{plusIcon:qhe,searchIcon:h4,IconLock:nde,IconImport:Qhe},props:["selectedDashboard","prefix"],emits:["update:selectedDashboard","add","update"],mounted(){yr.defaults.baseURL=this.prefix||"/api",this.getFileItems(),this.getList()},data(){return{searchQuery:"",scheme:null,formValues:{},formCreateValues:{},isVisible:!1,isVisibleFormDashboard:!1,fileItems:null,list:null,addDashboardForm:ide}},methods:{async getFileItems(){var r;try{const{data:e}=await yr.get("/bi-dashboard?type=file");this.scheme={dashboard:{type:"Checkbox",ua:"Дашборди",options:(r=e==null?void 0:e.rows)==null?void 0:r.map(({name:t,title:n})=>({id:t,text:n}))}}}catch{}},async getList(){try{const{data:r}=await yr.get("/bi-dashboard?type=db");this.list=r.rows.filter(e=>e.type==="db")}catch(r){console.error(r)}},async dashboardImport(){try{await yr.get(`/bi-dashboard-import?dashboard=${this.formValues.dashboard}`),this.isVisible=!1,this.formValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд імпортовано успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі імпортувати дашборд виникла помилка"})}},async createDashboard(){try{await this.$refs.form.doValidation(),await yr.post("/bi-dashboard",this.formCreateValues),this.isVisibleFormDashboard=!1,this.formCreateValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}},computed:{filteredList(){var e;const r=this.searchQuery.toLowerCase();return(e=this.list)==null?void 0:e.filter(t=>(t==null?void 0:t.title)&&(t==null?void 0:t.title.toLowerCase().includes(r))||(t==null?void 0:t.name)&&(t==null?void 0:t.name.toLowerCase().includes(r)))}}},ode={class:"h-full w-[300px] shrink-0 bg-white border-r border-gray-200 flex flex-col"},sde={class:"flex h-[49px] border-b justify-between px-[16px] items-center"},lde={class:"flex items-center gap-2"},cde={class:"flex items-center gap-2 px-[10px] py-2"},ude={class:"relative w-full"},hde={class:"px-[10px] flex flex-col gap-[2px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},dde=["item","onClick"],fde={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},pde={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function gde(r,e,t,n,i,a){const o=P.resolveComponent("IconImport"),s=P.resolveComponent("VsPopover"),l=P.resolveComponent("plusIcon"),c=P.resolveComponent("IconLock"),d=P.resolveComponent("VsForm"),f=P.resolveComponent("VsDialog");return P.openBlock(),P.createElementBlock(P.Fragment,null,[P.createElementVNode("div",ode,[P.createElementVNode("div",sde,[e[13]||(e[13]=P.createElementVNode("div",{class:"text-[20px]"},[P.createTextVNode("Editor "),P.createElementVNode("span",{class:"text-[#666666]"})],-1)),P.createElementVNode("div",lde,[P.createVNode(s,{placement:"left",trigger:"hover"},{reference:P.withCtx(()=>[P.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] text-blue-500 w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[0]||(e[0]=g=>i.isVisible=!0)},[P.createVNode(o,{height:"18",width:"18"})])]),default:P.withCtx(()=>[e[11]||(e[11]=P.createTextVNode(" Імпортувати дашборд "))]),_:1}),P.createVNode(s,{placement:"right",trigger:"hover"},{reference:P.withCtx(()=>[P.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[1]||(e[1]=g=>i.isVisibleFormDashboard=!0)},[P.createVNode(l)])]),default:P.withCtx(()=>[e[12]||(e[12]=P.createTextVNode(" Створити дашборд "))]),_:1})])]),P.createElementVNode("div",cde,[P.createElementVNode("div",ude,[P.withDirectives(P.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=g=>i.searchQuery=g),class:"flex-1 text-[13px] w-full h-[38px] px-3 text-gray-800 rounded-lg !border-none bg-gray-100 placeholder-gray-800 focus:outline-2 focus:outline-blue-600",placeholder:"Пошук..."},null,512),[[P.vModelText,i.searchQuery]])])]),P.createElementVNode("div",hde,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(a.filteredList,(g,m)=>(P.openBlock(),P.createElementBlock("div",{key:m,item:g,class:P.normalizeClass(["flex items-center cursor-pointer hover:bg-[#F3F4F6] py-1.5 px-2 text-[13px] text-gray-800 rounded-lg",{"bg-gray-100 outline-none":g.name===t.selectedDashboard}]),onClick:_=>r.$emit("update:selectedDashboard",g==null?void 0:g.name)},[P.createTextVNode(P.toDisplayString((g==null?void 0:g.title)||(g==null?void 0:g.name))+" ",1),g!=null&&g.public?P.createCommentVNode("",!0):(P.openBlock(),P.createBlock(c,{key:0,height:"12",width:"12",class:"ml-1 shrink-0"}))],10,dde))),128))])]),P.createVNode(f,{visible:i.isVisible,"onUpdate:visible":e[6]||(e[6]=g=>i.isVisible=g),title:"Імпортувати"},{footer:P.withCtx(()=>[P.createElementVNode("div",fde,[P.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[4]||(e[4]=g=>i.isVisible=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),P.createElementVNode("button",{onClick:e[5]||(e[5]=(...g)=>a.dashboardImport&&a.dashboardImport(...g)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Імпортувати ")])]),default:P.withCtx(()=>{var g;return[P.createTextVNode(P.toDisplayString((g=i.fileItems)==null?void 0:g.map(({name:m,title:_})=>({value:m,text:_})))+" ",1),P.createVNode(d,{scheme:i.scheme,modelValue:i.formValues,"onUpdate:modelValue":e[3]||(e[3]=m=>i.formValues=m)},null,8,["scheme","modelValue"])]}),_:1},8,["visible"]),P.createVNode(f,{visible:i.isVisibleFormDashboard,"onUpdate:visible":e[10]||(e[10]=g=>i.isVisibleFormDashboard=g),title:"Створити дашборд"},{footer:P.withCtx(()=>[P.createElementVNode("div",pde,[P.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=g=>i.isVisibleFormDashboard=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),P.createElementVNode("button",{onClick:e[9]||(e[9]=(...g)=>a.createDashboard&&a.createDashboard(...g)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:P.withCtx(()=>[P.createVNode(d,{ref:"form",scheme:i.addDashboardForm,modelValue:i.formCreateValues,"onUpdate:modelValue":e[7]||(e[7]=g=>i.formCreateValues=g)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const vde=ur(ade,[["render",gde]]),mde={},yde={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function _de(r,e){return P.openBlock(),P.createElementBlock("svg",yde,e[0]||(e[0]=[P.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const d4=ur(mde,[["render",_de]]),bde={},xde={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function wde(r,e){return P.openBlock(),P.createElementBlock("svg",xde,e[0]||(e[0]=[P.createElementVNode("path",{d:"M18 6 6 18"},null,-1),P.createElementVNode("path",{d:"m6 6 12 12"},null,-1)]))}const lC=ur(bde,[["render",wde]]),Sde={},Tde={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit"};function Ede(r,e){return P.openBlock(),P.createElementBlock("svg",Tde,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"},null,-1),P.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"},null,-1),P.createElementVNode("path",{d:"M16 5l3 3"},null,-1)]))}const f4=ur(Sde,[["render",Ede]]),Cde={class:"pt-[10px]"},Ade={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(r){var g,m,_,x,w,C;const{$notify:e}=P.getCurrentInstance().proxy,t=r,n=P.ref(null),i={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},a={show:{label:"Legend",type:"switcher",title:"Show legend"}},o={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},s=P.ref({...((m=(g=t.data)==null?void 0:g.style)==null?void 0:m.label)||{}}),l=P.ref({...((x=(_=t.data)==null?void 0:_.style)==null?void 0:x.legend)||{}}),c=P.ref({...((C=(w=t.data)==null?void 0:w.style)==null?void 0:C.tooltip)||{}}),d=()=>{const M=new CustomEvent(`update-style-${t.widgetName}`);M.chartId=t.widgetName,M.options={options:{legend:l.value,tooltip:c.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(M)};P.watch(s,d,{deep:!0}),P.watch(l,d,{deep:!0}),P.watch(c,d,{deep:!0});const f=async()=>{try{await yr.put(`/bi-dashboard/${n.value}/${t.widgetName}`,{style:{legend:l.value,tooltip:c.value,label:s.value}});const M=new CustomEvent(`update-style-${t.widgetName}`);M.chartId=t.widgetName,M.options={options:{legend:l.value,tooltip:c.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(M),await e({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await e({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return P.onMounted(()=>{const M=new URLSearchParams(window.top.location.search);n.value=M.get("dashboard")}),(M,L)=>{const O=P.resolveComponent("VsButton"),F=P.resolveComponent("VsForm");return P.openBlock(),P.createElementBlock("div",Cde,[P.createVNode(O,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:f},{default:P.withCtx(()=>L[3]||(L[3]=[P.createTextVNode(" Зберегти ")])),_:1}),P.createVNode(F,{scheme:i,modelValue:s.value,"onUpdate:modelValue":L[0]||(L[0]=V=>s.value=V),class:"p-0"},null,8,["modelValue"]),P.createVNode(F,{scheme:a,modelValue:l.value,"onUpdate:modelValue":L[1]||(L[1]=V=>l.value=V),class:"p-0"},null,8,["modelValue"]),P.createVNode(F,{scheme:o,modelValue:c.value,"onUpdate:modelValue":L[2]||(L[2]=V=>c.value=V),class:"p-0"},null,8,["modelValue"])])}}};function cC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let lh=cC();function p4(r){lh=r}const g4=/[&<>"']/,Dde=new RegExp(g4.source,"g"),v4=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Mde=new RegExp(v4.source,"g"),Ide={"&":"&","<":"<",">":">",'"':""","'":"'"},m4=r=>Ide[r];function Ga(r,e){if(e){if(g4.test(r))return r.replace(Dde,m4)}else if(v4.test(r))return r.replace(Mde,m4);return r}const kde=/(^|[^\[])\^/g;function hn(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const n={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(kde,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}function y4(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const tv={exec:()=>null};function _4(r,e){const t=r.replace(/\|/g,(a,o,s)=>{let l=!1,c=o;for(;--c>=0&&s[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function rv(r,e,t){const n=r.length;if(n===0)return"";let i=0;for(;i<n;){const a=r.charAt(n-i-1);if(a===e&&!t)i++;else if(a!==e&&t)i++;else break}return r.slice(0,n-i)}function Lde(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return-1}function b4(r,e,t,n){const i=e.href,a=e.title?Ga(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){n.state.inLink=!0;const s={type:"link",raw:t,href:i,title:a,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,s}return{type:"image",raw:t,href:i,title:a,text:Ga(o)}}function Pde(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
100
|
+
</div>`},prepareData(){var r,e,t;try{const n=Array.from(new Set(this.sourceData.map(f=>f[this.dimensions[0]]))),i=Array.from(new Set(this.sourceData.map(f=>f[this.dimensions[1]]))),a=parseInt(this.sourceData.reduce((f,g)=>f+parseFloat(g==null?void 0:g.metric),0),10),o=n.map((f,g)=>{const m=(i[g]/a*100).toFixed(2);return{name:`${f} (${m}%)`,value:i[g]}}),s=((r=this.styleData)==null?void 0:r.innerRadius)||"0%",l=((e=this.styleData)==null?void 0:e.outerRadius)||"100%",c=[s,l];return this.styleData.legend=W0.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:f=>f==null?void 0:f.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...this.styleData.legend}),this.styleData.label=W0.getLabelOptions(this.styleData.label),this.styleData.show_legend=((t=this.styleData)==null?void 0:t.show_legend)||!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:c,center:["50%","60%"],height:"75%",...sh(this.styleData),data:o}]}}catch(n){return console.error(n),null}},async initChart(r){try{const e=this.$refs.chart;this.chartInstance=b_(e);const t={tooltip:{trigger:"item",formatter:n=>this.buildTooltipForDonut(n,[n.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:r,...sh({...this.styleData})};this.chartInstance.setOption(t),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{this.chartInstance.resize()})}catch(e){console.error(e)}}}},Gce=["id"];function Uce(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Gce)}const eC=ur($ce,[["render",Uce]]),Hce=Object.freeze(Object.defineProperty({__proto__:null,default:eC},Symbol.toStringTag,{value:"Module"})),Wce={name:"VsLine",mixins:[Ea],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:r,xs:e}=this.prepareData();r&&this.initChart(r,e)},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e;try{const t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]])));let n;this.dimensions[0].includes("date")?n=t.map(o=>rs(o)):n=[...t];const i=this.sourceData.map(o=>parseFloat(o[this.dimensions[1]]));let a;return(r=this.styleData)!=null&&r.stack?a=this.dimensions.slice(1).map(s=>({name:s,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(l=>parseFloat(l[s])).map(l=>parseFloat(l[s]))})):a=[{name:this.title,type:"line",areaStyle:(e=this.styleData)!=null&&e.area?{}:null,data:i,stack:"a"}],{series:a,xs:n}}catch(t){return console.error(t),null}}}},qce=["id"];function Zce(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",{id:i.uniqueID,ref:"chart",style:{height:"400px"}},null,8,qce)}const tC=ur(Wce,[["render",Zce]]),jce=Object.freeze(Object.defineProperty({__proto__:null,default:tC},Symbol.toStringTag,{value:"Module"})),Xce={name:"VsStat",mixins:[Ea],data(){return{restDimensions:[],sumValue:0,columns:null,showTooltip:-1}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){this.columns=Object.keys(this.sourceData[0]);const r=this.getValues();this.sumValue=r.reduce((e,t)=>e+t,0),this.sourceData.forEach((e,t)=>{e.color=t<u4.length-1?u4[t]:Oce()})},formattedValue(r){const e=parseFloat(r);return En(e)}}},Yce={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},Kce={class:"flex flex-col justify-between w-full h-full"},Jce={class:"w-full h-full pb-6 space-y-4"},Qce={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},eue=["onMouseover"],tue={key:0,class:"absolute top-[-1] left-1/2 transform -translate-x-1/2 -translate-y-full bg-black text-white rounded px-2 py-1"},rue={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},nue={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},iue={class:"flex items-center"},aue={class:"text-sm text-gray-800"},oue={class:"text-end"},sue={class:"text-sm text-gray-500"};function lue(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",Yce,[P.createElementVNode("div",Kce,[P.createElementVNode("div",Jce,[P.createElementVNode("div",Qce,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>{var l,c,d,f;return P.openBlock(),P.createElementBlock("div",{class:P.normalizeClass(["flex flex-col min-w-[5px] justify-center min-h-2.5 h-2.5 text-xs text-white text-center whitespace-nowrap",`bg-[${o.color}]`]),style:P.normalizeStyle({width:`${parseFloat(o==null?void 0:o[(l=i.columns)==null?void 0:l[1]])/i.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:g=>i.showTooltip=s,onMouseleave:e[0]||(e[0]=g=>i.showTooltip=-1)},[i.showTooltip>-1?(P.openBlock(),P.createElementBlock("div",tue,P.toDisplayString(r.sourceData[i.showTooltip][i.columns[0]])+" "+P.toDisplayString((parseFloat((f=(c=r.sourceData)==null?void 0:c[i.showTooltip])==null?void 0:f[(d=i.columns)==null?void 0:d[1]])/i.sumValue*100).toFixed(2))+"% ",1)):P.createCommentVNode("",!0)],46,eue)}),256))]),P.createElementVNode("ul",rue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,o=>{var s,l;return P.openBlock(),P.createElementBlock("li",nue,[P.createElementVNode("div",iue,[P.createElementVNode("span",{class:P.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${o.color}]`])},null,2),P.createElementVNode("span",aue,P.toDisplayString((o==null?void 0:o[(s=i.columns)==null?void 0:s[0]])||"Не визначено"),1)]),P.createElementVNode("div",oue,[P.createElementVNode("span",sue,P.toDisplayString(a.formattedValue(o==null?void 0:o[(l=i.columns)==null?void 0:l[1]])||"-"),1)])])}),256))])])])])}const rC=ur(Xce,[["render",lue]]),cue=Object.freeze(Object.defineProperty({__proto__:null,default:rC},Symbol.toStringTag,{value:"Module"})),uue={name:"VsProgressBar",mixins:[Ea],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var e;this.columns=Object.keys((e=this.sourceData)==null?void 0:e[0])||null;const r=this.getValues();this.maxValue=Math.max(...r)},formattedValue(r){return En(r)}}},hue={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},due={class:"h-full pt-0 pb-6 space-y-4"},fue={class:"h-full space-y-4 custom-scrollbar"},pue={class:"flex items-center justify-between mr-2 gap-x-2"},gue={class:"grid items-center w-full grid-cols-2 gap-x-2"},vue={class:"text-sm text-gray-800"},mue={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},yue={class:"min-w-[60px] text-end"},_ue={class:"text-sm text-gray-500"};function bue(r,e,t,n,i,a){return i.columns?(P.openBlock(),P.createElementBlock("div",hue,[P.createElementVNode("div",due,[P.createElementVNode("ul",fue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>(P.openBlock(),P.createElementBlock("li",pue,[P.createElementVNode("div",gue,[P.createElementVNode("span",vue,P.toDisplayString(o[i.columns[0]]),1),P.createElementVNode("div",mue,[P.createElementVNode("div",{class:"h-1.5 flex flex-col justify-center overflow-hidden bg-indigo-500 rounded-full text-xs text-white text-center whitespace-nowrap",style:P.normalizeStyle({width:`${parseFloat(o[i.columns[1]])/i.maxValue*100}%`})},null,4)])]),P.createElementVNode("div",yue,[P.createElementVNode("span",_ue,P.toDisplayString(a.formattedValue(o[i.columns[1]])),1)])]))),256))])])])):P.createCommentVNode("",!0)}const nC=ur(uue,[["render",bue]]),xue=Object.freeze(Object.defineProperty({__proto__:null,default:nC},Symbol.toStringTag,{value:"Module"})),wue={name:"VsListbar",mixins:[Ea],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(r){console.error(r)}},prepareData(){var e,t,n;this.columns=Object.keys(((e=this.sourceData)==null?void 0:e[0])||{});const r=(t=this.sourceData)==null?void 0:t.map(i=>{var a;return i==null?void 0:i[(a=this.columns)==null?void 0:a[1]]});this.maxValue=Math.max(...r||[]),this.restDimensions=(n=this.columns)==null?void 0:n.filter((i,a)=>a!==0)},formattedValue(r){return En(r)},getWidth(r){return`${r/this.maxValue*100}%`}}},Sue={class:"h-full pt-[20px] list-bar"},Tue={class:"space-y-2 custom-scrollbar h-full h-[calc(100%-20px)]"},Eue={class:"relative w-full truncate"},Cue={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},Aue={class:"text-[14px] text-gray-500"};function Due(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",Sue,[P.createElementVNode("ul",Tue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>{var l,c,d;return P.openBlock(),P.createElementBlock("li",{key:s,class:"flex items-center justify-between w-full gap-x-2"},[P.createElementVNode("div",Eue,[P.createElementVNode("span",Cue,P.toDisplayString((o==null?void 0:o[(l=i.columns)==null?void 0:l[0]])||"Без категорії"),1),P.createElementVNode("div",{class:P.normalizeClass(["absolute inset-y-0 h-full rounded start-0",o!=null&&o[(c=i.columns)==null?void 0:c[0]]?"bg-indigo-100":"bg-gray-100"]),style:P.normalizeStyle({width:a.getWidth(o==null?void 0:o[(d=i.columns)==null?void 0:d[1]])})},null,6)]),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.restDimensions,(f,g)=>(P.openBlock(),P.createElementBlock("div",{key:g,class:"w-20 mr-2 text-end"},[P.createElementVNode("span",Aue,P.toDisplayString(a.formattedValue(o==null?void 0:o[f])),1)]))),128))])}),128))])])}const iC=ur(wue,[["render",Due]]),Mue=Object.freeze(Object.defineProperty({__proto__:null,default:iC},Symbol.toStringTag,{value:"Module"})),aC={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},Iue=["onClick"],kue={class:"flex items-center justify-between w-full"},Lue={key:0},Pue={__name:"vs-bi-dropdown",props:{title:String,options:[Array,String],value:{type:String}},emits:["selected"],setup(r,{emit:e}){const t=r,n=e,i=P.ref(!1),a=P.ref(t.value||null),o=P.ref(null),s=P.computed(()=>typeof t.options=="string"?t.options.split(",").map((m,_)=>({id:_,text:m.trim()})):t.options),l=P.computed(()=>{const m=s.value.find(_=>(_.id||_)===a.value);return m?m.text||m:t.title}),c=m=>{a.value=m.id||m,i.value=!1,n("selected",(m==null?void 0:m.id)||m),document.removeEventListener("click",d)},d=m=>{o.value&&!o.value.contains(m.target)&&(i.value=!1,document.removeEventListener("click",d))},f=()=>{i.value=!i.value,i.value?setTimeout(()=>{document.addEventListener("click",d)},200):document.removeEventListener("click",d)},g=m=>(aC==null?void 0:aC[m])||m;return P.onUnmounted(()=>{document.removeEventListener("click",d)}),(m,_)=>(P.openBlock(),P.createElementBlock(P.Fragment,null,[P.createElementVNode("button",{type:"button","aria-expanded":"true",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative group pr-2 -ms-2 py-1.5 pl-2.5 inline-flex shrink-0 justify-center items-center gap-x-1.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 before:absolute before:inset-0 before:z-[1] dark:text-neutral-400 dark:hover:bg-neutral-800 dark:focus:bg-neutral-700",onClick:f},[P.createTextVNode(P.toDisplayString(g(l.value))+" ",1),_[0]||(_[0]=P.createElementVNode("svg",{class:"shrink-0 size-3.5 text-gray-600 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),i.value?(P.openBlock(),P.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:o,"data-hs-select-dropdown":"",class:"absolute mt-2 z-50 w-48 p-1 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-950 opened",role:"listbox",tabindex:"-1","aria-orientation":"vertical",style:{"margin-top":"10px"}},[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(s.value,x=>(P.openBlock(),P.createElementBlock("div",{key:x.id||x,class:"cursor-pointer selected hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-800 py-1.5 px-2 w-full text-[13px] text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:w=>c(x)},[P.createElementVNode("div",kue,[P.createElementVNode("span",null,P.toDisplayString(g(x.text||x)),1),a.value===(x.id||x)?(P.openBlock(),P.createElementBlock("span",Lue,_[1]||(_[1]=[P.createElementVNode("svg",{class:"shrink-0 h-3.5 w-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):P.createCommentVNode("",!0)])],8,Iue))),128))],512)):P.createCommentVNode("",!0)],64))}},Rue={"bi-bar":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Fce)),"bi-number":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Qge)),"bi-text":P.defineAsyncComponent(()=>Promise.resolve().then(()=>ive)),"bi-listbar":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Mue)),"bi-pie":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Hce)),"bi-donut":P.defineAsyncComponent(()=>Promise.resolve().then(()=>lve)),"bi-line":P.defineAsyncComponent(()=>Promise.resolve().then(()=>jce)),"bi-stat":P.defineAsyncComponent(()=>Promise.resolve().then(()=>cue)),"bi-pivot":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Ghe)),"bi-progress":P.defineAsyncComponent(()=>Promise.resolve().then(()=>xue)),"bi-funnel":P.defineAsyncComponent(()=>Promise.resolve().then(()=>dve)),"bi-map":P.defineAsyncComponent(()=>Promise.resolve().then(()=>vme)),"bi-cluster":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Vme)),"bi-table":P.defineAsyncComponent(()=>Promise.resolve().then(()=>Jme))},Nue={class:"flex items-center space-x-2"},Oue=P.defineComponent({__name:"vs-bi-switch",props:P.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:P.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(r,{emit:e}){const t=e,n=P.useModel(r,"modelValue"),i=()=>{t("update:is-enabled",n)};return(a,o)=>(P.openBlock(),P.createElementBlock("div",Nue,[a.leftLabel?(P.openBlock(),P.createElementBlock("div",{key:0,class:P.normalizeClass(["transition-colors",{"text-blue-500":!n.value}])},P.toDisplayString(a.leftLabel),3)):P.createCommentVNode("",!0),P.withDirectives(P.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>n.value=s),type:"checkbox",class:"relative w-11 h-6 p-px bg-gray-100 border-transparent text-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:ring-blue-600 disabled:opacity-50 disabled:pointer-events-none checked:bg-none checked:text-blue-600 checked:border-blue-600 focus:checked:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-600 before:inline-block before:size-5 before:bg-white checked:before:bg-blue-200 before:translate-x-0 checked:before:translate-x-full before:rounded-full before:shadow before:h-5 before:w-5 before:transform before:ring-0 before:transition before:ease-in-out before:duration-200 dark:before:bg-neutral-400 dark:checked:before:bg-blue-200",onChange:i},null,544),[[P.vModelCheckbox,n.value]]),a.rightLabel?(P.openBlock(),P.createElementBlock("div",{key:1,class:P.normalizeClass(["transition-colors",{"text-blue-500":n.value}])},P.toDisplayString(a.rightLabel),3)):P.createCommentVNode("",!0)]))}}),zue={},Bue={class:"flex items-center justify-center h-full"};function Vue(r,e){return P.openBlock(),P.createElementBlock("div",Bue,e[0]||(e[0]=[P.createElementVNode("div",{class:"text-center text-gray-500"},[P.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Fue=ur(zue,[["render",Vue]]),$ue={},Gue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Uue(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("svg",Gue,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),P.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),P.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Hue={components:{VsBiDropdown:Pue,VsBiSwitch:Oue,VsNoDataChart:Fue,IconDownload:ur($ue,[["render",Uue]]),...Rue},props:{dashboard:{type:String},prefix:{type:String,default:""},widget:{type:String},filterURl:{type:String},dashboardWidgets:{type:Object},selectedWidget:{type:String}},data(){return{checked:[],selected:[],currentWidget:null,widgetData:[]}},computed:{computedTitle(){var e,t;const r=(e=this.dashboardWidgets)==null?void 0:e.find(n=>n.name===this.widget);return((t=r==null?void 0:r.data)==null?void 0:t.title)||(r==null?void 0:r.title)||""},computedType(){var e;const r=(e=this.dashboardWidgets)==null?void 0:e.find(t=>t.name===this.widget);return(r==null?void 0:r.type)||"text"},controls(){var e;return Object.keys(((e=this.widgetData)==null?void 0:e.controls)||{}).map(t=>{var n,i,a;return{name:t,options:typeof((n=this.widgetData)==null?void 0:n.controls)=="boolean"?!1:(a=(i=this.widgetData)==null?void 0:i.controls)==null?void 0:a[t]}})}},mounted(){this.prefix&&(yr.defaults.baseURL=this.prefix)},watch:{filterURl(r){var e,t;(t=(e=this.$refs)==null?void 0:e.chart)==null||t.setFilter(r)},selectedWidget(r,e){var t;r!==e&&r===((t=this.widgetData)==null?void 0:t.id)&&this.$emit("update:current-widget-data",this.widgetData)},widgetData(r,e){if((r==null?void 0:r.id)===(e==null?void 0:e.id))return;const n=new URLSearchParams(window.top.location.search).get("widget");n&&n===(r==null?void 0:r.id)&&this.$emit("update:current-widget-data",r)}},methods:{changeStyleHandler(r,e){var t;(t=this.$refs.chart)==null||t.changeStyle(r,e)},selectedOptionHandler(r,e){let t=!0;this.selected.forEach(n=>{n.name===e&&(n.option=r,t=!1)}),t&&this.selected.push({name:e,option:r}),this.makeUpUrl()},makeUpUrl(){var e;let r=`/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`;this.selected.forEach((t,n)=>{r+=`&${t.name}=${t.option}`}),(e=this.$refs.chart)==null||e.getDataFromURL(r)},exportChart(){if(this.currentWidget){const r=this.currentWidget.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),e=document.createElement("a");e.href=r,e.download="chart.png",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}}},Wue={key:0,class:"text-[16px] flex max-w-full items-center min-h-0 flex justify-between max-h-[50px] h-fit shrink-0"},que={class:"flex items-center justify-between w-full"},Zue={class:"grid"},jue={class:"text-gray-800 max-h-[30px] inline-block text-nowrap font-semibold"},Xue={class:"flex flex-col justify-end"},Yue={key:0,class:"flex items-center justify-end w-full gap-2"},Kue={class:"w-full h-full"};function Jue(r,e,t,n,i,a){var d,f,g,m,_,x,w,C,M;const o=P.resolveComponent("VsBiDropdown"),s=P.resolveComponent("VsBiSwitch"),l=P.resolveComponent("IconDownload"),c=P.resolveComponent("VsNoDataChart");return P.openBlock(),P.createElementBlock("div",{ref:"widget",class:P.normalizeClass(["box-border relative h-full p-4 bg-white border border-gray-200 select-auto rounded-xl",[(f=(d=i.widgetData)==null?void 0:d.style)!=null&&f.height?`max-h-[${(m=(g=i.widgetData)==null?void 0:g.style)==null?void 0:m.height}px] h-[${(x=(_=i.widgetData)==null?void 0:_.style)==null?void 0:x.height}px]`:"max-h-[460px]"]])},[["text","cluster","map"].includes(a.computedType)?P.createCommentVNode("",!0):(P.openBlock(),P.createElementBlock("div",Wue,[P.createElementVNode("div",que,[P.createElementVNode("div",Zue,[P.createElementVNode("span",jue,P.toDisplayString(a.computedTitle),1)]),P.createElementVNode("div",Xue,[(w=a.controls)!=null&&w.length?(P.openBlock(),P.createElementBlock("span",Yue,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList((C=a.controls)==null?void 0:C.filter(L=>(L==null?void 0:L.options)&&(L==null?void 0:L.name)!=="export"),L=>{var O;return P.openBlock(),P.createElementBlock("div",null,[Array.isArray(L==null?void 0:L.options)?(P.openBlock(),P.createBlock(o,{key:0,title:L==null?void 0:L.name,options:L==null?void 0:L.options,value:(O=i.widgetData)==null?void 0:O.data[L==null?void 0:L.name],onSelected:F=>a.selectedOptionHandler(F,L==null?void 0:L.name)},null,8,["title","options","value","onSelected"])):typeof L.options=="boolean"?(P.openBlock(),P.createBlock(s,{key:1,"left-label":L==null?void 0:L.name,"is-enabled":L==null?void 0:L.options,"onUpdate:isEnabled":F=>a.changeStyleHandler(L==null?void 0:L.name,F)},null,8,["left-label","is-enabled","onUpdate:isEnabled"])):P.createCommentVNode("",!0)])}),256)),(M=a.controls)!=null&&M.some(L=>(L==null?void 0:L.name)==="export")?(P.openBlock(),P.createElementBlock("button",{key:0,onClick:e[0]||(e[0]=(...L)=>a.exportChart&&a.exportChart(...L)),class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center"},[P.createVNode(l,{height:"16",width:"16",class:"text-gray-800"})])):P.createCommentVNode("",!0)])):P.createCommentVNode("",!0)])])])),P.createElementVNode("div",Kue,[i.widgetData?(P.openBlock(),P.createBlock(P.resolveDynamicComponent("bi-"+a.computedType),{key:0,currentWidget:i.currentWidget,"onUpdate:currentWidget":e[1]||(e[1]=L=>i.currentWidget=L),widgetData:i.widgetData,"onUpdate:widgetData":e[2]||(e[2]=L=>i.widgetData=L),ref:"chart",dashboard:t.dashboard,title:a.computedTitle,widget:t.widget},null,40,["currentWidget","widgetData","dashboard","title","widget"])):(P.openBlock(),P.createBlock(c,{key:1,class:"w-full h-full"}))])],2)}const ev=ur(Hue,[["render",Jue]]),Que={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},ehe={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},the={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},rhe={class:"max-w-sm mx-auto mt-6"},nhe={class:"font-medium text-gray-800 dark:text-neutral-200"},ihe={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function ahe(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",ehe,[P.createElementVNode("div",null,[P.createElementVNode("div",the,[e[0]||(e[0]=P.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),P.createElementVNode("div",rhe,[P.createElementVNode("p",nhe,P.toDisplayString(t.title),1),P.createElementVNode("p",ihe,P.toDisplayString(t.text),1)])])])])}const Z0=ur(Que,[["render",ahe]]),ohe={},she={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function lhe(r,e){return P.openBlock(),P.createElementBlock("svg",she,e[0]||(e[0]=[P.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const che=ur(ohe,[["render",lhe]]),uhe={},hhe={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-refresh"};function dhe(r,e){return P.openBlock(),P.createElementBlock("svg",hhe,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},null,-1),P.createElementVNode("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1)]))}const fhe={components:{filterIcon:che,refreshIcon:ur(uhe,[["render",dhe]])},props:["filterScheme"],emits:["filters:changed"],data(){return{rows:[],isFilterVisible:!1,rowList:[],activeFilters:"",filters:{}}},async mounted(){const e=await(await new URLSearchParams(window.top.location.search)).get("filter");this.filters.url=e||""},computed:{activeFiltersCount(){var r,e;return(r=this.filters)!=null&&r.url?((e=this.filters)==null?void 0:e.url.split("=").length)-1:0}},methods:{toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},handleFilterChange(r){var e,t;this.filters=r,this.activeFilters=(t=(e=this.$refs)==null?void 0:e.filter)==null?void 0:t.activeFilters,this.$emit("filters:changed",this.filters)},resetFilters(){this.$refs.filter&&this.$refs.filter.clearAll(),this.isFilterVisible=!1,this.$emit("filters:changed",""),this.activeFilters=null},closeFilter({target:r}){this.isFilterVisible&&r.classList.contains("filter-container")&&(this.isFilterVisible=!1)}}},phe={class:"flex items-center"},ghe={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"};function vhe(r,e,t,n,i,a){const o=P.resolveComponent("filterIcon"),s=P.resolveComponent("VsFilterList");return P.openBlock(),P.createElementBlock("div",phe,[t.filterScheme?(P.openBlock(),P.createBlock(s,{key:0,ref:"filter",scheme:t.filterScheme,closeFilterBtn:!0,onFilterClose:e[1]||(e[1]=l=>i.isFilterVisible=!1),layout:"default","apply-vue-router":"",history:"",view:"plain",token:r.table,name:"filter",footer:!0,background:!0,onFilterChange:a.handleFilterChange},{button:P.withCtx(()=>[P.createElementVNode("button",{type:"button",class:"py-2 px-2.5 ml-3 h-[38px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[0]||(e[0]=(...l)=>a.toggleFilterShown&&a.toggleFilterShown(...l))},[P.createVNode(o),e[2]||(e[2]=P.createTextVNode(" Фільтри ")),a.activeFiltersCount>=1?(P.openBlock(),P.createElementBlock("span",ghe,P.toDisplayString(a.activeFiltersCount),1)):P.createCommentVNode("",!0)])]),_:1},8,["scheme","token","onFilterChange"])):P.createCommentVNode("",!0)])}const mhe={props:["dashboardData","filters"],components:{VsFilterHeader:ur(fhe,[["render",vhe]])}},yhe={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 mt-2 rounded-xl mb-2 pt-[3px] justify-between items-center"},_he={class:"grow"},bhe={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},xhe={type:"button",class:"inline-flex items-center text-sm gap-x-2 text-stone-800 hover:text-stone-500 focus:outline-none focus:text-stone-500 dark:text-neutral-200 dark:hover:text-neutral-400 dark:focus:text-neutral-400","data-clipboard-target":"#hs-erc","data-clipboard-action":"copy","data-clipboard-success-text":"Copied"};function whe(r,e,t,n,i,a){var s,l;const o=P.resolveComponent("VsFilterHeader");return P.openBlock(),P.createElementBlock("div",yhe,[P.createElementVNode("div",_he,[P.createElementVNode("h1",bhe,P.toDisplayString((s=t.dashboardData)==null?void 0:s.title),1),P.createElementVNode("button",xhe,P.toDisplayString((l=t.dashboardData)==null?void 0:l.description),1)]),P.createVNode(o,{filterScheme:t.filters,"onFilters:changed":e[0]||(e[0]=c=>r.$emit("filters:changed",c))},null,8,["filterScheme"])])}const She={components:{VsWidget:ev,VsNewNodata:Z0,VsHeader:ur(mhe,[["render",whe]])},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){yr.defaults.baseURL=this.prefix||"/api",await this.fetchData()},methods:{async fetchData(){if(this.id)try{const{data:r}=await yr.get(`/bi-dashboard/${this.id}`);this.dashboardData=r}catch(r){console.error(r)}},columnClass(r){const e=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[e]||"w-full"},async filterHandler(r){var t;this.filterURl="";let e="&filter=";(t=r==null?void 0:r.url)!=null&&t.length&&(r.url.split("|").forEach(i=>{const a=i.split("=");e+=`${a[0]}=${a[1]}`}),this.filterURl+=e)}}},The={class:"w-full pb-8 overflow-y-auto"},Ehe={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function Che(r,e,t,n,i,a){var c,d,f;const o=P.resolveComponent("VsHeader"),s=P.resolveComponent("VsNewNodata"),l=P.resolveComponent("VsWidget");return P.openBlock(),P.createElementBlock("div",The,[P.createElementVNode("div",null,[(c=i.dashboardData)!=null&&c.filters?(P.openBlock(),P.createBlock(o,{key:0,filters:(d=i.dashboardData)==null?void 0:d.filters,dashboardData:i.dashboardData,"onFilters:changed":e[0]||(e[0]=g=>a.filterHandler(g))},null,8,["filters","dashboardData"])):P.createCommentVNode("",!0)]),P.createElementVNode("div",Ehe,[i.error||!i.dashboardData?(P.openBlock(),P.createBlock(s,{key:0,class:"col-span-12"})):P.createCommentVNode("",!0),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(((f=i.dashboardData)==null?void 0:f.panels)||[],(g,m)=>{var _;return P.openBlock(),P.createElementBlock("div",{key:m,class:P.normalizeClass([`col-span-${g.col||12}`,"flex flex-col gap-[10px]"])},[(_=g.widgets)!=null&&_.length?(P.openBlock(!0),P.createElementBlock(P.Fragment,{key:0},P.renderList(g.widgets,x=>(P.openBlock(),P.createBlock(l,{key:x,dashboard:t.id,widget:x,"dashboard-widgets":i.dashboardData.widgets,"filter-u-rl":i.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(P.openBlock(),P.createBlock(l,{key:1,class:"flex flex-col",dashboard:t.id,widget:g.widget,"dashboard-widgets":i.dashboardData.widgets,"filter-u-rl":i.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const oC=ur(She,[["render",Che]]),Ahe={name:"VsPivotTable",mixins:[Ea],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>rs(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(n=>parseFloat(n[e])).map(n=>En(parseFloat(n[e])))}))}catch(r){console.error(r)}}}},Dhe={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},Mhe={class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 custom-scrollbar"},Ihe={class:"inline-block min-w-full align-middle"},khe={class:"min-w-full divide-y divide-gray-200"},Lhe={class:"space-x-2"},Phe={scope:"col",class:"xl:min-w-[120px] min-w-48"},Rhe={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Nhe={class:"divide-y divide-gray-200 text-[12px]"},Ohe={class:"py-3 size-px whitespace-nowrap"},zhe={class:"flex items-center gap-x-3"},Bhe={class:"font-medium text-gray-800"},Vhe={class:"py-3 size-px whitespace-nowrap"},Fhe={class:"text-gray-600"};function $he(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",Dhe,[P.createElementVNode("div",Mhe,[P.createElementVNode("div",Ihe,[P.createElementVNode("table",khe,[P.createElementVNode("thead",null,[P.createElementVNode("tr",Lhe,[e[0]||(e[0]=P.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[P.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.xs,o=>(P.openBlock(),P.createElementBlock("th",Phe,[P.createElementVNode("div",Rhe,P.toDisplayString(o),1)]))),256))])]),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.values,o=>(P.openBlock(),P.createElementBlock("tbody",Nhe,[P.createElementVNode("tr",null,[P.createElementVNode("td",Ohe,[P.createElementVNode("div",zhe,[P.createElementVNode("span",Bhe,P.toDisplayString(o.name),1)])]),(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.xs,(s,l)=>(P.openBlock(),P.createElementBlock("td",Vhe,[P.createElementVNode("span",Fhe,P.toDisplayString(o.data[l]),1)]))),256))])]))),256))])])])])}const sC=ur(Ahe,[["render",$he]]),Ghe=Object.freeze(Object.defineProperty({__proto__:null,default:sC},Symbol.toStringTag,{value:"Module"})),Uhe={},Hhe={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Whe(r,e){return P.openBlock(),P.createElementBlock("svg",Hhe,e[0]||(e[0]=[P.createElementVNode("path",{d:"M3.3335 8H12.6668",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),P.createElementVNode("path",{d:"M8 3.33325V12.6666",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const qhe=ur(Uhe,[["render",Whe]]),Zhe={},jhe={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"mr-3"};function Xhe(r,e){return P.openBlock(),P.createElementBlock("svg",jhe,e[0]||(e[0]=[P.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),P.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.7417",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const h4=ur(Zhe,[["render",Xhe]]),Yhe={},Khe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Jhe(r,e){return P.openBlock(),P.createElementBlock("svg",Khe,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),P.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),P.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Qhe=ur(Yhe,[["render",Jhe]]),ede={},tde={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-lock"};function rde(r,e){return P.openBlock(),P.createElementBlock("svg",tde,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"},null,-1),P.createElementVNode("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"},null,-1),P.createElementVNode("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"},null,-1)]))}const nde=ur(ede,[["render",rde]]),ide=[{type:"Text",key:"name",label:"Назва",validators:["required"],original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"title",label:"Заголовок",validators:["required"],original:{type:"Text",ua:"Титул",col:8}},{type:"Text",key:"description",label:"Опис",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"words",label:"Ключові слова",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],ade={components:{plusIcon:qhe,searchIcon:h4,IconLock:nde,IconImport:Qhe},props:["selectedDashboard","prefix"],emits:["update:selectedDashboard","add","update"],mounted(){yr.defaults.baseURL=this.prefix||"/api",this.getFileItems(),this.getList()},data(){return{searchQuery:"",scheme:null,formValues:{},formCreateValues:{},isVisible:!1,isVisibleFormDashboard:!1,fileItems:null,list:null,addDashboardForm:ide}},methods:{async getFileItems(){var r;try{const{data:e}=await yr.get("/bi-dashboard?type=file");this.scheme={dashboard:{type:"Checkbox",ua:"Дашборди",options:(r=e==null?void 0:e.rows)==null?void 0:r.map(({name:t,title:n})=>({id:t,text:n}))}}}catch{}},async getList(){try{const{data:r}=await yr.get("/bi-dashboard?type=db");this.list=r.rows.filter(e=>e.type==="db")}catch(r){console.error(r)}},async dashboardImport(){try{await yr.get(`/bi-dashboard-import?dashboard=${this.formValues.dashboard}`),this.isVisible=!1,this.formValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд імпортовано успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі імпортувати дашборд виникла помилка"})}},async createDashboard(){try{await this.$refs.form.doValidation(),await yr.post("/bi-dashboard",this.formCreateValues),this.isVisibleFormDashboard=!1,this.formCreateValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}},computed:{filteredList(){var e;const r=this.searchQuery.toLowerCase();return(e=this.list)==null?void 0:e.filter(t=>(t==null?void 0:t.title)&&(t==null?void 0:t.title.toLowerCase().includes(r))||(t==null?void 0:t.name)&&(t==null?void 0:t.name.toLowerCase().includes(r)))}}},ode={class:"h-full w-[300px] shrink-0 bg-white border-r border-gray-200 flex flex-col"},sde={class:"flex h-[49px] border-b justify-between px-[16px] items-center"},lde={class:"flex items-center gap-2"},cde={class:"flex items-center gap-2 px-[10px] py-2"},ude={class:"relative w-full"},hde={class:"px-[10px] flex flex-col gap-[2px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},dde=["item","onClick"],fde={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},pde={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function gde(r,e,t,n,i,a){const o=P.resolveComponent("IconImport"),s=P.resolveComponent("VsPopover"),l=P.resolveComponent("plusIcon"),c=P.resolveComponent("IconLock"),d=P.resolveComponent("VsForm"),f=P.resolveComponent("VsDialog");return P.openBlock(),P.createElementBlock(P.Fragment,null,[P.createElementVNode("div",ode,[P.createElementVNode("div",sde,[e[13]||(e[13]=P.createElementVNode("div",{class:"text-[20px]"},[P.createTextVNode("Editor "),P.createElementVNode("span",{class:"text-[#666666]"})],-1)),P.createElementVNode("div",lde,[P.createVNode(s,{placement:"left",trigger:"hover"},{reference:P.withCtx(()=>[P.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] text-blue-500 w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[0]||(e[0]=g=>i.isVisible=!0)},[P.createVNode(o,{height:"18",width:"18"})])]),default:P.withCtx(()=>[e[11]||(e[11]=P.createTextVNode(" Імпортувати дашборд "))]),_:1}),P.createVNode(s,{placement:"right",trigger:"hover"},{reference:P.withCtx(()=>[P.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[1]||(e[1]=g=>i.isVisibleFormDashboard=!0)},[P.createVNode(l)])]),default:P.withCtx(()=>[e[12]||(e[12]=P.createTextVNode(" Створити дашборд "))]),_:1})])]),P.createElementVNode("div",cde,[P.createElementVNode("div",ude,[P.withDirectives(P.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=g=>i.searchQuery=g),class:"flex-1 text-[13px] w-full h-[38px] px-3 text-gray-800 rounded-lg !border-none bg-gray-100 placeholder-gray-800 focus:outline-2 focus:outline-blue-600",placeholder:"Пошук..."},null,512),[[P.vModelText,i.searchQuery]])])]),P.createElementVNode("div",hde,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(a.filteredList,(g,m)=>(P.openBlock(),P.createElementBlock("div",{key:m,item:g,class:P.normalizeClass(["flex items-center cursor-pointer hover:bg-[#F3F4F6] py-1.5 px-2 text-[13px] text-gray-800 rounded-lg",{"bg-gray-100 outline-none":g.name===t.selectedDashboard}]),onClick:_=>r.$emit("update:selectedDashboard",g==null?void 0:g.name)},[P.createTextVNode(P.toDisplayString((g==null?void 0:g.title)||(g==null?void 0:g.name))+" ",1),g!=null&&g.public?P.createCommentVNode("",!0):(P.openBlock(),P.createBlock(c,{key:0,height:"12",width:"12",class:"ml-1 shrink-0"}))],10,dde))),128))])]),P.createVNode(f,{visible:i.isVisible,"onUpdate:visible":e[6]||(e[6]=g=>i.isVisible=g),title:"Імпортувати"},{footer:P.withCtx(()=>[P.createElementVNode("div",fde,[P.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[4]||(e[4]=g=>i.isVisible=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),P.createElementVNode("button",{onClick:e[5]||(e[5]=(...g)=>a.dashboardImport&&a.dashboardImport(...g)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Імпортувати ")])]),default:P.withCtx(()=>{var g;return[P.createTextVNode(P.toDisplayString((g=i.fileItems)==null?void 0:g.map(({name:m,title:_})=>({value:m,text:_})))+" ",1),P.createVNode(d,{scheme:i.scheme,modelValue:i.formValues,"onUpdate:modelValue":e[3]||(e[3]=m=>i.formValues=m)},null,8,["scheme","modelValue"])]}),_:1},8,["visible"]),P.createVNode(f,{visible:i.isVisibleFormDashboard,"onUpdate:visible":e[10]||(e[10]=g=>i.isVisibleFormDashboard=g),title:"Створити дашборд"},{footer:P.withCtx(()=>[P.createElementVNode("div",pde,[P.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=g=>i.isVisibleFormDashboard=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),P.createElementVNode("button",{onClick:e[9]||(e[9]=(...g)=>a.createDashboard&&a.createDashboard(...g)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:P.withCtx(()=>[P.createVNode(d,{ref:"form",scheme:i.addDashboardForm,modelValue:i.formCreateValues,"onUpdate:modelValue":e[7]||(e[7]=g=>i.formCreateValues=g)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const vde=ur(ade,[["render",gde]]),mde={},yde={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function _de(r,e){return P.openBlock(),P.createElementBlock("svg",yde,e[0]||(e[0]=[P.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const d4=ur(mde,[["render",_de]]),bde={},xde={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function wde(r,e){return P.openBlock(),P.createElementBlock("svg",xde,e[0]||(e[0]=[P.createElementVNode("path",{d:"M18 6 6 18"},null,-1),P.createElementVNode("path",{d:"m6 6 12 12"},null,-1)]))}const lC=ur(bde,[["render",wde]]),Sde={},Tde={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit"};function Ede(r,e){return P.openBlock(),P.createElementBlock("svg",Tde,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"},null,-1),P.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"},null,-1),P.createElementVNode("path",{d:"M16 5l3 3"},null,-1)]))}const f4=ur(Sde,[["render",Ede]]),Cde={class:"pt-[10px]"},Ade={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(r){var g,m,_,x,w,C;const{$notify:e}=P.getCurrentInstance().proxy,t=r,n=P.ref(null),i={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},a={show:{label:"Legend",type:"switcher",title:"Show legend"}},o={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},s=P.ref({...((m=(g=t.data)==null?void 0:g.style)==null?void 0:m.label)||{}}),l=P.ref({...((x=(_=t.data)==null?void 0:_.style)==null?void 0:x.legend)||{}}),c=P.ref({...((C=(w=t.data)==null?void 0:w.style)==null?void 0:C.tooltip)||{}}),d=()=>{const M=new CustomEvent(`update-style-${t.widgetName}`);M.chartId=t.widgetName,M.options={options:{legend:l.value,tooltip:c.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(M)};P.watch(s,d,{deep:!0}),P.watch(l,d,{deep:!0}),P.watch(c,d,{deep:!0});const f=async()=>{try{await yr.put(`/bi-dashboard/${n.value}/${t.widgetName}`,{style:{legend:l.value,tooltip:c.value,label:s.value}});const M=new CustomEvent(`update-style-${t.widgetName}`);M.chartId=t.widgetName,M.options={options:{legend:l.value,tooltip:c.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(M),await e({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await e({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return P.onMounted(()=>{const M=new URLSearchParams(window.top.location.search);n.value=M.get("dashboard")}),(M,L)=>{const O=P.resolveComponent("VsButton"),F=P.resolveComponent("VsForm");return P.openBlock(),P.createElementBlock("div",Cde,[P.createVNode(O,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:f},{default:P.withCtx(()=>L[3]||(L[3]=[P.createTextVNode(" Зберегти ")])),_:1}),P.createVNode(F,{scheme:i,modelValue:s.value,"onUpdate:modelValue":L[0]||(L[0]=V=>s.value=V),class:"p-0"},null,8,["modelValue"]),P.createVNode(F,{scheme:a,modelValue:l.value,"onUpdate:modelValue":L[1]||(L[1]=V=>l.value=V),class:"p-0"},null,8,["modelValue"]),P.createVNode(F,{scheme:o,modelValue:c.value,"onUpdate:modelValue":L[2]||(L[2]=V=>c.value=V),class:"p-0"},null,8,["modelValue"])])}}};function cC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let lh=cC();function p4(r){lh=r}const g4=/[&<>"']/,Dde=new RegExp(g4.source,"g"),v4=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Mde=new RegExp(v4.source,"g"),Ide={"&":"&","<":"<",">":">",'"':""","'":"'"},m4=r=>Ide[r];function Ga(r,e){if(e){if(g4.test(r))return r.replace(Dde,m4)}else if(v4.test(r))return r.replace(Mde,m4);return r}const kde=/(^|[^\[])\^/g;function hn(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const n={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(kde,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}function y4(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const tv={exec:()=>null};function _4(r,e){const t=r.replace(/\|/g,(a,o,s)=>{let l=!1,c=o;for(;--c>=0&&s[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function rv(r,e,t){const n=r.length;if(n===0)return"";let i=0;for(;i<n;){const a=r.charAt(n-i-1);if(a===e&&!t)i++;else if(a!==e&&t)i++;else break}return r.slice(0,n-i)}function Lde(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return-1}function b4(r,e,t,n){const i=e.href,a=e.title?Ga(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){n.state.inLink=!0;const s={type:"link",raw:t,href:i,title:a,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,s}return{type:"image",raw:t,href:i,title:a,text:Ga(o)}}function Pde(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
101
101
|
`).map(i=>{const a=i.match(/^\s+/);if(a===null)return i;const[o]=a;return o.length>=n.length?i.slice(n.length):i}).join(`
|
|
102
102
|
`)}class j0{constructor(e){bn(this,"options");bn(this,"rules");bn(this,"lexer");this.options=e||lh}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:rv(n,`
|
|
103
103
|
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Pde(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=rv(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:rv(t[0],`
|
|
@@ -166,7 +166,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Fe=pe,Be=me),Me===void
|
|
|
166
166
|
* MapLibre GL JS
|
|
167
167
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
|
|
168
168
|
*/(function(r,e){(function(t,n){r.exports=n()})(pfe,function(){var t={},n={};function i(o,s,l){if(n[o]=l,o==="index"){var c="var sharedModule = {}; ("+n.shared+")(sharedModule); ("+n.worker+")(sharedModule);",d={};return n.shared(d),n.index(t,d),typeof window<"u"&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([c],{type:"text/javascript"}))),t}}i("shared",["exports"],function(o){function s(p,h,v,b){return new(v||(v=Promise))(function(E,I){function k(G){try{z(b.next(G))}catch(W){I(W)}}function R(G){try{z(b.throw(G))}catch(W){I(W)}}function z(G){var W;G.done?E(G.value):(W=G.value,W instanceof v?W:new v(function(j){j(W)})).then(k,R)}z((b=b.apply(p,h||[])).next())})}function l(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}typeof SuppressedError=="function"&&SuppressedError;var c=d;function d(p,h){this.x=p,this.y=h}d.prototype={clone:function(){return new d(this.x,this.y)},add:function(p){return this.clone()._add(p)},sub:function(p){return this.clone()._sub(p)},multByPoint:function(p){return this.clone()._multByPoint(p)},divByPoint:function(p){return this.clone()._divByPoint(p)},mult:function(p){return this.clone()._mult(p)},div:function(p){return this.clone()._div(p)},rotate:function(p){return this.clone()._rotate(p)},rotateAround:function(p,h){return this.clone()._rotateAround(p,h)},matMult:function(p){return this.clone()._matMult(p)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(p){return this.x===p.x&&this.y===p.y},dist:function(p){return Math.sqrt(this.distSqr(p))},distSqr:function(p){var h=p.x-this.x,v=p.y-this.y;return h*h+v*v},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(p){return Math.atan2(this.y-p.y,this.x-p.x)},angleWith:function(p){return this.angleWithSep(p.x,p.y)},angleWithSep:function(p,h){return Math.atan2(this.x*h-this.y*p,this.x*p+this.y*h)},_matMult:function(p){var h=p[2]*this.x+p[3]*this.y;return this.x=p[0]*this.x+p[1]*this.y,this.y=h,this},_add:function(p){return this.x+=p.x,this.y+=p.y,this},_sub:function(p){return this.x-=p.x,this.y-=p.y,this},_mult:function(p){return this.x*=p,this.y*=p,this},_div:function(p){return this.x/=p,this.y/=p,this},_multByPoint:function(p){return this.x*=p.x,this.y*=p.y,this},_divByPoint:function(p){return this.x/=p.x,this.y/=p.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var p=this.y;return this.y=this.x,this.x=-p,this},_rotate:function(p){var h=Math.cos(p),v=Math.sin(p),b=v*this.x+h*this.y;return this.x=h*this.x-v*this.y,this.y=b,this},_rotateAround:function(p,h){var v=Math.cos(p),b=Math.sin(p),E=h.y+b*(this.x-h.x)+v*(this.y-h.y);return this.x=h.x+v*(this.x-h.x)-b*(this.y-h.y),this.y=E,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},d.convert=function(p){return p instanceof d?p:Array.isArray(p)?new d(p[0],p[1]):p};var f=l(c),g=m;function m(p,h,v,b){this.cx=3*p,this.bx=3*(v-p)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(b-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=p,this.p1y=h,this.p2x=v,this.p2y=b}m.prototype={sampleCurveX:function(p){return((this.ax*p+this.bx)*p+this.cx)*p},sampleCurveY:function(p){return((this.ay*p+this.by)*p+this.cy)*p},sampleCurveDerivativeX:function(p){return(3*this.ax*p+2*this.bx)*p+this.cx},solveCurveX:function(p,h){if(h===void 0&&(h=1e-6),p<0)return 0;if(p>1)return 1;for(var v=p,b=0;b<8;b++){var E=this.sampleCurveX(v)-p;if(Math.abs(E)<h)return v;var I=this.sampleCurveDerivativeX(v);if(Math.abs(I)<1e-6)break;v-=E/I}var k=0,R=1;for(v=p,b=0;b<20&&(E=this.sampleCurveX(v),!(Math.abs(E-p)<h));b++)p>E?k=v:R=v,v=.5*(R-k)+k;return v},solve:function(p,h){return this.sampleCurveY(this.solveCurveX(p,h))}};var _=l(g);let x,w;function C(){return x==null&&(x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),x}function M(){if(w==null&&(w=!1,C())){const h=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(h){for(let b=0;b<5*5;b++){const E=4*b;h.fillStyle=`rgb(${E},${E+1},${E+2})`,h.fillRect(b%5,Math.floor(b/5),1,1)}const v=h.getImageData(0,0,5,5).data;for(let b=0;b<5*5*4;b++)if(b%4!=3&&v[b]!==b){w=!0;break}}}return w||!1}function L(p,h,v,b){const E=new _(p,h,v,b);return I=>E.solve(I)}const O=L(.25,.1,.25,1);function F(p,h,v){return Math.min(v,Math.max(h,p))}function V(p,h,v){const b=v-h,E=((p-h)%b+b)%b+h;return E===h?v:E}function U(p,...h){for(const v of h)for(const b in v)p[b]=v[b];return p}let H=1;function Z(p,h,v){const b={};for(const E in p)b[E]=h.call(this,p[E],E,p);return b}function Y(p,h,v){const b={};for(const E in p)h.call(this,p[E],E,p)&&(b[E]=p[E]);return b}function X(p){return Array.isArray(p)?p.map(X):typeof p=="object"&&p?Z(p,X):p}const ie={};function oe(p){ie[p]||(typeof console<"u"&&console.warn(p),ie[p]=!0)}function le(p,h,v){return(v.y-p.y)*(h.x-p.x)>(h.y-p.y)*(v.x-p.x)}function de(p){return typeof WorkerGlobalScope<"u"&&p!==void 0&&p instanceof WorkerGlobalScope}let ge=null;function pe(p){return typeof ImageBitmap<"u"&&p instanceof ImageBitmap}const me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Me(p,h,v,b,E){return s(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const I=new VideoFrame(p,{timestamp:0});try{const k=I==null?void 0:I.format;if(!k||!k.startsWith("BGR")&&!k.startsWith("RGB"))throw new Error(`Unrecognized format ${k}`);const R=k.startsWith("BGR"),z=new Uint8ClampedArray(b*E*4);if(yield I.copyTo(z,function(G,W,j,ee,ne){const se=4*Math.max(-W,0),ce=(Math.max(0,j)-j)*ee*4+se,ye=4*ee,we=Math.max(0,W),Oe=Math.max(0,j);return{rect:{x:we,y:Oe,width:Math.min(G.width,W+ee)-we,height:Math.min(G.height,j+ne)-Oe},layout:[{offset:ce,stride:ye}]}}(p,h,v,b,E)),R)for(let G=0;G<z.length;G+=4){const W=z[G];z[G]=z[G+2],z[G+2]=W}return z}finally{I.close()}})}let Be,Fe;const Xe="AbortError";function it(){return new Error(Xe)}const at={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ht(p){return at.REGISTERED_PROTOCOLS[p.substring(0,p.indexOf("://"))]}const ct="global-dispatcher";class dt extends Error{constructor(h,v,b,E){super(`AJAXError: ${v} (${h}): ${b}`),this.status=h,this.statusText=v,this.url=b,this.body=E}}const Qe=()=>de(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Dt=function(p,h){if(/:\/\//.test(p.url)&&!/^https?:|^file:/.test(p.url)){const b=ht(p.url);if(b)return b(p,h);if(de(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:p,targetMapId:ct},h)}if(!(/^file:/.test(v=p.url)||/^file:/.test(Qe())&&!/^\w+:/.test(v))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(b,E){return s(this,void 0,void 0,function*(){const I=new Request(b.url,{method:b.method||"GET",body:b.body,credentials:b.credentials,headers:b.headers,cache:b.cache,referrer:Qe(),signal:E.signal});b.type!=="json"||I.headers.has("Accept")||I.headers.set("Accept","application/json");const k=yield fetch(I);if(!k.ok){const G=yield k.blob();throw new dt(k.status,k.statusText,b.url,G)}let R;R=b.type==="arrayBuffer"||b.type==="image"?k.arrayBuffer():b.type==="json"?k.json():k.text();const z=yield R;if(E.signal.aborted)throw it();return{data:z,cacheControl:k.headers.get("Cache-Control"),expires:k.headers.get("Expires")}})}(p,h);if(de(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:p,mustQueue:!0,targetMapId:ct},h)}var v;return function(b,E){return new Promise((I,k)=>{var R;const z=new XMLHttpRequest;z.open(b.method||"GET",b.url,!0),b.type!=="arrayBuffer"&&b.type!=="image"||(z.responseType="arraybuffer");for(const G in b.headers)z.setRequestHeader(G,b.headers[G]);b.type==="json"&&(z.responseType="text",!((R=b.headers)===null||R===void 0)&&R.Accept||z.setRequestHeader("Accept","application/json")),z.withCredentials=b.credentials==="include",z.onerror=()=>{k(new Error(z.statusText))},z.onload=()=>{if(!E.signal.aborted)if((z.status>=200&&z.status<300||z.status===0)&&z.response!==null){let G=z.response;if(b.type==="json")try{G=JSON.parse(z.response)}catch(W){return void k(W)}I({data:G,cacheControl:z.getResponseHeader("Cache-Control"),expires:z.getResponseHeader("Expires")})}else{const G=new Blob([z.response],{type:z.getResponseHeader("Content-Type")});k(new dt(z.status,z.statusText,b.url,G))}},E.signal.addEventListener("abort",()=>{z.abort(),k(it())}),z.send(b.body)})}(p,h)};function wt(p){if(!p||p.indexOf("://")<=0||p.indexOf("data:image/")===0||p.indexOf("blob:")===0)return!0;const h=new URL(p),v=window.location;return h.protocol===v.protocol&&h.host===v.host}function ot(p,h,v){v[p]&&v[p].indexOf(h)!==-1||(v[p]=v[p]||[],v[p].push(h))}function St(p,h,v){if(v&&v[p]){const b=v[p].indexOf(h);b!==-1&&v[p].splice(b,1)}}class tt{constructor(h,v={}){U(this,v),this.type=h}}class kt extends tt{constructor(h,v={}){super("error",U({error:h},v))}}class _r{on(h,v){return this._listeners=this._listeners||{},ot(h,v,this._listeners),this}off(h,v){return St(h,v,this._listeners),St(h,v,this._oneTimeListeners),this}once(h,v){return v?(this._oneTimeListeners=this._oneTimeListeners||{},ot(h,v,this._oneTimeListeners),this):new Promise(b=>this.once(h,b))}fire(h,v){typeof h=="string"&&(h=new tt(h,v||{}));const b=h.type;if(this.listens(b)){h.target=this;const E=this._listeners&&this._listeners[b]?this._listeners[b].slice():[];for(const R of E)R.call(this,h);const I=this._oneTimeListeners&&this._oneTimeListeners[b]?this._oneTimeListeners[b].slice():[];for(const R of I)St(b,R,this._oneTimeListeners),R.call(this,h);const k=this._eventedParent;k&&(U(h,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),k.fire(h))}else h instanceof kt&&console.error(h.error);return this}listens(h){return this._listeners&&this._listeners[h]&&this._listeners[h].length>0||this._oneTimeListeners&&this._oneTimeListeners[h]&&this._oneTimeListeners[h].length>0||this._eventedParent&&this._eventedParent.listens(h)}setEventedParent(h,v){return this._eventedParent=h,this._eventedParentData=v,this}}var Le={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Vr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function yn(p,h){const v={};for(const b in p)b!=="ref"&&(v[b]=p[b]);return Vr.forEach(b=>{b in h&&(v[b]=h[b])}),v}function nt(p,h){if(Array.isArray(p)){if(!Array.isArray(h)||p.length!==h.length)return!1;for(let v=0;v<p.length;v++)if(!nt(p[v],h[v]))return!1;return!0}if(typeof p=="object"&&p!==null&&h!==null){if(typeof h!="object"||Object.keys(p).length!==Object.keys(h).length)return!1;for(const v in p)if(!nt(p[v],h[v]))return!1;return!0}return p===h}function Nr(p,h){p.push(h)}function br(p,h,v){Nr(v,{command:"addSource",args:[p,h[p]]})}function Ar(p,h,v){Nr(h,{command:"removeSource",args:[p]}),v[p]=!0}function zn(p,h,v,b){Ar(p,v,b),br(p,h,v)}function fi(p,h,v){let b;for(b in p[v])if(Object.prototype.hasOwnProperty.call(p[v],b)&&b!=="data"&&!nt(p[v][b],h[v][b]))return!1;for(b in h[v])if(Object.prototype.hasOwnProperty.call(h[v],b)&&b!=="data"&&!nt(p[v][b],h[v][b]))return!1;return!0}function kn(p,h,v,b,E,I){p=p||{},h=h||{};for(const k in p)Object.prototype.hasOwnProperty.call(p,k)&&(nt(p[k],h[k])||v.push({command:I,args:[b,k,h[k],E]}));for(const k in h)Object.prototype.hasOwnProperty.call(h,k)&&!Object.prototype.hasOwnProperty.call(p,k)&&(nt(p[k],h[k])||v.push({command:I,args:[b,k,h[k],E]}))}function si(p){return p.id}function Tt(p,h){return p[h.id]=h,p}class $e{constructor(h,v,b,E){this.message=(h?`${h}: `:"")+b,E&&(this.identifier=E),v!=null&&v.__line__&&(this.line=v.__line__)}}function er(p,...h){for(const v of h)for(const b in v)p[b]=v[b];return p}class sr extends Error{constructor(h,v){super(v),this.message=v,this.key=h}}class Kr{constructor(h,v=[]){this.parent=h,this.bindings={};for(const[b,E]of v)this.bindings[b]=E}concat(h){return new Kr(this,h)}get(h){if(this.bindings[h])return this.bindings[h];if(this.parent)return this.parent.get(h);throw new Error(`${h} not found in scope.`)}has(h){return!!this.bindings[h]||!!this.parent&&this.parent.has(h)}}const Ln={kind:"null"},ut={kind:"number"},hr={kind:"string"},Qt={kind:"boolean"},pi={kind:"color"},la={kind:"object"},Lt={kind:"value"},Di={kind:"collator"},Mi={kind:"formatted"},Co={kind:"padding"},Ao={kind:"resolvedImage"},xe={kind:"variableAnchorOffsetCollection"};function re(p,h){return{kind:"array",itemType:p,N:h}}function te(p){if(p.kind==="array"){const h=te(p.itemType);return typeof p.N=="number"?`array<${h}, ${p.N}>`:p.itemType.kind==="value"?"array":`array<${h}>`}return p.kind}const he=[Ln,ut,hr,Qt,pi,Mi,la,re(Lt),Co,Ao,xe];function _e(p,h){if(h.kind==="error")return null;if(p.kind==="array"){if(h.kind==="array"&&(h.N===0&&h.itemType.kind==="value"||!_e(p.itemType,h.itemType))&&(typeof p.N!="number"||p.N===h.N))return null}else{if(p.kind===h.kind)return null;if(p.kind==="value"){for(const v of he)if(!_e(v,h))return null}}return`Expected ${te(p)} but found ${te(h)} instead.`}function De(p,h){return h.some(v=>v.kind===p.kind)}function ke(p,h){return h.some(v=>v==="null"?p===null:v==="array"?Array.isArray(p):v==="object"?p&&!Array.isArray(p)&&typeof p=="object":v===typeof p)}function Ne(p,h){return p.kind==="array"&&h.kind==="array"?p.itemType.kind===h.itemType.kind&&typeof p.N=="number":p.kind===h.kind}const Ee=.96422,We=.82521,Je=4/29,Ge=6/29,ft=3*Ge*Ge,Wt=Ge*Ge*Ge,Xt=Math.PI/180,Or=180/Math.PI;function dr(p){return(p%=360)<0&&(p+=360),p}function zr([p,h,v,b]){let E,I;const k=Bn((.2225045*(p=Dr(p))+.7168786*(h=Dr(h))+.0606169*(v=Dr(v)))/1);p===h&&h===v?E=I=k:(E=Bn((.4360747*p+.3850649*h+.1430804*v)/Ee),I=Bn((.0139322*p+.0971045*h+.7141733*v)/We));const R=116*k-16;return[R<0?0:R,500*(E-k),200*(k-I),b]}function Dr(p){return p<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4)}function Bn(p){return p>Wt?Math.pow(p,1/3):p/ft+Je}function Sn([p,h,v,b]){let E=(p+16)/116,I=isNaN(h)?E:E+h/500,k=isNaN(v)?E:E-v/200;return E=1*jr(E),I=Ee*jr(I),k=We*jr(k),[xr(3.1338561*I-1.6168667*E-.4906146*k),xr(-.9787684*I+1.9161415*E+.033454*k),xr(.0719453*I-.2289914*E+1.4052427*k),b]}function xr(p){return(p=p<=.00304?12.92*p:1.055*Math.pow(p,1/2.4)-.055)<0?0:p>1?1:p}function jr(p){return p>Ge?p*p*p:ft*(p-Je)}function _n(p){return parseInt(p.padEnd(2,p),16)/255}function Yn(p,h){return li(h?p/100:p,0,1)}function li(p,h,v){return Math.min(Math.max(h,p),v)}function Ii(p){return!p.some(Number.isNaN)}const cc={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Xr{constructor(h,v,b,E=1,I=!0){this.r=h,this.g=v,this.b=b,this.a=E,I||(this.r*=E,this.g*=E,this.b*=E,E||this.overwriteGetter("rgb",[h,v,b,E]))}static parse(h){if(h instanceof Xr)return h;if(typeof h!="string")return;const v=function(b){if((b=b.toLowerCase().trim())==="transparent")return[0,0,0,0];const E=cc[b];if(E){const[k,R,z]=E;return[k/255,R/255,z/255,1]}if(b.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(b)){const k=b.length<6?1:2;let R=1;return[_n(b.slice(R,R+=k)),_n(b.slice(R,R+=k)),_n(b.slice(R,R+=k)),_n(b.slice(R,R+k)||"ff")]}if(b.startsWith("rgb")){const k=b.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(k){const[R,z,G,W,j,ee,ne,se,ce,ye,we,Oe]=k,Ae=[W||" ",ne||" ",ye].join("");if(Ae===" "||Ae===" /"||Ae===",,"||Ae===",,,"){const Re=[G,ee,ce].join(""),He=Re==="%%%"?100:Re===""?255:0;if(He){const et=[li(+z/He,0,1),li(+j/He,0,1),li(+se/He,0,1),we?Yn(+we,Oe):1];if(Ii(et))return et}}return}}const I=b.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(I){const[k,R,z,G,W,j,ee,ne,se]=I,ce=[z||" ",W||" ",ee].join("");if(ce===" "||ce===" /"||ce===",,"||ce===",,,"){const ye=[+R,li(+G,0,100),li(+j,0,100),ne?Yn(+ne,se):1];if(Ii(ye))return function([we,Oe,Ae,Re]){function He(et){const Ct=(et+we/30)%12,Yt=Oe*Math.min(Ae,1-Ae);return Ae-Yt*Math.max(-1,Math.min(Ct-3,9-Ct,1))}return we=dr(we),Oe/=100,Ae/=100,[He(0),He(8),He(4),Re]}(ye)}}}(h);return v?new Xr(...v,!1):void 0}get rgb(){const{r:h,g:v,b,a:E}=this,I=E||1/0;return this.overwriteGetter("rgb",[h/I,v/I,b/I,E])}get hcl(){return this.overwriteGetter("hcl",function(h){const[v,b,E,I]=zr(h),k=Math.sqrt(b*b+E*E);return[Math.round(1e4*k)?dr(Math.atan2(E,b)*Or):NaN,k,v,I]}(this.rgb))}get lab(){return this.overwriteGetter("lab",zr(this.rgb))}overwriteGetter(h,v){return Object.defineProperty(this,h,{value:v}),v}toString(){const[h,v,b,E]=this.rgb;return`rgba(${[h,v,b].map(I=>Math.round(255*I)).join(",")},${E})`}}Xr.black=new Xr(0,0,0,1),Xr.white=new Xr(1,1,1,1),Xr.transparent=new Xr(0,0,0,0),Xr.red=new Xr(1,0,0,1);class cv{constructor(h,v,b){this.sensitivity=h?v?"variant":"case":v?"accent":"base",this.locale=b,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(h,v){return this.collator.compare(h,v)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class uv{constructor(h,v,b,E,I){this.text=h,this.image=v,this.scale=b,this.fontStack=E,this.textColor=I}}class ca{constructor(h){this.sections=h}static fromString(h){return new ca([new uv(h,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(h=>h.text.length!==0||h.image&&h.image.name.length!==0)}static factory(h){return h instanceof ca?h:ca.fromString(h)}toString(){return this.sections.length===0?"":this.sections.map(h=>h.text).join("")}}class ua{constructor(h){this.values=h.slice()}static parse(h){if(h instanceof ua)return h;if(typeof h=="number")return new ua([h,h,h,h]);if(Array.isArray(h)&&!(h.length<1||h.length>4)){for(const v of h)if(typeof v!="number")return;switch(h.length){case 1:h=[h[0],h[0],h[0],h[0]];break;case 2:h=[h[0],h[1],h[0],h[1]];break;case 3:h=[h[0],h[1],h[2],h[1]]}return new ua(h)}}toString(){return JSON.stringify(this.values)}}const cA=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ca{constructor(h){this.values=h.slice()}static parse(h){if(h instanceof Ca)return h;if(Array.isArray(h)&&!(h.length<1)&&h.length%2==0){for(let v=0;v<h.length;v+=2){const b=h[v],E=h[v+1];if(typeof b!="string"||!cA.has(b)||!Array.isArray(E)||E.length!==2||typeof E[0]!="number"||typeof E[1]!="number")return}return new Ca(h)}}toString(){return JSON.stringify(this.values)}}class ha{constructor(h){this.name=h.name,this.available=h.available}toString(){return this.name}static fromString(h){return h?new ha({name:h,available:!1}):null}}function uc(p,h,v,b){return typeof p=="number"&&p>=0&&p<=255&&typeof h=="number"&&h>=0&&h<=255&&typeof v=="number"&&v>=0&&v<=255?b===void 0||typeof b=="number"&&b>=0&&b<=1?null:`Invalid rgba value [${[p,h,v,b].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof b=="number"?[p,h,v,b]:[p,h,v]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ol(p){if(p===null||typeof p=="string"||typeof p=="boolean"||typeof p=="number"||p instanceof Xr||p instanceof cv||p instanceof ca||p instanceof ua||p instanceof Ca||p instanceof ha)return!0;if(Array.isArray(p)){for(const h of p)if(!ol(h))return!1;return!0}if(typeof p=="object"){for(const h in p)if(!ol(p[h]))return!1;return!0}return!1}function Vn(p){if(p===null)return Ln;if(typeof p=="string")return hr;if(typeof p=="boolean")return Qt;if(typeof p=="number")return ut;if(p instanceof Xr)return pi;if(p instanceof cv)return Di;if(p instanceof ca)return Mi;if(p instanceof ua)return Co;if(p instanceof Ca)return xe;if(p instanceof ha)return Ao;if(Array.isArray(p)){const h=p.length;let v;for(const b of p){const E=Vn(b);if(v){if(v===E)continue;v=Lt;break}v=E}return re(v||Lt,h)}return la}function dh(p){const h=typeof p;return p===null?"":h==="string"||h==="number"||h==="boolean"?String(p):p instanceof Xr||p instanceof ca||p instanceof ua||p instanceof Ca||p instanceof ha?p.toString():JSON.stringify(p)}class Ua{constructor(h,v){this.type=h,this.value=v}static parse(h,v){if(h.length!==2)return v.error(`'literal' expression requires exactly one argument, but found ${h.length-1} instead.`);if(!ol(h[1]))return v.error("invalid value");const b=h[1];let E=Vn(b);const I=v.expectedType;return E.kind!=="array"||E.N!==0||!I||I.kind!=="array"||typeof I.N=="number"&&I.N!==0||(E=I),new Ua(E,b)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Pn{constructor(h){this.name="ExpressionEvaluationError",this.message=h}toJSON(){return this.message}}const af={string:hr,number:ut,boolean:Qt,object:la};class Ha{constructor(h,v){this.type=h,this.args=v}static parse(h,v){if(h.length<2)return v.error("Expected at least one argument.");let b,E=1;const I=h[0];if(I==="array"){let R,z;if(h.length>2){const G=h[1];if(typeof G!="string"||!(G in af)||G==="object")return v.error('The item type argument of "array" must be one of string, number, boolean',1);R=af[G],E++}else R=Lt;if(h.length>3){if(h[2]!==null&&(typeof h[2]!="number"||h[2]<0||h[2]!==Math.floor(h[2])))return v.error('The length argument to "array" must be a positive integer literal',2);z=h[2],E++}b=re(R,z)}else{if(!af[I])throw new Error(`Types doesn't contain name = ${I}`);b=af[I]}const k=[];for(;E<h.length;E++){const R=v.parse(h[E],E,Lt);if(!R)return null;k.push(R)}return new Ha(b,k)}evaluate(h){for(let v=0;v<this.args.length;v++){const b=this.args[v].evaluate(h);if(!_e(this.type,Vn(b)))return b;if(v===this.args.length-1)throw new Pn(`Expected value to be of type ${te(this.type)}, but found ${te(Vn(b))} instead.`)}throw new Error}eachChild(h){this.args.forEach(h)}outputDefined(){return this.args.every(h=>h.outputDefined())}}const hv={"to-boolean":Qt,"to-color":pi,"to-number":ut,"to-string":hr};class Wa{constructor(h,v){this.type=h,this.args=v}static parse(h,v){if(h.length<2)return v.error("Expected at least one argument.");const b=h[0];if(!hv[b])throw new Error(`Can't parse ${b} as it is not part of the known types`);if((b==="to-boolean"||b==="to-string")&&h.length!==2)return v.error("Expected one argument.");const E=hv[b],I=[];for(let k=1;k<h.length;k++){const R=v.parse(h[k],k,Lt);if(!R)return null;I.push(R)}return new Wa(E,I)}evaluate(h){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(h);case"color":{let v,b;for(const E of this.args){if(v=E.evaluate(h),b=null,v instanceof Xr)return v;if(typeof v=="string"){const I=h.parseColor(v);if(I)return I}else if(Array.isArray(v)&&(b=v.length<3||v.length>4?`Invalid rbga value ${JSON.stringify(v)}: expected an array containing either three or four numeric values.`:uc(v[0],v[1],v[2],v[3]),!b))return new Xr(v[0]/255,v[1]/255,v[2]/255,v[3])}throw new Pn(b||`Could not parse color from value '${typeof v=="string"?v:JSON.stringify(v)}'`)}case"padding":{let v;for(const b of this.args){v=b.evaluate(h);const E=ua.parse(v);if(E)return E}throw new Pn(`Could not parse padding from value '${typeof v=="string"?v:JSON.stringify(v)}'`)}case"variableAnchorOffsetCollection":{let v;for(const b of this.args){v=b.evaluate(h);const E=Ca.parse(v);if(E)return E}throw new Pn(`Could not parse variableAnchorOffsetCollection from value '${typeof v=="string"?v:JSON.stringify(v)}'`)}case"number":{let v=null;for(const b of this.args){if(v=b.evaluate(h),v===null)return 0;const E=Number(v);if(!isNaN(E))return E}throw new Pn(`Could not convert ${JSON.stringify(v)} to number.`)}case"formatted":return ca.fromString(dh(this.args[0].evaluate(h)));case"resolvedImage":return ha.fromString(dh(this.args[0].evaluate(h)));default:return dh(this.args[0].evaluate(h))}}eachChild(h){this.args.forEach(h)}outputDefined(){return this.args.every(h=>h.outputDefined())}}const uA=["Unknown","Point","LineString","Polygon"];class of{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?uA[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(h){let v=this._parseColorCache[h];return v||(v=this._parseColorCache[h]=Xr.parse(h)),v}}class sl{constructor(h,v,b=[],E,I=new Kr,k=[]){this.registry=h,this.path=b,this.key=b.map(R=>`[${R}]`).join(""),this.scope=I,this.errors=k,this.expectedType=E,this._isConstant=v}parse(h,v,b,E,I={}){return v?this.concat(v,b,E)._parse(h,I):this._parse(h,I)}_parse(h,v){function b(E,I,k){return k==="assert"?new Ha(I,[E]):k==="coerce"?new Wa(I,[E]):E}if(h!==null&&typeof h!="string"&&typeof h!="boolean"&&typeof h!="number"||(h=["literal",h]),Array.isArray(h)){if(h.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const E=h[0];if(typeof E!="string")return this.error(`Expression name must be a string, but found ${typeof E} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const I=this.registry[E];if(I){let k=I.parse(h,this);if(!k)return null;if(this.expectedType){const R=this.expectedType,z=k.type;if(R.kind!=="string"&&R.kind!=="number"&&R.kind!=="boolean"&&R.kind!=="object"&&R.kind!=="array"||z.kind!=="value")if(R.kind!=="color"&&R.kind!=="formatted"&&R.kind!=="resolvedImage"||z.kind!=="value"&&z.kind!=="string")if(R.kind!=="padding"||z.kind!=="value"&&z.kind!=="number"&&z.kind!=="array")if(R.kind!=="variableAnchorOffsetCollection"||z.kind!=="value"&&z.kind!=="array"){if(this.checkSubtype(R,z))return null}else k=b(k,R,v.typeAnnotation||"coerce");else k=b(k,R,v.typeAnnotation||"coerce");else k=b(k,R,v.typeAnnotation||"coerce");else k=b(k,R,v.typeAnnotation||"assert")}if(!(k instanceof Ua)&&k.type.kind!=="resolvedImage"&&this._isConstant(k)){const R=new of;try{k=new Ua(k.type,k.evaluate(R))}catch(z){return this.error(z.message),null}}return k}return this.error(`Unknown expression "${E}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(h===void 0?"'undefined' value invalid. Use null instead.":typeof h=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof h} instead.`)}concat(h,v,b){const E=typeof h=="number"?this.path.concat(h):this.path,I=b?this.scope.concat(b):this.scope;return new sl(this.registry,this._isConstant,E,v||null,I,this.errors)}error(h,...v){const b=`${this.key}${v.map(E=>`[${E}]`).join("")}`;this.errors.push(new sr(b,h))}checkSubtype(h,v){const b=_e(h,v);return b&&this.error(b),b}}class As{constructor(h,v){this.type=v.type,this.bindings=[].concat(h),this.result=v}evaluate(h){return this.result.evaluate(h)}eachChild(h){for(const v of this.bindings)h(v[1]);h(this.result)}static parse(h,v){if(h.length<4)return v.error(`Expected at least 3 arguments, but found ${h.length-1} instead.`);const b=[];for(let I=1;I<h.length-1;I+=2){const k=h[I];if(typeof k!="string")return v.error(`Expected string, but found ${typeof k} instead.`,I);if(/[^a-zA-Z0-9_]/.test(k))return v.error("Variable names must contain only alphanumeric characters or '_'.",I);const R=v.parse(h[I+1],I+1);if(!R)return null;b.push([k,R])}const E=v.parse(h[h.length-1],h.length-1,v.expectedType,b);return E?new As(b,E):null}outputDefined(){return this.result.outputDefined()}}class Ur{constructor(h,v){this.type=v.type,this.name=h,this.boundExpression=v}static parse(h,v){if(h.length!==2||typeof h[1]!="string")return v.error("'var' expression requires exactly one string literal argument.");const b=h[1];return v.scope.has(b)?new Ur(b,v.scope.get(b)):v.error(`Unknown variable "${b}". Make sure "${b}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(h){return this.boundExpression.evaluate(h)}eachChild(){}outputDefined(){return!1}}class dv{constructor(h,v,b){this.type=h,this.index=v,this.input=b}static parse(h,v){if(h.length!==3)return v.error(`Expected 2 arguments, but found ${h.length-1} instead.`);const b=v.parse(h[1],1,ut),E=v.parse(h[2],2,re(v.expectedType||Lt));return b&&E?new dv(E.type.itemType,b,E):null}evaluate(h){const v=this.index.evaluate(h),b=this.input.evaluate(h);if(v<0)throw new Pn(`Array index out of bounds: ${v} < 0.`);if(v>=b.length)throw new Pn(`Array index out of bounds: ${v} > ${b.length-1}.`);if(v!==Math.floor(v))throw new Pn(`Array index must be an integer, but found ${v} instead.`);return b[v]}eachChild(h){h(this.index),h(this.input)}outputDefined(){return!1}}class fv{constructor(h,v){this.type=Qt,this.needle=h,this.haystack=v}static parse(h,v){if(h.length!==3)return v.error(`Expected 2 arguments, but found ${h.length-1} instead.`);const b=v.parse(h[1],1,Lt),E=v.parse(h[2],2,Lt);return b&&E?De(b.type,[Qt,hr,ut,Ln,Lt])?new fv(b,E):v.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(b.type)} instead`):null}evaluate(h){const v=this.needle.evaluate(h),b=this.haystack.evaluate(h);if(!b)return!1;if(!ke(v,["boolean","string","number","null"]))throw new Pn(`Expected first argument to be of type boolean, string, number or null, but found ${te(Vn(v))} instead.`);if(!ke(b,["string","array"]))throw new Pn(`Expected second argument to be of type array or string, but found ${te(Vn(b))} instead.`);return b.indexOf(v)>=0}eachChild(h){h(this.needle),h(this.haystack)}outputDefined(){return!0}}class hc{constructor(h,v,b){this.type=ut,this.needle=h,this.haystack=v,this.fromIndex=b}static parse(h,v){if(h.length<=2||h.length>=5)return v.error(`Expected 3 or 4 arguments, but found ${h.length-1} instead.`);const b=v.parse(h[1],1,Lt),E=v.parse(h[2],2,Lt);if(!b||!E)return null;if(!De(b.type,[Qt,hr,ut,Ln,Lt]))return v.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(b.type)} instead`);if(h.length===4){const I=v.parse(h[3],3,ut);return I?new hc(b,E,I):null}return new hc(b,E)}evaluate(h){const v=this.needle.evaluate(h),b=this.haystack.evaluate(h);if(!ke(v,["boolean","string","number","null"]))throw new Pn(`Expected first argument to be of type boolean, string, number or null, but found ${te(Vn(v))} instead.`);let E;if(this.fromIndex&&(E=this.fromIndex.evaluate(h)),ke(b,["string"])){const I=b.indexOf(v,E);return I===-1?-1:[...b.slice(0,I)].length}if(ke(b,["array"]))return b.indexOf(v,E);throw new Pn(`Expected second argument to be of type array or string, but found ${te(Vn(b))} instead.`)}eachChild(h){h(this.needle),h(this.haystack),this.fromIndex&&h(this.fromIndex)}outputDefined(){return!1}}class pv{constructor(h,v,b,E,I,k){this.inputType=h,this.type=v,this.input=b,this.cases=E,this.outputs=I,this.otherwise=k}static parse(h,v){if(h.length<5)return v.error(`Expected at least 4 arguments, but found only ${h.length-1}.`);if(h.length%2!=1)return v.error("Expected an even number of arguments.");let b,E;v.expectedType&&v.expectedType.kind!=="value"&&(E=v.expectedType);const I={},k=[];for(let G=2;G<h.length-1;G+=2){let W=h[G];const j=h[G+1];Array.isArray(W)||(W=[W]);const ee=v.concat(G);if(W.length===0)return ee.error("Expected at least one branch label.");for(const se of W){if(typeof se!="number"&&typeof se!="string")return ee.error("Branch labels must be numbers or strings.");if(typeof se=="number"&&Math.abs(se)>Number.MAX_SAFE_INTEGER)return ee.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof se=="number"&&Math.floor(se)!==se)return ee.error("Numeric branch labels must be integer values.");if(b){if(ee.checkSubtype(b,Vn(se)))return null}else b=Vn(se);if(I[String(se)]!==void 0)return ee.error("Branch labels must be unique.");I[String(se)]=k.length}const ne=v.parse(j,G,E);if(!ne)return null;E=E||ne.type,k.push(ne)}const R=v.parse(h[1],1,Lt);if(!R)return null;const z=v.parse(h[h.length-1],h.length-1,E);return z?R.type.kind!=="value"&&v.concat(1).checkSubtype(b,R.type)?null:new pv(b,E,R,I,k,z):null}evaluate(h){const v=this.input.evaluate(h);return(Vn(v)===this.inputType&&this.outputs[this.cases[v]]||this.otherwise).evaluate(h)}eachChild(h){h(this.input),this.outputs.forEach(h),h(this.otherwise)}outputDefined(){return this.outputs.every(h=>h.outputDefined())&&this.otherwise.outputDefined()}}class sf{constructor(h,v,b){this.type=h,this.branches=v,this.otherwise=b}static parse(h,v){if(h.length<4)return v.error(`Expected at least 3 arguments, but found only ${h.length-1}.`);if(h.length%2!=0)return v.error("Expected an odd number of arguments.");let b;v.expectedType&&v.expectedType.kind!=="value"&&(b=v.expectedType);const E=[];for(let k=1;k<h.length-1;k+=2){const R=v.parse(h[k],k,Qt);if(!R)return null;const z=v.parse(h[k+1],k+1,b);if(!z)return null;E.push([R,z]),b=b||z.type}const I=v.parse(h[h.length-1],h.length-1,b);if(!I)return null;if(!b)throw new Error("Can't infer output type");return new sf(b,E,I)}evaluate(h){for(const[v,b]of this.branches)if(v.evaluate(h))return b.evaluate(h);return this.otherwise.evaluate(h)}eachChild(h){for(const[v,b]of this.branches)h(v),h(b);h(this.otherwise)}outputDefined(){return this.branches.every(([h,v])=>v.outputDefined())&&this.otherwise.outputDefined()}}class fh{constructor(h,v,b,E){this.type=h,this.input=v,this.beginIndex=b,this.endIndex=E}static parse(h,v){if(h.length<=2||h.length>=5)return v.error(`Expected 3 or 4 arguments, but found ${h.length-1} instead.`);const b=v.parse(h[1],1,Lt),E=v.parse(h[2],2,ut);if(!b||!E)return null;if(!De(b.type,[re(Lt),hr,Lt]))return v.error(`Expected first argument to be of type array or string, but found ${te(b.type)} instead`);if(h.length===4){const I=v.parse(h[3],3,ut);return I?new fh(b.type,b,E,I):null}return new fh(b.type,b,E)}evaluate(h){const v=this.input.evaluate(h),b=this.beginIndex.evaluate(h);let E;if(this.endIndex&&(E=this.endIndex.evaluate(h)),ke(v,["string"]))return[...v].slice(b,E).join("");if(ke(v,["array"]))return v.slice(b,E);throw new Pn(`Expected first argument to be of type array or string, but found ${te(Vn(v))} instead.`)}eachChild(h){h(this.input),h(this.beginIndex),this.endIndex&&h(this.endIndex)}outputDefined(){return!1}}function lf(p,h){const v=p.length-1;let b,E,I=0,k=v,R=0;for(;I<=k;)if(R=Math.floor((I+k)/2),b=p[R],E=p[R+1],b<=h){if(R===v||h<E)return R;I=R+1}else{if(!(b>h))throw new Pn("Input is not a number.");k=R-1}return 0}class dc{constructor(h,v,b){this.type=h,this.input=v,this.labels=[],this.outputs=[];for(const[E,I]of b)this.labels.push(E),this.outputs.push(I)}static parse(h,v){if(h.length-1<4)return v.error(`Expected at least 4 arguments, but found only ${h.length-1}.`);if((h.length-1)%2!=0)return v.error("Expected an even number of arguments.");const b=v.parse(h[1],1,ut);if(!b)return null;const E=[];let I=null;v.expectedType&&v.expectedType.kind!=="value"&&(I=v.expectedType);for(let k=1;k<h.length;k+=2){const R=k===1?-1/0:h[k],z=h[k+1],G=k,W=k+1;if(typeof R!="number")return v.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',G);if(E.length&&E[E.length-1][0]>=R)return v.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',G);const j=v.parse(z,W,I);if(!j)return null;I=I||j.type,E.push([R,j])}return new dc(I,b,E)}evaluate(h){const v=this.labels,b=this.outputs;if(v.length===1)return b[0].evaluate(h);const E=this.input.evaluate(h);if(E<=v[0])return b[0].evaluate(h);const I=v.length;return E>=v[I-1]?b[I-1].evaluate(h):b[lf(v,E)].evaluate(h)}eachChild(h){h(this.input);for(const v of this.outputs)h(v)}outputDefined(){return this.outputs.every(h=>h.outputDefined())}}function nb(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var hA=ib;function ib(p,h,v,b){this.cx=3*p,this.bx=3*(v-p)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(b-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=p,this.p1y=h,this.p2x=v,this.p2y=b}ib.prototype={sampleCurveX:function(p){return((this.ax*p+this.bx)*p+this.cx)*p},sampleCurveY:function(p){return((this.ay*p+this.by)*p+this.cy)*p},sampleCurveDerivativeX:function(p){return(3*this.ax*p+2*this.bx)*p+this.cx},solveCurveX:function(p,h){if(h===void 0&&(h=1e-6),p<0)return 0;if(p>1)return 1;for(var v=p,b=0;b<8;b++){var E=this.sampleCurveX(v)-p;if(Math.abs(E)<h)return v;var I=this.sampleCurveDerivativeX(v);if(Math.abs(I)<1e-6)break;v-=E/I}var k=0,R=1;for(v=p,b=0;b<20&&(E=this.sampleCurveX(v),!(Math.abs(E-p)<h));b++)p>E?k=v:R=v,v=.5*(R-k)+k;return v},solve:function(p,h){return this.sampleCurveY(this.solveCurveX(p,h))}};var dA=nb(hA);function ll(p,h,v){return p+v*(h-p)}function ph(p,h,v){return p.map((b,E)=>ll(b,h[E],v))}const $i={number:ll,color:function(p,h,v,b="rgb"){switch(b){case"rgb":{const[E,I,k,R]=ph(p.rgb,h.rgb,v);return new Xr(E,I,k,R,!1)}case"hcl":{const[E,I,k,R]=p.hcl,[z,G,W,j]=h.hcl;let ee,ne;if(isNaN(E)||isNaN(z))isNaN(E)?isNaN(z)?ee=NaN:(ee=z,k!==1&&k!==0||(ne=G)):(ee=E,W!==1&&W!==0||(ne=I));else{let Oe=z-E;z>E&&Oe>180?Oe-=360:z<E&&E-z>180&&(Oe+=360),ee=E+v*Oe}const[se,ce,ye,we]=function([Oe,Ae,Re,He]){return Oe=isNaN(Oe)?0:Oe*Xt,Sn([Re,Math.cos(Oe)*Ae,Math.sin(Oe)*Ae,He])}([ee,ne??ll(I,G,v),ll(k,W,v),ll(R,j,v)]);return new Xr(se,ce,ye,we,!1)}case"lab":{const[E,I,k,R]=Sn(ph(p.lab,h.lab,v));return new Xr(E,I,k,R,!1)}}},array:ph,padding:function(p,h,v){return new ua(ph(p.values,h.values,v))},variableAnchorOffsetCollection:function(p,h,v){const b=p.values,E=h.values;if(b.length!==E.length)throw new Pn(`Cannot interpolate values of different length. from: ${p.toString()}, to: ${h.toString()}`);const I=[];for(let k=0;k<b.length;k+=2){if(b[k]!==E[k])throw new Pn(`Cannot interpolate values containing mismatched anchors. from[${k}]: ${b[k]}, to[${k}]: ${E[k]}`);I.push(b[k]);const[R,z]=b[k+1],[G,W]=E[k+1];I.push([ll(R,G,v),ll(z,W,v)])}return new Ca(I)}};class Gi{constructor(h,v,b,E,I){this.type=h,this.operator=v,this.interpolation=b,this.input=E,this.labels=[],this.outputs=[];for(const[k,R]of I)this.labels.push(k),this.outputs.push(R)}static interpolationFactor(h,v,b,E){let I=0;if(h.name==="exponential")I=cf(v,h.base,b,E);else if(h.name==="linear")I=cf(v,1,b,E);else if(h.name==="cubic-bezier"){const k=h.controlPoints;I=new dA(k[0],k[1],k[2],k[3]).solve(cf(v,1,b,E))}return I}static parse(h,v){let[b,E,I,...k]=h;if(!Array.isArray(E)||E.length===0)return v.error("Expected an interpolation type expression.",1);if(E[0]==="linear")E={name:"linear"};else if(E[0]==="exponential"){const G=E[1];if(typeof G!="number")return v.error("Exponential interpolation requires a numeric base.",1,1);E={name:"exponential",base:G}}else{if(E[0]!=="cubic-bezier")return v.error(`Unknown interpolation type ${String(E[0])}`,1,0);{const G=E.slice(1);if(G.length!==4||G.some(W=>typeof W!="number"||W<0||W>1))return v.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);E={name:"cubic-bezier",controlPoints:G}}}if(h.length-1<4)return v.error(`Expected at least 4 arguments, but found only ${h.length-1}.`);if((h.length-1)%2!=0)return v.error("Expected an even number of arguments.");if(I=v.parse(I,2,ut),!I)return null;const R=[];let z=null;b==="interpolate-hcl"||b==="interpolate-lab"?z=pi:v.expectedType&&v.expectedType.kind!=="value"&&(z=v.expectedType);for(let G=0;G<k.length;G+=2){const W=k[G],j=k[G+1],ee=G+3,ne=G+4;if(typeof W!="number")return v.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ee);if(R.length&&R[R.length-1][0]>=W)return v.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',ee);const se=v.parse(j,ne,z);if(!se)return null;z=z||se.type,R.push([W,se])}return Ne(z,ut)||Ne(z,pi)||Ne(z,Co)||Ne(z,xe)||Ne(z,re(ut))?new Gi(z,b,E,I,R):v.error(`Type ${te(z)} is not interpolatable.`)}evaluate(h){const v=this.labels,b=this.outputs;if(v.length===1)return b[0].evaluate(h);const E=this.input.evaluate(h);if(E<=v[0])return b[0].evaluate(h);const I=v.length;if(E>=v[I-1])return b[I-1].evaluate(h);const k=lf(v,E),R=Gi.interpolationFactor(this.interpolation,E,v[k],v[k+1]),z=b[k].evaluate(h),G=b[k+1].evaluate(h);switch(this.operator){case"interpolate":return $i[this.type.kind](z,G,R);case"interpolate-hcl":return $i.color(z,G,R,"hcl");case"interpolate-lab":return $i.color(z,G,R,"lab")}}eachChild(h){h(this.input);for(const v of this.outputs)h(v)}outputDefined(){return this.outputs.every(h=>h.outputDefined())}}function cf(p,h,v,b){const E=b-v,I=p-v;return E===0?0:h===1?I/E:(Math.pow(h,I)-1)/(Math.pow(h,E)-1)}class uf{constructor(h,v){this.type=h,this.args=v}static parse(h,v){if(h.length<2)return v.error("Expectected at least one argument.");let b=null;const E=v.expectedType;E&&E.kind!=="value"&&(b=E);const I=[];for(const R of h.slice(1)){const z=v.parse(R,1+I.length,b,void 0,{typeAnnotation:"omit"});if(!z)return null;b=b||z.type,I.push(z)}if(!b)throw new Error("No output type");const k=E&&I.some(R=>_e(E,R.type));return new uf(k?Lt:b,I)}evaluate(h){let v,b=null,E=0;for(const I of this.args)if(E++,b=I.evaluate(h),b&&b instanceof ha&&!b.available&&(v||(v=b.name),b=null,E===this.args.length&&(b=v)),b!==null)break;return b}eachChild(h){this.args.forEach(h)}outputDefined(){return this.args.every(h=>h.outputDefined())}}function hf(p,h){return p==="=="||p==="!="?h.kind==="boolean"||h.kind==="string"||h.kind==="number"||h.kind==="null"||h.kind==="value":h.kind==="string"||h.kind==="number"||h.kind==="value"}function ab(p,h,v,b){return b.compare(h,v)===0}function fc(p,h,v){const b=p!=="=="&&p!=="!=";return class AG{constructor(I,k,R){this.type=Qt,this.lhs=I,this.rhs=k,this.collator=R,this.hasUntypedArgument=I.type.kind==="value"||k.type.kind==="value"}static parse(I,k){if(I.length!==3&&I.length!==4)return k.error("Expected two or three arguments.");const R=I[0];let z=k.parse(I[1],1,Lt);if(!z)return null;if(!hf(R,z.type))return k.concat(1).error(`"${R}" comparisons are not supported for type '${te(z.type)}'.`);let G=k.parse(I[2],2,Lt);if(!G)return null;if(!hf(R,G.type))return k.concat(2).error(`"${R}" comparisons are not supported for type '${te(G.type)}'.`);if(z.type.kind!==G.type.kind&&z.type.kind!=="value"&&G.type.kind!=="value")return k.error(`Cannot compare types '${te(z.type)}' and '${te(G.type)}'.`);b&&(z.type.kind==="value"&&G.type.kind!=="value"?z=new Ha(G.type,[z]):z.type.kind!=="value"&&G.type.kind==="value"&&(G=new Ha(z.type,[G])));let W=null;if(I.length===4){if(z.type.kind!=="string"&&G.type.kind!=="string"&&z.type.kind!=="value"&&G.type.kind!=="value")return k.error("Cannot use collator to compare non-string types.");if(W=k.parse(I[3],3,Di),!W)return null}return new AG(z,G,W)}evaluate(I){const k=this.lhs.evaluate(I),R=this.rhs.evaluate(I);if(b&&this.hasUntypedArgument){const z=Vn(k),G=Vn(R);if(z.kind!==G.kind||z.kind!=="string"&&z.kind!=="number")throw new Pn(`Expected arguments for "${p}" to be (string, string) or (number, number), but found (${z.kind}, ${G.kind}) instead.`)}if(this.collator&&!b&&this.hasUntypedArgument){const z=Vn(k),G=Vn(R);if(z.kind!=="string"||G.kind!=="string")return h(I,k,R)}return this.collator?v(I,k,R,this.collator.evaluate(I)):h(I,k,R)}eachChild(I){I(this.lhs),I(this.rhs),this.collator&&I(this.collator)}outputDefined(){return!0}}}const fA=fc("==",function(p,h,v){return h===v},ab),ob=fc("!=",function(p,h,v){return h!==v},function(p,h,v,b){return!ab(0,h,v,b)}),sb=fc("<",function(p,h,v){return h<v},function(p,h,v,b){return b.compare(h,v)<0}),pA=fc(">",function(p,h,v){return h>v},function(p,h,v,b){return b.compare(h,v)>0}),gA=fc("<=",function(p,h,v){return h<=v},function(p,h,v,b){return b.compare(h,v)<=0}),lb=fc(">=",function(p,h,v){return h>=v},function(p,h,v,b){return b.compare(h,v)>=0});class gh{constructor(h,v,b){this.type=Di,this.locale=b,this.caseSensitive=h,this.diacriticSensitive=v}static parse(h,v){if(h.length!==2)return v.error("Expected one argument.");const b=h[1];if(typeof b!="object"||Array.isArray(b))return v.error("Collator options argument must be an object.");const E=v.parse(b["case-sensitive"]!==void 0&&b["case-sensitive"],1,Qt);if(!E)return null;const I=v.parse(b["diacritic-sensitive"]!==void 0&&b["diacritic-sensitive"],1,Qt);if(!I)return null;let k=null;return b.locale&&(k=v.parse(b.locale,1,hr),!k)?null:new gh(E,I,k)}evaluate(h){return new cv(this.caseSensitive.evaluate(h),this.diacriticSensitive.evaluate(h),this.locale?this.locale.evaluate(h):null)}eachChild(h){h(this.caseSensitive),h(this.diacriticSensitive),this.locale&&h(this.locale)}outputDefined(){return!1}}class gv{constructor(h,v,b,E,I){this.type=hr,this.number=h,this.locale=v,this.currency=b,this.minFractionDigits=E,this.maxFractionDigits=I}static parse(h,v){if(h.length!==3)return v.error("Expected two arguments.");const b=v.parse(h[1],1,ut);if(!b)return null;const E=h[2];if(typeof E!="object"||Array.isArray(E))return v.error("NumberFormat options argument must be an object.");let I=null;if(E.locale&&(I=v.parse(E.locale,1,hr),!I))return null;let k=null;if(E.currency&&(k=v.parse(E.currency,1,hr),!k))return null;let R=null;if(E["min-fraction-digits"]&&(R=v.parse(E["min-fraction-digits"],1,ut),!R))return null;let z=null;return E["max-fraction-digits"]&&(z=v.parse(E["max-fraction-digits"],1,ut),!z)?null:new gv(b,I,k,R,z)}evaluate(h){return new Intl.NumberFormat(this.locale?this.locale.evaluate(h):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(h):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(h):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(h):void 0}).format(this.number.evaluate(h))}eachChild(h){h(this.number),this.locale&&h(this.locale),this.currency&&h(this.currency),this.minFractionDigits&&h(this.minFractionDigits),this.maxFractionDigits&&h(this.maxFractionDigits)}outputDefined(){return!1}}class df{constructor(h){this.type=Mi,this.sections=h}static parse(h,v){if(h.length<2)return v.error("Expected at least one argument.");const b=h[1];if(!Array.isArray(b)&&typeof b=="object")return v.error("First argument must be an image or text section.");const E=[];let I=!1;for(let k=1;k<=h.length-1;++k){const R=h[k];if(I&&typeof R=="object"&&!Array.isArray(R)){I=!1;let z=null;if(R["font-scale"]&&(z=v.parse(R["font-scale"],1,ut),!z))return null;let G=null;if(R["text-font"]&&(G=v.parse(R["text-font"],1,re(hr)),!G))return null;let W=null;if(R["text-color"]&&(W=v.parse(R["text-color"],1,pi),!W))return null;const j=E[E.length-1];j.scale=z,j.font=G,j.textColor=W}else{const z=v.parse(h[k],1,Lt);if(!z)return null;const G=z.type.kind;if(G!=="string"&&G!=="value"&&G!=="null"&&G!=="resolvedImage")return v.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");I=!0,E.push({content:z,scale:null,font:null,textColor:null})}}return new df(E)}evaluate(h){return new ca(this.sections.map(v=>{const b=v.content.evaluate(h);return Vn(b)===Ao?new uv("",b,null,null,null):new uv(dh(b),null,v.scale?v.scale.evaluate(h):null,v.font?v.font.evaluate(h).join(","):null,v.textColor?v.textColor.evaluate(h):null)}))}eachChild(h){for(const v of this.sections)h(v.content),v.scale&&h(v.scale),v.font&&h(v.font),v.textColor&&h(v.textColor)}outputDefined(){return!1}}class vv{constructor(h){this.type=Ao,this.input=h}static parse(h,v){if(h.length!==2)return v.error("Expected two arguments.");const b=v.parse(h[1],1,hr);return b?new vv(b):v.error("No image name provided.")}evaluate(h){const v=this.input.evaluate(h),b=ha.fromString(v);return b&&h.availableImages&&(b.available=h.availableImages.indexOf(v)>-1),b}eachChild(h){h(this.input)}outputDefined(){return!1}}class mv{constructor(h){this.type=ut,this.input=h}static parse(h,v){if(h.length!==2)return v.error(`Expected 1 argument, but found ${h.length-1} instead.`);const b=v.parse(h[1],1);return b?b.type.kind!=="array"&&b.type.kind!=="string"&&b.type.kind!=="value"?v.error(`Expected argument of type string or array, but found ${te(b.type)} instead.`):new mv(b):null}evaluate(h){const v=this.input.evaluate(h);if(typeof v=="string")return[...v].length;if(Array.isArray(v))return v.length;throw new Pn(`Expected value to be of type string or array, but found ${te(Vn(v))} instead.`)}eachChild(h){h(this.input)}outputDefined(){return!1}}const Do=8192;function vA(p,h){const v=(180+p[0])/360,b=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p[1]*Math.PI/360)))/360,E=Math.pow(2,h.z);return[Math.round(v*E*Do),Math.round(b*E*Do)]}function yv(p,h){const v=Math.pow(2,h.z);return[(E=(p[0]/Do+h.x)/v,360*E-180),(b=(p[1]/Do+h.y)/v,360/Math.PI*Math.atan(Math.exp((180-360*b)*Math.PI/180))-90)];var b,E}function cl(p,h){p[0]=Math.min(p[0],h[0]),p[1]=Math.min(p[1],h[1]),p[2]=Math.max(p[2],h[0]),p[3]=Math.max(p[3],h[1])}function Ds(p,h){return!(p[0]<=h[0]||p[2]>=h[2]||p[1]<=h[1]||p[3]>=h[3])}function Wr(p,h,v){const b=p[0]-h[0],E=p[1]-h[1],I=p[0]-v[0],k=p[1]-v[1];return b*k-I*E==0&&b*I<=0&&E*k<=0}function ff(p,h,v,b){return(E=[b[0]-v[0],b[1]-v[1]])[0]*(I=[h[0]-p[0],h[1]-p[1]])[1]-E[1]*I[0]!=0&&!(!ub(p,h,v,b)||!ub(v,b,p,h));var E,I}function mA(p,h,v){for(const b of v)for(let E=0;E<b.length-1;++E)if(ff(p,h,b[E],b[E+1]))return!0;return!1}function pc(p,h,v=!1){let b=!1;for(const R of h)for(let z=0;z<R.length-1;z++){if(Wr(p,R[z],R[z+1]))return v;(I=R[z])[1]>(E=p)[1]!=(k=R[z+1])[1]>E[1]&&E[0]<(k[0]-I[0])*(E[1]-I[1])/(k[1]-I[1])+I[0]&&(b=!b)}var E,I,k;return b}function yA(p,h){for(const v of h)if(pc(p,v))return!0;return!1}function cb(p,h){for(const v of p)if(!pc(v,h))return!1;for(let v=0;v<p.length-1;++v)if(mA(p[v],p[v+1],h))return!1;return!0}function _A(p,h){for(const v of h)if(cb(p,v))return!0;return!1}function ub(p,h,v,b){const E=b[0]-v[0],I=b[1]-v[1],k=(p[0]-v[0])*I-E*(p[1]-v[1]),R=(h[0]-v[0])*I-E*(h[1]-v[1]);return k>0&&R<0||k<0&&R>0}function _v(p,h,v){const b=[];for(let E=0;E<p.length;E++){const I=[];for(let k=0;k<p[E].length;k++){const R=vA(p[E][k],v);cl(h,R),I.push(R)}b.push(I)}return b}function hb(p,h,v){const b=[];for(let E=0;E<p.length;E++){const I=_v(p[E],h,v);b.push(I)}return b}function db(p,h,v,b){if(p[0]<v[0]||p[0]>v[2]){const E=.5*b;let I=p[0]-v[0]>E?-b:v[0]-p[0]>E?b:0;I===0&&(I=p[0]-v[2]>E?-b:v[2]-p[0]>E?b:0),p[0]+=I}cl(h,p)}function fb(p,h,v,b){const E=Math.pow(2,b.z)*Do,I=[b.x*Do,b.y*Do],k=[];for(const R of p)for(const z of R){const G=[z.x+I[0],z.y+I[1]];db(G,h,v,E),k.push(G)}return k}function pb(p,h,v,b){const E=Math.pow(2,b.z)*Do,I=[b.x*Do,b.y*Do],k=[];for(const z of p){const G=[];for(const W of z){const j=[W.x+I[0],W.y+I[1]];cl(h,j),G.push(j)}k.push(G)}if(h[2]-h[0]<=E/2){(R=h)[0]=R[1]=1/0,R[2]=R[3]=-1/0;for(const z of k)for(const G of z)db(G,h,v,E)}var R;return k}class ul{constructor(h,v){this.type=Qt,this.geojson=h,this.geometries=v}static parse(h,v){if(h.length!==2)return v.error(`'within' expression requires exactly one argument, but found ${h.length-1} instead.`);if(ol(h[1])){const b=h[1];if(b.type==="FeatureCollection"){const E=[];for(const I of b.features){const{type:k,coordinates:R}=I.geometry;k==="Polygon"&&E.push(R),k==="MultiPolygon"&&E.push(...R)}if(E.length)return new ul(b,{type:"MultiPolygon",coordinates:E})}else if(b.type==="Feature"){const E=b.geometry.type;if(E==="Polygon"||E==="MultiPolygon")return new ul(b,b.geometry)}else if(b.type==="Polygon"||b.type==="MultiPolygon")return new ul(b,b)}return v.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(h){if(h.geometry()!=null&&h.canonicalID()!=null){if(h.geometryType()==="Point")return function(v,b){const E=[1/0,1/0,-1/0,-1/0],I=[1/0,1/0,-1/0,-1/0],k=v.canonicalID();if(b.type==="Polygon"){const R=_v(b.coordinates,I,k),z=fb(v.geometry(),E,I,k);if(!Ds(E,I))return!1;for(const G of z)if(!pc(G,R))return!1}if(b.type==="MultiPolygon"){const R=hb(b.coordinates,I,k),z=fb(v.geometry(),E,I,k);if(!Ds(E,I))return!1;for(const G of z)if(!yA(G,R))return!1}return!0}(h,this.geometries);if(h.geometryType()==="LineString")return function(v,b){const E=[1/0,1/0,-1/0,-1/0],I=[1/0,1/0,-1/0,-1/0],k=v.canonicalID();if(b.type==="Polygon"){const R=_v(b.coordinates,I,k),z=pb(v.geometry(),E,I,k);if(!Ds(E,I))return!1;for(const G of z)if(!cb(G,R))return!1}if(b.type==="MultiPolygon"){const R=hb(b.coordinates,I,k),z=pb(v.geometry(),E,I,k);if(!Ds(E,I))return!1;for(const G of z)if(!_A(G,R))return!1}return!0}(h,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let gb=class{constructor(p=[],h=(v,b)=>v<b?-1:v>b?1:0){if(this.data=p,this.length=this.data.length,this.compare=h,this.length>0)for(let v=(this.length>>1)-1;v>=0;v--)this._down(v)}push(p){this.data.push(p),this._up(this.length++)}pop(){if(this.length===0)return;const p=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),p}peek(){return this.data[0]}_up(p){const{data:h,compare:v}=this,b=h[p];for(;p>0;){const E=p-1>>1,I=h[E];if(v(b,I)>=0)break;h[p]=I,p=E}h[p]=b}_down(p){const{data:h,compare:v}=this,b=this.length>>1,E=h[p];for(;p<b;){let I=1+(p<<1);const k=I+1;if(k<this.length&&v(h[k],h[I])<0&&(I=k),v(h[I],E)>=0)break;h[p]=h[I],p=I}h[p]=E}};function bA(p,h,v,b,E){vb(p,h,v,b||p.length-1,E||xA)}function vb(p,h,v,b,E){for(;b>v;){if(b-v>600){var I=b-v+1,k=h-v+1,R=Math.log(I),z=.5*Math.exp(2*R/3),G=.5*Math.sqrt(R*z*(I-z)/I)*(k-I/2<0?-1:1);vb(p,h,Math.max(v,Math.floor(h-k*z/I+G)),Math.min(b,Math.floor(h+(I-k)*z/I+G)),E)}var W=p[h],j=v,ee=b;for(vh(p,v,h),E(p[b],W)>0&&vh(p,v,b);j<ee;){for(vh(p,j,ee),j++,ee--;E(p[j],W)<0;)j++;for(;E(p[ee],W)>0;)ee--}E(p[v],W)===0?vh(p,v,ee):vh(p,++ee,b),ee<=h&&(v=ee+1),h<=ee&&(b=ee-1)}}function vh(p,h,v){var b=p[h];p[h]=p[v],p[v]=b}function xA(p,h){return p<h?-1:p>h?1:0}function pf(p,h){if(p.length<=1)return[p];const v=[];let b,E;for(const I of p){const k=SA(I);k!==0&&(I.area=Math.abs(k),E===void 0&&(E=k<0),E===k<0?(b&&v.push(b),b=[I]):b.push(I))}if(b&&v.push(b),h>1)for(let I=0;I<v.length;I++)v[I].length<=h||(bA(v[I],h,1,v[I].length-1,wA),v[I]=v[I].slice(0,h));return v}function wA(p,h){return h.area-p.area}function SA(p){let h=0;for(let v,b,E=0,I=p.length,k=I-1;E<I;k=E++)v=p[E],b=p[k],h+=(b.x-v.x)*(v.y+b.y);return h}const mb=1/298.257223563,yb=mb*(2-mb),_b=Math.PI/180;class bv{constructor(h){const v=6378.137*_b*1e3,b=Math.cos(h*_b),E=1/(1-yb*(1-b*b)),I=Math.sqrt(E);this.kx=v*I*b,this.ky=v*I*E*(1-yb)}distance(h,v){const b=this.wrap(h[0]-v[0])*this.kx,E=(h[1]-v[1])*this.ky;return Math.sqrt(b*b+E*E)}pointOnLine(h,v){let b,E,I,k,R=1/0;for(let z=0;z<h.length-1;z++){let G=h[z][0],W=h[z][1],j=this.wrap(h[z+1][0]-G)*this.kx,ee=(h[z+1][1]-W)*this.ky,ne=0;j===0&&ee===0||(ne=(this.wrap(v[0]-G)*this.kx*j+(v[1]-W)*this.ky*ee)/(j*j+ee*ee),ne>1?(G=h[z+1][0],W=h[z+1][1]):ne>0&&(G+=j/this.kx*ne,W+=ee/this.ky*ne)),j=this.wrap(v[0]-G)*this.kx,ee=(v[1]-W)*this.ky;const se=j*j+ee*ee;se<R&&(R=se,b=G,E=W,I=z,k=ne)}return{point:[b,E],index:I,t:Math.max(0,Math.min(1,k))}}wrap(h){for(;h<-180;)h+=360;for(;h>180;)h-=360;return h}}function bb(p,h){return h[0]-p[0]}function gf(p){return p[1]-p[0]+1}function Ko(p,h){return p[1]>=p[0]&&p[1]<h}function xv(p,h){if(p[0]>p[1])return[null,null];const v=gf(p);if(h){if(v===2)return[p,null];const E=Math.floor(v/2);return[[p[0],p[0]+E],[p[0]+E,p[1]]]}if(v===1)return[p,null];const b=Math.floor(v/2)-1;return[[p[0],p[0]+b],[p[0]+b+1,p[1]]]}function wv(p,h){if(!Ko(h,p.length))return[1/0,1/0,-1/0,-1/0];const v=[1/0,1/0,-1/0,-1/0];for(let b=h[0];b<=h[1];++b)cl(v,p[b]);return v}function Sv(p){const h=[1/0,1/0,-1/0,-1/0];for(const v of p)for(const b of v)cl(h,b);return h}function vf(p){return p[0]!==-1/0&&p[1]!==-1/0&&p[2]!==1/0&&p[3]!==1/0}function Tv(p,h,v){if(!vf(p)||!vf(h))return NaN;let b=0,E=0;return p[2]<h[0]&&(b=h[0]-p[2]),p[0]>h[2]&&(b=p[0]-h[2]),p[1]>h[3]&&(E=p[1]-h[3]),p[3]<h[1]&&(E=h[1]-p[3]),v.distance([0,0],[b,E])}function hl(p,h,v){const b=v.pointOnLine(h,p);return v.distance(p,b.point)}function Ev(p,h,v,b,E){const I=Math.min(hl(p,[v,b],E),hl(h,[v,b],E)),k=Math.min(hl(v,[p,h],E),hl(b,[p,h],E));return Math.min(I,k)}function TA(p,h,v,b,E){if(!Ko(h,p.length)||!Ko(b,v.length))return 1/0;let I=1/0;for(let k=h[0];k<h[1];++k){const R=p[k],z=p[k+1];for(let G=b[0];G<b[1];++G){const W=v[G],j=v[G+1];if(ff(R,z,W,j))return 0;I=Math.min(I,Ev(R,z,W,j,E))}}return I}function An(p,h,v,b,E){if(!Ko(h,p.length)||!Ko(b,v.length))return NaN;let I=1/0;for(let k=h[0];k<=h[1];++k)for(let R=b[0];R<=b[1];++R)if(I=Math.min(I,E.distance(p[k],v[R])),I===0)return I;return I}function EA(p,h,v){if(pc(p,h,!0))return 0;let b=1/0;for(const E of h){const I=E[0],k=E[E.length-1];if(I!==k&&(b=Math.min(b,hl(p,[k,I],v)),b===0))return b;const R=v.pointOnLine(E,p);if(b=Math.min(b,v.distance(p,R.point)),b===0)return b}return b}function wr(p,h,v,b){if(!Ko(h,p.length))return NaN;for(let I=h[0];I<=h[1];++I)if(pc(p[I],v,!0))return 0;let E=1/0;for(let I=h[0];I<h[1];++I){const k=p[I],R=p[I+1];for(const z of v)for(let G=0,W=z.length,j=W-1;G<W;j=G++){const ee=z[j],ne=z[G];if(ff(k,R,ee,ne))return 0;E=Math.min(E,Ev(k,R,ee,ne,b))}}return E}function mf(p,h){for(const v of p)for(const b of v)if(pc(b,h,!0))return!0;return!1}function ln(p,h,v,b=1/0){const E=Sv(p),I=Sv(h);if(b!==1/0&&Tv(E,I,v)>=b)return b;if(Ds(E,I)){if(mf(p,h))return 0}else if(mf(h,p))return 0;let k=1/0;for(const R of p)for(let z=0,G=R.length,W=G-1;z<G;W=z++){const j=R[W],ee=R[z];for(const ne of h)for(let se=0,ce=ne.length,ye=ce-1;se<ce;ye=se++){const we=ne[ye],Oe=ne[se];if(ff(j,ee,we,Oe))return 0;k=Math.min(k,Ev(j,ee,we,Oe,v))}}return k}function Jr(p,h,v,b,E,I){if(!I)return;const k=Tv(wv(b,I),E,v);k<h&&p.push([k,I,[0,0]])}function dl(p,h,v,b,E,I,k){if(!I||!k)return;const R=Tv(wv(b,I),wv(E,k),v);R<h&&p.push([R,I,k])}function mh(p,h,v,b,E=1/0){let I=Math.min(b.distance(p[0],v[0][0]),E);if(I===0)return I;const k=new gb([[0,[0,p.length-1],[0,0]]],bb),R=Sv(v);for(;k.length>0;){const z=k.pop();if(z[0]>=I)continue;const G=z[1],W=h?50:100;if(gf(G)<=W){if(!Ko(G,p.length))return NaN;if(h){const j=wr(p,G,v,b);if(isNaN(j)||j===0)return j;I=Math.min(I,j)}else for(let j=G[0];j<=G[1];++j){const ee=EA(p[j],v,b);if(I=Math.min(I,ee),I===0)return 0}}else{const j=xv(G,h);Jr(k,I,b,p,R,j[0]),Jr(k,I,b,p,R,j[1])}}return I}function yh(p,h,v,b,E,I=1/0){let k=Math.min(I,E.distance(p[0],v[0]));if(k===0)return k;const R=new gb([[0,[0,p.length-1],[0,v.length-1]]],bb);for(;R.length>0;){const z=R.pop();if(z[0]>=k)continue;const G=z[1],W=z[2],j=h?50:100,ee=b?50:100;if(gf(G)<=j&&gf(W)<=ee){if(!Ko(G,p.length)&&Ko(W,v.length))return NaN;let ne;if(h&&b)ne=TA(p,G,v,W,E),k=Math.min(k,ne);else if(h&&!b){const se=p.slice(G[0],G[1]+1);for(let ce=W[0];ce<=W[1];++ce)if(ne=hl(v[ce],se,E),k=Math.min(k,ne),k===0)return k}else if(!h&&b){const se=v.slice(W[0],W[1]+1);for(let ce=G[0];ce<=G[1];++ce)if(ne=hl(p[ce],se,E),k=Math.min(k,ne),k===0)return k}else ne=An(p,G,v,W,E),k=Math.min(k,ne)}else{const ne=xv(G,h),se=xv(W,b);dl(R,k,E,p,v,ne[0],se[0]),dl(R,k,E,p,v,ne[0],se[1]),dl(R,k,E,p,v,ne[1],se[0]),dl(R,k,E,p,v,ne[1],se[1])}}return k}function Cv(p){return p.type==="MultiPolygon"?p.coordinates.map(h=>({type:"Polygon",coordinates:h})):p.type==="MultiLineString"?p.coordinates.map(h=>({type:"LineString",coordinates:h})):p.type==="MultiPoint"?p.coordinates.map(h=>({type:"Point",coordinates:h})):[p]}class fl{constructor(h,v){this.type=ut,this.geojson=h,this.geometries=v}static parse(h,v){if(h.length!==2)return v.error(`'distance' expression requires exactly one argument, but found ${h.length-1} instead.`);if(ol(h[1])){const b=h[1];if(b.type==="FeatureCollection")return new fl(b,b.features.map(E=>Cv(E.geometry)).flat());if(b.type==="Feature")return new fl(b,Cv(b.geometry));if("type"in b&&"coordinates"in b)return new fl(b,Cv(b))}return v.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(h){if(h.geometry()!=null&&h.canonicalID()!=null){if(h.geometryType()==="Point")return function(v,b){const E=v.geometry(),I=E.flat().map(z=>yv([z.x,z.y],v.canonical));if(E.length===0)return NaN;const k=new bv(I[0][1]);let R=1/0;for(const z of b){switch(z.type){case"Point":R=Math.min(R,yh(I,!1,[z.coordinates],!1,k,R));break;case"LineString":R=Math.min(R,yh(I,!1,z.coordinates,!0,k,R));break;case"Polygon":R=Math.min(R,mh(I,!1,z.coordinates,k,R))}if(R===0)return R}return R}(h,this.geometries);if(h.geometryType()==="LineString")return function(v,b){const E=v.geometry(),I=E.flat().map(z=>yv([z.x,z.y],v.canonical));if(E.length===0)return NaN;const k=new bv(I[0][1]);let R=1/0;for(const z of b){switch(z.type){case"Point":R=Math.min(R,yh(I,!0,[z.coordinates],!1,k,R));break;case"LineString":R=Math.min(R,yh(I,!0,z.coordinates,!0,k,R));break;case"Polygon":R=Math.min(R,mh(I,!0,z.coordinates,k,R))}if(R===0)return R}return R}(h,this.geometries);if(h.geometryType()==="Polygon")return function(v,b){const E=v.geometry();if(E.length===0||E[0].length===0)return NaN;const I=pf(E,0).map(z=>z.map(G=>G.map(W=>yv([W.x,W.y],v.canonical)))),k=new bv(I[0][0][0][1]);let R=1/0;for(const z of b)for(const G of I){switch(z.type){case"Point":R=Math.min(R,mh([z.coordinates],!1,G,k,R));break;case"LineString":R=Math.min(R,mh(z.coordinates,!0,G,k,R));break;case"Polygon":R=Math.min(R,ln(G,z.coordinates,k,R))}if(R===0)return R}return R}(h,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const gc={"==":fA,"!=":ob,">":pA,"<":sb,">=":lb,"<=":gA,array:Ha,at:dv,boolean:Ha,case:sf,coalesce:uf,collator:gh,format:df,image:vv,in:fv,"index-of":hc,interpolate:Gi,"interpolate-hcl":Gi,"interpolate-lab":Gi,length:mv,let:As,literal:Ua,match:pv,number:Ha,"number-format":gv,object:Ha,slice:fh,step:dc,string:Ha,"to-boolean":Wa,"to-color":Wa,"to-number":Wa,"to-string":Wa,var:Ur,within:ul,distance:fl};class Aa{constructor(h,v,b,E){this.name=h,this.type=v,this._evaluate=b,this.args=E}evaluate(h){return this._evaluate(h,this.args)}eachChild(h){this.args.forEach(h)}outputDefined(){return!1}static parse(h,v){const b=h[0],E=Aa.definitions[b];if(!E)return v.error(`Unknown expression "${b}". If you wanted a literal array, use ["literal", [...]].`,0);const I=Array.isArray(E)?E[0]:E.type,k=Array.isArray(E)?[[E[1],E[2]]]:E.overloads,R=k.filter(([G])=>!Array.isArray(G)||G.length===h.length-1);let z=null;for(const[G,W]of R){z=new sl(v.registry,_h,v.path,null,v.scope);const j=[];let ee=!1;for(let ne=1;ne<h.length;ne++){const se=h[ne],ce=Array.isArray(G)?G[ne-1]:G.type,ye=z.parse(se,1+j.length,ce);if(!ye){ee=!0;break}j.push(ye)}if(!ee)if(Array.isArray(G)&&G.length!==j.length)z.error(`Expected ${G.length} arguments, but found ${j.length} instead.`);else{for(let ne=0;ne<j.length;ne++){const se=Array.isArray(G)?G[ne]:G.type,ce=j[ne];z.concat(ne+1).checkSubtype(se,ce.type)}if(z.errors.length===0)return new Aa(b,I,W,j)}}if(R.length===1)v.errors.push(...z.errors);else{const G=(R.length?R:k).map(([j])=>{return ee=j,Array.isArray(ee)?`(${ee.map(te).join(", ")})`:`(${te(ee.type)}...)`;var ee}).join(" | "),W=[];for(let j=1;j<h.length;j++){const ee=v.parse(h[j],1+W.length);if(!ee)return null;W.push(te(ee.type))}v.error(`Expected arguments of type ${G}, but found (${W.join(", ")}) instead.`)}return null}static register(h,v){Aa.definitions=v;for(const b in v)h[b]=Aa}}function Av(p,[h,v,b,E]){h=h.evaluate(p),v=v.evaluate(p),b=b.evaluate(p);const I=E?E.evaluate(p):1,k=uc(h,v,b,I);if(k)throw new Pn(k);return new Xr(h/255,v/255,b/255,I,!1)}function Dv(p,h){return p in h}function Mv(p,h){const v=h[p];return v===void 0?null:v}function pl(p){return{type:p}}function _h(p){if(p instanceof Ur)return _h(p.boundExpression);if(p instanceof Aa&&p.name==="error"||p instanceof gh||p instanceof ul||p instanceof fl)return!1;const h=p instanceof Wa||p instanceof Ha;let v=!0;return p.eachChild(b=>{v=h?v&&_h(b):v&&b instanceof Ua}),!!v&&bh(p)&&xh(p,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function bh(p){if(p instanceof Aa&&(p.name==="get"&&p.args.length===1||p.name==="feature-state"||p.name==="has"&&p.args.length===1||p.name==="properties"||p.name==="geometry-type"||p.name==="id"||/^filter-/.test(p.name))||p instanceof ul||p instanceof fl)return!1;let h=!0;return p.eachChild(v=>{h&&!bh(v)&&(h=!1)}),h}function vc(p){if(p instanceof Aa&&p.name==="feature-state")return!1;let h=!0;return p.eachChild(v=>{h&&!vc(v)&&(h=!1)}),h}function xh(p,h){if(p instanceof Aa&&h.indexOf(p.name)>=0)return!1;let v=!0;return p.eachChild(b=>{v&&!xh(b,h)&&(v=!1)}),v}function yf(p){return{result:"success",value:p}}function mc(p){return{result:"error",value:p}}function yc(p){return p["property-type"]==="data-driven"||p["property-type"]==="cross-faded-data-driven"}function xb(p){return!!p.expression&&p.expression.parameters.indexOf("zoom")>-1}function Iv(p){return!!p.expression&&p.expression.interpolated}function Fr(p){return p instanceof Number?"number":p instanceof String?"string":p instanceof Boolean?"boolean":Array.isArray(p)?"array":p===null?"null":typeof p}function _f(p){return typeof p=="object"&&p!==null&&!Array.isArray(p)}function CA(p){return p}function wb(p,h){const v=h.type==="color",b=p.stops&&typeof p.stops[0][0]=="object",E=b||!(b||p.property!==void 0),I=p.type||(Iv(h)?"exponential":"interval");if(v||h.type==="padding"){const W=v?Xr.parse:ua.parse;(p=er({},p)).stops&&(p.stops=p.stops.map(j=>[j[0],W(j[1])])),p.default=W(p.default?p.default:h.default)}if(p.colorSpace&&(k=p.colorSpace)!=="rgb"&&k!=="hcl"&&k!=="lab")throw new Error(`Unknown color space: "${p.colorSpace}"`);var k;let R,z,G;if(I==="exponential")R=Tb;else if(I==="interval")R=bf;else if(I==="categorical"){R=Sb,z=Object.create(null);for(const W of p.stops)z[W[0]]=W[1];G=typeof p.stops[0][0]}else{if(I!=="identity")throw new Error(`Unknown function type "${I}"`);R=Eb}if(b){const W={},j=[];for(let se=0;se<p.stops.length;se++){const ce=p.stops[se],ye=ce[0].zoom;W[ye]===void 0&&(W[ye]={zoom:ye,type:p.type,property:p.property,default:p.default,stops:[]},j.push(ye)),W[ye].stops.push([ce[0].value,ce[1]])}const ee=[];for(const se of j)ee.push([W[se].zoom,wb(W[se],h)]);const ne={name:"linear"};return{kind:"composite",interpolationType:ne,interpolationFactor:Gi.interpolationFactor.bind(void 0,ne),zoomStops:ee.map(se=>se[0]),evaluate:({zoom:se},ce)=>Tb({stops:ee,base:p.base},h,se).evaluate(se,ce)}}if(E){const W=I==="exponential"?{name:"exponential",base:p.base!==void 0?p.base:1}:null;return{kind:"camera",interpolationType:W,interpolationFactor:Gi.interpolationFactor.bind(void 0,W),zoomStops:p.stops.map(j=>j[0]),evaluate:({zoom:j})=>R(p,h,j,z,G)}}return{kind:"source",evaluate(W,j){const ee=j&&j.properties?j.properties[p.property]:void 0;return ee===void 0?_c(p.default,h.default):R(p,h,ee,z,G)}}}function _c(p,h,v){return p!==void 0?p:h!==void 0?h:v!==void 0?v:void 0}function Sb(p,h,v,b,E){return _c(typeof v===E?b[v]:void 0,p.default,h.default)}function bf(p,h,v){if(Fr(v)!=="number")return _c(p.default,h.default);const b=p.stops.length;if(b===1||v<=p.stops[0][0])return p.stops[0][1];if(v>=p.stops[b-1][0])return p.stops[b-1][1];const E=lf(p.stops.map(I=>I[0]),v);return p.stops[E][1]}function Tb(p,h,v){const b=p.base!==void 0?p.base:1;if(Fr(v)!=="number")return _c(p.default,h.default);const E=p.stops.length;if(E===1||v<=p.stops[0][0])return p.stops[0][1];if(v>=p.stops[E-1][0])return p.stops[E-1][1];const I=lf(p.stops.map(W=>W[0]),v),k=function(W,j,ee,ne){const se=ne-ee,ce=W-ee;return se===0?0:j===1?ce/se:(Math.pow(j,ce)-1)/(Math.pow(j,se)-1)}(v,b,p.stops[I][0],p.stops[I+1][0]),R=p.stops[I][1],z=p.stops[I+1][1],G=$i[h.type]||CA;return typeof R.evaluate=="function"?{evaluate(...W){const j=R.evaluate.apply(void 0,W),ee=z.evaluate.apply(void 0,W);if(j!==void 0&&ee!==void 0)return G(j,ee,k,p.colorSpace)}}:G(R,z,k,p.colorSpace)}function Eb(p,h,v){switch(h.type){case"color":v=Xr.parse(v);break;case"formatted":v=ca.fromString(v.toString());break;case"resolvedImage":v=ha.fromString(v.toString());break;case"padding":v=ua.parse(v);break;default:Fr(v)===h.type||h.type==="enum"&&h.values[v]||(v=void 0)}return _c(v,p.default,h.default)}Aa.register(gc,{error:[{kind:"error"},[hr],(p,[h])=>{throw new Pn(h.evaluate(p))}],typeof:[hr,[Lt],(p,[h])=>te(Vn(h.evaluate(p)))],"to-rgba":[re(ut,4),[pi],(p,[h])=>{const[v,b,E,I]=h.evaluate(p).rgb;return[255*v,255*b,255*E,I]}],rgb:[pi,[ut,ut,ut],Av],rgba:[pi,[ut,ut,ut,ut],Av],has:{type:Qt,overloads:[[[hr],(p,[h])=>Dv(h.evaluate(p),p.properties())],[[hr,la],(p,[h,v])=>Dv(h.evaluate(p),v.evaluate(p))]]},get:{type:Lt,overloads:[[[hr],(p,[h])=>Mv(h.evaluate(p),p.properties())],[[hr,la],(p,[h,v])=>Mv(h.evaluate(p),v.evaluate(p))]]},"feature-state":[Lt,[hr],(p,[h])=>Mv(h.evaluate(p),p.featureState||{})],properties:[la,[],p=>p.properties()],"geometry-type":[hr,[],p=>p.geometryType()],id:[Lt,[],p=>p.id()],zoom:[ut,[],p=>p.globals.zoom],"heatmap-density":[ut,[],p=>p.globals.heatmapDensity||0],"line-progress":[ut,[],p=>p.globals.lineProgress||0],accumulated:[Lt,[],p=>p.globals.accumulated===void 0?null:p.globals.accumulated],"+":[ut,pl(ut),(p,h)=>{let v=0;for(const b of h)v+=b.evaluate(p);return v}],"*":[ut,pl(ut),(p,h)=>{let v=1;for(const b of h)v*=b.evaluate(p);return v}],"-":{type:ut,overloads:[[[ut,ut],(p,[h,v])=>h.evaluate(p)-v.evaluate(p)],[[ut],(p,[h])=>-h.evaluate(p)]]},"/":[ut,[ut,ut],(p,[h,v])=>h.evaluate(p)/v.evaluate(p)],"%":[ut,[ut,ut],(p,[h,v])=>h.evaluate(p)%v.evaluate(p)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(p,[h,v])=>Math.pow(h.evaluate(p),v.evaluate(p))],sqrt:[ut,[ut],(p,[h])=>Math.sqrt(h.evaluate(p))],log10:[ut,[ut],(p,[h])=>Math.log(h.evaluate(p))/Math.LN10],ln:[ut,[ut],(p,[h])=>Math.log(h.evaluate(p))],log2:[ut,[ut],(p,[h])=>Math.log(h.evaluate(p))/Math.LN2],sin:[ut,[ut],(p,[h])=>Math.sin(h.evaluate(p))],cos:[ut,[ut],(p,[h])=>Math.cos(h.evaluate(p))],tan:[ut,[ut],(p,[h])=>Math.tan(h.evaluate(p))],asin:[ut,[ut],(p,[h])=>Math.asin(h.evaluate(p))],acos:[ut,[ut],(p,[h])=>Math.acos(h.evaluate(p))],atan:[ut,[ut],(p,[h])=>Math.atan(h.evaluate(p))],min:[ut,pl(ut),(p,h)=>Math.min(...h.map(v=>v.evaluate(p)))],max:[ut,pl(ut),(p,h)=>Math.max(...h.map(v=>v.evaluate(p)))],abs:[ut,[ut],(p,[h])=>Math.abs(h.evaluate(p))],round:[ut,[ut],(p,[h])=>{const v=h.evaluate(p);return v<0?-Math.round(-v):Math.round(v)}],floor:[ut,[ut],(p,[h])=>Math.floor(h.evaluate(p))],ceil:[ut,[ut],(p,[h])=>Math.ceil(h.evaluate(p))],"filter-==":[Qt,[hr,Lt],(p,[h,v])=>p.properties()[h.value]===v.value],"filter-id-==":[Qt,[Lt],(p,[h])=>p.id()===h.value],"filter-type-==":[Qt,[hr],(p,[h])=>p.geometryType()===h.value],"filter-<":[Qt,[hr,Lt],(p,[h,v])=>{const b=p.properties()[h.value],E=v.value;return typeof b==typeof E&&b<E}],"filter-id-<":[Qt,[Lt],(p,[h])=>{const v=p.id(),b=h.value;return typeof v==typeof b&&v<b}],"filter->":[Qt,[hr,Lt],(p,[h,v])=>{const b=p.properties()[h.value],E=v.value;return typeof b==typeof E&&b>E}],"filter-id->":[Qt,[Lt],(p,[h])=>{const v=p.id(),b=h.value;return typeof v==typeof b&&v>b}],"filter-<=":[Qt,[hr,Lt],(p,[h,v])=>{const b=p.properties()[h.value],E=v.value;return typeof b==typeof E&&b<=E}],"filter-id-<=":[Qt,[Lt],(p,[h])=>{const v=p.id(),b=h.value;return typeof v==typeof b&&v<=b}],"filter->=":[Qt,[hr,Lt],(p,[h,v])=>{const b=p.properties()[h.value],E=v.value;return typeof b==typeof E&&b>=E}],"filter-id->=":[Qt,[Lt],(p,[h])=>{const v=p.id(),b=h.value;return typeof v==typeof b&&v>=b}],"filter-has":[Qt,[Lt],(p,[h])=>h.value in p.properties()],"filter-has-id":[Qt,[],p=>p.id()!==null&&p.id()!==void 0],"filter-type-in":[Qt,[re(hr)],(p,[h])=>h.value.indexOf(p.geometryType())>=0],"filter-id-in":[Qt,[re(Lt)],(p,[h])=>h.value.indexOf(p.id())>=0],"filter-in-small":[Qt,[hr,re(Lt)],(p,[h,v])=>v.value.indexOf(p.properties()[h.value])>=0],"filter-in-large":[Qt,[hr,re(Lt)],(p,[h,v])=>function(b,E,I,k){for(;I<=k;){const R=I+k>>1;if(E[R]===b)return!0;E[R]>b?k=R-1:I=R+1}return!1}(p.properties()[h.value],v.value,0,v.value.length-1)],all:{type:Qt,overloads:[[[Qt,Qt],(p,[h,v])=>h.evaluate(p)&&v.evaluate(p)],[pl(Qt),(p,h)=>{for(const v of h)if(!v.evaluate(p))return!1;return!0}]]},any:{type:Qt,overloads:[[[Qt,Qt],(p,[h,v])=>h.evaluate(p)||v.evaluate(p)],[pl(Qt),(p,h)=>{for(const v of h)if(v.evaluate(p))return!0;return!1}]]},"!":[Qt,[Qt],(p,[h])=>!h.evaluate(p)],"is-supported-script":[Qt,[hr],(p,[h])=>{const v=p.globals&&p.globals.isSupportedScript;return!v||v(h.evaluate(p))}],upcase:[hr,[hr],(p,[h])=>h.evaluate(p).toUpperCase()],downcase:[hr,[hr],(p,[h])=>h.evaluate(p).toLowerCase()],concat:[hr,pl(Lt),(p,h)=>h.map(v=>dh(v.evaluate(p))).join("")],"resolved-locale":[hr,[Di],(p,[h])=>h.evaluate(p).resolvedLocale()]});class xf{constructor(h,v){var b;this.expression=h,this._warningHistory={},this._evaluator=new of,this._defaultValue=v?(b=v).type==="color"&&_f(b.default)?new Xr(0,0,0,0):b.type==="color"?Xr.parse(b.default)||null:b.type==="padding"?ua.parse(b.default)||null:b.type==="variableAnchorOffsetCollection"?Ca.parse(b.default)||null:b.default===void 0?null:b.default:null,this._enumValues=v&&v.type==="enum"?v.values:null}evaluateWithoutErrorHandling(h,v,b,E,I,k){return this._evaluator.globals=h,this._evaluator.feature=v,this._evaluator.featureState=b,this._evaluator.canonical=E,this._evaluator.availableImages=I||null,this._evaluator.formattedSection=k,this.expression.evaluate(this._evaluator)}evaluate(h,v,b,E,I,k){this._evaluator.globals=h,this._evaluator.feature=v||null,this._evaluator.featureState=b||null,this._evaluator.canonical=E,this._evaluator.availableImages=I||null,this._evaluator.formattedSection=k||null;try{const R=this.expression.evaluate(this._evaluator);if(R==null||typeof R=="number"&&R!=R)return this._defaultValue;if(this._enumValues&&!(R in this._enumValues))throw new Pn(`Expected value to be one of ${Object.keys(this._enumValues).map(z=>JSON.stringify(z)).join(", ")}, but found ${JSON.stringify(R)} instead.`);return R}catch(R){return this._warningHistory[R.message]||(this._warningHistory[R.message]=!0,typeof console<"u"&&console.warn(R.message)),this._defaultValue}}}function wf(p){return Array.isArray(p)&&p.length>0&&typeof p[0]=="string"&&p[0]in gc}function bc(p,h){const v=new sl(gc,_h,[],h?function(E){const I={color:pi,string:hr,number:ut,enum:hr,boolean:Qt,formatted:Mi,padding:Co,resolvedImage:Ao,variableAnchorOffsetCollection:xe};return E.type==="array"?re(I[E.value]||Lt,E.length):I[E.type]}(h):void 0),b=v.parse(p,void 0,void 0,void 0,h&&h.type==="string"?{typeAnnotation:"coerce"}:void 0);return b?yf(new xf(b,h)):mc(v.errors)}class xc{constructor(h,v){this.kind=h,this._styleExpression=v,this.isStateDependent=h!=="constant"&&!vc(v.expression)}evaluateWithoutErrorHandling(h,v,b,E,I,k){return this._styleExpression.evaluateWithoutErrorHandling(h,v,b,E,I,k)}evaluate(h,v,b,E,I,k){return this._styleExpression.evaluate(h,v,b,E,I,k)}}class wc{constructor(h,v,b,E){this.kind=h,this.zoomStops=b,this._styleExpression=v,this.isStateDependent=h!=="camera"&&!vc(v.expression),this.interpolationType=E}evaluateWithoutErrorHandling(h,v,b,E,I,k){return this._styleExpression.evaluateWithoutErrorHandling(h,v,b,E,I,k)}evaluate(h,v,b,E,I,k){return this._styleExpression.evaluate(h,v,b,E,I,k)}interpolationFactor(h,v,b){return this.interpolationType?Gi.interpolationFactor(this.interpolationType,h,v,b):0}}function kv(p,h){const v=bc(p,h);if(v.result==="error")return v;const b=v.value.expression,E=bh(b);if(!E&&!yc(h))return mc([new sr("","data expressions not supported")]);const I=xh(b,["zoom"]);if(!I&&!xb(h))return mc([new sr("","zoom expressions not supported")]);const k=wh(b);return k||I?k instanceof sr?mc([k]):k instanceof Gi&&!Iv(h)?mc([new sr("",'"interpolate" expressions cannot be used with this property')]):yf(k?new wc(E?"camera":"composite",v.value,k.labels,k instanceof Gi?k.interpolation:void 0):new xc(E?"constant":"source",v.value)):mc([new sr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Sc{constructor(h,v){this._parameters=h,this._specification=v,er(this,wb(this._parameters,this._specification))}static deserialize(h){return new Sc(h._parameters,h._specification)}static serialize(h){return{_parameters:h._parameters,_specification:h._specification}}}function wh(p){let h=null;if(p instanceof As)h=wh(p.result);else if(p instanceof uf){for(const v of p.args)if(h=wh(v),h)break}else(p instanceof dc||p instanceof Gi)&&p.input instanceof Aa&&p.input.name==="zoom"&&(h=p);return h instanceof sr||p.eachChild(v=>{const b=wh(v);b instanceof sr?h=b:!h&&b?h=new sr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):h&&b&&h!==b&&(h=new sr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),h}function Sf(p){if(p===!0||p===!1)return!0;if(!Array.isArray(p)||p.length===0)return!1;switch(p[0]){case"has":return p.length>=2&&p[1]!=="$id"&&p[1]!=="$type";case"in":return p.length>=3&&(typeof p[1]!="string"||Array.isArray(p[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return p.length!==3||Array.isArray(p[1])||Array.isArray(p[2]);case"any":case"all":for(const h of p.slice(1))if(!Sf(h)&&typeof h!="boolean")return!1;return!0;default:return!0}}const Tf={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Lv(p){if(p==null)return{filter:()=>!0,needGeometry:!1};Sf(p)||(p=Ef(p));const h=bc(p,Tf);if(h.result==="error")throw new Error(h.value.map(v=>`${v.key}: ${v.message}`).join(", "));return{filter:(v,b,E)=>h.value.evaluate(v,b,{},E),needGeometry:Cb(p)}}function AA(p,h){return p<h?-1:p>h?1:0}function Cb(p){if(!Array.isArray(p))return!1;if(p[0]==="within"||p[0]==="distance")return!0;for(let h=1;h<p.length;h++)if(Cb(p[h]))return!0;return!1}function Ef(p){if(!p)return!0;const h=p[0];return p.length<=1?h!=="any":h==="=="?Pv(p[1],p[2],"=="):h==="!="?gi(Pv(p[1],p[2],"==")):h==="<"||h===">"||h==="<="||h===">="?Pv(p[1],p[2],h):h==="any"?(v=p.slice(1),["any"].concat(v.map(Ef))):h==="all"?["all"].concat(p.slice(1).map(Ef)):h==="none"?["all"].concat(p.slice(1).map(Ef).map(gi)):h==="in"?Sh(p[1],p.slice(2)):h==="!in"?gi(Sh(p[1],p.slice(2))):h==="has"?Th(p[1]):h!=="!has"||gi(Th(p[1]));var v}function Pv(p,h,v){switch(p){case"$type":return[`filter-type-${v}`,h];case"$id":return[`filter-id-${v}`,h];default:return[`filter-${v}`,p,h]}}function Sh(p,h){if(h.length===0)return!1;switch(p){case"$type":return["filter-type-in",["literal",h]];case"$id":return["filter-id-in",["literal",h]];default:return h.length>200&&!h.some(v=>typeof v!=typeof h[0])?["filter-in-large",p,["literal",h.sort(AA)]]:["filter-in-small",p,["literal",h]]}}function Th(p){switch(p){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",p]}}function gi(p){return["!",p]}function gl(p){const h=typeof p;if(h==="number"||h==="boolean"||h==="string"||p==null)return JSON.stringify(p);if(Array.isArray(p)){let E="[";for(const I of p)E+=`${gl(I)},`;return`${E}]`}const v=Object.keys(p).sort();let b="{";for(let E=0;E<v.length;E++)b+=`${JSON.stringify(v[E])}:${gl(p[v[E]])},`;return`${b}}`}function Ab(p){let h="";for(const v of Vr)h+=`/${gl(p[v])}`;return h}function Db(p){const h=p.value;return h?[new $e(p.key,h,"constants have been deprecated as of v8")]:[]}function Dn(p){return p instanceof Number||p instanceof String||p instanceof Boolean?p.valueOf():p}function qa(p){if(Array.isArray(p))return p.map(qa);if(p instanceof Object&&!(p instanceof Number||p instanceof String||p instanceof Boolean)){const h={};for(const v in p)h[v]=qa(p[v]);return h}return Dn(p)}function da(p){const h=p.key,v=p.value,b=p.valueSpec||{},E=p.objectElementValidators||{},I=p.style,k=p.styleSpec,R=p.validateSpec;let z=[];const G=Fr(v);if(G!=="object")return[new $e(h,v,`object expected, ${G} found`)];for(const W in v){const j=W.split(".")[0],ee=b[j]||b["*"];let ne;if(E[j])ne=E[j];else if(b[j])ne=R;else if(E["*"])ne=E["*"];else{if(!b["*"]){z.push(new $e(h,v[W],`unknown property "${W}"`));continue}ne=R}z=z.concat(ne({key:(h&&`${h}.`)+W,value:v[W],valueSpec:ee,style:I,styleSpec:k,object:v,objectKey:W,validateSpec:R},v))}for(const W in b)E[W]||b[W].required&&b[W].default===void 0&&v[W]===void 0&&z.push(new $e(h,v,`missing required property "${W}"`));return z}function Eh(p){const h=p.value,v=p.valueSpec,b=p.style,E=p.styleSpec,I=p.key,k=p.arrayElementValidator||p.validateSpec;if(Fr(h)!=="array")return[new $e(I,h,`array expected, ${Fr(h)} found`)];if(v.length&&h.length!==v.length)return[new $e(I,h,`array length ${v.length} expected, length ${h.length} found`)];if(v["min-length"]&&h.length<v["min-length"])return[new $e(I,h,`array length at least ${v["min-length"]} expected, length ${h.length} found`)];let R={type:v.value,values:v.values};E.$version<7&&(R.function=v.function),Fr(v.value)==="object"&&(R=v.value);let z=[];for(let G=0;G<h.length;G++)z=z.concat(k({array:h,arrayIndex:G,value:h[G],valueSpec:R,validateSpec:p.validateSpec,style:b,styleSpec:E,key:`${I}[${G}]`}));return z}function Rv(p){const h=p.key,v=p.value,b=p.valueSpec;let E=Fr(v);return E==="number"&&v!=v&&(E="NaN"),E!=="number"?[new $e(h,v,`number expected, ${E} found`)]:"minimum"in b&&v<b.minimum?[new $e(h,v,`${v} is less than the minimum value ${b.minimum}`)]:"maximum"in b&&v>b.maximum?[new $e(h,v,`${v} is greater than the maximum value ${b.maximum}`)]:[]}function Cf(p){const h=p.valueSpec,v=Dn(p.value.type);let b,E,I,k={};const R=v!=="categorical"&&p.value.property===void 0,z=!R,G=Fr(p.value.stops)==="array"&&Fr(p.value.stops[0])==="array"&&Fr(p.value.stops[0][0])==="object",W=da({key:p.key,value:p.value,valueSpec:p.styleSpec.function,validateSpec:p.validateSpec,style:p.style,styleSpec:p.styleSpec,objectElementValidators:{stops:function(ne){if(v==="identity")return[new $e(ne.key,ne.value,'identity function may not have a "stops" property')];let se=[];const ce=ne.value;return se=se.concat(Eh({key:ne.key,value:ce,valueSpec:ne.valueSpec,validateSpec:ne.validateSpec,style:ne.style,styleSpec:ne.styleSpec,arrayElementValidator:j})),Fr(ce)==="array"&&ce.length===0&&se.push(new $e(ne.key,ce,"array must have at least one stop")),se},default:function(ne){return ne.validateSpec({key:ne.key,value:ne.value,valueSpec:h,validateSpec:ne.validateSpec,style:ne.style,styleSpec:ne.styleSpec})}}});return v==="identity"&&R&&W.push(new $e(p.key,p.value,'missing required property "property"')),v==="identity"||p.value.stops||W.push(new $e(p.key,p.value,'missing required property "stops"')),v==="exponential"&&p.valueSpec.expression&&!Iv(p.valueSpec)&&W.push(new $e(p.key,p.value,"exponential functions not supported")),p.styleSpec.$version>=8&&(z&&!yc(p.valueSpec)?W.push(new $e(p.key,p.value,"property functions not supported")):R&&!xb(p.valueSpec)&&W.push(new $e(p.key,p.value,"zoom functions not supported"))),v!=="categorical"&&!G||p.value.property!==void 0||W.push(new $e(p.key,p.value,'"property" property is required')),W;function j(ne){let se=[];const ce=ne.value,ye=ne.key;if(Fr(ce)!=="array")return[new $e(ye,ce,`array expected, ${Fr(ce)} found`)];if(ce.length!==2)return[new $e(ye,ce,`array length 2 expected, length ${ce.length} found`)];if(G){if(Fr(ce[0])!=="object")return[new $e(ye,ce,`object expected, ${Fr(ce[0])} found`)];if(ce[0].zoom===void 0)return[new $e(ye,ce,"object stop key must have zoom")];if(ce[0].value===void 0)return[new $e(ye,ce,"object stop key must have value")];if(I&&I>Dn(ce[0].zoom))return[new $e(ye,ce[0].zoom,"stop zoom values must appear in ascending order")];Dn(ce[0].zoom)!==I&&(I=Dn(ce[0].zoom),E=void 0,k={}),se=se.concat(da({key:`${ye}[0]`,value:ce[0],valueSpec:{zoom:{}},validateSpec:ne.validateSpec,style:ne.style,styleSpec:ne.styleSpec,objectElementValidators:{zoom:Rv,value:ee}}))}else se=se.concat(ee({key:`${ye}[0]`,value:ce[0],valueSpec:{},validateSpec:ne.validateSpec,style:ne.style,styleSpec:ne.styleSpec},ce));return wf(qa(ce[1]))?se.concat([new $e(`${ye}[1]`,ce[1],"expressions are not allowed in function stops.")]):se.concat(ne.validateSpec({key:`${ye}[1]`,value:ce[1],valueSpec:h,validateSpec:ne.validateSpec,style:ne.style,styleSpec:ne.styleSpec}))}function ee(ne,se){const ce=Fr(ne.value),ye=Dn(ne.value),we=ne.value!==null?ne.value:se;if(b){if(ce!==b)return[new $e(ne.key,we,`${ce} stop domain type must match previous stop domain type ${b}`)]}else b=ce;if(ce!=="number"&&ce!=="string"&&ce!=="boolean")return[new $e(ne.key,we,"stop domain value must be a number, string, or boolean")];if(ce!=="number"&&v!=="categorical"){let Oe=`number expected, ${ce} found`;return yc(h)&&v===void 0&&(Oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new $e(ne.key,we,Oe)]}return v!=="categorical"||ce!=="number"||isFinite(ye)&&Math.floor(ye)===ye?v!=="categorical"&&ce==="number"&&E!==void 0&&ye<E?[new $e(ne.key,we,"stop domain values must appear in ascending order")]:(E=ye,v==="categorical"&&ye in k?[new $e(ne.key,we,"stop domain values must be unique")]:(k[ye]=!0,[])):[new $e(ne.key,we,`integer expected, found ${ye}`)]}}function Tc(p){const h=(p.expressionContext==="property"?kv:bc)(qa(p.value),p.valueSpec);if(h.result==="error")return h.value.map(b=>new $e(`${p.key}${b.key}`,p.value,b.message));const v=h.value.expression||h.value._styleExpression.expression;if(p.expressionContext==="property"&&p.propertyKey==="text-font"&&!v.outputDefined())return[new $e(p.key,p.value,`Invalid data expression for "${p.propertyKey}". Output values must be contained as literals within the expression.`)];if(p.expressionContext==="property"&&p.propertyType==="layout"&&!vc(v))return[new $e(p.key,p.value,'"feature-state" data expressions are not supported with layout properties.')];if(p.expressionContext==="filter"&&!vc(v))return[new $e(p.key,p.value,'"feature-state" data expressions are not supported with filters.')];if(p.expressionContext&&p.expressionContext.indexOf("cluster")===0){if(!xh(v,["zoom","feature-state"]))return[new $e(p.key,p.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(p.expressionContext==="cluster-initial"&&!bh(v))return[new $e(p.key,p.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jo(p){const h=p.key,v=p.value,b=p.valueSpec,E=[];return Array.isArray(b.values)?b.values.indexOf(Dn(v))===-1&&E.push(new $e(h,v,`expected one of [${b.values.join(", ")}], ${JSON.stringify(v)} found`)):Object.keys(b.values).indexOf(Dn(v))===-1&&E.push(new $e(h,v,`expected one of [${Object.keys(b.values).join(", ")}], ${JSON.stringify(v)} found`)),E}function Nv(p){return Sf(qa(p.value))?Tc(er({},p,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Af(p)}function Af(p){const h=p.value,v=p.key;if(Fr(h)!=="array")return[new $e(v,h,`array expected, ${Fr(h)} found`)];const b=p.styleSpec;let E,I=[];if(h.length<1)return[new $e(v,h,"filter array must have at least 1 element")];switch(I=I.concat(Jo({key:`${v}[0]`,value:h[0],valueSpec:b.filter_operator,style:p.style,styleSpec:p.styleSpec})),Dn(h[0])){case"<":case"<=":case">":case">=":h.length>=2&&Dn(h[1])==="$type"&&I.push(new $e(v,h,`"$type" cannot be use with operator "${h[0]}"`));case"==":case"!=":h.length!==3&&I.push(new $e(v,h,`filter array for operator "${h[0]}" must have 3 elements`));case"in":case"!in":h.length>=2&&(E=Fr(h[1]),E!=="string"&&I.push(new $e(`${v}[1]`,h[1],`string expected, ${E} found`)));for(let k=2;k<h.length;k++)E=Fr(h[k]),Dn(h[1])==="$type"?I=I.concat(Jo({key:`${v}[${k}]`,value:h[k],valueSpec:b.geometry_type,style:p.style,styleSpec:p.styleSpec})):E!=="string"&&E!=="number"&&E!=="boolean"&&I.push(new $e(`${v}[${k}]`,h[k],`string, number, or boolean expected, ${E} found`));break;case"any":case"all":case"none":for(let k=1;k<h.length;k++)I=I.concat(Af({key:`${v}[${k}]`,value:h[k],style:p.style,styleSpec:p.styleSpec}));break;case"has":case"!has":E=Fr(h[1]),h.length!==2?I.push(new $e(v,h,`filter array for "${h[0]}" operator must have 2 elements`)):E!=="string"&&I.push(new $e(`${v}[1]`,h[1],`string expected, ${E} found`))}return I}function Ov(p,h){const v=p.key,b=p.validateSpec,E=p.style,I=p.styleSpec,k=p.value,R=p.objectKey,z=I[`${h}_${p.layerType}`];if(!z)return[];const G=R.match(/^(.*)-transition$/);if(h==="paint"&&G&&z[G[1]]&&z[G[1]].transition)return b({key:v,value:k,valueSpec:I.transition,style:E,styleSpec:I});const W=p.valueSpec||z[R];if(!W)return[new $e(v,k,`unknown property "${R}"`)];let j;if(Fr(k)==="string"&&yc(W)&&!W.tokens&&(j=/^{([^}]+)}$/.exec(k)))return[new $e(v,k,`"${R}" does not support interpolation syntax
|
|
169
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(j[1])} }\`.`)];const ee=[];return p.layerType==="symbol"&&(R==="text-field"&&E&&!E.glyphs&&ee.push(new $e(v,k,'use of "text-field" requires a style "glyphs" property')),R==="text-font"&&_f(qa(k))&&Dn(k.type)==="identity"&&ee.push(new $e(v,k,'"text-font" does not support identity functions'))),ee.concat(b({key:p.key,value:k,valueSpec:W,style:E,styleSpec:I,expressionContext:"property",propertyType:h,propertyKey:R}))}function Df(p){return Ov(p,"paint")}function zv(p){return Ov(p,"layout")}function Bv(p){let h=[];const v=p.value,b=p.key,E=p.style,I=p.styleSpec;v.type||v.ref||h.push(new $e(b,v,'either "type" or "ref" is required'));let k=Dn(v.type);const R=Dn(v.ref);if(v.id){const z=Dn(v.id);for(let G=0;G<p.arrayIndex;G++){const W=E.layers[G];Dn(W.id)===z&&h.push(new $e(b,v.id,`duplicate layer id "${v.id}", previously used at line ${W.id.__line__}`))}}if("ref"in v){let z;["type","source","source-layer","filter","layout"].forEach(G=>{G in v&&h.push(new $e(b,v[G],`"${G}" is prohibited for ref layers`))}),E.layers.forEach(G=>{Dn(G.id)===R&&(z=G)}),z?z.ref?h.push(new $e(b,v.ref,"ref cannot reference another ref layer")):k=Dn(z.type):h.push(new $e(b,v.ref,`ref layer "${R}" not found`))}else if(k!=="background")if(v.source){const z=E.sources&&E.sources[v.source],G=z&&Dn(z.type);z?G==="vector"&&k==="raster"?h.push(new $e(b,v.source,`layer "${v.id}" requires a raster source`)):G!=="raster-dem"&&k==="hillshade"?h.push(new $e(b,v.source,`layer "${v.id}" requires a raster-dem source`)):G==="raster"&&k!=="raster"?h.push(new $e(b,v.source,`layer "${v.id}" requires a vector source`)):G!=="vector"||v["source-layer"]?G==="raster-dem"&&k!=="hillshade"?h.push(new $e(b,v.source,"raster-dem source can only be used with layer type 'hillshade'.")):k!=="line"||!v.paint||!v.paint["line-gradient"]||G==="geojson"&&z.lineMetrics||h.push(new $e(b,v,`layer "${v.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):h.push(new $e(b,v,`layer "${v.id}" must specify a "source-layer"`)):h.push(new $e(b,v.source,`source "${v.source}" not found`))}else h.push(new $e(b,v,'missing required property "source"'));return h=h.concat(da({key:b,value:v,valueSpec:I.layer,style:p.style,styleSpec:p.styleSpec,validateSpec:p.validateSpec,objectElementValidators:{"*":()=>[],type:()=>p.validateSpec({key:`${b}.type`,value:v.type,valueSpec:I.layer.type,style:p.style,styleSpec:p.styleSpec,validateSpec:p.validateSpec,object:v,objectKey:"type"}),filter:Nv,layout:z=>da({layer:v,key:z.key,value:z.value,style:z.style,styleSpec:z.styleSpec,validateSpec:z.validateSpec,objectElementValidators:{"*":G=>zv(er({layerType:k},G))}}),paint:z=>da({layer:v,key:z.key,value:z.value,style:z.style,styleSpec:z.styleSpec,validateSpec:z.validateSpec,objectElementValidators:{"*":G=>Df(er({layerType:k},G))}})}})),h}function vl(p){const h=p.value,v=p.key,b=Fr(h);return b!=="string"?[new $e(v,h,`string expected, ${b} found`)]:[]}const Mf={promoteId:function({key:p,value:h}){if(Fr(h)==="string")return vl({key:p,value:h});{const v=[];for(const b in h)v.push(...vl({key:`${p}.${b}`,value:h[b]}));return v}}};function Ch(p){const h=p.value,v=p.key,b=p.styleSpec,E=p.style,I=p.validateSpec;if(!h.type)return[new $e(v,h,'"type" is required')];const k=Dn(h.type);let R;switch(k){case"vector":case"raster":return R=da({key:v,value:h,valueSpec:b[`source_${k.replace("-","_")}`],style:p.style,styleSpec:b,objectElementValidators:Mf,validateSpec:I}),R;case"raster-dem":return R=function(z){var G;const W=(G=z.sourceName)!==null&&G!==void 0?G:"",j=z.value,ee=z.styleSpec,ne=ee.source_raster_dem,se=z.style;let ce=[];const ye=Fr(j);if(j===void 0)return ce;if(ye!=="object")return ce.push(new $e("source_raster_dem",j,`object expected, ${ye} found`)),ce;const we=Dn(j.encoding)==="custom",Oe=["redFactor","greenFactor","blueFactor","baseShift"],Ae=z.value.encoding?`"${z.value.encoding}"`:"Default";for(const Re in j)!we&&Oe.includes(Re)?ce.push(new $e(Re,j[Re],`In "${W}": "${Re}" is only valid when "encoding" is set to "custom". ${Ae} encoding found`)):ne[Re]?ce=ce.concat(z.validateSpec({key:Re,value:j[Re],valueSpec:ne[Re],validateSpec:z.validateSpec,style:se,styleSpec:ee})):ce.push(new $e(Re,j[Re],`unknown property "${Re}"`));return ce}({sourceName:v,value:h,style:p.style,styleSpec:b,validateSpec:I}),R;case"geojson":if(R=da({key:v,value:h,valueSpec:b.source_geojson,style:E,styleSpec:b,validateSpec:I,objectElementValidators:Mf}),h.cluster)for(const z in h.clusterProperties){const[G,W]=h.clusterProperties[z],j=typeof G=="string"?[G,["accumulated"],["get",z]]:G;R.push(...Tc({key:`${v}.${z}.map`,value:W,validateSpec:I,expressionContext:"cluster-map"})),R.push(...Tc({key:`${v}.${z}.reduce`,value:j,validateSpec:I,expressionContext:"cluster-reduce"}))}return R;case"video":return da({key:v,value:h,valueSpec:b.source_video,style:E,validateSpec:I,styleSpec:b});case"image":return da({key:v,value:h,valueSpec:b.source_image,style:E,validateSpec:I,styleSpec:b});case"canvas":return[new $e(v,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jo({key:`${v}.type`,value:h.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:E,validateSpec:I,styleSpec:b})}}function Vv(p){const h=p.value,v=p.styleSpec,b=v.light,E=p.style;let I=[];const k=Fr(h);if(h===void 0)return I;if(k!=="object")return I=I.concat([new $e("light",h,`object expected, ${k} found`)]),I;for(const R in h){const z=R.match(/^(.*)-transition$/);I=I.concat(z&&b[z[1]]&&b[z[1]].transition?p.validateSpec({key:R,value:h[R],valueSpec:v.transition,validateSpec:p.validateSpec,style:E,styleSpec:v}):b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],validateSpec:p.validateSpec,style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)])}return I}function Fv(p){const h=p.value,v=p.styleSpec,b=v.sky,E=p.style,I=Fr(h);if(h===void 0)return[];if(I!=="object")return[new $e("sky",h,`object expected, ${I} found`)];let k=[];for(const R in h)k=k.concat(b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)]);return k}function $v(p){const h=p.value,v=p.styleSpec,b=v.terrain,E=p.style;let I=[];const k=Fr(h);if(h===void 0)return I;if(k!=="object")return I=I.concat([new $e("terrain",h,`object expected, ${k} found`)]),I;for(const R in h)I=I.concat(b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],validateSpec:p.validateSpec,style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)]);return I}function Gv(p){let h=[];const v=p.value,b=p.key;if(Array.isArray(v)){const E=[],I=[];for(const k in v)v[k].id&&E.includes(v[k].id)&&h.push(new $e(b,v,`all the sprites' ids must be unique, but ${v[k].id} is duplicated`)),E.push(v[k].id),v[k].url&&I.includes(v[k].url)&&h.push(new $e(b,v,`all the sprites' URLs must be unique, but ${v[k].url} is duplicated`)),I.push(v[k].url),h=h.concat(da({key:`${b}[${k}]`,value:v[k],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:p.validateSpec}));return h}return vl({key:b,value:v})}const If={"*":()=>[],array:Eh,boolean:function(p){const h=p.value,v=p.key,b=Fr(h);return b!=="boolean"?[new $e(v,h,`boolean expected, ${b} found`)]:[]},number:Rv,color:function(p){const h=p.key,v=p.value,b=Fr(v);return b!=="string"?[new $e(h,v,`color expected, ${b} found`)]:Xr.parse(String(v))?[]:[new $e(h,v,`color expected, "${v}" found`)]},constants:Db,enum:Jo,filter:Nv,function:Cf,layer:Bv,object:da,source:Ch,light:Vv,sky:Fv,terrain:$v,projection:function(p){const h=p.value,v=p.styleSpec,b=v.projection,E=p.style,I=Fr(h);if(h===void 0)return[];if(I!=="object")return[new $e("projection",h,`object expected, ${I} found`)];let k=[];for(const R in h)k=k.concat(b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)]);return k},string:vl,formatted:function(p){return vl(p).length===0?[]:Tc(p)},resolvedImage:function(p){return vl(p).length===0?[]:Tc(p)},padding:function(p){const h=p.key,v=p.value;if(Fr(v)==="array"){if(v.length<1||v.length>4)return[new $e(h,v,`padding requires 1 to 4 values; ${v.length} values found`)];const b={type:"number"};let E=[];for(let I=0;I<v.length;I++)E=E.concat(p.validateSpec({key:`${h}[${I}]`,value:v[I],validateSpec:p.validateSpec,valueSpec:b}));return E}return Rv({key:h,value:v,valueSpec:{}})},variableAnchorOffsetCollection:function(p){const h=p.key,v=p.value,b=Fr(v),E=p.styleSpec;if(b!=="array"||v.length<1||v.length%2!=0)return[new $e(h,v,"variableAnchorOffsetCollection requires a non-empty array of even length")];let I=[];for(let k=0;k<v.length;k+=2)I=I.concat(Jo({key:`${h}[${k}]`,value:v[k],valueSpec:E.layout_symbol["text-anchor"]})),I=I.concat(Eh({key:`${h}[${k+1}]`,value:v[k+1],valueSpec:{length:2,value:"number"},validateSpec:p.validateSpec,style:p.style,styleSpec:E}));return I},sprite:Gv};function Ec(p){const h=p.value,v=p.valueSpec,b=p.styleSpec;return p.validateSpec=Ec,v.expression&&_f(Dn(h))?Cf(p):v.expression&&wf(qa(h))?Tc(p):v.type&&If[v.type]?If[v.type](p):da(er({},p,{valueSpec:v.type?b[v.type]:v}))}function Mb(p){const h=p.value,v=p.key,b=vl(p);return b.length||(h.indexOf("{fontstack}")===-1&&b.push(new $e(v,h,'"glyphs" url must include a "{fontstack}" token')),h.indexOf("{range}")===-1&&b.push(new $e(v,h,'"glyphs" url must include a "{range}" token'))),b}function Da(p,h=Le){let v=[];return v=v.concat(Ec({key:"",value:p,valueSpec:h.$root,styleSpec:h,style:p,validateSpec:Ec,objectElementValidators:{glyphs:Mb,"*":()=>[]}})),p.constants&&(v=v.concat(Db({key:"constants",value:p.constants,style:p,styleSpec:h,validateSpec:Ec}))),Uv(v)}function Mo(p){return function(h){return p({...h,validateSpec:Ec})}}function Uv(p){return[].concat(p).sort((h,v)=>h.line-v.line)}function Za(p){return function(...h){return Uv(p.apply(this,h))}}Da.source=Za(Mo(Ch)),Da.sprite=Za(Mo(Gv)),Da.glyphs=Za(Mo(Mb)),Da.light=Za(Mo(Vv)),Da.sky=Za(Mo(Fv)),Da.terrain=Za(Mo($v)),Da.layer=Za(Mo(Bv)),Da.filter=Za(Mo(Nv)),Da.paintProperty=Za(Mo(Df)),Da.layoutProperty=Za(Mo(zv));const ml=Da,DA=ml.light,MA=ml.sky,Ib=ml.paintProperty,kb=ml.layoutProperty;function Hv(p,h){let v=!1;if(h&&h.length)for(const b of h)p.fire(new kt(new Error(b.message))),v=!0;return v}class Cc{constructor(h,v,b){const E=this.cells=[];if(h instanceof ArrayBuffer){this.arrayBuffer=h;const k=new Int32Array(this.arrayBuffer);h=k[0],this.d=(v=k[1])+2*(b=k[2]);for(let z=0;z<this.d*this.d;z++){const G=k[3+z],W=k[3+z+1];E.push(G===W?null:k.subarray(G,W))}const R=k[3+E.length+1];this.keys=k.subarray(k[3+E.length],R),this.bboxes=k.subarray(R),this.insert=this._insertReadonly}else{this.d=v+2*b;for(let k=0;k<this.d*this.d;k++)E.push([]);this.keys=[],this.bboxes=[]}this.n=v,this.extent=h,this.padding=b,this.scale=v/h,this.uid=0;const I=b/v*h;this.min=-I,this.max=h+I}insert(h,v,b,E,I){this._forEachCell(v,b,E,I,this._insertCell,this.uid++,void 0,void 0),this.keys.push(h),this.bboxes.push(v),this.bboxes.push(b),this.bboxes.push(E),this.bboxes.push(I)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(h,v,b,E,I,k){this.cells[I].push(k)}query(h,v,b,E,I){const k=this.min,R=this.max;if(h<=k&&v<=k&&R<=b&&R<=E&&!I)return Array.prototype.slice.call(this.keys);{const z=[];return this._forEachCell(h,v,b,E,this._queryCell,z,{},I),z}}_queryCell(h,v,b,E,I,k,R,z){const G=this.cells[I];if(G!==null){const W=this.keys,j=this.bboxes;for(let ee=0;ee<G.length;ee++){const ne=G[ee];if(R[ne]===void 0){const se=4*ne;(z?z(j[se+0],j[se+1],j[se+2],j[se+3]):h<=j[se+2]&&v<=j[se+3]&&b>=j[se+0]&&E>=j[se+1])?(R[ne]=!0,k.push(W[ne])):R[ne]=!1}}}}_forEachCell(h,v,b,E,I,k,R,z){const G=this._convertToCellCoord(h),W=this._convertToCellCoord(v),j=this._convertToCellCoord(b),ee=this._convertToCellCoord(E);for(let ne=G;ne<=j;ne++)for(let se=W;se<=ee;se++){const ce=this.d*se+ne;if((!z||z(this._convertFromCellCoord(ne),this._convertFromCellCoord(se),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(se+1)))&&I.call(this,h,v,b,E,ce,k,R,z))return}}_convertFromCellCoord(h){return(h-this.padding)/this.scale}_convertToCellCoord(h){return Math.max(0,Math.min(this.d-1,Math.floor(h*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const h=this.cells,v=3+this.cells.length+1+1;let b=0;for(let k=0;k<this.cells.length;k++)b+=this.cells[k].length;const E=new Int32Array(v+b+this.keys.length+this.bboxes.length);E[0]=this.extent,E[1]=this.n,E[2]=this.padding;let I=v;for(let k=0;k<h.length;k++){const R=h[k];E[3+k]=I,E.set(R,I),I+=R.length}return E[3+h.length]=I,E.set(this.keys,I),I+=this.keys.length,E[3+h.length+1]=I,E.set(this.bboxes,I),I+=this.bboxes.length,E.buffer}static serialize(h,v){const b=h.toArrayBuffer();return v&&v.push(b),{buffer:b}}static deserialize(h){return new Cc(h.buffer)}}const Ma={};function Pt(p,h,v={}){if(Ma[p])throw new Error(`${p} is already registered.`);Object.defineProperty(h,"_classRegistryKey",{value:p,writeable:!1}),Ma[p]={klass:h,omit:v.omit||[],shallow:v.shallow||[]}}Pt("Object",Object),Pt("TransferableGridIndex",Cc),Pt("Color",Xr),Pt("Error",Error),Pt("AJAXError",dt),Pt("ResolvedImage",ha),Pt("StylePropertyFunction",Sc),Pt("StyleExpression",xf,{omit:["_evaluator"]}),Pt("ZoomDependentExpression",wc),Pt("ZoomConstantExpression",xc),Pt("CompoundExpression",Aa,{omit:["_evaluate"]});for(const p in gc)gc[p]._classRegistryKey||Pt(`Expression_${p}`,gc[p]);function kf(p){return p&&typeof ArrayBuffer<"u"&&(p instanceof ArrayBuffer||p.constructor&&p.constructor.name==="ArrayBuffer")}function Wv(p){return p.$name||p.constructor._classRegistryKey}function Lb(p){return!function(h){if(h===null||typeof h!="object")return!1;const v=Wv(h);return!(!v||v==="Object")}(p)&&(p==null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||p instanceof Boolean||p instanceof Number||p instanceof String||p instanceof Date||p instanceof RegExp||p instanceof Blob||p instanceof Error||kf(p)||pe(p)||ArrayBuffer.isView(p)||p instanceof ImageData)}function Ac(p,h){if(Lb(p))return(kf(p)||pe(p))&&h&&h.push(p),ArrayBuffer.isView(p)&&h&&h.push(p.buffer),p instanceof ImageData&&h&&h.push(p.data.buffer),p;if(Array.isArray(p)){const I=[];for(const k of p)I.push(Ac(k,h));return I}if(typeof p!="object")throw new Error("can't serialize object of type "+typeof p);const v=Wv(p);if(!v)throw new Error(`can't serialize object of unregistered class ${p.constructor.name}`);if(!Ma[v])throw new Error(`${v} is not registered.`);const{klass:b}=Ma[v],E=b.serialize?b.serialize(p,h):{};if(b.serialize){if(h&&E===h[h.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const I in p){if(!p.hasOwnProperty(I)||Ma[v].omit.indexOf(I)>=0)continue;const k=p[I];E[I]=Ma[v].shallow.indexOf(I)>=0?k:Ac(k,h)}p instanceof Error&&(E.message=p.message)}if(E.$name)throw new Error("$name property is reserved for worker serialization logic.");return v!=="Object"&&(E.$name=v),E}function Dc(p){if(Lb(p))return p;if(Array.isArray(p))return p.map(Dc);if(typeof p!="object")throw new Error("can't deserialize object of type "+typeof p);const h=Wv(p)||"Object";if(!Ma[h])throw new Error(`can't deserialize unregistered class ${h}`);const{klass:v}=Ma[h];if(!v)throw new Error(`can't deserialize unregistered class ${h}`);if(v.deserialize)return v.deserialize(p);const b=Object.create(v.prototype);for(const E of Object.keys(p)){if(E==="$name")continue;const I=p[E];b[E]=Ma[h].shallow.indexOf(E)>=0?I:Dc(I)}return b}class qv{constructor(){this.first=!0}update(h,v){const b=Math.floor(h);return this.first?(this.first=!1,this.lastIntegerZoom=b,this.lastIntegerZoomTime=0,this.lastZoom=h,this.lastFloorZoom=b,!0):(this.lastFloorZoom>b?(this.lastIntegerZoom=b+1,this.lastIntegerZoomTime=v):this.lastFloorZoom<b&&(this.lastIntegerZoom=b,this.lastIntegerZoomTime=v),h!==this.lastZoom&&(this.lastZoom=h,this.lastFloorZoom=b,!0))}}const Lr={"Latin-1 Supplement":p=>p>=128&&p<=255,"Hangul Jamo":p=>p>=4352&&p<=4607,Khmer:p=>p>=6016&&p<=6143,"General Punctuation":p=>p>=8192&&p<=8303,"Letterlike Symbols":p=>p>=8448&&p<=8527,"Number Forms":p=>p>=8528&&p<=8591,"Miscellaneous Technical":p=>p>=8960&&p<=9215,"Control Pictures":p=>p>=9216&&p<=9279,"Optical Character Recognition":p=>p>=9280&&p<=9311,"Enclosed Alphanumerics":p=>p>=9312&&p<=9471,"Geometric Shapes":p=>p>=9632&&p<=9727,"Miscellaneous Symbols":p=>p>=9728&&p<=9983,"Miscellaneous Symbols and Arrows":p=>p>=11008&&p<=11263,"Ideographic Description Characters":p=>p>=12272&&p<=12287,"CJK Symbols and Punctuation":p=>p>=12288&&p<=12351,Katakana:p=>p>=12448&&p<=12543,Kanbun:p=>p>=12688&&p<=12703,"CJK Strokes":p=>p>=12736&&p<=12783,"Enclosed CJK Letters and Months":p=>p>=12800&&p<=13055,"CJK Compatibility":p=>p>=13056&&p<=13311,"Yijing Hexagram Symbols":p=>p>=19904&&p<=19967,"Private Use Area":p=>p>=57344&&p<=63743,"Vertical Forms":p=>p>=65040&&p<=65055,"CJK Compatibility Forms":p=>p>=65072&&p<=65103,"Small Form Variants":p=>p>=65104&&p<=65135,"Halfwidth and Fullwidth Forms":p=>p>=65280&&p<=65519};function Zv(p){for(const h of p)if(Xv(h.charCodeAt(0)))return!0;return!1}function IA(p){for(const h of p)if(!Mc(h.charCodeAt(0)))return!1;return!0}function jv(p){const h=p.map(v=>{try{return new RegExp(`\\p{sc=${v}}`,"u").source}catch{return null}}).filter(v=>v);return new RegExp(h.join("|"),"u")}const kA=jv(["Arab","Dupl","Mong","Ougr","Syrc"]);function Mc(p){return!kA.test(String.fromCodePoint(p))}const Pb=jv(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Xv(p){return!(p!==746&&p!==747&&(p<4352||!(Lr["CJK Compatibility Forms"](p)&&!(p>=65097&&p<=65103)||Lr["CJK Compatibility"](p)||Lr["CJK Strokes"](p)||!(!Lr["CJK Symbols and Punctuation"](p)||p>=12296&&p<=12305||p>=12308&&p<=12319||p===12336)||Lr["Enclosed CJK Letters and Months"](p)||Lr["Ideographic Description Characters"](p)||Lr.Kanbun(p)||Lr.Katakana(p)&&p!==12540||!(!Lr["Halfwidth and Fullwidth Forms"](p)||p===65288||p===65289||p===65293||p>=65306&&p<=65310||p===65339||p===65341||p===65343||p>=65371&&p<=65503||p===65507||p>=65512&&p<=65519)||!(!Lr["Small Form Variants"](p)||p>=65112&&p<=65118||p>=65123&&p<=65126)||Lr["Vertical Forms"](p)||Lr["Yijing Hexagram Symbols"](p)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(p))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(p))||Pb.test(String.fromCodePoint(p)))))}function Rb(p){return!(Xv(p)||function(h){return!!(Lr["Latin-1 Supplement"](h)&&(h===167||h===169||h===174||h===177||h===188||h===189||h===190||h===215||h===247)||Lr["General Punctuation"](h)&&(h===8214||h===8224||h===8225||h===8240||h===8241||h===8251||h===8252||h===8258||h===8263||h===8264||h===8265||h===8273)||Lr["Letterlike Symbols"](h)||Lr["Number Forms"](h)||Lr["Miscellaneous Technical"](h)&&(h>=8960&&h<=8967||h>=8972&&h<=8991||h>=8996&&h<=9e3||h===9003||h>=9085&&h<=9114||h>=9150&&h<=9165||h===9167||h>=9169&&h<=9179||h>=9186&&h<=9215)||Lr["Control Pictures"](h)&&h!==9251||Lr["Optical Character Recognition"](h)||Lr["Enclosed Alphanumerics"](h)||Lr["Geometric Shapes"](h)||Lr["Miscellaneous Symbols"](h)&&!(h>=9754&&h<=9759)||Lr["Miscellaneous Symbols and Arrows"](h)&&(h>=11026&&h<=11055||h>=11088&&h<=11097||h>=11192&&h<=11243)||Lr["CJK Symbols and Punctuation"](h)||Lr.Katakana(h)||Lr["Private Use Area"](h)||Lr["CJK Compatibility Forms"](h)||Lr["Small Form Variants"](h)||Lr["Halfwidth and Fullwidth Forms"](h)||h===8734||h===8756||h===8757||h>=9984&&h<=10087||h>=10102&&h<=10131||h===65532||h===65533)}(p))}const LA=jv(["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 Yv(p){return LA.test(String.fromCodePoint(p))}function PA(p,h){return!(!h&&Yv(p)||p>=2304&&p<=3583||p>=3840&&p<=4255||Lr.Khmer(p))}function RA(p){for(const h of p)if(Yv(h.charCodeAt(0)))return!0;return!1}const fa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(p){this.pluginStatus=p.pluginStatus,this.pluginURL=p.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(p){this.applyArabicShaping=p.applyArabicShaping,this.processBidirectionalText=p.processBidirectionalText,this.processStyledBidirectionalText=p.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class dn{constructor(h,v){this.zoom=h,v?(this.now=v.now,this.fadeDuration=v.fadeDuration,this.zoomHistory=v.zoomHistory,this.transition=v.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new qv,this.transition={})}isSupportedScript(h){return function(v,b){for(const E of v)if(!PA(E.charCodeAt(0),b))return!1;return!0}(h,fa.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const h=this.zoom,v=h-Math.floor(h),b=this.crossFadingFactor();return h>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:v+(1-v)*b}:{fromScale:.5,toScale:1,t:1-(1-b)*v}}}class Ic{constructor(h,v){this.property=h,this.value=v,this.expression=function(b,E){if(_f(b))return new Sc(b,E);if(wf(b)){const I=kv(b,E);if(I.result==="error")throw new Error(I.value.map(k=>`${k.key}: ${k.message}`).join(", "));return I.value}{let I=b;return E.type==="color"&&typeof b=="string"?I=Xr.parse(b):E.type!=="padding"||typeof b!="number"&&!Array.isArray(b)?E.type==="variableAnchorOffsetCollection"&&Array.isArray(b)&&(I=Ca.parse(b)):I=ua.parse(b),{kind:"constant",evaluate:()=>I}}}(v===void 0?h.specification.default:v,h.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(h,v,b){return this.property.possiblyEvaluate(this,h,v,b)}}class Lf{constructor(h){this.property=h,this.value=new Ic(h,void 0)}transitioned(h,v){return new Nb(this.property,this.value,v,U({},h.transition,this.transition),h.now)}untransitioned(){return new Nb(this.property,this.value,null,{},0)}}class Pf{constructor(h){this._properties=h,this._values=Object.create(h.defaultTransitionablePropertyValues)}getValue(h){return X(this._values[h].value.value)}setValue(h,v){Object.prototype.hasOwnProperty.call(this._values,h)||(this._values[h]=new Lf(this._values[h].property)),this._values[h].value=new Ic(this._values[h].property,v===null?void 0:X(v))}getTransition(h){return X(this._values[h].transition)}setTransition(h,v){Object.prototype.hasOwnProperty.call(this._values,h)||(this._values[h]=new Lf(this._values[h].property)),this._values[h].transition=X(v)||void 0}serialize(){const h={};for(const v of Object.keys(this._values)){const b=this.getValue(v);b!==void 0&&(h[v]=b);const E=this.getTransition(v);E!==void 0&&(h[`${v}-transition`]=E)}return h}transitioned(h,v){const b=new Ah(this._properties);for(const E of Object.keys(this._values))b._values[E]=this._values[E].transitioned(h,v._values[E]);return b}untransitioned(){const h=new Ah(this._properties);for(const v of Object.keys(this._values))h._values[v]=this._values[v].untransitioned();return h}}class Nb{constructor(h,v,b,E,I){this.property=h,this.value=v,this.begin=I+E.delay||0,this.end=this.begin+E.duration||0,h.specification.transition&&(E.delay||E.duration)&&(this.prior=b)}possiblyEvaluate(h,v,b){const E=h.now||0,I=this.value.possiblyEvaluate(h,v,b),k=this.prior;if(k){if(E>this.end)return this.prior=null,I;if(this.value.isDataDriven())return this.prior=null,I;if(E<this.begin)return k.possiblyEvaluate(h,v,b);{const R=(E-this.begin)/(this.end-this.begin);return this.property.interpolate(k.possiblyEvaluate(h,v,b),I,function(z){if(z<=0)return 0;if(z>=1)return 1;const G=z*z,W=G*z;return 4*(z<.5?W:3*(z-G)+W-.75)}(R))}}return I}}class Ah{constructor(h){this._properties=h,this._values=Object.create(h.defaultTransitioningPropertyValues)}possiblyEvaluate(h,v,b){const E=new Mh(this._properties);for(const I of Object.keys(this._values))E._values[I]=this._values[I].possiblyEvaluate(h,v,b);return E}hasTransition(){for(const h of Object.keys(this._values))if(this._values[h].prior)return!0;return!1}}class Dh{constructor(h){this._properties=h,this._values=Object.create(h.defaultPropertyValues)}hasValue(h){return this._values[h].value!==void 0}getValue(h){return X(this._values[h].value)}setValue(h,v){this._values[h]=new Ic(this._values[h].property,v===null?void 0:X(v))}serialize(){const h={};for(const v of Object.keys(this._values)){const b=this.getValue(v);b!==void 0&&(h[v]=b)}return h}possiblyEvaluate(h,v,b){const E=new Mh(this._properties);for(const I of Object.keys(this._values))E._values[I]=this._values[I].possiblyEvaluate(h,v,b);return E}}class Io{constructor(h,v,b){this.property=h,this.value=v,this.parameters=b}isConstant(){return this.value.kind==="constant"}constantOr(h){return this.value.kind==="constant"?this.value.value:h}evaluate(h,v,b,E){return this.property.evaluate(this.value,this.parameters,h,v,b,E)}}class Mh{constructor(h){this._properties=h,this._values=Object.create(h.defaultPossiblyEvaluatedValues)}get(h){return this._values[h]}}class Ot{constructor(h){this.specification=h}possiblyEvaluate(h,v){if(h.isDataDriven())throw new Error("Value should not be data driven");return h.expression.evaluate(v)}interpolate(h,v,b){const E=$i[this.specification.type];return E?E(h,v,b):h}}class Kt{constructor(h,v){this.specification=h,this.overrides=v}possiblyEvaluate(h,v,b,E){return new Io(this,h.expression.kind==="constant"||h.expression.kind==="camera"?{kind:"constant",value:h.expression.evaluate(v,null,{},b,E)}:h.expression,v)}interpolate(h,v,b){if(h.value.kind!=="constant"||v.value.kind!=="constant")return h;if(h.value.value===void 0||v.value.value===void 0)return new Io(this,{kind:"constant",value:void 0},h.parameters);const E=$i[this.specification.type];if(E){const I=E(h.value.value,v.value.value,b);return new Io(this,{kind:"constant",value:I},h.parameters)}return h}evaluate(h,v,b,E,I,k){return h.kind==="constant"?h.value:h.evaluate(v,b,E,I,k)}}class Rf extends Kt{possiblyEvaluate(h,v,b,E){if(h.value===void 0)return new Io(this,{kind:"constant",value:void 0},v);if(h.expression.kind==="constant"){const I=h.expression.evaluate(v,null,{},b,E),k=h.property.specification.type==="resolvedImage"&&typeof I!="string"?I.name:I,R=this._calculate(k,k,k,v);return new Io(this,{kind:"constant",value:R},v)}if(h.expression.kind==="camera"){const I=this._calculate(h.expression.evaluate({zoom:v.zoom-1}),h.expression.evaluate({zoom:v.zoom}),h.expression.evaluate({zoom:v.zoom+1}),v);return new Io(this,{kind:"constant",value:I},v)}return new Io(this,h.expression,v)}evaluate(h,v,b,E,I,k){if(h.kind==="source"){const R=h.evaluate(v,b,E,I,k);return this._calculate(R,R,R,v)}return h.kind==="composite"?this._calculate(h.evaluate({zoom:Math.floor(v.zoom)-1},b,E),h.evaluate({zoom:Math.floor(v.zoom)},b,E),h.evaluate({zoom:Math.floor(v.zoom)+1},b,E),v):h.value}_calculate(h,v,b,E){return E.zoom>E.zoomHistory.lastIntegerZoom?{from:h,to:v}:{from:b,to:v}}interpolate(h){return h}}class Nf{constructor(h){this.specification=h}possiblyEvaluate(h,v,b,E){if(h.value!==void 0){if(h.expression.kind==="constant"){const I=h.expression.evaluate(v,null,{},b,E);return this._calculate(I,I,I,v)}return this._calculate(h.expression.evaluate(new dn(Math.floor(v.zoom-1),v)),h.expression.evaluate(new dn(Math.floor(v.zoom),v)),h.expression.evaluate(new dn(Math.floor(v.zoom+1),v)),v)}}_calculate(h,v,b,E){return E.zoom>E.zoomHistory.lastIntegerZoom?{from:h,to:v}:{from:b,to:v}}interpolate(h){return h}}class Kv{constructor(h){this.specification=h}possiblyEvaluate(h,v,b,E){return!!h.expression.evaluate(v,null,{},b,E)}interpolate(){return!1}}class D{constructor(h){this.properties=h,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const v in h){const b=h[v];b.specification.overridable&&this.overridableProperties.push(v);const E=this.defaultPropertyValues[v]=new Ic(b,void 0),I=this.defaultTransitionablePropertyValues[v]=new Lf(b);this.defaultTransitioningPropertyValues[v]=I.untransitioned(),this.defaultPossiblyEvaluatedValues[v]=E.possiblyEvaluate({})}}}Pt("DataDrivenProperty",Kt),Pt("DataConstantProperty",Ot),Pt("CrossFadedDataDrivenProperty",Rf),Pt("CrossFadedProperty",Nf),Pt("ColorRampProperty",Kv);const u="-transition";class y extends _r{constructor(h,v){if(super(),this.id=h.id,this.type=h.type,this._featureFilter={filter:()=>!0,needGeometry:!1},h.type!=="custom"&&(this.metadata=h.metadata,this.minzoom=h.minzoom,this.maxzoom=h.maxzoom,h.type!=="background"&&(this.source=h.source,this.sourceLayer=h["source-layer"],this.filter=h.filter),v.layout&&(this._unevaluatedLayout=new Dh(v.layout)),v.paint)){this._transitionablePaint=new Pf(v.paint);for(const b in h.paint)this.setPaintProperty(b,h.paint[b],{validate:!1});for(const b in h.layout)this.setLayoutProperty(b,h.layout[b],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Mh(v.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(h){return h==="visibility"?this.visibility:this._unevaluatedLayout.getValue(h)}setLayoutProperty(h,v,b={}){v!=null&&this._validate(kb,`layers.${this.id}.layout.${h}`,h,v,b)||(h!=="visibility"?this._unevaluatedLayout.setValue(h,v):this.visibility=v)}getPaintProperty(h){return h.endsWith(u)?this._transitionablePaint.getTransition(h.slice(0,-11)):this._transitionablePaint.getValue(h)}setPaintProperty(h,v,b={}){if(v!=null&&this._validate(Ib,`layers.${this.id}.paint.${h}`,h,v,b))return!1;if(h.endsWith(u))return this._transitionablePaint.setTransition(h.slice(0,-11),v||void 0),!1;{const E=this._transitionablePaint._values[h],I=E.property.specification["property-type"]==="cross-faded-data-driven",k=E.value.isDataDriven(),R=E.value;this._transitionablePaint.setValue(h,v),this._handleSpecialPaintPropertyUpdate(h);const z=this._transitionablePaint._values[h].value;return z.isDataDriven()||k||I||this._handleOverridablePaintPropertyUpdate(h,R,z)}}_handleSpecialPaintPropertyUpdate(h){}_handleOverridablePaintPropertyUpdate(h,v,b){return!1}isHidden(h){return!!(this.minzoom&&h<this.minzoom)||!!(this.maxzoom&&h>=this.maxzoom)||this.visibility==="none"}updateTransitions(h){this._transitioningPaint=this._transitionablePaint.transitioned(h,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(h,v){h.getCrossfadeParameters&&(this._crossfadeParameters=h.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(h,void 0,v)),this.paint=this._transitioningPaint.possiblyEvaluate(h,void 0,v)}serialize(){const h={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&&(h.layout=h.layout||{},h.layout.visibility=this.visibility),Y(h,(v,b)=>!(v===void 0||b==="layout"&&!Object.keys(v).length||b==="paint"&&!Object.keys(v).length))}_validate(h,v,b,E,I={}){return(!I||I.validate!==!1)&&Hv(this,h.call(ml,{key:v,layerType:this.type,objectKey:b,value:E,styleSpec:Le,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const h in this.paint._values){const v=this.paint.get(h);if(v instanceof Io&&yc(v.property.specification)&&(v.value.kind==="source"||v.value.kind==="composite")&&v.value.isStateDependent)return!0}return!1}}const S={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class T{constructor(h,v){this._structArray=h,this._pos1=v*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class A{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(h,v){return h._trim(),v&&(h.isTransferred=!0,v.push(h.arrayBuffer)),{length:h.length,arrayBuffer:h.arrayBuffer}}static deserialize(h){const v=Object.create(this.prototype);return v.arrayBuffer=h.arrayBuffer,v.length=h.length,v.capacity=h.arrayBuffer.byteLength/v.bytesPerElement,v._refreshViews(),v}_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(h){this.reserve(h),this.length=h}reserve(h){if(h>this.capacity){this.capacity=Math.max(h,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const v=this.uint8;this._refreshViews(),v&&this.uint8.set(v)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function N(p,h=1){let v=0,b=0;return{members:p.map(E=>{const I=S[E.type].BYTES_PER_ELEMENT,k=v=B(v,Math.max(h,I)),R=E.components||1;return b=Math.max(b,I),v+=I*R,{name:E.name,type:E.type,components:R,offset:k}}),size:B(v,Math.max(b,h)),alignment:h}}function B(p,h){return Math.ceil(p/h)*h}class $ extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v){const b=this.length;return this.resize(b+1),this.emplace(b,h,v)}emplace(h,v,b){const E=2*h;return this.int16[E+0]=v,this.int16[E+1]=b,h}}$.prototype.bytesPerElement=4,Pt("StructArrayLayout2i4",$);class q extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.int16[I+0]=v,this.int16[I+1]=b,this.int16[I+2]=E,h}}q.prototype.bytesPerElement=6,Pt("StructArrayLayout3i6",q);class K extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E){const I=this.length;return this.resize(I+1),this.emplace(I,h,v,b,E)}emplace(h,v,b,E,I){const k=4*h;return this.int16[k+0]=v,this.int16[k+1]=b,this.int16[k+2]=E,this.int16[k+3]=I,h}}K.prototype.bytesPerElement=8,Pt("StructArrayLayout4i8",K);class J extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=6*h;return this.int16[z+0]=v,this.int16[z+1]=b,this.int16[z+2]=E,this.int16[z+3]=I,this.int16[z+4]=k,this.int16[z+5]=R,h}}J.prototype.bytesPerElement=12,Pt("StructArrayLayout2i4i12",J);class ae extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=4*h,G=8*h;return this.int16[z+0]=v,this.int16[z+1]=b,this.uint8[G+4]=E,this.uint8[G+5]=I,this.uint8[G+6]=k,this.uint8[G+7]=R,h}}ae.prototype.bytesPerElement=8,Pt("StructArrayLayout2i4ub8",ae);class ue extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v){const b=this.length;return this.resize(b+1),this.emplace(b,h,v)}emplace(h,v,b){const E=2*h;return this.float32[E+0]=v,this.float32[E+1]=b,h}}ue.prototype.bytesPerElement=8,Pt("StructArrayLayout2f8",ue);class fe extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k,R,z,G,W){const j=this.length;return this.resize(j+1),this.emplace(j,h,v,b,E,I,k,R,z,G,W)}emplace(h,v,b,E,I,k,R,z,G,W,j){const ee=10*h;return this.uint16[ee+0]=v,this.uint16[ee+1]=b,this.uint16[ee+2]=E,this.uint16[ee+3]=I,this.uint16[ee+4]=k,this.uint16[ee+5]=R,this.uint16[ee+6]=z,this.uint16[ee+7]=G,this.uint16[ee+8]=W,this.uint16[ee+9]=j,h}}fe.prototype.bytesPerElement=20,Pt("StructArrayLayout10ui20",fe);class be extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k,R,z,G,W,j,ee){const ne=this.length;return this.resize(ne+1),this.emplace(ne,h,v,b,E,I,k,R,z,G,W,j,ee)}emplace(h,v,b,E,I,k,R,z,G,W,j,ee,ne){const se=12*h;return this.int16[se+0]=v,this.int16[se+1]=b,this.int16[se+2]=E,this.int16[se+3]=I,this.uint16[se+4]=k,this.uint16[se+5]=R,this.uint16[se+6]=z,this.uint16[se+7]=G,this.int16[se+8]=W,this.int16[se+9]=j,this.int16[se+10]=ee,this.int16[se+11]=ne,h}}be.prototype.bytesPerElement=24,Pt("StructArrayLayout4i4ui4i24",be);class Se extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.float32[I+0]=v,this.float32[I+1]=b,this.float32[I+2]=E,h}}Se.prototype.bytesPerElement=12,Pt("StructArrayLayout3f12",Se);class Te extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(h){const v=this.length;return this.resize(v+1),this.emplace(v,h)}emplace(h,v){return this.uint32[1*h+0]=v,h}}Te.prototype.bytesPerElement=4,Pt("StructArrayLayout1ul4",Te);class Ce extends A{_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(h,v,b,E,I,k,R,z,G){const W=this.length;return this.resize(W+1),this.emplace(W,h,v,b,E,I,k,R,z,G)}emplace(h,v,b,E,I,k,R,z,G,W){const j=10*h,ee=5*h;return this.int16[j+0]=v,this.int16[j+1]=b,this.int16[j+2]=E,this.int16[j+3]=I,this.int16[j+4]=k,this.int16[j+5]=R,this.uint32[ee+3]=z,this.uint16[j+8]=G,this.uint16[j+9]=W,h}}Ce.prototype.bytesPerElement=20,Pt("StructArrayLayout6i1ul2ui20",Ce);class ve extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=6*h;return this.int16[z+0]=v,this.int16[z+1]=b,this.int16[z+2]=E,this.int16[z+3]=I,this.int16[z+4]=k,this.int16[z+5]=R,h}}ve.prototype.bytesPerElement=12,Pt("StructArrayLayout2i2i2i12",ve);class Ie extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I){const k=this.length;return this.resize(k+1),this.emplace(k,h,v,b,E,I)}emplace(h,v,b,E,I,k){const R=4*h,z=8*h;return this.float32[R+0]=v,this.float32[R+1]=b,this.float32[R+2]=E,this.int16[z+6]=I,this.int16[z+7]=k,h}}Ie.prototype.bytesPerElement=16,Pt("StructArrayLayout2f1f2i16",Ie);class Pe extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=16*h,G=4*h,W=8*h;return this.uint8[z+0]=v,this.uint8[z+1]=b,this.float32[G+1]=E,this.float32[G+2]=I,this.int16[W+6]=k,this.int16[W+7]=R,h}}Pe.prototype.bytesPerElement=16,Pt("StructArrayLayout2ub2f2i16",Pe);class Ve extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.uint16[I+0]=v,this.uint16[I+1]=b,this.uint16[I+2]=E,h}}Ve.prototype.bytesPerElement=6,Pt("StructArrayLayout3ui6",Ve);class Ke extends A{_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(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we)}emplace(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe){const Ae=24*h,Re=12*h,He=48*h;return this.int16[Ae+0]=v,this.int16[Ae+1]=b,this.uint16[Ae+2]=E,this.uint16[Ae+3]=I,this.uint32[Re+2]=k,this.uint32[Re+3]=R,this.uint32[Re+4]=z,this.uint16[Ae+10]=G,this.uint16[Ae+11]=W,this.uint16[Ae+12]=j,this.float32[Re+7]=ee,this.float32[Re+8]=ne,this.uint8[He+36]=se,this.uint8[He+37]=ce,this.uint8[He+38]=ye,this.uint32[Re+10]=we,this.int16[Ae+22]=Oe,h}}Ke.prototype.bytesPerElement=48,Pt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ke);class st extends A{_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(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe,Ae,Re,He,et,Ct,Yt,xt,_t,Gt,Rt){const It=this.length;return this.resize(It+1),this.emplace(It,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe,Ae,Re,He,et,Ct,Yt,xt,_t,Gt,Rt)}emplace(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe,Ae,Re,He,et,Ct,Yt,xt,_t,Gt,Rt,It){const Ye=32*h,Ut=16*h;return this.int16[Ye+0]=v,this.int16[Ye+1]=b,this.int16[Ye+2]=E,this.int16[Ye+3]=I,this.int16[Ye+4]=k,this.int16[Ye+5]=R,this.int16[Ye+6]=z,this.int16[Ye+7]=G,this.uint16[Ye+8]=W,this.uint16[Ye+9]=j,this.uint16[Ye+10]=ee,this.uint16[Ye+11]=ne,this.uint16[Ye+12]=se,this.uint16[Ye+13]=ce,this.uint16[Ye+14]=ye,this.uint16[Ye+15]=we,this.uint16[Ye+16]=Oe,this.uint16[Ye+17]=Ae,this.uint16[Ye+18]=Re,this.uint16[Ye+19]=He,this.uint16[Ye+20]=et,this.uint16[Ye+21]=Ct,this.uint16[Ye+22]=Yt,this.uint32[Ut+12]=xt,this.float32[Ut+13]=_t,this.float32[Ut+14]=Gt,this.uint16[Ye+30]=Rt,this.uint16[Ye+31]=It,h}}st.prototype.bytesPerElement=64,Pt("StructArrayLayout8i15ui1ul2f2ui64",st);class bt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h){const v=this.length;return this.resize(v+1),this.emplace(v,h)}emplace(h,v){return this.float32[1*h+0]=v,h}}bt.prototype.bytesPerElement=4,Pt("StructArrayLayout1f4",bt);class Mt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.uint16[6*h+0]=v,this.float32[I+1]=b,this.float32[I+2]=E,h}}Mt.prototype.bytesPerElement=12,Pt("StructArrayLayout1ui2f12",Mt);class gt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=4*h;return this.uint32[2*h+0]=v,this.uint16[I+2]=b,this.uint16[I+3]=E,h}}gt.prototype.bytesPerElement=8,Pt("StructArrayLayout1ul2ui8",gt);class pt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v){const b=this.length;return this.resize(b+1),this.emplace(b,h,v)}emplace(h,v,b){const E=2*h;return this.uint16[E+0]=v,this.uint16[E+1]=b,h}}pt.prototype.bytesPerElement=4,Pt("StructArrayLayout2ui4",pt);class zt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h){const v=this.length;return this.resize(v+1),this.emplace(v,h)}emplace(h,v){return this.uint16[1*h+0]=v,h}}zt.prototype.bytesPerElement=2,Pt("StructArrayLayout1ui2",zt);class or extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v,b,E){const I=this.length;return this.resize(I+1),this.emplace(I,h,v,b,E)}emplace(h,v,b,E,I){const k=4*h;return this.float32[k+0]=v,this.float32[k+1]=b,this.float32[k+2]=E,this.float32[k+3]=I,h}}or.prototype.bytesPerElement=16,Pt("StructArrayLayout4f16",or);class mt extends T{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 f(this.anchorPointX,this.anchorPointY)}}mt.prototype.size=20;class Et extends Ce{get(h){return new mt(this,h)}}Pt("CollisionBoxArray",Et);class rr extends T{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(h){this._structArray.uint8[this._pos1+37]=h}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(h){this._structArray.uint8[this._pos1+38]=h}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(h){this._structArray.uint32[this._pos4+10]=h}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}rr.prototype.size=48;class fn extends Ke{get(h){return new rr(this,h)}}Pt("PlacedSymbolArray",fn);class mr extends T{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(h){this._structArray.uint32[this._pos4+12]=h}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]}}mr.prototype.size=64;class Mr extends st{get(h){return new mr(this,h)}}Pt("SymbolInstanceArray",Mr);class pn extends bt{getoffsetX(h){return this.float32[1*h+0]}}Pt("GlyphOffsetArray",pn);class vi extends q{getx(h){return this.int16[3*h+0]}gety(h){return this.int16[3*h+1]}gettileUnitDistanceFromAnchor(h){return this.int16[3*h+2]}}Pt("SymbolLineVertexArray",vi);class ja extends T{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]}}ja.prototype.size=12;class gn extends Mt{get(h){return new ja(this,h)}}Pt("TextAnchorOffsetArray",gn);class Ui extends T{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]}}Ui.prototype.size=8;class ki extends gt{get(h){return new Ui(this,h)}}Pt("FeatureIndexArray",ki);class mi extends ${}class Li extends ${}class ko extends ${}class kc extends J{}class Of extends ae{}class Lc extends ue{}class Ia extends fe{}class zf extends be{}class Jv extends Se{}class ka extends Te{}class La extends ve{}class Ms extends Pe{}class Xa extends Ve{}class ci extends pt{}const yi=N([{name:"a_pos",components:2,type:"Int16"}],4),{members:pa}=yi;class Pr{constructor(h=[]){this.segments=h}prepareSegment(h,v,b,E){let I=this.segments[this.segments.length-1];return h>Pr.MAX_VERTEX_ARRAY_LENGTH&&oe(`Max vertices per segment is ${Pr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${h}`),(!I||I.vertexLength+h>Pr.MAX_VERTEX_ARRAY_LENGTH||I.sortKey!==E)&&(I={vertexOffset:v.length,primitiveOffset:b.length,vertexLength:0,primitiveLength:0},E!==void 0&&(I.sortKey=E),this.segments.push(I)),I}get(){return this.segments}destroy(){for(const h of this.segments)for(const v in h.vaos)h.vaos[v].destroy()}static simpleSegment(h,v,b,E){return new Pr([{vertexOffset:h,primitiveOffset:v,vertexLength:b,primitiveLength:E,vaos:{},sortKey:0}])}}function yl(p,h){return 256*(p=F(Math.floor(p),0,255))+F(Math.floor(h),0,255)}Pr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Pt("SegmentVector",Pr);const Pc=N([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Rc={exports:{}},Ob={exports:{}};Ob.exports=function(p,h){var v,b,E,I,k,R,z,G;for(b=p.length-(v=3&p.length),E=h,k=3432918353,R=461845907,G=0;G<b;)z=255&p.charCodeAt(G)|(255&p.charCodeAt(++G))<<8|(255&p.charCodeAt(++G))<<16|(255&p.charCodeAt(++G))<<24,++G,E=27492+(65535&(I=5*(65535&(E=(E^=z=(65535&(z=(z=(65535&z)*k+(((z>>>16)*k&65535)<<16)&4294967295)<<15|z>>>17))*R+(((z>>>16)*R&65535)<<16)&4294967295)<<13|E>>>19))+((5*(E>>>16)&65535)<<16)&4294967295))+((58964+(I>>>16)&65535)<<16);switch(z=0,v){case 3:z^=(255&p.charCodeAt(G+2))<<16;case 2:z^=(255&p.charCodeAt(G+1))<<8;case 1:E^=z=(65535&(z=(z=(65535&(z^=255&p.charCodeAt(G)))*k+(((z>>>16)*k&65535)<<16)&4294967295)<<15|z>>>17))*R+(((z>>>16)*R&65535)<<16)&4294967295}return E^=p.length,E=2246822507*(65535&(E^=E>>>16))+((2246822507*(E>>>16)&65535)<<16)&4294967295,E=3266489909*(65535&(E^=E>>>13))+((3266489909*(E>>>16)&65535)<<16)&4294967295,(E^=E>>>16)>>>0};var NA=Ob.exports,zb={exports:{}};zb.exports=function(p,h){for(var v,b=p.length,E=h^b,I=0;b>=4;)v=1540483477*(65535&(v=255&p.charCodeAt(I)|(255&p.charCodeAt(++I))<<8|(255&p.charCodeAt(++I))<<16|(255&p.charCodeAt(++I))<<24))+((1540483477*(v>>>16)&65535)<<16),E=1540483477*(65535&E)+((1540483477*(E>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),b-=4,++I;switch(b){case 3:E^=(255&p.charCodeAt(I+2))<<16;case 2:E^=(255&p.charCodeAt(I+1))<<8;case 1:E=1540483477*(65535&(E^=255&p.charCodeAt(I)))+((1540483477*(E>>>16)&65535)<<16)}return E=1540483477*(65535&(E^=E>>>13))+((1540483477*(E>>>16)&65535)<<16),(E^=E>>>15)>>>0};var Is=NA,Bb=zb.exports;Rc.exports=Is,Rc.exports.murmur3=Is,Rc.exports.murmur2=Bb;var Bf=l(Rc.exports);class Ih{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(h,v,b,E){this.ids.push(Vf(h)),this.positions.push(v,b,E)}getPositions(h){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const v=Vf(h);let b=0,E=this.ids.length-1;for(;b<E;){const k=b+E>>1;this.ids[k]>=v?E=k:b=k+1}const I=[];for(;this.ids[b]===v;)I.push({index:this.positions[3*b],start:this.positions[3*b+1],end:this.positions[3*b+2]}),b++;return I}static serialize(h,v){const b=new Float64Array(h.ids),E=new Uint32Array(h.positions);return Ff(b,E,0,b.length-1),v&&v.push(b.buffer,E.buffer),{ids:b,positions:E}}static deserialize(h){const v=new Ih;return v.ids=h.ids,v.positions=h.positions,v.indexed=!0,v}}function Vf(p){const h=+p;return!isNaN(h)&&h<=Number.MAX_SAFE_INTEGER?h:Bf(String(p))}function Ff(p,h,v,b){for(;v<b;){const E=p[v+b>>1];let I=v-1,k=b+1;for(;;){do I++;while(p[I]<E);do k--;while(p[k]>E);if(I>=k)break;Nc(p,I,k),Nc(h,3*I,3*k),Nc(h,3*I+1,3*k+1),Nc(h,3*I+2,3*k+2)}k-v<b-k?(Ff(p,h,v,k),v=k+1):(Ff(p,h,k+1,b),b=k)}}function Nc(p,h,v){const b=p[h];p[h]=p[v],p[v]=b}Pt("FeaturePositionMap",Ih);class kh{constructor(h,v){this.gl=h.gl,this.location=v}}class Vb extends kh{constructor(h,v){super(h,v),this.current=0}set(h){this.current!==h&&(this.current=h,this.gl.uniform1f(this.location,h))}}class H$ extends kh{constructor(h,v){super(h,v),this.current=[0,0,0,0]}set(h){h[0]===this.current[0]&&h[1]===this.current[1]&&h[2]===this.current[2]&&h[3]===this.current[3]||(this.current=h,this.gl.uniform4f(this.location,h[0],h[1],h[2],h[3]))}}class W$ extends kh{constructor(h,v){super(h,v),this.current=Xr.transparent}set(h){h.r===this.current.r&&h.g===this.current.g&&h.b===this.current.b&&h.a===this.current.a||(this.current=h,this.gl.uniform4f(this.location,h.r,h.g,h.b,h.a))}}const Yme=new Float32Array(16);function OA(p){return[yl(255*p.r,255*p.g),yl(255*p.b,255*p.a)]}class Qv{constructor(h,v,b){this.value=h,this.uniformNames=v.map(E=>`u_${E}`),this.type=b}setUniform(h,v,b){h.set(b.constantOr(this.value))}getBinding(h,v,b){return this.type==="color"?new W$(h,v):new Vb(h,v)}}class $f{constructor(h,v){this.uniformNames=v.map(b=>`u_${b}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(h,v){this.pixelRatioFrom=v.pixelRatio,this.pixelRatioTo=h.pixelRatio,this.patternFrom=v.tlbr,this.patternTo=h.tlbr}setUniform(h,v,b,E){const I=E==="u_pattern_to"?this.patternTo:E==="u_pattern_from"?this.patternFrom:E==="u_pixel_ratio_to"?this.pixelRatioTo:E==="u_pixel_ratio_from"?this.pixelRatioFrom:null;I&&h.set(I)}getBinding(h,v,b){return b.substr(0,9)==="u_pattern"?new H$(h,v):new Vb(h,v)}}class _l{constructor(h,v,b,E){this.expression=h,this.type=b,this.maxValue=0,this.paintVertexAttributes=v.map(I=>({name:`a_${I}`,type:"Float32",components:b==="color"?2:1,offset:0})),this.paintVertexArray=new E}populatePaintArray(h,v,b,E,I){const k=this.paintVertexArray.length,R=this.expression.evaluate(new dn(0),v,{},E,[],I);this.paintVertexArray.resize(h),this._setPaintValue(k,h,R)}updatePaintArray(h,v,b,E){const I=this.expression.evaluate({zoom:0},b,E);this._setPaintValue(h,v,I)}_setPaintValue(h,v,b){if(this.type==="color"){const E=OA(b);for(let I=h;I<v;I++)this.paintVertexArray.emplace(I,E[0],E[1])}else{for(let E=h;E<v;E++)this.paintVertexArray.emplace(E,b);this.maxValue=Math.max(this.maxValue,Math.abs(b))}}upload(h){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=h.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Qo{constructor(h,v,b,E,I,k){this.expression=h,this.uniformNames=v.map(R=>`u_${R}_t`),this.type=b,this.useIntegerZoom=E,this.zoom=I,this.maxValue=0,this.paintVertexAttributes=v.map(R=>({name:`a_${R}`,type:"Float32",components:b==="color"?4:2,offset:0})),this.paintVertexArray=new k}populatePaintArray(h,v,b,E,I){const k=this.expression.evaluate(new dn(this.zoom),v,{},E,[],I),R=this.expression.evaluate(new dn(this.zoom+1),v,{},E,[],I),z=this.paintVertexArray.length;this.paintVertexArray.resize(h),this._setPaintValue(z,h,k,R)}updatePaintArray(h,v,b,E){const I=this.expression.evaluate({zoom:this.zoom},b,E),k=this.expression.evaluate({zoom:this.zoom+1},b,E);this._setPaintValue(h,v,I,k)}_setPaintValue(h,v,b,E){if(this.type==="color"){const I=OA(b),k=OA(E);for(let R=h;R<v;R++)this.paintVertexArray.emplace(R,I[0],I[1],k[0],k[1])}else{for(let I=h;I<v;I++)this.paintVertexArray.emplace(I,b,E);this.maxValue=Math.max(this.maxValue,Math.abs(b),Math.abs(E))}}upload(h){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=h.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(h,v){const b=this.useIntegerZoom?Math.floor(v.zoom):v.zoom,E=F(this.expression.interpolationFactor(b,this.zoom,this.zoom+1),0,1);h.set(E)}getBinding(h,v,b){return new Vb(h,v)}}class Oc{constructor(h,v,b,E,I,k){this.expression=h,this.type=v,this.useIntegerZoom=b,this.zoom=E,this.layerId=k,this.zoomInPaintVertexArray=new I,this.zoomOutPaintVertexArray=new I}populatePaintArray(h,v,b){const E=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(h),this.zoomOutPaintVertexArray.resize(h),this._setPaintValues(E,h,v.patterns&&v.patterns[this.layerId],b)}updatePaintArray(h,v,b,E,I){this._setPaintValues(h,v,b.patterns&&b.patterns[this.layerId],I)}_setPaintValues(h,v,b,E){if(!E||!b)return;const{min:I,mid:k,max:R}=b,z=E[I],G=E[k],W=E[R];if(z&&G&&W)for(let j=h;j<v;j++)this.zoomInPaintVertexArray.emplace(j,G.tl[0],G.tl[1],G.br[0],G.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],G.pixelRatio,z.pixelRatio),this.zoomOutPaintVertexArray.emplace(j,G.tl[0],G.tl[1],G.br[0],G.br[1],W.tl[0],W.tl[1],W.br[0],W.br[1],G.pixelRatio,W.pixelRatio)}upload(h){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=h.createVertexBuffer(this.zoomInPaintVertexArray,Pc.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=h.createVertexBuffer(this.zoomOutPaintVertexArray,Pc.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class q${constructor(h,v,b){this.binders={},this._buffers=[];const E=[];for(const I in h.paint._values){if(!b(I))continue;const k=h.paint.get(I);if(!(k instanceof Io&&yc(k.property.specification)))continue;const R=Kme(I,h.type),z=k.value,G=k.property.specification.type,W=k.property.useIntegerZoom,j=k.property.specification["property-type"],ee=j==="cross-faded"||j==="cross-faded-data-driven";if(z.kind==="constant")this.binders[I]=ee?new $f(z.value,R):new Qv(z.value,R,G),E.push(`/u_${I}`);else if(z.kind==="source"||ee){const ne=Z$(I,G,"source");this.binders[I]=ee?new Oc(z,G,W,v,ne,h.id):new _l(z,R,G,ne),E.push(`/a_${I}`)}else{const ne=Z$(I,G,"composite");this.binders[I]=new Qo(z,R,G,W,v,ne),E.push(`/z_${I}`)}}this.cacheKey=E.sort().join("")}getMaxValue(h){const v=this.binders[h];return v instanceof _l||v instanceof Qo?v.maxValue:0}populatePaintArrays(h,v,b,E,I){for(const k in this.binders){const R=this.binders[k];(R instanceof _l||R instanceof Qo||R instanceof Oc)&&R.populatePaintArray(h,v,b,E,I)}}setConstantPatternPositions(h,v){for(const b in this.binders){const E=this.binders[b];E instanceof $f&&E.setConstantPatternPositions(h,v)}}updatePaintArrays(h,v,b,E,I){let k=!1;for(const R in h){const z=v.getPositions(R);for(const G of z){const W=b.feature(G.index);for(const j in this.binders){const ee=this.binders[j];if((ee instanceof _l||ee instanceof Qo||ee instanceof Oc)&&ee.expression.isStateDependent===!0){const ne=E.paint.get(j);ee.expression=ne.value,ee.updatePaintArray(G.start,G.end,W,h[R],I),k=!0}}}}return k}defines(){const h=[];for(const v in this.binders){const b=this.binders[v];(b instanceof Qv||b instanceof $f)&&h.push(...b.uniformNames.map(E=>`#define HAS_UNIFORM_${E}`))}return h}getBinderAttributes(){const h=[];for(const v in this.binders){const b=this.binders[v];if(b instanceof _l||b instanceof Qo)for(let E=0;E<b.paintVertexAttributes.length;E++)h.push(b.paintVertexAttributes[E].name);else if(b instanceof Oc)for(let E=0;E<Pc.members.length;E++)h.push(Pc.members[E].name)}return h}getBinderUniforms(){const h=[];for(const v in this.binders){const b=this.binders[v];if(b instanceof Qv||b instanceof $f||b instanceof Qo)for(const E of b.uniformNames)h.push(E)}return h}getPaintVertexBuffers(){return this._buffers}getUniforms(h,v){const b=[];for(const E in this.binders){const I=this.binders[E];if(I instanceof Qv||I instanceof $f||I instanceof Qo){for(const k of I.uniformNames)if(v[k]){const R=I.getBinding(h,v[k],k);b.push({name:k,property:E,binding:R})}}}return b}setUniforms(h,v,b,E){for(const{name:I,property:k,binding:R}of v)this.binders[k].setUniform(R,E,b.get(k),I)}updatePaintBuffers(h){this._buffers=[];for(const v in this.binders){const b=this.binders[v];if(h&&b instanceof Oc){const E=h.fromScale===2?b.zoomInPaintVertexBuffer:b.zoomOutPaintVertexBuffer;E&&this._buffers.push(E)}else(b instanceof _l||b instanceof Qo)&&b.paintVertexBuffer&&this._buffers.push(b.paintVertexBuffer)}}upload(h){for(const v in this.binders){const b=this.binders[v];(b instanceof _l||b instanceof Qo||b instanceof Oc)&&b.upload(h)}this.updatePaintBuffers()}destroy(){for(const h in this.binders){const v=this.binders[h];(v instanceof _l||v instanceof Qo||v instanceof Oc)&&v.destroy()}}}class Lh{constructor(h,v,b=()=>!0){this.programConfigurations={};for(const E of h)this.programConfigurations[E.id]=new q$(E,v,b);this.needsUpload=!1,this._featureMap=new Ih,this._bufferOffset=0}populatePaintArrays(h,v,b,E,I,k){for(const R in this.programConfigurations)this.programConfigurations[R].populatePaintArrays(h,v,E,I,k);v.id!==void 0&&this._featureMap.add(v.id,b,this._bufferOffset,h),this._bufferOffset=h,this.needsUpload=!0}updatePaintArrays(h,v,b,E){for(const I of b)this.needsUpload=this.programConfigurations[I.id].updatePaintArrays(h,this._featureMap,v,I,E)||this.needsUpload}get(h){return this.programConfigurations[h]}upload(h){if(this.needsUpload){for(const v in this.programConfigurations)this.programConfigurations[v].upload(h);this.needsUpload=!1}}destroy(){for(const h in this.programConfigurations)this.programConfigurations[h].destroy()}}function Kme(p,h){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[p]||[p.replace(`${h}-`,"").replace(/-/g,"_")]}function Z$(p,h,v){const b={color:{source:ue,composite:or},number:{source:bt,composite:ue}},E=function(I){return{"line-pattern":{source:Ia,composite:Ia},"fill-pattern":{source:Ia,composite:Ia},"fill-extrusion-pattern":{source:Ia,composite:Ia}}[I]}(p);return E&&E[v]||b[h][v]}Pt("ConstantBinder",Qv),Pt("CrossFadedConstantBinder",$f),Pt("SourceExpressionBinder",_l),Pt("CrossFadedCompositeBinder",Oc),Pt("CompositeExpressionBinder",Qo),Pt("ProgramConfiguration",q$,{omit:["_buffers"]}),Pt("ProgramConfigurationSet",Lh);const Fn=8192,zA=Math.pow(2,14)-1,j$=-zA-1;function Ph(p){const h=Fn/p.extent,v=p.loadGeometry();for(let b=0;b<v.length;b++){const E=v[b];for(let I=0;I<E.length;I++){const k=E[I],R=Math.round(k.x*h),z=Math.round(k.y*h);k.x=F(R,j$,zA),k.y=F(z,j$,zA),(R<k.x||R>k.x+1||z<k.y||z>k.y+1)&&oe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return v}function Rh(p,h){return{type:p.type,id:p.id,properties:p.properties,geometry:h?Ph(p):[]}}function Fb(p,h,v,b,E){p.emplaceBack(2*h+(b+1)/2,2*v+(E+1)/2)}class BA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.layoutVertexArray=new Li,this.indexArray=new Xa,this.segments=new Pr,this.programConfigurations=new Lh(h.layers,h.zoom),this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){const E=this.layers[0],I=[];let k=null,R=!1;E.type==="circle"&&(k=E.layout.get("circle-sort-key"),R=!k.isConstant());for(const{feature:z,id:G,index:W,sourceLayerIndex:j}of h){const ee=this.layers[0]._featureFilter.needGeometry,ne=Rh(z,ee);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),ne,b))continue;const se=R?k.evaluate(ne,{},b):void 0,ce={id:G,properties:z.properties,type:z.type,sourceLayerIndex:j,index:W,geometry:ee?ne.geometry:Ph(z),patterns:{},sortKey:se};I.push(ce)}R&&I.sort((z,G)=>z.sortKey-G.sortKey);for(const z of I){const{geometry:G,index:W,sourceLayerIndex:j}=z,ee=h[W].feature;this.addFeature(z,G,W,b),v.featureIndex.insert(ee,G,W,j,this.index)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,pa),this.indexBuffer=h.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(h),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(h,v,b,E){for(const I of v)for(const k of I){const R=k.x,z=k.y;if(R<0||R>=Fn||z<0||z>=Fn)continue;const G=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,h.sortKey),W=G.vertexLength;Fb(this.layoutVertexArray,R,z,-1,-1),Fb(this.layoutVertexArray,R,z,1,-1),Fb(this.layoutVertexArray,R,z,1,1),Fb(this.layoutVertexArray,R,z,-1,1),this.indexArray.emplaceBack(W,W+1,W+2),this.indexArray.emplaceBack(W,W+3,W+2),G.vertexLength+=4,G.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,{},E)}}function X$(p,h){for(let v=0;v<p.length;v++)if(Gf(h,p[v]))return!0;for(let v=0;v<h.length;v++)if(Gf(p,h[v]))return!0;return!!VA(p,h)}function Jme(p,h,v){return!!Gf(p,h)||!!FA(h,p,v)}function Y$(p,h){if(p.length===1)return J$(h,p[0]);for(let v=0;v<h.length;v++){const b=h[v];for(let E=0;E<b.length;E++)if(Gf(p,b[E]))return!0}for(let v=0;v<p.length;v++)if(J$(h,p[v]))return!0;for(let v=0;v<h.length;v++)if(VA(p,h[v]))return!0;return!1}function Qme(p,h,v){if(p.length>1){if(VA(p,h))return!0;for(let b=0;b<h.length;b++)if(FA(h[b],p,v))return!0}for(let b=0;b<p.length;b++)if(FA(p[b],h,v))return!0;return!1}function VA(p,h){if(p.length===0||h.length===0)return!1;for(let v=0;v<p.length-1;v++){const b=p[v],E=p[v+1];for(let I=0;I<h.length-1;I++)if(eye(b,E,h[I],h[I+1]))return!0}return!1}function eye(p,h,v,b){return le(p,v,b)!==le(h,v,b)&&le(p,h,v)!==le(p,h,b)}function FA(p,h,v){const b=v*v;if(h.length===1)return p.distSqr(h[0])<b;for(let E=1;E<h.length;E++)if(K$(p,h[E-1],h[E])<b)return!0;return!1}function K$(p,h,v){const b=h.distSqr(v);if(b===0)return p.distSqr(h);const E=((p.x-h.x)*(v.x-h.x)+(p.y-h.y)*(v.y-h.y))/b;return p.distSqr(E<0?h:E>1?v:v.sub(h)._mult(E)._add(h))}function J$(p,h){let v,b,E,I=!1;for(let k=0;k<p.length;k++){v=p[k];for(let R=0,z=v.length-1;R<v.length;z=R++)b=v[R],E=v[z],b.y>h.y!=E.y>h.y&&h.x<(E.x-b.x)*(h.y-b.y)/(E.y-b.y)+b.x&&(I=!I)}return I}function Gf(p,h){let v=!1;for(let b=0,E=p.length-1;b<p.length;E=b++){const I=p[b],k=p[E];I.y>h.y!=k.y>h.y&&h.x<(k.x-I.x)*(h.y-I.y)/(k.y-I.y)+I.x&&(v=!v)}return v}function tye(p,h,v){const b=v[0],E=v[2];if(p.x<b.x&&h.x<b.x||p.x>E.x&&h.x>E.x||p.y<b.y&&h.y<b.y||p.y>E.y&&h.y>E.y)return!1;const I=le(p,h,v[0]);return I!==le(p,h,v[1])||I!==le(p,h,v[2])||I!==le(p,h,v[3])}function em(p,h,v){const b=h.paint.get(p).value;return b.kind==="constant"?b.value:v.programConfigurations.get(h.id).getMaxValue(p)}function $b(p){return Math.sqrt(p[0]*p[0]+p[1]*p[1])}function Gb(p,h,v,b,E){if(!h[0]&&!h[1])return p;const I=f.convert(h)._mult(E);v==="viewport"&&I._rotate(-b);const k=[];for(let R=0;R<p.length;R++)k.push(p[R].sub(I));return k}let Q$,e6;Pt("CircleBucket",BA,{omit:["layers"]});var rye={get paint(){return e6=e6||new D({"circle-radius":new Kt(Le.paint_circle["circle-radius"]),"circle-color":new Kt(Le.paint_circle["circle-color"]),"circle-blur":new Kt(Le.paint_circle["circle-blur"]),"circle-opacity":new Kt(Le.paint_circle["circle-opacity"]),"circle-translate":new Ot(Le.paint_circle["circle-translate"]),"circle-translate-anchor":new Ot(Le.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ot(Le.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ot(Le.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Kt(Le.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Kt(Le.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Kt(Le.paint_circle["circle-stroke-opacity"])})},get layout(){return Q$=Q$||new D({"circle-sort-key":new Kt(Le.layout_circle["circle-sort-key"])})}},Hi=1e-6,Uf=typeof Float32Array<"u"?Float32Array:Array;function $A(p){return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function t6(p,h,v){var b=h[0],E=h[1],I=h[2],k=h[3],R=h[4],z=h[5],G=h[6],W=h[7],j=h[8],ee=h[9],ne=h[10],se=h[11],ce=h[12],ye=h[13],we=h[14],Oe=h[15],Ae=v[0],Re=v[1],He=v[2],et=v[3];return p[0]=Ae*b+Re*R+He*j+et*ce,p[1]=Ae*E+Re*z+He*ee+et*ye,p[2]=Ae*I+Re*G+He*ne+et*we,p[3]=Ae*k+Re*W+He*se+et*Oe,p[4]=(Ae=v[4])*b+(Re=v[5])*R+(He=v[6])*j+(et=v[7])*ce,p[5]=Ae*E+Re*z+He*ee+et*ye,p[6]=Ae*I+Re*G+He*ne+et*we,p[7]=Ae*k+Re*W+He*se+et*Oe,p[8]=(Ae=v[8])*b+(Re=v[9])*R+(He=v[10])*j+(et=v[11])*ce,p[9]=Ae*E+Re*z+He*ee+et*ye,p[10]=Ae*I+Re*G+He*ne+et*we,p[11]=Ae*k+Re*W+He*se+et*Oe,p[12]=(Ae=v[12])*b+(Re=v[13])*R+(He=v[14])*j+(et=v[15])*ce,p[13]=Ae*E+Re*z+He*ee+et*ye,p[14]=Ae*I+Re*G+He*ne+et*we,p[15]=Ae*k+Re*W+He*se+et*Oe,p}Math.hypot||(Math.hypot=function(){for(var p=0,h=arguments.length;h--;)p+=arguments[h]*arguments[h];return Math.sqrt(p)});var tm,nye=t6;function Ub(p,h,v){var b=h[0],E=h[1],I=h[2],k=h[3];return p[0]=v[0]*b+v[4]*E+v[8]*I+v[12]*k,p[1]=v[1]*b+v[5]*E+v[9]*I+v[13]*k,p[2]=v[2]*b+v[6]*E+v[10]*I+v[14]*k,p[3]=v[3]*b+v[7]*E+v[11]*I+v[15]*k,p}tm=new Uf(4),Uf!=Float32Array&&(tm[0]=0,tm[1]=0,tm[2]=0,tm[3]=0);class iye extends y{constructor(h){super(h,rye)}createBucket(h){return new BA(h)}queryRadius(h){const v=h;return em("circle-radius",this,v)+em("circle-stroke-width",this,v)+$b(this.paint.get("circle-translate"))}queryIntersectsFeature(h,v,b,E,I,k,R,z){const G=Gb(h,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),k.angle,R),W=this.paint.get("circle-radius").evaluate(v,b)+this.paint.get("circle-stroke-width").evaluate(v,b),j=this.paint.get("circle-pitch-alignment")==="map",ee=j?G:function(se,ce){return se.map(ye=>r6(ye,ce))}(G,z),ne=j?W*R:W;for(const se of E)for(const ce of se){const ye=j?ce:r6(ce,z);let we=ne;const Oe=Ub([],[ce.x,ce.y,0,1],z);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?we*=Oe[3]/k.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(we*=k.cameraToCenterDistance/Oe[3]),Jme(ee,ye,we))return!0}return!1}}function r6(p,h){const v=Ub([],[p.x,p.y,0,1],h);return new f(v[0]/v[3],v[1]/v[3])}class n6 extends BA{}let i6;Pt("HeatmapBucket",n6,{omit:["layers"]});var aye={get paint(){return i6=i6||new D({"heatmap-radius":new Kt(Le.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Kt(Le.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ot(Le.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Kv(Le.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ot(Le.paint_heatmap["heatmap-opacity"])})}};function GA(p,{width:h,height:v},b,E){if(E){if(E instanceof Uint8ClampedArray)E=new Uint8Array(E.buffer);else if(E.length!==h*v*b)throw new RangeError(`mismatched image size. expected: ${E.length} but got: ${h*v*b}`)}else E=new Uint8Array(h*v*b);return p.width=h,p.height=v,p.data=E,p}function a6(p,{width:h,height:v},b){if(h===p.width&&v===p.height)return;const E=GA({},{width:h,height:v},b);UA(p,E,{x:0,y:0},{x:0,y:0},{width:Math.min(p.width,h),height:Math.min(p.height,v)},b),p.width=h,p.height=v,p.data=E.data}function UA(p,h,v,b,E,I){if(E.width===0||E.height===0)return h;if(E.width>p.width||E.height>p.height||v.x>p.width-E.width||v.y>p.height-E.height)throw new RangeError("out of range source coordinates for image copy");if(E.width>h.width||E.height>h.height||b.x>h.width-E.width||b.y>h.height-E.height)throw new RangeError("out of range destination coordinates for image copy");const k=p.data,R=h.data;if(k===R)throw new Error("srcData equals dstData, so image is already copied");for(let z=0;z<E.height;z++){const G=((v.y+z)*p.width+v.x)*I,W=((b.y+z)*h.width+b.x)*I;for(let j=0;j<E.width*I;j++)R[W+j]=k[G+j]}return h}class rm{constructor(h,v){GA(this,h,1,v)}resize(h){a6(this,h,1)}clone(){return new rm({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(h,v,b,E,I){UA(h,v,b,E,I,1)}}class Ya{constructor(h,v){GA(this,h,4,v)}resize(h){a6(this,h,4)}replace(h,v){v?this.data.set(h):this.data=h instanceof Uint8ClampedArray?new Uint8Array(h.buffer):h}clone(){return new Ya({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(h,v,b,E,I){UA(h,v,b,E,I,4)}}function o6(p){const h={},v=p.resolution||256,b=p.clips?p.clips.length:1,E=p.image||new Ya({width:v,height:b});if(Math.log(v)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${v}`);const I=(k,R,z)=>{h[p.evaluationKey]=z;const G=p.expression.evaluate(h);E.data[k+R+0]=Math.floor(255*G.r/G.a),E.data[k+R+1]=Math.floor(255*G.g/G.a),E.data[k+R+2]=Math.floor(255*G.b/G.a),E.data[k+R+3]=Math.floor(255*G.a)};if(p.clips)for(let k=0,R=0;k<b;++k,R+=4*v)for(let z=0,G=0;z<v;z++,G+=4){const W=z/(v-1),{start:j,end:ee}=p.clips[k];I(R,G,j*(1-W)+ee*W)}else for(let k=0,R=0;k<v;k++,R+=4)I(0,R,k/(v-1));return E}Pt("AlphaImage",rm),Pt("RGBAImage",Ya);const HA="big-fb";class oye extends y{createBucket(h){return new n6(h)}constructor(h){super(h,aye),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(h){h==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=o6({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(HA)&&this.heatmapFbos.delete(HA)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let s6;var sye={get paint(){return s6=s6||new D({"hillshade-illumination-direction":new Ot(Le.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ot(Le.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ot(Le.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ot(Le.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ot(Le.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ot(Le.paint_hillshade["hillshade-accent-color"])})}};class lye extends y{constructor(h){super(h,sye)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const cye=N([{name:"a_pos",components:2,type:"Int16"}],4),{members:uye}=cye;function l6(p,h,v=2){const b=h&&h.length,E=b?h[0]*v:p.length;let I=c6(p,0,E,v,!0);const k=[];if(!I||I.next===I.prev)return k;let R,z,G;if(b&&(I=function(W,j,ee,ne){const se=[];for(let ce=0,ye=j.length;ce<ye;ce++){const we=c6(W,j[ce]*ne,ce<ye-1?j[ce+1]*ne:W.length,ne,!1);we===we.next&&(we.steiner=!0),se.push(yye(we))}se.sort(gye);for(let ce=0;ce<se.length;ce++)ee=vye(se[ce],ee);return ee}(p,h,I,v)),p.length>80*v){R=1/0,z=1/0;let W=-1/0,j=-1/0;for(let ee=v;ee<E;ee+=v){const ne=p[ee],se=p[ee+1];ne<R&&(R=ne),se<z&&(z=se),ne>W&&(W=ne),se>j&&(j=se)}G=Math.max(W-R,j-z),G=G!==0?32767/G:0}return nm(I,k,v,R,z,G,0),k}function c6(p,h,v,b,E){let I;if(E===function(k,R,z,G){let W=0;for(let j=R,ee=z-G;j<z;j+=G)W+=(k[ee]-k[j])*(k[j+1]+k[ee+1]),ee=j;return W}(p,h,v,b)>0)for(let k=h;k<v;k+=b)I=d6(k/b|0,p[k],p[k+1],I);else for(let k=v-b;k>=h;k-=b)I=d6(k/b|0,p[k],p[k+1],I);return I&&Hb(I,I.next)&&(am(I),I=I.next),I}function Nh(p,h){if(!p)return p;h||(h=p);let v,b=p;do if(v=!1,b.steiner||!Hb(b,b.next)&&Rn(b.prev,b,b.next)!==0)b=b.next;else{if(am(b),b=h=b.prev,b===b.next)break;v=!0}while(v||b!==h);return h}function nm(p,h,v,b,E,I,k){if(!p)return;!k&&I&&function(z,G,W,j){let ee=z;do ee.z===0&&(ee.z=WA(ee.x,ee.y,G,W,j)),ee.prevZ=ee.prev,ee.nextZ=ee.next,ee=ee.next;while(ee!==z);ee.prevZ.nextZ=null,ee.prevZ=null,function(ne){let se,ce=1;do{let ye,we=ne;ne=null;let Oe=null;for(se=0;we;){se++;let Ae=we,Re=0;for(let et=0;et<ce&&(Re++,Ae=Ae.nextZ,Ae);et++);let He=ce;for(;Re>0||He>0&&Ae;)Re!==0&&(He===0||!Ae||we.z<=Ae.z)?(ye=we,we=we.nextZ,Re--):(ye=Ae,Ae=Ae.nextZ,He--),Oe?Oe.nextZ=ye:ne=ye,ye.prevZ=Oe,Oe=ye;we=Ae}Oe.nextZ=null,ce*=2}while(se>1)}(ee)}(p,b,E,I);let R=p;for(;p.prev!==p.next;){const z=p.prev,G=p.next;if(I?dye(p,b,E,I):hye(p))h.push(z.i,p.i,G.i),am(p),p=G.next,R=G.next;else if((p=G)===R){k?k===1?nm(p=fye(Nh(p),h),h,v,b,E,I,2):k===2&&pye(p,h,v,b,E,I):nm(Nh(p),h,v,b,E,I,1);break}}}function hye(p){const h=p.prev,v=p,b=p.next;if(Rn(h,v,b)>=0)return!1;const E=h.x,I=v.x,k=b.x,R=h.y,z=v.y,G=b.y,W=E<I?E<k?E:k:I<k?I:k,j=R<z?R<G?R:G:z<G?z:G,ee=E>I?E>k?E:k:I>k?I:k,ne=R>z?R>G?R:G:z>G?z:G;let se=b.next;for(;se!==h;){if(se.x>=W&&se.x<=ee&&se.y>=j&&se.y<=ne&&Hf(E,R,I,z,k,G,se.x,se.y)&&Rn(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function dye(p,h,v,b){const E=p.prev,I=p,k=p.next;if(Rn(E,I,k)>=0)return!1;const R=E.x,z=I.x,G=k.x,W=E.y,j=I.y,ee=k.y,ne=R<z?R<G?R:G:z<G?z:G,se=W<j?W<ee?W:ee:j<ee?j:ee,ce=R>z?R>G?R:G:z>G?z:G,ye=W>j?W>ee?W:ee:j>ee?j:ee,we=WA(ne,se,h,v,b),Oe=WA(ce,ye,h,v,b);let Ae=p.prevZ,Re=p.nextZ;for(;Ae&&Ae.z>=we&&Re&&Re.z<=Oe;){if(Ae.x>=ne&&Ae.x<=ce&&Ae.y>=se&&Ae.y<=ye&&Ae!==E&&Ae!==k&&Hf(R,W,z,j,G,ee,Ae.x,Ae.y)&&Rn(Ae.prev,Ae,Ae.next)>=0||(Ae=Ae.prevZ,Re.x>=ne&&Re.x<=ce&&Re.y>=se&&Re.y<=ye&&Re!==E&&Re!==k&&Hf(R,W,z,j,G,ee,Re.x,Re.y)&&Rn(Re.prev,Re,Re.next)>=0))return!1;Re=Re.nextZ}for(;Ae&&Ae.z>=we;){if(Ae.x>=ne&&Ae.x<=ce&&Ae.y>=se&&Ae.y<=ye&&Ae!==E&&Ae!==k&&Hf(R,W,z,j,G,ee,Ae.x,Ae.y)&&Rn(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.prevZ}for(;Re&&Re.z<=Oe;){if(Re.x>=ne&&Re.x<=ce&&Re.y>=se&&Re.y<=ye&&Re!==E&&Re!==k&&Hf(R,W,z,j,G,ee,Re.x,Re.y)&&Rn(Re.prev,Re,Re.next)>=0)return!1;Re=Re.nextZ}return!0}function fye(p,h){let v=p;do{const b=v.prev,E=v.next.next;!Hb(b,E)&&u6(b,v,v.next,E)&&im(b,E)&&im(E,b)&&(h.push(b.i,v.i,E.i),am(v),am(v.next),v=p=E),v=v.next}while(v!==p);return Nh(v)}function pye(p,h,v,b,E,I){let k=p;do{let R=k.next.next;for(;R!==k.prev;){if(k.i!==R.i&&_ye(k,R)){let z=h6(k,R);return k=Nh(k,k.next),z=Nh(z,z.next),nm(k,h,v,b,E,I,0),void nm(z,h,v,b,E,I,0)}R=R.next}k=k.next}while(k!==p)}function gye(p,h){return p.x-h.x}function vye(p,h){const v=function(E,I){let k=I;const R=E.x,z=E.y;let G,W=-1/0;do{if(z<=k.y&&z>=k.next.y&&k.next.y!==k.y){const ce=k.x+(z-k.y)*(k.next.x-k.x)/(k.next.y-k.y);if(ce<=R&&ce>W&&(W=ce,G=k.x<k.next.x?k:k.next,ce===R))return G}k=k.next}while(k!==I);if(!G)return null;const j=G,ee=G.x,ne=G.y;let se=1/0;k=G;do{if(R>=k.x&&k.x>=ee&&R!==k.x&&Hf(z<ne?R:W,z,ee,ne,z<ne?W:R,z,k.x,k.y)){const ce=Math.abs(z-k.y)/(R-k.x);im(k,E)&&(ce<se||ce===se&&(k.x>G.x||k.x===G.x&&mye(G,k)))&&(G=k,se=ce)}k=k.next}while(k!==j);return G}(p,h);if(!v)return h;const b=h6(v,p);return Nh(b,b.next),Nh(v,v.next)}function mye(p,h){return Rn(p.prev,p,h.prev)<0&&Rn(h.next,p,p.next)<0}function WA(p,h,v,b,E){return(p=1431655765&((p=858993459&((p=252645135&((p=16711935&((p=(p-v)*E|0)|p<<8))|p<<4))|p<<2))|p<<1))|(h=1431655765&((h=858993459&((h=252645135&((h=16711935&((h=(h-b)*E|0)|h<<8))|h<<4))|h<<2))|h<<1))<<1}function yye(p){let h=p,v=p;do(h.x<v.x||h.x===v.x&&h.y<v.y)&&(v=h),h=h.next;while(h!==p);return v}function Hf(p,h,v,b,E,I,k,R){return(E-k)*(h-R)>=(p-k)*(I-R)&&(p-k)*(b-R)>=(v-k)*(h-R)&&(v-k)*(I-R)>=(E-k)*(b-R)}function _ye(p,h){return p.next.i!==h.i&&p.prev.i!==h.i&&!function(v,b){let E=v;do{if(E.i!==v.i&&E.next.i!==v.i&&E.i!==b.i&&E.next.i!==b.i&&u6(E,E.next,v,b))return!0;E=E.next}while(E!==v);return!1}(p,h)&&(im(p,h)&&im(h,p)&&function(v,b){let E=v,I=!1;const k=(v.x+b.x)/2,R=(v.y+b.y)/2;do E.y>R!=E.next.y>R&&E.next.y!==E.y&&k<(E.next.x-E.x)*(R-E.y)/(E.next.y-E.y)+E.x&&(I=!I),E=E.next;while(E!==v);return I}(p,h)&&(Rn(p.prev,p,h.prev)||Rn(p,h.prev,h))||Hb(p,h)&&Rn(p.prev,p,p.next)>0&&Rn(h.prev,h,h.next)>0)}function Rn(p,h,v){return(h.y-p.y)*(v.x-h.x)-(h.x-p.x)*(v.y-h.y)}function Hb(p,h){return p.x===h.x&&p.y===h.y}function u6(p,h,v,b){const E=qb(Rn(p,h,v)),I=qb(Rn(p,h,b)),k=qb(Rn(v,b,p)),R=qb(Rn(v,b,h));return E!==I&&k!==R||!(E!==0||!Wb(p,v,h))||!(I!==0||!Wb(p,b,h))||!(k!==0||!Wb(v,p,b))||!(R!==0||!Wb(v,h,b))}function Wb(p,h,v){return h.x<=Math.max(p.x,v.x)&&h.x>=Math.min(p.x,v.x)&&h.y<=Math.max(p.y,v.y)&&h.y>=Math.min(p.y,v.y)}function qb(p){return p>0?1:p<0?-1:0}function im(p,h){return Rn(p.prev,p,p.next)<0?Rn(p,h,p.next)>=0&&Rn(p,p.prev,h)>=0:Rn(p,h,p.prev)<0||Rn(p,p.next,h)<0}function h6(p,h){const v=qA(p.i,p.x,p.y),b=qA(h.i,h.x,h.y),E=p.next,I=h.prev;return p.next=h,h.prev=p,v.next=E,E.prev=v,b.next=v,v.prev=b,I.next=b,b.prev=I,b}function d6(p,h,v,b){const E=qA(p,h,v);return b?(E.next=b.next,E.prev=b,b.next.prev=E,b.next=E):(E.prev=E,E.next=E),E}function am(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function qA(p,h,v){return{i:p,x:h,y:v,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ZA(p,h,v){const b=v.patternDependencies;let E=!1;for(const I of h){const k=I.paint.get(`${p}-pattern`);k.isConstant()||(E=!0);const R=k.constantOr(null);R&&(E=!0,b[R.to]=!0,b[R.from]=!0)}return E}function jA(p,h,v,b,E){const I=E.patternDependencies;for(const k of h){const R=k.paint.get(`${p}-pattern`).value;if(R.kind!=="constant"){let z=R.evaluate({zoom:b-1},v,{},E.availableImages),G=R.evaluate({zoom:b},v,{},E.availableImages),W=R.evaluate({zoom:b+1},v,{},E.availableImages);z=z&&z.name?z.name:z,G=G&&G.name?G.name:G,W=W&&W.name?W.name:W,I[z]=!0,I[G]=!0,I[W]=!0,v.patterns[k.id]={min:z,mid:G,max:W}}}return v}class XA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ko,this.indexArray=new Xa,this.indexArray2=new ci,this.programConfigurations=new Lh(h.layers,h.zoom),this.segments=new Pr,this.segments2=new Pr,this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){this.hasPattern=ZA("fill",this.layers,v);const E=this.layers[0].layout.get("fill-sort-key"),I=!E.isConstant(),k=[];for(const{feature:R,id:z,index:G,sourceLayerIndex:W}of h){const j=this.layers[0]._featureFilter.needGeometry,ee=Rh(R,j);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),ee,b))continue;const ne=I?E.evaluate(ee,{},b,v.availableImages):void 0,se={id:z,properties:R.properties,type:R.type,sourceLayerIndex:W,index:G,geometry:j?ee.geometry:Ph(R),patterns:{},sortKey:ne};k.push(se)}I&&k.sort((R,z)=>R.sortKey-z.sortKey);for(const R of k){const{geometry:z,index:G,sourceLayerIndex:W}=R;if(this.hasPattern){const j=jA("fill",this.layers,R,this.zoom,v);this.patternFeatures.push(j)}else this.addFeature(R,z,G,b,{});v.featureIndex.insert(h[G].feature,z,G,W,this.index)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}addFeatures(h,v,b){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,v,b)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,uye),this.indexBuffer=h.createIndexBuffer(this.indexArray),this.indexBuffer2=h.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(h),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(h,v,b,E,I){for(const k of pf(v,500)){let R=0;for(const ne of k)R+=ne.length;const z=this.segments.prepareSegment(R,this.layoutVertexArray,this.indexArray),G=z.vertexLength,W=[],j=[];for(const ne of k){if(ne.length===0)continue;ne!==k[0]&&j.push(W.length/2);const se=this.segments2.prepareSegment(ne.length,this.layoutVertexArray,this.indexArray2),ce=se.vertexLength;this.layoutVertexArray.emplaceBack(ne[0].x,ne[0].y),this.indexArray2.emplaceBack(ce+ne.length-1,ce),W.push(ne[0].x),W.push(ne[0].y);for(let ye=1;ye<ne.length;ye++)this.layoutVertexArray.emplaceBack(ne[ye].x,ne[ye].y),this.indexArray2.emplaceBack(ce+ye-1,ce+ye),W.push(ne[ye].x),W.push(ne[ye].y);se.vertexLength+=ne.length,se.primitiveLength+=ne.length}const ee=l6(W,j);for(let ne=0;ne<ee.length;ne+=3)this.indexArray.emplaceBack(G+ee[ne],G+ee[ne+1],G+ee[ne+2]);z.vertexLength+=R,z.primitiveLength+=ee.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,I,E)}}let f6,p6;Pt("FillBucket",XA,{omit:["layers","patternFeatures"]});var bye={get paint(){return p6=p6||new D({"fill-antialias":new Ot(Le.paint_fill["fill-antialias"]),"fill-opacity":new Kt(Le.paint_fill["fill-opacity"]),"fill-color":new Kt(Le.paint_fill["fill-color"]),"fill-outline-color":new Kt(Le.paint_fill["fill-outline-color"]),"fill-translate":new Ot(Le.paint_fill["fill-translate"]),"fill-translate-anchor":new Ot(Le.paint_fill["fill-translate-anchor"]),"fill-pattern":new Rf(Le.paint_fill["fill-pattern"])})},get layout(){return f6=f6||new D({"fill-sort-key":new Kt(Le.layout_fill["fill-sort-key"])})}};class xye extends y{constructor(h){super(h,bye)}recalculate(h,v){super.recalculate(h,v);const b=this.paint._values["fill-outline-color"];b.value.kind==="constant"&&b.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(h){return new XA(h)}queryRadius(){return $b(this.paint.get("fill-translate"))}queryIntersectsFeature(h,v,b,E,I,k,R){return Y$(Gb(h,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),k.angle,R),E)}isTileClipped(){return!0}}const wye=N([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Sye=N([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Tye}=wye;var zc={},Eye=c,g6=Wf;function Wf(p,h,v,b,E){this.properties={},this.extent=v,this.type=0,this._pbf=p,this._geometry=-1,this._keys=b,this._values=E,p.readFields(Cye,this,h)}function Cye(p,h,v){p==1?h.id=v.readVarint():p==2?function(b,E){for(var I=b.readVarint()+b.pos;b.pos<I;){var k=E._keys[b.readVarint()],R=E._values[b.readVarint()];E.properties[k]=R}}(v,h):p==3?h.type=v.readVarint():p==4&&(h._geometry=v.pos)}function Aye(p){for(var h,v,b=0,E=0,I=p.length,k=I-1;E<I;k=E++)b+=((v=p[k]).x-(h=p[E]).x)*(h.y+v.y);return b}Wf.types=["Unknown","Point","LineString","Polygon"],Wf.prototype.loadGeometry=function(){var p=this._pbf;p.pos=this._geometry;for(var h,v=p.readVarint()+p.pos,b=1,E=0,I=0,k=0,R=[];p.pos<v;){if(E<=0){var z=p.readVarint();b=7&z,E=z>>3}if(E--,b===1||b===2)I+=p.readSVarint(),k+=p.readSVarint(),b===1&&(h&&R.push(h),h=[]),h.push(new Eye(I,k));else{if(b!==7)throw new Error("unknown command "+b);h&&h.push(h[0].clone())}}return h&&R.push(h),R},Wf.prototype.bbox=function(){var p=this._pbf;p.pos=this._geometry;for(var h=p.readVarint()+p.pos,v=1,b=0,E=0,I=0,k=1/0,R=-1/0,z=1/0,G=-1/0;p.pos<h;){if(b<=0){var W=p.readVarint();v=7&W,b=W>>3}if(b--,v===1||v===2)(E+=p.readSVarint())<k&&(k=E),E>R&&(R=E),(I+=p.readSVarint())<z&&(z=I),I>G&&(G=I);else if(v!==7)throw new Error("unknown command "+v)}return[k,z,R,G]},Wf.prototype.toGeoJSON=function(p,h,v){var b,E,I=this.extent*Math.pow(2,v),k=this.extent*p,R=this.extent*h,z=this.loadGeometry(),G=Wf.types[this.type];function W(ne){for(var se=0;se<ne.length;se++){var ce=ne[se];ne[se]=[360*(ce.x+k)/I-180,360/Math.PI*Math.atan(Math.exp((180-360*(ce.y+R)/I)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(b=0;b<z.length;b++)j[b]=z[b][0];W(z=j);break;case 2:for(b=0;b<z.length;b++)W(z[b]);break;case 3:for(z=function(ne){var se=ne.length;if(se<=1)return[ne];for(var ce,ye,we=[],Oe=0;Oe<se;Oe++){var Ae=Aye(ne[Oe]);Ae!==0&&(ye===void 0&&(ye=Ae<0),ye===Ae<0?(ce&&we.push(ce),ce=[ne[Oe]]):ce.push(ne[Oe]))}return ce&&we.push(ce),we}(z),b=0;b<z.length;b++)for(E=0;E<z[b].length;E++)W(z[b][E])}z.length===1?z=z[0]:G="Multi"+G;var ee={type:"Feature",geometry:{type:G,coordinates:z},properties:this.properties};return"id"in this&&(ee.id=this.id),ee};var Dye=g6,v6=m6;function m6(p,h){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=p,this._keys=[],this._values=[],this._features=[],p.readFields(Mye,this,h),this.length=this._features.length}function Mye(p,h,v){p===15?h.version=v.readVarint():p===1?h.name=v.readString():p===5?h.extent=v.readVarint():p===2?h._features.push(v.pos):p===3?h._keys.push(v.readString()):p===4&&h._values.push(function(b){for(var E=null,I=b.readVarint()+b.pos;b.pos<I;){var k=b.readVarint()>>3;E=k===1?b.readString():k===2?b.readFloat():k===3?b.readDouble():k===4?b.readVarint64():k===5?b.readVarint():k===6?b.readSVarint():k===7?b.readBoolean():null}return E}(v))}m6.prototype.feature=function(p){if(p<0||p>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[p];var h=this._pbf.readVarint()+this._pbf.pos;return new Dye(this._pbf,h,this.extent,this._keys,this._values)};var Iye=v6;function kye(p,h,v){if(p===3){var b=new Iye(v,v.readVarint()+v.pos);b.length&&(h[b.name]=b)}}zc.VectorTile=function(p,h){this.layers=p.readFields(kye,{},h)},zc.VectorTileFeature=g6,zc.VectorTileLayer=v6;const Lye=zc.VectorTileFeature.types,YA=Math.pow(2,13);function om(p,h,v,b,E,I,k,R){p.emplaceBack(h,v,2*Math.floor(b*YA)+k,E*YA*2,I*YA*2,Math.round(R))}class KA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.layoutVertexArray=new kc,this.centroidVertexArray=new mi,this.indexArray=new Xa,this.programConfigurations=new Lh(h.layers,h.zoom),this.segments=new Pr,this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){this.features=[],this.hasPattern=ZA("fill-extrusion",this.layers,v);for(const{feature:E,id:I,index:k,sourceLayerIndex:R}of h){const z=this.layers[0]._featureFilter.needGeometry,G=Rh(E,z);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),G,b))continue;const W={id:I,sourceLayerIndex:R,index:k,geometry:z?G.geometry:Ph(E),properties:E.properties,type:E.type,patterns:{}};this.hasPattern?this.features.push(jA("fill-extrusion",this.layers,W,this.zoom,v)):this.addFeature(W,W.geometry,k,b,{}),v.featureIndex.insert(E,W.geometry,k,R,this.index,!0)}}addFeatures(h,v,b){for(const E of this.features){const{geometry:I}=E;this.addFeature(E,I,E.index,v,b)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,Tye),this.centroidVertexBuffer=h.createVertexBuffer(this.centroidVertexArray,Sye.members,!0),this.indexBuffer=h.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(h),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(h,v,b,E,I){for(const k of pf(v,500)){const R={x:0,y:0,vertexCount:0};let z=0;for(const se of k)z+=se.length;let G=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const se of k){if(se.length===0||Rye(se))continue;let ce=0;for(let ye=0;ye<se.length;ye++){const we=se[ye];if(ye>=1){const Oe=se[ye-1];if(!Pye(we,Oe)){G.vertexLength+4>Pr.MAX_VERTEX_ARRAY_LENGTH&&(G=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Ae=we.sub(Oe)._perp()._unit(),Re=Oe.dist(we);ce+Re>32768&&(ce=0),om(this.layoutVertexArray,we.x,we.y,Ae.x,Ae.y,0,0,ce),om(this.layoutVertexArray,we.x,we.y,Ae.x,Ae.y,0,1,ce),R.x+=2*we.x,R.y+=2*we.y,R.vertexCount+=2,ce+=Re,om(this.layoutVertexArray,Oe.x,Oe.y,Ae.x,Ae.y,0,0,ce),om(this.layoutVertexArray,Oe.x,Oe.y,Ae.x,Ae.y,0,1,ce),R.x+=2*Oe.x,R.y+=2*Oe.y,R.vertexCount+=2;const He=G.vertexLength;this.indexArray.emplaceBack(He,He+2,He+1),this.indexArray.emplaceBack(He+1,He+2,He+3),G.vertexLength+=4,G.primitiveLength+=2}}}}if(G.vertexLength+z>Pr.MAX_VERTEX_ARRAY_LENGTH&&(G=this.segments.prepareSegment(z,this.layoutVertexArray,this.indexArray)),Lye[h.type]!=="Polygon")continue;const W=[],j=[],ee=G.vertexLength;for(const se of k)if(se.length!==0){se!==k[0]&&j.push(W.length/2);for(let ce=0;ce<se.length;ce++){const ye=se[ce];om(this.layoutVertexArray,ye.x,ye.y,0,0,1,1,0),R.x+=ye.x,R.y+=ye.y,R.vertexCount+=1,W.push(ye.x),W.push(ye.y)}}const ne=l6(W,j);for(let se=0;se<ne.length;se+=3)this.indexArray.emplaceBack(ee+ne[se],ee+ne[se+2],ee+ne[se+1]);G.primitiveLength+=ne.length/3,G.vertexLength+=z;for(let se=0;se<R.vertexCount;se++){const ce=Math.floor(R.x/R.vertexCount),ye=Math.floor(R.y/R.vertexCount);this.centroidVertexArray.emplaceBack(ce,ye)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,I,E)}}function Pye(p,h){return p.x===h.x&&(p.x<0||p.x>Fn)||p.y===h.y&&(p.y<0||p.y>Fn)}function Rye(p){return p.every(h=>h.x<0)||p.every(h=>h.x>Fn)||p.every(h=>h.y<0)||p.every(h=>h.y>Fn)}let y6;Pt("FillExtrusionBucket",KA,{omit:["layers","features"]});var Nye={get paint(){return y6=y6||new D({"fill-extrusion-opacity":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Kt(Le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Rf(Le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Kt(Le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Kt(Le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Oye extends y{constructor(h){super(h,Nye)}createBucket(h){return new KA(h)}queryRadius(){return $b(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(h,v,b,E,I,k,R,z){const G=Gb(h,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),k.angle,R),W=this.paint.get("fill-extrusion-height").evaluate(v,b),j=this.paint.get("fill-extrusion-base").evaluate(v,b),ee=function(se,ce,ye,we){const Oe=[];for(const Ae of se){const Re=[Ae.x,Ae.y,0,1];Ub(Re,Re,ce),Oe.push(new f(Re[0]/Re[3],Re[1]/Re[3]))}return Oe}(G,z),ne=function(se,ce,ye,we){const Oe=[],Ae=[],Re=we[8]*ce,He=we[9]*ce,et=we[10]*ce,Ct=we[11]*ce,Yt=we[8]*ye,xt=we[9]*ye,_t=we[10]*ye,Gt=we[11]*ye;for(const Rt of se){const It=[],Ye=[];for(const Ut of Rt){const Ft=Ut.x,nr=Ut.y,rn=we[0]*Ft+we[4]*nr+we[12],en=we[1]*Ft+we[5]*nr+we[13],Kn=we[2]*Ft+we[6]*nr+we[14],Lo=we[3]*Ft+we[7]*nr+we[15],bi=Kn+et,Jn=Lo+Ct,Wi=rn+Yt,qi=en+xt,Zi=Kn+_t,Mn=Lo+Gt,Qn=new f((rn+Re)/Jn,(en+He)/Jn);Qn.z=bi/Jn,It.push(Qn);const Pi=new f(Wi/Mn,qi/Mn);Pi.z=Zi/Mn,Ye.push(Pi)}Oe.push(It),Ae.push(Ye)}return[Oe,Ae]}(E,j,W,z);return function(se,ce,ye){let we=1/0;Y$(ye,ce)&&(we=_6(ye,ce[0]));for(let Oe=0;Oe<ce.length;Oe++){const Ae=ce[Oe],Re=se[Oe];for(let He=0;He<Ae.length-1;He++){const et=Ae[He],Ct=[et,Ae[He+1],Re[He+1],Re[He],et];X$(ye,Ct)&&(we=Math.min(we,_6(ye,Ct)))}}return we!==1/0&&we}(ne[0],ne[1],ee)}}function sm(p,h){return p.x*h.x+p.y*h.y}function _6(p,h){if(p.length===1){let v=0;const b=h[v++];let E;for(;!E||b.equals(E);)if(E=h[v++],!E)return 1/0;for(;v<h.length;v++){const I=h[v],k=p[0],R=E.sub(b),z=I.sub(b),G=k.sub(b),W=sm(R,R),j=sm(R,z),ee=sm(z,z),ne=sm(G,R),se=sm(G,z),ce=W*ee-j*j,ye=(ee*ne-j*se)/ce,we=(W*se-j*ne)/ce,Oe=b.z*(1-ye-we)+E.z*ye+I.z*we;if(isFinite(Oe))return Oe}return 1/0}{let v=1/0;for(const b of h)v=Math.min(v,b.z);return v}}const zye=N([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Bye}=zye,Vye=N([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Fye}=Vye,$ye=zc.VectorTileFeature.types,Gye=Math.cos(Math.PI/180*37.5),b6=Math.pow(2,14)/.5;class JA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(v=>{this.gradients[v.id]={}}),this.layoutVertexArray=new Of,this.layoutVertexArray2=new Lc,this.indexArray=new Xa,this.programConfigurations=new Lh(h.layers,h.zoom),this.segments=new Pr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){this.hasPattern=ZA("line",this.layers,v);const E=this.layers[0].layout.get("line-sort-key"),I=!E.isConstant(),k=[];for(const{feature:R,id:z,index:G,sourceLayerIndex:W}of h){const j=this.layers[0]._featureFilter.needGeometry,ee=Rh(R,j);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),ee,b))continue;const ne=I?E.evaluate(ee,{},b):void 0,se={id:z,properties:R.properties,type:R.type,sourceLayerIndex:W,index:G,geometry:j?ee.geometry:Ph(R),patterns:{},sortKey:ne};k.push(se)}I&&k.sort((R,z)=>R.sortKey-z.sortKey);for(const R of k){const{geometry:z,index:G,sourceLayerIndex:W}=R;if(this.hasPattern){const j=jA("line",this.layers,R,this.zoom,v);this.patternFeatures.push(j)}else this.addFeature(R,z,G,b,{});v.featureIndex.insert(h[G].feature,z,G,W,this.index)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}addFeatures(h,v,b){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,v,b)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=h.createVertexBuffer(this.layoutVertexArray2,Fye)),this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,Bye),this.indexBuffer=h.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(h),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(h){if(h.properties&&Object.prototype.hasOwnProperty.call(h.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(h.properties,"mapbox_clip_end"))return{start:+h.properties.mapbox_clip_start,end:+h.properties.mapbox_clip_end}}addFeature(h,v,b,E,I){const k=this.layers[0].layout,R=k.get("line-join").evaluate(h,{}),z=k.get("line-cap"),G=k.get("line-miter-limit"),W=k.get("line-round-limit");this.lineClips=this.lineFeatureClips(h);for(const j of v)this.addLine(j,h,R,z,G,W);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,I,E)}addLine(h,v,b,E,I,k){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let we=0;we<h.length-1;we++)this.totalDistance+=h[we].dist(h[we+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const R=$ye[v.type]==="Polygon";let z=h.length;for(;z>=2&&h[z-1].equals(h[z-2]);)z--;let G=0;for(;G<z-1&&h[G].equals(h[G+1]);)G++;if(z<(R?3:2))return;b==="bevel"&&(I=1.05);const W=this.overscaling<=16?15*Fn/(512*this.overscaling):0,j=this.segments.prepareSegment(10*z,this.layoutVertexArray,this.indexArray);let ee,ne,se,ce,ye;this.e1=this.e2=-1,R&&(ee=h[z-2],ye=h[G].sub(ee)._unit()._perp());for(let we=G;we<z;we++){if(se=we===z-1?R?h[G+1]:void 0:h[we+1],se&&h[we].equals(se))continue;ye&&(ce=ye),ee&&(ne=ee),ee=h[we],ye=se?se.sub(ee)._unit()._perp():ce,ce=ce||ye;let Oe=ce.add(ye);Oe.x===0&&Oe.y===0||Oe._unit();const Ae=ce.x*ye.x+ce.y*ye.y,Re=Oe.x*ye.x+Oe.y*ye.y,He=Re!==0?1/Re:1/0,et=2*Math.sqrt(2-2*Re),Ct=Re<Gye&&ne&&se,Yt=ce.x*ye.y-ce.y*ye.x>0;if(Ct&&we>G){const Gt=ee.dist(ne);if(Gt>2*W){const Rt=ee.sub(ee.sub(ne)._mult(W/Gt)._round());this.updateDistance(ne,Rt),this.addCurrentVertex(Rt,ce,0,0,j),ne=Rt}}const xt=ne&&se;let _t=xt?b:R?"butt":E;if(xt&&_t==="round"&&(He<k?_t="miter":He<=2&&(_t="fakeround")),_t==="miter"&&He>I&&(_t="bevel"),_t==="bevel"&&(He>2&&(_t="flipbevel"),He<I&&(_t="miter")),ne&&this.updateDistance(ne,ee),_t==="miter")Oe._mult(He),this.addCurrentVertex(ee,Oe,0,0,j);else if(_t==="flipbevel"){if(He>100)Oe=ye.mult(-1);else{const Gt=He*ce.add(ye).mag()/ce.sub(ye).mag();Oe._perp()._mult(Gt*(Yt?-1:1))}this.addCurrentVertex(ee,Oe,0,0,j),this.addCurrentVertex(ee,Oe.mult(-1),0,0,j)}else if(_t==="bevel"||_t==="fakeround"){const Gt=-Math.sqrt(He*He-1),Rt=Yt?Gt:0,It=Yt?0:Gt;if(ne&&this.addCurrentVertex(ee,ce,Rt,It,j),_t==="fakeround"){const Ye=Math.round(180*et/Math.PI/20);for(let Ut=1;Ut<Ye;Ut++){let Ft=Ut/Ye;if(Ft!==.5){const rn=Ft-.5;Ft+=Ft*rn*(Ft-1)*((1.0904+Ae*(Ae*(3.55645-1.43519*Ae)-3.2452))*rn*rn+(.848013+Ae*(.215638*Ae-1.06021)))}const nr=ye.sub(ce)._mult(Ft)._add(ce)._unit()._mult(Yt?-1:1);this.addHalfVertex(ee,nr.x,nr.y,!1,Yt,0,j)}}se&&this.addCurrentVertex(ee,ye,-Rt,-It,j)}else if(_t==="butt")this.addCurrentVertex(ee,Oe,0,0,j);else if(_t==="square"){const Gt=ne?1:-1;this.addCurrentVertex(ee,Oe,Gt,Gt,j)}else _t==="round"&&(ne&&(this.addCurrentVertex(ee,ce,0,0,j),this.addCurrentVertex(ee,ce,1,1,j,!0)),se&&(this.addCurrentVertex(ee,ye,-1,-1,j,!0),this.addCurrentVertex(ee,ye,0,0,j)));if(Ct&&we<z-1){const Gt=ee.dist(se);if(Gt>2*W){const Rt=ee.add(se.sub(ee)._mult(W/Gt)._round());this.updateDistance(ee,Rt),this.addCurrentVertex(Rt,ye,0,0,j),ee=Rt}}}}addCurrentVertex(h,v,b,E,I,k=!1){const R=v.y*E-v.x,z=-v.y-v.x*E;this.addHalfVertex(h,v.x+v.y*b,v.y-v.x*b,k,!1,b,I),this.addHalfVertex(h,R,z,k,!0,-E,I),this.distance>b6/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(h,v,b,E,I,k))}addHalfVertex({x:h,y:v},b,E,I,k,R,z){const G=.5*(this.lineClips?this.scaledDistance*(b6-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((h<<1)+(I?1:0),(v<<1)+(k?1:0),Math.round(63*b)+128,Math.round(63*E)+128,1+(R===0?0:R<0?-1:1)|(63&G)<<2,G>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const W=z.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,W),z.primitiveLength++),k?this.e2=W:this.e1=W}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(h,v){this.distance+=h.dist(v),this.updateScaledDistance()}}let x6,w6;Pt("LineBucket",JA,{omit:["layers","patternFeatures"]});var S6={get paint(){return w6=w6||new D({"line-opacity":new Kt(Le.paint_line["line-opacity"]),"line-color":new Kt(Le.paint_line["line-color"]),"line-translate":new Ot(Le.paint_line["line-translate"]),"line-translate-anchor":new Ot(Le.paint_line["line-translate-anchor"]),"line-width":new Kt(Le.paint_line["line-width"]),"line-gap-width":new Kt(Le.paint_line["line-gap-width"]),"line-offset":new Kt(Le.paint_line["line-offset"]),"line-blur":new Kt(Le.paint_line["line-blur"]),"line-dasharray":new Nf(Le.paint_line["line-dasharray"]),"line-pattern":new Rf(Le.paint_line["line-pattern"]),"line-gradient":new Kv(Le.paint_line["line-gradient"])})},get layout(){return x6=x6||new D({"line-cap":new Ot(Le.layout_line["line-cap"]),"line-join":new Kt(Le.layout_line["line-join"]),"line-miter-limit":new Ot(Le.layout_line["line-miter-limit"]),"line-round-limit":new Ot(Le.layout_line["line-round-limit"]),"line-sort-key":new Kt(Le.layout_line["line-sort-key"])})}};class Uye extends Kt{possiblyEvaluate(h,v){return v=new dn(Math.floor(v.zoom),{now:v.now,fadeDuration:v.fadeDuration,zoomHistory:v.zoomHistory,transition:v.transition}),super.possiblyEvaluate(h,v)}evaluate(h,v,b,E){return v=U({},v,{zoom:Math.floor(v.zoom)}),super.evaluate(h,v,b,E)}}let Zb;class Hye extends y{constructor(h){super(h,S6),this.gradientVersion=0,Zb||(Zb=new Uye(S6.paint.properties["line-width"].specification),Zb.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(h){if(h==="line-gradient"){const v=this.gradientExpression();this.stepInterpolant=!!function(b){return b._styleExpression!==void 0}(v)&&v._styleExpression.expression instanceof dc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(h,v){super.recalculate(h,v),this.paint._values["line-floorwidth"]=Zb.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,h)}createBucket(h){return new JA(h)}queryRadius(h){const v=h,b=T6(em("line-width",this,v),em("line-gap-width",this,v)),E=em("line-offset",this,v);return b/2+Math.abs(E)+$b(this.paint.get("line-translate"))}queryIntersectsFeature(h,v,b,E,I,k,R){const z=Gb(h,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,R),G=R/2*T6(this.paint.get("line-width").evaluate(v,b),this.paint.get("line-gap-width").evaluate(v,b)),W=this.paint.get("line-offset").evaluate(v,b);return W&&(E=function(j,ee){const ne=[];for(let se=0;se<j.length;se++){const ce=j[se],ye=[];for(let we=0;we<ce.length;we++){const Oe=ce[we-1],Ae=ce[we],Re=ce[we+1],He=we===0?new f(0,0):Ae.sub(Oe)._unit()._perp(),et=we===ce.length-1?new f(0,0):Re.sub(Ae)._unit()._perp(),Ct=He._add(et)._unit(),Yt=Ct.x*et.x+Ct.y*et.y;Yt!==0&&Ct._mult(1/Yt),ye.push(Ct._mult(ee)._add(Ae))}ne.push(ye)}return ne}(E,W*R)),function(j,ee,ne){for(let se=0;se<ee.length;se++){const ce=ee[se];if(j.length>=3){for(let ye=0;ye<ce.length;ye++)if(Gf(j,ce[ye]))return!0}if(Qme(j,ce,ne))return!0}return!1}(z,E,G)}isTileClipped(){return!0}}function T6(p,h){return h>0?h+2*p:p}const Wye=N([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),qye=N([{name:"a_projected_pos",components:3,type:"Float32"}],4);N([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Zye=N([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);N([{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 E6=N([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),jye=N([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Xye(p,h,v){return p.sections.forEach(b=>{b.text=function(E,I,k){const R=I.layout.get("text-transform").evaluate(k,{});return R==="uppercase"?E=E.toLocaleUpperCase():R==="lowercase"&&(E=E.toLocaleLowerCase()),fa.applyArabicShaping&&(E=fa.applyArabicShaping(E)),E}(b.text,h,v)}),p}N([{name:"triangle",components:3,type:"Uint16"}]),N([{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"}]),N([{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"}]),N([{type:"Float32",name:"offsetX"}]),N([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),N([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const lm={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Zn=24,C6=Qr,A6=function(p,h,v,b,E){var I,k,R=8*E-b-1,z=(1<<R)-1,G=z>>1,W=-7,j=E-1,ee=-1,ne=p[h+j];for(j+=ee,I=ne&(1<<-W)-1,ne>>=-W,W+=R;W>0;I=256*I+p[h+j],j+=ee,W-=8);for(k=I&(1<<-W)-1,I>>=-W,W+=b;W>0;k=256*k+p[h+j],j+=ee,W-=8);if(I===0)I=1-G;else{if(I===z)return k?NaN:1/0*(ne?-1:1);k+=Math.pow(2,b),I-=G}return(ne?-1:1)*k*Math.pow(2,I-b)},D6=function(p,h,v,b,E,I){var k,R,z,G=8*I-E-1,W=(1<<G)-1,j=W>>1,ee=E===23?Math.pow(2,-24)-Math.pow(2,-77):0,ne=0,se=1,ce=h<0||h===0&&1/h<0?1:0;for(h=Math.abs(h),isNaN(h)||h===1/0?(R=isNaN(h)?1:0,k=W):(k=Math.floor(Math.log(h)/Math.LN2),h*(z=Math.pow(2,-k))<1&&(k--,z*=2),(h+=k+j>=1?ee/z:ee*Math.pow(2,1-j))*z>=2&&(k++,z/=2),k+j>=W?(R=0,k=W):k+j>=1?(R=(h*z-1)*Math.pow(2,E),k+=j):(R=h*Math.pow(2,j-1)*Math.pow(2,E),k=0));E>=8;p[v+ne]=255&R,ne+=se,R/=256,E-=8);for(k=k<<E|R,G+=E;G>0;p[v+ne]=255&k,ne+=se,k/=256,G-=8);p[v+ne-se]|=128*ce};function Qr(p){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(p)?p:new Uint8Array(p||0),this.pos=0,this.type=0,this.length=this.buf.length}Qr.Varint=0,Qr.Fixed64=1,Qr.Bytes=2,Qr.Fixed32=5;var QA=4294967296,M6=1/QA,I6=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function bl(p){return p.type===Qr.Bytes?p.readVarint()+p.pos:p.pos+1}function qf(p,h,v){return v?4294967296*h+(p>>>0):4294967296*(h>>>0)+(p>>>0)}function k6(p,h,v){var b=h<=16383?1:h<=2097151?2:h<=268435455?3:Math.floor(Math.log(h)/(7*Math.LN2));v.realloc(b);for(var E=v.pos-1;E>=p;E--)v.buf[E+b]=v.buf[E]}function Yye(p,h){for(var v=0;v<p.length;v++)h.writeVarint(p[v])}function Kye(p,h){for(var v=0;v<p.length;v++)h.writeSVarint(p[v])}function Jye(p,h){for(var v=0;v<p.length;v++)h.writeFloat(p[v])}function Qye(p,h){for(var v=0;v<p.length;v++)h.writeDouble(p[v])}function e_e(p,h){for(var v=0;v<p.length;v++)h.writeBoolean(p[v])}function t_e(p,h){for(var v=0;v<p.length;v++)h.writeFixed32(p[v])}function r_e(p,h){for(var v=0;v<p.length;v++)h.writeSFixed32(p[v])}function n_e(p,h){for(var v=0;v<p.length;v++)h.writeFixed64(p[v])}function i_e(p,h){for(var v=0;v<p.length;v++)h.writeSFixed64(p[v])}function jb(p,h){return(p[h]|p[h+1]<<8|p[h+2]<<16)+16777216*p[h+3]}function Zf(p,h,v){p[v]=h,p[v+1]=h>>>8,p[v+2]=h>>>16,p[v+3]=h>>>24}function L6(p,h){return(p[h]|p[h+1]<<8|p[h+2]<<16)+(p[h+3]<<24)}Qr.prototype={destroy:function(){this.buf=null},readFields:function(p,h,v){for(v=v||this.length;this.pos<v;){var b=this.readVarint(),E=b>>3,I=this.pos;this.type=7&b,p(E,h,this),this.pos===I&&this.skip(b)}return h},readMessage:function(p,h){return this.readFields(p,h,this.readVarint()+this.pos)},readFixed32:function(){var p=jb(this.buf,this.pos);return this.pos+=4,p},readSFixed32:function(){var p=L6(this.buf,this.pos);return this.pos+=4,p},readFixed64:function(){var p=jb(this.buf,this.pos)+jb(this.buf,this.pos+4)*QA;return this.pos+=8,p},readSFixed64:function(){var p=jb(this.buf,this.pos)+L6(this.buf,this.pos+4)*QA;return this.pos+=8,p},readFloat:function(){var p=A6(this.buf,this.pos,!0,23,4);return this.pos+=4,p},readDouble:function(){var p=A6(this.buf,this.pos,!0,52,8);return this.pos+=8,p},readVarint:function(p){var h,v,b=this.buf;return h=127&(v=b[this.pos++]),v<128?h:(h|=(127&(v=b[this.pos++]))<<7,v<128?h:(h|=(127&(v=b[this.pos++]))<<14,v<128?h:(h|=(127&(v=b[this.pos++]))<<21,v<128?h:function(E,I,k){var R,z,G=k.buf;if(R=(112&(z=G[k.pos++]))>>4,z<128||(R|=(127&(z=G[k.pos++]))<<3,z<128)||(R|=(127&(z=G[k.pos++]))<<10,z<128)||(R|=(127&(z=G[k.pos++]))<<17,z<128)||(R|=(127&(z=G[k.pos++]))<<24,z<128)||(R|=(1&(z=G[k.pos++]))<<31,z<128))return qf(E,R,I);throw new Error("Expected varint not more than 10 bytes")}(h|=(15&(v=b[this.pos]))<<28,p,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var p=this.readVarint();return p%2==1?(p+1)/-2:p/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var p=this.readVarint()+this.pos,h=this.pos;return this.pos=p,p-h>=12&&I6?function(v,b,E){return I6.decode(v.subarray(b,E))}(this.buf,h,p):function(v,b,E){for(var I="",k=b;k<E;){var R,z,G,W=v[k],j=null,ee=W>239?4:W>223?3:W>191?2:1;if(k+ee>E)break;ee===1?W<128&&(j=W):ee===2?(192&(R=v[k+1]))==128&&(j=(31&W)<<6|63&R)<=127&&(j=null):ee===3?(z=v[k+2],(192&(R=v[k+1]))==128&&(192&z)==128&&((j=(15&W)<<12|(63&R)<<6|63&z)<=2047||j>=55296&&j<=57343)&&(j=null)):ee===4&&(z=v[k+2],G=v[k+3],(192&(R=v[k+1]))==128&&(192&z)==128&&(192&G)==128&&((j=(15&W)<<18|(63&R)<<12|(63&z)<<6|63&G)<=65535||j>=1114112)&&(j=null)),j===null?(j=65533,ee=1):j>65535&&(j-=65536,I+=String.fromCharCode(j>>>10&1023|55296),j=56320|1023&j),I+=String.fromCharCode(j),k+=ee}return I}(this.buf,h,p)},readBytes:function(){var p=this.readVarint()+this.pos,h=this.buf.subarray(this.pos,p);return this.pos=p,h},readPackedVarint:function(p,h){if(this.type!==Qr.Bytes)return p.push(this.readVarint(h));var v=bl(this);for(p=p||[];this.pos<v;)p.push(this.readVarint(h));return p},readPackedSVarint:function(p){if(this.type!==Qr.Bytes)return p.push(this.readSVarint());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readSVarint());return p},readPackedBoolean:function(p){if(this.type!==Qr.Bytes)return p.push(this.readBoolean());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readBoolean());return p},readPackedFloat:function(p){if(this.type!==Qr.Bytes)return p.push(this.readFloat());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readFloat());return p},readPackedDouble:function(p){if(this.type!==Qr.Bytes)return p.push(this.readDouble());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readDouble());return p},readPackedFixed32:function(p){if(this.type!==Qr.Bytes)return p.push(this.readFixed32());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readFixed32());return p},readPackedSFixed32:function(p){if(this.type!==Qr.Bytes)return p.push(this.readSFixed32());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readSFixed32());return p},readPackedFixed64:function(p){if(this.type!==Qr.Bytes)return p.push(this.readFixed64());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readFixed64());return p},readPackedSFixed64:function(p){if(this.type!==Qr.Bytes)return p.push(this.readSFixed64());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readSFixed64());return p},skip:function(p){var h=7&p;if(h===Qr.Varint)for(;this.buf[this.pos++]>127;);else if(h===Qr.Bytes)this.pos=this.readVarint()+this.pos;else if(h===Qr.Fixed32)this.pos+=4;else{if(h!==Qr.Fixed64)throw new Error("Unimplemented type: "+h);this.pos+=8}},writeTag:function(p,h){this.writeVarint(p<<3|h)},realloc:function(p){for(var h=this.length||16;h<this.pos+p;)h*=2;if(h!==this.length){var v=new Uint8Array(h);v.set(this.buf),this.buf=v,this.length=h}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(p){this.realloc(4),Zf(this.buf,p,this.pos),this.pos+=4},writeSFixed32:function(p){this.realloc(4),Zf(this.buf,p,this.pos),this.pos+=4},writeFixed64:function(p){this.realloc(8),Zf(this.buf,-1&p,this.pos),Zf(this.buf,Math.floor(p*M6),this.pos+4),this.pos+=8},writeSFixed64:function(p){this.realloc(8),Zf(this.buf,-1&p,this.pos),Zf(this.buf,Math.floor(p*M6),this.pos+4),this.pos+=8},writeVarint:function(p){(p=+p||0)>268435455||p<0?function(h,v){var b,E;if(h>=0?(b=h%4294967296|0,E=h/4294967296|0):(E=~(-h/4294967296),4294967295^(b=~(-h%4294967296))?b=b+1|0:(b=0,E=E+1|0)),h>=18446744073709552e3||h<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");v.realloc(10),function(I,k,R){R.buf[R.pos++]=127&I|128,I>>>=7,R.buf[R.pos++]=127&I|128,I>>>=7,R.buf[R.pos++]=127&I|128,I>>>=7,R.buf[R.pos++]=127&I|128,R.buf[R.pos]=127&(I>>>=7)}(b,0,v),function(I,k){var R=(7&I)<<4;k.buf[k.pos++]|=R|((I>>>=3)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I)))))}(E,v)}(p,this):(this.realloc(4),this.buf[this.pos++]=127&p|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=p>>>7&127))))},writeSVarint:function(p){this.writeVarint(p<0?2*-p-1:2*p)},writeBoolean:function(p){this.writeVarint(!!p)},writeString:function(p){p=String(p),this.realloc(4*p.length),this.pos++;var h=this.pos;this.pos=function(b,E,I){for(var k,R,z=0;z<E.length;z++){if((k=E.charCodeAt(z))>55295&&k<57344){if(!R){k>56319||z+1===E.length?(b[I++]=239,b[I++]=191,b[I++]=189):R=k;continue}if(k<56320){b[I++]=239,b[I++]=191,b[I++]=189,R=k;continue}k=R-55296<<10|k-56320|65536,R=null}else R&&(b[I++]=239,b[I++]=191,b[I++]=189,R=null);k<128?b[I++]=k:(k<2048?b[I++]=k>>6|192:(k<65536?b[I++]=k>>12|224:(b[I++]=k>>18|240,b[I++]=k>>12&63|128),b[I++]=k>>6&63|128),b[I++]=63&k|128)}return I}(this.buf,p,this.pos);var v=this.pos-h;v>=128&&k6(h,v,this),this.pos=h-1,this.writeVarint(v),this.pos+=v},writeFloat:function(p){this.realloc(4),D6(this.buf,p,this.pos,!0,23,4),this.pos+=4},writeDouble:function(p){this.realloc(8),D6(this.buf,p,this.pos,!0,52,8),this.pos+=8},writeBytes:function(p){var h=p.length;this.writeVarint(h),this.realloc(h);for(var v=0;v<h;v++)this.buf[this.pos++]=p[v]},writeRawMessage:function(p,h){this.pos++;var v=this.pos;p(h,this);var b=this.pos-v;b>=128&&k6(v,b,this),this.pos=v-1,this.writeVarint(b),this.pos+=b},writeMessage:function(p,h,v){this.writeTag(p,Qr.Bytes),this.writeRawMessage(h,v)},writePackedVarint:function(p,h){h.length&&this.writeMessage(p,Yye,h)},writePackedSVarint:function(p,h){h.length&&this.writeMessage(p,Kye,h)},writePackedBoolean:function(p,h){h.length&&this.writeMessage(p,e_e,h)},writePackedFloat:function(p,h){h.length&&this.writeMessage(p,Jye,h)},writePackedDouble:function(p,h){h.length&&this.writeMessage(p,Qye,h)},writePackedFixed32:function(p,h){h.length&&this.writeMessage(p,t_e,h)},writePackedSFixed32:function(p,h){h.length&&this.writeMessage(p,r_e,h)},writePackedFixed64:function(p,h){h.length&&this.writeMessage(p,n_e,h)},writePackedSFixed64:function(p,h){h.length&&this.writeMessage(p,i_e,h)},writeBytesField:function(p,h){this.writeTag(p,Qr.Bytes),this.writeBytes(h)},writeFixed32Field:function(p,h){this.writeTag(p,Qr.Fixed32),this.writeFixed32(h)},writeSFixed32Field:function(p,h){this.writeTag(p,Qr.Fixed32),this.writeSFixed32(h)},writeFixed64Field:function(p,h){this.writeTag(p,Qr.Fixed64),this.writeFixed64(h)},writeSFixed64Field:function(p,h){this.writeTag(p,Qr.Fixed64),this.writeSFixed64(h)},writeVarintField:function(p,h){this.writeTag(p,Qr.Varint),this.writeVarint(h)},writeSVarintField:function(p,h){this.writeTag(p,Qr.Varint),this.writeSVarint(h)},writeStringField:function(p,h){this.writeTag(p,Qr.Bytes),this.writeString(h)},writeFloatField:function(p,h){this.writeTag(p,Qr.Fixed32),this.writeFloat(h)},writeDoubleField:function(p,h){this.writeTag(p,Qr.Fixed64),this.writeDouble(h)},writeBooleanField:function(p,h){this.writeVarintField(p,!!h)}};var eD=l(C6);const tD=3;function a_e(p,h,v){p===1&&v.readMessage(o_e,h)}function o_e(p,h,v){if(p===3){const{id:b,bitmap:E,width:I,height:k,left:R,top:z,advance:G}=v.readMessage(s_e,{});h.push({id:b,bitmap:new rm({width:I+2*tD,height:k+2*tD},E),metrics:{width:I,height:k,left:R,top:z,advance:G}})}}function s_e(p,h,v){p===1?h.id=v.readVarint():p===2?h.bitmap=v.readBytes():p===3?h.width=v.readVarint():p===4?h.height=v.readVarint():p===5?h.left=v.readSVarint():p===6?h.top=v.readSVarint():p===7&&(h.advance=v.readVarint())}const P6=tD;function R6(p){let h=0,v=0;for(const k of p)h+=k.w*k.h,v=Math.max(v,k.w);p.sort((k,R)=>R.h-k.h);const b=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(h/.95)),v),h:1/0}];let E=0,I=0;for(const k of p)for(let R=b.length-1;R>=0;R--){const z=b[R];if(!(k.w>z.w||k.h>z.h)){if(k.x=z.x,k.y=z.y,I=Math.max(I,k.y+k.h),E=Math.max(E,k.x+k.w),k.w===z.w&&k.h===z.h){const G=b.pop();R<b.length&&(b[R]=G)}else k.h===z.h?(z.x+=k.w,z.w-=k.w):k.w===z.w?(z.y+=k.h,z.h-=k.h):(b.push({x:z.x+k.w,y:z.y,w:z.w-k.w,h:k.h}),z.y+=k.h,z.h-=k.h);break}}return{w:E,h:I,fill:h/(E*I)||0}}const ga=1;class rD{constructor(h,{pixelRatio:v,version:b,stretchX:E,stretchY:I,content:k,textFitWidth:R,textFitHeight:z}){this.paddedRect=h,this.pixelRatio=v,this.stretchX=E,this.stretchY=I,this.content=k,this.version=b,this.textFitWidth=R,this.textFitHeight=z}get tl(){return[this.paddedRect.x+ga,this.paddedRect.y+ga]}get br(){return[this.paddedRect.x+this.paddedRect.w-ga,this.paddedRect.y+this.paddedRect.h-ga]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*ga)/this.pixelRatio,(this.paddedRect.h-2*ga)/this.pixelRatio]}}class N6{constructor(h,v){const b={},E={};this.haveRenderCallbacks=[];const I=[];this.addImages(h,b,I),this.addImages(v,E,I);const{w:k,h:R}=R6(I),z=new Ya({width:k||1,height:R||1});for(const G in h){const W=h[G],j=b[G].paddedRect;Ya.copy(W.data,z,{x:0,y:0},{x:j.x+ga,y:j.y+ga},W.data)}for(const G in v){const W=v[G],j=E[G].paddedRect,ee=j.x+ga,ne=j.y+ga,se=W.data.width,ce=W.data.height;Ya.copy(W.data,z,{x:0,y:0},{x:ee,y:ne},W.data),Ya.copy(W.data,z,{x:0,y:ce-1},{x:ee,y:ne-1},{width:se,height:1}),Ya.copy(W.data,z,{x:0,y:0},{x:ee,y:ne+ce},{width:se,height:1}),Ya.copy(W.data,z,{x:se-1,y:0},{x:ee-1,y:ne},{width:1,height:ce}),Ya.copy(W.data,z,{x:0,y:0},{x:ee+se,y:ne},{width:1,height:ce})}this.image=z,this.iconPositions=b,this.patternPositions=E}addImages(h,v,b){for(const E in h){const I=h[E],k={x:0,y:0,w:I.data.width+2*ga,h:I.data.height+2*ga};b.push(k),v[E]=new rD(k,I),I.hasRenderCallback&&this.haveRenderCallbacks.push(E)}}patchUpdatedImages(h,v){h.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const b in h.updatedImages)this.patchUpdatedImage(this.iconPositions[b],h.getImage(b),v),this.patchUpdatedImage(this.patternPositions[b],h.getImage(b),v)}patchUpdatedImage(h,v,b){if(!h||!v||h.version===v.version)return;h.version=v.version;const[E,I]=h.tl;b.update(v.data,void 0,{x:E,y:I})}}var Bc;Pt("ImagePosition",rD),Pt("ImageAtlas",N6),o.ah=void 0,(Bc=o.ah||(o.ah={}))[Bc.none=0]="none",Bc[Bc.horizontal=1]="horizontal",Bc[Bc.vertical=2]="vertical",Bc[Bc.horizontalOnly=3]="horizontalOnly";const cm=-17;class um{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(h,v){const b=new um;return b.scale=h||1,b.fontStack=v,b}static forImage(h){const v=new um;return v.imageName=h,v}}class jf{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(h,v){const b=new jf;for(let E=0;E<h.sections.length;E++){const I=h.sections[E];I.image?b.addImageSection(I):b.addTextSection(I,v)}return b}length(){return this.text.length}getSection(h){return this.sections[this.sectionIndex[h]]}getSectionIndex(h){return this.sectionIndex[h]}getCharCode(h){return this.text.charCodeAt(h)}verticalizePunctuation(){this.text=function(h){let v="";for(let b=0;b<h.length;b++){const E=h.charCodeAt(b+1)||null,I=h.charCodeAt(b-1)||null;v+=E&&Rb(E)&&!lm[h[b+1]]||I&&Rb(I)&&!lm[h[b-1]]||!lm[h[b]]?h[b]:lm[h[b]]}return v}(this.text)}trim(){let h=0;for(let b=0;b<this.text.length&&Yb[this.text.charCodeAt(b)];b++)h++;let v=this.text.length;for(let b=this.text.length-1;b>=0&&b>=h&&Yb[this.text.charCodeAt(b)];b--)v--;this.text=this.text.substring(h,v),this.sectionIndex=this.sectionIndex.slice(h,v)}substring(h,v){const b=new jf;return b.text=this.text.substring(h,v),b.sectionIndex=this.sectionIndex.slice(h,v),b.sections=this.sections,b}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((h,v)=>Math.max(h,this.sections[v].scale),0)}addTextSection(h,v){this.text+=h.text,this.sections.push(um.forText(h.scale,h.fontStack||v));const b=this.sections.length-1;for(let E=0;E<h.text.length;++E)this.sectionIndex.push(b)}addImageSection(h){const v=h.image?h.image.name:"";if(v.length===0)return void oe("Can't add FormattedSection with an empty image.");const b=this.getNextImageSectionCharCode();b?(this.text+=String.fromCharCode(b),this.sections.push(um.forImage(v)),this.sectionIndex.push(this.sections.length-1)):oe("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Xb(p,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se){const ce=jf.fromFeature(p,E);let ye;j===o.ah.vertical&&ce.verticalizePunctuation();const{processBidirectionalText:we,processStyledBidirectionalText:Oe}=fa;if(we&&ce.sections.length===1){ye=[];const He=we(ce.toString(),nD(ce,G,I,h,b,ne));for(const et of He){const Ct=new jf;Ct.text=et,Ct.sections=ce.sections;for(let Yt=0;Yt<et.length;Yt++)Ct.sectionIndex.push(0);ye.push(Ct)}}else if(Oe){ye=[];const He=Oe(ce.text,ce.sectionIndex,nD(ce,G,I,h,b,ne));for(const et of He){const Ct=new jf;Ct.text=et[0],Ct.sectionIndex=et[1],Ct.sections=ce.sections,ye.push(Ct)}}else ye=function(He,et){const Ct=[],Yt=He.text;let xt=0;for(const _t of et)Ct.push(He.substring(xt,_t)),xt=_t;return xt<Yt.length&&Ct.push(He.substring(xt,Yt.length)),Ct}(ce,nD(ce,G,I,h,b,ne));const Ae=[],Re={positionedLines:Ae,text:ce.toString(),top:W[1],bottom:W[1],left:W[0],right:W[0],writingMode:j,iconsInText:!1,verticalizable:!1};return function(He,et,Ct,Yt,xt,_t,Gt,Rt,It,Ye,Ut,Ft){let nr=0,rn=cm,en=0,Kn=0;const Lo=Rt==="right"?1:Rt==="left"?0:.5;let bi=0;for(const Mn of xt){Mn.trim();const Qn=Mn.getMaxScale(),Pi=(Qn-1)*Zn,xi={positionedGlyphs:[],lineOffset:0};He.positionedLines[bi]=xi;const ji=xi.positionedGlyphs;let wi=0;if(!Mn.length()){rn+=_t,++bi;continue}for(let va=0;va<Mn.length();va++){const $r=Mn.getSection(va),cn=Mn.getSectionIndex(va),vn=Mn.getCharCode(va);let Pa=0,Tn=null,Jf=null,Ls=null,Ps=Zn;const Po=!(It===o.ah.horizontal||!Ut&&!Xv(vn)||Ut&&(Yb[vn]||(Jn=vn,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Jn)))));if($r.imageName){const Qa=Yt[$r.imageName];if(!Qa)continue;Ls=$r.imageName,He.iconsInText=He.iconsInText||!0,Jf=Qa.paddedRect;const ui=Qa.displaySize;$r.scale=$r.scale*Zn/Ft,Tn={width:ui[0],height:ui[1],left:ga,top:-P6,advance:Po?ui[1]:ui[0]},Pa=Pi+(Zn-ui[1]*$r.scale),Ps=Tn.advance;const xl=Po?ui[0]*$r.scale-Zn*Qn:ui[1]*$r.scale-Zn*Qn;xl>0&&xl>wi&&(wi=xl)}else{const Qa=Ct[$r.fontStack],ui=Qa&&Qa[vn];if(ui&&ui.rect)Jf=ui.rect,Tn=ui.metrics;else{const xl=et[$r.fontStack],vm=xl&&xl[vn];if(!vm)continue;Tn=vm.metrics}Pa=(Qn-$r.scale)*Zn}Po?(He.verticalizable=!0,ji.push({glyph:vn,imageName:Ls,x:nr,y:rn+Pa,vertical:Po,scale:$r.scale,fontStack:$r.fontStack,sectionIndex:cn,metrics:Tn,rect:Jf}),nr+=Ps*$r.scale+Ye):(ji.push({glyph:vn,imageName:Ls,x:nr,y:rn+Pa,vertical:Po,scale:$r.scale,fontStack:$r.fontStack,sectionIndex:cn,metrics:Tn,rect:Jf}),nr+=Tn.advance*$r.scale+Ye)}ji.length!==0&&(en=Math.max(nr-Ye,en),h_e(ji,0,ji.length-1,Lo,wi)),nr=0;const Ja=_t*Qn+wi;xi.lineOffset=Math.max(wi,Pi),rn+=Ja,Kn=Math.max(Ja,Kn),++bi}var Jn;const Wi=rn-cm,{horizontalAlign:qi,verticalAlign:Zi}=iD(Gt);(function(Mn,Qn,Pi,xi,ji,wi,Ja,va,$r){const cn=(Qn-Pi)*ji;let vn=0;vn=wi!==Ja?-va*xi-cm:(-xi*$r+.5)*Ja;for(const Pa of Mn)for(const Tn of Pa.positionedGlyphs)Tn.x+=cn,Tn.y+=vn})(He.positionedLines,Lo,qi,Zi,en,Kn,_t,Wi,xt.length),He.top+=-Zi*Wi,He.bottom=He.top+Wi,He.left+=-qi*en,He.right=He.left+en}(Re,h,v,b,ye,k,R,z,j,G,ee,se),!function(He){for(const et of He)if(et.positionedGlyphs.length!==0)return!1;return!0}(Ae)&&Re}const Yb={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},l_e={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},c_e={40:!0};function O6(p,h,v,b,E,I){if(h.imageName){const k=b[h.imageName];return k?k.displaySize[0]*h.scale*Zn/I+E:0}{const k=v[h.fontStack],R=k&&k[p];return R?R.metrics.advance*h.scale+E:0}}function z6(p,h,v,b){const E=Math.pow(p-h,2);return b?p<h?E/2:2*E:E+Math.abs(v)*v}function u_e(p,h,v){let b=0;return p===10&&(b-=1e4),v&&(b+=150),p!==40&&p!==65288||(b+=50),h!==41&&h!==65289||(b+=50),b}function B6(p,h,v,b,E,I){let k=null,R=z6(h,v,E,I);for(const z of b){const G=z6(h-z.x,v,E,I)+z.badness;G<=R&&(k=z,R=G)}return{index:p,x:h,priorBreak:k,badness:R}}function V6(p){return p?V6(p.priorBreak).concat(p.index):[]}function nD(p,h,v,b,E,I){if(!p)return[];const k=[],R=function(j,ee,ne,se,ce,ye){let we=0;for(let Oe=0;Oe<j.length();Oe++){const Ae=j.getSection(Oe);we+=O6(j.getCharCode(Oe),Ae,se,ce,ee,ye)}return we/Math.max(1,Math.ceil(we/ne))}(p,h,v,b,E,I),z=p.text.indexOf("")>=0;let G=0;for(let j=0;j<p.length();j++){const ee=p.getSection(j),ne=p.getCharCode(j);if(Yb[ne]||(G+=O6(ne,ee,b,E,h,I)),j<p.length()-1){const se=!((W=ne)<11904)&&(!!Lr["CJK Compatibility Forms"](W)||!!Lr["CJK Compatibility"](W)||!!Lr["CJK Strokes"](W)||!!Lr["CJK Symbols and Punctuation"](W)||!!Lr["Enclosed CJK Letters and Months"](W)||!!Lr["Halfwidth and Fullwidth Forms"](W)||!!Lr["Ideographic Description Characters"](W)||!!Lr["Vertical Forms"](W)||Pb.test(String.fromCodePoint(W)));(l_e[ne]||se||ee.imageName||j!==p.length()-2&&c_e[p.getCharCode(j+1)])&&k.push(B6(j+1,G,R,k,u_e(ne,p.getCharCode(j+1),se&&z),!1))}}var W;return V6(B6(p.length(),G,R,k,0,!0))}function iD(p){let h=.5,v=.5;switch(p){case"right":case"top-right":case"bottom-right":h=1;break;case"left":case"top-left":case"bottom-left":h=0}switch(p){case"bottom":case"bottom-right":case"bottom-left":v=1;break;case"top":case"top-right":case"top-left":v=0}return{horizontalAlign:h,verticalAlign:v}}function h_e(p,h,v,b,E){if(!b&&!E)return;const I=p[v],k=(p[v].x+I.metrics.advance*I.scale)*b;for(let R=h;R<=v;R++)p[R].x-=k,p[R].y+=E}function d_e(p,h,v){const{horizontalAlign:b,verticalAlign:E}=iD(v),I=h[0]-p.displaySize[0]*b,k=h[1]-p.displaySize[1]*E;return{image:p,top:k,bottom:k+p.displaySize[1],left:I,right:I+p.displaySize[0]}}function F6(p){var h,v;let b=p.left,E=p.top,I=p.right-b,k=p.bottom-E;const R=(h=p.image.textFitWidth)!==null&&h!==void 0?h:"stretchOrShrink",z=(v=p.image.textFitHeight)!==null&&v!==void 0?v:"stretchOrShrink",G=(p.image.content[2]-p.image.content[0])/(p.image.content[3]-p.image.content[1]);if(z==="proportional"){if(R==="stretchOnly"&&I/k<G||R==="proportional"){const W=Math.ceil(k*G);b*=W/I,I=W}}else if(R==="proportional"&&z==="stretchOnly"&&G!==0&&I/k>G){const W=Math.ceil(I/G);E*=W/k,k=W}return{x1:b,y1:E,x2:b+I,y2:E+k}}function $6(p,h,v,b,E,I){const k=p.image;let R;if(k.content){const ye=k.content,we=k.pixelRatio||1;R=[ye[0]/we,ye[1]/we,k.displaySize[0]-ye[2]/we,k.displaySize[1]-ye[3]/we]}const z=h.left*I,G=h.right*I;let W,j,ee,ne;v==="width"||v==="both"?(ne=E[0]+z-b[3],j=E[0]+G+b[1]):(ne=E[0]+(z+G-k.displaySize[0])/2,j=ne+k.displaySize[0]);const se=h.top*I,ce=h.bottom*I;return v==="height"||v==="both"?(W=E[1]+se-b[0],ee=E[1]+ce+b[2]):(W=E[1]+(se+ce-k.displaySize[1])/2,ee=W+k.displaySize[1]),{image:k,top:W,right:j,bottom:ee,left:ne,collisionPadding:R}}const hm=255,ks=128,Vc=hm*ks;function G6(p,h){const{expression:v}=h;if(v.kind==="constant")return{kind:"constant",layoutSize:v.evaluate(new dn(p+1))};if(v.kind==="source")return{kind:"source"};{const{zoomStops:b,interpolationType:E}=v;let I=0;for(;I<b.length&&b[I]<=p;)I++;I=Math.max(0,I-1);let k=I;for(;k<b.length&&b[k]<p+1;)k++;k=Math.min(b.length-1,k);const R=b[I],z=b[k];return v.kind==="composite"?{kind:"composite",minZoom:R,maxZoom:z,interpolationType:E}:{kind:"camera",minZoom:R,maxZoom:z,minSize:v.evaluate(new dn(R)),maxSize:v.evaluate(new dn(z)),interpolationType:E}}}function aD(p,h,v){let b="never";const E=p.get(h);return E?b=E:p.get(v)&&(b="always"),b}const f_e=zc.VectorTileFeature.types,p_e=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Kb(p,h,v,b,E,I,k,R,z,G,W,j,ee){const ne=R?Math.min(Vc,Math.round(R[0])):0,se=R?Math.min(Vc,Math.round(R[1])):0;p.emplaceBack(h,v,Math.round(32*b),Math.round(32*E),I,k,(ne<<1)+(z?1:0),se,16*G,16*W,256*j,256*ee)}function oD(p,h,v){p.emplaceBack(h.x,h.y,v),p.emplaceBack(h.x,h.y,v),p.emplaceBack(h.x,h.y,v),p.emplaceBack(h.x,h.y,v)}function g_e(p){for(const h of p.sections)if(RA(h.text))return!0;return!1}class sD{constructor(h){this.layoutVertexArray=new zf,this.indexArray=new Xa,this.programConfigurations=h,this.segments=new Pr,this.dynamicLayoutVertexArray=new Jv,this.opacityVertexArray=new ka,this.hasVisibleVertices=!1,this.placedSymbolArray=new fn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(h,v,b,E){this.isEmpty()||(b&&(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,Wye.members),this.indexBuffer=h.createIndexBuffer(this.indexArray,v),this.dynamicLayoutVertexBuffer=h.createVertexBuffer(this.dynamicLayoutVertexArray,qye.members,!0),this.opacityVertexBuffer=h.createVertexBuffer(this.opacityVertexArray,p_e,!0),this.opacityVertexBuffer.itemSize=1),(b||E)&&this.programConfigurations.upload(h))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Pt("SymbolBuffers",sD);class lD{constructor(h,v,b){this.layoutVertexArray=new h,this.layoutAttributes=v,this.indexArray=new b,this.segments=new Pr,this.collisionVertexArray=new Ms}upload(h){this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=h.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=h.createVertexBuffer(this.collisionVertexArray,Zye.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Pt("CollisionBuffers",lD);class Xf{constructor(h){this.collisionBoxArray=h.collisionBoxArray,this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(k=>k.id),this.index=h.index,this.pixelRatio=h.pixelRatio,this.sourceLayerIndex=h.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=$A([]),this.placementViewportMatrix=$A([]);const v=this.layers[0]._unevaluatedLayout._values;this.textSizeData=G6(this.zoom,v["text-size"]),this.iconSizeData=G6(this.zoom,v["icon-size"]);const b=this.layers[0].layout,E=b.get("symbol-sort-key"),I=b.get("symbol-z-order");this.canOverlap=aD(b,"text-overlap","text-allow-overlap")!=="never"||aD(b,"icon-overlap","icon-allow-overlap")!=="never"||b.get("text-ignore-placement")||b.get("icon-ignore-placement"),this.sortFeaturesByKey=I!=="viewport-y"&&!E.isConstant(),this.sortFeaturesByY=(I==="viewport-y"||I==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,b.get("symbol-placement")==="point"&&(this.writingModes=b.get("text-writing-mode").map(k=>o.ah[k])),this.stateDependentLayerIds=this.layers.filter(k=>k.isStateDependent()).map(k=>k.id),this.sourceID=h.sourceID}createArrays(){this.text=new sD(new Lh(this.layers,this.zoom,h=>/^text/.test(h))),this.icon=new sD(new Lh(this.layers,this.zoom,h=>/^icon/.test(h))),this.glyphOffsetArray=new pn,this.lineVertexArray=new vi,this.symbolInstances=new Mr,this.textAnchorOffsets=new gn}calculateGlyphDependencies(h,v,b,E,I){for(let k=0;k<h.length;k++)if(v[h.charCodeAt(k)]=!0,(b||E)&&I){const R=lm[h.charAt(k)];R&&(v[R.charCodeAt(0)]=!0)}}populate(h,v,b){const E=this.layers[0],I=E.layout,k=I.get("text-font"),R=I.get("text-field"),z=I.get("icon-image"),G=(R.value.kind!=="constant"||R.value.value instanceof ca&&!R.value.value.isEmpty()||R.value.value.toString().length>0)&&(k.value.kind!=="constant"||k.value.value.length>0),W=z.value.kind!=="constant"||!!z.value.value||Object.keys(z.parameters).length>0,j=I.get("symbol-sort-key");if(this.features=[],!G&&!W)return;const ee=v.iconDependencies,ne=v.glyphDependencies,se=v.availableImages,ce=new dn(this.zoom);for(const{feature:ye,id:we,index:Oe,sourceLayerIndex:Ae}of h){const Re=E._featureFilter.needGeometry,He=Rh(ye,Re);if(!E._featureFilter.filter(ce,He,b))continue;let et,Ct;if(Re||(He.geometry=Ph(ye)),G){const xt=E.getValueAndResolveTokens("text-field",He,b,se),_t=ca.factory(xt),Gt=this.hasRTLText=this.hasRTLText||g_e(_t);(!Gt||fa.getRTLTextPluginStatus()==="unavailable"||Gt&&fa.isParsed())&&(et=Xye(_t,E,He))}if(W){const xt=E.getValueAndResolveTokens("icon-image",He,b,se);Ct=xt instanceof ha?xt:ha.fromString(xt)}if(!et&&!Ct)continue;const Yt=this.sortFeaturesByKey?j.evaluate(He,{},b):void 0;if(this.features.push({id:we,text:et,icon:Ct,index:Oe,sourceLayerIndex:Ae,geometry:He.geometry,properties:ye.properties,type:f_e[ye.type],sortKey:Yt}),Ct&&(ee[Ct.name]=!0),et){const xt=k.evaluate(He,{},b).join(","),_t=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(o.ah.vertical)>=0;for(const Gt of et.sections)if(Gt.image)ee[Gt.image.name]=!0;else{const Rt=Zv(et.toString()),It=Gt.fontStack||xt,Ye=ne[It]=ne[It]||{};this.calculateGlyphDependencies(Gt.text,Ye,_t,this.allowVerticalPlacement,Rt)}}}I.get("symbol-placement")==="line"&&(this.features=function(ye){const we={},Oe={},Ae=[];let Re=0;function He(xt){Ae.push(ye[xt]),Re++}function et(xt,_t,Gt){const Rt=Oe[xt];return delete Oe[xt],Oe[_t]=Rt,Ae[Rt].geometry[0].pop(),Ae[Rt].geometry[0]=Ae[Rt].geometry[0].concat(Gt[0]),Rt}function Ct(xt,_t,Gt){const Rt=we[_t];return delete we[_t],we[xt]=Rt,Ae[Rt].geometry[0].shift(),Ae[Rt].geometry[0]=Gt[0].concat(Ae[Rt].geometry[0]),Rt}function Yt(xt,_t,Gt){const Rt=Gt?_t[0][_t[0].length-1]:_t[0][0];return`${xt}:${Rt.x}:${Rt.y}`}for(let xt=0;xt<ye.length;xt++){const _t=ye[xt],Gt=_t.geometry,Rt=_t.text?_t.text.toString():null;if(!Rt){He(xt);continue}const It=Yt(Rt,Gt),Ye=Yt(Rt,Gt,!0);if(It in Oe&&Ye in we&&Oe[It]!==we[Ye]){const Ut=Ct(It,Ye,Gt),Ft=et(It,Ye,Ae[Ut].geometry);delete we[It],delete Oe[Ye],Oe[Yt(Rt,Ae[Ft].geometry,!0)]=Ft,Ae[Ut].geometry=null}else It in Oe?et(It,Ye,Gt):Ye in we?Ct(It,Ye,Gt):(He(xt),we[It]=Re-1,Oe[Ye]=Re-1)}return Ae.filter(xt=>xt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ye,we)=>ye.sortKey-we.sortKey)}update(h,v,b){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(h,v,this.layers,b),this.icon.programConfigurations.updatePaintArrays(h,v,this.layers,b))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(h){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(h),this.iconCollisionBox.upload(h)),this.text.upload(h,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(h,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(h,v){const b=this.lineVertexArray.length;if(h.segment!==void 0){let E=h.dist(v[h.segment+1]),I=h.dist(v[h.segment]);const k={};for(let R=h.segment+1;R<v.length;R++)k[R]={x:v[R].x,y:v[R].y,tileUnitDistanceFromAnchor:E},R<v.length-1&&(E+=v[R+1].dist(v[R]));for(let R=h.segment||0;R>=0;R--)k[R]={x:v[R].x,y:v[R].y,tileUnitDistanceFromAnchor:I},R>0&&(I+=v[R-1].dist(v[R]));for(let R=0;R<v.length;R++){const z=k[R];this.lineVertexArray.emplaceBack(z.x,z.y,z.tileUnitDistanceFromAnchor)}}return{lineStartIndex:b,lineLength:this.lineVertexArray.length-b}}addSymbols(h,v,b,E,I,k,R,z,G,W,j,ee){const ne=h.indexArray,se=h.layoutVertexArray,ce=h.segments.prepareSegment(4*v.length,se,ne,this.canOverlap?k.sortKey:void 0),ye=this.glyphOffsetArray.length,we=ce.vertexLength,Oe=this.allowVerticalPlacement&&R===o.ah.vertical?Math.PI/2:0,Ae=k.text&&k.text.sections;for(let Re=0;Re<v.length;Re++){const{tl:He,tr:et,bl:Ct,br:Yt,tex:xt,pixelOffsetTL:_t,pixelOffsetBR:Gt,minFontScaleX:Rt,minFontScaleY:It,glyphOffset:Ye,isSDF:Ut,sectionIndex:Ft}=v[Re],nr=ce.vertexLength,rn=Ye[1];Kb(se,z.x,z.y,He.x,rn+He.y,xt.x,xt.y,b,Ut,_t.x,_t.y,Rt,It),Kb(se,z.x,z.y,et.x,rn+et.y,xt.x+xt.w,xt.y,b,Ut,Gt.x,_t.y,Rt,It),Kb(se,z.x,z.y,Ct.x,rn+Ct.y,xt.x,xt.y+xt.h,b,Ut,_t.x,Gt.y,Rt,It),Kb(se,z.x,z.y,Yt.x,rn+Yt.y,xt.x+xt.w,xt.y+xt.h,b,Ut,Gt.x,Gt.y,Rt,It),oD(h.dynamicLayoutVertexArray,z,Oe),ne.emplaceBack(nr,nr+1,nr+2),ne.emplaceBack(nr+1,nr+2,nr+3),ce.vertexLength+=4,ce.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ye[0]),Re!==v.length-1&&Ft===v[Re+1].sectionIndex||h.programConfigurations.populatePaintArrays(se.length,k,k.index,{},ee,Ae&&Ae[Ft])}h.placedSymbolArray.emplaceBack(z.x,z.y,ye,this.glyphOffsetArray.length-ye,we,G,W,z.segment,b?b[0]:0,b?b[1]:0,E[0],E[1],R,0,!1,0,j)}_addCollisionDebugVertex(h,v,b,E,I,k){return v.emplaceBack(0,0),h.emplaceBack(b.x,b.y,E,I,Math.round(k.x),Math.round(k.y))}addCollisionDebugVertices(h,v,b,E,I,k,R){const z=I.segments.prepareSegment(4,I.layoutVertexArray,I.indexArray),G=z.vertexLength,W=I.layoutVertexArray,j=I.collisionVertexArray,ee=R.anchorX,ne=R.anchorY;this._addCollisionDebugVertex(W,j,k,ee,ne,new f(h,v)),this._addCollisionDebugVertex(W,j,k,ee,ne,new f(b,v)),this._addCollisionDebugVertex(W,j,k,ee,ne,new f(b,E)),this._addCollisionDebugVertex(W,j,k,ee,ne,new f(h,E)),z.vertexLength+=4;const se=I.indexArray;se.emplaceBack(G,G+1),se.emplaceBack(G+1,G+2),se.emplaceBack(G+2,G+3),se.emplaceBack(G+3,G),z.primitiveLength+=4}addDebugCollisionBoxes(h,v,b,E){for(let I=h;I<v;I++){const k=this.collisionBoxArray.get(I);this.addCollisionDebugVertices(k.x1,k.y1,k.x2,k.y2,E?this.textCollisionBox:this.iconCollisionBox,k.anchorPoint,b)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new lD(La,E6.members,ci),this.iconCollisionBox=new lD(La,E6.members,ci);for(let h=0;h<this.symbolInstances.length;h++){const v=this.symbolInstances.get(h);this.addDebugCollisionBoxes(v.textBoxStartIndex,v.textBoxEndIndex,v,!0),this.addDebugCollisionBoxes(v.verticalTextBoxStartIndex,v.verticalTextBoxEndIndex,v,!0),this.addDebugCollisionBoxes(v.iconBoxStartIndex,v.iconBoxEndIndex,v,!1),this.addDebugCollisionBoxes(v.verticalIconBoxStartIndex,v.verticalIconBoxEndIndex,v,!1)}}_deserializeCollisionBoxesForSymbol(h,v,b,E,I,k,R,z,G){const W={};for(let j=v;j<b;j++){const ee=h.get(j);W.textBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.textFeatureIndex=ee.featureIndex;break}for(let j=E;j<I;j++){const ee=h.get(j);W.verticalTextBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.verticalTextFeatureIndex=ee.featureIndex;break}for(let j=k;j<R;j++){const ee=h.get(j);W.iconBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.iconFeatureIndex=ee.featureIndex;break}for(let j=z;j<G;j++){const ee=h.get(j);W.verticalIconBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.verticalIconFeatureIndex=ee.featureIndex;break}return W}deserializeCollisionBoxes(h){this.collisionArrays=[];for(let v=0;v<this.symbolInstances.length;v++){const b=this.symbolInstances.get(v);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(h,b.textBoxStartIndex,b.textBoxEndIndex,b.verticalTextBoxStartIndex,b.verticalTextBoxEndIndex,b.iconBoxStartIndex,b.iconBoxEndIndex,b.verticalIconBoxStartIndex,b.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(h,v){const b=h.placedSymbolArray.get(v),E=b.vertexStartIndex+4*b.numGlyphs;for(let I=b.vertexStartIndex;I<E;I+=4)h.indexArray.emplaceBack(I,I+1,I+2),h.indexArray.emplaceBack(I+1,I+2,I+3)}getSortedSymbolIndexes(h){if(this.sortedAngle===h&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const v=Math.sin(h),b=Math.cos(h),E=[],I=[],k=[];for(let R=0;R<this.symbolInstances.length;++R){k.push(R);const z=this.symbolInstances.get(R);E.push(0|Math.round(v*z.anchorX+b*z.anchorY)),I.push(z.featureIndex)}return k.sort((R,z)=>E[R]-E[z]||I[z]-I[R]),k}addToSortKeyRanges(h,v){const b=this.sortKeyRanges[this.sortKeyRanges.length-1];b&&b.sortKey===v?b.symbolInstanceEnd=h+1:this.sortKeyRanges.push({sortKey:v,symbolInstanceStart:h,symbolInstanceEnd:h+1})}sortFeatures(h){if(this.sortFeaturesByY&&this.sortedAngle!==h&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(h),this.sortedAngle=h,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const v of this.symbolInstanceIndexes){const b=this.symbolInstances.get(v);this.featureSortOrder.push(b.featureIndex),[b.rightJustifiedTextSymbolIndex,b.centerJustifiedTextSymbolIndex,b.leftJustifiedTextSymbolIndex].forEach((E,I,k)=>{E>=0&&k.indexOf(E)===I&&this.addIndicesForPlacedSymbol(this.text,E)}),b.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,b.verticalPlacedTextSymbolIndex),b.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,b.placedIconSymbolIndex),b.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,b.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let U6,H6;Pt("SymbolBucket",Xf,{omit:["layers","collisionBoxArray","features","compareText"]}),Xf.MAX_GLYPHS=65535,Xf.addDynamicAttributes=oD;var cD={get paint(){return H6=H6||new D({"icon-opacity":new Kt(Le.paint_symbol["icon-opacity"]),"icon-color":new Kt(Le.paint_symbol["icon-color"]),"icon-halo-color":new Kt(Le.paint_symbol["icon-halo-color"]),"icon-halo-width":new Kt(Le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Kt(Le.paint_symbol["icon-halo-blur"]),"icon-translate":new Ot(Le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ot(Le.paint_symbol["icon-translate-anchor"]),"text-opacity":new Kt(Le.paint_symbol["text-opacity"]),"text-color":new Kt(Le.paint_symbol["text-color"],{runtimeType:pi,getOverride:p=>p.textColor,hasOverride:p=>!!p.textColor}),"text-halo-color":new Kt(Le.paint_symbol["text-halo-color"]),"text-halo-width":new Kt(Le.paint_symbol["text-halo-width"]),"text-halo-blur":new Kt(Le.paint_symbol["text-halo-blur"]),"text-translate":new Ot(Le.paint_symbol["text-translate"]),"text-translate-anchor":new Ot(Le.paint_symbol["text-translate-anchor"])})},get layout(){return U6=U6||new D({"symbol-placement":new Ot(Le.layout_symbol["symbol-placement"]),"symbol-spacing":new Ot(Le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ot(Le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Kt(Le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ot(Le.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ot(Le.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ot(Le.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ot(Le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ot(Le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ot(Le.layout_symbol["icon-rotation-alignment"]),"icon-size":new Kt(Le.layout_symbol["icon-size"]),"icon-text-fit":new Ot(Le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ot(Le.layout_symbol["icon-text-fit-padding"]),"icon-image":new Kt(Le.layout_symbol["icon-image"]),"icon-rotate":new Kt(Le.layout_symbol["icon-rotate"]),"icon-padding":new Kt(Le.layout_symbol["icon-padding"]),"icon-keep-upright":new Ot(Le.layout_symbol["icon-keep-upright"]),"icon-offset":new Kt(Le.layout_symbol["icon-offset"]),"icon-anchor":new Kt(Le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ot(Le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ot(Le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ot(Le.layout_symbol["text-rotation-alignment"]),"text-field":new Kt(Le.layout_symbol["text-field"]),"text-font":new Kt(Le.layout_symbol["text-font"]),"text-size":new Kt(Le.layout_symbol["text-size"]),"text-max-width":new Kt(Le.layout_symbol["text-max-width"]),"text-line-height":new Ot(Le.layout_symbol["text-line-height"]),"text-letter-spacing":new Kt(Le.layout_symbol["text-letter-spacing"]),"text-justify":new Kt(Le.layout_symbol["text-justify"]),"text-radial-offset":new Kt(Le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ot(Le.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Kt(Le.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Kt(Le.layout_symbol["text-anchor"]),"text-max-angle":new Ot(Le.layout_symbol["text-max-angle"]),"text-writing-mode":new Ot(Le.layout_symbol["text-writing-mode"]),"text-rotate":new Kt(Le.layout_symbol["text-rotate"]),"text-padding":new Ot(Le.layout_symbol["text-padding"]),"text-keep-upright":new Ot(Le.layout_symbol["text-keep-upright"]),"text-transform":new Kt(Le.layout_symbol["text-transform"]),"text-offset":new Kt(Le.layout_symbol["text-offset"]),"text-allow-overlap":new Ot(Le.layout_symbol["text-allow-overlap"]),"text-overlap":new Ot(Le.layout_symbol["text-overlap"]),"text-ignore-placement":new Ot(Le.layout_symbol["text-ignore-placement"]),"text-optional":new Ot(Le.layout_symbol["text-optional"])})}};class W6{constructor(h){if(h.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=h.property.overrides?h.property.overrides.runtimeType:Ln,this.defaultValue=h}evaluate(h){if(h.formattedSection){const v=this.defaultValue.property.overrides;if(v&&v.hasOverride(h.formattedSection))return v.getOverride(h.formattedSection)}return h.feature&&h.featureState?this.defaultValue.evaluate(h.feature,h.featureState):this.defaultValue.property.specification.default}eachChild(h){this.defaultValue.isConstant()||h(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Pt("FormatSectionOverride",W6,{omit:["defaultValue"]});class Jb extends y{constructor(h){super(h,cD)}recalculate(h,v){if(super.recalculate(h,v),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const b=this.layout.get("text-writing-mode");if(b){const E=[];for(const I of b)E.indexOf(I)<0&&E.push(I);this.layout._values["text-writing-mode"]=E}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(h,v,b,E){const I=this.layout.get(h).evaluate(v,{},b,E),k=this._unevaluatedLayout._values[h];return k.isDataDriven()||wf(k.value)||!I?I:function(R,z){return z.replace(/{([^{}]+)}/g,(G,W)=>R&&W in R?String(R[W]):"")}(v.properties,I)}createBucket(h){return new Xf(h)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const h of cD.paint.overridableProperties){if(!Jb.hasPaintOverride(this.layout,h))continue;const v=this.paint.get(h),b=new W6(v),E=new xf(b,v.property.specification);let I=null;I=v.value.kind==="constant"||v.value.kind==="source"?new xc("source",E):new wc("composite",E,v.value.zoomStops),this.paint._values[h]=new Io(v.property,I,v.parameters)}}_handleOverridablePaintPropertyUpdate(h,v,b){return!(!this.layout||v.isDataDriven()||b.isDataDriven())&&Jb.hasPaintOverride(this.layout,h)}static hasPaintOverride(h,v){const b=h.get("text-field"),E=cD.paint.properties[v];let I=!1;const k=R=>{for(const z of R)if(E.overrides&&E.overrides.hasOverride(z))return void(I=!0)};if(b.value.kind==="constant"&&b.value.value instanceof ca)k(b.value.value.sections);else if(b.value.kind==="source"){const R=G=>{I||(G instanceof Ua&&Vn(G.value)===Mi?k(G.value.sections):G instanceof df?k(G.sections):G.eachChild(R))},z=b.value;z._styleExpression&&R(z._styleExpression.expression)}return I}}let q6;var v_e={get paint(){return q6=q6||new D({"background-color":new Ot(Le.paint_background["background-color"]),"background-pattern":new Nf(Le.paint_background["background-pattern"]),"background-opacity":new Ot(Le.paint_background["background-opacity"])})}};class m_e extends y{constructor(h){super(h,v_e)}}let Z6;var y_e={get paint(){return Z6=Z6||new D({"raster-opacity":new Ot(Le.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ot(Le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ot(Le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ot(Le.paint_raster["raster-brightness-max"]),"raster-saturation":new Ot(Le.paint_raster["raster-saturation"]),"raster-contrast":new Ot(Le.paint_raster["raster-contrast"]),"raster-resampling":new Ot(Le.paint_raster["raster-resampling"]),"raster-fade-duration":new Ot(Le.paint_raster["raster-fade-duration"])})}};class __e extends y{constructor(h){super(h,y_e)}}class b_e extends y{constructor(h){super(h,{}),this.onAdd=v=>{this.implementation.onAdd&&this.implementation.onAdd(v,v.painter.context.gl)},this.onRemove=v=>{this.implementation.onRemove&&this.implementation.onRemove(v,v.painter.context.gl)},this.implementation=h}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class x_e{constructor(h){this._methodToThrottle=h,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const uD=63710088e-1;class Fc{constructor(h,v){if(isNaN(h)||isNaN(v))throw new Error(`Invalid LngLat object: (${h}, ${v})`);if(this.lng=+h,this.lat=+v,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Fc(V(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(h){const v=Math.PI/180,b=this.lat*v,E=h.lat*v,I=Math.sin(b)*Math.sin(E)+Math.cos(b)*Math.cos(E)*Math.cos((h.lng-this.lng)*v);return uD*Math.acos(Math.min(I,1))}static convert(h){if(h instanceof Fc)return h;if(Array.isArray(h)&&(h.length===2||h.length===3))return new Fc(Number(h[0]),Number(h[1]));if(!Array.isArray(h)&&typeof h=="object"&&h!==null)return new Fc(Number("lng"in h?h.lng:h.lon),Number(h.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 j6=2*Math.PI*uD;function X6(p){return j6*Math.cos(p*Math.PI/180)}function Y6(p){return(180+p)/360}function K6(p){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p*Math.PI/360)))/360}function J6(p,h){return p/X6(h)}function hD(p){return 360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90}class dm{constructor(h,v,b=0){this.x=+h,this.y=+v,this.z=+b}static fromLngLat(h,v=0){const b=Fc.convert(h);return new dm(Y6(b.lng),K6(b.lat),J6(v,b.lat))}toLngLat(){return new Fc(360*this.x-180,hD(this.y))}toAltitude(){return this.z*X6(hD(this.y))}meterInMercatorCoordinateUnits(){return 1/j6*(h=hD(this.y),1/Math.cos(h*Math.PI/180));var h}}function Q6(p,h,v){var b=2*Math.PI*6378137/256/Math.pow(2,v);return[p*b-2*Math.PI*6378137/2,h*b-2*Math.PI*6378137/2]}class dD{constructor(h,v,b){if(!function(E,I,k){return!(E<0||E>25||k<0||k>=Math.pow(2,E)||I<0||I>=Math.pow(2,E))}(h,v,b))throw new Error(`x=${v}, y=${b}, z=${h} outside of bounds. 0<=x<${Math.pow(2,h)}, 0<=y<${Math.pow(2,h)} 0<=z<=25 `);this.z=h,this.x=v,this.y=b,this.key=fm(0,h,h,v,b)}equals(h){return this.z===h.z&&this.x===h.x&&this.y===h.y}url(h,v,b){const E=(k=this.y,R=this.z,z=Q6(256*(I=this.x),256*(k=Math.pow(2,R)-k-1),R),G=Q6(256*(I+1),256*(k+1),R),z[0]+","+z[1]+","+G[0]+","+G[1]);var I,k,R,z,G;const W=function(j,ee,ne){let se,ce="";for(let ye=j;ye>0;ye--)se=1<<ye-1,ce+=(ee&se?1:0)+(ne&se?2:0);return ce}(this.z,this.x,this.y);return h[(this.x+this.y)%h.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(b==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,v>1?"@2x":"").replace(/{quadkey}/g,W).replace(/{bbox-epsg-3857}/g,E)}isChildOf(h){const v=this.z-h.z;return v>0&&h.x===this.x>>v&&h.y===this.y>>v}getTilePoint(h){const v=Math.pow(2,this.z);return new f((h.x*v-this.x)*Fn,(h.y*v-this.y)*Fn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class eG{constructor(h,v){this.wrap=h,this.canonical=v,this.key=fm(h,v.z,v.z,v.x,v.y)}}class Ka{constructor(h,v,b,E,I){if(h<b)throw new Error(`overscaledZ should be >= z; overscaledZ = ${h}; z = ${b}`);this.overscaledZ=h,this.wrap=v,this.canonical=new dD(b,+E,+I),this.key=fm(v,h,b,E,I)}clone(){return new Ka(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(h){return this.overscaledZ===h.overscaledZ&&this.wrap===h.wrap&&this.canonical.equals(h.canonical)}scaledTo(h){if(h>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${h}; overscaledZ = ${this.overscaledZ}`);const v=this.canonical.z-h;return h>this.canonical.z?new Ka(h,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ka(h,this.wrap,h,this.canonical.x>>v,this.canonical.y>>v)}calculateScaledKey(h,v){if(h>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${h}; overscaledZ = ${this.overscaledZ}`);const b=this.canonical.z-h;return h>this.canonical.z?fm(this.wrap*+v,h,this.canonical.z,this.canonical.x,this.canonical.y):fm(this.wrap*+v,h,h,this.canonical.x>>b,this.canonical.y>>b)}isChildOf(h){if(h.wrap!==this.wrap)return!1;const v=this.canonical.z-h.canonical.z;return h.overscaledZ===0||h.overscaledZ<this.overscaledZ&&h.canonical.x===this.canonical.x>>v&&h.canonical.y===this.canonical.y>>v}children(h){if(this.overscaledZ>=h)return[new Ka(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const v=this.canonical.z+1,b=2*this.canonical.x,E=2*this.canonical.y;return[new Ka(v,this.wrap,v,b,E),new Ka(v,this.wrap,v,b+1,E),new Ka(v,this.wrap,v,b,E+1),new Ka(v,this.wrap,v,b+1,E+1)]}isLessThan(h){return this.wrap<h.wrap||!(this.wrap>h.wrap)&&(this.overscaledZ<h.overscaledZ||!(this.overscaledZ>h.overscaledZ)&&(this.canonical.x<h.canonical.x||!(this.canonical.x>h.canonical.x)&&this.canonical.y<h.canonical.y))}wrapped(){return new Ka(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(h){return new Ka(this.overscaledZ,h,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new eG(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(h){return this.canonical.getTilePoint(new dm(h.x-this.wrap,h.y))}}function fm(p,h,v,b,E){(p*=2)<0&&(p=-1*p-1);const I=1<<v;return(I*I*p+I*E+b).toString(36)+v.toString(36)+h.toString(36)}Pt("CanonicalTileID",dD),Pt("OverscaledTileID",Ka,{omit:["posMatrix"]});class tG{constructor(h,v,b,E=1,I=1,k=1,R=0){if(this.uid=h,v.height!==v.width)throw new RangeError("DEM tiles must be square");if(b&&!["mapbox","terrarium","custom"].includes(b))return void oe(`"${b}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=v.height;const z=this.dim=v.height-2;switch(this.data=new Uint32Array(v.data.buffer),b){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=E,this.greenFactor=I,this.blueFactor=k,this.baseShift=R;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let G=0;G<z;G++)this.data[this._idx(-1,G)]=this.data[this._idx(0,G)],this.data[this._idx(z,G)]=this.data[this._idx(z-1,G)],this.data[this._idx(G,-1)]=this.data[this._idx(G,0)],this.data[this._idx(G,z)]=this.data[this._idx(G,z-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(z,-1)]=this.data[this._idx(z-1,0)],this.data[this._idx(-1,z)]=this.data[this._idx(0,z-1)],this.data[this._idx(z,z)]=this.data[this._idx(z-1,z-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let G=0;G<z;G++)for(let W=0;W<z;W++){const j=this.get(G,W);j>this.max&&(this.max=j),j<this.min&&(this.min=j)}}get(h,v){const b=new Uint8Array(this.data.buffer),E=4*this._idx(h,v);return this.unpack(b[E],b[E+1],b[E+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(h,v){if(h<-1||h>=this.dim+1||v<-1||v>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(v+1)*this.stride+(h+1)}unpack(h,v,b){return h*this.redFactor+v*this.greenFactor+b*this.blueFactor-this.baseShift}getPixels(){return new Ya({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(h,v,b){if(this.dim!==h.dim)throw new Error("dem dimension mismatch");let E=v*this.dim,I=v*this.dim+this.dim,k=b*this.dim,R=b*this.dim+this.dim;switch(v){case-1:E=I-1;break;case 1:I=E+1}switch(b){case-1:k=R-1;break;case 1:R=k+1}const z=-v*this.dim,G=-b*this.dim;for(let W=k;W<R;W++)for(let j=E;j<I;j++)this.data[this._idx(j,W)]=h.data[this._idx(j+z,W+G)]}}Pt("DEMData",tG);class rG{constructor(h){this._stringToNumber={},this._numberToString=[];for(let v=0;v<h.length;v++){const b=h[v];this._stringToNumber[b]=v,this._numberToString[v]=b}}encode(h){return this._stringToNumber[h]}decode(h){if(h>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${h} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[h]}}class nG{constructor(h,v,b,E,I){this.type="Feature",this._vectorTileFeature=h,h._z=v,h._x=b,h._y=E,this.properties=h.properties,this.id=I}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(h){this._geometry=h}toJSON(){const h={geometry:this.geometry};for(const v in this)v!=="_geometry"&&v!=="_vectorTileFeature"&&(h[v]=this[v]);return h}}class iG{constructor(h,v){this.tileID=h,this.x=h.canonical.x,this.y=h.canonical.y,this.z=h.canonical.z,this.grid=new Cc(Fn,16,0),this.grid3D=new Cc(Fn,16,0),this.featureIndexArray=new ki,this.promoteId=v}insert(h,v,b,E,I,k){const R=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(b,E,I);const z=k?this.grid3D:this.grid;for(let G=0;G<v.length;G++){const W=v[G],j=[1/0,1/0,-1/0,-1/0];for(let ee=0;ee<W.length;ee++){const ne=W[ee];j[0]=Math.min(j[0],ne.x),j[1]=Math.min(j[1],ne.y),j[2]=Math.max(j[2],ne.x),j[3]=Math.max(j[3],ne.y)}j[0]<Fn&&j[1]<Fn&&j[2]>=0&&j[3]>=0&&z.insert(R,j[0],j[1],j[2],j[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new zc.VectorTile(new eD(this.rawTileData)).layers,this.sourceLayerCoder=new rG(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(h,v,b,E){this.loadVTLayers();const I=h.params||{},k=Fn/h.tileSize/h.scale,R=Lv(I.filter),z=h.queryGeometry,G=h.queryPadding*k,W=oG(z),j=this.grid.query(W.minX-G,W.minY-G,W.maxX+G,W.maxY+G),ee=oG(h.cameraQueryGeometry),ne=this.grid3D.query(ee.minX-G,ee.minY-G,ee.maxX+G,ee.maxY+G,(ye,we,Oe,Ae)=>function(Re,He,et,Ct,Yt){for(const _t of Re)if(He<=_t.x&&et<=_t.y&&Ct>=_t.x&&Yt>=_t.y)return!0;const xt=[new f(He,et),new f(He,Yt),new f(Ct,Yt),new f(Ct,et)];if(Re.length>2){for(const _t of xt)if(Gf(Re,_t))return!0}for(let _t=0;_t<Re.length-1;_t++)if(tye(Re[_t],Re[_t+1],xt))return!0;return!1}(h.cameraQueryGeometry,ye-G,we-G,Oe+G,Ae+G));for(const ye of ne)j.push(ye);j.sort(w_e);const se={};let ce;for(let ye=0;ye<j.length;ye++){const we=j[ye];if(we===ce)continue;ce=we;const Oe=this.featureIndexArray.get(we);let Ae=null;this.loadMatchingFeature(se,Oe.bucketIndex,Oe.sourceLayerIndex,Oe.featureIndex,R,I.layers,I.availableImages,v,b,E,(Re,He,et)=>(Ae||(Ae=Ph(Re)),He.queryIntersectsFeature(z,Re,et,Ae,this.z,h.transform,k,h.pixelPosMatrix)))}return se}loadMatchingFeature(h,v,b,E,I,k,R,z,G,W,j){const ee=this.bucketLayerIDs[v];if(k&&!function(ye,we){for(let Oe=0;Oe<ye.length;Oe++)if(we.indexOf(ye[Oe])>=0)return!0;return!1}(k,ee))return;const ne=this.sourceLayerCoder.decode(b),se=this.vtLayers[ne].feature(E);if(I.needGeometry){const ye=Rh(se,!0);if(!I.filter(new dn(this.tileID.overscaledZ),ye,this.tileID.canonical))return}else if(!I.filter(new dn(this.tileID.overscaledZ),se))return;const ce=this.getId(se,ne);for(let ye=0;ye<ee.length;ye++){const we=ee[ye];if(k&&k.indexOf(we)<0)continue;const Oe=z[we];if(!Oe)continue;let Ae={};ce&&W&&(Ae=W.getState(Oe.sourceLayer||"_geojsonTileLayer",ce));const Re=U({},G[we]);Re.paint=aG(Re.paint,Oe.paint,se,Ae,R),Re.layout=aG(Re.layout,Oe.layout,se,Ae,R);const He=!j||j(se,Oe,Ae);if(!He)continue;const et=new nG(se,this.z,this.x,this.y,ce);et.layer=Re;let Ct=h[we];Ct===void 0&&(Ct=h[we]=[]),Ct.push({featureIndex:E,feature:et,intersectionZ:He})}}lookupSymbolFeatures(h,v,b,E,I,k,R,z){const G={};this.loadVTLayers();const W=Lv(I);for(const j of h)this.loadMatchingFeature(G,b,E,j,W,k,R,z,v);return G}hasLayer(h){for(const v of this.bucketLayerIDs)for(const b of v)if(h===b)return!0;return!1}getId(h,v){let b=h.id;return this.promoteId&&(b=h.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[v]],typeof b=="boolean"&&(b=Number(b))),b}}function aG(p,h,v,b,E){return Z(p,(I,k)=>{const R=h instanceof Mh?h.get(k):null;return R&&R.evaluate?R.evaluate(v,b,E):R})}function oG(p){let h=1/0,v=1/0,b=-1/0,E=-1/0;for(const I of p)h=Math.min(h,I.x),v=Math.min(v,I.y),b=Math.max(b,I.x),E=Math.max(E,I.y);return{minX:h,minY:v,maxX:b,maxY:E}}function w_e(p,h){return h-p}function sG(p,h,v,b,E){const I=[];for(let k=0;k<p.length;k++){const R=p[k];let z;for(let G=0;G<R.length-1;G++){let W=R[G],j=R[G+1];W.x<h&&j.x<h||(W.x<h?W=new f(h,W.y+(h-W.x)/(j.x-W.x)*(j.y-W.y))._round():j.x<h&&(j=new f(h,W.y+(h-W.x)/(j.x-W.x)*(j.y-W.y))._round()),W.y<v&&j.y<v||(W.y<v?W=new f(W.x+(v-W.y)/(j.y-W.y)*(j.x-W.x),v)._round():j.y<v&&(j=new f(W.x+(v-W.y)/(j.y-W.y)*(j.x-W.x),v)._round()),W.x>=b&&j.x>=b||(W.x>=b?W=new f(b,W.y+(b-W.x)/(j.x-W.x)*(j.y-W.y))._round():j.x>=b&&(j=new f(b,W.y+(b-W.x)/(j.x-W.x)*(j.y-W.y))._round()),W.y>=E&&j.y>=E||(W.y>=E?W=new f(W.x+(E-W.y)/(j.y-W.y)*(j.x-W.x),E)._round():j.y>=E&&(j=new f(W.x+(E-W.y)/(j.y-W.y)*(j.x-W.x),E)._round()),z&&W.equals(z[z.length-1])||(z=[W],I.push(z)),z.push(j)))))}}return I}Pt("FeatureIndex",iG,{omit:["rawTileData","sourceLayerCoder"]});class $c extends f{constructor(h,v,b,E){super(h,v),this.angle=b,E!==void 0&&(this.segment=E)}clone(){return new $c(this.x,this.y,this.angle,this.segment)}}function lG(p,h,v,b,E){if(h.segment===void 0||v===0)return!0;let I=h,k=h.segment+1,R=0;for(;R>-v/2;){if(k--,k<0)return!1;R-=p[k].dist(I),I=p[k]}R+=p[k].dist(p[k+1]),k++;const z=[];let G=0;for(;R<v/2;){const W=p[k],j=p[k+1];if(!j)return!1;let ee=p[k-1].angleTo(W)-W.angleTo(j);for(ee=Math.abs((ee+3*Math.PI)%(2*Math.PI)-Math.PI),z.push({distance:R,angleDelta:ee}),G+=ee;R-z[0].distance>b;)G-=z.shift().angleDelta;if(G>E)return!1;k++,R+=W.dist(j)}return!0}function cG(p){let h=0;for(let v=0;v<p.length-1;v++)h+=p[v].dist(p[v+1]);return h}function uG(p,h,v){return p?.6*h*v:0}function hG(p,h){return Math.max(p?p.right-p.left:0,h?h.right-h.left:0)}function S_e(p,h,v,b,E,I){const k=uG(v,E,I),R=hG(v,b)*I;let z=0;const G=cG(p)/2;for(let W=0;W<p.length-1;W++){const j=p[W],ee=p[W+1],ne=j.dist(ee);if(z+ne>G){const se=(G-z)/ne,ce=$i.number(j.x,ee.x,se),ye=$i.number(j.y,ee.y,se),we=new $c(ce,ye,ee.angleTo(j),W);return we._round(),!k||lG(p,we,R,k,h)?we:void 0}z+=ne}}function T_e(p,h,v,b,E,I,k,R,z){const G=uG(b,I,k),W=hG(b,E),j=W*k,ee=p[0].x===0||p[0].x===z||p[0].y===0||p[0].y===z;return h-j<h/4&&(h=j+h/4),dG(p,ee?h/2*R%h:(W/2+2*I)*k*R%h,h,G,v,j,ee,!1,z)}function dG(p,h,v,b,E,I,k,R,z){const G=I/2,W=cG(p);let j=0,ee=h-v,ne=[];for(let se=0;se<p.length-1;se++){const ce=p[se],ye=p[se+1],we=ce.dist(ye),Oe=ye.angleTo(ce);for(;ee+v<j+we;){ee+=v;const Ae=(ee-j)/we,Re=$i.number(ce.x,ye.x,Ae),He=$i.number(ce.y,ye.y,Ae);if(Re>=0&&Re<z&&He>=0&&He<z&&ee-G>=0&&ee+G<=W){const et=new $c(Re,He,Oe,se);et._round(),b&&!lG(p,et,I,b,E)||ne.push(et)}}j+=we}return R||ne.length||k||(ne=dG(p,j/2,v,b,E,I,k,!0,z)),ne}Pt("Anchor",$c);const Yf=ga;function fG(p,h,v,b){const E=[],I=p.image,k=I.pixelRatio,R=I.paddedRect.w-2*Yf,z=I.paddedRect.h-2*Yf;let G={x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};const W=I.stretchX||[[0,R]],j=I.stretchY||[[0,z]],ee=(Ye,Ut)=>Ye+Ut[1]-Ut[0],ne=W.reduce(ee,0),se=j.reduce(ee,0),ce=R-ne,ye=z-se;let we=0,Oe=ne,Ae=0,Re=se,He=0,et=ce,Ct=0,Yt=ye;if(I.content&&b){const Ye=I.content,Ut=Ye[2]-Ye[0],Ft=Ye[3]-Ye[1];(I.textFitWidth||I.textFitHeight)&&(G=F6(p)),we=Qb(W,0,Ye[0]),Ae=Qb(j,0,Ye[1]),Oe=Qb(W,Ye[0],Ye[2]),Re=Qb(j,Ye[1],Ye[3]),He=Ye[0]-we,Ct=Ye[1]-Ae,et=Ut-Oe,Yt=Ft-Re}const xt=G.x1,_t=G.y1,Gt=G.x2-xt,Rt=G.y2-_t,It=(Ye,Ut,Ft,nr)=>{const rn=ex(Ye.stretch-we,Oe,Gt,xt),en=tx(Ye.fixed-He,et,Ye.stretch,ne),Kn=ex(Ut.stretch-Ae,Re,Rt,_t),Lo=tx(Ut.fixed-Ct,Yt,Ut.stretch,se),bi=ex(Ft.stretch-we,Oe,Gt,xt),Jn=tx(Ft.fixed-He,et,Ft.stretch,ne),Wi=ex(nr.stretch-Ae,Re,Rt,_t),qi=tx(nr.fixed-Ct,Yt,nr.stretch,se),Zi=new f(rn,Kn),Mn=new f(bi,Kn),Qn=new f(bi,Wi),Pi=new f(rn,Wi),xi=new f(en/k,Lo/k),ji=new f(Jn/k,qi/k),wi=h*Math.PI/180;if(wi){const $r=Math.sin(wi),cn=Math.cos(wi),vn=[cn,-$r,$r,cn];Zi._matMult(vn),Mn._matMult(vn),Pi._matMult(vn),Qn._matMult(vn)}const Ja=Ye.stretch+Ye.fixed,va=Ut.stretch+Ut.fixed;return{tl:Zi,tr:Mn,bl:Pi,br:Qn,tex:{x:I.paddedRect.x+Yf+Ja,y:I.paddedRect.y+Yf+va,w:Ft.stretch+Ft.fixed-Ja,h:nr.stretch+nr.fixed-va},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xi,pixelOffsetBR:ji,minFontScaleX:et/k/Gt,minFontScaleY:Yt/k/Rt,isSDF:v}};if(b&&(I.stretchX||I.stretchY)){const Ye=pG(W,ce,ne),Ut=pG(j,ye,se);for(let Ft=0;Ft<Ye.length-1;Ft++){const nr=Ye[Ft],rn=Ye[Ft+1];for(let en=0;en<Ut.length-1;en++)E.push(It(nr,Ut[en],rn,Ut[en+1]))}}else E.push(It({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:R+1},{fixed:0,stretch:z+1}));return E}function Qb(p,h,v){let b=0;for(const E of p)b+=Math.max(h,Math.min(v,E[1]))-Math.max(h,Math.min(v,E[0]));return b}function pG(p,h,v){const b=[{fixed:-Yf,stretch:0}];for(const[E,I]of p){const k=b[b.length-1];b.push({fixed:E-k.stretch,stretch:k.stretch}),b.push({fixed:E-k.stretch,stretch:k.stretch+(I-E)})}return b.push({fixed:h+Yf,stretch:v}),b}function ex(p,h,v,b){return p/h*v+b}function tx(p,h,v,b){return p-h*v/b}class rx{constructor(h,v,b,E,I,k,R,z,G,W){var j;if(this.boxStartIndex=h.length,G){let ee=k.top,ne=k.bottom;const se=k.collisionPadding;se&&(ee-=se[1],ne+=se[3]);let ce=ne-ee;ce>0&&(ce=Math.max(10,ce),this.circleDiameter=ce)}else{const ee=!((j=k.image)===null||j===void 0)&&j.content&&(k.image.textFitWidth||k.image.textFitHeight)?F6(k):{x1:k.left,y1:k.top,x2:k.right,y2:k.bottom};ee.y1=ee.y1*R-z[0],ee.y2=ee.y2*R+z[2],ee.x1=ee.x1*R-z[3],ee.x2=ee.x2*R+z[1];const ne=k.collisionPadding;if(ne&&(ee.x1-=ne[0]*R,ee.y1-=ne[1]*R,ee.x2+=ne[2]*R,ee.y2+=ne[3]*R),W){const se=new f(ee.x1,ee.y1),ce=new f(ee.x2,ee.y1),ye=new f(ee.x1,ee.y2),we=new f(ee.x2,ee.y2),Oe=W*Math.PI/180;se._rotate(Oe),ce._rotate(Oe),ye._rotate(Oe),we._rotate(Oe),ee.x1=Math.min(se.x,ce.x,ye.x,we.x),ee.x2=Math.max(se.x,ce.x,ye.x,we.x),ee.y1=Math.min(se.y,ce.y,ye.y,we.y),ee.y2=Math.max(se.y,ce.y,ye.y,we.y)}h.emplaceBack(v.x,v.y,ee.x1,ee.y1,ee.x2,ee.y2,b,E,I)}this.boxEndIndex=h.length}}class E_e{constructor(h=[],v=(b,E)=>b<E?-1:b>E?1:0){if(this.data=h,this.length=this.data.length,this.compare=v,this.length>0)for(let b=(this.length>>1)-1;b>=0;b--)this._down(b)}push(h){this.data.push(h),this._up(this.length++)}pop(){if(this.length===0)return;const h=this.data[0],v=this.data.pop();return--this.length>0&&(this.data[0]=v,this._down(0)),h}peek(){return this.data[0]}_up(h){const{data:v,compare:b}=this,E=v[h];for(;h>0;){const I=h-1>>1,k=v[I];if(b(E,k)>=0)break;v[h]=k,h=I}v[h]=E}_down(h){const{data:v,compare:b}=this,E=this.length>>1,I=v[h];for(;h<E;){let k=1+(h<<1);const R=k+1;if(R<this.length&&b(v[R],v[k])<0&&(k=R),b(v[k],I)>=0)break;v[h]=v[k],h=k}v[h]=I}}function C_e(p,h=1,v=!1){let b=1/0,E=1/0,I=-1/0,k=-1/0;const R=p[0];for(let ne=0;ne<R.length;ne++){const se=R[ne];(!ne||se.x<b)&&(b=se.x),(!ne||se.y<E)&&(E=se.y),(!ne||se.x>I)&&(I=se.x),(!ne||se.y>k)&&(k=se.y)}const z=Math.min(I-b,k-E);let G=z/2;const W=new E_e([],A_e);if(z===0)return new f(b,E);for(let ne=b;ne<I;ne+=z)for(let se=E;se<k;se+=z)W.push(new Kf(ne+G,se+G,G,p));let j=function(ne){let se=0,ce=0,ye=0;const we=ne[0];for(let Oe=0,Ae=we.length,Re=Ae-1;Oe<Ae;Re=Oe++){const He=we[Oe],et=we[Re],Ct=He.x*et.y-et.x*He.y;ce+=(He.x+et.x)*Ct,ye+=(He.y+et.y)*Ct,se+=3*Ct}return new Kf(ce/se,ye/se,0,ne)}(p),ee=W.length;for(;W.length;){const ne=W.pop();(ne.d>j.d||!j.d)&&(j=ne,v&&console.log("found best %d after %d probes",Math.round(1e4*ne.d)/1e4,ee)),ne.max-j.d<=h||(G=ne.h/2,W.push(new Kf(ne.p.x-G,ne.p.y-G,G,p)),W.push(new Kf(ne.p.x+G,ne.p.y-G,G,p)),W.push(new Kf(ne.p.x-G,ne.p.y+G,G,p)),W.push(new Kf(ne.p.x+G,ne.p.y+G,G,p)),ee+=4)}return v&&(console.log(`num probes: ${ee}`),console.log(`best distance: ${j.d}`)),j.p}function A_e(p,h){return h.max-p.max}function Kf(p,h,v,b){this.p=new f(p,h),this.h=v,this.d=function(E,I){let k=!1,R=1/0;for(let z=0;z<I.length;z++){const G=I[z];for(let W=0,j=G.length,ee=j-1;W<j;ee=W++){const ne=G[W],se=G[ee];ne.y>E.y!=se.y>E.y&&E.x<(se.x-ne.x)*(E.y-ne.y)/(se.y-ne.y)+ne.x&&(k=!k),R=Math.min(R,K$(E,ne,se))}}return(k?1:-1)*Math.sqrt(R)}(this.p,b),this.max=this.d+this.h*Math.SQRT2}var _i;o.aq=void 0,(_i=o.aq||(o.aq={}))[_i.center=1]="center",_i[_i.left=2]="left",_i[_i.right=3]="right",_i[_i.top=4]="top",_i[_i.bottom=5]="bottom",_i[_i["top-left"]=6]="top-left",_i[_i["top-right"]=7]="top-right",_i[_i["bottom-left"]=8]="bottom-left",_i[_i["bottom-right"]=9]="bottom-right";const Gc=7,fD=Number.POSITIVE_INFINITY;function gG(p,h){return h[1]!==fD?function(v,b,E){let I=0,k=0;switch(b=Math.abs(b),E=Math.abs(E),v){case"top-right":case"top-left":case"top":k=E-Gc;break;case"bottom-right":case"bottom-left":case"bottom":k=-E+Gc}switch(v){case"top-right":case"bottom-right":case"right":I=-b;break;case"top-left":case"bottom-left":case"left":I=b}return[I,k]}(p,h[0],h[1]):function(v,b){let E=0,I=0;b<0&&(b=0);const k=b/Math.SQRT2;switch(v){case"top-right":case"top-left":I=k-Gc;break;case"bottom-right":case"bottom-left":I=-k+Gc;break;case"bottom":I=-b+Gc;break;case"top":I=b-Gc}switch(v){case"top-right":case"bottom-right":E=-k;break;case"top-left":case"bottom-left":E=k;break;case"left":E=b;break;case"right":E=-b}return[E,I]}(p,h[0])}function vG(p,h,v){var b;const E=p.layout,I=(b=E.get("text-variable-anchor-offset"))===null||b===void 0?void 0:b.evaluate(h,{},v);if(I){const R=I.values,z=[];for(let G=0;G<R.length;G+=2){const W=z[G]=R[G],j=R[G+1].map(ee=>ee*Zn);W.startsWith("top")?j[1]-=Gc:W.startsWith("bottom")&&(j[1]+=Gc),z[G+1]=j}return new Ca(z)}const k=E.get("text-variable-anchor");if(k){let R;R=p._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[E.get("text-radial-offset").evaluate(h,{},v)*Zn,fD]:E.get("text-offset").evaluate(h,{},v).map(G=>G*Zn);const z=[];for(const G of k)z.push(G,gG(G,R));return new Ca(z)}return null}function pD(p){switch(p){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function D_e(p,h,v,b,E,I,k,R,z,G,W){let j=I.textMaxSize.evaluate(h,{});j===void 0&&(j=k);const ee=p.layers[0].layout,ne=ee.get("icon-offset").evaluate(h,{},W),se=yG(v.horizontal),ce=k/24,ye=p.tilePixelRatio*ce,we=p.tilePixelRatio*j/24,Oe=p.tilePixelRatio*R,Ae=p.tilePixelRatio*ee.get("symbol-spacing"),Re=ee.get("text-padding")*p.tilePixelRatio,He=function(Ye,Ut,Ft,nr=1){const rn=Ye.get("icon-padding").evaluate(Ut,{},Ft),en=rn&&rn.values;return[en[0]*nr,en[1]*nr,en[2]*nr,en[3]*nr]}(ee,h,W,p.tilePixelRatio),et=ee.get("text-max-angle")/180*Math.PI,Ct=ee.get("text-rotation-alignment")!=="viewport"&&ee.get("symbol-placement")!=="point",Yt=ee.get("icon-rotation-alignment")==="map"&&ee.get("symbol-placement")!=="point",xt=ee.get("symbol-placement"),_t=Ae/2,Gt=ee.get("icon-text-fit");let Rt;b&&Gt!=="none"&&(p.allowVerticalPlacement&&v.vertical&&(Rt=$6(b,v.vertical,Gt,ee.get("icon-text-fit-padding"),ne,ce)),se&&(b=$6(b,se,Gt,ee.get("icon-text-fit-padding"),ne,ce)));const It=(Ye,Ut)=>{Ut.x<0||Ut.x>=Fn||Ut.y<0||Ut.y>=Fn||function(Ft,nr,rn,en,Kn,Lo,bi,Jn,Wi,qi,Zi,Mn,Qn,Pi,xi,ji,wi,Ja,va,$r,cn,vn,Pa,Tn,Jf){const Ls=Ft.addToLineVertexArray(nr,rn);let Ps,Po,Qa,ui,xl=0,vm=0,wG=0,SG=0,wD=-1,SD=-1;const wl={};let TG=Bf("");if(Ft.allowVerticalPlacement&&en.vertical){const Ri=Jn.layout.get("text-rotate").evaluate(cn,{},Tn)+90;Qa=new rx(Wi,nr,qi,Zi,Mn,en.vertical,Qn,Pi,xi,Ri),bi&&(ui=new rx(Wi,nr,qi,Zi,Mn,bi,wi,Ja,xi,Ri))}if(Kn){const Ri=Jn.layout.get("icon-rotate").evaluate(cn,{}),eo=Jn.layout.get("icon-text-fit")!=="none",Oh=fG(Kn,Ri,Pa,eo),ts=bi?fG(bi,Ri,Pa,eo):void 0;Po=new rx(Wi,nr,qi,Zi,Mn,Kn,wi,Ja,!1,Ri),xl=4*Oh.length;const zh=Ft.iconSizeData;let Rs=null;zh.kind==="source"?(Rs=[ks*Jn.layout.get("icon-size").evaluate(cn,{})],Rs[0]>Vc&&oe(`${Ft.layerIds[0]}: Value for "icon-size" is >= ${hm}. Reduce your "icon-size".`)):zh.kind==="composite"&&(Rs=[ks*vn.compositeIconSizes[0].evaluate(cn,{},Tn),ks*vn.compositeIconSizes[1].evaluate(cn,{},Tn)],(Rs[0]>Vc||Rs[1]>Vc)&&oe(`${Ft.layerIds[0]}: Value for "icon-size" is >= ${hm}. Reduce your "icon-size".`)),Ft.addSymbols(Ft.icon,Oh,Rs,$r,va,cn,o.ah.none,nr,Ls.lineStartIndex,Ls.lineLength,-1,Tn),wD=Ft.icon.placedSymbolArray.length-1,ts&&(vm=4*ts.length,Ft.addSymbols(Ft.icon,ts,Rs,$r,va,cn,o.ah.vertical,nr,Ls.lineStartIndex,Ls.lineLength,-1,Tn),SD=Ft.icon.placedSymbolArray.length-1)}const EG=Object.keys(en.horizontal);for(const Ri of EG){const eo=en.horizontal[Ri];if(!Ps){TG=Bf(eo.text);const ts=Jn.layout.get("text-rotate").evaluate(cn,{},Tn);Ps=new rx(Wi,nr,qi,Zi,Mn,eo,Qn,Pi,xi,ts)}const Oh=eo.positionedLines.length===1;if(wG+=mG(Ft,nr,eo,Lo,Jn,xi,cn,ji,Ls,en.vertical?o.ah.horizontal:o.ah.horizontalOnly,Oh?EG:[Ri],wl,wD,vn,Tn),Oh)break}en.vertical&&(SG+=mG(Ft,nr,en.vertical,Lo,Jn,xi,cn,ji,Ls,o.ah.vertical,["vertical"],wl,SD,vn,Tn));const k_e=Ps?Ps.boxStartIndex:Ft.collisionBoxArray.length,L_e=Ps?Ps.boxEndIndex:Ft.collisionBoxArray.length,P_e=Qa?Qa.boxStartIndex:Ft.collisionBoxArray.length,R_e=Qa?Qa.boxEndIndex:Ft.collisionBoxArray.length,N_e=Po?Po.boxStartIndex:Ft.collisionBoxArray.length,O_e=Po?Po.boxEndIndex:Ft.collisionBoxArray.length,z_e=ui?ui.boxStartIndex:Ft.collisionBoxArray.length,B_e=ui?ui.boxEndIndex:Ft.collisionBoxArray.length;let es=-1;const ix=(Ri,eo)=>Ri&&Ri.circleDiameter?Math.max(Ri.circleDiameter,eo):eo;es=ix(Ps,es),es=ix(Qa,es),es=ix(Po,es),es=ix(ui,es);const CG=es>-1?1:0;CG&&(es*=Jf/Zn),Ft.glyphOffsetArray.length>=Xf.MAX_GLYPHS&&oe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),cn.sortKey!==void 0&&Ft.addToSortKeyRanges(Ft.symbolInstances.length,cn.sortKey);const V_e=vG(Jn,cn,Tn),[F_e,$_e]=function(Ri,eo){const Oh=Ri.length,ts=eo==null?void 0:eo.values;if((ts==null?void 0:ts.length)>0)for(let zh=0;zh<ts.length;zh+=2){const Rs=ts[zh+1];Ri.emplaceBack(o.aq[ts[zh]],Rs[0],Rs[1])}return[Oh,Ri.length]}(Ft.textAnchorOffsets,V_e);Ft.symbolInstances.emplaceBack(nr.x,nr.y,wl.right>=0?wl.right:-1,wl.center>=0?wl.center:-1,wl.left>=0?wl.left:-1,wl.vertical||-1,wD,SD,TG,k_e,L_e,P_e,R_e,N_e,O_e,z_e,B_e,qi,wG,SG,xl,vm,CG,0,Qn,es,F_e,$_e)}(p,Ut,Ye,v,b,E,Rt,p.layers[0],p.collisionBoxArray,h.index,h.sourceLayerIndex,p.index,ye,[Re,Re,Re,Re],Ct,z,Oe,He,Yt,ne,h,I,G,W,k)};if(xt==="line")for(const Ye of sG(h.geometry,0,0,Fn,Fn)){const Ut=T_e(Ye,Ae,et,v.vertical||se,b,24,we,p.overscaling,Fn);for(const Ft of Ut)se&&M_e(p,se.text,_t,Ft)||It(Ye,Ft)}else if(xt==="line-center"){for(const Ye of h.geometry)if(Ye.length>1){const Ut=S_e(Ye,et,v.vertical||se,b,24,we);Ut&&It(Ye,Ut)}}else if(h.type==="Polygon")for(const Ye of pf(h.geometry,0)){const Ut=C_e(Ye,16);It(Ye[0],new $c(Ut.x,Ut.y,0))}else if(h.type==="LineString")for(const Ye of h.geometry)It(Ye,new $c(Ye[0].x,Ye[0].y,0));else if(h.type==="Point")for(const Ye of h.geometry)for(const Ut of Ye)It([Ut],new $c(Ut.x,Ut.y,0))}function mG(p,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se){const ce=function(Oe,Ae,Re,He,et,Ct,Yt,xt){const _t=He.layout.get("text-rotate").evaluate(Ct,{})*Math.PI/180,Gt=[];for(const Rt of Ae.positionedLines)for(const It of Rt.positionedGlyphs){if(!It.rect)continue;const Ye=It.rect||{};let Ut=P6+1,Ft=!0,nr=1,rn=0;const en=(et||xt)&&It.vertical,Kn=It.metrics.advance*It.scale/2;if(xt&&Ae.verticalizable&&(rn=Rt.lineOffset/2-(It.imageName?-(Zn-It.metrics.width*It.scale)/2:(It.scale-1)*Zn)),It.imageName){const $r=Yt[It.imageName];Ft=$r.sdf,nr=$r.pixelRatio,Ut=ga/nr}const Lo=et?[It.x+Kn,It.y]:[0,0];let bi=et?[0,0]:[It.x+Kn+Re[0],It.y+Re[1]-rn],Jn=[0,0];en&&(Jn=bi,bi=[0,0]);const Wi=It.metrics.isDoubleResolution?2:1,qi=(It.metrics.left-Ut)*It.scale-Kn+bi[0],Zi=(-It.metrics.top-Ut)*It.scale+bi[1],Mn=qi+Ye.w/Wi*It.scale/nr,Qn=Zi+Ye.h/Wi*It.scale/nr,Pi=new f(qi,Zi),xi=new f(Mn,Zi),ji=new f(qi,Qn),wi=new f(Mn,Qn);if(en){const $r=new f(-Kn,Kn-cm),cn=-Math.PI/2,vn=Zn/2-Kn,Pa=new f(5-cm-vn,-(It.imageName?vn:0)),Tn=new f(...Jn);Pi._rotateAround(cn,$r)._add(Pa)._add(Tn),xi._rotateAround(cn,$r)._add(Pa)._add(Tn),ji._rotateAround(cn,$r)._add(Pa)._add(Tn),wi._rotateAround(cn,$r)._add(Pa)._add(Tn)}if(_t){const $r=Math.sin(_t),cn=Math.cos(_t),vn=[cn,-$r,$r,cn];Pi._matMult(vn),xi._matMult(vn),ji._matMult(vn),wi._matMult(vn)}const Ja=new f(0,0),va=new f(0,0);Gt.push({tl:Pi,tr:xi,bl:ji,br:wi,tex:Ye,writingMode:Ae.writingMode,glyphOffset:Lo,sectionIndex:It.sectionIndex,isSDF:Ft,pixelOffsetTL:Ja,pixelOffsetBR:va,minFontScaleX:0,minFontScaleY:0})}return Gt}(0,v,R,E,I,k,b,p.allowVerticalPlacement),ye=p.textSizeData;let we=null;ye.kind==="source"?(we=[ks*E.layout.get("text-size").evaluate(k,{})],we[0]>Vc&&oe(`${p.layerIds[0]}: Value for "text-size" is >= ${hm}. Reduce your "text-size".`)):ye.kind==="composite"&&(we=[ks*ne.compositeTextSizes[0].evaluate(k,{},se),ks*ne.compositeTextSizes[1].evaluate(k,{},se)],(we[0]>Vc||we[1]>Vc)&&oe(`${p.layerIds[0]}: Value for "text-size" is >= ${hm}. Reduce your "text-size".`)),p.addSymbols(p.text,ce,we,R,I,k,G,h,z.lineStartIndex,z.lineLength,ee,se);for(const Oe of W)j[Oe]=p.text.placedSymbolArray.length-1;return 4*ce.length}function yG(p){for(const h in p)return p[h];return null}function M_e(p,h,v,b){const E=p.compareText;if(h in E){const I=E[h];for(let k=I.length-1;k>=0;k--)if(b.dist(I[k])<v)return!0}else E[h]=[];return E[h].push(b),!1}const _G=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class gD{static from(h){if(!(h instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[v,b]=new Uint8Array(h,0,2);if(v!==219)throw new Error("Data does not appear to be in a KDBush format.");const E=b>>4;if(E!==1)throw new Error(`Got v${E} data when expected v1.`);const I=_G[15&b];if(!I)throw new Error("Unrecognized array type.");const[k]=new Uint16Array(h,2,1),[R]=new Uint32Array(h,4,1);return new gD(R,k,I,h)}constructor(h,v=64,b=Float64Array,E){if(isNaN(h)||h<0)throw new Error(`Unpexpected numItems value: ${h}.`);this.numItems=+h,this.nodeSize=Math.min(Math.max(+v,2),65535),this.ArrayType=b,this.IndexArrayType=h<65536?Uint16Array:Uint32Array;const I=_G.indexOf(this.ArrayType),k=2*h*this.ArrayType.BYTES_PER_ELEMENT,R=h*this.IndexArrayType.BYTES_PER_ELEMENT,z=(8-R%8)%8;if(I<0)throw new Error(`Unexpected typed array class: ${b}.`);E&&E instanceof ArrayBuffer?(this.data=E,this.ids=new this.IndexArrayType(this.data,8,h),this.coords=new this.ArrayType(this.data,8+R+z,2*h),this._pos=2*h,this._finished=!0):(this.data=new ArrayBuffer(8+k+R+z),this.ids=new this.IndexArrayType(this.data,8,h),this.coords=new this.ArrayType(this.data,8+R+z,2*h),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+I]),new Uint16Array(this.data,2,1)[0]=v,new Uint32Array(this.data,4,1)[0]=h)}add(h,v){const b=this._pos>>1;return this.ids[b]=b,this.coords[this._pos++]=h,this.coords[this._pos++]=v,b}finish(){const h=this._pos>>1;if(h!==this.numItems)throw new Error(`Added ${h} items when expected ${this.numItems}.`);return vD(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(h,v,b,E){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:I,coords:k,nodeSize:R}=this,z=[0,I.length-1,0],G=[];for(;z.length;){const W=z.pop()||0,j=z.pop()||0,ee=z.pop()||0;if(j-ee<=R){for(let ye=ee;ye<=j;ye++){const we=k[2*ye],Oe=k[2*ye+1];we>=h&&we<=b&&Oe>=v&&Oe<=E&&G.push(I[ye])}continue}const ne=ee+j>>1,se=k[2*ne],ce=k[2*ne+1];se>=h&&se<=b&&ce>=v&&ce<=E&&G.push(I[ne]),(W===0?h<=se:v<=ce)&&(z.push(ee),z.push(ne-1),z.push(1-W)),(W===0?b>=se:E>=ce)&&(z.push(ne+1),z.push(j),z.push(1-W))}return G}within(h,v,b){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:E,coords:I,nodeSize:k}=this,R=[0,E.length-1,0],z=[],G=b*b;for(;R.length;){const W=R.pop()||0,j=R.pop()||0,ee=R.pop()||0;if(j-ee<=k){for(let ye=ee;ye<=j;ye++)xG(I[2*ye],I[2*ye+1],h,v)<=G&&z.push(E[ye]);continue}const ne=ee+j>>1,se=I[2*ne],ce=I[2*ne+1];xG(se,ce,h,v)<=G&&z.push(E[ne]),(W===0?h-b<=se:v-b<=ce)&&(R.push(ee),R.push(ne-1),R.push(1-W)),(W===0?h+b>=se:v+b>=ce)&&(R.push(ne+1),R.push(j),R.push(1-W))}return z}}function vD(p,h,v,b,E,I){if(E-b<=v)return;const k=b+E>>1;bG(p,h,k,b,E,I),vD(p,h,v,b,k-1,1-I),vD(p,h,v,k+1,E,1-I)}function bG(p,h,v,b,E,I){for(;E>b;){if(E-b>600){const G=E-b+1,W=v-b+1,j=Math.log(G),ee=.5*Math.exp(2*j/3),ne=.5*Math.sqrt(j*ee*(G-ee)/G)*(W-G/2<0?-1:1);bG(p,h,v,Math.max(b,Math.floor(v-W*ee/G+ne)),Math.min(E,Math.floor(v+(G-W)*ee/G+ne)),I)}const k=h[2*v+I];let R=b,z=E;for(pm(p,h,b,v),h[2*E+I]>k&&pm(p,h,b,E);R<z;){for(pm(p,h,R,z),R++,z--;h[2*R+I]<k;)R++;for(;h[2*z+I]>k;)z--}h[2*b+I]===k?pm(p,h,b,z):(z++,pm(p,h,z,E)),z<=v&&(b=z+1),v<=z&&(E=z-1)}}function pm(p,h,v,b){mD(p,v,b),mD(h,2*v,2*b),mD(h,2*v+1,2*b+1)}function mD(p,h,v){const b=p[h];p[h]=p[v],p[v]=b}function xG(p,h,v,b){const E=p-v,I=h-b;return E*E+I*I}var yD;o.bg=void 0,(yD=o.bg||(o.bg={})).create="create",yD.load="load",yD.fullLoad="fullLoad";let nx=null,gm=[];const _D=1e3/60,bD="loadTime",xD="fullLoadTime",I_e={mark(p){performance.mark(p)},frame(p){const h=p;nx!=null&&gm.push(h-nx),nx=h},clearMetrics(){nx=null,gm=[],performance.clearMeasures(bD),performance.clearMeasures(xD);for(const p in o.bg)performance.clearMarks(o.bg[p])},getPerformanceMetrics(){performance.measure(bD,o.bg.create,o.bg.load),performance.measure(xD,o.bg.create,o.bg.fullLoad);const p=performance.getEntriesByName(bD)[0].duration,h=performance.getEntriesByName(xD)[0].duration,v=gm.length,b=1/(gm.reduce((I,k)=>I+k,0)/v/1e3),E=gm.filter(I=>I>_D).reduce((I,k)=>I+(k-_D)/_D,0);return{loadTime:p,fullLoadTime:h,fps:b,percentDroppedFrames:E/(v+E)*100,totalFrames:v}}};o.$=class extends K{},o.A=Uf,o.B=MA,o.C=function(p){if(ge==null){const h=p.navigator?p.navigator.userAgent:null;ge=!!p.safari||!(!h||!(/\b(iPad|iPhone|iPod)\b/.test(h)||h.match("Safari")&&!h.match("Chrome")))}return ge},o.D=Ot,o.E=_r,o.F=class{constructor(p,h){this.target=p,this.mapId=h,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new x_e(()=>this.process()),this.subscription=function(v,b,E,I){return v.addEventListener(b,E,!1),{unsubscribe:()=>{v.removeEventListener(b,E,!1)}}}(this.target,"message",v=>this.receive(v)),this.globalScope=de(self)?p:window}registerMessageHandler(p,h){this.messageHandlers[p]=h}sendAsync(p,h){return new Promise((v,b)=>{const E=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[E]={resolve:v,reject:b},h&&h.signal.addEventListener("abort",()=>{delete this.resolveRejects[E];const R={id:E,type:"<cancel>",origin:location.origin,targetMapId:p.targetMapId,sourceMapId:this.mapId};this.target.postMessage(R)},{once:!0});const I=[],k=Object.assign(Object.assign({},p),{id:E,sourceMapId:this.mapId,origin:location.origin,data:Ac(p.data,I)});this.target.postMessage(k,{transfer:I})})}receive(p){const h=p.data,v=h.id;if(!(h.origin!=="file://"&&location.origin!=="file://"&&h.origin!=="resource://android"&&location.origin!=="resource://android"&&h.origin!==location.origin||h.targetMapId&&this.mapId!==h.targetMapId)){if(h.type==="<cancel>"){delete this.tasks[v];const b=this.abortControllers[v];return delete this.abortControllers[v],void(b&&b.abort())}if(de(self)||h.mustQueue)return this.tasks[v]=h,this.taskQueue.push(v),void this.invoker.trigger();this.processTask(v,h)}}process(){if(this.taskQueue.length===0)return;const p=this.taskQueue.shift(),h=this.tasks[p];delete this.tasks[p],this.taskQueue.length>0&&this.invoker.trigger(),h&&this.processTask(p,h)}processTask(p,h){return s(this,void 0,void 0,function*(){if(h.type==="<response>"){const E=this.resolveRejects[p];return delete this.resolveRejects[p],E?void(h.error?E.reject(Dc(h.error)):E.resolve(Dc(h.data))):void 0}if(!this.messageHandlers[h.type])return void this.completeTask(p,new Error(`Could not find a registered handler for ${h.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const v=Dc(h.data),b=new AbortController;this.abortControllers[p]=b;try{const E=yield this.messageHandlers[h.type](h.sourceMapId,v,b);this.completeTask(p,null,E)}catch(E){this.completeTask(p,E)}})}completeTask(p,h,v){const b=[];delete this.abortControllers[p];const E={id:p,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:h?Ac(h):null,data:Ac(v,b)};this.target.postMessage(E,{transfer:b})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},o.G=ct,o.H=function(){var p=new Uf(16);return Uf!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p},o.I=rD,o.J=function(p,h,v){var b,E,I,k,R,z,G,W,j,ee,ne,se,ce=v[0],ye=v[1],we=v[2];return h===p?(p[12]=h[0]*ce+h[4]*ye+h[8]*we+h[12],p[13]=h[1]*ce+h[5]*ye+h[9]*we+h[13],p[14]=h[2]*ce+h[6]*ye+h[10]*we+h[14],p[15]=h[3]*ce+h[7]*ye+h[11]*we+h[15]):(E=h[1],I=h[2],k=h[3],R=h[4],z=h[5],G=h[6],W=h[7],j=h[8],ee=h[9],ne=h[10],se=h[11],p[0]=b=h[0],p[1]=E,p[2]=I,p[3]=k,p[4]=R,p[5]=z,p[6]=G,p[7]=W,p[8]=j,p[9]=ee,p[10]=ne,p[11]=se,p[12]=b*ce+R*ye+j*we+h[12],p[13]=E*ce+z*ye+ee*we+h[13],p[14]=I*ce+G*ye+ne*we+h[14],p[15]=k*ce+W*ye+se*we+h[15]),p},o.K=function(p,h,v){var b=v[0],E=v[1],I=v[2];return p[0]=h[0]*b,p[1]=h[1]*b,p[2]=h[2]*b,p[3]=h[3]*b,p[4]=h[4]*E,p[5]=h[5]*E,p[6]=h[6]*E,p[7]=h[7]*E,p[8]=h[8]*I,p[9]=h[9]*I,p[10]=h[10]*I,p[11]=h[11]*I,p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15],p},o.L=t6,o.M=function(p,h){const v={};for(let b=0;b<h.length;b++){const E=h[b];E in p&&(v[E]=p[E])}return v},o.N=Fc,o.O=Y6,o.P=f,o.Q=K6,o.R=Ya,o.S=Ka,o.T=Pf,o.U=C,o.V=M,o.W=Me,o.X=Fn,o.Y=N,o.Z=dm,o._=s,o.a=at,o.a$=function(p,h){var v=p[0],b=p[1],E=p[2],I=p[3],k=p[4],R=p[5],z=p[6],G=p[7],W=p[8],j=p[9],ee=p[10],ne=p[11],se=p[12],ce=p[13],ye=p[14],we=p[15],Oe=h[0],Ae=h[1],Re=h[2],He=h[3],et=h[4],Ct=h[5],Yt=h[6],xt=h[7],_t=h[8],Gt=h[9],Rt=h[10],It=h[11],Ye=h[12],Ut=h[13],Ft=h[14],nr=h[15];return Math.abs(v-Oe)<=Hi*Math.max(1,Math.abs(v),Math.abs(Oe))&&Math.abs(b-Ae)<=Hi*Math.max(1,Math.abs(b),Math.abs(Ae))&&Math.abs(E-Re)<=Hi*Math.max(1,Math.abs(E),Math.abs(Re))&&Math.abs(I-He)<=Hi*Math.max(1,Math.abs(I),Math.abs(He))&&Math.abs(k-et)<=Hi*Math.max(1,Math.abs(k),Math.abs(et))&&Math.abs(R-Ct)<=Hi*Math.max(1,Math.abs(R),Math.abs(Ct))&&Math.abs(z-Yt)<=Hi*Math.max(1,Math.abs(z),Math.abs(Yt))&&Math.abs(G-xt)<=Hi*Math.max(1,Math.abs(G),Math.abs(xt))&&Math.abs(W-_t)<=Hi*Math.max(1,Math.abs(W),Math.abs(_t))&&Math.abs(j-Gt)<=Hi*Math.max(1,Math.abs(j),Math.abs(Gt))&&Math.abs(ee-Rt)<=Hi*Math.max(1,Math.abs(ee),Math.abs(Rt))&&Math.abs(ne-It)<=Hi*Math.max(1,Math.abs(ne),Math.abs(It))&&Math.abs(se-Ye)<=Hi*Math.max(1,Math.abs(se),Math.abs(Ye))&&Math.abs(ce-Ut)<=Hi*Math.max(1,Math.abs(ce),Math.abs(Ut))&&Math.abs(ye-Ft)<=Hi*Math.max(1,Math.abs(ye),Math.abs(Ft))&&Math.abs(we-nr)<=Hi*Math.max(1,Math.abs(we),Math.abs(nr))},o.a0=Pr,o.a1=dD,o.a2=$e,o.a3=p=>{const h=window.document.createElement("video");return h.muted=!0,new Promise(v=>{h.onloadstart=()=>{v(h)};for(const b of p){const E=window.document.createElement("source");wt(b)||(h.crossOrigin="Anonymous"),E.src=b,h.appendChild(E)}})},o.a4=function(){return H++},o.a5=Et,o.a6=Xf,o.a7=Lv,o.a8=Rh,o.a9=nG,o.aA=function(p){if(p.type==="custom")return new b_e(p);switch(p.type){case"background":return new m_e(p);case"circle":return new iye(p);case"fill":return new xye(p);case"fill-extrusion":return new Oye(p);case"heatmap":return new oye(p);case"hillshade":return new lye(p);case"line":return new Hye(p);case"raster":return new __e(p);case"symbol":return new Jb(p)}},o.aB=X,o.aC=function(p,h){if(!p)return[{command:"setStyle",args:[h]}];let v=[];try{if(!nt(p.version,h.version))return[{command:"setStyle",args:[h]}];nt(p.center,h.center)||v.push({command:"setCenter",args:[h.center]}),nt(p.zoom,h.zoom)||v.push({command:"setZoom",args:[h.zoom]}),nt(p.bearing,h.bearing)||v.push({command:"setBearing",args:[h.bearing]}),nt(p.pitch,h.pitch)||v.push({command:"setPitch",args:[h.pitch]}),nt(p.sprite,h.sprite)||v.push({command:"setSprite",args:[h.sprite]}),nt(p.glyphs,h.glyphs)||v.push({command:"setGlyphs",args:[h.glyphs]}),nt(p.transition,h.transition)||v.push({command:"setTransition",args:[h.transition]}),nt(p.light,h.light)||v.push({command:"setLight",args:[h.light]}),nt(p.terrain,h.terrain)||v.push({command:"setTerrain",args:[h.terrain]}),nt(p.sky,h.sky)||v.push({command:"setSky",args:[h.sky]}),nt(p.projection,h.projection)||v.push({command:"setProjection",args:[h.projection]});const b={},E=[];(function(k,R,z,G){let W;for(W in R=R||{},k=k||{})Object.prototype.hasOwnProperty.call(k,W)&&(Object.prototype.hasOwnProperty.call(R,W)||Ar(W,z,G));for(W in R)Object.prototype.hasOwnProperty.call(R,W)&&(Object.prototype.hasOwnProperty.call(k,W)?nt(k[W],R[W])||(k[W].type==="geojson"&&R[W].type==="geojson"&&fi(k,R,W)?Nr(z,{command:"setGeoJSONSourceData",args:[W,R[W].data]}):zn(W,R,z,G)):br(W,R,z))})(p.sources,h.sources,E,b);const I=[];p.layers&&p.layers.forEach(k=>{"source"in k&&b[k.source]?v.push({command:"removeLayer",args:[k.id]}):I.push(k)}),v=v.concat(E),function(k,R,z){R=R||[];const G=(k=k||[]).map(si),W=R.map(si),j=k.reduce(Tt,{}),ee=R.reduce(Tt,{}),ne=G.slice(),se=Object.create(null);let ce,ye,we,Oe,Ae;for(let Re=0,He=0;Re<G.length;Re++)ce=G[Re],Object.prototype.hasOwnProperty.call(ee,ce)?He++:(Nr(z,{command:"removeLayer",args:[ce]}),ne.splice(ne.indexOf(ce,He),1));for(let Re=0,He=0;Re<W.length;Re++)ce=W[W.length-1-Re],ne[ne.length-1-Re]!==ce&&(Object.prototype.hasOwnProperty.call(j,ce)?(Nr(z,{command:"removeLayer",args:[ce]}),ne.splice(ne.lastIndexOf(ce,ne.length-He),1)):He++,Oe=ne[ne.length-Re],Nr(z,{command:"addLayer",args:[ee[ce],Oe]}),ne.splice(ne.length-Re,0,ce),se[ce]=!0);for(let Re=0;Re<W.length;Re++)if(ce=W[Re],ye=j[ce],we=ee[ce],!se[ce]&&!nt(ye,we))if(nt(ye.source,we.source)&&nt(ye["source-layer"],we["source-layer"])&&nt(ye.type,we.type)){for(Ae in kn(ye.layout,we.layout,z,ce,null,"setLayoutProperty"),kn(ye.paint,we.paint,z,ce,null,"setPaintProperty"),nt(ye.filter,we.filter)||Nr(z,{command:"setFilter",args:[ce,we.filter]}),nt(ye.minzoom,we.minzoom)&&nt(ye.maxzoom,we.maxzoom)||Nr(z,{command:"setLayerZoomRange",args:[ce,we.minzoom,we.maxzoom]}),ye)Object.prototype.hasOwnProperty.call(ye,Ae)&&Ae!=="layout"&&Ae!=="paint"&&Ae!=="filter"&&Ae!=="metadata"&&Ae!=="minzoom"&&Ae!=="maxzoom"&&(Ae.indexOf("paint.")===0?kn(ye[Ae],we[Ae],z,ce,Ae.slice(6),"setPaintProperty"):nt(ye[Ae],we[Ae])||Nr(z,{command:"setLayerProperty",args:[ce,Ae,we[Ae]]}));for(Ae in we)Object.prototype.hasOwnProperty.call(we,Ae)&&!Object.prototype.hasOwnProperty.call(ye,Ae)&&Ae!=="layout"&&Ae!=="paint"&&Ae!=="filter"&&Ae!=="metadata"&&Ae!=="minzoom"&&Ae!=="maxzoom"&&(Ae.indexOf("paint.")===0?kn(ye[Ae],we[Ae],z,ce,Ae.slice(6),"setPaintProperty"):nt(ye[Ae],we[Ae])||Nr(z,{command:"setLayerProperty",args:[ce,Ae,we[Ae]]}))}else Nr(z,{command:"removeLayer",args:[ce]}),Oe=ne[ne.lastIndexOf(ce)+1],Nr(z,{command:"addLayer",args:[we,Oe]})}(I,h.layers,v)}catch(b){console.warn("Unable to compute style diff:",b),v=[{command:"setStyle",args:[h]}]}return v},o.aD=function(p){const h=[],v=p.id;return v===void 0&&h.push({message:`layers.${v}: missing required property "id"`}),p.render===void 0&&h.push({message:`layers.${v}: missing required method "render"`}),p.renderingMode&&p.renderingMode!=="2d"&&p.renderingMode!=="3d"&&h.push({message:`layers.${v}: property "renderingMode" must be either "2d" or "3d"`}),h},o.aE=function p(h,v){if(Array.isArray(h)){if(!Array.isArray(v)||h.length!==v.length)return!1;for(let b=0;b<h.length;b++)if(!p(h[b],v[b]))return!1;return!0}if(typeof h=="object"&&h!==null&&v!==null){if(typeof v!="object"||Object.keys(h).length!==Object.keys(v).length)return!1;for(const b in h)if(!p(h[b],v[b]))return!1;return!0}return h===v},o.aF=Z,o.aG=Y,o.aH=class extends kh{constructor(p,h){super(p,h),this.current=0}set(p){this.current!==p&&(this.current=p,this.gl.uniform1i(this.location,p))}},o.aI=Vb,o.aJ=class extends kh{constructor(p,h){super(p,h),this.current=Yme}set(p){if(p[12]!==this.current[12]||p[0]!==this.current[0])return this.current=p,void this.gl.uniformMatrix4fv(this.location,!1,p);for(let h=1;h<16;h++)if(p[h]!==this.current[h]){this.current=p,this.gl.uniformMatrix4fv(this.location,!1,p);break}}},o.aK=H$,o.aL=W$,o.aM=Xr,o.aN=class extends kh{constructor(p,h){super(p,h),this.current=[0,0,0]}set(p){p[0]===this.current[0]&&p[1]===this.current[1]&&p[2]===this.current[2]||(this.current=p,this.gl.uniform3f(this.location,p[0],p[1],p[2]))}},o.aO=class extends kh{constructor(p,h){super(p,h),this.current=[0,0]}set(p){p[0]===this.current[0]&&p[1]===this.current[1]||(this.current=p,this.gl.uniform2f(this.location,p[0],p[1]))}},o.aP=function(p,h,v,b,E,I,k){var R=1/(h-v),z=1/(b-E),G=1/(I-k);return p[0]=-2*R,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=-2*z,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=2*G,p[11]=0,p[12]=(h+v)*R,p[13]=(E+b)*z,p[14]=(k+I)*G,p[15]=1,p},o.aQ=nye,o.aR=class extends Ie{},o.aS=jye,o.aT=class extends Ve{},o.aU=HA,o.aV=function(p){return p<=1?1:Math.pow(2,Math.ceil(Math.log(p)/Math.LN2))},o.aW=o6,o.aX=mi,o.aY=Xa,o.aZ=class extends zt{},o.a_=function(p,h){return p[0]===h[0]&&p[1]===h[1]&&p[2]===h[2]&&p[3]===h[3]&&p[4]===h[4]&&p[5]===h[5]&&p[6]===h[6]&&p[7]===h[7]&&p[8]===h[8]&&p[9]===h[9]&&p[10]===h[10]&&p[11]===h[11]&&p[12]===h[12]&&p[13]===h[13]&&p[14]===h[14]&&p[15]===h[15]},o.aa=function(p){const h={};if(p.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(v,b,E,I)=>{const k=E||I;return h[b]=!k||k.toLowerCase(),""}),h["max-age"]){const v=parseInt(h["max-age"],10);isNaN(v)?delete h["max-age"]:h["max-age"]=v}return h},o.ab=function(p,h){const v=[];for(const b in p)b in h||v.push(b);return v},o.ac=F,o.ad=function(p,h,v){var b=Math.sin(v),E=Math.cos(v),I=h[0],k=h[1],R=h[2],z=h[3],G=h[4],W=h[5],j=h[6],ee=h[7];return h!==p&&(p[8]=h[8],p[9]=h[9],p[10]=h[10],p[11]=h[11],p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15]),p[0]=I*E+G*b,p[1]=k*E+W*b,p[2]=R*E+j*b,p[3]=z*E+ee*b,p[4]=G*E-I*b,p[5]=W*E-k*b,p[6]=j*E-R*b,p[7]=ee*E-z*b,p},o.ae=function(p){var h=new Uf(16);return h[0]=p[0],h[1]=p[1],h[2]=p[2],h[3]=p[3],h[4]=p[4],h[5]=p[5],h[6]=p[6],h[7]=p[7],h[8]=p[8],h[9]=p[9],h[10]=p[10],h[11]=p[11],h[12]=p[12],h[13]=p[13],h[14]=p[14],h[15]=p[15],h},o.af=Ub,o.ag=function(p,h){let v=0,b=0;if(p.kind==="constant")b=p.layoutSize;else if(p.kind!=="source"){const{interpolationType:E,minZoom:I,maxZoom:k}=p,R=E?F(Gi.interpolationFactor(E,h,I,k),0,1):0;p.kind==="camera"?b=$i.number(p.minSize,p.maxSize,R):v=R}return{uSizeT:v,uSize:b}},o.ai=function(p,{uSize:h,uSizeT:v},{lowerSize:b,upperSize:E}){return p.kind==="source"?b/ks:p.kind==="composite"?$i.number(b/ks,E/ks,v):h},o.aj=oD,o.ak=function(p,h,v,b){const E=h.y-p.y,I=h.x-p.x,k=b.y-v.y,R=b.x-v.x,z=k*I-R*E;if(z===0)return null;const G=(R*(p.y-v.y)-k*(p.x-v.x))/z;return new f(p.x+G*I,p.y+G*E)},o.al=sG,o.am=X$,o.an=$A,o.ao=function(p){let h=1/0,v=1/0,b=-1/0,E=-1/0;for(const I of p)h=Math.min(h,I.x),v=Math.min(v,I.y),b=Math.max(b,I.x),E=Math.max(E,I.y);return[h,v,b,E]},o.ap=Zn,o.ar=aD,o.as=function(p,h){var v=h[0],b=h[1],E=h[2],I=h[3],k=h[4],R=h[5],z=h[6],G=h[7],W=h[8],j=h[9],ee=h[10],ne=h[11],se=h[12],ce=h[13],ye=h[14],we=h[15],Oe=v*R-b*k,Ae=v*z-E*k,Re=v*G-I*k,He=b*z-E*R,et=b*G-I*R,Ct=E*G-I*z,Yt=W*ce-j*se,xt=W*ye-ee*se,_t=W*we-ne*se,Gt=j*ye-ee*ce,Rt=j*we-ne*ce,It=ee*we-ne*ye,Ye=Oe*It-Ae*Rt+Re*Gt+He*_t-et*xt+Ct*Yt;return Ye?(p[0]=(R*It-z*Rt+G*Gt)*(Ye=1/Ye),p[1]=(E*Rt-b*It-I*Gt)*Ye,p[2]=(ce*Ct-ye*et+we*He)*Ye,p[3]=(ee*et-j*Ct-ne*He)*Ye,p[4]=(z*_t-k*It-G*xt)*Ye,p[5]=(v*It-E*_t+I*xt)*Ye,p[6]=(ye*Re-se*Ct-we*Ae)*Ye,p[7]=(W*Ct-ee*Re+ne*Ae)*Ye,p[8]=(k*Rt-R*_t+G*Yt)*Ye,p[9]=(b*_t-v*Rt-I*Yt)*Ye,p[10]=(se*et-ce*Re+we*Oe)*Ye,p[11]=(j*Re-W*et-ne*Oe)*Ye,p[12]=(R*xt-k*Gt-z*Yt)*Ye,p[13]=(v*Gt-b*xt+E*Yt)*Ye,p[14]=(ce*Ae-se*He-ye*Oe)*Ye,p[15]=(W*He-j*Ae+ee*Oe)*Ye,p):null},o.at=pD,o.au=iD,o.av=gD,o.aw=function(){const p={},h=Le.$version;for(const v in Le.$root){const b=Le.$root[v];if(b.required){let E=null;E=v==="version"?h:b.type==="array"?[]:{},E!=null&&(p[v]=E)}}return p},o.ax=qv,o.ay=Qe,o.az=function(p){p=p.slice();const h=Object.create(null);for(let v=0;v<p.length;v++)h[p[v].id]=p[v];for(let v=0;v<p.length;v++)"ref"in p[v]&&(p[v]=yn(p[v],h[p[v].ref]));return p},o.b=pe,o.b0=function(p,h){return p[0]=h[0],p[1]=h[1],p[2]=h[2],p[3]=h[3],p[4]=h[4],p[5]=h[5],p[6]=h[6],p[7]=h[7],p[8]=h[8],p[9]=h[9],p[10]=h[10],p[11]=h[11],p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15],p},o.b1=function(p,h,v){return p[0]=h[0]*v[0],p[1]=h[1]*v[1],p[2]=h[2]*v[2],p[3]=h[3]*v[3],p},o.b2=function(p,h){return p[0]*h[0]+p[1]*h[1]+p[2]*h[2]+p[3]*h[3]},o.b3=V,o.b4=eG,o.b5=J6,o.b6=function(p,h,v,b,E){var I,k=1/Math.tan(h/2);return p[0]=k/v,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=k,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=-1,p[12]=0,p[13]=0,p[15]=0,E!=null&&E!==1/0?(p[10]=(E+b)*(I=1/(b-E)),p[14]=2*E*b*I):(p[10]=-1,p[14]=-2*b),p},o.b7=function(p,h,v){var b=Math.sin(v),E=Math.cos(v),I=h[4],k=h[5],R=h[6],z=h[7],G=h[8],W=h[9],j=h[10],ee=h[11];return h!==p&&(p[0]=h[0],p[1]=h[1],p[2]=h[2],p[3]=h[3],p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15]),p[4]=I*E+G*b,p[5]=k*E+W*b,p[6]=R*E+j*b,p[7]=z*E+ee*b,p[8]=G*E-I*b,p[9]=W*E-k*b,p[10]=j*E-R*b,p[11]=ee*E-z*b,p},o.b8=L,o.b9=O,o.bA=C6,o.bB=function(p){return p.message===Xe},o.bC=bc,o.bD=fa,o.ba=function(p){return p*Math.PI/180},o.bb=function(p,h){const{x:v,y:b}=dm.fromLngLat(h);return!(p<0||p>25||b<0||b>=1||v<0||v>=1)},o.bc=function(p,h){return p[0]=h[0],p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=h[1],p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=h[2],p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},o.bd=class extends q{},o.be=uD,o.bf=I_e,o.bh=dt,o.bi=function(p,h){at.REGISTERED_PROTOCOLS[p]=h},o.bj=function(p){delete at.REGISTERED_PROTOCOLS[p]},o.bk=function(p,h){const v={};for(let E=0;E<p.length;E++){const I=h&&h[p[E].id]||Ab(p[E]);h&&(h[p[E].id]=I);let k=v[I];k||(k=v[I]=[]),k.push(p[E])}const b=[];for(const E in v)b.push(v[E]);return b},o.bl=Pt,o.bm=rG,o.bn=iG,o.bo=N6,o.bp=function(p){p.bucket.createArrays(),p.bucket.tilePixelRatio=Fn/(512*p.bucket.overscaling),p.bucket.compareText={},p.bucket.iconsNeedLinear=!1;const h=p.bucket.layers[0],v=h.layout,b=h._unevaluatedLayout._values,E={layoutIconSize:b["icon-size"].possiblyEvaluate(new dn(p.bucket.zoom+1),p.canonical),layoutTextSize:b["text-size"].possiblyEvaluate(new dn(p.bucket.zoom+1),p.canonical),textMaxSize:b["text-size"].possiblyEvaluate(new dn(18))};if(p.bucket.textSizeData.kind==="composite"){const{minZoom:G,maxZoom:W}=p.bucket.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new dn(G),p.canonical),b["text-size"].possiblyEvaluate(new dn(W),p.canonical)]}if(p.bucket.iconSizeData.kind==="composite"){const{minZoom:G,maxZoom:W}=p.bucket.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new dn(G),p.canonical),b["icon-size"].possiblyEvaluate(new dn(W),p.canonical)]}const I=v.get("text-line-height")*Zn,k=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point",R=v.get("text-keep-upright"),z=v.get("text-size");for(const G of p.bucket.features){const W=v.get("text-font").evaluate(G,{},p.canonical).join(","),j=z.evaluate(G,{},p.canonical),ee=E.layoutTextSize.evaluate(G,{},p.canonical),ne=E.layoutIconSize.evaluate(G,{},p.canonical),se={horizontal:{},vertical:void 0},ce=G.text;let ye,we=[0,0];if(ce){const Re=ce.toString(),He=v.get("text-letter-spacing").evaluate(G,{},p.canonical)*Zn,et=IA(Re)?He:0,Ct=v.get("text-anchor").evaluate(G,{},p.canonical),Yt=vG(h,G,p.canonical);if(!Yt){const Rt=v.get("text-radial-offset").evaluate(G,{},p.canonical);we=Rt?gG(Ct,[Rt*Zn,fD]):v.get("text-offset").evaluate(G,{},p.canonical).map(It=>It*Zn)}let xt=k?"center":v.get("text-justify").evaluate(G,{},p.canonical);const _t=v.get("symbol-placement")==="point"?v.get("text-max-width").evaluate(G,{},p.canonical)*Zn:1/0,Gt=()=>{p.bucket.allowVerticalPlacement&&Zv(Re)&&(se.vertical=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,Ct,"left",et,we,o.ah.vertical,!0,ee,j))};if(!k&&Yt){const Rt=new Set;if(xt==="auto")for(let Ye=0;Ye<Yt.values.length;Ye+=2)Rt.add(pD(Yt.values[Ye]));else Rt.add(xt);let It=!1;for(const Ye of Rt)if(!se.horizontal[Ye])if(It)se.horizontal[Ye]=se.horizontal[0];else{const Ut=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,"center",Ye,et,we,o.ah.horizontal,!1,ee,j);Ut&&(se.horizontal[Ye]=Ut,It=Ut.positionedLines.length===1)}Gt()}else{xt==="auto"&&(xt=pD(Ct));const Rt=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,Ct,xt,et,we,o.ah.horizontal,!1,ee,j);Rt&&(se.horizontal[xt]=Rt),Gt(),Zv(Re)&&k&&R&&(se.vertical=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,Ct,xt,et,we,o.ah.vertical,!1,ee,j))}}let Oe=!1;if(G.icon&&G.icon.name){const Re=p.imageMap[G.icon.name];Re&&(ye=d_e(p.imagePositions[G.icon.name],v.get("icon-offset").evaluate(G,{},p.canonical),v.get("icon-anchor").evaluate(G,{},p.canonical)),Oe=!!Re.sdf,p.bucket.sdfIcons===void 0?p.bucket.sdfIcons=Oe:p.bucket.sdfIcons!==Oe&&oe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Re.pixelRatio!==p.bucket.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(p.bucket.iconsNeedLinear=!0))}const Ae=yG(se.horizontal)||se.vertical;p.bucket.iconsInText=!!Ae&&Ae.iconsInText,(Ae||ye)&&D_e(p.bucket,G,se,ye,p.imageMap,E,ee,ne,we,Oe,p.canonical)}p.showCollisionBoxes&&p.bucket.generateCollisionDebugBuffers()},o.bq=JA,o.br=XA,o.bs=KA,o.bt=zc,o.bu=eD,o.bv=class{constructor(p){this._marks={start:[p.url,"start"].join("#"),end:[p.url,"end"].join("#"),measure:p.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let p=performance.getEntriesByName(this._marks.measure);return p.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),p=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),p}},o.bw=function(p,h,v,b,E){return s(this,void 0,void 0,function*(){if(M())try{return yield Me(p,h,v,b,E)}catch{}return function(I,k,R,z,G){const W=I.width,j=I.height;Be&&Fe||(Be=new OffscreenCanvas(W,j),Fe=Be.getContext("2d",{willReadFrequently:!0})),Be.width=W,Be.height=j,Fe.drawImage(I,0,0,W,j);const ee=Fe.getImageData(k,R,z,G);return Fe.clearRect(0,0,W,j),ee.data}(p,h,v,b,E)})},o.bx=tG,o.by=l,o.bz=c,o.c=it,o.d=p=>s(void 0,void 0,void 0,function*(){if(p.byteLength===0)return createImageBitmap(new ImageData(1,1));const h=new Blob([new Uint8Array(p)],{type:"image/png"});try{return createImageBitmap(h)}catch(v){throw new Error(`Could not load image because of ${v.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),o.e=U,o.f=p=>new Promise((h,v)=>{const b=new Image;b.onload=()=>{h(b),URL.revokeObjectURL(b.src),b.onload=null,window.requestAnimationFrame(()=>{b.src=me})},b.onerror=()=>v(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 E=new Blob([new Uint8Array(p)],{type:"image/png"});b.src=p.byteLength?URL.createObjectURL(E):me}),o.g=ht,o.h=(p,h)=>Dt(U(p,{type:"json"}),h),o.i=de,o.j=kt,o.k=tt,o.l=(p,h)=>Dt(U(p,{type:"arrayBuffer"}),h),o.m=Dt,o.n=function(p){return new eD(p).readFields(a_e,[])},o.o=rm,o.p=R6,o.q=D,o.r=DA,o.s=wt,o.t=Hv,o.u=ml,o.v=Le,o.w=oe,o.x=function([p,h,v]){return h+=90,h*=Math.PI/180,v*=Math.PI/180,{x:p*Math.cos(h)*Math.sin(v),y:p*Math.sin(h)*Math.sin(v),z:p*Math.cos(v)}},o.y=$i,o.z=dn}),i("worker",["./shared"],function(o){class s{constructor(re){this.keyCache={},re&&this.replace(re)}replace(re){this._layerConfigs={},this._layers={},this.update(re,[])}update(re,te){for(const _e of re){this._layerConfigs[_e.id]=_e;const De=this._layers[_e.id]=o.aA(_e);De._featureFilter=o.a7(De.filter),this.keyCache[_e.id]&&delete this.keyCache[_e.id]}for(const _e of te)delete this.keyCache[_e],delete this._layerConfigs[_e],delete this._layers[_e];this.familiesBySource={};const he=o.bk(Object.values(this._layerConfigs),this.keyCache);for(const _e of he){const De=_e.map(Ge=>this._layers[Ge.id]),ke=De[0];if(ke.visibility==="none")continue;const Ne=ke.source||"";let Ee=this.familiesBySource[Ne];Ee||(Ee=this.familiesBySource[Ne]={});const We=ke.sourceLayer||"_geojsonTileLayer";let Je=Ee[We];Je||(Je=Ee[We]=[]),Je.push(De)}}}class l{constructor(re){const te={},he=[];for(const Ne in re){const Ee=re[Ne],We=te[Ne]={};for(const Je in Ee){const Ge=Ee[+Je];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const ft={x:0,y:0,w:Ge.bitmap.width+2,h:Ge.bitmap.height+2};he.push(ft),We[Je]={rect:ft,metrics:Ge.metrics}}}const{w:_e,h:De}=o.p(he),ke=new o.o({width:_e||1,height:De||1});for(const Ne in re){const Ee=re[Ne];for(const We in Ee){const Je=Ee[+We];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const Ge=te[Ne][We].rect;o.o.copy(Je.bitmap,ke,{x:0,y:0},{x:Ge.x+1,y:Ge.y+1},Je.bitmap)}}this.image=ke,this.positions=te}}o.bl("GlyphAtlas",l);class c{constructor(re){this.tileID=new o.S(re.tileID.overscaledZ,re.tileID.wrap,re.tileID.canonical.z,re.tileID.canonical.x,re.tileID.canonical.y),this.uid=re.uid,this.zoom=re.zoom,this.pixelRatio=re.pixelRatio,this.tileSize=re.tileSize,this.source=re.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=re.showCollisionBoxes,this.collectResourceTiming=!!re.collectResourceTiming,this.returnDependencies=!!re.returnDependencies,this.promoteId=re.promoteId,this.inFlightDependencies=[]}parse(re,te,he,_e){return o._(this,void 0,void 0,function*(){this.status="parsing",this.data=re,this.collisionBoxArray=new o.a5;const De=new o.bm(Object.keys(re.layers).sort()),ke=new o.bn(this.tileID,this.promoteId);ke.bucketLayerIDs=[];const Ne={},Ee={featureIndex:ke,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:he},We=te.familiesBySource[this.source];for(const xr in We){const jr=re.layers[xr];if(!jr)continue;jr.version===1&&o.w(`Vector tile source "${this.source}" layer "${xr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _n=De.encode(xr),Yn=[];for(let li=0;li<jr.length;li++){const Ii=jr.feature(li),cc=ke.getId(Ii,xr);Yn.push({feature:Ii,id:cc,index:li,sourceLayerIndex:_n})}for(const li of We[xr]){const Ii=li[0];Ii.source!==this.source&&o.w(`layer.source = ${Ii.source} does not equal this.source = ${this.source}`),Ii.minzoom&&this.zoom<Math.floor(Ii.minzoom)||Ii.maxzoom&&this.zoom>=Ii.maxzoom||Ii.visibility!=="none"&&(d(li,this.zoom,he),(Ne[Ii.id]=Ii.createBucket({index:ke.bucketLayerIDs.length,layers:li,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_n,sourceID:this.source})).populate(Yn,Ee,this.tileID.canonical),ke.bucketLayerIDs.push(li.map(cc=>cc.id)))}}const Je=o.aF(Ee.glyphDependencies,xr=>Object.keys(xr).map(Number));this.inFlightDependencies.forEach(xr=>xr==null?void 0:xr.abort()),this.inFlightDependencies=[];let Ge=Promise.resolve({});if(Object.keys(Je).length){const xr=new AbortController;this.inFlightDependencies.push(xr),Ge=_e.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},xr)}const ft=Object.keys(Ee.iconDependencies);let Wt=Promise.resolve({});if(ft.length){const xr=new AbortController;this.inFlightDependencies.push(xr),Wt=_e.sendAsync({type:"GI",data:{icons:ft,source:this.source,tileID:this.tileID,type:"icons"}},xr)}const Xt=Object.keys(Ee.patternDependencies);let Or=Promise.resolve({});if(Xt.length){const xr=new AbortController;this.inFlightDependencies.push(xr),Or=_e.sendAsync({type:"GI",data:{icons:Xt,source:this.source,tileID:this.tileID,type:"patterns"}},xr)}const[dr,zr,Dr]=yield Promise.all([Ge,Wt,Or]),Bn=new l(dr),Sn=new o.bo(zr,Dr);for(const xr in Ne){const jr=Ne[xr];jr instanceof o.a6?(d(jr.layers,this.zoom,he),o.bp({bucket:jr,glyphMap:dr,glyphPositions:Bn.positions,imageMap:zr,imagePositions:Sn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):jr.hasPattern&&(jr instanceof o.bq||jr instanceof o.br||jr instanceof o.bs)&&(d(jr.layers,this.zoom,he),jr.addFeatures(Ee,this.tileID.canonical,Sn.patternPositions))}return this.status="done",{buckets:Object.values(Ne).filter(xr=>!xr.isEmpty()),featureIndex:ke,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Bn.image,imageAtlas:Sn,glyphMap:this.returnDependencies?dr:null,iconMap:this.returnDependencies?zr:null,glyphPositions:this.returnDependencies?Bn.positions:null}})}}function d(xe,re,te){const he=new o.z(re);for(const _e of xe)_e.recalculate(he,te)}class f{constructor(re,te,he){this.actor=re,this.layerIndex=te,this.availableImages=he,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(re,te){return o._(this,void 0,void 0,function*(){const he=yield o.l(re.request,te);try{return{vectorTile:new o.bt.VectorTile(new o.bu(he.data)),rawData:he.data,cacheControl:he.cacheControl,expires:he.expires}}catch(_e){const De=new Uint8Array(he.data);let ke=`Unable to parse the tile at ${re.request.url}, `;throw ke+=De[0]===31&&De[1]===139?"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(ke)}})}loadTile(re){return o._(this,void 0,void 0,function*(){const te=re.uid,he=!!(re&&re.request&&re.request.collectResourceTiming)&&new o.bv(re.request),_e=new c(re);this.loading[te]=_e;const De=new AbortController;_e.abort=De;try{const ke=yield this.loadVectorTile(re,De);if(delete this.loading[te],!ke)return null;const Ne=ke.rawData,Ee={};ke.expires&&(Ee.expires=ke.expires),ke.cacheControl&&(Ee.cacheControl=ke.cacheControl);const We={};if(he){const Ge=he.finish();Ge&&(We.resourceTiming=JSON.parse(JSON.stringify(Ge)))}_e.vectorTile=ke.vectorTile;const Je=_e.parse(ke.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[te]=_e,this.fetching[te]={rawTileData:Ne,cacheControl:Ee,resourceTiming:We};try{const Ge=yield Je;return o.e({rawTileData:Ne.slice(0)},Ge,Ee,We)}finally{delete this.fetching[te]}}catch(ke){throw delete this.loading[te],_e.status="done",this.loaded[te]=_e,ke}})}reloadTile(re){return o._(this,void 0,void 0,function*(){const te=re.uid;if(!this.loaded||!this.loaded[te])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const he=this.loaded[te];if(he.showCollisionBoxes=re.showCollisionBoxes,he.status==="parsing"){const _e=yield he.parse(he.vectorTile,this.layerIndex,this.availableImages,this.actor);let De;if(this.fetching[te]){const{rawTileData:ke,cacheControl:Ne,resourceTiming:Ee}=this.fetching[te];delete this.fetching[te],De=o.e({rawTileData:ke.slice(0)},_e,Ne,Ee)}else De=_e;return De}if(he.status==="done"&&he.vectorTile)return he.parse(he.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(re){return o._(this,void 0,void 0,function*(){const te=this.loading,he=re.uid;te&&te[he]&&te[he].abort&&(te[he].abort.abort(),delete te[he])})}removeTile(re){return o._(this,void 0,void 0,function*(){this.loaded&&this.loaded[re.uid]&&delete this.loaded[re.uid]})}}class g{constructor(){this.loaded={}}loadTile(re){return o._(this,void 0,void 0,function*(){const{uid:te,encoding:he,rawImageData:_e,redFactor:De,greenFactor:ke,blueFactor:Ne,baseShift:Ee}=re,We=_e.width+2,Je=_e.height+2,Ge=o.b(_e)?new o.R({width:We,height:Je},yield o.bw(_e,-1,-1,We,Je)):_e,ft=new o.bx(te,Ge,he,De,ke,Ne,Ee);return this.loaded=this.loaded||{},this.loaded[te]=ft,ft})}removeTile(re){const te=this.loaded,he=re.uid;te&&te[he]&&delete te[he]}}function m(xe,re){if(xe.length!==0){_(xe[0],re);for(var te=1;te<xe.length;te++)_(xe[te],!re)}}function _(xe,re){for(var te=0,he=0,_e=0,De=xe.length,ke=De-1;_e<De;ke=_e++){var Ne=(xe[_e][0]-xe[ke][0])*(xe[ke][1]+xe[_e][1]),Ee=te+Ne;he+=Math.abs(te)>=Math.abs(Ne)?te-Ee+Ne:Ne-Ee+te,te=Ee}te+he>=0!=!!re&&xe.reverse()}var x=o.by(function xe(re,te){var he,_e=re&&re.type;if(_e==="FeatureCollection")for(he=0;he<re.features.length;he++)xe(re.features[he],te);else if(_e==="GeometryCollection")for(he=0;he<re.geometries.length;he++)xe(re.geometries[he],te);else if(_e==="Feature")xe(re.geometry,te);else if(_e==="Polygon")m(re.coordinates,te);else if(_e==="MultiPolygon")for(he=0;he<re.coordinates.length;he++)m(re.coordinates[he],te);return re});const w=o.bt.VectorTileFeature.prototype.toGeoJSON;var C={exports:{}},M=o.bz,L=o.bt.VectorTileFeature,O=F;function F(xe,re){this.options=re||{},this.features=xe,this.length=xe.length}function V(xe,re){this.id=typeof xe.id=="number"?xe.id:void 0,this.type=xe.type,this.rawGeometry=xe.type===1?[xe.geometry]:xe.geometry,this.properties=xe.tags,this.extent=re||4096}F.prototype.feature=function(xe){return new V(this.features[xe],this.options.extent)},V.prototype.loadGeometry=function(){var xe=this.rawGeometry;this.geometry=[];for(var re=0;re<xe.length;re++){for(var te=xe[re],he=[],_e=0;_e<te.length;_e++)he.push(new M(te[_e][0],te[_e][1]));this.geometry.push(he)}return this.geometry},V.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var xe=this.geometry,re=1/0,te=-1/0,he=1/0,_e=-1/0,De=0;De<xe.length;De++)for(var ke=xe[De],Ne=0;Ne<ke.length;Ne++){var Ee=ke[Ne];re=Math.min(re,Ee.x),te=Math.max(te,Ee.x),he=Math.min(he,Ee.y),_e=Math.max(_e,Ee.y)}return[re,he,te,_e]},V.prototype.toGeoJSON=L.prototype.toGeoJSON;var U=o.bA,H=O;function Z(xe){var re=new U;return function(te,he){for(var _e in te.layers)he.writeMessage(3,Y,te.layers[_e])}(xe,re),re.finish()}function Y(xe,re){var te;re.writeVarintField(15,xe.version||1),re.writeStringField(1,xe.name||""),re.writeVarintField(5,xe.extent||4096);var he={keys:[],values:[],keycache:{},valuecache:{}};for(te=0;te<xe.length;te++)he.feature=xe.feature(te),re.writeMessage(2,X,he);var _e=he.keys;for(te=0;te<_e.length;te++)re.writeStringField(3,_e[te]);var De=he.values;for(te=0;te<De.length;te++)re.writeMessage(4,ge,De[te])}function X(xe,re){var te=xe.feature;te.id!==void 0&&re.writeVarintField(1,te.id),re.writeMessage(2,ie,xe),re.writeVarintField(3,te.type),re.writeMessage(4,de,te)}function ie(xe,re){var te=xe.feature,he=xe.keys,_e=xe.values,De=xe.keycache,ke=xe.valuecache;for(var Ne in te.properties){var Ee=te.properties[Ne],We=De[Ne];if(Ee!==null){We===void 0&&(he.push(Ne),De[Ne]=We=he.length-1),re.writeVarint(We);var Je=typeof Ee;Je!=="string"&&Je!=="boolean"&&Je!=="number"&&(Ee=JSON.stringify(Ee));var Ge=Je+":"+Ee,ft=ke[Ge];ft===void 0&&(_e.push(Ee),ke[Ge]=ft=_e.length-1),re.writeVarint(ft)}}}function oe(xe,re){return(re<<3)+(7&xe)}function le(xe){return xe<<1^xe>>31}function de(xe,re){for(var te=xe.loadGeometry(),he=xe.type,_e=0,De=0,ke=te.length,Ne=0;Ne<ke;Ne++){var Ee=te[Ne],We=1;he===1&&(We=Ee.length),re.writeVarint(oe(1,We));for(var Je=he===3?Ee.length-1:Ee.length,Ge=0;Ge<Je;Ge++){Ge===1&&he!==1&&re.writeVarint(oe(2,Je-1));var ft=Ee[Ge].x-_e,Wt=Ee[Ge].y-De;re.writeVarint(le(ft)),re.writeVarint(le(Wt)),_e+=ft,De+=Wt}he===3&&re.writeVarint(oe(7,1))}}function ge(xe,re){var te=typeof xe;te==="string"?re.writeStringField(1,xe):te==="boolean"?re.writeBooleanField(7,xe):te==="number"&&(xe%1!=0?re.writeDoubleField(3,xe):xe<0?re.writeSVarintField(6,xe):re.writeVarintField(5,xe))}C.exports=Z,C.exports.fromVectorTileJs=Z,C.exports.fromGeojsonVt=function(xe,re){re=re||{};var te={};for(var he in xe)te[he]=new H(xe[he].features,re),te[he].name=he,te[he].version=re.version,te[he].extent=re.extent;return Z({layers:te})},C.exports.GeoJSONWrapper=H;var pe=o.by(C.exports);const me={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:xe=>xe},Me=Math.fround||(Be=new Float32Array(1),xe=>(Be[0]=+xe,Be[0]));var Be;const Fe=3,Xe=5,it=6;class at{constructor(re){this.options=Object.assign(Object.create(me),re),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(re){const{log:te,minZoom:he,maxZoom:_e}=this.options;te&&console.time("total time");const De=`prepare ${re.length} points`;te&&console.time(De),this.points=re;const ke=[];for(let Ee=0;Ee<re.length;Ee++){const We=re[Ee];if(!We.geometry)continue;const[Je,Ge]=We.geometry.coordinates,ft=Me(dt(Je)),Wt=Me(Qe(Ge));ke.push(ft,Wt,1/0,Ee,-1,1),this.options.reduce&&ke.push(0)}let Ne=this.trees[_e+1]=this._createTree(ke);te&&console.timeEnd(De);for(let Ee=_e;Ee>=he;Ee--){const We=+Date.now();Ne=this.trees[Ee]=this._createTree(this._cluster(Ne,Ee)),te&&console.log("z%d: %d clusters in %dms",Ee,Ne.numItems,+Date.now()-We)}return te&&console.timeEnd("total time"),this}getClusters(re,te){let he=((re[0]+180)%360+360)%360-180;const _e=Math.max(-90,Math.min(90,re[1]));let De=re[2]===180?180:((re[2]+180)%360+360)%360-180;const ke=Math.max(-90,Math.min(90,re[3]));if(re[2]-re[0]>=360)he=-180,De=180;else if(he>De){const Ge=this.getClusters([he,_e,180,ke],te),ft=this.getClusters([-180,_e,De,ke],te);return Ge.concat(ft)}const Ne=this.trees[this._limitZoom(te)],Ee=Ne.range(dt(he),Qe(ke),dt(De),Qe(_e)),We=Ne.data,Je=[];for(const Ge of Ee){const ft=this.stride*Ge;Je.push(We[ft+Xe]>1?ht(We,ft,this.clusterProps):this.points[We[ft+Fe]])}return Je}getChildren(re){const te=this._getOriginId(re),he=this._getOriginZoom(re),_e="No cluster with the specified id.",De=this.trees[he];if(!De)throw new Error(_e);const ke=De.data;if(te*this.stride>=ke.length)throw new Error(_e);const Ne=this.options.radius/(this.options.extent*Math.pow(2,he-1)),Ee=De.within(ke[te*this.stride],ke[te*this.stride+1],Ne),We=[];for(const Je of Ee){const Ge=Je*this.stride;ke[Ge+4]===re&&We.push(ke[Ge+Xe]>1?ht(ke,Ge,this.clusterProps):this.points[ke[Ge+Fe]])}if(We.length===0)throw new Error(_e);return We}getLeaves(re,te,he){const _e=[];return this._appendLeaves(_e,re,te=te||10,he=he||0,0),_e}getTile(re,te,he){const _e=this.trees[this._limitZoom(re)],De=Math.pow(2,re),{extent:ke,radius:Ne}=this.options,Ee=Ne/ke,We=(he-Ee)/De,Je=(he+1+Ee)/De,Ge={features:[]};return this._addTileFeatures(_e.range((te-Ee)/De,We,(te+1+Ee)/De,Je),_e.data,te,he,De,Ge),te===0&&this._addTileFeatures(_e.range(1-Ee/De,We,1,Je),_e.data,De,he,De,Ge),te===De-1&&this._addTileFeatures(_e.range(0,We,Ee/De,Je),_e.data,-1,he,De,Ge),Ge.features.length?Ge:null}getClusterExpansionZoom(re){let te=this._getOriginZoom(re)-1;for(;te<=this.options.maxZoom;){const he=this.getChildren(re);if(te++,he.length!==1)break;re=he[0].properties.cluster_id}return te}_appendLeaves(re,te,he,_e,De){const ke=this.getChildren(te);for(const Ne of ke){const Ee=Ne.properties;if(Ee&&Ee.cluster?De+Ee.point_count<=_e?De+=Ee.point_count:De=this._appendLeaves(re,Ee.cluster_id,he,_e,De):De<_e?De++:re.push(Ne),re.length===he)break}return De}_createTree(re){const te=new o.av(re.length/this.stride|0,this.options.nodeSize,Float32Array);for(let he=0;he<re.length;he+=this.stride)te.add(re[he],re[he+1]);return te.finish(),te.data=re,te}_addTileFeatures(re,te,he,_e,De,ke){for(const Ne of re){const Ee=Ne*this.stride,We=te[Ee+Xe]>1;let Je,Ge,ft;if(We)Je=ct(te,Ee,this.clusterProps),Ge=te[Ee],ft=te[Ee+1];else{const Or=this.points[te[Ee+Fe]];Je=Or.properties;const[dr,zr]=Or.geometry.coordinates;Ge=dt(dr),ft=Qe(zr)}const Wt={type:1,geometry:[[Math.round(this.options.extent*(Ge*De-he)),Math.round(this.options.extent*(ft*De-_e))]],tags:Je};let Xt;Xt=We||this.options.generateId?te[Ee+Fe]:this.points[te[Ee+Fe]].id,Xt!==void 0&&(Wt.id=Xt),ke.features.push(Wt)}}_limitZoom(re){return Math.max(this.options.minZoom,Math.min(Math.floor(+re),this.options.maxZoom+1))}_cluster(re,te){const{radius:he,extent:_e,reduce:De,minPoints:ke}=this.options,Ne=he/(_e*Math.pow(2,te)),Ee=re.data,We=[],Je=this.stride;for(let Ge=0;Ge<Ee.length;Ge+=Je){if(Ee[Ge+2]<=te)continue;Ee[Ge+2]=te;const ft=Ee[Ge],Wt=Ee[Ge+1],Xt=re.within(Ee[Ge],Ee[Ge+1],Ne),Or=Ee[Ge+Xe];let dr=Or;for(const zr of Xt){const Dr=zr*Je;Ee[Dr+2]>te&&(dr+=Ee[Dr+Xe])}if(dr>Or&&dr>=ke){let zr,Dr=ft*Or,Bn=Wt*Or,Sn=-1;const xr=((Ge/Je|0)<<5)+(te+1)+this.points.length;for(const jr of Xt){const _n=jr*Je;if(Ee[_n+2]<=te)continue;Ee[_n+2]=te;const Yn=Ee[_n+Xe];Dr+=Ee[_n]*Yn,Bn+=Ee[_n+1]*Yn,Ee[_n+4]=xr,De&&(zr||(zr=this._map(Ee,Ge,!0),Sn=this.clusterProps.length,this.clusterProps.push(zr)),De(zr,this._map(Ee,_n)))}Ee[Ge+4]=xr,We.push(Dr/dr,Bn/dr,1/0,xr,-1,dr),De&&We.push(Sn)}else{for(let zr=0;zr<Je;zr++)We.push(Ee[Ge+zr]);if(dr>1)for(const zr of Xt){const Dr=zr*Je;if(!(Ee[Dr+2]<=te)){Ee[Dr+2]=te;for(let Bn=0;Bn<Je;Bn++)We.push(Ee[Dr+Bn])}}}}return We}_getOriginId(re){return re-this.points.length>>5}_getOriginZoom(re){return(re-this.points.length)%32}_map(re,te,he){if(re[te+Xe]>1){const ke=this.clusterProps[re[te+it]];return he?Object.assign({},ke):ke}const _e=this.points[re[te+Fe]].properties,De=this.options.map(_e);return he&&De===_e?Object.assign({},De):De}}function ht(xe,re,te){return{type:"Feature",id:xe[re+Fe],properties:ct(xe,re,te),geometry:{type:"Point",coordinates:[(he=xe[re],360*(he-.5)),Dt(xe[re+1])]}};var he}function ct(xe,re,te){const he=xe[re+Xe],_e=he>=1e4?`${Math.round(he/1e3)}k`:he>=1e3?Math.round(he/100)/10+"k":he,De=xe[re+it],ke=De===-1?{}:Object.assign({},te[De]);return Object.assign(ke,{cluster:!0,cluster_id:xe[re+Fe],point_count:he,point_count_abbreviated:_e})}function dt(xe){return xe/360+.5}function Qe(xe){const re=Math.sin(xe*Math.PI/180),te=.5-.25*Math.log((1+re)/(1-re))/Math.PI;return te<0?0:te>1?1:te}function Dt(xe){const re=(180-360*xe)*Math.PI/180;return 360*Math.atan(Math.exp(re))/Math.PI-90}function wt(xe,re,te,he){let _e=he;const De=re+(te-re>>1);let ke,Ne=te-re;const Ee=xe[re],We=xe[re+1],Je=xe[te],Ge=xe[te+1];for(let ft=re+3;ft<te;ft+=3){const Wt=ot(xe[ft],xe[ft+1],Ee,We,Je,Ge);if(Wt>_e)ke=ft,_e=Wt;else if(Wt===_e){const Xt=Math.abs(ft-De);Xt<Ne&&(ke=ft,Ne=Xt)}}_e>he&&(ke-re>3&&wt(xe,re,ke,he),xe[ke+2]=_e,te-ke>3&&wt(xe,ke,te,he))}function ot(xe,re,te,he,_e,De){let ke=_e-te,Ne=De-he;if(ke!==0||Ne!==0){const Ee=((xe-te)*ke+(re-he)*Ne)/(ke*ke+Ne*Ne);Ee>1?(te=_e,he=De):Ee>0&&(te+=ke*Ee,he+=Ne*Ee)}return ke=xe-te,Ne=re-he,ke*ke+Ne*Ne}function St(xe,re,te,he){const _e={id:xe??null,type:re,geometry:te,tags:he,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(re==="Point"||re==="MultiPoint"||re==="LineString")tt(_e,te);else if(re==="Polygon")tt(_e,te[0]);else if(re==="MultiLineString")for(const De of te)tt(_e,De);else if(re==="MultiPolygon")for(const De of te)tt(_e,De[0]);return _e}function tt(xe,re){for(let te=0;te<re.length;te+=3)xe.minX=Math.min(xe.minX,re[te]),xe.minY=Math.min(xe.minY,re[te+1]),xe.maxX=Math.max(xe.maxX,re[te]),xe.maxY=Math.max(xe.maxY,re[te+1])}function kt(xe,re,te,he){if(!re.geometry)return;const _e=re.geometry.coordinates;if(_e&&_e.length===0)return;const De=re.geometry.type,ke=Math.pow(te.tolerance/((1<<te.maxZoom)*te.extent),2);let Ne=[],Ee=re.id;if(te.promoteId?Ee=re.properties[te.promoteId]:te.generateId&&(Ee=he||0),De==="Point")_r(_e,Ne);else if(De==="MultiPoint")for(const We of _e)_r(We,Ne);else if(De==="LineString")Le(_e,Ne,ke,!1);else if(De==="MultiLineString"){if(te.lineMetrics){for(const We of _e)Ne=[],Le(We,Ne,ke,!1),xe.push(St(Ee,"LineString",Ne,re.properties));return}Vr(_e,Ne,ke,!1)}else if(De==="Polygon")Vr(_e,Ne,ke,!0);else{if(De!=="MultiPolygon"){if(De==="GeometryCollection"){for(const We of re.geometry.geometries)kt(xe,{id:Ee,geometry:We,properties:re.properties},te,he);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const We of _e){const Je=[];Vr(We,Je,ke,!0),Ne.push(Je)}}xe.push(St(Ee,De,Ne,re.properties))}function _r(xe,re){re.push(yn(xe[0]),nt(xe[1]),0)}function Le(xe,re,te,he){let _e,De,ke=0;for(let Ee=0;Ee<xe.length;Ee++){const We=yn(xe[Ee][0]),Je=nt(xe[Ee][1]);re.push(We,Je,0),Ee>0&&(ke+=he?(_e*Je-We*De)/2:Math.sqrt(Math.pow(We-_e,2)+Math.pow(Je-De,2))),_e=We,De=Je}const Ne=re.length-3;re[2]=1,wt(re,0,Ne,te),re[Ne+2]=1,re.size=Math.abs(ke),re.start=0,re.end=re.size}function Vr(xe,re,te,he){for(let _e=0;_e<xe.length;_e++){const De=[];Le(xe[_e],De,te,he),re.push(De)}}function yn(xe){return xe/360+.5}function nt(xe){const re=Math.sin(xe*Math.PI/180),te=.5-.25*Math.log((1+re)/(1-re))/Math.PI;return te<0?0:te>1?1:te}function Nr(xe,re,te,he,_e,De,ke,Ne){if(he/=re,De>=(te/=re)&&ke<he)return xe;if(ke<te||De>=he)return null;const Ee=[];for(const We of xe){const Je=We.geometry;let Ge=We.type;const ft=_e===0?We.minX:We.minY,Wt=_e===0?We.maxX:We.maxY;if(ft>=te&&Wt<he){Ee.push(We);continue}if(Wt<te||ft>=he)continue;let Xt=[];if(Ge==="Point"||Ge==="MultiPoint")br(Je,Xt,te,he,_e);else if(Ge==="LineString")Ar(Je,Xt,te,he,_e,!1,Ne.lineMetrics);else if(Ge==="MultiLineString")fi(Je,Xt,te,he,_e,!1);else if(Ge==="Polygon")fi(Je,Xt,te,he,_e,!0);else if(Ge==="MultiPolygon")for(const Or of Je){const dr=[];fi(Or,dr,te,he,_e,!0),dr.length&&Xt.push(dr)}if(Xt.length){if(Ne.lineMetrics&&Ge==="LineString"){for(const Or of Xt)Ee.push(St(We.id,Ge,Or,We.tags));continue}Ge!=="LineString"&&Ge!=="MultiLineString"||(Xt.length===1?(Ge="LineString",Xt=Xt[0]):Ge="MultiLineString"),Ge!=="Point"&&Ge!=="MultiPoint"||(Ge=Xt.length===3?"Point":"MultiPoint"),Ee.push(St(We.id,Ge,Xt,We.tags))}}return Ee.length?Ee:null}function br(xe,re,te,he,_e){for(let De=0;De<xe.length;De+=3){const ke=xe[De+_e];ke>=te&&ke<=he&&kn(re,xe[De],xe[De+1],xe[De+2])}}function Ar(xe,re,te,he,_e,De,ke){let Ne=zn(xe);const Ee=_e===0?si:Tt;let We,Je,Ge=xe.start;for(let dr=0;dr<xe.length-3;dr+=3){const zr=xe[dr],Dr=xe[dr+1],Bn=xe[dr+2],Sn=xe[dr+3],xr=xe[dr+4],jr=_e===0?zr:Dr,_n=_e===0?Sn:xr;let Yn=!1;ke&&(We=Math.sqrt(Math.pow(zr-Sn,2)+Math.pow(Dr-xr,2))),jr<te?_n>te&&(Je=Ee(Ne,zr,Dr,Sn,xr,te),ke&&(Ne.start=Ge+We*Je)):jr>he?_n<he&&(Je=Ee(Ne,zr,Dr,Sn,xr,he),ke&&(Ne.start=Ge+We*Je)):kn(Ne,zr,Dr,Bn),_n<te&&jr>=te&&(Je=Ee(Ne,zr,Dr,Sn,xr,te),Yn=!0),_n>he&&jr<=he&&(Je=Ee(Ne,zr,Dr,Sn,xr,he),Yn=!0),!De&&Yn&&(ke&&(Ne.end=Ge+We*Je),re.push(Ne),Ne=zn(xe)),ke&&(Ge+=We)}let ft=xe.length-3;const Wt=xe[ft],Xt=xe[ft+1],Or=_e===0?Wt:Xt;Or>=te&&Or<=he&&kn(Ne,Wt,Xt,xe[ft+2]),ft=Ne.length-3,De&&ft>=3&&(Ne[ft]!==Ne[0]||Ne[ft+1]!==Ne[1])&&kn(Ne,Ne[0],Ne[1],Ne[2]),Ne.length&&re.push(Ne)}function zn(xe){const re=[];return re.size=xe.size,re.start=xe.start,re.end=xe.end,re}function fi(xe,re,te,he,_e,De){for(const ke of xe)Ar(ke,re,te,he,_e,De,!1)}function kn(xe,re,te,he){xe.push(re,te,he)}function si(xe,re,te,he,_e,De){const ke=(De-re)/(he-re);return kn(xe,De,te+(_e-te)*ke,1),ke}function Tt(xe,re,te,he,_e,De){const ke=(De-te)/(_e-te);return kn(xe,re+(he-re)*ke,De,1),ke}function $e(xe,re){const te=[];for(let he=0;he<xe.length;he++){const _e=xe[he],De=_e.type;let ke;if(De==="Point"||De==="MultiPoint"||De==="LineString")ke=er(_e.geometry,re);else if(De==="MultiLineString"||De==="Polygon"){ke=[];for(const Ne of _e.geometry)ke.push(er(Ne,re))}else if(De==="MultiPolygon"){ke=[];for(const Ne of _e.geometry){const Ee=[];for(const We of Ne)Ee.push(er(We,re));ke.push(Ee)}}te.push(St(_e.id,De,ke,_e.tags))}return te}function er(xe,re){const te=[];te.size=xe.size,xe.start!==void 0&&(te.start=xe.start,te.end=xe.end);for(let he=0;he<xe.length;he+=3)te.push(xe[he]+re,xe[he+1],xe[he+2]);return te}function sr(xe,re){if(xe.transformed)return xe;const te=1<<xe.z,he=xe.x,_e=xe.y;for(const De of xe.features){const ke=De.geometry,Ne=De.type;if(De.geometry=[],Ne===1)for(let Ee=0;Ee<ke.length;Ee+=2)De.geometry.push(Kr(ke[Ee],ke[Ee+1],re,te,he,_e));else for(let Ee=0;Ee<ke.length;Ee++){const We=[];for(let Je=0;Je<ke[Ee].length;Je+=2)We.push(Kr(ke[Ee][Je],ke[Ee][Je+1],re,te,he,_e));De.geometry.push(We)}}return xe.transformed=!0,xe}function Kr(xe,re,te,he,_e,De){return[Math.round(te*(xe*he-_e)),Math.round(te*(re*he-De))]}function Ln(xe,re,te,he,_e){const De=re===_e.maxZoom?0:_e.tolerance/((1<<re)*_e.extent),ke={features:[],numPoints:0,numSimplified:0,numFeatures:xe.length,source:null,x:te,y:he,z:re,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Ne of xe)ut(ke,Ne,De,_e);return ke}function ut(xe,re,te,he){const _e=re.geometry,De=re.type,ke=[];if(xe.minX=Math.min(xe.minX,re.minX),xe.minY=Math.min(xe.minY,re.minY),xe.maxX=Math.max(xe.maxX,re.maxX),xe.maxY=Math.max(xe.maxY,re.maxY),De==="Point"||De==="MultiPoint")for(let Ne=0;Ne<_e.length;Ne+=3)ke.push(_e[Ne],_e[Ne+1]),xe.numPoints++,xe.numSimplified++;else if(De==="LineString")hr(ke,_e,xe,te,!1,!1);else if(De==="MultiLineString"||De==="Polygon")for(let Ne=0;Ne<_e.length;Ne++)hr(ke,_e[Ne],xe,te,De==="Polygon",Ne===0);else if(De==="MultiPolygon")for(let Ne=0;Ne<_e.length;Ne++){const Ee=_e[Ne];for(let We=0;We<Ee.length;We++)hr(ke,Ee[We],xe,te,!0,We===0)}if(ke.length){let Ne=re.tags||null;if(De==="LineString"&&he.lineMetrics){Ne={};for(const We in re.tags)Ne[We]=re.tags[We];Ne.mapbox_clip_start=_e.start/_e.size,Ne.mapbox_clip_end=_e.end/_e.size}const Ee={geometry:ke,type:De==="Polygon"||De==="MultiPolygon"?3:De==="LineString"||De==="MultiLineString"?2:1,tags:Ne};re.id!==null&&(Ee.id=re.id),xe.features.push(Ee)}}function hr(xe,re,te,he,_e,De){const ke=he*he;if(he>0&&re.size<(_e?ke:he))return void(te.numPoints+=re.length/3);const Ne=[];for(let Ee=0;Ee<re.length;Ee+=3)(he===0||re[Ee+2]>ke)&&(te.numSimplified++,Ne.push(re[Ee],re[Ee+1])),te.numPoints++;_e&&function(Ee,We){let Je=0;for(let Ge=0,ft=Ee.length,Wt=ft-2;Ge<ft;Wt=Ge,Ge+=2)Je+=(Ee[Ge]-Ee[Wt])*(Ee[Ge+1]+Ee[Wt+1]);if(Je>0===We)for(let Ge=0,ft=Ee.length;Ge<ft/2;Ge+=2){const Wt=Ee[Ge],Xt=Ee[Ge+1];Ee[Ge]=Ee[ft-2-Ge],Ee[Ge+1]=Ee[ft-1-Ge],Ee[ft-2-Ge]=Wt,Ee[ft-1-Ge]=Xt}}(Ne,De),xe.push(Ne)}const Qt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class pi{constructor(re,te){const he=(te=this.options=function(De,ke){for(const Ne in ke)De[Ne]=ke[Ne];return De}(Object.create(Qt),te)).debug;if(he&&console.time("preprocess data"),te.maxZoom<0||te.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(te.promoteId&&te.generateId)throw new Error("promoteId and generateId cannot be used together.");let _e=function(De,ke){const Ne=[];if(De.type==="FeatureCollection")for(let Ee=0;Ee<De.features.length;Ee++)kt(Ne,De.features[Ee],ke,Ee);else kt(Ne,De.type==="Feature"?De:{geometry:De},ke);return Ne}(re,te);this.tiles={},this.tileCoords=[],he&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",te.indexMaxZoom,te.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),_e=function(De,ke){const Ne=ke.buffer/ke.extent;let Ee=De;const We=Nr(De,1,-1-Ne,Ne,0,-1,2,ke),Je=Nr(De,1,1-Ne,2+Ne,0,-1,2,ke);return(We||Je)&&(Ee=Nr(De,1,-Ne,1+Ne,0,-1,2,ke)||[],We&&(Ee=$e(We,1).concat(Ee)),Je&&(Ee=Ee.concat($e(Je,-1)))),Ee}(_e,te),_e.length&&this.splitTile(_e,0,0,0),he&&(_e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(re,te,he,_e,De,ke,Ne){const Ee=[re,te,he,_e],We=this.options,Je=We.debug;for(;Ee.length;){_e=Ee.pop(),he=Ee.pop(),te=Ee.pop(),re=Ee.pop();const Ge=1<<te,ft=la(te,he,_e);let Wt=this.tiles[ft];if(!Wt&&(Je>1&&console.time("creation"),Wt=this.tiles[ft]=Ln(re,te,he,_e,We),this.tileCoords.push({z:te,x:he,y:_e}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",te,he,_e,Wt.numFeatures,Wt.numPoints,Wt.numSimplified),console.timeEnd("creation"));const Yn=`z${te}`;this.stats[Yn]=(this.stats[Yn]||0)+1,this.total++}if(Wt.source=re,De==null){if(te===We.indexMaxZoom||Wt.numPoints<=We.indexMaxPoints)continue}else{if(te===We.maxZoom||te===De)continue;if(De!=null){const Yn=De-te;if(he!==ke>>Yn||_e!==Ne>>Yn)continue}}if(Wt.source=null,re.length===0)continue;Je>1&&console.time("clipping");const Xt=.5*We.buffer/We.extent,Or=.5-Xt,dr=.5+Xt,zr=1+Xt;let Dr=null,Bn=null,Sn=null,xr=null,jr=Nr(re,Ge,he-Xt,he+dr,0,Wt.minX,Wt.maxX,We),_n=Nr(re,Ge,he+Or,he+zr,0,Wt.minX,Wt.maxX,We);re=null,jr&&(Dr=Nr(jr,Ge,_e-Xt,_e+dr,1,Wt.minY,Wt.maxY,We),Bn=Nr(jr,Ge,_e+Or,_e+zr,1,Wt.minY,Wt.maxY,We),jr=null),_n&&(Sn=Nr(_n,Ge,_e-Xt,_e+dr,1,Wt.minY,Wt.maxY,We),xr=Nr(_n,Ge,_e+Or,_e+zr,1,Wt.minY,Wt.maxY,We),_n=null),Je>1&&console.timeEnd("clipping"),Ee.push(Dr||[],te+1,2*he,2*_e),Ee.push(Bn||[],te+1,2*he,2*_e+1),Ee.push(Sn||[],te+1,2*he+1,2*_e),Ee.push(xr||[],te+1,2*he+1,2*_e+1)}}getTile(re,te,he){re=+re,te=+te,he=+he;const _e=this.options,{extent:De,debug:ke}=_e;if(re<0||re>24)return null;const Ne=1<<re,Ee=la(re,te=te+Ne&Ne-1,he);if(this.tiles[Ee])return sr(this.tiles[Ee],De);ke>1&&console.log("drilling down to z%d-%d-%d",re,te,he);let We,Je=re,Ge=te,ft=he;for(;!We&&Je>0;)Je--,Ge>>=1,ft>>=1,We=this.tiles[la(Je,Ge,ft)];return We&&We.source?(ke>1&&(console.log("found parent tile z%d-%d-%d",Je,Ge,ft),console.time("drilling down")),this.splitTile(We.source,Je,Ge,ft,re,te,he),ke>1&&console.timeEnd("drilling down"),this.tiles[Ee]?sr(this.tiles[Ee],De):null):null}}function la(xe,re,te){return 32*((1<<xe)*te+re)+xe}function Lt(xe,re){return re?xe.properties[re]:xe.id}function Di(xe,re){if(xe==null)return!0;if(xe.type==="Feature")return Lt(xe,re)!=null;if(xe.type==="FeatureCollection"){const te=new Set;for(const he of xe.features){const _e=Lt(he,re);if(_e==null||te.has(_e))return!1;te.add(_e)}return!0}return!1}function Mi(xe,re){const te=new Map;if(xe!=null)if(xe.type==="Feature")te.set(Lt(xe,re),xe);else for(const he of xe.features)te.set(Lt(he,re),he);return te}class Co extends f{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(re,te){return o._(this,void 0,void 0,function*(){const he=re.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const _e=this._geoJSONIndex.getTile(he.z,he.x,he.y);if(!_e)return null;const De=new class{constructor(Ne){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.X,this.length=Ne.length,this._features=Ne}feature(Ne){return new class{constructor(Ee){this._feature=Ee,this.extent=o.X,this.type=Ee.type,this.properties=Ee.tags,"id"in Ee&&!isNaN(Ee.id)&&(this.id=parseInt(Ee.id,10))}loadGeometry(){if(this._feature.type===1){const Ee=[];for(const We of this._feature.geometry)Ee.push([new o.P(We[0],We[1])]);return Ee}{const Ee=[];for(const We of this._feature.geometry){const Je=[];for(const Ge of We)Je.push(new o.P(Ge[0],Ge[1]));Ee.push(Je)}return Ee}}toGeoJSON(Ee,We,Je){return w.call(this,Ee,We,Je)}}(this._features[Ne])}}(_e.features);let ke=pe(De);return ke.byteOffset===0&&ke.byteLength===ke.buffer.byteLength||(ke=new Uint8Array(ke)),{vectorTile:De,rawData:ke.buffer}})}loadData(re){return o._(this,void 0,void 0,function*(){var te;(te=this._pendingRequest)===null||te===void 0||te.abort();const he=!!(re&&re.request&&re.request.collectResourceTiming)&&new o.bv(re.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(re,this._pendingRequest),this._geoJSONIndex=re.cluster?new at(function({superclusterOptions:ke,clusterProperties:Ne}){if(!Ne||!ke)return ke;const Ee={},We={},Je={accumulated:null,zoom:0},Ge={properties:null},ft=Object.keys(Ne);for(const Wt of ft){const[Xt,Or]=Ne[Wt],dr=o.bC(Or),zr=o.bC(typeof Xt=="string"?[Xt,["accumulated"],["get",Wt]]:Xt);Ee[Wt]=dr.value,We[Wt]=zr.value}return ke.map=Wt=>{Ge.properties=Wt;const Xt={};for(const Or of ft)Xt[Or]=Ee[Or].evaluate(Je,Ge);return Xt},ke.reduce=(Wt,Xt)=>{Ge.properties=Xt;for(const Or of ft)Je.accumulated=Wt[Or],Wt[Or]=We[Or].evaluate(Je,Ge)},ke}(re)).load((yield this._pendingData).features):(_e=yield this._pendingData,new pi(_e,re.geojsonVtOptions)),this.loaded={};const De={};if(he){const ke=he.finish();ke&&(De.resourceTiming={},De.resourceTiming[re.source]=JSON.parse(JSON.stringify(ke)))}return De}catch(De){if(delete this._pendingRequest,o.bB(De))return{abandoned:!0};throw De}var _e})}getData(){return o._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(re){const te=this.loaded;return te&&te[re.uid]?super.reloadTile(re):this.loadTile(re)}loadAndProcessGeoJSON(re,te){return o._(this,void 0,void 0,function*(){let he=yield this.loadGeoJSON(re,te);if(delete this._pendingRequest,typeof he!="object")throw new Error(`Input data given to '${re.source}' is not a valid GeoJSON object.`);if(x(he,!0),re.filter){const _e=o.bC(re.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(_e.result==="error")throw new Error(_e.value.map(ke=>`${ke.key}: ${ke.message}`).join(", "));he={type:"FeatureCollection",features:he.features.filter(ke=>_e.value.evaluate({zoom:0},ke))}}return he})}loadGeoJSON(re,te){return o._(this,void 0,void 0,function*(){const{promoteId:he}=re;if(re.request){const _e=yield o.h(re.request,te);return this._dataUpdateable=Di(_e.data,he)?Mi(_e.data,he):void 0,_e.data}if(typeof re.data=="string")try{const _e=JSON.parse(re.data);return this._dataUpdateable=Di(_e,he)?Mi(_e,he):void 0,_e}catch{throw new Error(`Input data given to '${re.source}' is not a valid GeoJSON object.`)}if(!re.dataDiff)throw new Error(`Input data given to '${re.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${re.source}`);return function(_e,De,ke){var Ne,Ee,We,Je;if(De.removeAll&&_e.clear(),De.remove)for(const Ge of De.remove)_e.delete(Ge);if(De.add)for(const Ge of De.add){const ft=Lt(Ge,ke);ft!=null&&_e.set(ft,Ge)}if(De.update)for(const Ge of De.update){let ft=_e.get(Ge.id);if(ft==null)continue;const Wt=!Ge.removeAllProperties&&(((Ne=Ge.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0||((Ee=Ge.addOrUpdateProperties)===null||Ee===void 0?void 0:Ee.length)>0);if((Ge.newGeometry||Ge.removeAllProperties||Wt)&&(ft=Object.assign({},ft),_e.set(Ge.id,ft),Wt&&(ft.properties=Object.assign({},ft.properties))),Ge.newGeometry&&(ft.geometry=Ge.newGeometry),Ge.removeAllProperties)ft.properties={};else if(((We=Ge.removeProperties)===null||We===void 0?void 0:We.length)>0)for(const Xt of Ge.removeProperties)Object.prototype.hasOwnProperty.call(ft.properties,Xt)&&delete ft.properties[Xt];if(((Je=Ge.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Xt,value:Or}of Ge.addOrUpdateProperties)ft.properties[Xt]=Or}}(this._dataUpdateable,re.dataDiff,he),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(re){return o._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(re){return this._geoJSONIndex.getClusterExpansionZoom(re.clusterId)}getClusterChildren(re){return this._geoJSONIndex.getChildren(re.clusterId)}getClusterLeaves(re){return this._geoJSONIndex.getLeaves(re.clusterId,re.limit,re.offset)}}class Ao{constructor(re){this.self=re,this.actor=new o.F(re),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(te,he)=>{if(this.externalWorkerSourceTypes[te])throw new Error(`Worker source with name "${te}" already registered.`);this.externalWorkerSourceTypes[te]=he},this.self.addProtocol=o.bi,this.self.removeProtocol=o.bj,this.self.registerRTLTextPlugin=te=>{if(o.bD.isParsed())throw new Error("RTL text plugin already registered.");o.bD.setMethods(te)},this.actor.registerMessageHandler("LDT",(te,he)=>this._getDEMWorkerSource(te,he.source).loadTile(he)),this.actor.registerMessageHandler("RDT",(te,he)=>o._(this,void 0,void 0,function*(){this._getDEMWorkerSource(te,he.source).removeTile(he)})),this.actor.registerMessageHandler("GCEZ",(te,he)=>o._(this,void 0,void 0,function*(){return this._getWorkerSource(te,he.type,he.source).getClusterExpansionZoom(he)})),this.actor.registerMessageHandler("GCC",(te,he)=>o._(this,void 0,void 0,function*(){return this._getWorkerSource(te,he.type,he.source).getClusterChildren(he)})),this.actor.registerMessageHandler("GCL",(te,he)=>o._(this,void 0,void 0,function*(){return this._getWorkerSource(te,he.type,he.source).getClusterLeaves(he)})),this.actor.registerMessageHandler("LD",(te,he)=>this._getWorkerSource(te,he.type,he.source).loadData(he)),this.actor.registerMessageHandler("GD",(te,he)=>this._getWorkerSource(te,he.type,he.source).getData()),this.actor.registerMessageHandler("LT",(te,he)=>this._getWorkerSource(te,he.type,he.source).loadTile(he)),this.actor.registerMessageHandler("RT",(te,he)=>this._getWorkerSource(te,he.type,he.source).reloadTile(he)),this.actor.registerMessageHandler("AT",(te,he)=>this._getWorkerSource(te,he.type,he.source).abortTile(he)),this.actor.registerMessageHandler("RMT",(te,he)=>this._getWorkerSource(te,he.type,he.source).removeTile(he)),this.actor.registerMessageHandler("RS",(te,he)=>o._(this,void 0,void 0,function*(){if(!this.workerSources[te]||!this.workerSources[te][he.type]||!this.workerSources[te][he.type][he.source])return;const _e=this.workerSources[te][he.type][he.source];delete this.workerSources[te][he.type][he.source],_e.removeSource!==void 0&&_e.removeSource(he)})),this.actor.registerMessageHandler("RM",te=>o._(this,void 0,void 0,function*(){delete this.layerIndexes[te],delete this.availableImages[te],delete this.workerSources[te],delete this.demWorkerSources[te]})),this.actor.registerMessageHandler("SR",(te,he)=>o._(this,void 0,void 0,function*(){this.referrer=he})),this.actor.registerMessageHandler("SRPS",(te,he)=>this._syncRTLPluginState(te,he)),this.actor.registerMessageHandler("IS",(te,he)=>o._(this,void 0,void 0,function*(){this.self.importScripts(he)})),this.actor.registerMessageHandler("SI",(te,he)=>this._setImages(te,he)),this.actor.registerMessageHandler("UL",(te,he)=>o._(this,void 0,void 0,function*(){this._getLayerIndex(te).update(he.layers,he.removedIds)})),this.actor.registerMessageHandler("SL",(te,he)=>o._(this,void 0,void 0,function*(){this._getLayerIndex(te).replace(he)}))}_setImages(re,te){return o._(this,void 0,void 0,function*(){this.availableImages[re]=te;for(const he in this.workerSources[re]){const _e=this.workerSources[re][he];for(const De in _e)_e[De].availableImages=te}})}_syncRTLPluginState(re,te){return o._(this,void 0,void 0,function*(){if(o.bD.isParsed())return o.bD.getState();if(te.pluginStatus!=="loading")return o.bD.setState(te),te;const he=te.pluginURL;if(this.self.importScripts(he),o.bD.isParsed()){const _e={pluginStatus:"loaded",pluginURL:he};return o.bD.setState(_e),_e}throw o.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${he}`)})}_getAvailableImages(re){let te=this.availableImages[re];return te||(te=[]),te}_getLayerIndex(re){let te=this.layerIndexes[re];return te||(te=this.layerIndexes[re]=new s),te}_getWorkerSource(re,te,he){if(this.workerSources[re]||(this.workerSources[re]={}),this.workerSources[re][te]||(this.workerSources[re][te]={}),!this.workerSources[re][te][he]){const _e={sendAsync:(De,ke)=>(De.targetMapId=re,this.actor.sendAsync(De,ke))};switch(te){case"vector":this.workerSources[re][te][he]=new f(_e,this._getLayerIndex(re),this._getAvailableImages(re));break;case"geojson":this.workerSources[re][te][he]=new Co(_e,this._getLayerIndex(re),this._getAvailableImages(re));break;default:this.workerSources[re][te][he]=new this.externalWorkerSourceTypes[te](_e,this._getLayerIndex(re),this._getAvailableImages(re))}}return this.workerSources[re][te][he]}_getDEMWorkerSource(re,te){return this.demWorkerSources[re]||(this.demWorkerSources[re]={}),this.demWorkerSources[re][te]||(this.demWorkerSources[re][te]=new g),this.demWorkerSources[re][te]}}return o.i(self)&&(self.worker=new Ao(self)),Ao}),i("index",["exports","./shared"],function(o,s){var l="4.7.1";let c,d;const f={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:D=>new Promise((u,y)=>{const S=requestAnimationFrame(u);D.signal.addEventListener("abort",()=>{cancelAnimationFrame(S),y(s.c())})}),getImageData(D,u=0){return this.getImageCanvasContext(D).getImageData(-u,-u,D.width+2*u,D.height+2*u)},getImageCanvasContext(D){const u=window.document.createElement("canvas"),y=u.getContext("2d",{willReadFrequently:!0});if(!y)throw new Error("failed to create canvas 2d context");return u.width=D.width,u.height=D.height,y.drawImage(D,0,0,D.width,D.height),y},resolveURL:D=>(c||(c=document.createElement("a")),c.href=D,c.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(d==null&&(d=matchMedia("(prefers-reduced-motion: reduce)")),d.matches)}};class g{static testProp(u){if(!g.docStyle)return u[0];for(let y=0;y<u.length;y++)if(u[y]in g.docStyle)return u[y];return u[0]}static create(u,y,S){const T=window.document.createElement(u);return y!==void 0&&(T.className=y),S&&S.appendChild(T),T}static createNS(u,y){return window.document.createElementNS(u,y)}static disableDrag(){g.docStyle&&g.selectProp&&(g.userSelect=g.docStyle[g.selectProp],g.docStyle[g.selectProp]="none")}static enableDrag(){g.docStyle&&g.selectProp&&(g.docStyle[g.selectProp]=g.userSelect)}static setTransform(u,y){u.style[g.transformProp]=y}static addEventListener(u,y,S,T={}){u.addEventListener(y,S,"passive"in T?T:T.capture)}static removeEventListener(u,y,S,T={}){u.removeEventListener(y,S,"passive"in T?T:T.capture)}static suppressClickInternal(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",g.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",g.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",g.suppressClickInternal,!0)},0)}static getScale(u){const y=u.getBoundingClientRect();return{x:y.width/u.offsetWidth||1,y:y.height/u.offsetHeight||1,boundingClientRect:y}}static getPoint(u,y,S){const T=y.boundingClientRect;return new s.P((S.clientX-T.left)/y.x-u.clientLeft,(S.clientY-T.top)/y.y-u.clientTop)}static mousePos(u,y){const S=g.getScale(u);return g.getPoint(u,S,y)}static touchPos(u,y){const S=[],T=g.getScale(u);for(let A=0;A<y.length;A++)S.push(g.getPoint(u,T,y[A]));return S}static mouseButton(u){return u.button}static remove(u){u.parentNode&&u.parentNode.removeChild(u)}}g.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,g.selectProp=g.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),g.transformProp=g.testProp(["transform","WebkitTransform"]);const m={supported:!1,testSupport:function(D){!w&&x&&(C?M(D):_=D)}};let _,x,w=!1,C=!1;function M(D){const u=D.createTexture();D.bindTexture(D.TEXTURE_2D,u);try{if(D.texImage2D(D.TEXTURE_2D,0,D.RGBA,D.RGBA,D.UNSIGNED_BYTE,x),D.isContextLost())return;m.supported=!0}catch{}D.deleteTexture(u),w=!0}var L;typeof document<"u"&&(x=document.createElement("img"),x.onload=()=>{_&&M(_),_=null,C=!0},x.onerror=()=>{w=!0,_=null},x.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(D){let u,y,S,T;D.resetRequestQueue=()=>{u=[],y=0,S=0,T={}},D.addThrottleControl=$=>{const q=S++;return T[q]=$,q},D.removeThrottleControl=$=>{delete T[$],N()},D.getImage=($,q,K=!0)=>new Promise((J,ae)=>{m.supported&&($.headers||($.headers={}),$.headers.accept="image/webp,*/*"),s.e($,{type:"image"}),u.push({abortController:q,requestParameters:$,supportImageRefresh:K,state:"queued",onError:ue=>{ae(ue)},onSuccess:ue=>{J(ue)}}),N()});const A=$=>s._(this,void 0,void 0,function*(){$.state="running";const{requestParameters:q,supportImageRefresh:K,onError:J,onSuccess:ae,abortController:ue}=$,fe=K===!1&&!s.i(self)&&!s.g(q.url)&&(!q.headers||Object.keys(q.headers).reduce((Te,Ce)=>Te&&Ce==="accept",!0));y++;const be=fe?B(q,ue):s.m(q,ue);try{const Te=yield be;delete $.abortController,$.state="completed",Te.data instanceof HTMLImageElement||s.b(Te.data)?ae(Te):Te.data&&ae({data:yield(Se=Te.data,typeof createImageBitmap=="function"?s.d(Se):s.f(Se)),cacheControl:Te.cacheControl,expires:Te.expires})}catch(Te){delete $.abortController,J(Te)}finally{y--,N()}var Se}),N=()=>{const $=(()=>{for(const q of Object.keys(T))if(T[q]())return!0;return!1})()?s.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:s.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let q=y;q<$&&u.length>0;q++){const K=u.shift();K.abortController.signal.aborted?q--:A(K)}},B=($,q)=>new Promise((K,J)=>{const ae=new Image,ue=$.url,fe=$.credentials;fe&&fe==="include"?ae.crossOrigin="use-credentials":(fe&&fe==="same-origin"||!s.s(ue))&&(ae.crossOrigin="anonymous"),q.signal.addEventListener("abort",()=>{ae.src="",J(s.c())}),ae.fetchPriority="high",ae.onload=()=>{ae.onerror=ae.onload=null,K({data:ae})},ae.onerror=()=>{ae.onerror=ae.onload=null,q.signal.aborted||J(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."))},ae.src=ue})}(L||(L={})),L.resetRequestQueue();class O{constructor(u){this._transformRequestFn=u}transformRequest(u,y){return this._transformRequestFn&&this._transformRequestFn(u,y)||{url:u}}setTransformRequest(u){this._transformRequestFn=u}}function F(D){var u=new s.A(3);return u[0]=D[0],u[1]=D[1],u[2]=D[2],u}var V,U=function(D,u,y){return D[0]=u[0]-y[0],D[1]=u[1]-y[1],D[2]=u[2]-y[2],D};V=new s.A(3),s.A!=Float32Array&&(V[0]=0,V[1]=0,V[2]=0);var H=function(D){var u=D[0],y=D[1];return u*u+y*y};function Z(D){const u=[];if(typeof D=="string")u.push({id:"default",url:D});else if(D&&D.length>0){const y=[];for(const{id:S,url:T}of D){const A=`${S}${T}`;y.indexOf(A)===-1&&(y.push(A),u.push({id:S,url:T}))}}return u}function Y(D,u,y){const S=D.split("?");return S[0]+=`${u}${y}`,S.join("?")}(function(){var D=new s.A(2);s.A!=Float32Array&&(D[0]=0,D[1]=0)})();class X{constructor(u,y,S,T){this.context=u,this.format=S,this.texture=u.gl.createTexture(),this.update(y,T)}update(u,y,S){const{width:T,height:A}=u,N=!(this.size&&this.size[0]===T&&this.size[1]===A||S),{context:B}=this,{gl:$}=B;if(this.useMipmap=!!(y&&y.useMipmap),$.bindTexture($.TEXTURE_2D,this.texture),B.pixelStoreUnpackFlipY.set(!1),B.pixelStoreUnpack.set(1),B.pixelStoreUnpackPremultiplyAlpha.set(this.format===$.RGBA&&(!y||y.premultiply!==!1)),N)this.size=[T,A],u instanceof HTMLImageElement||u instanceof HTMLCanvasElement||u instanceof HTMLVideoElement||u instanceof ImageData||s.b(u)?$.texImage2D($.TEXTURE_2D,0,this.format,this.format,$.UNSIGNED_BYTE,u):$.texImage2D($.TEXTURE_2D,0,this.format,T,A,0,this.format,$.UNSIGNED_BYTE,u.data);else{const{x:q,y:K}=S||{x:0,y:0};u instanceof HTMLImageElement||u instanceof HTMLCanvasElement||u instanceof HTMLVideoElement||u instanceof ImageData||s.b(u)?$.texSubImage2D($.TEXTURE_2D,0,q,K,$.RGBA,$.UNSIGNED_BYTE,u):$.texSubImage2D($.TEXTURE_2D,0,q,K,T,A,$.RGBA,$.UNSIGNED_BYTE,u.data)}this.useMipmap&&this.isSizePowerOfTwo()&&$.generateMipmap($.TEXTURE_2D)}bind(u,y,S){const{context:T}=this,{gl:A}=T;A.bindTexture(A.TEXTURE_2D,this.texture),S!==A.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(S=A.LINEAR),u!==this.filter&&(A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,u),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,S||u),this.filter=u),y!==this.wrap&&(A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,y),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,y),this.wrap=y)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:u}=this.context;u.deleteTexture(this.texture),this.texture=null}}function ie(D){const{userImage:u}=D;return!!(u&&u.render&&u.render())&&(D.data.replace(new Uint8Array(u.data.buffer)),!0)}class oe extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new s.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(u){if(this.loaded!==u&&(this.loaded=u,u)){for(const{ids:y,promiseResolve:S}of this.requestors)S(this._getImagesForIds(y));this.requestors=[]}}getImage(u){const y=this.images[u];if(y&&!y.data&&y.spriteData){const S=y.spriteData;y.data=new s.R({width:S.width,height:S.height},S.context.getImageData(S.x,S.y,S.width,S.height).data),y.spriteData=null}return y}addImage(u,y){if(this.images[u])throw new Error(`Image id ${u} already exist, use updateImage instead`);this._validate(u,y)&&(this.images[u]=y)}_validate(u,y){let S=!0;const T=y.data||y.spriteData;return this._validateStretch(y.stretchX,T&&T.width)||(this.fire(new s.j(new Error(`Image "${u}" has invalid "stretchX" value`))),S=!1),this._validateStretch(y.stretchY,T&&T.height)||(this.fire(new s.j(new Error(`Image "${u}" has invalid "stretchY" value`))),S=!1),this._validateContent(y.content,y)||(this.fire(new s.j(new Error(`Image "${u}" has invalid "content" value`))),S=!1),S}_validateStretch(u,y){if(!u)return!0;let S=0;for(const T of u){if(T[0]<S||T[1]<T[0]||y<T[1])return!1;S=T[1]}return!0}_validateContent(u,y){if(!u)return!0;if(u.length!==4)return!1;const S=y.spriteData,T=S&&S.width||y.data.width,A=S&&S.height||y.data.height;return!(u[0]<0||T<u[0]||u[1]<0||A<u[1]||u[2]<0||T<u[2]||u[3]<0||A<u[3]||u[2]<u[0]||u[3]<u[1])}updateImage(u,y,S=!0){const T=this.getImage(u);if(S&&(T.data.width!==y.data.width||T.data.height!==y.data.height))throw new Error(`size mismatch between old image (${T.data.width}x${T.data.height}) and new image (${y.data.width}x${y.data.height}).`);y.version=T.version+1,this.images[u]=y,this.updatedImages[u]=!0}removeImage(u){const y=this.images[u];delete this.images[u],delete this.patterns[u],y.userImage&&y.userImage.onRemove&&y.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(u){return new Promise((y,S)=>{let T=!0;if(!this.isLoaded())for(const A of u)this.images[A]||(T=!1);this.isLoaded()||T?y(this._getImagesForIds(u)):this.requestors.push({ids:u,promiseResolve:y})})}_getImagesForIds(u){const y={};for(const S of u){let T=this.getImage(S);T||(this.fire(new s.k("styleimagemissing",{id:S})),T=this.getImage(S)),T?y[S]={data:T.data.clone(),pixelRatio:T.pixelRatio,sdf:T.sdf,version:T.version,stretchX:T.stretchX,stretchY:T.stretchY,content:T.content,textFitWidth:T.textFitWidth,textFitHeight:T.textFitHeight,hasRenderCallback:!!(T.userImage&&T.userImage.render)}:s.w(`Image "${S}" 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 y}getPixelSize(){const{width:u,height:y}=this.atlasImage;return{width:u,height:y}}getPattern(u){const y=this.patterns[u],S=this.getImage(u);if(!S)return null;if(y&&y.position.version===S.version)return y.position;if(y)y.position.version=S.version;else{const T={w:S.data.width+2,h:S.data.height+2,x:0,y:0},A=new s.I(T,S);this.patterns[u]={bin:T,position:A}}return this._updatePatternAtlas(),this.patterns[u].position}bind(u){const y=u.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new X(u,this.atlasImage,y.RGBA),this.atlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE)}_updatePatternAtlas(){const u=[];for(const A in this.patterns)u.push(this.patterns[A].bin);const{w:y,h:S}=s.p(u),T=this.atlasImage;T.resize({width:y||1,height:S||1});for(const A in this.patterns){const{bin:N}=this.patterns[A],B=N.x+1,$=N.y+1,q=this.getImage(A).data,K=q.width,J=q.height;s.R.copy(q,T,{x:0,y:0},{x:B,y:$},{width:K,height:J}),s.R.copy(q,T,{x:0,y:J-1},{x:B,y:$-1},{width:K,height:1}),s.R.copy(q,T,{x:0,y:0},{x:B,y:$+J},{width:K,height:1}),s.R.copy(q,T,{x:K-1,y:0},{x:B-1,y:$},{width:1,height:J}),s.R.copy(q,T,{x:0,y:0},{x:B+K,y:$},{width:1,height:J})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(u){for(const y of u){if(this.callbackDispatchedThisFrame[y])continue;this.callbackDispatchedThisFrame[y]=!0;const S=this.getImage(y);S||s.w(`Image with ID: "${y}" was not found`),ie(S)&&this.updateImage(y,S)}}}const le=1e20;function de(D,u,y,S,T,A,N,B,$){for(let q=u;q<u+S;q++)ge(D,y*A+q,A,T,N,B,$);for(let q=y;q<y+T;q++)ge(D,q*A+u,1,S,N,B,$)}function ge(D,u,y,S,T,A,N){A[0]=0,N[0]=-le,N[1]=le,T[0]=D[u];for(let B=1,$=0,q=0;B<S;B++){T[B]=D[u+B*y];const K=B*B;do{const J=A[$];q=(T[B]-T[J]+K-J*J)/(B-J)/2}while(q<=N[$]&&--$>-1);$++,A[$]=B,N[$]=q,N[$+1]=le}for(let B=0,$=0;B<S;B++){for(;N[$+1]<B;)$++;const q=A[$],K=B-q;D[u+B*y]=T[q]+K*K}}class pe{constructor(u,y){this.requestManager=u,this.localIdeographFontFamily=y,this.entries={}}setURL(u){this.url=u}getGlyphs(u){return s._(this,void 0,void 0,function*(){const y=[];for(const A in u)for(const N of u[A])y.push(this._getAndCacheGlyphsPromise(A,N));const S=yield Promise.all(y),T={};for(const{stack:A,id:N,glyph:B}of S)T[A]||(T[A]={}),T[A][N]=B&&{id:B.id,bitmap:B.bitmap.clone(),metrics:B.metrics};return T})}_getAndCacheGlyphsPromise(u,y){return s._(this,void 0,void 0,function*(){let S=this.entries[u];S||(S=this.entries[u]={glyphs:{},requests:{},ranges:{}});let T=S.glyphs[y];if(T!==void 0)return{stack:u,id:y,glyph:T};if(T=this._tinySDF(S,u,y),T)return S.glyphs[y]=T,{stack:u,id:y,glyph:T};const A=Math.floor(y/256);if(256*A>65535)throw new Error("glyphs > 65535 not supported");if(S.ranges[A])return{stack:u,id:y,glyph:T};if(!this.url)throw new Error("glyphsUrl is not set");if(!S.requests[A]){const B=pe.loadGlyphRange(u,A,this.url,this.requestManager);S.requests[A]=B}const N=yield S.requests[A];for(const B in N)this._doesCharSupportLocalGlyph(+B)||(S.glyphs[+B]=N[+B]);return S.ranges[A]=!0,{stack:u,id:y,glyph:N[y]||null}})}_doesCharSupportLocalGlyph(u){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(u))}_tinySDF(u,y,S){const T=this.localIdeographFontFamily;if(!T||!this._doesCharSupportLocalGlyph(S))return;let A=u.tinySDF;if(!A){let B="400";/bold/i.test(y)?B="900":/medium/i.test(y)?B="500":/light/i.test(y)&&(B="200"),A=u.tinySDF=new pe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:T,fontWeight:B})}const N=A.draw(String.fromCharCode(S));return{id:S,bitmap:new s.o({width:N.width||60,height:N.height||60},N.data),metrics:{width:N.glyphWidth/2||24,height:N.glyphHeight/2||24,left:N.glyphLeft/2+.5||0,top:N.glyphTop/2-27.5||-8,advance:N.glyphAdvance/2||24,isDoubleResolution:!0}}}}pe.loadGlyphRange=function(D,u,y,S){return s._(this,void 0,void 0,function*(){const T=256*u,A=T+255,N=S.transformRequest(y.replace("{fontstack}",D).replace("{range}",`${T}-${A}`),"Glyphs"),B=yield s.l(N,new AbortController);if(!B||!B.data)throw new Error(`Could not load glyph range. range: ${u}, ${T}-${A}`);const $={};for(const q of s.n(B.data))$[q.id]=q;return $})},pe.TinySDF=class{constructor({fontSize:D=24,buffer:u=3,radius:y=8,cutoff:S=.25,fontFamily:T="sans-serif",fontWeight:A="normal",fontStyle:N="normal"}={}){this.buffer=u,this.cutoff=S,this.radius=y;const B=this.size=D+4*u,$=this._createCanvas(B),q=this.ctx=$.getContext("2d",{willReadFrequently:!0});q.font=`${N} ${A} ${D}px ${T}`,q.textBaseline="alphabetic",q.textAlign="left",q.fillStyle="black",this.gridOuter=new Float64Array(B*B),this.gridInner=new Float64Array(B*B),this.f=new Float64Array(B),this.z=new Float64Array(B+1),this.v=new Uint16Array(B)}_createCanvas(D){const u=document.createElement("canvas");return u.width=u.height=D,u}draw(D){const{width:u,actualBoundingBoxAscent:y,actualBoundingBoxDescent:S,actualBoundingBoxLeft:T,actualBoundingBoxRight:A}=this.ctx.measureText(D),N=Math.ceil(y),B=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(A-T))),$=Math.min(this.size-this.buffer,N+Math.ceil(S)),q=B+2*this.buffer,K=$+2*this.buffer,J=Math.max(q*K,0),ae=new Uint8ClampedArray(J),ue={data:ae,width:q,height:K,glyphWidth:B,glyphHeight:$,glyphTop:N,glyphLeft:0,glyphAdvance:u};if(B===0||$===0)return ue;const{ctx:fe,buffer:be,gridInner:Se,gridOuter:Te}=this;fe.clearRect(be,be,B,$),fe.fillText(D,be,be+N);const Ce=fe.getImageData(be,be,B,$);Te.fill(le,0,J),Se.fill(0,0,J);for(let ve=0;ve<$;ve++)for(let Ie=0;Ie<B;Ie++){const Pe=Ce.data[4*(ve*B+Ie)+3]/255;if(Pe===0)continue;const Ve=(ve+be)*q+Ie+be;if(Pe===1)Te[Ve]=0,Se[Ve]=le;else{const Ke=.5-Pe;Te[Ve]=Ke>0?Ke*Ke:0,Se[Ve]=Ke<0?Ke*Ke:0}}de(Te,0,0,q,K,q,this.f,this.v,this.z),de(Se,be,be,B,$,q,this.f,this.v,this.z);for(let ve=0;ve<J;ve++){const Ie=Math.sqrt(Te[ve])-Math.sqrt(Se[ve]);ae[ve]=Math.round(255-255*(Ie/this.radius+this.cutoff))}return ue}};class me{constructor(){this.specification=s.v.light.position}possiblyEvaluate(u,y){return s.x(u.expression.evaluate(y))}interpolate(u,y,S){return{x:s.y.number(u.x,y.x,S),y:s.y.number(u.y,y.y,S),z:s.y.number(u.z,y.z,S)}}}let Me;class Be extends s.E{constructor(u){super(),Me=Me||new s.q({anchor:new s.D(s.v.light.anchor),position:new me,color:new s.D(s.v.light.color),intensity:new s.D(s.v.light.intensity)}),this._transitionable=new s.T(Me),this.setLight(u),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(u,y={}){if(!this._validate(s.r,u,y))for(const S in u){const T=u[S];S.endsWith("-transition")?this._transitionable.setTransition(S.slice(0,-11),T):this._transitionable.setValue(S,T)}}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,y,S){return(!S||S.validate!==!1)&&s.t(this,u.call(s.u,{value:y,style:{glyphs:!0,sprite:!0},styleSpec:s.v}))}}const Fe=new s.q({"sky-color":new s.D(s.v.sky["sky-color"]),"horizon-color":new s.D(s.v.sky["horizon-color"]),"fog-color":new s.D(s.v.sky["fog-color"]),"fog-ground-blend":new s.D(s.v.sky["fog-ground-blend"]),"horizon-fog-blend":new s.D(s.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new s.D(s.v.sky["sky-horizon-blend"]),"atmosphere-blend":new s.D(s.v.sky["atmosphere-blend"])});class Xe extends s.E{constructor(u){super(),this._transitionable=new s.T(Fe),this.setSky(u),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new s.z(0))}setSky(u,y={}){if(!this._validate(s.B,u,y)){u||(u={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const S in u){const T=u[S];S.endsWith("-transition")?this._transitionable.setTransition(S.slice(0,-11),T):this._transitionable.setValue(S,T)}}}getSky(){return this._transitionable.serialize()}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,y,S={}){return(S==null?void 0:S.validate)!==!1&&s.t(this,u.call(s.u,s.e({value:y,style:{glyphs:!0,sprite:!0},styleSpec:s.v})))}calculateFogBlendOpacity(u){return u<60?0:u<70?(u-60)/10:1}}class it{constructor(u,y){this.width=u,this.height=y,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(u,y){const S=u.join(",")+String(y);return this.dashEntry[S]||(this.dashEntry[S]=this.addDash(u,y)),this.dashEntry[S]}getDashRanges(u,y,S){const T=[];let A=u.length%2==1?-u[u.length-1]*S:0,N=u[0]*S,B=!0;T.push({left:A,right:N,isDash:B,zeroLength:u[0]===0});let $=u[0];for(let q=1;q<u.length;q++){B=!B;const K=u[q];A=$*S,$+=K,N=$*S,T.push({left:A,right:N,isDash:B,zeroLength:K===0})}return T}addRoundDash(u,y,S){const T=y/2;for(let A=-S;A<=S;A++){const N=this.width*(this.nextRow+S+A);let B=0,$=u[B];for(let q=0;q<this.width;q++){q/$.right>1&&($=u[++B]);const K=Math.abs(q-$.left),J=Math.abs(q-$.right),ae=Math.min(K,J);let ue;const fe=A/S*(T+1);if($.isDash){const be=T-Math.abs(fe);ue=Math.sqrt(ae*ae+be*be)}else ue=T-Math.sqrt(ae*ae+fe*fe);this.data[N+q]=Math.max(0,Math.min(255,ue+128))}}}addRegularDash(u){for(let B=u.length-1;B>=0;--B){const $=u[B],q=u[B+1];$.zeroLength?u.splice(B,1):q&&q.isDash===$.isDash&&(q.left=$.left,u.splice(B,1))}const y=u[0],S=u[u.length-1];y.isDash===S.isDash&&(y.left=S.left-this.width,S.right=y.right+this.width);const T=this.width*this.nextRow;let A=0,N=u[A];for(let B=0;B<this.width;B++){B/N.right>1&&(N=u[++A]);const $=Math.abs(B-N.left),q=Math.abs(B-N.right),K=Math.min($,q);this.data[T+B]=Math.max(0,Math.min(255,(N.isDash?K:-K)+128))}}addDash(u,y){const S=y?7:0,T=2*S+1;if(this.nextRow+T>this.height)return s.w("LineAtlas out of space"),null;let A=0;for(let B=0;B<u.length;B++)A+=u[B];if(A!==0){const B=this.width/A,$=this.getDashRanges(u,this.width,B);y?this.addRoundDash($,B,S):this.addRegularDash($)}const N={y:(this.nextRow+S+.5)/this.height,height:2*S/this.height,width:A};return this.nextRow+=T,this.dirty=!0,N}bind(u){const y=u.gl;this.texture?(y.bindTexture(y.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,y.texSubImage2D(y.TEXTURE_2D,0,0,0,this.width,this.height,y.ALPHA,y.UNSIGNED_BYTE,this.data))):(this.texture=y.createTexture(),y.bindTexture(y.TEXTURE_2D,this.texture),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.REPEAT),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.REPEAT),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.texImage2D(y.TEXTURE_2D,0,y.ALPHA,this.width,this.height,0,y.ALPHA,y.UNSIGNED_BYTE,this.data))}}const at="maplibre_preloaded_worker_pool";class ht{constructor(){this.active={}}acquire(u){if(!this.workers)for(this.workers=[];this.workers.length<ht.workerCount;)this.workers.push(new Worker(s.a.WORKER_URL));return this.active[u]=!0,this.workers.slice()}release(u){delete this.active[u],this.numActive()===0&&(this.workers.forEach(y=>{y.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[at]}numActive(){return Object.keys(this.active).length}}const ct=Math.floor(f.hardwareConcurrency/2);let dt,Qe;function Dt(){return dt||(dt=new ht),dt}ht.workerCount=s.C(globalThis)?Math.max(Math.min(ct,3),1):1;class wt{constructor(u,y){this.workerPool=u,this.actors=[],this.currentActor=0,this.id=y;const S=this.workerPool.acquire(y);for(let T=0;T<S.length;T++){const A=new s.F(S[T],y);A.name=`Worker ${T}`,this.actors.push(A)}if(!this.actors.length)throw new Error("No actors found")}broadcast(u,y){const S=[];for(const T of this.actors)S.push(T.sendAsync({type:u,data:y}));return Promise.all(S)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(u=!0){this.actors.forEach(y=>{y.remove()}),this.actors=[],u&&this.workerPool.release(this.id)}registerMessageHandler(u,y){for(const S of this.actors)S.registerMessageHandler(u,y)}}function ot(){return Qe||(Qe=new wt(Dt(),s.G),Qe.registerMessageHandler("GR",(D,u,y)=>s.m(u,y))),Qe}function St(D,u){const y=s.H();return s.J(y,y,[1,1,0]),s.K(y,y,[.5*D.width,.5*D.height,1]),s.L(y,y,D.calculatePosMatrix(u.toUnwrapped()))}function tt(D,u,y,S,T,A){const N=function(J,ae,ue){if(J)for(const fe of J){const be=ae[fe];if(be&&be.source===ue&&be.type==="fill-extrusion")return!0}else for(const fe in ae){const be=ae[fe];if(be.source===ue&&be.type==="fill-extrusion")return!0}return!1}(T&&T.layers,u,D.id),B=A.maxPitchScaleFactor(),$=D.tilesIn(S,B,N);$.sort(kt);const q=[];for(const J of $)q.push({wrappedTileID:J.tileID.wrapped().key,queryResults:J.tile.queryRenderedFeatures(u,y,D._state,J.queryGeometry,J.cameraQueryGeometry,J.scale,T,A,B,St(D.transform,J.tileID))});const K=function(J){const ae={},ue={};for(const fe of J){const be=fe.queryResults,Se=fe.wrappedTileID,Te=ue[Se]=ue[Se]||{};for(const Ce in be){const ve=be[Ce],Ie=Te[Ce]=Te[Ce]||{},Pe=ae[Ce]=ae[Ce]||[];for(const Ve of ve)Ie[Ve.featureIndex]||(Ie[Ve.featureIndex]=!0,Pe.push(Ve))}}return ae}(q);for(const J in K)K[J].forEach(ae=>{const ue=ae.feature,fe=D.getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=fe});return K}function kt(D,u){const y=D.tileID,S=u.tileID;return y.overscaledZ-S.overscaledZ||y.canonical.y-S.canonical.y||y.wrap-S.wrap||y.canonical.x-S.canonical.x}function _r(D,u,y){return s._(this,void 0,void 0,function*(){let S=D;if(D.url?S=(yield s.h(u.transformRequest(D.url,"Source"),y)).data:yield f.frameAsync(y),!S)return null;const T=s.M(s.e(S,D),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in S&&S.vector_layers&&(T.vectorLayerIds=S.vector_layers.map(A=>A.id)),T})}class Le{constructor(u,y){u&&(y?this.setSouthWest(u).setNorthEast(y):Array.isArray(u)&&(u.length===4?this.setSouthWest([u[0],u[1]]).setNorthEast([u[2],u[3]]):this.setSouthWest(u[0]).setNorthEast(u[1])))}setNorthEast(u){return this._ne=u instanceof s.N?new s.N(u.lng,u.lat):s.N.convert(u),this}setSouthWest(u){return this._sw=u instanceof s.N?new s.N(u.lng,u.lat):s.N.convert(u),this}extend(u){const y=this._sw,S=this._ne;let T,A;if(u instanceof s.N)T=u,A=u;else{if(!(u instanceof Le))return Array.isArray(u)?u.length===4||u.every(Array.isArray)?this.extend(Le.convert(u)):this.extend(s.N.convert(u)):u&&("lng"in u||"lon"in u)&&"lat"in u?this.extend(s.N.convert(u)):this;if(T=u._sw,A=u._ne,!T||!A)return this}return y||S?(y.lng=Math.min(T.lng,y.lng),y.lat=Math.min(T.lat,y.lat),S.lng=Math.max(A.lng,S.lng),S.lat=Math.max(A.lat,S.lat)):(this._sw=new s.N(T.lng,T.lat),this._ne=new s.N(A.lng,A.lat)),this}getCenter(){return new s.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new s.N(this.getWest(),this.getNorth())}getSouthEast(){return new s.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(u){const{lng:y,lat:S}=s.N.convert(u);let T=this._sw.lng<=y&&y<=this._ne.lng;return this._sw.lng>this._ne.lng&&(T=this._sw.lng>=y&&y>=this._ne.lng),this._sw.lat<=S&&S<=this._ne.lat&&T}static convert(u){return u instanceof Le?u:u&&new Le(u)}static fromLngLat(u,y=0){const S=360*y/40075017,T=S/Math.cos(Math.PI/180*u.lat);return new Le(new s.N(u.lng-T,u.lat-S),new s.N(u.lng+T,u.lat+S))}adjustAntiMeridian(){const u=new s.N(this._sw.lng,this._sw.lat),y=new s.N(this._ne.lng,this._ne.lat);return new Le(u,u.lng>y.lng?new s.N(y.lng+360,y.lat):y)}}class Vr{constructor(u,y,S){this.bounds=Le.convert(this.validateBounds(u)),this.minzoom=y||0,this.maxzoom=S||24}validateBounds(u){return Array.isArray(u)&&u.length===4?[Math.max(-180,u[0]),Math.max(-90,u[1]),Math.min(180,u[2]),Math.min(90,u[3])]:[-180,-90,180,90]}contains(u){const y=Math.pow(2,u.z),S=Math.floor(s.O(this.bounds.getWest())*y),T=Math.floor(s.Q(this.bounds.getNorth())*y),A=Math.ceil(s.O(this.bounds.getEast())*y),N=Math.ceil(s.Q(this.bounds.getSouth())*y);return u.x>=S&&u.x<A&&u.y>=T&&u.y<N}}class yn extends s.E{constructor(u,y,S,T){if(super(),this.id=u,this.dispatcher=S,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.e(this,s.M(y,["url","scheme","tileSize","promoteId"])),this._options=s.e({type:"vector"},y),this._collectResourceTiming=y.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(T)}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const u=yield _r(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),u&&(s.e(this,u),u.bounds&&(this.tileBounds=new Vr(u.bounds,this.minzoom,this.maxzoom)),this.fire(new s.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})))}catch(u){this._tileJSONRequest=null,this.fire(new s.j(u))}})}loaded(){return this._loaded}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}onAdd(u){this.map=u,this.load()}setSourceProperty(u){this._tileJSONRequest&&this._tileJSONRequest.abort(),u(),this.load()}setTiles(u){return this.setSourceProperty(()=>{this._options.tiles=u}),this}setUrl(u){return this.setSourceProperty(()=>{this.url=u,this._options.url=u}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return s.e({},this._options)}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),S={request:this.map._requestManager.transformRequest(y,"Tile"),uid:u.uid,tileID:u.tileID,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};S.request.collectResourceTiming=this._collectResourceTiming;let T="RT";if(u.actor&&u.state!=="expired"){if(u.state==="loading")return new Promise((A,N)=>{u.reloadPromise={resolve:A,reject:N}})}else u.actor=this.dispatcher.getActor(),T="LT";u.abortController=new AbortController;try{const A=yield u.actor.sendAsync({type:T,data:S},u.abortController);if(delete u.abortController,u.aborted)return;this._afterTileLoadWorkerResponse(u,A)}catch(A){if(delete u.abortController,u.aborted)return;if(A&&A.status!==404)throw A;this._afterTileLoadWorkerResponse(u,null)}})}_afterTileLoadWorkerResponse(u,y){if(y&&y.resourceTiming&&(u.resourceTiming=y.resourceTiming),y&&this.map._refreshExpiredTiles&&u.setExpiryData(y),u.loadVectorData(y,this.map.painter),u.reloadPromise){const S=u.reloadPromise;u.reloadPromise=null,this.loadTile(u).then(S.resolve).catch(S.reject)}}abortTile(u){return s._(this,void 0,void 0,function*(){u.abortController&&(u.abortController.abort(),delete u.abortController),u.actor&&(yield u.actor.sendAsync({type:"AT",data:{uid:u.uid,type:this.type,source:this.id}}))})}unloadTile(u){return s._(this,void 0,void 0,function*(){u.unloadVectorData(),u.actor&&(yield u.actor.sendAsync({type:"RMT",data:{uid:u.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class nt extends s.E{constructor(u,y,S,T){super(),this.id=u,this.dispatcher=S,this.setEventedParent(T),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.e({type:"raster"},y),s.e(this,s.M(y,["url","scheme","tileSize"]))}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const u=yield _r(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,u&&(s.e(this,u),u.bounds&&(this.tileBounds=new Vr(u.bounds,this.minzoom,this.maxzoom)),this.fire(new s.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})))}catch(u){this._tileJSONRequest=null,this.fire(new s.j(u))}})}loaded(){return this._loaded}onAdd(u){this.map=u,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(u){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),u(),this.load()}setTiles(u){return this.setSourceProperty(()=>{this._options.tiles=u}),this}setUrl(u){return this.setSourceProperty(()=>{this.url=u,this._options.url=u}),this}serialize(){return s.e({},this._options)}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);u.abortController=new AbortController;try{const S=yield L.getImage(this.map._requestManager.transformRequest(y,"Tile"),u.abortController,this.map._refreshExpiredTiles);if(delete u.abortController,u.aborted)return void(u.state="unloaded");if(S&&S.data){this.map._refreshExpiredTiles&&S.cacheControl&&S.expires&&u.setExpiryData({cacheControl:S.cacheControl,expires:S.expires});const T=this.map.painter.context,A=T.gl,N=S.data;u.texture=this.map.painter.getTileTexture(N.width),u.texture?u.texture.update(N,{useMipmap:!0}):(u.texture=new X(T,N,A.RGBA,{useMipmap:!0}),u.texture.bind(A.LINEAR,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST)),u.state="loaded"}}catch(S){if(delete u.abortController,u.aborted)u.state="unloaded";else if(S)throw u.state="errored",S}})}abortTile(u){return s._(this,void 0,void 0,function*(){u.abortController&&(u.abortController.abort(),delete u.abortController)})}unloadTile(u){return s._(this,void 0,void 0,function*(){u.texture&&this.map.painter.saveTileTexture(u.texture)})}hasTransition(){return!1}}class Nr extends nt{constructor(u,y,S,T){super(u,y,S,T),this.type="raster-dem",this.maxzoom=22,this._options=s.e({type:"raster-dem"},y),this.encoding=y.encoding||"mapbox",this.redFactor=y.redFactor,this.greenFactor=y.greenFactor,this.blueFactor=y.blueFactor,this.baseShift=y.baseShift}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),S=this.map._requestManager.transformRequest(y,"Tile");u.neighboringTiles=this._getNeighboringTiles(u.tileID),u.abortController=new AbortController;try{const T=yield L.getImage(S,u.abortController,this.map._refreshExpiredTiles);if(delete u.abortController,u.aborted)return void(u.state="unloaded");if(T&&T.data){const A=T.data;this.map._refreshExpiredTiles&&T.cacheControl&&T.expires&&u.setExpiryData({cacheControl:T.cacheControl,expires:T.expires});const N=s.b(A)&&s.U()?A:yield this.readImageNow(A),B={type:this.type,uid:u.uid,source:this.id,rawImageData:N,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!u.actor||u.state==="expired"){u.actor=this.dispatcher.getActor();const $=yield u.actor.sendAsync({type:"LDT",data:B});u.dem=$,u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0,u.state="loaded"}}}catch(T){if(delete u.abortController,u.aborted)u.state="unloaded";else if(T)throw u.state="errored",T}})}readImageNow(u){return s._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&s.V()){const y=u.width+2,S=u.height+2;try{return new s.R({width:y,height:S},yield s.W(u,-1,-1,y,S))}catch{}}return f.getImageData(u,1)})}_getNeighboringTiles(u){const y=u.canonical,S=Math.pow(2,y.z),T=(y.x-1+S)%S,A=y.x===0?u.wrap-1:u.wrap,N=(y.x+1+S)%S,B=y.x+1===S?u.wrap+1:u.wrap,$={};return $[new s.S(u.overscaledZ,A,y.z,T,y.y).key]={backfilled:!1},$[new s.S(u.overscaledZ,B,y.z,N,y.y).key]={backfilled:!1},y.y>0&&($[new s.S(u.overscaledZ,A,y.z,T,y.y-1).key]={backfilled:!1},$[new s.S(u.overscaledZ,u.wrap,y.z,y.x,y.y-1).key]={backfilled:!1},$[new s.S(u.overscaledZ,B,y.z,N,y.y-1).key]={backfilled:!1}),y.y+1<S&&($[new s.S(u.overscaledZ,A,y.z,T,y.y+1).key]={backfilled:!1},$[new s.S(u.overscaledZ,u.wrap,y.z,y.x,y.y+1).key]={backfilled:!1},$[new s.S(u.overscaledZ,B,y.z,N,y.y+1).key]={backfilled:!1}),$}unloadTile(u){return s._(this,void 0,void 0,function*(){u.demTexture&&this.map.painter.saveTileTexture(u.demTexture),u.fbo&&(u.fbo.destroy(),delete u.fbo),u.dem&&delete u.dem,delete u.neighboringTiles,u.state="unloaded",u.actor&&(yield u.actor.sendAsync({type:"RDT",data:{type:this.type,uid:u.uid,source:this.id}}))})}}class br extends s.E{constructor(u,y,S,T){super(),this.id=u,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=S.getActor(),this.setEventedParent(T),this._data=y.data,this._options=s.e({},y),this._collectResourceTiming=y.collectResourceTiming,y.maxzoom!==void 0&&(this.maxzoom=y.maxzoom),y.type&&(this.type=y.type),y.attribution&&(this.attribution=y.attribution),this.promoteId=y.promoteId;const A=s.X/this.tileSize;y.clusterMaxZoom!==void 0&&this.maxzoom<=y.clusterMaxZoom&&s.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${y.clusterMaxZoom}".`),this.workerOptions=s.e({source:this.id,cluster:y.cluster||!1,geojsonVtOptions:{buffer:(y.buffer!==void 0?y.buffer:128)*A,tolerance:(y.tolerance!==void 0?y.tolerance:.375)*A,extent:s.X,maxZoom:this.maxzoom,lineMetrics:y.lineMetrics||!1,generateId:y.generateId||!1},superclusterOptions:{maxZoom:y.clusterMaxZoom!==void 0?y.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,y.clusterMinPoints||2),extent:s.X,radius:(y.clusterRadius||50)*A,log:!1,generateId:y.generateId||!1},clusterProperties:y.clusterProperties,filter:y.filter},y.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return s._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(u){this.map=u,this.load()}setData(u){return this._data=u,this._updateWorkerData(),this}updateData(u){return this._updateWorkerData(u),this}getData(){return s._(this,void 0,void 0,function*(){const u=s.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:u})})}setClusterOptions(u){return this.workerOptions.cluster=u.cluster,u&&(u.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=u.clusterRadius),u.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=u.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(u){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:u,source:this.id}})}getClusterChildren(u){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:u,source:this.id}})}getClusterLeaves(u,y,S){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:u,limit:y,offset:S}})}_updateWorkerData(u){return s._(this,void 0,void 0,function*(){const y=s.e({type:this.type},this.workerOptions);u?y.dataDiff=u:typeof this._data=="string"?(y.request=this.map._requestManager.transformRequest(f.resolveURL(this._data),"Source"),y.request.collectResourceTiming=this._collectResourceTiming):y.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new s.k("dataloading",{dataType:"source"}));try{const S=yield this.actor.sendAsync({type:"LD",data:y});if(this._pendingLoads--,this._removed||S.abandoned)return void this.fire(new s.k("dataabort",{dataType:"source"}));let T=null;S.resourceTiming&&S.resourceTiming[this.id]&&(T=S.resourceTiming[this.id].slice(0));const A={dataType:"source"};this._collectResourceTiming&&T&&T.length>0&&s.e(A,{resourceTiming:T}),this.fire(new s.k("data",Object.assign(Object.assign({},A),{sourceDataType:"metadata"}))),this.fire(new s.k("data",Object.assign(Object.assign({},A),{sourceDataType:"content"})))}catch(S){if(this._pendingLoads--,this._removed)return void this.fire(new s.k("dataabort",{dataType:"source"}));this.fire(new s.j(S))}})}loaded(){return this._pendingLoads===0}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.actor?"RT":"LT";u.actor=this.actor;const S={type:this.type,uid:u.uid,tileID:u.tileID,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};u.abortController=new AbortController;const T=yield this.actor.sendAsync({type:y,data:S},u.abortController);delete u.abortController,u.unloadVectorData(),u.aborted||u.loadVectorData(T,this.map.painter,y==="RT")})}abortTile(u){return s._(this,void 0,void 0,function*(){u.abortController&&(u.abortController.abort(),delete u.abortController),u.aborted=!0})}unloadTile(u){return s._(this,void 0,void 0,function*(){u.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:u.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 s.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ar=s.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class zn extends s.E{constructor(u,y,S,T){super(),this.id=u,this.dispatcher=S,this.coordinates=y.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(T),this.options=y}load(u){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const y=yield L.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,y&&y.data&&(this.image=y.data,u&&(this.coordinates=u),this._finishLoading())}catch(y){this._request=null,this._loaded=!0,this.fire(new s.j(y))}})}loaded(){return this._loaded}updateImage(u){return u.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=u.url,this.load(u.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new s.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(u){this.map=u,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(u){this.coordinates=u;const y=u.map(s.Z.fromLngLat);this.tileID=function(T){let A=1/0,N=1/0,B=-1/0,$=-1/0;for(const ae of T)A=Math.min(A,ae.x),N=Math.min(N,ae.y),B=Math.max(B,ae.x),$=Math.max($,ae.y);const q=Math.max(B-A,$-N),K=Math.max(0,Math.floor(-Math.log(q)/Math.LN2)),J=Math.pow(2,K);return new s.a1(K,Math.floor((A+B)/2*J),Math.floor((N+$)/2*J))}(y),this.minzoom=this.maxzoom=this.tileID.z;const S=y.map(T=>this.tileID.getTilePoint(T)._round());return this._boundsArray=new s.$,this._boundsArray.emplaceBack(S[0].x,S[0].y,0,0),this._boundsArray.emplaceBack(S[1].x,S[1].y,s.X,0),this._boundsArray.emplaceBack(S[3].x,S[3].y,0,s.X),this._boundsArray.emplaceBack(S[2].x,S[2].y,s.X,s.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const u=this.map.painter.context,y=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ar.members)),this.boundsSegments||(this.boundsSegments=s.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new X(u,this.image,y.RGBA),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE));let S=!1;for(const T in this.tiles){const A=this.tiles[T];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture,S=!0)}S&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(u){return s._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(u.tileID.canonical)?(this.tiles[String(u.tileID.wrap)]=u,u.buckets={}):u.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class fi extends zn{constructor(u,y,S,T){super(u,y,S,T),this.roundZoom=!0,this.type="video",this.options=y}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1;const u=this.options;this.urls=[];for(const y of u.urls)this.urls.push(this.map._requestManager.transformRequest(y,"Source").url);try{const y=yield s.a3(this.urls);if(this._loaded=!0,!y)return;this.video=y,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(y){this.fire(new s.j(y))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(u){if(this.video){const y=this.video.seekable;u<y.start(0)||u>y.end(0)?this.fire(new s.j(new s.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${y.start(0)} and ${y.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const u=this.map.painter.context,y=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ar.members)),this.boundsSegments||(this.boundsSegments=s.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE),y.texSubImage2D(y.TEXTURE_2D,0,0,0,y.RGBA,y.UNSIGNED_BYTE,this.video)):(this.texture=new X(u,this.video,y.RGBA),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE));let S=!1;for(const T in this.tiles){const A=this.tiles[T];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture,S=!0)}S&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class kn extends zn{constructor(u,y,S,T){super(u,y,S,T),y.coordinates?Array.isArray(y.coordinates)&&y.coordinates.length===4&&!y.coordinates.some(A=>!Array.isArray(A)||A.length!==2||A.some(N=>typeof N!="number"))||this.fire(new s.j(new s.a2(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.j(new s.a2(`sources.${u}`,null,'missing required property "coordinates"'))),y.animate&&typeof y.animate!="boolean"&&this.fire(new s.j(new s.a2(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),y.canvas?typeof y.canvas=="string"||y.canvas instanceof HTMLCanvasElement||this.fire(new s.j(new s.a2(`sources.${u}`,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 s.j(new s.a2(`sources.${u}`,null,'missing required property "canvas"'))),this.options=y,this.animate=y.animate===void 0||y.animate}load(){return s._(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 s.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const y=this.map.painter.context,S=y.gl;this.boundsBuffer||(this.boundsBuffer=y.createVertexBuffer(this._boundsArray,Ar.members)),this.boundsSegments||(this.boundsSegments=s.a0.simpleSegment(0,0,4,2)),this.texture?(u||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new X(y,this.canvas,S.RGBA,{premultiply:!0});let T=!1;for(const A in this.tiles){const N=this.tiles[A];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture,T=!0)}T&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}}const si={},Tt=D=>{switch(D){case"geojson":return br;case"image":return zn;case"raster":return nt;case"raster-dem":return Nr;case"vector":return yn;case"video":return fi;case"canvas":return kn}return si[D]},$e="RTLPluginLoaded";class er extends s.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ot()}_syncState(u){return this.status=u,this.dispatcher.broadcast("SRPS",{pluginStatus:u,pluginURL:this.url}).catch(y=>{throw this.status="error",y})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(u){return s._(this,arguments,void 0,function*(y,S=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=f.resolveURL(y),!this.url)throw new Error(`requested url ${y} is invalid`);if(this.status==="unavailable"){if(!S)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return s._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new s.k($e))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let sr=null;function Kr(){return sr||(sr=new er),sr}class Ln{constructor(u,y){this.timeAdded=0,this.fadeEndTime=0,this.tileID=u,this.uid=s.a4(),this.uses=0,this.tileSize=y,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(u){const y=u+this.timeAdded;y<this.fadeEndTime||(this.fadeEndTime=y)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(u){this.demTexture&&u.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(u,y,S){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",u){u.featureIndex&&(this.latestFeatureIndex=u.featureIndex,u.rawTileData?(this.latestRawTileData=u.rawTileData,this.latestFeatureIndex.rawTileData=u.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=u.collisionBoxArray,this.buckets=function(T,A){const N={};if(!A)return N;for(const B of T){const $=B.layerIds.map(q=>A.getLayer(q)).filter(Boolean);if($.length!==0){B.layers=$,B.stateDependentLayerIds&&(B.stateDependentLayers=B.stateDependentLayerIds.map(q=>$.filter(K=>K.id===q)[0]));for(const q of $)N[q.id]=B}}return N}(u.buckets,y.style),this.hasSymbolBuckets=!1;for(const T in this.buckets){const A=this.buckets[T];if(A instanceof s.a6){if(this.hasSymbolBuckets=!0,!S)break;A.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const T in this.buckets){const A=this.buckets[T];if(A instanceof s.a6&&A.hasRTLText){this.hasRTLText=!0,Kr().lazyLoad();break}}this.queryPadding=0;for(const T in this.buckets){const A=this.buckets[T];this.queryPadding=Math.max(this.queryPadding,y.style.getLayer(T).queryRadius(A))}u.imageAtlas&&(this.imageAtlas=u.imageAtlas),u.glyphAtlasImage&&(this.glyphAtlasImage=u.glyphAtlasImage)}else this.collisionBoxArray=new s.a5}unloadVectorData(){for(const u in this.buckets)this.buckets[u].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(u){return this.buckets[u.id]}upload(u){for(const S in this.buckets){const T=this.buckets[S];T.uploadPending()&&T.upload(u)}const y=u.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new X(u,this.imageAtlas.image,y.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new X(u,this.glyphAtlasImage,y.ALPHA),this.glyphAtlasImage=null)}prepare(u){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(u,this.imageAtlasTexture)}queryRenderedFeatures(u,y,S,T,A,N,B,$,q,K){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:T,cameraQueryGeometry:A,scale:N,tileSize:this.tileSize,pixelPosMatrix:K,transform:$,params:B,queryPadding:this.queryPadding*q},u,y,S):{}}querySourceFeatures(u,y){const S=this.latestFeatureIndex;if(!S||!S.rawTileData)return;const T=S.loadVTLayers(),A=y&&y.sourceLayer?y.sourceLayer:"",N=T._geojsonTileLayer||T[A];if(!N)return;const B=s.a7(y&&y.filter),{z:$,x:q,y:K}=this.tileID.canonical,J={z:$,x:q,y:K};for(let ae=0;ae<N.length;ae++){const ue=N.feature(ae);if(B.needGeometry){const Se=s.a8(ue,!0);if(!B.filter(new s.z(this.tileID.overscaledZ),Se,this.tileID.canonical))continue}else if(!B.filter(new s.z(this.tileID.overscaledZ),ue))continue;const fe=S.getId(ue,A),be=new s.a9(ue,$,q,K,fe);be.tile=J,u.push(be)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(u){const y=this.expirationTime;if(u.cacheControl){const S=s.aa(u.cacheControl);S["max-age"]&&(this.expirationTime=Date.now()+1e3*S["max-age"])}else u.expires&&(this.expirationTime=new Date(u.expires).getTime());if(this.expirationTime){const S=Date.now();let T=!1;if(this.expirationTime>S)T=!1;else if(y)if(this.expirationTime<y)T=!0;else{const A=this.expirationTime-y;A?this.expirationTime=S+Math.max(A,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(u,y){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(u).length===0)return;const S=this.latestFeatureIndex.loadVTLayers();for(const T in this.buckets){if(!y.style.hasLayer(T))continue;const A=this.buckets[T],N=A.layers[0].sourceLayer||"_geojsonTileLayer",B=S[N],$=u[N];if(!B||!$||Object.keys($).length===0)continue;A.update($,B,this.imageAtlas&&this.imageAtlas.patternPositions||{});const q=y&&y.style&&y.style.getLayer(T);q&&(this.queryPadding=Math.max(this.queryPadding,q.queryRadius(A)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<f.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(u){this.symbolFadeHoldUntil=f.now()+u}setDependencies(u,y){const S={};for(const T of y)S[T]=!0;this.dependencies[u]=S}hasDependency(u,y){for(const S of u){const T=this.dependencies[S];if(T){for(const A of y)if(T[A])return!0}}return!1}}class ut{constructor(u,y){this.max=u,this.onRemove=y,this.reset()}reset(){for(const u in this.data)for(const y of this.data[u])y.timeout&&clearTimeout(y.timeout),this.onRemove(y.value);return this.data={},this.order=[],this}add(u,y,S){const T=u.wrapped().key;this.data[T]===void 0&&(this.data[T]=[]);const A={value:y,timeout:void 0};if(S!==void 0&&(A.timeout=setTimeout(()=>{this.remove(u,A)},S)),this.data[T].push(A),this.order.push(T),this.order.length>this.max){const N=this._getAndRemoveByKey(this.order[0]);N&&this.onRemove(N)}return this}has(u){return u.wrapped().key in this.data}getAndRemove(u){return this.has(u)?this._getAndRemoveByKey(u.wrapped().key):null}_getAndRemoveByKey(u){const y=this.data[u].shift();return y.timeout&&clearTimeout(y.timeout),this.data[u].length===0&&delete this.data[u],this.order.splice(this.order.indexOf(u),1),y.value}getByKey(u){const y=this.data[u];return y?y[0].value:null}get(u){return this.has(u)?this.data[u.wrapped().key][0].value:null}remove(u,y){if(!this.has(u))return this;const S=u.wrapped().key,T=y===void 0?0:this.data[S].indexOf(y),A=this.data[S][T];return this.data[S].splice(T,1),A.timeout&&clearTimeout(A.timeout),this.data[S].length===0&&delete this.data[S],this.onRemove(A.value),this.order.splice(this.order.indexOf(S),1),this}setMaxSize(u){for(this.max=u;this.order.length>this.max;){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}return this}filter(u){const y=[];for(const S in this.data)for(const T of this.data[S])u(T.value)||y.push(T);for(const S of y)this.remove(S.value.tileID,S)}}class hr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(u,y,S){const T=String(y);if(this.stateChanges[u]=this.stateChanges[u]||{},this.stateChanges[u][T]=this.stateChanges[u][T]||{},s.e(this.stateChanges[u][T],S),this.deletedStates[u]===null){this.deletedStates[u]={};for(const A in this.state[u])A!==T&&(this.deletedStates[u][A]=null)}else if(this.deletedStates[u]&&this.deletedStates[u][T]===null){this.deletedStates[u][T]={};for(const A in this.state[u][T])S[A]||(this.deletedStates[u][T][A]=null)}else for(const A in S)this.deletedStates[u]&&this.deletedStates[u][T]&&this.deletedStates[u][T][A]===null&&delete this.deletedStates[u][T][A]}removeFeatureState(u,y,S){if(this.deletedStates[u]===null)return;const T=String(y);if(this.deletedStates[u]=this.deletedStates[u]||{},S&&y!==void 0)this.deletedStates[u][T]!==null&&(this.deletedStates[u][T]=this.deletedStates[u][T]||{},this.deletedStates[u][T][S]=null);else if(y!==void 0)if(this.stateChanges[u]&&this.stateChanges[u][T])for(S in this.deletedStates[u][T]={},this.stateChanges[u][T])this.deletedStates[u][T][S]=null;else this.deletedStates[u][T]=null;else this.deletedStates[u]=null}getState(u,y){const S=String(y),T=s.e({},(this.state[u]||{})[S],(this.stateChanges[u]||{})[S]);if(this.deletedStates[u]===null)return{};if(this.deletedStates[u]){const A=this.deletedStates[u][y];if(A===null)return{};for(const N in A)delete T[N]}return T}initializeTileState(u,y){u.setFeatureState(this.state,y)}coalesceChanges(u,y){const S={};for(const T in this.stateChanges){this.state[T]=this.state[T]||{};const A={};for(const N in this.stateChanges[T])this.state[T][N]||(this.state[T][N]={}),s.e(this.state[T][N],this.stateChanges[T][N]),A[N]=this.state[T][N];S[T]=A}for(const T in this.deletedStates){this.state[T]=this.state[T]||{};const A={};if(this.deletedStates[T]===null)for(const N in this.state[T])A[N]={},this.state[T][N]={};else for(const N in this.deletedStates[T]){if(this.deletedStates[T][N]===null)this.state[T][N]={};else for(const B of Object.keys(this.deletedStates[T][N]))delete this.state[T][N][B];A[N]=this.state[T][N]}S[T]=S[T]||{},s.e(S[T],A)}if(this.stateChanges={},this.deletedStates={},Object.keys(S).length!==0)for(const T in u)u[T].setFeatureState(S,y)}}class Qt extends s.E{constructor(u,y,S){super(),this.id=u,this.dispatcher=S,this.on("data",T=>this._dataHandler(T)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((T,A,N,B)=>{const $=new(Tt(A.type))(T,A,N,B);if($.id!==T)throw new Error(`Expected Source id to be ${T} instead of ${$.id}`);return $})(u,y,S,this),this._tiles={},this._cache=new ut(0,T=>this._unloadTile(T)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new hr,this._didEmitContent=!1,this._updated=!1}onAdd(u){this.map=u,this._maxTileCacheSize=u?u._maxTileCacheSize:null,this._maxTileCacheZoomLevels=u?u._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(u)}onRemove(u){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(u)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const u in this._tiles){const y=this._tiles[u];if(y.state!=="loaded"&&y.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const u=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,u&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(u,y,S){return s._(this,void 0,void 0,function*(){try{yield this._source.loadTile(u),this._tileLoaded(u,y,S)}catch(T){u.state="errored",T.status!==404?this._source.fire(new s.j(T,{tile:u})):this.update(this.transform,this.terrain)}})}_unloadTile(u){this._source.unloadTile&&this._source.unloadTile(u)}_abortTile(u){this._source.abortTile&&this._source.abortTile(u),this._source.fire(new s.k("dataabort",{tile:u,coord:u.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(u){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const y in this._tiles){const S=this._tiles[y];S.upload(u),S.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(u=>u.tileID).sort(pi).map(u=>u.key)}getRenderableIds(u){const y=[];for(const S in this._tiles)this._isIdRenderable(S,u)&&y.push(this._tiles[S]);return u?y.sort((S,T)=>{const A=S.tileID,N=T.tileID,B=new s.P(A.canonical.x,A.canonical.y)._rotate(this.transform.angle),$=new s.P(N.canonical.x,N.canonical.y)._rotate(this.transform.angle);return A.overscaledZ-N.overscaledZ||$.y-B.y||$.x-B.x}).map(S=>S.tileID.key):y.map(S=>S.tileID).sort(pi).map(S=>S.key)}hasRenderableParent(u){const y=this.findLoadedParent(u,0);return!!y&&this._isIdRenderable(y.tileID.key)}_isIdRenderable(u,y){return this._tiles[u]&&this._tiles[u].hasData()&&!this._coveredTiles[u]&&(y||!this._tiles[u].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const u in this._tiles)this._tiles[u].state!=="errored"&&this._reloadTile(u,"reloading")}}_reloadTile(u,y){return s._(this,void 0,void 0,function*(){const S=this._tiles[u];S&&(S.state!=="loading"&&(S.state=y),yield this._loadTile(S,u,y))})}_tileLoaded(u,y,S){u.timeAdded=f.now(),S==="expired"&&(u.refreshedUponExpiration=!0),this._setTileReloadTimer(y,u),this.getSource().type==="raster-dem"&&u.dem&&this._backfillDEM(u),this._state.initializeTileState(u,this.map?this.map.painter:null),u.aborted||this._source.fire(new s.k("data",{dataType:"source",tile:u,coord:u.tileID}))}_backfillDEM(u){const y=this.getRenderableIds();for(let T=0;T<y.length;T++){const A=y[T];if(u.neighboringTiles&&u.neighboringTiles[A]){const N=this.getTileByID(A);S(u,N),S(N,u)}}function S(T,A){T.needsHillshadePrepare=!0,T.needsTerrainPrepare=!0;let N=A.tileID.canonical.x-T.tileID.canonical.x;const B=A.tileID.canonical.y-T.tileID.canonical.y,$=Math.pow(2,T.tileID.canonical.z),q=A.tileID.key;N===0&&B===0||Math.abs(B)>1||(Math.abs(N)>1&&(Math.abs(N+$)===1?N+=$:Math.abs(N-$)===1&&(N-=$)),A.dem&&T.dem&&(T.dem.backfillBorder(A.dem,N,B),T.neighboringTiles&&T.neighboringTiles[q]&&(T.neighboringTiles[q].backfilled=!0)))}}getTile(u){return this.getTileByID(u.key)}getTileByID(u){return this._tiles[u]}_retainLoadedChildren(u,y,S,T){for(const A in this._tiles){let N=this._tiles[A];if(T[A]||!N.hasData()||N.tileID.overscaledZ<=y||N.tileID.overscaledZ>S)continue;let B=N.tileID;for(;N&&N.tileID.overscaledZ>y+1;){const q=N.tileID.scaledTo(N.tileID.overscaledZ-1);N=this._tiles[q.key],N&&N.hasData()&&(B=q)}let $=B;for(;$.overscaledZ>y;)if($=$.scaledTo($.overscaledZ-1),u[$.key]){T[B.key]=B;break}}}findLoadedParent(u,y){if(u.key in this._loadedParentTiles){const S=this._loadedParentTiles[u.key];return S&&S.tileID.overscaledZ>=y?S:null}for(let S=u.overscaledZ-1;S>=y;S--){const T=u.scaledTo(S),A=this._getLoadedTile(T);if(A)return A}}findLoadedSibling(u){return this._getLoadedTile(u)}_getLoadedTile(u){const y=this._tiles[u.key];return y&&y.hasData()?y:this._cache.getByKey(u.wrapped().key)}updateCacheSize(u){const y=Math.ceil(u.width/this._source.tileSize)+1,S=Math.ceil(u.height/this._source.tileSize)+1,T=Math.floor(y*S*(this._maxTileCacheZoomLevels===null?s.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),A=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,T):T;this._cache.setMaxSize(A)}handleWrapJump(u){const y=Math.round((u-(this._prevLng===void 0?u:this._prevLng))/360);if(this._prevLng=u,y){const S={};for(const T in this._tiles){const A=this._tiles[T];A.tileID=A.tileID.unwrapTo(A.tileID.wrap+y),S[A.tileID.key]=A}this._tiles=S;for(const T in this._timers)clearTimeout(this._timers[T]),delete this._timers[T];for(const T in this._tiles)this._setTileReloadTimer(T,this._tiles[T])}}_updateCoveredAndRetainedTiles(u,y,S,T,A,N){const B={},$={},q=Object.keys(u),K=f.now();for(const J of q){const ae=u[J],ue=this._tiles[J];if(!ue||ue.fadeEndTime!==0&&ue.fadeEndTime<=K)continue;const fe=this.findLoadedParent(ae,y),be=this.findLoadedSibling(ae),Se=fe||be||null;Se&&(this._addTile(Se.tileID),B[Se.tileID.key]=Se.tileID),$[J]=ae}this._retainLoadedChildren($,T,S,u);for(const J in B)u[J]||(this._coveredTiles[J]=!0,u[J]=B[J]);if(N){const J={},ae={};for(const ue of A)this._tiles[ue.key].hasData()?J[ue.key]=ue:ae[ue.key]=ue;for(const ue in ae){const fe=ae[ue].children(this._source.maxzoom);this._tiles[fe[0].key]&&this._tiles[fe[1].key]&&this._tiles[fe[2].key]&&this._tiles[fe[3].key]&&(J[fe[0].key]=u[fe[0].key]=fe[0],J[fe[1].key]=u[fe[1].key]=fe[1],J[fe[2].key]=u[fe[2].key]=fe[2],J[fe[3].key]=u[fe[3].key]=fe[3],delete ae[ue])}for(const ue in ae){const fe=ae[ue],be=this.findLoadedParent(fe,this._source.minzoom),Se=this.findLoadedSibling(fe),Te=be||Se||null;if(Te){J[Te.tileID.key]=u[Te.tileID.key]=Te.tileID;for(const Ce in J)J[Ce].isChildOf(Te.tileID)&&delete J[Ce]}}for(const ue in this._tiles)J[ue]||(this._coveredTiles[ue]=!0)}}update(u,y){if(!this._sourceLoaded||this._paused)return;let S;this.transform=u,this.terrain=y,this.updateCacheSize(u),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?S=u.getVisibleUnwrappedCoordinates(this._source.tileID).map(K=>new s.S(K.canonical.z,K.wrap,K.canonical.z,K.canonical.x,K.canonical.y)):(S=u.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:y}),this._source.hasTile&&(S=S.filter(K=>this._source.hasTile(K)))):S=[];const T=u.coveringZoomLevel(this._source),A=Math.max(T-Qt.maxOverzooming,this._source.minzoom),N=Math.max(T+Qt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const K={};for(const J of S)if(J.canonical.z>this._source.minzoom){const ae=J.scaledTo(J.canonical.z-1);K[ae.key]=ae;const ue=J.scaledTo(Math.max(this._source.minzoom,Math.min(J.canonical.z,5)));K[ue.key]=ue}S=S.concat(Object.values(K))}const B=S.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,B&&this.fire(new s.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const $=this._updateRetainedTiles(S,T);la(this._source.type)&&this._updateCoveredAndRetainedTiles($,A,N,T,S,y);for(const K in $)this._tiles[K].clearFadeHold();const q=s.ab(this._tiles,$);for(const K of q){const J=this._tiles[K];J.hasSymbolBuckets&&!J.holdingForFade()?J.setHoldDuration(this.map._fadeDuration):J.hasSymbolBuckets&&!J.symbolFadeFinished()||this._removeTile(K)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const u in this._tiles)this._tiles[u].holdingForFade()&&this._removeTile(u)}_updateRetainedTiles(u,y){var S;const T={},A={},N=Math.max(y-Qt.maxOverzooming,this._source.minzoom),B=Math.max(y+Qt.maxUnderzooming,this._source.minzoom),$={};for(const q of u){const K=this._addTile(q);T[q.key]=q,K.hasData()||y<this._source.maxzoom&&($[q.key]=q)}this._retainLoadedChildren($,y,B,T);for(const q of u){let K=this._tiles[q.key];if(K.hasData())continue;if(y+1>this._source.maxzoom){const ae=q.children(this._source.maxzoom)[0],ue=this.getTile(ae);if(ue&&ue.hasData()){T[ae.key]=ae;continue}}else{const ae=q.children(this._source.maxzoom);if(T[ae[0].key]&&T[ae[1].key]&&T[ae[2].key]&&T[ae[3].key])continue}let J=K.wasRequested();for(let ae=q.overscaledZ-1;ae>=N;--ae){const ue=q.scaledTo(ae);if(A[ue.key])break;if(A[ue.key]=!0,K=this.getTile(ue),!K&&J&&(K=this._addTile(ue)),K){const fe=K.hasData();if((fe||!(!((S=this.map)===null||S===void 0)&&S.cancelPendingTileRequestsWhileZooming)||J)&&(T[ue.key]=ue),J=K.wasRequested(),fe)break}}}return T}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const u in this._tiles){const y=[];let S,T=this._tiles[u].tileID;for(;T.overscaledZ>0;){if(T.key in this._loadedParentTiles){S=this._loadedParentTiles[T.key];break}y.push(T.key);const A=T.scaledTo(T.overscaledZ-1);if(S=this._getLoadedTile(A),S)break;T=A}for(const A of y)this._loadedParentTiles[A]=S}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const u in this._tiles){const y=this._tiles[u].tileID,S=this._getLoadedTile(y);this._loadedSiblingTiles[y.key]=S}}_addTile(u){let y=this._tiles[u.key];if(y)return y;y=this._cache.getAndRemove(u),y&&(this._setTileReloadTimer(u.key,y),y.tileID=u,this._state.initializeTileState(y,this.map?this.map.painter:null),this._cacheTimers[u.key]&&(clearTimeout(this._cacheTimers[u.key]),delete this._cacheTimers[u.key],this._setTileReloadTimer(u.key,y)));const S=y;return y||(y=new Ln(u,this._source.tileSize*u.overscaleFactor()),this._loadTile(y,u.key,y.state)),y.uses++,this._tiles[u.key]=y,S||this._source.fire(new s.k("dataloading",{tile:y,coord:y.tileID,dataType:"source"})),y}_setTileReloadTimer(u,y){u in this._timers&&(clearTimeout(this._timers[u]),delete this._timers[u]);const S=y.getExpiryTimeout();S&&(this._timers[u]=setTimeout(()=>{this._reloadTile(u,"expired"),delete this._timers[u]},S))}_removeTile(u){const y=this._tiles[u];y&&(y.uses--,delete this._tiles[u],this._timers[u]&&(clearTimeout(this._timers[u]),delete this._timers[u]),y.uses>0||(y.hasData()&&y.state!=="reloading"?this._cache.add(y.tileID,y,y.getExpiryTimeout()):(y.aborted=!0,this._abortTile(y),this._unloadTile(y))))}_dataHandler(u){const y=u.sourceDataType;u.dataType==="source"&&y==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&y==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const u in this._tiles)this._removeTile(u);this._cache.reset()}tilesIn(u,y,S){const T=[],A=this.transform;if(!A)return T;const N=S?A.getCameraQueryGeometry(u):u,B=u.map(fe=>A.pointCoordinate(fe,this.terrain)),$=N.map(fe=>A.pointCoordinate(fe,this.terrain)),q=this.getIds();let K=1/0,J=1/0,ae=-1/0,ue=-1/0;for(const fe of $)K=Math.min(K,fe.x),J=Math.min(J,fe.y),ae=Math.max(ae,fe.x),ue=Math.max(ue,fe.y);for(let fe=0;fe<q.length;fe++){const be=this._tiles[q[fe]];if(be.holdingForFade())continue;const Se=be.tileID,Te=Math.pow(2,A.zoom-be.tileID.overscaledZ),Ce=y*be.queryPadding*s.X/be.tileSize/Te,ve=[Se.getTilePoint(new s.Z(K,J)),Se.getTilePoint(new s.Z(ae,ue))];if(ve[0].x-Ce<s.X&&ve[0].y-Ce<s.X&&ve[1].x+Ce>=0&&ve[1].y+Ce>=0){const Ie=B.map(Ve=>Se.getTilePoint(Ve)),Pe=$.map(Ve=>Se.getTilePoint(Ve));T.push({tile:be,tileID:Se,queryGeometry:Ie,cameraQueryGeometry:Pe,scale:Te})}}return T}getVisibleCoordinates(u){const y=this.getRenderableIds(u).map(S=>this._tiles[S].tileID);for(const S of y)S.posMatrix=this.transform.calculatePosMatrix(S.toUnwrapped());return y}hasTransition(){if(this._source.hasTransition())return!0;if(la(this._source.type)){const u=f.now();for(const y in this._tiles)if(this._tiles[y].fadeEndTime>=u)return!0}return!1}setFeatureState(u,y,S){this._state.updateState(u=u||"_geojsonTileLayer",y,S)}removeFeatureState(u,y,S){this._state.removeFeatureState(u=u||"_geojsonTileLayer",y,S)}getFeatureState(u,y){return this._state.getState(u=u||"_geojsonTileLayer",y)}setDependencies(u,y,S){const T=this._tiles[u];T&&T.setDependencies(y,S)}reloadTilesForDependencies(u,y){for(const S in this._tiles)this._tiles[S].hasDependency(u,y)&&this._reloadTile(S,"reloading");this._cache.filter(S=>!S.hasDependency(u,y))}}function pi(D,u){const y=Math.abs(2*D.wrap)-+(D.wrap<0),S=Math.abs(2*u.wrap)-+(u.wrap<0);return D.overscaledZ-u.overscaledZ||S-y||u.canonical.y-D.canonical.y||u.canonical.x-D.canonical.x}function la(D){return D==="raster"||D==="image"||D==="video"}Qt.maxOverzooming=10,Qt.maxUnderzooming=3;class Lt{constructor(u,y){this.reset(u,y)}reset(u,y){this.points=u||[],this._distances=[0];for(let S=1;S<this.points.length;S++)this._distances[S]=this._distances[S-1]+this.points[S].dist(this.points[S-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(y||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(u){if(this.points.length===1)return this.points[0];u=s.ac(u,0,1);let y=1,S=this._distances[y];const T=u*this.paddedLength+this.padding;for(;S<T&&y<this._distances.length;)S=this._distances[++y];const A=y-1,N=this._distances[A],B=S-N,$=B>0?(T-N)/B:0;return this.points[A].mult(1-$).add(this.points[y].mult($))}}function Di(D,u){let y=!0;return D==="always"||D!=="never"&&u!=="never"||(y=!1),y}class Mi{constructor(u,y,S){const T=this.boxCells=[],A=this.circleCells=[];this.xCellCount=Math.ceil(u/S),this.yCellCount=Math.ceil(y/S);for(let N=0;N<this.xCellCount*this.yCellCount;N++)T.push([]),A.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=u,this.height=y,this.xScale=this.xCellCount/u,this.yScale=this.yCellCount/y,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(u,y,S,T,A){this._forEachCell(y,S,T,A,this._insertBoxCell,this.boxUid++),this.boxKeys.push(u),this.bboxes.push(y),this.bboxes.push(S),this.bboxes.push(T),this.bboxes.push(A)}insertCircle(u,y,S,T){this._forEachCell(y-T,S-T,y+T,S+T,this._insertCircleCell,this.circleUid++),this.circleKeys.push(u),this.circles.push(y),this.circles.push(S),this.circles.push(T)}_insertBoxCell(u,y,S,T,A,N){this.boxCells[A].push(N)}_insertCircleCell(u,y,S,T,A,N){this.circleCells[A].push(N)}_query(u,y,S,T,A,N,B){if(S<0||u>this.width||T<0||y>this.height)return[];const $=[];if(u<=0&&y<=0&&this.width<=S&&this.height<=T){if(A)return[{key:null,x1:u,y1:y,x2:S,y2:T}];for(let q=0;q<this.boxKeys.length;q++)$.push({key:this.boxKeys[q],x1:this.bboxes[4*q],y1:this.bboxes[4*q+1],x2:this.bboxes[4*q+2],y2:this.bboxes[4*q+3]});for(let q=0;q<this.circleKeys.length;q++){const K=this.circles[3*q],J=this.circles[3*q+1],ae=this.circles[3*q+2];$.push({key:this.circleKeys[q],x1:K-ae,y1:J-ae,x2:K+ae,y2:J+ae})}}else this._forEachCell(u,y,S,T,this._queryCell,$,{hitTest:A,overlapMode:N,seenUids:{box:{},circle:{}}},B);return $}query(u,y,S,T){return this._query(u,y,S,T,!1,null)}hitTest(u,y,S,T,A,N){return this._query(u,y,S,T,!0,A,N).length>0}hitTestCircle(u,y,S,T,A){const N=u-S,B=u+S,$=y-S,q=y+S;if(B<0||N>this.width||q<0||$>this.height)return!1;const K=[];return this._forEachCell(N,$,B,q,this._queryCellCircle,K,{hitTest:!0,overlapMode:T,circle:{x:u,y,radius:S},seenUids:{box:{},circle:{}}},A),K.length>0}_queryCell(u,y,S,T,A,N,B,$){const{seenUids:q,hitTest:K,overlapMode:J}=B,ae=this.boxCells[A];if(ae!==null){const fe=this.bboxes;for(const be of ae)if(!q.box[be]){q.box[be]=!0;const Se=4*be,Te=this.boxKeys[be];if(u<=fe[Se+2]&&y<=fe[Se+3]&&S>=fe[Se+0]&&T>=fe[Se+1]&&(!$||$(Te))&&(!K||!Di(J,Te.overlapMode))&&(N.push({key:Te,x1:fe[Se],y1:fe[Se+1],x2:fe[Se+2],y2:fe[Se+3]}),K))return!0}}const ue=this.circleCells[A];if(ue!==null){const fe=this.circles;for(const be of ue)if(!q.circle[be]){q.circle[be]=!0;const Se=3*be,Te=this.circleKeys[be];if(this._circleAndRectCollide(fe[Se],fe[Se+1],fe[Se+2],u,y,S,T)&&(!$||$(Te))&&(!K||!Di(J,Te.overlapMode))){const Ce=fe[Se],ve=fe[Se+1],Ie=fe[Se+2];if(N.push({key:Te,x1:Ce-Ie,y1:ve-Ie,x2:Ce+Ie,y2:ve+Ie}),K)return!0}}}return!1}_queryCellCircle(u,y,S,T,A,N,B,$){const{circle:q,seenUids:K,overlapMode:J}=B,ae=this.boxCells[A];if(ae!==null){const fe=this.bboxes;for(const be of ae)if(!K.box[be]){K.box[be]=!0;const Se=4*be,Te=this.boxKeys[be];if(this._circleAndRectCollide(q.x,q.y,q.radius,fe[Se+0],fe[Se+1],fe[Se+2],fe[Se+3])&&(!$||$(Te))&&!Di(J,Te.overlapMode))return N.push(!0),!0}}const ue=this.circleCells[A];if(ue!==null){const fe=this.circles;for(const be of ue)if(!K.circle[be]){K.circle[be]=!0;const Se=3*be,Te=this.circleKeys[be];if(this._circlesCollide(fe[Se],fe[Se+1],fe[Se+2],q.x,q.y,q.radius)&&(!$||$(Te))&&!Di(J,Te.overlapMode))return N.push(!0),!0}}}_forEachCell(u,y,S,T,A,N,B,$){const q=this._convertToXCellCoord(u),K=this._convertToYCellCoord(y),J=this._convertToXCellCoord(S),ae=this._convertToYCellCoord(T);for(let ue=q;ue<=J;ue++)for(let fe=K;fe<=ae;fe++)if(A.call(this,u,y,S,T,this.xCellCount*fe+ue,N,B,$))return}_convertToXCellCoord(u){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(u*this.xScale)))}_convertToYCellCoord(u){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(u*this.yScale)))}_circlesCollide(u,y,S,T,A,N){const B=T-u,$=A-y,q=S+N;return q*q>B*B+$*$}_circleAndRectCollide(u,y,S,T,A,N,B){const $=(N-T)/2,q=Math.abs(u-(T+$));if(q>$+S)return!1;const K=(B-A)/2,J=Math.abs(y-(A+K));if(J>K+S)return!1;if(q<=$||J<=K)return!0;const ae=q-$,ue=J-K;return ae*ae+ue*ue<=S*S}}function Co(D,u,y,S,T){const A=s.H();return u?(s.K(A,A,[1/T,1/T,1]),y||s.ad(A,A,S.angle)):s.L(A,S.labelPlaneMatrix,D),A}function Ao(D,u,y,S,T){if(u){const A=s.ae(D);return s.K(A,A,[T,T,1]),y||s.ad(A,A,-S.angle),A}return S.glCoordMatrix}function xe(D,u,y,S){let T;S?(T=[D,u,S(D,u),1],s.af(T,T,y)):(T=[D,u,0,1],Or(T,T,y));const A=T[3];return{point:new s.P(T[0]/A,T[1]/A),signedDistanceFromCamera:A,isOccluded:!1}}function re(D,u){return .5+D/u*.5}function te(D,u){return D.x>=-u[0]&&D.x<=u[0]&&D.y>=-u[1]&&D.y<=u[1]}function he(D,u,y,S,T,A,N,B,$,q,K,J,ae,ue,fe){const be=S?D.textSizeData:D.iconSizeData,Se=s.ag(be,y.transform.zoom),Te=[256/y.width*2+1,256/y.height*2+1],Ce=S?D.text.dynamicLayoutVertexArray:D.icon.dynamicLayoutVertexArray;Ce.clear();const ve=D.lineVertexArray,Ie=S?D.text.placedSymbolArray:D.icon.placedSymbolArray,Pe=y.transform.width/y.transform.height;let Ve=!1;for(let Ke=0;Ke<Ie.length;Ke++){const st=Ie.get(Ke);if(st.hidden||st.writingMode===s.ah.vertical&&!Ve){Xt(st.numGlyphs,Ce);continue}Ve=!1;const bt=xe(st.anchorX,st.anchorY,u,fe);if(!te(bt.point,Te)){Xt(st.numGlyphs,Ce);continue}const Mt=re(y.transform.cameraToCenterDistance,bt.signedDistanceFromCamera),gt=s.ai(be,Se,st),pt=N?gt/Mt:gt*Mt,zt={getElevation:fe,labelPlaneMatrix:T,lineVertexArray:ve,pitchWithMap:N,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:q,tileAnchorPoint:new s.P(st.anchorX,st.anchorY),unwrappedTileID:K,width:J,height:ae,translation:ue},or=ke(zt,st,pt,!1,B,u,A,D.glyphOffsetArray,Ce,Pe,$);Ve=or.useVertical,(or.notEnoughRoom||Ve||or.needsFlipping&&ke(zt,st,pt,!0,B,u,A,D.glyphOffsetArray,Ce,Pe,$).notEnoughRoom)&&Xt(st.numGlyphs,Ce)}S?D.text.dynamicLayoutVertexBuffer.updateData(Ce):D.icon.dynamicLayoutVertexBuffer.updateData(Ce)}function _e(D,u,y,S,T,A,N,B){const $=A.glyphStartIndex+A.numGlyphs,q=A.lineStartIndex,K=A.lineStartIndex+A.lineLength,J=u.getoffsetX(A.glyphStartIndex),ae=u.getoffsetX($-1),ue=ft(D*J,y,S,T,A.segment,q,K,B,N);if(!ue)return null;const fe=ft(D*ae,y,S,T,A.segment,q,K,B,N);return fe?B.projectionCache.anyProjectionOccluded?null:{first:ue,last:fe}:null}function De(D,u,y,S){return D===s.ah.horizontal&&Math.abs(y.y-u.y)>Math.abs(y.x-u.x)*S?{useVertical:!0}:(D===s.ah.vertical?u.y<y.y:u.x>y.x)?{needsFlipping:!0}:null}function ke(D,u,y,S,T,A,N,B,$,q,K){const J=y/24,ae=u.lineOffsetX*J,ue=u.lineOffsetY*J;let fe;if(u.numGlyphs>1){const be=u.glyphStartIndex+u.numGlyphs,Se=u.lineStartIndex,Te=u.lineStartIndex+u.lineLength,Ce=_e(J,B,ae,ue,S,u,K,D);if(!Ce)return{notEnoughRoom:!0};const ve=xe(Ce.first.point.x,Ce.first.point.y,N,D.getElevation).point,Ie=xe(Ce.last.point.x,Ce.last.point.y,N,D.getElevation).point;if(T&&!S){const Pe=De(u.writingMode,ve,Ie,q);if(Pe)return Pe}fe=[Ce.first];for(let Pe=u.glyphStartIndex+1;Pe<be-1;Pe++)fe.push(ft(J*B.getoffsetX(Pe),ae,ue,S,u.segment,Se,Te,D,K));fe.push(Ce.last)}else{if(T&&!S){const Se=xe(D.tileAnchorPoint.x,D.tileAnchorPoint.y,A,D.getElevation).point,Te=u.lineStartIndex+u.segment+1,Ce=new s.P(D.lineVertexArray.getx(Te),D.lineVertexArray.gety(Te)),ve=xe(Ce.x,Ce.y,A,D.getElevation),Ie=ve.signedDistanceFromCamera>0?ve.point:function(Ve,Ke,st,bt,Mt,gt){return Ne(Ve,Ke,st,1,Mt,gt)}(D.tileAnchorPoint,Ce,Se,0,A,D),Pe=De(u.writingMode,Se,Ie,q);if(Pe)return Pe}const be=ft(J*B.getoffsetX(u.glyphStartIndex),ae,ue,S,u.segment,u.lineStartIndex,u.lineStartIndex+u.lineLength,D,K);if(!be||D.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};fe=[be]}for(const be of fe)s.aj($,be.point,be.angle);return{}}function Ne(D,u,y,S,T,A){const N=D.add(D.sub(u)._unit()),B=T!==void 0?xe(N.x,N.y,T,A.getElevation).point:We(N.x,N.y,A).point,$=y.sub(B);return y.add($._mult(S/$.mag()))}function Ee(D,u,y){const S=u.projectionCache;if(S.projections[D])return S.projections[D];const T=new s.P(u.lineVertexArray.getx(D),u.lineVertexArray.gety(D)),A=We(T.x,T.y,u);if(A.signedDistanceFromCamera>0)return S.projections[D]=A.point,S.anyProjectionOccluded=S.anyProjectionOccluded||A.isOccluded,A.point;const N=D-y.direction;return function(B,$,q,K,J){return Ne(B,$,q,K,void 0,J)}(y.distanceFromAnchor===0?u.tileAnchorPoint:new s.P(u.lineVertexArray.getx(N),u.lineVertexArray.gety(N)),T,y.previousVertex,y.absOffsetX-y.distanceFromAnchor+1,u)}function We(D,u,y){const S=D+y.translation[0],T=u+y.translation[1];let A;return!y.pitchWithMap&&y.projection.useSpecialProjectionForSymbols?(A=y.projection.projectTileCoordinates(S,T,y.unwrappedTileID,y.getElevation),A.point.x=(.5*A.point.x+.5)*y.width,A.point.y=(.5*-A.point.y+.5)*y.height):(A=xe(S,T,y.labelPlaneMatrix,y.getElevation),A.isOccluded=!1),A}function Je(D,u,y){return D._unit()._perp()._mult(u*y)}function Ge(D,u,y,S,T,A,N,B,$){if(B.projectionCache.offsets[D])return B.projectionCache.offsets[D];const q=y.add(u);if(D+$.direction<S||D+$.direction>=T)return B.projectionCache.offsets[D]=q,q;const K=Ee(D+$.direction,B,$),J=Je(K.sub(y),N,$.direction),ae=y.add(J),ue=K.add(J);return B.projectionCache.offsets[D]=s.ak(A,q,ae,ue)||q,B.projectionCache.offsets[D]}function ft(D,u,y,S,T,A,N,B,$){const q=S?D-u:D+u;let K=q>0?1:-1,J=0;S&&(K*=-1,J=Math.PI),K<0&&(J+=Math.PI);let ae,ue=K>0?A+T:A+T+1;B.projectionCache.cachedAnchorPoint?ae=B.projectionCache.cachedAnchorPoint:(ae=We(B.tileAnchorPoint.x,B.tileAnchorPoint.y,B).point,B.projectionCache.cachedAnchorPoint=ae);let fe,be,Se=ae,Te=ae,Ce=0,ve=0;const Ie=Math.abs(q),Pe=[];let Ve;for(;Ce+ve<=Ie;){if(ue+=K,ue<A||ue>=N)return null;Ce+=ve,Te=Se,be=fe;const bt={absOffsetX:Ie,direction:K,distanceFromAnchor:Ce,previousVertex:Te};if(Se=Ee(ue,B,bt),y===0)Pe.push(Te),Ve=Se.sub(Te);else{let Mt;const gt=Se.sub(Te);Mt=gt.mag()===0?Je(Ee(ue+K,B,bt).sub(Se),y,K):Je(gt,y,K),be||(be=Te.add(Mt)),fe=Ge(ue,Mt,Se,A,N,be,y,B,bt),Pe.push(be),Ve=fe.sub(be)}ve=Ve.mag()}const Ke=Ve._mult((Ie-Ce)/ve)._add(be||Te),st=J+Math.atan2(Se.y-Te.y,Se.x-Te.x);return Pe.push(Ke),{point:Ke,angle:$?st:0,path:Pe}}const Wt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(D,u){for(let y=0;y<D;y++){const S=u.length;u.resize(S+4),u.float32.set(Wt,3*S)}}function Or(D,u,y){const S=u[0],T=u[1];return D[0]=y[0]*S+y[4]*T+y[12],D[1]=y[1]*S+y[5]*T+y[13],D[3]=y[3]*S+y[7]*T+y[15],D}const dr=100;class zr{constructor(u,y,S=new Mi(u.width+200,u.height+200,25),T=new Mi(u.width+200,u.height+200,25)){this.transform=u,this.mapProjection=y,this.grid=S,this.ignoredGrid=T,this.pitchFactor=Math.cos(u._pitch)*u.cameraToCenterDistance,this.screenRightBoundary=u.width+dr,this.screenBottomBoundary=u.height+dr,this.gridRightBoundary=u.width+200,this.gridBottomBoundary=u.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(u,y,S,T,A,N,B,$,q,K,J){const ae=u.anchorPointX+$[0],ue=u.anchorPointY+$[1],fe=this.projectAndGetPerspectiveRatio(T,ae,ue,A,K),be=S*fe.perspectiveRatio;let Se;if(N||B)Se=this._projectCollisionBox(u,be,T,A,N,B,$,fe,K,J);else{const Pe=fe.point.x+(J?J.x*be:0),Ve=fe.point.y+(J?J.y*be:0);Se={allPointsOccluded:!1,box:[Pe+u.x1*be,Ve+u.y1*be,Pe+u.x2*be,Ve+u.y2*be]}}const[Te,Ce,ve,Ie]=Se.box;return this.mapProjection.useSpecialProjectionForSymbols&&(N?Se.allPointsOccluded:this.mapProjection.isOccluded(ae,ue,A))||fe.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(Te,Ce,ve,Ie)||y!=="always"&&this.grid.hitTest(Te,Ce,ve,Ie,y,q)?{box:[Te,Ce,ve,Ie],placeable:!1,offscreen:!1}:{box:[Te,Ce,ve,Ie],placeable:!0,offscreen:this.isOffscreen(Te,Ce,ve,Ie)}}placeCollisionCircles(u,y,S,T,A,N,B,$,q,K,J,ae,ue,fe,be,Se){const Te=[],Ce=new s.P(y.anchorX,y.anchorY),ve=this.getPerspectiveRatio(N,Ce.x,Ce.y,B,Se),Ie=(J?A/ve:A*ve)/s.ap,Pe={getElevation:Se,labelPlaneMatrix:$,lineVertexArray:S,pitchWithMap:J,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Ce,unwrappedTileID:B,width:this.transform.width,height:this.transform.height,translation:be},Ve=_e(Ie,T,y.lineOffsetX*Ie,y.lineOffsetY*Ie,!1,y,!1,Pe);let Ke=!1,st=!1,bt=!0;if(Ve){const Mt=.5*ue*ve+fe,gt=new s.P(-100,-100),pt=new s.P(this.screenRightBoundary,this.screenBottomBoundary),zt=new Lt,or=Ve.first,mt=Ve.last;let Et=[];for(let mr=or.path.length-1;mr>=1;mr--)Et.push(or.path[mr]);for(let mr=1;mr<mt.path.length;mr++)Et.push(mt.path[mr]);const rr=2.5*Mt;if(q){const mr=this.projectPathToScreenSpace(Et,Pe,q);Et=mr.some(Mr=>Mr.signedDistanceFromCamera<=0)?[]:mr.map(Mr=>Mr.point)}let fn=[];if(Et.length>0){const mr=Et[0].clone(),Mr=Et[0].clone();for(let pn=1;pn<Et.length;pn++)mr.x=Math.min(mr.x,Et[pn].x),mr.y=Math.min(mr.y,Et[pn].y),Mr.x=Math.max(Mr.x,Et[pn].x),Mr.y=Math.max(Mr.y,Et[pn].y);fn=mr.x>=gt.x&&Mr.x<=pt.x&&mr.y>=gt.y&&Mr.y<=pt.y?[Et]:Mr.x<gt.x||mr.x>pt.x||Mr.y<gt.y||mr.y>pt.y?[]:s.al([Et],gt.x,gt.y,pt.x,pt.y)}for(const mr of fn){zt.reset(mr,.25*Mt);let Mr=0;Mr=zt.length<=.5*Mt?1:Math.ceil(zt.paddedLength/rr)+1;for(let pn=0;pn<Mr;pn++){const vi=pn/Math.max(Mr-1,1),ja=zt.lerp(vi),gn=ja.x+dr,Ui=ja.y+dr;Te.push(gn,Ui,Mt,0);const ki=gn-Mt,mi=Ui-Mt,Li=gn+Mt,ko=Ui+Mt;if(bt=bt&&this.isOffscreen(ki,mi,Li,ko),st=st||this.isInsideGrid(ki,mi,Li,ko),u!=="always"&&this.grid.hitTestCircle(gn,Ui,Mt,u,ae)&&(Ke=!0,!K))return{circles:[],offscreen:!1,collisionDetected:Ke}}}}return{circles:!K&&Ke||!st||ve<this.perspectiveRatioCutoff?[]:Te,offscreen:bt,collisionDetected:Ke}}projectPathToScreenSpace(u,y,S){return u.map(T=>xe(T.x,T.y,S,y.getElevation))}queryRenderedSymbols(u){if(u.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const y=[];let S=1/0,T=1/0,A=-1/0,N=-1/0;for(const K of u){const J=new s.P(K.x+dr,K.y+dr);S=Math.min(S,J.x),T=Math.min(T,J.y),A=Math.max(A,J.x),N=Math.max(N,J.y),y.push(J)}const B=this.grid.query(S,T,A,N).concat(this.ignoredGrid.query(S,T,A,N)),$={},q={};for(const K of B){const J=K.key;if($[J.bucketInstanceId]===void 0&&($[J.bucketInstanceId]={}),$[J.bucketInstanceId][J.featureIndex])continue;const ae=[new s.P(K.x1,K.y1),new s.P(K.x2,K.y1),new s.P(K.x2,K.y2),new s.P(K.x1,K.y2)];s.am(y,ae)&&($[J.bucketInstanceId][J.featureIndex]=!0,q[J.bucketInstanceId]===void 0&&(q[J.bucketInstanceId]=[]),q[J.bucketInstanceId].push(J.featureIndex))}return q}insertCollisionBox(u,y,S,T,A,N){(S?this.ignoredGrid:this.grid).insert({bucketInstanceId:T,featureIndex:A,collisionGroupID:N,overlapMode:y},u[0],u[1],u[2],u[3])}insertCollisionCircles(u,y,S,T,A,N){const B=S?this.ignoredGrid:this.grid,$={bucketInstanceId:T,featureIndex:A,collisionGroupID:N,overlapMode:y};for(let q=0;q<u.length;q+=4)B.insertCircle($,u[q],u[q+1],u[q+2])}projectAndGetPerspectiveRatio(u,y,S,T,A){let N;A?(N=[y,S,A(y,S),1],s.af(N,N,u)):(N=[y,S,0,1],Or(N,N,u));const B=N[3];return{point:new s.P((N[0]/B+1)/2*this.transform.width+dr,(-N[1]/B+1)/2*this.transform.height+dr),perspectiveRatio:.5+this.transform.cameraToCenterDistance/B*.5,isOccluded:!1,signedDistanceFromCamera:B}}getPerspectiveRatio(u,y,S,T,A){const N=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(y,S,T,A):xe(y,S,u,A);return .5+this.transform.cameraToCenterDistance/N.signedDistanceFromCamera*.5}isOffscreen(u,y,S,T){return S<dr||u>=this.screenRightBoundary||T<dr||y>this.screenBottomBoundary}isInsideGrid(u,y,S,T){return S>=0&&u<this.gridRightBoundary&&T>=0&&y<this.gridBottomBoundary}getViewportMatrix(){const u=s.an([]);return s.J(u,u,[-100,-100,0]),u}_projectCollisionBox(u,y,S,T,A,N,B,$,q,K){let J=new s.P(1,0),ae=new s.P(0,1);const ue=new s.P(u.anchorPointX+B[0],u.anchorPointY+B[1]);if(N&&!A){const bt=this.projectAndGetPerspectiveRatio(S,ue.x+1,ue.y,T,q).point.sub($.point).unit(),Mt=Math.atan(bt.y/bt.x)+(bt.x<0?Math.PI:0),gt=Math.sin(Mt),pt=Math.cos(Mt);J=new s.P(pt,gt),ae=new s.P(-gt,pt)}else if(!N&&A){const bt=-this.transform.angle,Mt=Math.sin(bt),gt=Math.cos(bt);J=new s.P(gt,Mt),ae=new s.P(-Mt,gt)}let fe=$.point,be=y;if(A){fe=ue;const bt=this.transform.zoom-Math.floor(this.transform.zoom);be=Math.pow(2,-bt),be*=this.mapProjection.getPitchedTextCorrection(this.transform,ue,T),K||(be*=s.ac(.5+$.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}K&&(fe=fe.add(J.mult(K.x*be)).add(ae.mult(K.y*be)));const Se=u.x1*be,Te=u.x2*be,Ce=(Se+Te)/2,ve=u.y1*be,Ie=u.y2*be,Pe=(ve+Ie)/2,Ve=[{offsetX:Se,offsetY:ve},{offsetX:Ce,offsetY:ve},{offsetX:Te,offsetY:ve},{offsetX:Te,offsetY:Pe},{offsetX:Te,offsetY:Ie},{offsetX:Ce,offsetY:Ie},{offsetX:Se,offsetY:Ie},{offsetX:Se,offsetY:Pe}];let Ke=[];for(const{offsetX:bt,offsetY:Mt}of Ve)Ke.push(new s.P(fe.x+J.x*bt+ae.x*Mt,fe.y+J.y*bt+ae.y*Mt));let st=!1;if(A){const bt=Ke.map(Mt=>this.projectAndGetPerspectiveRatio(S,Mt.x,Mt.y,T,q));st=bt.some(Mt=>!Mt.isOccluded),Ke=bt.map(Mt=>Mt.point)}else st=!0;return{box:s.ao(Ke),allPointsOccluded:!st}}}function Dr(D,u,y){return u*(s.X/(D.tileSize*Math.pow(2,y-D.tileID.overscaledZ)))}class Bn{constructor(u,y,S,T){this.opacity=u?Math.max(0,Math.min(1,u.opacity+(u.placed?y:-y))):T&&S?1:0,this.placed=S}isHidden(){return this.opacity===0&&!this.placed}}class Sn{constructor(u,y,S,T,A){this.text=new Bn(u?u.text:null,y,S,A),this.icon=new Bn(u?u.icon:null,y,T,A)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class xr{constructor(u,y,S){this.text=u,this.icon=y,this.skipFade=S}}class jr{constructor(){this.invProjMatrix=s.H(),this.viewportMatrix=s.H(),this.circles=[]}}class _n{constructor(u,y,S,T,A){this.bucketInstanceId=u,this.featureIndex=y,this.sourceLayerIndex=S,this.bucketIndex=T,this.tileID=A}}class Yn{constructor(u){this.crossSourceCollisions=u,this.maxGroupID=0,this.collisionGroups={}}get(u){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[u]){const y=++this.maxGroupID;this.collisionGroups[u]={ID:y,predicate:S=>S.collisionGroupID===y}}return this.collisionGroups[u]}}function li(D,u,y,S,T){const{horizontalAlign:A,verticalAlign:N}=s.au(D);return new s.P(-(A-.5)*u+S[0]*T,-(N-.5)*y+S[1]*T)}class Ii{constructor(u,y,S,T,A,N){this.transform=u.clone(),this.terrain=S,this.collisionIndex=new zr(this.transform,y),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=T,this.retainedQueryData={},this.collisionGroups=new Yn(A),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=N,N&&(N.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(u){const y=this.terrain;return y?(S,T)=>y.getElevation(u,S,T):null}getBucketParts(u,y,S,T){const A=S.getBucket(y),N=S.latestFeatureIndex;if(!A||!N||y.id!==A.layerIds[0])return;const B=S.collisionBoxArray,$=A.layers[0].layout,q=A.layers[0].paint,K=Math.pow(2,this.transform.zoom-S.tileID.overscaledZ),J=S.tileSize/s.X,ae=S.tileID.toUnwrapped(),ue=this.transform.calculatePosMatrix(ae),fe=$.get("text-pitch-alignment")==="map",be=$.get("text-rotation-alignment")==="map",Se=Dr(S,1,this.transform.zoom),Te=this.collisionIndex.mapProjection.translatePosition(this.transform,S,q.get("text-translate"),q.get("text-translate-anchor")),Ce=this.collisionIndex.mapProjection.translatePosition(this.transform,S,q.get("icon-translate"),q.get("icon-translate-anchor")),ve=Co(ue,fe,be,this.transform,Se);let Ie=null;if(fe){const Ve=Ao(ue,fe,be,this.transform,Se);Ie=s.L([],this.transform.labelPlaneMatrix,Ve)}this.retainedQueryData[A.bucketInstanceId]=new _n(A.bucketInstanceId,N,A.sourceLayerIndex,A.index,S.tileID);const Pe={bucket:A,layout:$,translationText:Te,translationIcon:Ce,posMatrix:ue,unwrappedTileID:ae,textLabelPlaneMatrix:ve,labelToScreenMatrix:Ie,scale:K,textPixelRatio:J,holdingForFade:S.holdingForFade(),collisionBoxArray:B,partiallyEvaluatedTextSize:s.ag(A.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(A.sourceID)};if(T)for(const Ve of A.sortKeyRanges){const{sortKey:Ke,symbolInstanceStart:st,symbolInstanceEnd:bt}=Ve;u.push({sortKey:Ke,symbolInstanceStart:st,symbolInstanceEnd:bt,parameters:Pe})}else u.push({symbolInstanceStart:0,symbolInstanceEnd:A.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(u,y,S,T,A,N,B,$,q,K,J,ae,ue,fe,be,Se,Te,Ce,ve){const Ie=s.aq[u.textAnchor],Pe=[u.textOffset0,u.textOffset1],Ve=li(Ie,S,T,Pe,A),Ke=this.collisionIndex.placeCollisionBox(y,ae,$,q,K,B,N,Se,J.predicate,ve,Ve);if((!Ce||this.collisionIndex.placeCollisionBox(Ce,ae,$,q,K,B,N,Te,J.predicate,ve,Ve).placeable)&&Ke.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ue.crossTileID]&&this.prevPlacement.placements[ue.crossTileID]&&this.prevPlacement.placements[ue.crossTileID].text&&(st=this.prevPlacement.variableOffsets[ue.crossTileID].anchor),ue.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ue.crossTileID]={textOffset:Pe,width:S,height:T,anchor:Ie,textBoxScale:A,prevAnchor:st},this.markUsedJustification(fe,Ie,ue,be),fe.allowVerticalPlacement&&(this.markUsedOrientation(fe,be,ue),this.placedOrientations[ue.crossTileID]=be),{shift:Ve,placedGlyphBoxes:Ke}}}placeLayerBucketPart(u,y,S){const{bucket:T,layout:A,translationText:N,translationIcon:B,posMatrix:$,unwrappedTileID:q,textLabelPlaneMatrix:K,labelToScreenMatrix:J,textPixelRatio:ae,holdingForFade:ue,collisionBoxArray:fe,partiallyEvaluatedTextSize:be,collisionGroup:Se}=u.parameters,Te=A.get("text-optional"),Ce=A.get("icon-optional"),ve=s.ar(A,"text-overlap","text-allow-overlap"),Ie=ve==="always",Pe=s.ar(A,"icon-overlap","icon-allow-overlap"),Ve=Pe==="always",Ke=A.get("text-rotation-alignment")==="map",st=A.get("text-pitch-alignment")==="map",bt=A.get("icon-text-fit")!=="none",Mt=A.get("symbol-z-order")==="viewport-y",gt=Ie&&(Ve||!T.hasIconData()||Ce),pt=Ve&&(Ie||!T.hasTextData()||Te);!T.collisionArrays&&fe&&T.deserializeCollisionBoxes(fe);const zt=this._getTerrainElevationFunc(this.retainedQueryData[T.bucketInstanceId].tileID),or=(mt,Et,rr)=>{var fn,mr;if(y[mt.crossTileID])return;if(ue)return void(this.placements[mt.crossTileID]=new xr(!1,!1,!1));let Mr=!1,pn=!1,vi=!0,ja=null,gn={box:null,placeable:!1,offscreen:null},Ui={box:null,placeable:!1,offscreen:null},ki=null,mi=null,Li=null,ko=0,kc=0,Of=0;Et.textFeatureIndex?ko=Et.textFeatureIndex:mt.useRuntimeCollisionCircles&&(ko=mt.featureIndex),Et.verticalTextFeatureIndex&&(kc=Et.verticalTextFeatureIndex);const Lc=Et.textBox;if(Lc){const ka=ci=>{let yi=s.ah.horizontal;if(T.allowVerticalPlacement&&!ci&&this.prevPlacement){const pa=this.prevPlacement.placedOrientations[mt.crossTileID];pa&&(this.placedOrientations[mt.crossTileID]=pa,yi=pa,this.markUsedOrientation(T,yi,mt))}return yi},La=(ci,yi)=>{if(T.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&Et.verticalTextBox){for(const pa of T.writingModes)if(pa===s.ah.vertical?(gn=yi(),Ui=gn):gn=ci(),gn&&gn.placeable)break}else gn=ci()},Ms=mt.textAnchorOffsetStartIndex,Xa=mt.textAnchorOffsetEndIndex;if(Xa===Ms){const ci=(yi,pa)=>{const Pr=this.collisionIndex.placeCollisionBox(yi,ve,ae,$,q,st,Ke,N,Se.predicate,zt);return Pr&&Pr.placeable&&(this.markUsedOrientation(T,pa,mt),this.placedOrientations[mt.crossTileID]=pa),Pr};La(()=>ci(Lc,s.ah.horizontal),()=>{const yi=Et.verticalTextBox;return T.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&yi?ci(yi,s.ah.vertical):{box:null,offscreen:null}}),ka(gn&&gn.placeable)}else{let ci=s.aq[(mr=(fn=this.prevPlacement)===null||fn===void 0?void 0:fn.variableOffsets[mt.crossTileID])===null||mr===void 0?void 0:mr.anchor];const yi=(Pr,yl,Pc)=>{const Rc=Pr.x2-Pr.x1,Ob=Pr.y2-Pr.y1,NA=mt.textBoxScale,zb=bt&&Pe==="never"?yl:null;let Is=null,Bb=ve==="never"?1:2,Bf="never";ci&&Bb++;for(let Ih=0;Ih<Bb;Ih++){for(let Vf=Ms;Vf<Xa;Vf++){const Ff=T.textAnchorOffsets.get(Vf);if(ci&&Ff.textAnchor!==ci)continue;const Nc=this.attemptAnchorPlacement(Ff,Pr,Rc,Ob,NA,Ke,st,ae,$,q,Se,Bf,mt,T,Pc,N,B,zb,zt);if(Nc&&(Is=Nc.placedGlyphBoxes,Is&&Is.placeable))return Mr=!0,ja=Nc.shift,Is}ci?ci=null:Bf=ve}return S&&!Is&&(Is={box:this.collisionIndex.placeCollisionBox(Lc,"always",ae,$,q,st,Ke,N,Se.predicate,zt,new s.P(0,0)).box,offscreen:!1,placeable:!1}),Is};La(()=>yi(Lc,Et.iconBox,s.ah.horizontal),()=>{const Pr=Et.verticalTextBox;return T.allowVerticalPlacement&&(!gn||!gn.placeable)&&mt.numVerticalGlyphVertices>0&&Pr?yi(Pr,Et.verticalIconBox,s.ah.vertical):{box:null,occluded:!0,offscreen:null}}),gn&&(Mr=gn.placeable,vi=gn.offscreen);const pa=ka(gn&&gn.placeable);if(!Mr&&this.prevPlacement){const Pr=this.prevPlacement.variableOffsets[mt.crossTileID];Pr&&(this.variableOffsets[mt.crossTileID]=Pr,this.markUsedJustification(T,Pr.anchor,mt,pa))}}}if(ki=gn,Mr=ki&&ki.placeable,vi=ki&&ki.offscreen,mt.useRuntimeCollisionCircles){const ka=T.text.placedSymbolArray.get(mt.centerJustifiedTextSymbolIndex),La=s.ai(T.textSizeData,be,ka),Ms=A.get("text-padding");mi=this.collisionIndex.placeCollisionCircles(ve,ka,T.lineVertexArray,T.glyphOffsetArray,La,$,q,K,J,S,st,Se.predicate,mt.collisionCircleDiameter,Ms,N,zt),mi.circles.length&&mi.collisionDetected&&!S&&s.w("Collisions detected, but collision boxes are not shown"),Mr=Ie||mi.circles.length>0&&!mi.collisionDetected,vi=vi&&mi.offscreen}if(Et.iconFeatureIndex&&(Of=Et.iconFeatureIndex),Et.iconBox){const ka=La=>this.collisionIndex.placeCollisionBox(La,Pe,ae,$,q,st,Ke,B,Se.predicate,zt,bt&&ja?ja:void 0);Ui&&Ui.placeable&&Et.verticalIconBox?(Li=ka(Et.verticalIconBox),pn=Li.placeable):(Li=ka(Et.iconBox),pn=Li.placeable),vi=vi&&Li.offscreen}const Ia=Te||mt.numHorizontalGlyphVertices===0&&mt.numVerticalGlyphVertices===0,zf=Ce||mt.numIconVertices===0;Ia||zf?zf?Ia||(pn=pn&&Mr):Mr=pn&&Mr:pn=Mr=pn&&Mr;const Jv=pn&&Li.placeable;if(Mr&&ki.placeable&&this.collisionIndex.insertCollisionBox(ki.box,ve,A.get("text-ignore-placement"),T.bucketInstanceId,Ui&&Ui.placeable&&kc?kc:ko,Se.ID),Jv&&this.collisionIndex.insertCollisionBox(Li.box,Pe,A.get("icon-ignore-placement"),T.bucketInstanceId,Of,Se.ID),mi&&Mr&&this.collisionIndex.insertCollisionCircles(mi.circles,ve,A.get("text-ignore-placement"),T.bucketInstanceId,ko,Se.ID),S&&this.storeCollisionData(T.bucketInstanceId,rr,Et,ki,Li,mi),mt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(T.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[mt.crossTileID]=new xr(Mr||gt,pn||pt,vi||T.justReloaded),y[mt.crossTileID]=!0};if(Mt){if(u.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const mt=T.getSortedSymbolIndexes(this.transform.angle);for(let Et=mt.length-1;Et>=0;--Et){const rr=mt[Et];or(T.symbolInstances.get(rr),T.collisionArrays[rr],rr)}}else for(let mt=u.symbolInstanceStart;mt<u.symbolInstanceEnd;mt++)or(T.symbolInstances.get(mt),T.collisionArrays[mt],mt);if(S&&T.bucketInstanceId in this.collisionCircleArrays){const mt=this.collisionCircleArrays[T.bucketInstanceId];s.as(mt.invProjMatrix,$),mt.viewportMatrix=this.collisionIndex.getViewportMatrix()}T.justReloaded=!1}storeCollisionData(u,y,S,T,A,N){if(S.textBox||S.iconBox){let B,$;this.collisionBoxArrays.has(u)?B=this.collisionBoxArrays.get(u):(B=new Map,this.collisionBoxArrays.set(u,B)),B.has(y)?$=B.get(y):($={text:null,icon:null},B.set(y,$)),S.textBox&&($.text=T.box),S.iconBox&&($.icon=A.box)}if(N){let B=this.collisionCircleArrays[u];B===void 0&&(B=this.collisionCircleArrays[u]=new jr);for(let $=0;$<N.circles.length;$+=4)B.circles.push(N.circles[$+0]),B.circles.push(N.circles[$+1]),B.circles.push(N.circles[$+2]),B.circles.push(N.collisionDetected?1:0)}}markUsedJustification(u,y,S,T){let A;A=T===s.ah.vertical?S.verticalPlacedTextSymbolIndex:{left:S.leftJustifiedTextSymbolIndex,center:S.centerJustifiedTextSymbolIndex,right:S.rightJustifiedTextSymbolIndex}[s.at(y)];const N=[S.leftJustifiedTextSymbolIndex,S.centerJustifiedTextSymbolIndex,S.rightJustifiedTextSymbolIndex,S.verticalPlacedTextSymbolIndex];for(const B of N)B>=0&&(u.text.placedSymbolArray.get(B).crossTileID=A>=0&&B!==A?0:S.crossTileID)}markUsedOrientation(u,y,S){const T=y===s.ah.horizontal||y===s.ah.horizontalOnly?y:0,A=y===s.ah.vertical?y:0,N=[S.leftJustifiedTextSymbolIndex,S.centerJustifiedTextSymbolIndex,S.rightJustifiedTextSymbolIndex];for(const B of N)u.text.placedSymbolArray.get(B).placedOrientation=T;S.verticalPlacedTextSymbolIndex&&(u.text.placedSymbolArray.get(S.verticalPlacedTextSymbolIndex).placedOrientation=A)}commit(u){this.commitTime=u,this.zoomAtLastRecencyCheck=this.transform.zoom;const y=this.prevPlacement;let S=!1;this.prevZoomAdjustment=y?y.zoomAdjustment(this.transform.zoom):0;const T=y?y.symbolFadeChange(u):1,A=y?y.opacities:{},N=y?y.variableOffsets:{},B=y?y.placedOrientations:{};for(const $ in this.placements){const q=this.placements[$],K=A[$];K?(this.opacities[$]=new Sn(K,T,q.text,q.icon),S=S||q.text!==K.text.placed||q.icon!==K.icon.placed):(this.opacities[$]=new Sn(null,T,q.text,q.icon,q.skipFade),S=S||q.text||q.icon)}for(const $ in A){const q=A[$];if(!this.opacities[$]){const K=new Sn(q,T,!1,!1);K.isHidden()||(this.opacities[$]=K,S=S||q.text.placed||q.icon.placed)}}for(const $ in N)this.variableOffsets[$]||!this.opacities[$]||this.opacities[$].isHidden()||(this.variableOffsets[$]=N[$]);for(const $ in B)this.placedOrientations[$]||!this.opacities[$]||this.opacities[$].isHidden()||(this.placedOrientations[$]=B[$]);if(y&&y.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");S?this.lastPlacementChangeTime=u:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=y?y.lastPlacementChangeTime:u)}updateLayerOpacities(u,y){const S={};for(const T of y){const A=T.getBucket(u);A&&T.latestFeatureIndex&&u.id===A.layerIds[0]&&this.updateBucketOpacities(A,T.tileID,S,T.collisionBoxArray)}}updateBucketOpacities(u,y,S,T){u.hasTextData()&&(u.text.opacityVertexArray.clear(),u.text.hasVisibleVertices=!1),u.hasIconData()&&(u.icon.opacityVertexArray.clear(),u.icon.hasVisibleVertices=!1),u.hasIconCollisionBoxData()&&u.iconCollisionBox.collisionVertexArray.clear(),u.hasTextCollisionBoxData()&&u.textCollisionBox.collisionVertexArray.clear();const A=u.layers[0],N=A.layout,B=new Sn(null,0,!1,!1,!0),$=N.get("text-allow-overlap"),q=N.get("icon-allow-overlap"),K=A._unevaluatedLayout.hasValue("text-variable-anchor")||A._unevaluatedLayout.hasValue("text-variable-anchor-offset"),J=N.get("text-rotation-alignment")==="map",ae=N.get("text-pitch-alignment")==="map",ue=N.get("icon-text-fit")!=="none",fe=new Sn(null,0,$&&(q||!u.hasIconData()||N.get("icon-optional")),q&&($||!u.hasTextData()||N.get("text-optional")),!0);!u.collisionArrays&&T&&(u.hasIconCollisionBoxData()||u.hasTextCollisionBoxData())&&u.deserializeCollisionBoxes(T);const be=(Te,Ce,ve)=>{for(let Ie=0;Ie<Ce/4;Ie++)Te.opacityVertexArray.emplaceBack(ve);Te.hasVisibleVertices=Te.hasVisibleVertices||ve!==uc},Se=this.collisionBoxArrays.get(u.bucketInstanceId);for(let Te=0;Te<u.symbolInstances.length;Te++){const Ce=u.symbolInstances.get(Te),{numHorizontalGlyphVertices:ve,numVerticalGlyphVertices:Ie,crossTileID:Pe}=Ce;let Ve=this.opacities[Pe];S[Pe]?Ve=B:Ve||(Ve=fe,this.opacities[Pe]=Ve),S[Pe]=!0;const Ke=Ce.numIconVertices>0,st=this.placedOrientations[Ce.crossTileID],bt=st===s.ah.vertical,Mt=st===s.ah.horizontal||st===s.ah.horizontalOnly;if(ve>0||Ie>0){const pt=ha(Ve.text);be(u.text,ve,bt?uc:pt),be(u.text,Ie,Mt?uc:pt);const zt=Ve.text.isHidden();[Ce.rightJustifiedTextSymbolIndex,Ce.centerJustifiedTextSymbolIndex,Ce.leftJustifiedTextSymbolIndex].forEach(Et=>{Et>=0&&(u.text.placedSymbolArray.get(Et).hidden=zt||bt?1:0)}),Ce.verticalPlacedTextSymbolIndex>=0&&(u.text.placedSymbolArray.get(Ce.verticalPlacedTextSymbolIndex).hidden=zt||Mt?1:0);const or=this.variableOffsets[Ce.crossTileID];or&&this.markUsedJustification(u,or.anchor,Ce,st);const mt=this.placedOrientations[Ce.crossTileID];mt&&(this.markUsedJustification(u,"left",Ce,mt),this.markUsedOrientation(u,mt,Ce))}if(Ke){const pt=ha(Ve.icon),zt=!(ue&&Ce.verticalPlacedIconSymbolIndex&&bt);Ce.placedIconSymbolIndex>=0&&(be(u.icon,Ce.numIconVertices,zt?pt:uc),u.icon.placedSymbolArray.get(Ce.placedIconSymbolIndex).hidden=Ve.icon.isHidden()),Ce.verticalPlacedIconSymbolIndex>=0&&(be(u.icon,Ce.numVerticalIconVertices,zt?uc:pt),u.icon.placedSymbolArray.get(Ce.verticalPlacedIconSymbolIndex).hidden=Ve.icon.isHidden())}const gt=Se&&Se.has(Te)?Se.get(Te):{text:null,icon:null};if(u.hasIconCollisionBoxData()||u.hasTextCollisionBoxData()){const pt=u.collisionArrays[Te];if(pt){let zt=new s.P(0,0);if(pt.textBox||pt.verticalTextBox){let or=!0;if(K){const mt=this.variableOffsets[Pe];mt?(zt=li(mt.anchor,mt.width,mt.height,mt.textOffset,mt.textBoxScale),J&&zt._rotate(ae?this.transform.angle:-this.transform.angle)):or=!1}if(pt.textBox||pt.verticalTextBox){let mt;pt.textBox&&(mt=bt),pt.verticalTextBox&&(mt=Mt),cc(u.textCollisionBox.collisionVertexArray,Ve.text.placed,!or||mt,gt.text,zt.x,zt.y)}}if(pt.iconBox||pt.verticalIconBox){const or=!!(!Mt&&pt.verticalIconBox);let mt;pt.iconBox&&(mt=or),pt.verticalIconBox&&(mt=!or),cc(u.iconCollisionBox.collisionVertexArray,Ve.icon.placed,mt,gt.icon,ue?zt.x:0,ue?zt.y:0)}}}}if(u.sortFeatures(this.transform.angle),this.retainedQueryData[u.bucketInstanceId]&&(this.retainedQueryData[u.bucketInstanceId].featureSortOrder=u.featureSortOrder),u.hasTextData()&&u.text.opacityVertexBuffer&&u.text.opacityVertexBuffer.updateData(u.text.opacityVertexArray),u.hasIconData()&&u.icon.opacityVertexBuffer&&u.icon.opacityVertexBuffer.updateData(u.icon.opacityVertexArray),u.hasIconCollisionBoxData()&&u.iconCollisionBox.collisionVertexBuffer&&u.iconCollisionBox.collisionVertexBuffer.updateData(u.iconCollisionBox.collisionVertexArray),u.hasTextCollisionBoxData()&&u.textCollisionBox.collisionVertexBuffer&&u.textCollisionBox.collisionVertexBuffer.updateData(u.textCollisionBox.collisionVertexArray),u.text.opacityVertexArray.length!==u.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${u.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${u.text.layoutVertexArray.length}) / 4`);if(u.icon.opacityVertexArray.length!==u.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${u.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${u.icon.layoutVertexArray.length}) / 4`);if(u.bucketInstanceId in this.collisionCircleArrays){const Te=this.collisionCircleArrays[u.bucketInstanceId];u.placementInvProjMatrix=Te.invProjMatrix,u.placementViewportMatrix=Te.viewportMatrix,u.collisionCircleArray=Te.circles,delete this.collisionCircleArrays[u.bucketInstanceId]}}symbolFadeChange(u){return this.fadeDuration===0?1:(u-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(u){return Math.max(0,(this.transform.zoom-u)/1.5)}hasTransitions(u){return this.stale||u-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(u,y){const S=this.zoomAtLastRecencyCheck===y?1-this.zoomAdjustment(y):1;return this.zoomAtLastRecencyCheck=y,this.commitTime+this.fadeDuration*S>u}setStale(){this.stale=!0}}function cc(D,u,y,S,T,A){S&&S.length!==0||(S=[0,0,0,0]);const N=S[0]-dr,B=S[1]-dr,$=S[2]-dr,q=S[3]-dr;D.emplaceBack(u?1:0,y?1:0,T||0,A||0,N,B),D.emplaceBack(u?1:0,y?1:0,T||0,A||0,$,B),D.emplaceBack(u?1:0,y?1:0,T||0,A||0,$,q),D.emplaceBack(u?1:0,y?1:0,T||0,A||0,N,q)}const Xr=Math.pow(2,25),cv=Math.pow(2,24),uv=Math.pow(2,17),ca=Math.pow(2,16),ua=Math.pow(2,9),cA=Math.pow(2,8),Ca=Math.pow(2,1);function ha(D){if(D.opacity===0&&!D.placed)return 0;if(D.opacity===1&&D.placed)return 4294967295;const u=D.placed?1:0,y=Math.floor(127*D.opacity);return y*Xr+u*cv+y*uv+u*ca+y*ua+u*cA+y*Ca+u}const uc=0;function ol(){return{isOccluded:(D,u,y)=>!1,getPitchedTextCorrection:(D,u,y)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(D,u,y,S){throw new Error("Not implemented.")},translatePosition:(D,u,y,S)=>function(T,A,N,B,$=!1){if(!N[0]&&!N[1])return[0,0];const q=$?B==="map"?T.angle:0:B==="viewport"?-T.angle:0;if(q){const K=Math.sin(q),J=Math.cos(q);N=[N[0]*J-N[1]*K,N[0]*K+N[1]*J]}return[$?N[0]:Dr(A,N[0],T.zoom),$?N[1]:Dr(A,N[1],T.zoom)]}(D,u,y,S),getCircleRadiusCorrection:D=>1}}class Vn{constructor(u){this._sortAcrossTiles=u.layout.get("symbol-z-order")!=="viewport-y"&&!u.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(u,y,S,T,A){const N=this._bucketParts;for(;this._currentTileIndex<u.length;)if(y.getBucketParts(N,T,u[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,A())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,N.sort((B,$)=>B.sortKey-$.sortKey));this._currentPartIndex<N.length;)if(y.placeLayerBucketPart(N[this._currentPartIndex],this._seenCrossTileIDs,S),this._currentPartIndex++,A())return!0;return!1}}class dh{constructor(u,y,S,T,A,N,B,$){this.placement=new Ii(u,ol(),y,N,B,$),this._currentPlacementIndex=S.length-1,this._forceFullPlacement=T,this._showCollisionBoxes=A,this._done=!1}isDone(){return this._done}continuePlacement(u,y,S){const T=f.now(),A=()=>!this._forceFullPlacement&&f.now()-T>2;for(;this._currentPlacementIndex>=0;){const N=y[u[this._currentPlacementIndex]],B=this.placement.collisionIndex.transform.zoom;if(N.type==="symbol"&&(!N.minzoom||N.minzoom<=B)&&(!N.maxzoom||N.maxzoom>B)){if(this._inProgressLayer||(this._inProgressLayer=new Vn(N)),this._inProgressLayer.continuePlacement(S[N.source],this.placement,this._showCollisionBoxes,N,A))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(u){return this.placement.commit(u),this.placement}}const Ua=512/s.X/2;class Pn{constructor(u,y,S){this.tileID=u,this.bucketInstanceId=S,this._symbolsByKey={};const T=new Map;for(let A=0;A<y.length;A++){const N=y.get(A),B=N.key,$=T.get(B);$?$.push(N):T.set(B,[N])}for(const[A,N]of T){const B={positions:N.map($=>({x:Math.floor($.anchorX*Ua),y:Math.floor($.anchorY*Ua)})),crossTileIDs:N.map($=>$.crossTileID)};if(B.positions.length>128){const $=new s.av(B.positions.length,16,Uint16Array);for(const{x:q,y:K}of B.positions)$.add(q,K);$.finish(),delete B.positions,B.index=$}this._symbolsByKey[A]=B}}getScaledCoordinates(u,y){const{x:S,y:T,z:A}=this.tileID.canonical,{x:N,y:B,z:$}=y.canonical,q=Ua/Math.pow(2,$-A),K=(B*s.X+u.anchorY)*q,J=T*s.X*Ua;return{x:Math.floor((N*s.X+u.anchorX)*q-S*s.X*Ua),y:Math.floor(K-J)}}findMatches(u,y,S){const T=this.tileID.canonical.z<y.canonical.z?1:Math.pow(2,this.tileID.canonical.z-y.canonical.z);for(let A=0;A<u.length;A++){const N=u.get(A);if(N.crossTileID)continue;const B=this._symbolsByKey[N.key];if(!B)continue;const $=this.getScaledCoordinates(N,y);if(B.index){const q=B.index.range($.x-T,$.y-T,$.x+T,$.y+T).sort();for(const K of q){const J=B.crossTileIDs[K];if(!S[J]){S[J]=!0,N.crossTileID=J;break}}}else if(B.positions)for(let q=0;q<B.positions.length;q++){const K=B.positions[q],J=B.crossTileIDs[q];if(Math.abs(K.x-$.x)<=T&&Math.abs(K.y-$.y)<=T&&!S[J]){S[J]=!0,N.crossTileID=J;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:u})=>u)}}class af{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ha{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(u){const y=Math.round((u-this.lng)/360);if(y!==0)for(const S in this.indexes){const T=this.indexes[S],A={};for(const N in T){const B=T[N];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+y),A[B.tileID.key]=B}this.indexes[S]=A}this.lng=u}addBucket(u,y,S){if(this.indexes[u.overscaledZ]&&this.indexes[u.overscaledZ][u.key]){if(this.indexes[u.overscaledZ][u.key].bucketInstanceId===y.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(u.overscaledZ,this.indexes[u.overscaledZ][u.key])}for(let A=0;A<y.symbolInstances.length;A++)y.symbolInstances.get(A).crossTileID=0;this.usedCrossTileIDs[u.overscaledZ]||(this.usedCrossTileIDs[u.overscaledZ]={});const T=this.usedCrossTileIDs[u.overscaledZ];for(const A in this.indexes){const N=this.indexes[A];if(Number(A)>u.overscaledZ)for(const B in N){const $=N[B];$.tileID.isChildOf(u)&&$.findMatches(y.symbolInstances,u,T)}else{const B=N[u.scaledTo(Number(A)).key];B&&B.findMatches(y.symbolInstances,u,T)}}for(let A=0;A<y.symbolInstances.length;A++){const N=y.symbolInstances.get(A);N.crossTileID||(N.crossTileID=S.generate(),T[N.crossTileID]=!0)}return this.indexes[u.overscaledZ]===void 0&&(this.indexes[u.overscaledZ]={}),this.indexes[u.overscaledZ][u.key]=new Pn(u,y.symbolInstances,y.bucketInstanceId),!0}removeBucketCrossTileIDs(u,y){for(const S of y.getCrossTileIDsLists())for(const T of S)delete this.usedCrossTileIDs[u][T]}removeStaleBuckets(u){let y=!1;for(const S in this.indexes){const T=this.indexes[S];for(const A in T)u[T[A].bucketInstanceId]||(this.removeBucketCrossTileIDs(S,T[A]),delete T[A],y=!0)}return y}}class hv{constructor(){this.layerIndexes={},this.crossTileIDs=new af,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(u,y,S){let T=this.layerIndexes[u.id];T===void 0&&(T=this.layerIndexes[u.id]=new Ha);let A=!1;const N={};T.handleWrapJump(S);for(const B of y){const $=B.getBucket(u);$&&u.id===$.layerIds[0]&&($.bucketInstanceId||($.bucketInstanceId=++this.maxBucketInstanceId),T.addBucket(B.tileID,$,this.crossTileIDs)&&(A=!0),N[$.bucketInstanceId]=!0)}return T.removeStaleBuckets(N)&&(A=!0),A}pruneUnusedLayers(u){const y={};u.forEach(S=>{y[S]=!0});for(const S in this.layerIndexes)y[S]||delete this.layerIndexes[S]}}const Wa=(D,u)=>s.t(D,u&&u.filter(y=>y.identifier!=="source.canvas")),uA=s.aw();class of extends s.E{constructor(u,y={}){super(),this._rtlPluginLoaded=()=>{for(const S in this.sourceCaches){const T=this.sourceCaches[S].getSource().type;T!=="vector"&&T!=="geojson"||this.sourceCaches[S].reload()}},this.map=u,this.dispatcher=new wt(Dt(),u._getMapId()),this.dispatcher.registerMessageHandler("GG",(S,T)=>this.getGlyphs(S,T)),this.dispatcher.registerMessageHandler("GI",(S,T)=>this.getImages(S,T)),this.imageManager=new oe,this.imageManager.setEventedParent(this),this.glyphManager=new pe(u._requestManager,y.localIdeographFontFamily),this.lineAtlas=new it(256,512),this.crossTileSymbolIndex=new hv,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new s.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",s.ay()),Kr().on($e,this._rtlPluginLoaded),this.on("data",S=>{if(S.dataType!=="source"||S.sourceDataType!=="metadata")return;const T=this.sourceCaches[S.sourceId];if(!T)return;const A=T.getSource();if(A&&A.vectorLayerIds)for(const N in this._layers){const B=this._layers[N];B.source===A.id&&this._validateLayer(B)}})}loadURL(u,y={},S){this.fire(new s.k("dataloading",{dataType:"style"})),y.validate=typeof y.validate!="boolean"||y.validate;const T=this.map._requestManager.transformRequest(u,"Style");this._loadStyleRequest=new AbortController;const A=this._loadStyleRequest;s.h(T,this._loadStyleRequest).then(N=>{this._loadStyleRequest=null,this._load(N.data,y,S)}).catch(N=>{this._loadStyleRequest=null,N&&!A.signal.aborted&&this.fire(new s.j(N))})}loadJSON(u,y={},S){this.fire(new s.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,f.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,y.validate=y.validate!==!1,this._load(u,y,S)}).catch(()=>{})}loadEmpty(){this.fire(new s.k("dataloading",{dataType:"style"})),this._load(uA,{validate:!1})}_load(u,y,S){var T;const A=y.transformStyle?y.transformStyle(S,u):u;if(!y.validate||!Wa(this,s.u(A))){this._loaded=!0,this.stylesheet=A;for(const N in A.sources)this.addSource(N,A.sources[N],{validate:!1});A.sprite?this._loadSprite(A.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(A.glyphs),this._createLayers(),this.light=new Be(this.stylesheet.light),this.sky=new Xe(this.stylesheet.sky),this.map.setTerrain((T=this.stylesheet.terrain)!==null&&T!==void 0?T:null),this.fire(new s.k("data",{dataType:"style"})),this.fire(new s.k("style.load"))}}_createLayers(){const u=s.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",u),this._order=u.map(y=>y.id),this._layers={},this._serializedLayers=null;for(const y of u){const S=s.aA(y);S.setEventedParent(this,{layer:{id:y.id}}),this._layers[y.id]=S}}_loadSprite(u,y=!1,S=void 0){let T;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(A,N,B,$){return s._(this,void 0,void 0,function*(){const q=Z(A),K=B>1?"@2x":"",J={},ae={};for(const{id:ue,url:fe}of q){const be=N.transformRequest(Y(fe,K,".json"),"SpriteJSON");J[ue]=s.h(be,$);const Se=N.transformRequest(Y(fe,K,".png"),"SpriteImage");ae[ue]=L.getImage(Se,$)}return yield Promise.all([...Object.values(J),...Object.values(ae)]),function(ue,fe){return s._(this,void 0,void 0,function*(){const be={};for(const Se in ue){be[Se]={};const Te=f.getImageCanvasContext((yield fe[Se]).data),Ce=(yield ue[Se]).data;for(const ve in Ce){const{width:Ie,height:Pe,x:Ve,y:Ke,sdf:st,pixelRatio:bt,stretchX:Mt,stretchY:gt,content:pt,textFitWidth:zt,textFitHeight:or}=Ce[ve];be[Se][ve]={data:null,pixelRatio:bt,sdf:st,stretchX:Mt,stretchY:gt,content:pt,textFitWidth:zt,textFitHeight:or,spriteData:{width:Ie,height:Pe,x:Ve,y:Ke,context:Te}}}}return be})}(J,ae)})}(u,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(A=>{if(this._spriteRequest=null,A)for(const N in A){this._spritesImagesIds[N]=[];const B=this._spritesImagesIds[N]?this._spritesImagesIds[N].filter($=>!($ in A)):[];for(const $ of B)this.imageManager.removeImage($),this._changedImages[$]=!0;for(const $ in A[N]){const q=N==="default"?$:`${N}:${$}`;this._spritesImagesIds[N].push(q),q in this.imageManager.images?this.imageManager.updateImage(q,A[N][$],!1):this.imageManager.addImage(q,A[N][$]),y&&(this._changedImages[q]=!0)}}}).catch(A=>{this._spriteRequest=null,T=A,this.fire(new s.j(T))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),y&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"})),S&&S(T)})}_unloadSprite(){for(const u of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(u),this._changedImages[u]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"}))}_validateLayer(u){const y=this.sourceCaches[u.source];if(!y)return;const S=u.sourceLayer;if(!S)return;const T=y.getSource();(T.type==="geojson"||T.vectorLayerIds&&T.vectorLayerIds.indexOf(S)===-1)&&this.fire(new s.j(new Error(`Source layer "${S}" does not exist on source "${T.id}" as specified by style layer "${u.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const u in this.sourceCaches)if(!this.sourceCaches[u].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(u,y=!1){const S=this._serializedAllLayers();if(!u||u.length===0)return Object.values(y?s.aB(S):S);const T=[];for(const A of u)if(S[A]){const N=y?s.aB(S[A]):S[A];T.push(N)}return T}_serializedAllLayers(){let u=this._serializedLayers;if(u)return u;u=this._serializedLayers={};const y=Object.keys(this._layers);for(const S of y){const T=this._layers[S];T.type!=="custom"&&(u[S]=T.serialize())}return u}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const u in this.sourceCaches)if(this.sourceCaches[u].hasTransition())return!0;for(const u in this._layers)if(this._layers[u].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(u){if(!this._loaded)return;const y=this._changed;if(y){const T=Object.keys(this._updatedLayers),A=Object.keys(this._removedLayers);(T.length||A.length)&&this._updateWorkerLayers(T,A);for(const N in this._updatedSources){const B=this._updatedSources[N];if(B==="reload")this._reloadSource(N);else{if(B!=="clear")throw new Error(`Invalid action ${B}`);this._clearSource(N)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const N in this._updatedPaintProps)this._layers[N].updateTransitions(u);this.light.updateTransitions(u),this.sky.updateTransitions(u),this._resetUpdates()}const S={};for(const T in this.sourceCaches){const A=this.sourceCaches[T];S[T]=A.used,A.used=!1}for(const T of this._order){const A=this._layers[T];A.recalculate(u,this._availableImages),!A.isHidden(u.zoom)&&A.source&&(this.sourceCaches[A.source].used=!0)}for(const T in S){const A=this.sourceCaches[T];!!S[T]!=!!A.used&&A.fire(new s.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:T}))}this.light.recalculate(u),this.sky.recalculate(u),this.z=u.zoom,y&&this.fire(new s.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const u=Object.keys(this._changedImages);if(u.length){for(const y in this.sourceCaches)this.sourceCaches[y].reloadTilesForDependencies(["icons","patterns"],u);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(u,y){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(u,!1),removedIds:y})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(u,y={}){var S;this._checkLoaded();const T=this.serialize();if(u=y.transformStyle?y.transformStyle(T,u):u,((S=y.validate)===null||S===void 0||S)&&Wa(this,s.u(u)))return!1;(u=s.aB(u)).layers=s.az(u.layers);const A=s.aC(T,u),N=this._getOperationsToPerform(A);if(N.unimplemented.length>0)throw new Error(`Unimplemented: ${N.unimplemented.join(", ")}.`);if(N.operations.length===0)return!1;for(const B of N.operations)B();return this.stylesheet=u,this._serializedLayers=null,!0}_getOperationsToPerform(u){const y=[],S=[];for(const T of u)switch(T.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":y.push(()=>this.addLayer.apply(this,T.args));break;case"removeLayer":y.push(()=>this.removeLayer.apply(this,T.args));break;case"setPaintProperty":y.push(()=>this.setPaintProperty.apply(this,T.args));break;case"setLayoutProperty":y.push(()=>this.setLayoutProperty.apply(this,T.args));break;case"setFilter":y.push(()=>this.setFilter.apply(this,T.args));break;case"addSource":y.push(()=>this.addSource.apply(this,T.args));break;case"removeSource":y.push(()=>this.removeSource.apply(this,T.args));break;case"setLayerZoomRange":y.push(()=>this.setLayerZoomRange.apply(this,T.args));break;case"setLight":y.push(()=>this.setLight.apply(this,T.args));break;case"setGeoJSONSourceData":y.push(()=>this.setGeoJSONSourceData.apply(this,T.args));break;case"setGlyphs":y.push(()=>this.setGlyphs.apply(this,T.args));break;case"setSprite":y.push(()=>this.setSprite.apply(this,T.args));break;case"setSky":y.push(()=>this.setSky.apply(this,T.args));break;case"setTerrain":y.push(()=>this.map.setTerrain.apply(this,T.args));break;case"setTransition":y.push(()=>{});break;default:S.push(T.command)}return{operations:y,unimplemented:S}}addImage(u,y){if(this.getImage(u))return this.fire(new s.j(new Error(`An image named "${u}" already exists.`)));this.imageManager.addImage(u,y),this._afterImageUpdated(u)}updateImage(u,y){this.imageManager.updateImage(u,y)}getImage(u){return this.imageManager.getImage(u)}removeImage(u){if(!this.getImage(u))return this.fire(new s.j(new Error(`An image named "${u}" does not exist.`)));this.imageManager.removeImage(u),this._afterImageUpdated(u)}_afterImageUpdated(u){this._availableImages=this.imageManager.listImages(),this._changedImages[u]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(u,y,S={}){if(this._checkLoaded(),this.sourceCaches[u]!==void 0)throw new Error(`Source "${u}" already exists.`);if(!y.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(y).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(y.type)>=0&&this._validate(s.u.source,`sources.${u}`,y,null,S))return;this.map&&this.map._collectResourceTiming&&(y.collectResourceTiming=!0);const T=this.sourceCaches[u]=new Qt(u,y,this.dispatcher);T.style=this,T.setEventedParent(this,()=>({isSourceLoaded:T.loaded(),source:T.serialize(),sourceId:u})),T.onAdd(this.map),this._changed=!0}removeSource(u){if(this._checkLoaded(),this.sourceCaches[u]===void 0)throw new Error("There is no source with this ID");for(const S in this._layers)if(this._layers[S].source===u)return this.fire(new s.j(new Error(`Source "${u}" cannot be removed while layer "${S}" is using it.`)));const y=this.sourceCaches[u];delete this.sourceCaches[u],delete this._updatedSources[u],y.fire(new s.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:u})),y.setEventedParent(null),y.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(u,y){if(this._checkLoaded(),this.sourceCaches[u]===void 0)throw new Error(`There is no source with this ID=${u}`);const S=this.sourceCaches[u].getSource();if(S.type!=="geojson")throw new Error(`geojsonSource.type is ${S.type}, which is !== 'geojson`);S.setData(y),this._changed=!0}getSource(u){return this.sourceCaches[u]&&this.sourceCaches[u].getSource()}addLayer(u,y,S={}){this._checkLoaded();const T=u.id;if(this.getLayer(T))return void this.fire(new s.j(new Error(`Layer "${T}" already exists on this map.`)));let A;if(u.type==="custom"){if(Wa(this,s.aD(u)))return;A=s.aA(u)}else{if("source"in u&&typeof u.source=="object"&&(this.addSource(T,u.source),u=s.aB(u),u=s.e(u,{source:T})),this._validate(s.u.layer,`layers.${T}`,u,{arrayIndex:-1},S))return;A=s.aA(u),this._validateLayer(A),A.setEventedParent(this,{layer:{id:T}})}const N=y?this._order.indexOf(y):this._order.length;if(y&&N===-1)this.fire(new s.j(new Error(`Cannot add layer "${T}" before non-existing layer "${y}".`)));else{if(this._order.splice(N,0,T),this._layerOrderChanged=!0,this._layers[T]=A,this._removedLayers[T]&&A.source&&A.type!=="custom"){const B=this._removedLayers[T];delete this._removedLayers[T],B.type!==A.type?this._updatedSources[A.source]="clear":(this._updatedSources[A.source]="reload",this.sourceCaches[A.source].pause())}this._updateLayer(A),A.onAdd&&A.onAdd(this.map)}}moveLayer(u,y){if(this._checkLoaded(),this._changed=!0,!this._layers[u])return void this.fire(new s.j(new Error(`The layer '${u}' does not exist in the map's style and cannot be moved.`)));if(u===y)return;const S=this._order.indexOf(u);this._order.splice(S,1);const T=y?this._order.indexOf(y):this._order.length;y&&T===-1?this.fire(new s.j(new Error(`Cannot move layer "${u}" before non-existing layer "${y}".`))):(this._order.splice(T,0,u),this._layerOrderChanged=!0)}removeLayer(u){this._checkLoaded();const y=this._layers[u];if(!y)return void this.fire(new s.j(new Error(`Cannot remove non-existing layer "${u}".`)));y.setEventedParent(null);const S=this._order.indexOf(u);this._order.splice(S,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[u]=y,delete this._layers[u],this._serializedLayers&&delete this._serializedLayers[u],delete this._updatedLayers[u],delete this._updatedPaintProps[u],y.onRemove&&y.onRemove(this.map)}getLayer(u){return this._layers[u]}getLayersOrder(){return[...this._order]}hasLayer(u){return u in this._layers}setLayerZoomRange(u,y,S){this._checkLoaded();const T=this.getLayer(u);T?T.minzoom===y&&T.maxzoom===S||(y!=null&&(T.minzoom=y),S!=null&&(T.maxzoom=S),this._updateLayer(T)):this.fire(new s.j(new Error(`Cannot set the zoom range of non-existing layer "${u}".`)))}setFilter(u,y,S={}){this._checkLoaded();const T=this.getLayer(u);if(T){if(!s.aE(T.filter,y))return y==null?(T.filter=void 0,void this._updateLayer(T)):void(this._validate(s.u.filter,`layers.${T.id}.filter`,y,null,S)||(T.filter=s.aB(y),this._updateLayer(T)))}else this.fire(new s.j(new Error(`Cannot filter non-existing layer "${u}".`)))}getFilter(u){return s.aB(this.getLayer(u).filter)}setLayoutProperty(u,y,S,T={}){this._checkLoaded();const A=this.getLayer(u);A?s.aE(A.getLayoutProperty(y),S)||(A.setLayoutProperty(y,S,T),this._updateLayer(A)):this.fire(new s.j(new Error(`Cannot style non-existing layer "${u}".`)))}getLayoutProperty(u,y){const S=this.getLayer(u);if(S)return S.getLayoutProperty(y);this.fire(new s.j(new Error(`Cannot get style of non-existing layer "${u}".`)))}setPaintProperty(u,y,S,T={}){this._checkLoaded();const A=this.getLayer(u);A?s.aE(A.getPaintProperty(y),S)||(A.setPaintProperty(y,S,T)&&this._updateLayer(A),this._changed=!0,this._updatedPaintProps[u]=!0,this._serializedLayers=null):this.fire(new s.j(new Error(`Cannot style non-existing layer "${u}".`)))}getPaintProperty(u,y){return this.getLayer(u).getPaintProperty(y)}setFeatureState(u,y){this._checkLoaded();const S=u.source,T=u.sourceLayer,A=this.sourceCaches[S];if(A===void 0)return void this.fire(new s.j(new Error(`The source '${S}' does not exist in the map's style.`)));const N=A.getSource().type;N==="geojson"&&T?this.fire(new s.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):N!=="vector"||T?(u.id===void 0&&this.fire(new s.j(new Error("The feature id parameter must be provided."))),A.setFeatureState(T,u.id,y)):this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(u,y){this._checkLoaded();const S=u.source,T=this.sourceCaches[S];if(T===void 0)return void this.fire(new s.j(new Error(`The source '${S}' does not exist in the map's style.`)));const A=T.getSource().type,N=A==="vector"?u.sourceLayer:void 0;A!=="vector"||N?y&&typeof u.id!="string"&&typeof u.id!="number"?this.fire(new s.j(new Error("A feature id is required to remove its specific state property."))):T.removeFeatureState(N,u.id,y):this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(u){this._checkLoaded();const y=u.source,S=u.sourceLayer,T=this.sourceCaches[y];if(T!==void 0)return T.getSource().type!=="vector"||S?(u.id===void 0&&this.fire(new s.j(new Error("The feature id parameter must be provided."))),T.getFeatureState(S,u.id)):void this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new s.j(new Error(`The source '${y}' does not exist in the map's style.`)))}getTransition(){return s.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const u=s.aF(this.sourceCaches,A=>A.serialize()),y=this._serializeByIds(this._order,!0),S=this.map.getTerrain()||void 0,T=this.stylesheet;return s.aG({version:T.version,name:T.name,metadata:T.metadata,light:T.light,sky:T.sky,center:T.center,zoom:T.zoom,bearing:T.bearing,pitch:T.pitch,sprite:T.sprite,glyphs:T.glyphs,transition:T.transition,sources:u,layers:y,terrain:S},A=>A!==void 0)}_updateLayer(u){this._updatedLayers[u.id]=!0,u.source&&!this._updatedSources[u.source]&&this.sourceCaches[u.source].getSource().type!=="raster"&&(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(u){const y=N=>this._layers[N].type==="fill-extrusion",S={},T=[];for(let N=this._order.length-1;N>=0;N--){const B=this._order[N];if(y(B)){S[B]=N;for(const $ of u){const q=$[B];if(q)for(const K of q)T.push(K)}}}T.sort((N,B)=>B.intersectionZ-N.intersectionZ);const A=[];for(let N=this._order.length-1;N>=0;N--){const B=this._order[N];if(y(B))for(let $=T.length-1;$>=0;$--){const q=T[$].feature;if(S[q.layer.id]<N)break;A.push(q),T.pop()}else for(const $ of u){const q=$[B];if(q)for(const K of q)A.push(K.feature)}}return A}queryRenderedFeatures(u,y,S){y&&y.filter&&this._validate(s.u.filter,"queryRenderedFeatures.filter",y.filter,null,y);const T={};if(y&&y.layers){if(!Array.isArray(y.layers))return this.fire(new s.j(new Error("parameters.layers must be an Array."))),[];for(const B of y.layers){const $=this._layers[B];if(!$)return this.fire(new s.j(new Error(`The layer '${B}' does not exist in the map's style and cannot be queried for features.`))),[];T[$.source]=!0}}const A=[];y.availableImages=this._availableImages;const N=this._serializedAllLayers();for(const B in this.sourceCaches)y.layers&&!T[B]||A.push(tt(this.sourceCaches[B],this._layers,N,u,y,S));return this.placement&&A.push(function(B,$,q,K,J,ae,ue){const fe={},be=ae.queryRenderedSymbols(K),Se=[];for(const Te of Object.keys(be).map(Number))Se.push(ue[Te]);Se.sort(kt);for(const Te of Se){const Ce=Te.featureIndex.lookupSymbolFeatures(be[Te.bucketInstanceId],$,Te.bucketIndex,Te.sourceLayerIndex,J.filter,J.layers,J.availableImages,B);for(const ve in Ce){const Ie=fe[ve]=fe[ve]||[],Pe=Ce[ve];Pe.sort((Ve,Ke)=>{const st=Te.featureSortOrder;if(st){const bt=st.indexOf(Ve.featureIndex);return st.indexOf(Ke.featureIndex)-bt}return Ke.featureIndex-Ve.featureIndex});for(const Ve of Pe)Ie.push(Ve)}}for(const Te in fe)fe[Te].forEach(Ce=>{const ve=Ce.feature,Ie=q[B[Te].source].getFeatureState(ve.layer["source-layer"],ve.id);ve.source=ve.layer.source,ve.layer["source-layer"]&&(ve.sourceLayer=ve.layer["source-layer"]),ve.state=Ie});return fe}(this._layers,N,this.sourceCaches,u,y,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(A)}querySourceFeatures(u,y){y&&y.filter&&this._validate(s.u.filter,"querySourceFeatures.filter",y.filter,null,y);const S=this.sourceCaches[u];return S?function(T,A){const N=T.getRenderableIds().map(q=>T.getTileByID(q)),B=[],$={};for(let q=0;q<N.length;q++){const K=N[q],J=K.tileID.canonical.key;$[J]||($[J]=!0,K.querySourceFeatures(B,A))}return B}(S,y):[]}getLight(){return this.light.getLight()}setLight(u,y={}){this._checkLoaded();const S=this.light.getLight();let T=!1;for(const N in u)if(!s.aE(u[N],S[N])){T=!0;break}if(!T)return;const A={now:f.now(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(u,y),this.light.updateTransitions(A)}getSky(){var u;return(u=this.stylesheet)===null||u===void 0?void 0:u.sky}setSky(u,y={}){const S=this.getSky();let T=!1;if(!u&&!S)return;if(u&&!S)T=!0;else if(!u&&S)T=!0;else for(const N in u)if(!s.aE(u[N],S[N])){T=!0;break}if(!T)return;const A={now:f.now(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=u,this.sky.setSky(u,y),this.sky.updateTransitions(A)}_validate(u,y,S,T,A={}){return(!A||A.validate!==!1)&&Wa(this,u.call(s.u,s.e({key:y,style:this.serialize(),value:S,styleSpec:s.v},T)))}_remove(u=!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),Kr().off($e,this._rtlPluginLoaded);for(const y in this._layers)this._layers[y].setEventedParent(null);for(const y in this.sourceCaches){const S=this.sourceCaches[y];S.setEventedParent(null),S.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),u&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(u)}_clearSource(u){this.sourceCaches[u].clearTiles()}_reloadSource(u){this.sourceCaches[u].resume(),this.sourceCaches[u].reload()}_updateSources(u){for(const y in this.sourceCaches)this.sourceCaches[y].update(u,this.map.terrain)}_generateCollisionBoxes(){for(const u in this.sourceCaches)this._reloadSource(u)}_updatePlacement(u,y,S,T,A=!1){let N=!1,B=!1;const $={};for(const q of this._order){const K=this._layers[q];if(K.type!=="symbol")continue;if(!$[K.source]){const ae=this.sourceCaches[K.source];$[K.source]=ae.getRenderableIds(!0).map(ue=>ae.getTileByID(ue)).sort((ue,fe)=>fe.tileID.overscaledZ-ue.tileID.overscaledZ||(ue.tileID.isLessThan(fe.tileID)?-1:1))}const J=this.crossTileSymbolIndex.addLayer(K,$[K.source],u.center.lng);N=N||J}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((A=A||this._layerOrderChanged||S===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(f.now(),u.zoom))&&(this.pauseablePlacement=new dh(u,this.map.terrain,this._order,A,y,S,T,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,$),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(f.now()),B=!0),N&&this.pauseablePlacement.placement.setStale()),B||N)for(const q of this._order){const K=this._layers[q];K.type==="symbol"&&this.placement.updateLayerOpacities(K,$[K.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(f.now())}_releaseSymbolFadeTiles(){for(const u in this.sourceCaches)this.sourceCaches[u].releaseSymbolFadeTiles()}getImages(u,y){return s._(this,void 0,void 0,function*(){const S=yield this.imageManager.getImages(y.icons);this._updateTilesForChangedImages();const T=this.sourceCaches[y.source];return T&&T.setDependencies(y.tileID.key,y.type,y.icons),S})}getGlyphs(u,y){return s._(this,void 0,void 0,function*(){const S=yield this.glyphManager.getGlyphs(y.stacks),T=this.sourceCaches[y.source];return T&&T.setDependencies(y.tileID.key,y.type,[""]),S})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(u,y={}){this._checkLoaded(),u&&this._validate(s.u.glyphs,"glyphs",u,null,y)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=u,this.glyphManager.entries={},this.glyphManager.setURL(u))}addSprite(u,y,S={},T){this._checkLoaded();const A=[{id:u,url:y}],N=[...Z(this.stylesheet.sprite),...A];this._validate(s.u.sprite,"sprite",N,null,S)||(this.stylesheet.sprite=N,this._loadSprite(A,!0,T))}removeSprite(u){this._checkLoaded();const y=Z(this.stylesheet.sprite);if(y.find(S=>S.id===u)){if(this._spritesImagesIds[u])for(const S of this._spritesImagesIds[u])this.imageManager.removeImage(S),this._changedImages[S]=!0;y.splice(y.findIndex(S=>S.id===u),1),this.stylesheet.sprite=y.length>0?y:void 0,delete this._spritesImagesIds[u],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"}))}else this.fire(new s.j(new Error(`Sprite "${u}" doesn't exists on this map.`)))}getSprite(){return Z(this.stylesheet.sprite)}setSprite(u,y={},S){this._checkLoaded(),u&&this._validate(s.u.sprite,"sprite",u,null,y)||(this.stylesheet.sprite=u,u?this._loadSprite(u,!0,S):(this._unloadSprite(),S&&S(null)))}}var sl=s.Y([{name:"a_pos",type:"Int16",components:2}]);const As={prelude:Ur(`#ifdef GL_ES
|
|
169
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(j[1])} }\`.`)];const ee=[];return p.layerType==="symbol"&&(R==="text-field"&&E&&!E.glyphs&&ee.push(new $e(v,k,'use of "text-field" requires a style "glyphs" property')),R==="text-font"&&_f(qa(k))&&Dn(k.type)==="identity"&&ee.push(new $e(v,k,'"text-font" does not support identity functions'))),ee.concat(b({key:p.key,value:k,valueSpec:W,style:E,styleSpec:I,expressionContext:"property",propertyType:h,propertyKey:R}))}function Df(p){return Ov(p,"paint")}function zv(p){return Ov(p,"layout")}function Bv(p){let h=[];const v=p.value,b=p.key,E=p.style,I=p.styleSpec;v.type||v.ref||h.push(new $e(b,v,'either "type" or "ref" is required'));let k=Dn(v.type);const R=Dn(v.ref);if(v.id){const z=Dn(v.id);for(let G=0;G<p.arrayIndex;G++){const W=E.layers[G];Dn(W.id)===z&&h.push(new $e(b,v.id,`duplicate layer id "${v.id}", previously used at line ${W.id.__line__}`))}}if("ref"in v){let z;["type","source","source-layer","filter","layout"].forEach(G=>{G in v&&h.push(new $e(b,v[G],`"${G}" is prohibited for ref layers`))}),E.layers.forEach(G=>{Dn(G.id)===R&&(z=G)}),z?z.ref?h.push(new $e(b,v.ref,"ref cannot reference another ref layer")):k=Dn(z.type):h.push(new $e(b,v.ref,`ref layer "${R}" not found`))}else if(k!=="background")if(v.source){const z=E.sources&&E.sources[v.source],G=z&&Dn(z.type);z?G==="vector"&&k==="raster"?h.push(new $e(b,v.source,`layer "${v.id}" requires a raster source`)):G!=="raster-dem"&&k==="hillshade"?h.push(new $e(b,v.source,`layer "${v.id}" requires a raster-dem source`)):G==="raster"&&k!=="raster"?h.push(new $e(b,v.source,`layer "${v.id}" requires a vector source`)):G!=="vector"||v["source-layer"]?G==="raster-dem"&&k!=="hillshade"?h.push(new $e(b,v.source,"raster-dem source can only be used with layer type 'hillshade'.")):k!=="line"||!v.paint||!v.paint["line-gradient"]||G==="geojson"&&z.lineMetrics||h.push(new $e(b,v,`layer "${v.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):h.push(new $e(b,v,`layer "${v.id}" must specify a "source-layer"`)):h.push(new $e(b,v.source,`source "${v.source}" not found`))}else h.push(new $e(b,v,'missing required property "source"'));return h=h.concat(da({key:b,value:v,valueSpec:I.layer,style:p.style,styleSpec:p.styleSpec,validateSpec:p.validateSpec,objectElementValidators:{"*":()=>[],type:()=>p.validateSpec({key:`${b}.type`,value:v.type,valueSpec:I.layer.type,style:p.style,styleSpec:p.styleSpec,validateSpec:p.validateSpec,object:v,objectKey:"type"}),filter:Nv,layout:z=>da({layer:v,key:z.key,value:z.value,style:z.style,styleSpec:z.styleSpec,validateSpec:z.validateSpec,objectElementValidators:{"*":G=>zv(er({layerType:k},G))}}),paint:z=>da({layer:v,key:z.key,value:z.value,style:z.style,styleSpec:z.styleSpec,validateSpec:z.validateSpec,objectElementValidators:{"*":G=>Df(er({layerType:k},G))}})}})),h}function vl(p){const h=p.value,v=p.key,b=Fr(h);return b!=="string"?[new $e(v,h,`string expected, ${b} found`)]:[]}const Mf={promoteId:function({key:p,value:h}){if(Fr(h)==="string")return vl({key:p,value:h});{const v=[];for(const b in h)v.push(...vl({key:`${p}.${b}`,value:h[b]}));return v}}};function Ch(p){const h=p.value,v=p.key,b=p.styleSpec,E=p.style,I=p.validateSpec;if(!h.type)return[new $e(v,h,'"type" is required')];const k=Dn(h.type);let R;switch(k){case"vector":case"raster":return R=da({key:v,value:h,valueSpec:b[`source_${k.replace("-","_")}`],style:p.style,styleSpec:b,objectElementValidators:Mf,validateSpec:I}),R;case"raster-dem":return R=function(z){var G;const W=(G=z.sourceName)!==null&&G!==void 0?G:"",j=z.value,ee=z.styleSpec,ne=ee.source_raster_dem,se=z.style;let ce=[];const ye=Fr(j);if(j===void 0)return ce;if(ye!=="object")return ce.push(new $e("source_raster_dem",j,`object expected, ${ye} found`)),ce;const we=Dn(j.encoding)==="custom",Oe=["redFactor","greenFactor","blueFactor","baseShift"],Ae=z.value.encoding?`"${z.value.encoding}"`:"Default";for(const Re in j)!we&&Oe.includes(Re)?ce.push(new $e(Re,j[Re],`In "${W}": "${Re}" is only valid when "encoding" is set to "custom". ${Ae} encoding found`)):ne[Re]?ce=ce.concat(z.validateSpec({key:Re,value:j[Re],valueSpec:ne[Re],validateSpec:z.validateSpec,style:se,styleSpec:ee})):ce.push(new $e(Re,j[Re],`unknown property "${Re}"`));return ce}({sourceName:v,value:h,style:p.style,styleSpec:b,validateSpec:I}),R;case"geojson":if(R=da({key:v,value:h,valueSpec:b.source_geojson,style:E,styleSpec:b,validateSpec:I,objectElementValidators:Mf}),h.cluster)for(const z in h.clusterProperties){const[G,W]=h.clusterProperties[z],j=typeof G=="string"?[G,["accumulated"],["get",z]]:G;R.push(...Tc({key:`${v}.${z}.map`,value:W,validateSpec:I,expressionContext:"cluster-map"})),R.push(...Tc({key:`${v}.${z}.reduce`,value:j,validateSpec:I,expressionContext:"cluster-reduce"}))}return R;case"video":return da({key:v,value:h,valueSpec:b.source_video,style:E,validateSpec:I,styleSpec:b});case"image":return da({key:v,value:h,valueSpec:b.source_image,style:E,validateSpec:I,styleSpec:b});case"canvas":return[new $e(v,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jo({key:`${v}.type`,value:h.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:E,validateSpec:I,styleSpec:b})}}function Vv(p){const h=p.value,v=p.styleSpec,b=v.light,E=p.style;let I=[];const k=Fr(h);if(h===void 0)return I;if(k!=="object")return I=I.concat([new $e("light",h,`object expected, ${k} found`)]),I;for(const R in h){const z=R.match(/^(.*)-transition$/);I=I.concat(z&&b[z[1]]&&b[z[1]].transition?p.validateSpec({key:R,value:h[R],valueSpec:v.transition,validateSpec:p.validateSpec,style:E,styleSpec:v}):b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],validateSpec:p.validateSpec,style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)])}return I}function Fv(p){const h=p.value,v=p.styleSpec,b=v.sky,E=p.style,I=Fr(h);if(h===void 0)return[];if(I!=="object")return[new $e("sky",h,`object expected, ${I} found`)];let k=[];for(const R in h)k=k.concat(b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)]);return k}function $v(p){const h=p.value,v=p.styleSpec,b=v.terrain,E=p.style;let I=[];const k=Fr(h);if(h===void 0)return I;if(k!=="object")return I=I.concat([new $e("terrain",h,`object expected, ${k} found`)]),I;for(const R in h)I=I.concat(b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],validateSpec:p.validateSpec,style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)]);return I}function Gv(p){let h=[];const v=p.value,b=p.key;if(Array.isArray(v)){const E=[],I=[];for(const k in v)v[k].id&&E.includes(v[k].id)&&h.push(new $e(b,v,`all the sprites' ids must be unique, but ${v[k].id} is duplicated`)),E.push(v[k].id),v[k].url&&I.includes(v[k].url)&&h.push(new $e(b,v,`all the sprites' URLs must be unique, but ${v[k].url} is duplicated`)),I.push(v[k].url),h=h.concat(da({key:`${b}[${k}]`,value:v[k],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:p.validateSpec}));return h}return vl({key:b,value:v})}const If={"*":()=>[],array:Eh,boolean:function(p){const h=p.value,v=p.key,b=Fr(h);return b!=="boolean"?[new $e(v,h,`boolean expected, ${b} found`)]:[]},number:Rv,color:function(p){const h=p.key,v=p.value,b=Fr(v);return b!=="string"?[new $e(h,v,`color expected, ${b} found`)]:Xr.parse(String(v))?[]:[new $e(h,v,`color expected, "${v}" found`)]},constants:Db,enum:Jo,filter:Nv,function:Cf,layer:Bv,object:da,source:Ch,light:Vv,sky:Fv,terrain:$v,projection:function(p){const h=p.value,v=p.styleSpec,b=v.projection,E=p.style,I=Fr(h);if(h===void 0)return[];if(I!=="object")return[new $e("projection",h,`object expected, ${I} found`)];let k=[];for(const R in h)k=k.concat(b[R]?p.validateSpec({key:R,value:h[R],valueSpec:b[R],style:E,styleSpec:v}):[new $e(R,h[R],`unknown property "${R}"`)]);return k},string:vl,formatted:function(p){return vl(p).length===0?[]:Tc(p)},resolvedImage:function(p){return vl(p).length===0?[]:Tc(p)},padding:function(p){const h=p.key,v=p.value;if(Fr(v)==="array"){if(v.length<1||v.length>4)return[new $e(h,v,`padding requires 1 to 4 values; ${v.length} values found`)];const b={type:"number"};let E=[];for(let I=0;I<v.length;I++)E=E.concat(p.validateSpec({key:`${h}[${I}]`,value:v[I],validateSpec:p.validateSpec,valueSpec:b}));return E}return Rv({key:h,value:v,valueSpec:{}})},variableAnchorOffsetCollection:function(p){const h=p.key,v=p.value,b=Fr(v),E=p.styleSpec;if(b!=="array"||v.length<1||v.length%2!=0)return[new $e(h,v,"variableAnchorOffsetCollection requires a non-empty array of even length")];let I=[];for(let k=0;k<v.length;k+=2)I=I.concat(Jo({key:`${h}[${k}]`,value:v[k],valueSpec:E.layout_symbol["text-anchor"]})),I=I.concat(Eh({key:`${h}[${k+1}]`,value:v[k+1],valueSpec:{length:2,value:"number"},validateSpec:p.validateSpec,style:p.style,styleSpec:E}));return I},sprite:Gv};function Ec(p){const h=p.value,v=p.valueSpec,b=p.styleSpec;return p.validateSpec=Ec,v.expression&&_f(Dn(h))?Cf(p):v.expression&&wf(qa(h))?Tc(p):v.type&&If[v.type]?If[v.type](p):da(er({},p,{valueSpec:v.type?b[v.type]:v}))}function Mb(p){const h=p.value,v=p.key,b=vl(p);return b.length||(h.indexOf("{fontstack}")===-1&&b.push(new $e(v,h,'"glyphs" url must include a "{fontstack}" token')),h.indexOf("{range}")===-1&&b.push(new $e(v,h,'"glyphs" url must include a "{range}" token'))),b}function Da(p,h=Le){let v=[];return v=v.concat(Ec({key:"",value:p,valueSpec:h.$root,styleSpec:h,style:p,validateSpec:Ec,objectElementValidators:{glyphs:Mb,"*":()=>[]}})),p.constants&&(v=v.concat(Db({key:"constants",value:p.constants,style:p,styleSpec:h,validateSpec:Ec}))),Uv(v)}function Mo(p){return function(h){return p({...h,validateSpec:Ec})}}function Uv(p){return[].concat(p).sort((h,v)=>h.line-v.line)}function Za(p){return function(...h){return Uv(p.apply(this,h))}}Da.source=Za(Mo(Ch)),Da.sprite=Za(Mo(Gv)),Da.glyphs=Za(Mo(Mb)),Da.light=Za(Mo(Vv)),Da.sky=Za(Mo(Fv)),Da.terrain=Za(Mo($v)),Da.layer=Za(Mo(Bv)),Da.filter=Za(Mo(Nv)),Da.paintProperty=Za(Mo(Df)),Da.layoutProperty=Za(Mo(zv));const ml=Da,DA=ml.light,MA=ml.sky,Ib=ml.paintProperty,kb=ml.layoutProperty;function Hv(p,h){let v=!1;if(h&&h.length)for(const b of h)p.fire(new kt(new Error(b.message))),v=!0;return v}class Cc{constructor(h,v,b){const E=this.cells=[];if(h instanceof ArrayBuffer){this.arrayBuffer=h;const k=new Int32Array(this.arrayBuffer);h=k[0],this.d=(v=k[1])+2*(b=k[2]);for(let z=0;z<this.d*this.d;z++){const G=k[3+z],W=k[3+z+1];E.push(G===W?null:k.subarray(G,W))}const R=k[3+E.length+1];this.keys=k.subarray(k[3+E.length],R),this.bboxes=k.subarray(R),this.insert=this._insertReadonly}else{this.d=v+2*b;for(let k=0;k<this.d*this.d;k++)E.push([]);this.keys=[],this.bboxes=[]}this.n=v,this.extent=h,this.padding=b,this.scale=v/h,this.uid=0;const I=b/v*h;this.min=-I,this.max=h+I}insert(h,v,b,E,I){this._forEachCell(v,b,E,I,this._insertCell,this.uid++,void 0,void 0),this.keys.push(h),this.bboxes.push(v),this.bboxes.push(b),this.bboxes.push(E),this.bboxes.push(I)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(h,v,b,E,I,k){this.cells[I].push(k)}query(h,v,b,E,I){const k=this.min,R=this.max;if(h<=k&&v<=k&&R<=b&&R<=E&&!I)return Array.prototype.slice.call(this.keys);{const z=[];return this._forEachCell(h,v,b,E,this._queryCell,z,{},I),z}}_queryCell(h,v,b,E,I,k,R,z){const G=this.cells[I];if(G!==null){const W=this.keys,j=this.bboxes;for(let ee=0;ee<G.length;ee++){const ne=G[ee];if(R[ne]===void 0){const se=4*ne;(z?z(j[se+0],j[se+1],j[se+2],j[se+3]):h<=j[se+2]&&v<=j[se+3]&&b>=j[se+0]&&E>=j[se+1])?(R[ne]=!0,k.push(W[ne])):R[ne]=!1}}}}_forEachCell(h,v,b,E,I,k,R,z){const G=this._convertToCellCoord(h),W=this._convertToCellCoord(v),j=this._convertToCellCoord(b),ee=this._convertToCellCoord(E);for(let ne=G;ne<=j;ne++)for(let se=W;se<=ee;se++){const ce=this.d*se+ne;if((!z||z(this._convertFromCellCoord(ne),this._convertFromCellCoord(se),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(se+1)))&&I.call(this,h,v,b,E,ce,k,R,z))return}}_convertFromCellCoord(h){return(h-this.padding)/this.scale}_convertToCellCoord(h){return Math.max(0,Math.min(this.d-1,Math.floor(h*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const h=this.cells,v=3+this.cells.length+1+1;let b=0;for(let k=0;k<this.cells.length;k++)b+=this.cells[k].length;const E=new Int32Array(v+b+this.keys.length+this.bboxes.length);E[0]=this.extent,E[1]=this.n,E[2]=this.padding;let I=v;for(let k=0;k<h.length;k++){const R=h[k];E[3+k]=I,E.set(R,I),I+=R.length}return E[3+h.length]=I,E.set(this.keys,I),I+=this.keys.length,E[3+h.length+1]=I,E.set(this.bboxes,I),I+=this.bboxes.length,E.buffer}static serialize(h,v){const b=h.toArrayBuffer();return v&&v.push(b),{buffer:b}}static deserialize(h){return new Cc(h.buffer)}}const Ma={};function Pt(p,h,v={}){if(Ma[p])throw new Error(`${p} is already registered.`);Object.defineProperty(h,"_classRegistryKey",{value:p,writeable:!1}),Ma[p]={klass:h,omit:v.omit||[],shallow:v.shallow||[]}}Pt("Object",Object),Pt("TransferableGridIndex",Cc),Pt("Color",Xr),Pt("Error",Error),Pt("AJAXError",dt),Pt("ResolvedImage",ha),Pt("StylePropertyFunction",Sc),Pt("StyleExpression",xf,{omit:["_evaluator"]}),Pt("ZoomDependentExpression",wc),Pt("ZoomConstantExpression",xc),Pt("CompoundExpression",Aa,{omit:["_evaluate"]});for(const p in gc)gc[p]._classRegistryKey||Pt(`Expression_${p}`,gc[p]);function kf(p){return p&&typeof ArrayBuffer<"u"&&(p instanceof ArrayBuffer||p.constructor&&p.constructor.name==="ArrayBuffer")}function Wv(p){return p.$name||p.constructor._classRegistryKey}function Lb(p){return!function(h){if(h===null||typeof h!="object")return!1;const v=Wv(h);return!(!v||v==="Object")}(p)&&(p==null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||p instanceof Boolean||p instanceof Number||p instanceof String||p instanceof Date||p instanceof RegExp||p instanceof Blob||p instanceof Error||kf(p)||pe(p)||ArrayBuffer.isView(p)||p instanceof ImageData)}function Ac(p,h){if(Lb(p))return(kf(p)||pe(p))&&h&&h.push(p),ArrayBuffer.isView(p)&&h&&h.push(p.buffer),p instanceof ImageData&&h&&h.push(p.data.buffer),p;if(Array.isArray(p)){const I=[];for(const k of p)I.push(Ac(k,h));return I}if(typeof p!="object")throw new Error("can't serialize object of type "+typeof p);const v=Wv(p);if(!v)throw new Error(`can't serialize object of unregistered class ${p.constructor.name}`);if(!Ma[v])throw new Error(`${v} is not registered.`);const{klass:b}=Ma[v],E=b.serialize?b.serialize(p,h):{};if(b.serialize){if(h&&E===h[h.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const I in p){if(!p.hasOwnProperty(I)||Ma[v].omit.indexOf(I)>=0)continue;const k=p[I];E[I]=Ma[v].shallow.indexOf(I)>=0?k:Ac(k,h)}p instanceof Error&&(E.message=p.message)}if(E.$name)throw new Error("$name property is reserved for worker serialization logic.");return v!=="Object"&&(E.$name=v),E}function Dc(p){if(Lb(p))return p;if(Array.isArray(p))return p.map(Dc);if(typeof p!="object")throw new Error("can't deserialize object of type "+typeof p);const h=Wv(p)||"Object";if(!Ma[h])throw new Error(`can't deserialize unregistered class ${h}`);const{klass:v}=Ma[h];if(!v)throw new Error(`can't deserialize unregistered class ${h}`);if(v.deserialize)return v.deserialize(p);const b=Object.create(v.prototype);for(const E of Object.keys(p)){if(E==="$name")continue;const I=p[E];b[E]=Ma[h].shallow.indexOf(E)>=0?I:Dc(I)}return b}class qv{constructor(){this.first=!0}update(h,v){const b=Math.floor(h);return this.first?(this.first=!1,this.lastIntegerZoom=b,this.lastIntegerZoomTime=0,this.lastZoom=h,this.lastFloorZoom=b,!0):(this.lastFloorZoom>b?(this.lastIntegerZoom=b+1,this.lastIntegerZoomTime=v):this.lastFloorZoom<b&&(this.lastIntegerZoom=b,this.lastIntegerZoomTime=v),h!==this.lastZoom&&(this.lastZoom=h,this.lastFloorZoom=b,!0))}}const Lr={"Latin-1 Supplement":p=>p>=128&&p<=255,"Hangul Jamo":p=>p>=4352&&p<=4607,Khmer:p=>p>=6016&&p<=6143,"General Punctuation":p=>p>=8192&&p<=8303,"Letterlike Symbols":p=>p>=8448&&p<=8527,"Number Forms":p=>p>=8528&&p<=8591,"Miscellaneous Technical":p=>p>=8960&&p<=9215,"Control Pictures":p=>p>=9216&&p<=9279,"Optical Character Recognition":p=>p>=9280&&p<=9311,"Enclosed Alphanumerics":p=>p>=9312&&p<=9471,"Geometric Shapes":p=>p>=9632&&p<=9727,"Miscellaneous Symbols":p=>p>=9728&&p<=9983,"Miscellaneous Symbols and Arrows":p=>p>=11008&&p<=11263,"Ideographic Description Characters":p=>p>=12272&&p<=12287,"CJK Symbols and Punctuation":p=>p>=12288&&p<=12351,Katakana:p=>p>=12448&&p<=12543,Kanbun:p=>p>=12688&&p<=12703,"CJK Strokes":p=>p>=12736&&p<=12783,"Enclosed CJK Letters and Months":p=>p>=12800&&p<=13055,"CJK Compatibility":p=>p>=13056&&p<=13311,"Yijing Hexagram Symbols":p=>p>=19904&&p<=19967,"Private Use Area":p=>p>=57344&&p<=63743,"Vertical Forms":p=>p>=65040&&p<=65055,"CJK Compatibility Forms":p=>p>=65072&&p<=65103,"Small Form Variants":p=>p>=65104&&p<=65135,"Halfwidth and Fullwidth Forms":p=>p>=65280&&p<=65519};function Zv(p){for(const h of p)if(Xv(h.charCodeAt(0)))return!0;return!1}function IA(p){for(const h of p)if(!Mc(h.charCodeAt(0)))return!1;return!0}function jv(p){const h=p.map(v=>{try{return new RegExp(`\\p{sc=${v}}`,"u").source}catch{return null}}).filter(v=>v);return new RegExp(h.join("|"),"u")}const kA=jv(["Arab","Dupl","Mong","Ougr","Syrc"]);function Mc(p){return!kA.test(String.fromCodePoint(p))}const Pb=jv(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Xv(p){return!(p!==746&&p!==747&&(p<4352||!(Lr["CJK Compatibility Forms"](p)&&!(p>=65097&&p<=65103)||Lr["CJK Compatibility"](p)||Lr["CJK Strokes"](p)||!(!Lr["CJK Symbols and Punctuation"](p)||p>=12296&&p<=12305||p>=12308&&p<=12319||p===12336)||Lr["Enclosed CJK Letters and Months"](p)||Lr["Ideographic Description Characters"](p)||Lr.Kanbun(p)||Lr.Katakana(p)&&p!==12540||!(!Lr["Halfwidth and Fullwidth Forms"](p)||p===65288||p===65289||p===65293||p>=65306&&p<=65310||p===65339||p===65341||p===65343||p>=65371&&p<=65503||p===65507||p>=65512&&p<=65519)||!(!Lr["Small Form Variants"](p)||p>=65112&&p<=65118||p>=65123&&p<=65126)||Lr["Vertical Forms"](p)||Lr["Yijing Hexagram Symbols"](p)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(p))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(p))||Pb.test(String.fromCodePoint(p)))))}function Rb(p){return!(Xv(p)||function(h){return!!(Lr["Latin-1 Supplement"](h)&&(h===167||h===169||h===174||h===177||h===188||h===189||h===190||h===215||h===247)||Lr["General Punctuation"](h)&&(h===8214||h===8224||h===8225||h===8240||h===8241||h===8251||h===8252||h===8258||h===8263||h===8264||h===8265||h===8273)||Lr["Letterlike Symbols"](h)||Lr["Number Forms"](h)||Lr["Miscellaneous Technical"](h)&&(h>=8960&&h<=8967||h>=8972&&h<=8991||h>=8996&&h<=9e3||h===9003||h>=9085&&h<=9114||h>=9150&&h<=9165||h===9167||h>=9169&&h<=9179||h>=9186&&h<=9215)||Lr["Control Pictures"](h)&&h!==9251||Lr["Optical Character Recognition"](h)||Lr["Enclosed Alphanumerics"](h)||Lr["Geometric Shapes"](h)||Lr["Miscellaneous Symbols"](h)&&!(h>=9754&&h<=9759)||Lr["Miscellaneous Symbols and Arrows"](h)&&(h>=11026&&h<=11055||h>=11088&&h<=11097||h>=11192&&h<=11243)||Lr["CJK Symbols and Punctuation"](h)||Lr.Katakana(h)||Lr["Private Use Area"](h)||Lr["CJK Compatibility Forms"](h)||Lr["Small Form Variants"](h)||Lr["Halfwidth and Fullwidth Forms"](h)||h===8734||h===8756||h===8757||h>=9984&&h<=10087||h>=10102&&h<=10131||h===65532||h===65533)}(p))}const LA=jv(["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 Yv(p){return LA.test(String.fromCodePoint(p))}function PA(p,h){return!(!h&&Yv(p)||p>=2304&&p<=3583||p>=3840&&p<=4255||Lr.Khmer(p))}function RA(p){for(const h of p)if(Yv(h.charCodeAt(0)))return!0;return!1}const fa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(p){this.pluginStatus=p.pluginStatus,this.pluginURL=p.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(p){this.applyArabicShaping=p.applyArabicShaping,this.processBidirectionalText=p.processBidirectionalText,this.processStyledBidirectionalText=p.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class dn{constructor(h,v){this.zoom=h,v?(this.now=v.now,this.fadeDuration=v.fadeDuration,this.zoomHistory=v.zoomHistory,this.transition=v.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new qv,this.transition={})}isSupportedScript(h){return function(v,b){for(const E of v)if(!PA(E.charCodeAt(0),b))return!1;return!0}(h,fa.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const h=this.zoom,v=h-Math.floor(h),b=this.crossFadingFactor();return h>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:v+(1-v)*b}:{fromScale:.5,toScale:1,t:1-(1-b)*v}}}class Ic{constructor(h,v){this.property=h,this.value=v,this.expression=function(b,E){if(_f(b))return new Sc(b,E);if(wf(b)){const I=kv(b,E);if(I.result==="error")throw new Error(I.value.map(k=>`${k.key}: ${k.message}`).join(", "));return I.value}{let I=b;return E.type==="color"&&typeof b=="string"?I=Xr.parse(b):E.type!=="padding"||typeof b!="number"&&!Array.isArray(b)?E.type==="variableAnchorOffsetCollection"&&Array.isArray(b)&&(I=Ca.parse(b)):I=ua.parse(b),{kind:"constant",evaluate:()=>I}}}(v===void 0?h.specification.default:v,h.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(h,v,b){return this.property.possiblyEvaluate(this,h,v,b)}}class Lf{constructor(h){this.property=h,this.value=new Ic(h,void 0)}transitioned(h,v){return new Nb(this.property,this.value,v,U({},h.transition,this.transition),h.now)}untransitioned(){return new Nb(this.property,this.value,null,{},0)}}class Pf{constructor(h){this._properties=h,this._values=Object.create(h.defaultTransitionablePropertyValues)}getValue(h){return X(this._values[h].value.value)}setValue(h,v){Object.prototype.hasOwnProperty.call(this._values,h)||(this._values[h]=new Lf(this._values[h].property)),this._values[h].value=new Ic(this._values[h].property,v===null?void 0:X(v))}getTransition(h){return X(this._values[h].transition)}setTransition(h,v){Object.prototype.hasOwnProperty.call(this._values,h)||(this._values[h]=new Lf(this._values[h].property)),this._values[h].transition=X(v)||void 0}serialize(){const h={};for(const v of Object.keys(this._values)){const b=this.getValue(v);b!==void 0&&(h[v]=b);const E=this.getTransition(v);E!==void 0&&(h[`${v}-transition`]=E)}return h}transitioned(h,v){const b=new Ah(this._properties);for(const E of Object.keys(this._values))b._values[E]=this._values[E].transitioned(h,v._values[E]);return b}untransitioned(){const h=new Ah(this._properties);for(const v of Object.keys(this._values))h._values[v]=this._values[v].untransitioned();return h}}class Nb{constructor(h,v,b,E,I){this.property=h,this.value=v,this.begin=I+E.delay||0,this.end=this.begin+E.duration||0,h.specification.transition&&(E.delay||E.duration)&&(this.prior=b)}possiblyEvaluate(h,v,b){const E=h.now||0,I=this.value.possiblyEvaluate(h,v,b),k=this.prior;if(k){if(E>this.end)return this.prior=null,I;if(this.value.isDataDriven())return this.prior=null,I;if(E<this.begin)return k.possiblyEvaluate(h,v,b);{const R=(E-this.begin)/(this.end-this.begin);return this.property.interpolate(k.possiblyEvaluate(h,v,b),I,function(z){if(z<=0)return 0;if(z>=1)return 1;const G=z*z,W=G*z;return 4*(z<.5?W:3*(z-G)+W-.75)}(R))}}return I}}class Ah{constructor(h){this._properties=h,this._values=Object.create(h.defaultTransitioningPropertyValues)}possiblyEvaluate(h,v,b){const E=new Mh(this._properties);for(const I of Object.keys(this._values))E._values[I]=this._values[I].possiblyEvaluate(h,v,b);return E}hasTransition(){for(const h of Object.keys(this._values))if(this._values[h].prior)return!0;return!1}}class Dh{constructor(h){this._properties=h,this._values=Object.create(h.defaultPropertyValues)}hasValue(h){return this._values[h].value!==void 0}getValue(h){return X(this._values[h].value)}setValue(h,v){this._values[h]=new Ic(this._values[h].property,v===null?void 0:X(v))}serialize(){const h={};for(const v of Object.keys(this._values)){const b=this.getValue(v);b!==void 0&&(h[v]=b)}return h}possiblyEvaluate(h,v,b){const E=new Mh(this._properties);for(const I of Object.keys(this._values))E._values[I]=this._values[I].possiblyEvaluate(h,v,b);return E}}class Io{constructor(h,v,b){this.property=h,this.value=v,this.parameters=b}isConstant(){return this.value.kind==="constant"}constantOr(h){return this.value.kind==="constant"?this.value.value:h}evaluate(h,v,b,E){return this.property.evaluate(this.value,this.parameters,h,v,b,E)}}class Mh{constructor(h){this._properties=h,this._values=Object.create(h.defaultPossiblyEvaluatedValues)}get(h){return this._values[h]}}class Ot{constructor(h){this.specification=h}possiblyEvaluate(h,v){if(h.isDataDriven())throw new Error("Value should not be data driven");return h.expression.evaluate(v)}interpolate(h,v,b){const E=$i[this.specification.type];return E?E(h,v,b):h}}class Kt{constructor(h,v){this.specification=h,this.overrides=v}possiblyEvaluate(h,v,b,E){return new Io(this,h.expression.kind==="constant"||h.expression.kind==="camera"?{kind:"constant",value:h.expression.evaluate(v,null,{},b,E)}:h.expression,v)}interpolate(h,v,b){if(h.value.kind!=="constant"||v.value.kind!=="constant")return h;if(h.value.value===void 0||v.value.value===void 0)return new Io(this,{kind:"constant",value:void 0},h.parameters);const E=$i[this.specification.type];if(E){const I=E(h.value.value,v.value.value,b);return new Io(this,{kind:"constant",value:I},h.parameters)}return h}evaluate(h,v,b,E,I,k){return h.kind==="constant"?h.value:h.evaluate(v,b,E,I,k)}}class Rf extends Kt{possiblyEvaluate(h,v,b,E){if(h.value===void 0)return new Io(this,{kind:"constant",value:void 0},v);if(h.expression.kind==="constant"){const I=h.expression.evaluate(v,null,{},b,E),k=h.property.specification.type==="resolvedImage"&&typeof I!="string"?I.name:I,R=this._calculate(k,k,k,v);return new Io(this,{kind:"constant",value:R},v)}if(h.expression.kind==="camera"){const I=this._calculate(h.expression.evaluate({zoom:v.zoom-1}),h.expression.evaluate({zoom:v.zoom}),h.expression.evaluate({zoom:v.zoom+1}),v);return new Io(this,{kind:"constant",value:I},v)}return new Io(this,h.expression,v)}evaluate(h,v,b,E,I,k){if(h.kind==="source"){const R=h.evaluate(v,b,E,I,k);return this._calculate(R,R,R,v)}return h.kind==="composite"?this._calculate(h.evaluate({zoom:Math.floor(v.zoom)-1},b,E),h.evaluate({zoom:Math.floor(v.zoom)},b,E),h.evaluate({zoom:Math.floor(v.zoom)+1},b,E),v):h.value}_calculate(h,v,b,E){return E.zoom>E.zoomHistory.lastIntegerZoom?{from:h,to:v}:{from:b,to:v}}interpolate(h){return h}}class Nf{constructor(h){this.specification=h}possiblyEvaluate(h,v,b,E){if(h.value!==void 0){if(h.expression.kind==="constant"){const I=h.expression.evaluate(v,null,{},b,E);return this._calculate(I,I,I,v)}return this._calculate(h.expression.evaluate(new dn(Math.floor(v.zoom-1),v)),h.expression.evaluate(new dn(Math.floor(v.zoom),v)),h.expression.evaluate(new dn(Math.floor(v.zoom+1),v)),v)}}_calculate(h,v,b,E){return E.zoom>E.zoomHistory.lastIntegerZoom?{from:h,to:v}:{from:b,to:v}}interpolate(h){return h}}class Kv{constructor(h){this.specification=h}possiblyEvaluate(h,v,b,E){return!!h.expression.evaluate(v,null,{},b,E)}interpolate(){return!1}}class D{constructor(h){this.properties=h,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const v in h){const b=h[v];b.specification.overridable&&this.overridableProperties.push(v);const E=this.defaultPropertyValues[v]=new Ic(b,void 0),I=this.defaultTransitionablePropertyValues[v]=new Lf(b);this.defaultTransitioningPropertyValues[v]=I.untransitioned(),this.defaultPossiblyEvaluatedValues[v]=E.possiblyEvaluate({})}}}Pt("DataDrivenProperty",Kt),Pt("DataConstantProperty",Ot),Pt("CrossFadedDataDrivenProperty",Rf),Pt("CrossFadedProperty",Nf),Pt("ColorRampProperty",Kv);const u="-transition";class y extends _r{constructor(h,v){if(super(),this.id=h.id,this.type=h.type,this._featureFilter={filter:()=>!0,needGeometry:!1},h.type!=="custom"&&(this.metadata=h.metadata,this.minzoom=h.minzoom,this.maxzoom=h.maxzoom,h.type!=="background"&&(this.source=h.source,this.sourceLayer=h["source-layer"],this.filter=h.filter),v.layout&&(this._unevaluatedLayout=new Dh(v.layout)),v.paint)){this._transitionablePaint=new Pf(v.paint);for(const b in h.paint)this.setPaintProperty(b,h.paint[b],{validate:!1});for(const b in h.layout)this.setLayoutProperty(b,h.layout[b],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Mh(v.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(h){return h==="visibility"?this.visibility:this._unevaluatedLayout.getValue(h)}setLayoutProperty(h,v,b={}){v!=null&&this._validate(kb,`layers.${this.id}.layout.${h}`,h,v,b)||(h!=="visibility"?this._unevaluatedLayout.setValue(h,v):this.visibility=v)}getPaintProperty(h){return h.endsWith(u)?this._transitionablePaint.getTransition(h.slice(0,-11)):this._transitionablePaint.getValue(h)}setPaintProperty(h,v,b={}){if(v!=null&&this._validate(Ib,`layers.${this.id}.paint.${h}`,h,v,b))return!1;if(h.endsWith(u))return this._transitionablePaint.setTransition(h.slice(0,-11),v||void 0),!1;{const E=this._transitionablePaint._values[h],I=E.property.specification["property-type"]==="cross-faded-data-driven",k=E.value.isDataDriven(),R=E.value;this._transitionablePaint.setValue(h,v),this._handleSpecialPaintPropertyUpdate(h);const z=this._transitionablePaint._values[h].value;return z.isDataDriven()||k||I||this._handleOverridablePaintPropertyUpdate(h,R,z)}}_handleSpecialPaintPropertyUpdate(h){}_handleOverridablePaintPropertyUpdate(h,v,b){return!1}isHidden(h){return!!(this.minzoom&&h<this.minzoom)||!!(this.maxzoom&&h>=this.maxzoom)||this.visibility==="none"}updateTransitions(h){this._transitioningPaint=this._transitionablePaint.transitioned(h,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(h,v){h.getCrossfadeParameters&&(this._crossfadeParameters=h.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(h,void 0,v)),this.paint=this._transitioningPaint.possiblyEvaluate(h,void 0,v)}serialize(){const h={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&&(h.layout=h.layout||{},h.layout.visibility=this.visibility),Y(h,(v,b)=>!(v===void 0||b==="layout"&&!Object.keys(v).length||b==="paint"&&!Object.keys(v).length))}_validate(h,v,b,E,I={}){return(!I||I.validate!==!1)&&Hv(this,h.call(ml,{key:v,layerType:this.type,objectKey:b,value:E,styleSpec:Le,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const h in this.paint._values){const v=this.paint.get(h);if(v instanceof Io&&yc(v.property.specification)&&(v.value.kind==="source"||v.value.kind==="composite")&&v.value.isStateDependent)return!0}return!1}}const S={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class T{constructor(h,v){this._structArray=h,this._pos1=v*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class A{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(h,v){return h._trim(),v&&(h.isTransferred=!0,v.push(h.arrayBuffer)),{length:h.length,arrayBuffer:h.arrayBuffer}}static deserialize(h){const v=Object.create(this.prototype);return v.arrayBuffer=h.arrayBuffer,v.length=h.length,v.capacity=h.arrayBuffer.byteLength/v.bytesPerElement,v._refreshViews(),v}_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(h){this.reserve(h),this.length=h}reserve(h){if(h>this.capacity){this.capacity=Math.max(h,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const v=this.uint8;this._refreshViews(),v&&this.uint8.set(v)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function N(p,h=1){let v=0,b=0;return{members:p.map(E=>{const I=S[E.type].BYTES_PER_ELEMENT,k=v=B(v,Math.max(h,I)),R=E.components||1;return b=Math.max(b,I),v+=I*R,{name:E.name,type:E.type,components:R,offset:k}}),size:B(v,Math.max(b,h)),alignment:h}}function B(p,h){return Math.ceil(p/h)*h}class $ extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v){const b=this.length;return this.resize(b+1),this.emplace(b,h,v)}emplace(h,v,b){const E=2*h;return this.int16[E+0]=v,this.int16[E+1]=b,h}}$.prototype.bytesPerElement=4,Pt("StructArrayLayout2i4",$);class q extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.int16[I+0]=v,this.int16[I+1]=b,this.int16[I+2]=E,h}}q.prototype.bytesPerElement=6,Pt("StructArrayLayout3i6",q);class K extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E){const I=this.length;return this.resize(I+1),this.emplace(I,h,v,b,E)}emplace(h,v,b,E,I){const k=4*h;return this.int16[k+0]=v,this.int16[k+1]=b,this.int16[k+2]=E,this.int16[k+3]=I,h}}K.prototype.bytesPerElement=8,Pt("StructArrayLayout4i8",K);class J extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=6*h;return this.int16[z+0]=v,this.int16[z+1]=b,this.int16[z+2]=E,this.int16[z+3]=I,this.int16[z+4]=k,this.int16[z+5]=R,h}}J.prototype.bytesPerElement=12,Pt("StructArrayLayout2i4i12",J);class ae extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=4*h,G=8*h;return this.int16[z+0]=v,this.int16[z+1]=b,this.uint8[G+4]=E,this.uint8[G+5]=I,this.uint8[G+6]=k,this.uint8[G+7]=R,h}}ae.prototype.bytesPerElement=8,Pt("StructArrayLayout2i4ub8",ae);class ue extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v){const b=this.length;return this.resize(b+1),this.emplace(b,h,v)}emplace(h,v,b){const E=2*h;return this.float32[E+0]=v,this.float32[E+1]=b,h}}ue.prototype.bytesPerElement=8,Pt("StructArrayLayout2f8",ue);class fe extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k,R,z,G,W){const j=this.length;return this.resize(j+1),this.emplace(j,h,v,b,E,I,k,R,z,G,W)}emplace(h,v,b,E,I,k,R,z,G,W,j){const ee=10*h;return this.uint16[ee+0]=v,this.uint16[ee+1]=b,this.uint16[ee+2]=E,this.uint16[ee+3]=I,this.uint16[ee+4]=k,this.uint16[ee+5]=R,this.uint16[ee+6]=z,this.uint16[ee+7]=G,this.uint16[ee+8]=W,this.uint16[ee+9]=j,h}}fe.prototype.bytesPerElement=20,Pt("StructArrayLayout10ui20",fe);class be extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k,R,z,G,W,j,ee){const ne=this.length;return this.resize(ne+1),this.emplace(ne,h,v,b,E,I,k,R,z,G,W,j,ee)}emplace(h,v,b,E,I,k,R,z,G,W,j,ee,ne){const se=12*h;return this.int16[se+0]=v,this.int16[se+1]=b,this.int16[se+2]=E,this.int16[se+3]=I,this.uint16[se+4]=k,this.uint16[se+5]=R,this.uint16[se+6]=z,this.uint16[se+7]=G,this.int16[se+8]=W,this.int16[se+9]=j,this.int16[se+10]=ee,this.int16[se+11]=ne,h}}be.prototype.bytesPerElement=24,Pt("StructArrayLayout4i4ui4i24",be);class Se extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.float32[I+0]=v,this.float32[I+1]=b,this.float32[I+2]=E,h}}Se.prototype.bytesPerElement=12,Pt("StructArrayLayout3f12",Se);class Te extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(h){const v=this.length;return this.resize(v+1),this.emplace(v,h)}emplace(h,v){return this.uint32[1*h+0]=v,h}}Te.prototype.bytesPerElement=4,Pt("StructArrayLayout1ul4",Te);class Ce extends A{_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(h,v,b,E,I,k,R,z,G){const W=this.length;return this.resize(W+1),this.emplace(W,h,v,b,E,I,k,R,z,G)}emplace(h,v,b,E,I,k,R,z,G,W){const j=10*h,ee=5*h;return this.int16[j+0]=v,this.int16[j+1]=b,this.int16[j+2]=E,this.int16[j+3]=I,this.int16[j+4]=k,this.int16[j+5]=R,this.uint32[ee+3]=z,this.uint16[j+8]=G,this.uint16[j+9]=W,h}}Ce.prototype.bytesPerElement=20,Pt("StructArrayLayout6i1ul2ui20",Ce);class ve extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=6*h;return this.int16[z+0]=v,this.int16[z+1]=b,this.int16[z+2]=E,this.int16[z+3]=I,this.int16[z+4]=k,this.int16[z+5]=R,h}}ve.prototype.bytesPerElement=12,Pt("StructArrayLayout2i2i2i12",ve);class Ie extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I){const k=this.length;return this.resize(k+1),this.emplace(k,h,v,b,E,I)}emplace(h,v,b,E,I,k){const R=4*h,z=8*h;return this.float32[R+0]=v,this.float32[R+1]=b,this.float32[R+2]=E,this.int16[z+6]=I,this.int16[z+7]=k,h}}Ie.prototype.bytesPerElement=16,Pt("StructArrayLayout2f1f2i16",Ie);class Pe extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(h,v,b,E,I,k){const R=this.length;return this.resize(R+1),this.emplace(R,h,v,b,E,I,k)}emplace(h,v,b,E,I,k,R){const z=16*h,G=4*h,W=8*h;return this.uint8[z+0]=v,this.uint8[z+1]=b,this.float32[G+1]=E,this.float32[G+2]=I,this.int16[W+6]=k,this.int16[W+7]=R,h}}Pe.prototype.bytesPerElement=16,Pt("StructArrayLayout2ub2f2i16",Pe);class Ve extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.uint16[I+0]=v,this.uint16[I+1]=b,this.uint16[I+2]=E,h}}Ve.prototype.bytesPerElement=6,Pt("StructArrayLayout3ui6",Ve);class Ke extends A{_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(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we)}emplace(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe){const Ae=24*h,Re=12*h,He=48*h;return this.int16[Ae+0]=v,this.int16[Ae+1]=b,this.uint16[Ae+2]=E,this.uint16[Ae+3]=I,this.uint32[Re+2]=k,this.uint32[Re+3]=R,this.uint32[Re+4]=z,this.uint16[Ae+10]=G,this.uint16[Ae+11]=W,this.uint16[Ae+12]=j,this.float32[Re+7]=ee,this.float32[Re+8]=ne,this.uint8[He+36]=se,this.uint8[He+37]=ce,this.uint8[He+38]=ye,this.uint32[Re+10]=we,this.int16[Ae+22]=Oe,h}}Ke.prototype.bytesPerElement=48,Pt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ke);class st extends A{_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(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe,Ae,Re,He,et,Ct,Yt,xt,_t,Gt,Rt){const It=this.length;return this.resize(It+1),this.emplace(It,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe,Ae,Re,He,et,Ct,Yt,xt,_t,Gt,Rt)}emplace(h,v,b,E,I,k,R,z,G,W,j,ee,ne,se,ce,ye,we,Oe,Ae,Re,He,et,Ct,Yt,xt,_t,Gt,Rt,It){const Ye=32*h,Ut=16*h;return this.int16[Ye+0]=v,this.int16[Ye+1]=b,this.int16[Ye+2]=E,this.int16[Ye+3]=I,this.int16[Ye+4]=k,this.int16[Ye+5]=R,this.int16[Ye+6]=z,this.int16[Ye+7]=G,this.uint16[Ye+8]=W,this.uint16[Ye+9]=j,this.uint16[Ye+10]=ee,this.uint16[Ye+11]=ne,this.uint16[Ye+12]=se,this.uint16[Ye+13]=ce,this.uint16[Ye+14]=ye,this.uint16[Ye+15]=we,this.uint16[Ye+16]=Oe,this.uint16[Ye+17]=Ae,this.uint16[Ye+18]=Re,this.uint16[Ye+19]=He,this.uint16[Ye+20]=et,this.uint16[Ye+21]=Ct,this.uint16[Ye+22]=Yt,this.uint32[Ut+12]=xt,this.float32[Ut+13]=_t,this.float32[Ut+14]=Gt,this.uint16[Ye+30]=Rt,this.uint16[Ye+31]=It,h}}st.prototype.bytesPerElement=64,Pt("StructArrayLayout8i15ui1ul2f2ui64",st);class bt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h){const v=this.length;return this.resize(v+1),this.emplace(v,h)}emplace(h,v){return this.float32[1*h+0]=v,h}}bt.prototype.bytesPerElement=4,Pt("StructArrayLayout1f4",bt);class Mt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=3*h;return this.uint16[6*h+0]=v,this.float32[I+1]=b,this.float32[I+2]=E,h}}Mt.prototype.bytesPerElement=12,Pt("StructArrayLayout1ui2f12",Mt);class gt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,h,v,b)}emplace(h,v,b,E){const I=4*h;return this.uint32[2*h+0]=v,this.uint16[I+2]=b,this.uint16[I+3]=E,h}}gt.prototype.bytesPerElement=8,Pt("StructArrayLayout1ul2ui8",gt);class pt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h,v){const b=this.length;return this.resize(b+1),this.emplace(b,h,v)}emplace(h,v,b){const E=2*h;return this.uint16[E+0]=v,this.uint16[E+1]=b,h}}pt.prototype.bytesPerElement=4,Pt("StructArrayLayout2ui4",pt);class zt extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(h){const v=this.length;return this.resize(v+1),this.emplace(v,h)}emplace(h,v){return this.uint16[1*h+0]=v,h}}zt.prototype.bytesPerElement=2,Pt("StructArrayLayout1ui2",zt);class or extends A{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(h,v,b,E){const I=this.length;return this.resize(I+1),this.emplace(I,h,v,b,E)}emplace(h,v,b,E,I){const k=4*h;return this.float32[k+0]=v,this.float32[k+1]=b,this.float32[k+2]=E,this.float32[k+3]=I,h}}or.prototype.bytesPerElement=16,Pt("StructArrayLayout4f16",or);class mt extends T{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 f(this.anchorPointX,this.anchorPointY)}}mt.prototype.size=20;class Et extends Ce{get(h){return new mt(this,h)}}Pt("CollisionBoxArray",Et);class rr extends T{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(h){this._structArray.uint8[this._pos1+37]=h}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(h){this._structArray.uint8[this._pos1+38]=h}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(h){this._structArray.uint32[this._pos4+10]=h}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}rr.prototype.size=48;class fn extends Ke{get(h){return new rr(this,h)}}Pt("PlacedSymbolArray",fn);class mr extends T{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(h){this._structArray.uint32[this._pos4+12]=h}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]}}mr.prototype.size=64;class Mr extends st{get(h){return new mr(this,h)}}Pt("SymbolInstanceArray",Mr);class pn extends bt{getoffsetX(h){return this.float32[1*h+0]}}Pt("GlyphOffsetArray",pn);class vi extends q{getx(h){return this.int16[3*h+0]}gety(h){return this.int16[3*h+1]}gettileUnitDistanceFromAnchor(h){return this.int16[3*h+2]}}Pt("SymbolLineVertexArray",vi);class ja extends T{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]}}ja.prototype.size=12;class gn extends Mt{get(h){return new ja(this,h)}}Pt("TextAnchorOffsetArray",gn);class Ui extends T{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]}}Ui.prototype.size=8;class ki extends gt{get(h){return new Ui(this,h)}}Pt("FeatureIndexArray",ki);class mi extends ${}class Li extends ${}class ko extends ${}class kc extends J{}class Of extends ae{}class Lc extends ue{}class Ia extends fe{}class zf extends be{}class Jv extends Se{}class ka extends Te{}class La extends ve{}class Ms extends Pe{}class Xa extends Ve{}class ci extends pt{}const yi=N([{name:"a_pos",components:2,type:"Int16"}],4),{members:pa}=yi;class Pr{constructor(h=[]){this.segments=h}prepareSegment(h,v,b,E){let I=this.segments[this.segments.length-1];return h>Pr.MAX_VERTEX_ARRAY_LENGTH&&oe(`Max vertices per segment is ${Pr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${h}`),(!I||I.vertexLength+h>Pr.MAX_VERTEX_ARRAY_LENGTH||I.sortKey!==E)&&(I={vertexOffset:v.length,primitiveOffset:b.length,vertexLength:0,primitiveLength:0},E!==void 0&&(I.sortKey=E),this.segments.push(I)),I}get(){return this.segments}destroy(){for(const h of this.segments)for(const v in h.vaos)h.vaos[v].destroy()}static simpleSegment(h,v,b,E){return new Pr([{vertexOffset:h,primitiveOffset:v,vertexLength:b,primitiveLength:E,vaos:{},sortKey:0}])}}function yl(p,h){return 256*(p=F(Math.floor(p),0,255))+F(Math.floor(h),0,255)}Pr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Pt("SegmentVector",Pr);const Pc=N([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Rc={exports:{}},Ob={exports:{}};Ob.exports=function(p,h){var v,b,E,I,k,R,z,G;for(b=p.length-(v=3&p.length),E=h,k=3432918353,R=461845907,G=0;G<b;)z=255&p.charCodeAt(G)|(255&p.charCodeAt(++G))<<8|(255&p.charCodeAt(++G))<<16|(255&p.charCodeAt(++G))<<24,++G,E=27492+(65535&(I=5*(65535&(E=(E^=z=(65535&(z=(z=(65535&z)*k+(((z>>>16)*k&65535)<<16)&4294967295)<<15|z>>>17))*R+(((z>>>16)*R&65535)<<16)&4294967295)<<13|E>>>19))+((5*(E>>>16)&65535)<<16)&4294967295))+((58964+(I>>>16)&65535)<<16);switch(z=0,v){case 3:z^=(255&p.charCodeAt(G+2))<<16;case 2:z^=(255&p.charCodeAt(G+1))<<8;case 1:E^=z=(65535&(z=(z=(65535&(z^=255&p.charCodeAt(G)))*k+(((z>>>16)*k&65535)<<16)&4294967295)<<15|z>>>17))*R+(((z>>>16)*R&65535)<<16)&4294967295}return E^=p.length,E=2246822507*(65535&(E^=E>>>16))+((2246822507*(E>>>16)&65535)<<16)&4294967295,E=3266489909*(65535&(E^=E>>>13))+((3266489909*(E>>>16)&65535)<<16)&4294967295,(E^=E>>>16)>>>0};var NA=Ob.exports,zb={exports:{}};zb.exports=function(p,h){for(var v,b=p.length,E=h^b,I=0;b>=4;)v=1540483477*(65535&(v=255&p.charCodeAt(I)|(255&p.charCodeAt(++I))<<8|(255&p.charCodeAt(++I))<<16|(255&p.charCodeAt(++I))<<24))+((1540483477*(v>>>16)&65535)<<16),E=1540483477*(65535&E)+((1540483477*(E>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),b-=4,++I;switch(b){case 3:E^=(255&p.charCodeAt(I+2))<<16;case 2:E^=(255&p.charCodeAt(I+1))<<8;case 1:E=1540483477*(65535&(E^=255&p.charCodeAt(I)))+((1540483477*(E>>>16)&65535)<<16)}return E=1540483477*(65535&(E^=E>>>13))+((1540483477*(E>>>16)&65535)<<16),(E^=E>>>15)>>>0};var Is=NA,Bb=zb.exports;Rc.exports=Is,Rc.exports.murmur3=Is,Rc.exports.murmur2=Bb;var Bf=l(Rc.exports);class Ih{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(h,v,b,E){this.ids.push(Vf(h)),this.positions.push(v,b,E)}getPositions(h){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const v=Vf(h);let b=0,E=this.ids.length-1;for(;b<E;){const k=b+E>>1;this.ids[k]>=v?E=k:b=k+1}const I=[];for(;this.ids[b]===v;)I.push({index:this.positions[3*b],start:this.positions[3*b+1],end:this.positions[3*b+2]}),b++;return I}static serialize(h,v){const b=new Float64Array(h.ids),E=new Uint32Array(h.positions);return Ff(b,E,0,b.length-1),v&&v.push(b.buffer,E.buffer),{ids:b,positions:E}}static deserialize(h){const v=new Ih;return v.ids=h.ids,v.positions=h.positions,v.indexed=!0,v}}function Vf(p){const h=+p;return!isNaN(h)&&h<=Number.MAX_SAFE_INTEGER?h:Bf(String(p))}function Ff(p,h,v,b){for(;v<b;){const E=p[v+b>>1];let I=v-1,k=b+1;for(;;){do I++;while(p[I]<E);do k--;while(p[k]>E);if(I>=k)break;Nc(p,I,k),Nc(h,3*I,3*k),Nc(h,3*I+1,3*k+1),Nc(h,3*I+2,3*k+2)}k-v<b-k?(Ff(p,h,v,k),v=k+1):(Ff(p,h,k+1,b),b=k)}}function Nc(p,h,v){const b=p[h];p[h]=p[v],p[v]=b}Pt("FeaturePositionMap",Ih);class kh{constructor(h,v){this.gl=h.gl,this.location=v}}class Vb extends kh{constructor(h,v){super(h,v),this.current=0}set(h){this.current!==h&&(this.current=h,this.gl.uniform1f(this.location,h))}}class H$ extends kh{constructor(h,v){super(h,v),this.current=[0,0,0,0]}set(h){h[0]===this.current[0]&&h[1]===this.current[1]&&h[2]===this.current[2]&&h[3]===this.current[3]||(this.current=h,this.gl.uniform4f(this.location,h[0],h[1],h[2],h[3]))}}class W$ extends kh{constructor(h,v){super(h,v),this.current=Xr.transparent}set(h){h.r===this.current.r&&h.g===this.current.g&&h.b===this.current.b&&h.a===this.current.a||(this.current=h,this.gl.uniform4f(this.location,h.r,h.g,h.b,h.a))}}const Qme=new Float32Array(16);function OA(p){return[yl(255*p.r,255*p.g),yl(255*p.b,255*p.a)]}class Qv{constructor(h,v,b){this.value=h,this.uniformNames=v.map(E=>`u_${E}`),this.type=b}setUniform(h,v,b){h.set(b.constantOr(this.value))}getBinding(h,v,b){return this.type==="color"?new W$(h,v):new Vb(h,v)}}class $f{constructor(h,v){this.uniformNames=v.map(b=>`u_${b}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(h,v){this.pixelRatioFrom=v.pixelRatio,this.pixelRatioTo=h.pixelRatio,this.patternFrom=v.tlbr,this.patternTo=h.tlbr}setUniform(h,v,b,E){const I=E==="u_pattern_to"?this.patternTo:E==="u_pattern_from"?this.patternFrom:E==="u_pixel_ratio_to"?this.pixelRatioTo:E==="u_pixel_ratio_from"?this.pixelRatioFrom:null;I&&h.set(I)}getBinding(h,v,b){return b.substr(0,9)==="u_pattern"?new H$(h,v):new Vb(h,v)}}class _l{constructor(h,v,b,E){this.expression=h,this.type=b,this.maxValue=0,this.paintVertexAttributes=v.map(I=>({name:`a_${I}`,type:"Float32",components:b==="color"?2:1,offset:0})),this.paintVertexArray=new E}populatePaintArray(h,v,b,E,I){const k=this.paintVertexArray.length,R=this.expression.evaluate(new dn(0),v,{},E,[],I);this.paintVertexArray.resize(h),this._setPaintValue(k,h,R)}updatePaintArray(h,v,b,E){const I=this.expression.evaluate({zoom:0},b,E);this._setPaintValue(h,v,I)}_setPaintValue(h,v,b){if(this.type==="color"){const E=OA(b);for(let I=h;I<v;I++)this.paintVertexArray.emplace(I,E[0],E[1])}else{for(let E=h;E<v;E++)this.paintVertexArray.emplace(E,b);this.maxValue=Math.max(this.maxValue,Math.abs(b))}}upload(h){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=h.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Qo{constructor(h,v,b,E,I,k){this.expression=h,this.uniformNames=v.map(R=>`u_${R}_t`),this.type=b,this.useIntegerZoom=E,this.zoom=I,this.maxValue=0,this.paintVertexAttributes=v.map(R=>({name:`a_${R}`,type:"Float32",components:b==="color"?4:2,offset:0})),this.paintVertexArray=new k}populatePaintArray(h,v,b,E,I){const k=this.expression.evaluate(new dn(this.zoom),v,{},E,[],I),R=this.expression.evaluate(new dn(this.zoom+1),v,{},E,[],I),z=this.paintVertexArray.length;this.paintVertexArray.resize(h),this._setPaintValue(z,h,k,R)}updatePaintArray(h,v,b,E){const I=this.expression.evaluate({zoom:this.zoom},b,E),k=this.expression.evaluate({zoom:this.zoom+1},b,E);this._setPaintValue(h,v,I,k)}_setPaintValue(h,v,b,E){if(this.type==="color"){const I=OA(b),k=OA(E);for(let R=h;R<v;R++)this.paintVertexArray.emplace(R,I[0],I[1],k[0],k[1])}else{for(let I=h;I<v;I++)this.paintVertexArray.emplace(I,b,E);this.maxValue=Math.max(this.maxValue,Math.abs(b),Math.abs(E))}}upload(h){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=h.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(h,v){const b=this.useIntegerZoom?Math.floor(v.zoom):v.zoom,E=F(this.expression.interpolationFactor(b,this.zoom,this.zoom+1),0,1);h.set(E)}getBinding(h,v,b){return new Vb(h,v)}}class Oc{constructor(h,v,b,E,I,k){this.expression=h,this.type=v,this.useIntegerZoom=b,this.zoom=E,this.layerId=k,this.zoomInPaintVertexArray=new I,this.zoomOutPaintVertexArray=new I}populatePaintArray(h,v,b){const E=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(h),this.zoomOutPaintVertexArray.resize(h),this._setPaintValues(E,h,v.patterns&&v.patterns[this.layerId],b)}updatePaintArray(h,v,b,E,I){this._setPaintValues(h,v,b.patterns&&b.patterns[this.layerId],I)}_setPaintValues(h,v,b,E){if(!E||!b)return;const{min:I,mid:k,max:R}=b,z=E[I],G=E[k],W=E[R];if(z&&G&&W)for(let j=h;j<v;j++)this.zoomInPaintVertexArray.emplace(j,G.tl[0],G.tl[1],G.br[0],G.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],G.pixelRatio,z.pixelRatio),this.zoomOutPaintVertexArray.emplace(j,G.tl[0],G.tl[1],G.br[0],G.br[1],W.tl[0],W.tl[1],W.br[0],W.br[1],G.pixelRatio,W.pixelRatio)}upload(h){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=h.createVertexBuffer(this.zoomInPaintVertexArray,Pc.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=h.createVertexBuffer(this.zoomOutPaintVertexArray,Pc.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class q${constructor(h,v,b){this.binders={},this._buffers=[];const E=[];for(const I in h.paint._values){if(!b(I))continue;const k=h.paint.get(I);if(!(k instanceof Io&&yc(k.property.specification)))continue;const R=eye(I,h.type),z=k.value,G=k.property.specification.type,W=k.property.useIntegerZoom,j=k.property.specification["property-type"],ee=j==="cross-faded"||j==="cross-faded-data-driven";if(z.kind==="constant")this.binders[I]=ee?new $f(z.value,R):new Qv(z.value,R,G),E.push(`/u_${I}`);else if(z.kind==="source"||ee){const ne=Z$(I,G,"source");this.binders[I]=ee?new Oc(z,G,W,v,ne,h.id):new _l(z,R,G,ne),E.push(`/a_${I}`)}else{const ne=Z$(I,G,"composite");this.binders[I]=new Qo(z,R,G,W,v,ne),E.push(`/z_${I}`)}}this.cacheKey=E.sort().join("")}getMaxValue(h){const v=this.binders[h];return v instanceof _l||v instanceof Qo?v.maxValue:0}populatePaintArrays(h,v,b,E,I){for(const k in this.binders){const R=this.binders[k];(R instanceof _l||R instanceof Qo||R instanceof Oc)&&R.populatePaintArray(h,v,b,E,I)}}setConstantPatternPositions(h,v){for(const b in this.binders){const E=this.binders[b];E instanceof $f&&E.setConstantPatternPositions(h,v)}}updatePaintArrays(h,v,b,E,I){let k=!1;for(const R in h){const z=v.getPositions(R);for(const G of z){const W=b.feature(G.index);for(const j in this.binders){const ee=this.binders[j];if((ee instanceof _l||ee instanceof Qo||ee instanceof Oc)&&ee.expression.isStateDependent===!0){const ne=E.paint.get(j);ee.expression=ne.value,ee.updatePaintArray(G.start,G.end,W,h[R],I),k=!0}}}}return k}defines(){const h=[];for(const v in this.binders){const b=this.binders[v];(b instanceof Qv||b instanceof $f)&&h.push(...b.uniformNames.map(E=>`#define HAS_UNIFORM_${E}`))}return h}getBinderAttributes(){const h=[];for(const v in this.binders){const b=this.binders[v];if(b instanceof _l||b instanceof Qo)for(let E=0;E<b.paintVertexAttributes.length;E++)h.push(b.paintVertexAttributes[E].name);else if(b instanceof Oc)for(let E=0;E<Pc.members.length;E++)h.push(Pc.members[E].name)}return h}getBinderUniforms(){const h=[];for(const v in this.binders){const b=this.binders[v];if(b instanceof Qv||b instanceof $f||b instanceof Qo)for(const E of b.uniformNames)h.push(E)}return h}getPaintVertexBuffers(){return this._buffers}getUniforms(h,v){const b=[];for(const E in this.binders){const I=this.binders[E];if(I instanceof Qv||I instanceof $f||I instanceof Qo){for(const k of I.uniformNames)if(v[k]){const R=I.getBinding(h,v[k],k);b.push({name:k,property:E,binding:R})}}}return b}setUniforms(h,v,b,E){for(const{name:I,property:k,binding:R}of v)this.binders[k].setUniform(R,E,b.get(k),I)}updatePaintBuffers(h){this._buffers=[];for(const v in this.binders){const b=this.binders[v];if(h&&b instanceof Oc){const E=h.fromScale===2?b.zoomInPaintVertexBuffer:b.zoomOutPaintVertexBuffer;E&&this._buffers.push(E)}else(b instanceof _l||b instanceof Qo)&&b.paintVertexBuffer&&this._buffers.push(b.paintVertexBuffer)}}upload(h){for(const v in this.binders){const b=this.binders[v];(b instanceof _l||b instanceof Qo||b instanceof Oc)&&b.upload(h)}this.updatePaintBuffers()}destroy(){for(const h in this.binders){const v=this.binders[h];(v instanceof _l||v instanceof Qo||v instanceof Oc)&&v.destroy()}}}class Lh{constructor(h,v,b=()=>!0){this.programConfigurations={};for(const E of h)this.programConfigurations[E.id]=new q$(E,v,b);this.needsUpload=!1,this._featureMap=new Ih,this._bufferOffset=0}populatePaintArrays(h,v,b,E,I,k){for(const R in this.programConfigurations)this.programConfigurations[R].populatePaintArrays(h,v,E,I,k);v.id!==void 0&&this._featureMap.add(v.id,b,this._bufferOffset,h),this._bufferOffset=h,this.needsUpload=!0}updatePaintArrays(h,v,b,E){for(const I of b)this.needsUpload=this.programConfigurations[I.id].updatePaintArrays(h,this._featureMap,v,I,E)||this.needsUpload}get(h){return this.programConfigurations[h]}upload(h){if(this.needsUpload){for(const v in this.programConfigurations)this.programConfigurations[v].upload(h);this.needsUpload=!1}}destroy(){for(const h in this.programConfigurations)this.programConfigurations[h].destroy()}}function eye(p,h){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[p]||[p.replace(`${h}-`,"").replace(/-/g,"_")]}function Z$(p,h,v){const b={color:{source:ue,composite:or},number:{source:bt,composite:ue}},E=function(I){return{"line-pattern":{source:Ia,composite:Ia},"fill-pattern":{source:Ia,composite:Ia},"fill-extrusion-pattern":{source:Ia,composite:Ia}}[I]}(p);return E&&E[v]||b[h][v]}Pt("ConstantBinder",Qv),Pt("CrossFadedConstantBinder",$f),Pt("SourceExpressionBinder",_l),Pt("CrossFadedCompositeBinder",Oc),Pt("CompositeExpressionBinder",Qo),Pt("ProgramConfiguration",q$,{omit:["_buffers"]}),Pt("ProgramConfigurationSet",Lh);const Fn=8192,zA=Math.pow(2,14)-1,j$=-zA-1;function Ph(p){const h=Fn/p.extent,v=p.loadGeometry();for(let b=0;b<v.length;b++){const E=v[b];for(let I=0;I<E.length;I++){const k=E[I],R=Math.round(k.x*h),z=Math.round(k.y*h);k.x=F(R,j$,zA),k.y=F(z,j$,zA),(R<k.x||R>k.x+1||z<k.y||z>k.y+1)&&oe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return v}function Rh(p,h){return{type:p.type,id:p.id,properties:p.properties,geometry:h?Ph(p):[]}}function Fb(p,h,v,b,E){p.emplaceBack(2*h+(b+1)/2,2*v+(E+1)/2)}class BA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.layoutVertexArray=new Li,this.indexArray=new Xa,this.segments=new Pr,this.programConfigurations=new Lh(h.layers,h.zoom),this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){const E=this.layers[0],I=[];let k=null,R=!1;E.type==="circle"&&(k=E.layout.get("circle-sort-key"),R=!k.isConstant());for(const{feature:z,id:G,index:W,sourceLayerIndex:j}of h){const ee=this.layers[0]._featureFilter.needGeometry,ne=Rh(z,ee);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),ne,b))continue;const se=R?k.evaluate(ne,{},b):void 0,ce={id:G,properties:z.properties,type:z.type,sourceLayerIndex:j,index:W,geometry:ee?ne.geometry:Ph(z),patterns:{},sortKey:se};I.push(ce)}R&&I.sort((z,G)=>z.sortKey-G.sortKey);for(const z of I){const{geometry:G,index:W,sourceLayerIndex:j}=z,ee=h[W].feature;this.addFeature(z,G,W,b),v.featureIndex.insert(ee,G,W,j,this.index)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,pa),this.indexBuffer=h.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(h),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(h,v,b,E){for(const I of v)for(const k of I){const R=k.x,z=k.y;if(R<0||R>=Fn||z<0||z>=Fn)continue;const G=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,h.sortKey),W=G.vertexLength;Fb(this.layoutVertexArray,R,z,-1,-1),Fb(this.layoutVertexArray,R,z,1,-1),Fb(this.layoutVertexArray,R,z,1,1),Fb(this.layoutVertexArray,R,z,-1,1),this.indexArray.emplaceBack(W,W+1,W+2),this.indexArray.emplaceBack(W,W+3,W+2),G.vertexLength+=4,G.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,{},E)}}function X$(p,h){for(let v=0;v<p.length;v++)if(Gf(h,p[v]))return!0;for(let v=0;v<h.length;v++)if(Gf(p,h[v]))return!0;return!!VA(p,h)}function tye(p,h,v){return!!Gf(p,h)||!!FA(h,p,v)}function Y$(p,h){if(p.length===1)return J$(h,p[0]);for(let v=0;v<h.length;v++){const b=h[v];for(let E=0;E<b.length;E++)if(Gf(p,b[E]))return!0}for(let v=0;v<p.length;v++)if(J$(h,p[v]))return!0;for(let v=0;v<h.length;v++)if(VA(p,h[v]))return!0;return!1}function rye(p,h,v){if(p.length>1){if(VA(p,h))return!0;for(let b=0;b<h.length;b++)if(FA(h[b],p,v))return!0}for(let b=0;b<p.length;b++)if(FA(p[b],h,v))return!0;return!1}function VA(p,h){if(p.length===0||h.length===0)return!1;for(let v=0;v<p.length-1;v++){const b=p[v],E=p[v+1];for(let I=0;I<h.length-1;I++)if(nye(b,E,h[I],h[I+1]))return!0}return!1}function nye(p,h,v,b){return le(p,v,b)!==le(h,v,b)&&le(p,h,v)!==le(p,h,b)}function FA(p,h,v){const b=v*v;if(h.length===1)return p.distSqr(h[0])<b;for(let E=1;E<h.length;E++)if(K$(p,h[E-1],h[E])<b)return!0;return!1}function K$(p,h,v){const b=h.distSqr(v);if(b===0)return p.distSqr(h);const E=((p.x-h.x)*(v.x-h.x)+(p.y-h.y)*(v.y-h.y))/b;return p.distSqr(E<0?h:E>1?v:v.sub(h)._mult(E)._add(h))}function J$(p,h){let v,b,E,I=!1;for(let k=0;k<p.length;k++){v=p[k];for(let R=0,z=v.length-1;R<v.length;z=R++)b=v[R],E=v[z],b.y>h.y!=E.y>h.y&&h.x<(E.x-b.x)*(h.y-b.y)/(E.y-b.y)+b.x&&(I=!I)}return I}function Gf(p,h){let v=!1;for(let b=0,E=p.length-1;b<p.length;E=b++){const I=p[b],k=p[E];I.y>h.y!=k.y>h.y&&h.x<(k.x-I.x)*(h.y-I.y)/(k.y-I.y)+I.x&&(v=!v)}return v}function iye(p,h,v){const b=v[0],E=v[2];if(p.x<b.x&&h.x<b.x||p.x>E.x&&h.x>E.x||p.y<b.y&&h.y<b.y||p.y>E.y&&h.y>E.y)return!1;const I=le(p,h,v[0]);return I!==le(p,h,v[1])||I!==le(p,h,v[2])||I!==le(p,h,v[3])}function em(p,h,v){const b=h.paint.get(p).value;return b.kind==="constant"?b.value:v.programConfigurations.get(h.id).getMaxValue(p)}function $b(p){return Math.sqrt(p[0]*p[0]+p[1]*p[1])}function Gb(p,h,v,b,E){if(!h[0]&&!h[1])return p;const I=f.convert(h)._mult(E);v==="viewport"&&I._rotate(-b);const k=[];for(let R=0;R<p.length;R++)k.push(p[R].sub(I));return k}let Q$,e6;Pt("CircleBucket",BA,{omit:["layers"]});var aye={get paint(){return e6=e6||new D({"circle-radius":new Kt(Le.paint_circle["circle-radius"]),"circle-color":new Kt(Le.paint_circle["circle-color"]),"circle-blur":new Kt(Le.paint_circle["circle-blur"]),"circle-opacity":new Kt(Le.paint_circle["circle-opacity"]),"circle-translate":new Ot(Le.paint_circle["circle-translate"]),"circle-translate-anchor":new Ot(Le.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ot(Le.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ot(Le.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Kt(Le.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Kt(Le.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Kt(Le.paint_circle["circle-stroke-opacity"])})},get layout(){return Q$=Q$||new D({"circle-sort-key":new Kt(Le.layout_circle["circle-sort-key"])})}},Hi=1e-6,Uf=typeof Float32Array<"u"?Float32Array:Array;function $A(p){return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function t6(p,h,v){var b=h[0],E=h[1],I=h[2],k=h[3],R=h[4],z=h[5],G=h[6],W=h[7],j=h[8],ee=h[9],ne=h[10],se=h[11],ce=h[12],ye=h[13],we=h[14],Oe=h[15],Ae=v[0],Re=v[1],He=v[2],et=v[3];return p[0]=Ae*b+Re*R+He*j+et*ce,p[1]=Ae*E+Re*z+He*ee+et*ye,p[2]=Ae*I+Re*G+He*ne+et*we,p[3]=Ae*k+Re*W+He*se+et*Oe,p[4]=(Ae=v[4])*b+(Re=v[5])*R+(He=v[6])*j+(et=v[7])*ce,p[5]=Ae*E+Re*z+He*ee+et*ye,p[6]=Ae*I+Re*G+He*ne+et*we,p[7]=Ae*k+Re*W+He*se+et*Oe,p[8]=(Ae=v[8])*b+(Re=v[9])*R+(He=v[10])*j+(et=v[11])*ce,p[9]=Ae*E+Re*z+He*ee+et*ye,p[10]=Ae*I+Re*G+He*ne+et*we,p[11]=Ae*k+Re*W+He*se+et*Oe,p[12]=(Ae=v[12])*b+(Re=v[13])*R+(He=v[14])*j+(et=v[15])*ce,p[13]=Ae*E+Re*z+He*ee+et*ye,p[14]=Ae*I+Re*G+He*ne+et*we,p[15]=Ae*k+Re*W+He*se+et*Oe,p}Math.hypot||(Math.hypot=function(){for(var p=0,h=arguments.length;h--;)p+=arguments[h]*arguments[h];return Math.sqrt(p)});var tm,oye=t6;function Ub(p,h,v){var b=h[0],E=h[1],I=h[2],k=h[3];return p[0]=v[0]*b+v[4]*E+v[8]*I+v[12]*k,p[1]=v[1]*b+v[5]*E+v[9]*I+v[13]*k,p[2]=v[2]*b+v[6]*E+v[10]*I+v[14]*k,p[3]=v[3]*b+v[7]*E+v[11]*I+v[15]*k,p}tm=new Uf(4),Uf!=Float32Array&&(tm[0]=0,tm[1]=0,tm[2]=0,tm[3]=0);class sye extends y{constructor(h){super(h,aye)}createBucket(h){return new BA(h)}queryRadius(h){const v=h;return em("circle-radius",this,v)+em("circle-stroke-width",this,v)+$b(this.paint.get("circle-translate"))}queryIntersectsFeature(h,v,b,E,I,k,R,z){const G=Gb(h,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),k.angle,R),W=this.paint.get("circle-radius").evaluate(v,b)+this.paint.get("circle-stroke-width").evaluate(v,b),j=this.paint.get("circle-pitch-alignment")==="map",ee=j?G:function(se,ce){return se.map(ye=>r6(ye,ce))}(G,z),ne=j?W*R:W;for(const se of E)for(const ce of se){const ye=j?ce:r6(ce,z);let we=ne;const Oe=Ub([],[ce.x,ce.y,0,1],z);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?we*=Oe[3]/k.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(we*=k.cameraToCenterDistance/Oe[3]),tye(ee,ye,we))return!0}return!1}}function r6(p,h){const v=Ub([],[p.x,p.y,0,1],h);return new f(v[0]/v[3],v[1]/v[3])}class n6 extends BA{}let i6;Pt("HeatmapBucket",n6,{omit:["layers"]});var lye={get paint(){return i6=i6||new D({"heatmap-radius":new Kt(Le.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Kt(Le.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ot(Le.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Kv(Le.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ot(Le.paint_heatmap["heatmap-opacity"])})}};function GA(p,{width:h,height:v},b,E){if(E){if(E instanceof Uint8ClampedArray)E=new Uint8Array(E.buffer);else if(E.length!==h*v*b)throw new RangeError(`mismatched image size. expected: ${E.length} but got: ${h*v*b}`)}else E=new Uint8Array(h*v*b);return p.width=h,p.height=v,p.data=E,p}function a6(p,{width:h,height:v},b){if(h===p.width&&v===p.height)return;const E=GA({},{width:h,height:v},b);UA(p,E,{x:0,y:0},{x:0,y:0},{width:Math.min(p.width,h),height:Math.min(p.height,v)},b),p.width=h,p.height=v,p.data=E.data}function UA(p,h,v,b,E,I){if(E.width===0||E.height===0)return h;if(E.width>p.width||E.height>p.height||v.x>p.width-E.width||v.y>p.height-E.height)throw new RangeError("out of range source coordinates for image copy");if(E.width>h.width||E.height>h.height||b.x>h.width-E.width||b.y>h.height-E.height)throw new RangeError("out of range destination coordinates for image copy");const k=p.data,R=h.data;if(k===R)throw new Error("srcData equals dstData, so image is already copied");for(let z=0;z<E.height;z++){const G=((v.y+z)*p.width+v.x)*I,W=((b.y+z)*h.width+b.x)*I;for(let j=0;j<E.width*I;j++)R[W+j]=k[G+j]}return h}class rm{constructor(h,v){GA(this,h,1,v)}resize(h){a6(this,h,1)}clone(){return new rm({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(h,v,b,E,I){UA(h,v,b,E,I,1)}}class Ya{constructor(h,v){GA(this,h,4,v)}resize(h){a6(this,h,4)}replace(h,v){v?this.data.set(h):this.data=h instanceof Uint8ClampedArray?new Uint8Array(h.buffer):h}clone(){return new Ya({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(h,v,b,E,I){UA(h,v,b,E,I,4)}}function o6(p){const h={},v=p.resolution||256,b=p.clips?p.clips.length:1,E=p.image||new Ya({width:v,height:b});if(Math.log(v)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${v}`);const I=(k,R,z)=>{h[p.evaluationKey]=z;const G=p.expression.evaluate(h);E.data[k+R+0]=Math.floor(255*G.r/G.a),E.data[k+R+1]=Math.floor(255*G.g/G.a),E.data[k+R+2]=Math.floor(255*G.b/G.a),E.data[k+R+3]=Math.floor(255*G.a)};if(p.clips)for(let k=0,R=0;k<b;++k,R+=4*v)for(let z=0,G=0;z<v;z++,G+=4){const W=z/(v-1),{start:j,end:ee}=p.clips[k];I(R,G,j*(1-W)+ee*W)}else for(let k=0,R=0;k<v;k++,R+=4)I(0,R,k/(v-1));return E}Pt("AlphaImage",rm),Pt("RGBAImage",Ya);const HA="big-fb";class cye extends y{createBucket(h){return new n6(h)}constructor(h){super(h,lye),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(h){h==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=o6({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(HA)&&this.heatmapFbos.delete(HA)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let s6;var uye={get paint(){return s6=s6||new D({"hillshade-illumination-direction":new Ot(Le.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ot(Le.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ot(Le.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ot(Le.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ot(Le.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ot(Le.paint_hillshade["hillshade-accent-color"])})}};class hye extends y{constructor(h){super(h,uye)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const dye=N([{name:"a_pos",components:2,type:"Int16"}],4),{members:fye}=dye;function l6(p,h,v=2){const b=h&&h.length,E=b?h[0]*v:p.length;let I=c6(p,0,E,v,!0);const k=[];if(!I||I.next===I.prev)return k;let R,z,G;if(b&&(I=function(W,j,ee,ne){const se=[];for(let ce=0,ye=j.length;ce<ye;ce++){const we=c6(W,j[ce]*ne,ce<ye-1?j[ce+1]*ne:W.length,ne,!1);we===we.next&&(we.steiner=!0),se.push(xye(we))}se.sort(yye);for(let ce=0;ce<se.length;ce++)ee=_ye(se[ce],ee);return ee}(p,h,I,v)),p.length>80*v){R=1/0,z=1/0;let W=-1/0,j=-1/0;for(let ee=v;ee<E;ee+=v){const ne=p[ee],se=p[ee+1];ne<R&&(R=ne),se<z&&(z=se),ne>W&&(W=ne),se>j&&(j=se)}G=Math.max(W-R,j-z),G=G!==0?32767/G:0}return nm(I,k,v,R,z,G,0),k}function c6(p,h,v,b,E){let I;if(E===function(k,R,z,G){let W=0;for(let j=R,ee=z-G;j<z;j+=G)W+=(k[ee]-k[j])*(k[j+1]+k[ee+1]),ee=j;return W}(p,h,v,b)>0)for(let k=h;k<v;k+=b)I=d6(k/b|0,p[k],p[k+1],I);else for(let k=v-b;k>=h;k-=b)I=d6(k/b|0,p[k],p[k+1],I);return I&&Hb(I,I.next)&&(am(I),I=I.next),I}function Nh(p,h){if(!p)return p;h||(h=p);let v,b=p;do if(v=!1,b.steiner||!Hb(b,b.next)&&Rn(b.prev,b,b.next)!==0)b=b.next;else{if(am(b),b=h=b.prev,b===b.next)break;v=!0}while(v||b!==h);return h}function nm(p,h,v,b,E,I,k){if(!p)return;!k&&I&&function(z,G,W,j){let ee=z;do ee.z===0&&(ee.z=WA(ee.x,ee.y,G,W,j)),ee.prevZ=ee.prev,ee.nextZ=ee.next,ee=ee.next;while(ee!==z);ee.prevZ.nextZ=null,ee.prevZ=null,function(ne){let se,ce=1;do{let ye,we=ne;ne=null;let Oe=null;for(se=0;we;){se++;let Ae=we,Re=0;for(let et=0;et<ce&&(Re++,Ae=Ae.nextZ,Ae);et++);let He=ce;for(;Re>0||He>0&&Ae;)Re!==0&&(He===0||!Ae||we.z<=Ae.z)?(ye=we,we=we.nextZ,Re--):(ye=Ae,Ae=Ae.nextZ,He--),Oe?Oe.nextZ=ye:ne=ye,ye.prevZ=Oe,Oe=ye;we=Ae}Oe.nextZ=null,ce*=2}while(se>1)}(ee)}(p,b,E,I);let R=p;for(;p.prev!==p.next;){const z=p.prev,G=p.next;if(I?gye(p,b,E,I):pye(p))h.push(z.i,p.i,G.i),am(p),p=G.next,R=G.next;else if((p=G)===R){k?k===1?nm(p=vye(Nh(p),h),h,v,b,E,I,2):k===2&&mye(p,h,v,b,E,I):nm(Nh(p),h,v,b,E,I,1);break}}}function pye(p){const h=p.prev,v=p,b=p.next;if(Rn(h,v,b)>=0)return!1;const E=h.x,I=v.x,k=b.x,R=h.y,z=v.y,G=b.y,W=E<I?E<k?E:k:I<k?I:k,j=R<z?R<G?R:G:z<G?z:G,ee=E>I?E>k?E:k:I>k?I:k,ne=R>z?R>G?R:G:z>G?z:G;let se=b.next;for(;se!==h;){if(se.x>=W&&se.x<=ee&&se.y>=j&&se.y<=ne&&Hf(E,R,I,z,k,G,se.x,se.y)&&Rn(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function gye(p,h,v,b){const E=p.prev,I=p,k=p.next;if(Rn(E,I,k)>=0)return!1;const R=E.x,z=I.x,G=k.x,W=E.y,j=I.y,ee=k.y,ne=R<z?R<G?R:G:z<G?z:G,se=W<j?W<ee?W:ee:j<ee?j:ee,ce=R>z?R>G?R:G:z>G?z:G,ye=W>j?W>ee?W:ee:j>ee?j:ee,we=WA(ne,se,h,v,b),Oe=WA(ce,ye,h,v,b);let Ae=p.prevZ,Re=p.nextZ;for(;Ae&&Ae.z>=we&&Re&&Re.z<=Oe;){if(Ae.x>=ne&&Ae.x<=ce&&Ae.y>=se&&Ae.y<=ye&&Ae!==E&&Ae!==k&&Hf(R,W,z,j,G,ee,Ae.x,Ae.y)&&Rn(Ae.prev,Ae,Ae.next)>=0||(Ae=Ae.prevZ,Re.x>=ne&&Re.x<=ce&&Re.y>=se&&Re.y<=ye&&Re!==E&&Re!==k&&Hf(R,W,z,j,G,ee,Re.x,Re.y)&&Rn(Re.prev,Re,Re.next)>=0))return!1;Re=Re.nextZ}for(;Ae&&Ae.z>=we;){if(Ae.x>=ne&&Ae.x<=ce&&Ae.y>=se&&Ae.y<=ye&&Ae!==E&&Ae!==k&&Hf(R,W,z,j,G,ee,Ae.x,Ae.y)&&Rn(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.prevZ}for(;Re&&Re.z<=Oe;){if(Re.x>=ne&&Re.x<=ce&&Re.y>=se&&Re.y<=ye&&Re!==E&&Re!==k&&Hf(R,W,z,j,G,ee,Re.x,Re.y)&&Rn(Re.prev,Re,Re.next)>=0)return!1;Re=Re.nextZ}return!0}function vye(p,h){let v=p;do{const b=v.prev,E=v.next.next;!Hb(b,E)&&u6(b,v,v.next,E)&&im(b,E)&&im(E,b)&&(h.push(b.i,v.i,E.i),am(v),am(v.next),v=p=E),v=v.next}while(v!==p);return Nh(v)}function mye(p,h,v,b,E,I){let k=p;do{let R=k.next.next;for(;R!==k.prev;){if(k.i!==R.i&&wye(k,R)){let z=h6(k,R);return k=Nh(k,k.next),z=Nh(z,z.next),nm(k,h,v,b,E,I,0),void nm(z,h,v,b,E,I,0)}R=R.next}k=k.next}while(k!==p)}function yye(p,h){return p.x-h.x}function _ye(p,h){const v=function(E,I){let k=I;const R=E.x,z=E.y;let G,W=-1/0;do{if(z<=k.y&&z>=k.next.y&&k.next.y!==k.y){const ce=k.x+(z-k.y)*(k.next.x-k.x)/(k.next.y-k.y);if(ce<=R&&ce>W&&(W=ce,G=k.x<k.next.x?k:k.next,ce===R))return G}k=k.next}while(k!==I);if(!G)return null;const j=G,ee=G.x,ne=G.y;let se=1/0;k=G;do{if(R>=k.x&&k.x>=ee&&R!==k.x&&Hf(z<ne?R:W,z,ee,ne,z<ne?W:R,z,k.x,k.y)){const ce=Math.abs(z-k.y)/(R-k.x);im(k,E)&&(ce<se||ce===se&&(k.x>G.x||k.x===G.x&&bye(G,k)))&&(G=k,se=ce)}k=k.next}while(k!==j);return G}(p,h);if(!v)return h;const b=h6(v,p);return Nh(b,b.next),Nh(v,v.next)}function bye(p,h){return Rn(p.prev,p,h.prev)<0&&Rn(h.next,p,p.next)<0}function WA(p,h,v,b,E){return(p=1431655765&((p=858993459&((p=252645135&((p=16711935&((p=(p-v)*E|0)|p<<8))|p<<4))|p<<2))|p<<1))|(h=1431655765&((h=858993459&((h=252645135&((h=16711935&((h=(h-b)*E|0)|h<<8))|h<<4))|h<<2))|h<<1))<<1}function xye(p){let h=p,v=p;do(h.x<v.x||h.x===v.x&&h.y<v.y)&&(v=h),h=h.next;while(h!==p);return v}function Hf(p,h,v,b,E,I,k,R){return(E-k)*(h-R)>=(p-k)*(I-R)&&(p-k)*(b-R)>=(v-k)*(h-R)&&(v-k)*(I-R)>=(E-k)*(b-R)}function wye(p,h){return p.next.i!==h.i&&p.prev.i!==h.i&&!function(v,b){let E=v;do{if(E.i!==v.i&&E.next.i!==v.i&&E.i!==b.i&&E.next.i!==b.i&&u6(E,E.next,v,b))return!0;E=E.next}while(E!==v);return!1}(p,h)&&(im(p,h)&&im(h,p)&&function(v,b){let E=v,I=!1;const k=(v.x+b.x)/2,R=(v.y+b.y)/2;do E.y>R!=E.next.y>R&&E.next.y!==E.y&&k<(E.next.x-E.x)*(R-E.y)/(E.next.y-E.y)+E.x&&(I=!I),E=E.next;while(E!==v);return I}(p,h)&&(Rn(p.prev,p,h.prev)||Rn(p,h.prev,h))||Hb(p,h)&&Rn(p.prev,p,p.next)>0&&Rn(h.prev,h,h.next)>0)}function Rn(p,h,v){return(h.y-p.y)*(v.x-h.x)-(h.x-p.x)*(v.y-h.y)}function Hb(p,h){return p.x===h.x&&p.y===h.y}function u6(p,h,v,b){const E=qb(Rn(p,h,v)),I=qb(Rn(p,h,b)),k=qb(Rn(v,b,p)),R=qb(Rn(v,b,h));return E!==I&&k!==R||!(E!==0||!Wb(p,v,h))||!(I!==0||!Wb(p,b,h))||!(k!==0||!Wb(v,p,b))||!(R!==0||!Wb(v,h,b))}function Wb(p,h,v){return h.x<=Math.max(p.x,v.x)&&h.x>=Math.min(p.x,v.x)&&h.y<=Math.max(p.y,v.y)&&h.y>=Math.min(p.y,v.y)}function qb(p){return p>0?1:p<0?-1:0}function im(p,h){return Rn(p.prev,p,p.next)<0?Rn(p,h,p.next)>=0&&Rn(p,p.prev,h)>=0:Rn(p,h,p.prev)<0||Rn(p,p.next,h)<0}function h6(p,h){const v=qA(p.i,p.x,p.y),b=qA(h.i,h.x,h.y),E=p.next,I=h.prev;return p.next=h,h.prev=p,v.next=E,E.prev=v,b.next=v,v.prev=b,I.next=b,b.prev=I,b}function d6(p,h,v,b){const E=qA(p,h,v);return b?(E.next=b.next,E.prev=b,b.next.prev=E,b.next=E):(E.prev=E,E.next=E),E}function am(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function qA(p,h,v){return{i:p,x:h,y:v,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ZA(p,h,v){const b=v.patternDependencies;let E=!1;for(const I of h){const k=I.paint.get(`${p}-pattern`);k.isConstant()||(E=!0);const R=k.constantOr(null);R&&(E=!0,b[R.to]=!0,b[R.from]=!0)}return E}function jA(p,h,v,b,E){const I=E.patternDependencies;for(const k of h){const R=k.paint.get(`${p}-pattern`).value;if(R.kind!=="constant"){let z=R.evaluate({zoom:b-1},v,{},E.availableImages),G=R.evaluate({zoom:b},v,{},E.availableImages),W=R.evaluate({zoom:b+1},v,{},E.availableImages);z=z&&z.name?z.name:z,G=G&&G.name?G.name:G,W=W&&W.name?W.name:W,I[z]=!0,I[G]=!0,I[W]=!0,v.patterns[k.id]={min:z,mid:G,max:W}}}return v}class XA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ko,this.indexArray=new Xa,this.indexArray2=new ci,this.programConfigurations=new Lh(h.layers,h.zoom),this.segments=new Pr,this.segments2=new Pr,this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){this.hasPattern=ZA("fill",this.layers,v);const E=this.layers[0].layout.get("fill-sort-key"),I=!E.isConstant(),k=[];for(const{feature:R,id:z,index:G,sourceLayerIndex:W}of h){const j=this.layers[0]._featureFilter.needGeometry,ee=Rh(R,j);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),ee,b))continue;const ne=I?E.evaluate(ee,{},b,v.availableImages):void 0,se={id:z,properties:R.properties,type:R.type,sourceLayerIndex:W,index:G,geometry:j?ee.geometry:Ph(R),patterns:{},sortKey:ne};k.push(se)}I&&k.sort((R,z)=>R.sortKey-z.sortKey);for(const R of k){const{geometry:z,index:G,sourceLayerIndex:W}=R;if(this.hasPattern){const j=jA("fill",this.layers,R,this.zoom,v);this.patternFeatures.push(j)}else this.addFeature(R,z,G,b,{});v.featureIndex.insert(h[G].feature,z,G,W,this.index)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}addFeatures(h,v,b){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,v,b)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,fye),this.indexBuffer=h.createIndexBuffer(this.indexArray),this.indexBuffer2=h.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(h),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(h,v,b,E,I){for(const k of pf(v,500)){let R=0;for(const ne of k)R+=ne.length;const z=this.segments.prepareSegment(R,this.layoutVertexArray,this.indexArray),G=z.vertexLength,W=[],j=[];for(const ne of k){if(ne.length===0)continue;ne!==k[0]&&j.push(W.length/2);const se=this.segments2.prepareSegment(ne.length,this.layoutVertexArray,this.indexArray2),ce=se.vertexLength;this.layoutVertexArray.emplaceBack(ne[0].x,ne[0].y),this.indexArray2.emplaceBack(ce+ne.length-1,ce),W.push(ne[0].x),W.push(ne[0].y);for(let ye=1;ye<ne.length;ye++)this.layoutVertexArray.emplaceBack(ne[ye].x,ne[ye].y),this.indexArray2.emplaceBack(ce+ye-1,ce+ye),W.push(ne[ye].x),W.push(ne[ye].y);se.vertexLength+=ne.length,se.primitiveLength+=ne.length}const ee=l6(W,j);for(let ne=0;ne<ee.length;ne+=3)this.indexArray.emplaceBack(G+ee[ne],G+ee[ne+1],G+ee[ne+2]);z.vertexLength+=R,z.primitiveLength+=ee.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,I,E)}}let f6,p6;Pt("FillBucket",XA,{omit:["layers","patternFeatures"]});var Sye={get paint(){return p6=p6||new D({"fill-antialias":new Ot(Le.paint_fill["fill-antialias"]),"fill-opacity":new Kt(Le.paint_fill["fill-opacity"]),"fill-color":new Kt(Le.paint_fill["fill-color"]),"fill-outline-color":new Kt(Le.paint_fill["fill-outline-color"]),"fill-translate":new Ot(Le.paint_fill["fill-translate"]),"fill-translate-anchor":new Ot(Le.paint_fill["fill-translate-anchor"]),"fill-pattern":new Rf(Le.paint_fill["fill-pattern"])})},get layout(){return f6=f6||new D({"fill-sort-key":new Kt(Le.layout_fill["fill-sort-key"])})}};class Tye extends y{constructor(h){super(h,Sye)}recalculate(h,v){super.recalculate(h,v);const b=this.paint._values["fill-outline-color"];b.value.kind==="constant"&&b.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(h){return new XA(h)}queryRadius(){return $b(this.paint.get("fill-translate"))}queryIntersectsFeature(h,v,b,E,I,k,R){return Y$(Gb(h,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),k.angle,R),E)}isTileClipped(){return!0}}const Eye=N([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Cye=N([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Aye}=Eye;var zc={},Dye=c,g6=Wf;function Wf(p,h,v,b,E){this.properties={},this.extent=v,this.type=0,this._pbf=p,this._geometry=-1,this._keys=b,this._values=E,p.readFields(Mye,this,h)}function Mye(p,h,v){p==1?h.id=v.readVarint():p==2?function(b,E){for(var I=b.readVarint()+b.pos;b.pos<I;){var k=E._keys[b.readVarint()],R=E._values[b.readVarint()];E.properties[k]=R}}(v,h):p==3?h.type=v.readVarint():p==4&&(h._geometry=v.pos)}function Iye(p){for(var h,v,b=0,E=0,I=p.length,k=I-1;E<I;k=E++)b+=((v=p[k]).x-(h=p[E]).x)*(h.y+v.y);return b}Wf.types=["Unknown","Point","LineString","Polygon"],Wf.prototype.loadGeometry=function(){var p=this._pbf;p.pos=this._geometry;for(var h,v=p.readVarint()+p.pos,b=1,E=0,I=0,k=0,R=[];p.pos<v;){if(E<=0){var z=p.readVarint();b=7&z,E=z>>3}if(E--,b===1||b===2)I+=p.readSVarint(),k+=p.readSVarint(),b===1&&(h&&R.push(h),h=[]),h.push(new Dye(I,k));else{if(b!==7)throw new Error("unknown command "+b);h&&h.push(h[0].clone())}}return h&&R.push(h),R},Wf.prototype.bbox=function(){var p=this._pbf;p.pos=this._geometry;for(var h=p.readVarint()+p.pos,v=1,b=0,E=0,I=0,k=1/0,R=-1/0,z=1/0,G=-1/0;p.pos<h;){if(b<=0){var W=p.readVarint();v=7&W,b=W>>3}if(b--,v===1||v===2)(E+=p.readSVarint())<k&&(k=E),E>R&&(R=E),(I+=p.readSVarint())<z&&(z=I),I>G&&(G=I);else if(v!==7)throw new Error("unknown command "+v)}return[k,z,R,G]},Wf.prototype.toGeoJSON=function(p,h,v){var b,E,I=this.extent*Math.pow(2,v),k=this.extent*p,R=this.extent*h,z=this.loadGeometry(),G=Wf.types[this.type];function W(ne){for(var se=0;se<ne.length;se++){var ce=ne[se];ne[se]=[360*(ce.x+k)/I-180,360/Math.PI*Math.atan(Math.exp((180-360*(ce.y+R)/I)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(b=0;b<z.length;b++)j[b]=z[b][0];W(z=j);break;case 2:for(b=0;b<z.length;b++)W(z[b]);break;case 3:for(z=function(ne){var se=ne.length;if(se<=1)return[ne];for(var ce,ye,we=[],Oe=0;Oe<se;Oe++){var Ae=Iye(ne[Oe]);Ae!==0&&(ye===void 0&&(ye=Ae<0),ye===Ae<0?(ce&&we.push(ce),ce=[ne[Oe]]):ce.push(ne[Oe]))}return ce&&we.push(ce),we}(z),b=0;b<z.length;b++)for(E=0;E<z[b].length;E++)W(z[b][E])}z.length===1?z=z[0]:G="Multi"+G;var ee={type:"Feature",geometry:{type:G,coordinates:z},properties:this.properties};return"id"in this&&(ee.id=this.id),ee};var kye=g6,v6=m6;function m6(p,h){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=p,this._keys=[],this._values=[],this._features=[],p.readFields(Lye,this,h),this.length=this._features.length}function Lye(p,h,v){p===15?h.version=v.readVarint():p===1?h.name=v.readString():p===5?h.extent=v.readVarint():p===2?h._features.push(v.pos):p===3?h._keys.push(v.readString()):p===4&&h._values.push(function(b){for(var E=null,I=b.readVarint()+b.pos;b.pos<I;){var k=b.readVarint()>>3;E=k===1?b.readString():k===2?b.readFloat():k===3?b.readDouble():k===4?b.readVarint64():k===5?b.readVarint():k===6?b.readSVarint():k===7?b.readBoolean():null}return E}(v))}m6.prototype.feature=function(p){if(p<0||p>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[p];var h=this._pbf.readVarint()+this._pbf.pos;return new kye(this._pbf,h,this.extent,this._keys,this._values)};var Pye=v6;function Rye(p,h,v){if(p===3){var b=new Pye(v,v.readVarint()+v.pos);b.length&&(h[b.name]=b)}}zc.VectorTile=function(p,h){this.layers=p.readFields(Rye,{},h)},zc.VectorTileFeature=g6,zc.VectorTileLayer=v6;const Nye=zc.VectorTileFeature.types,YA=Math.pow(2,13);function om(p,h,v,b,E,I,k,R){p.emplaceBack(h,v,2*Math.floor(b*YA)+k,E*YA*2,I*YA*2,Math.round(R))}class KA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.layoutVertexArray=new kc,this.centroidVertexArray=new mi,this.indexArray=new Xa,this.programConfigurations=new Lh(h.layers,h.zoom),this.segments=new Pr,this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){this.features=[],this.hasPattern=ZA("fill-extrusion",this.layers,v);for(const{feature:E,id:I,index:k,sourceLayerIndex:R}of h){const z=this.layers[0]._featureFilter.needGeometry,G=Rh(E,z);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),G,b))continue;const W={id:I,sourceLayerIndex:R,index:k,geometry:z?G.geometry:Ph(E),properties:E.properties,type:E.type,patterns:{}};this.hasPattern?this.features.push(jA("fill-extrusion",this.layers,W,this.zoom,v)):this.addFeature(W,W.geometry,k,b,{}),v.featureIndex.insert(E,W.geometry,k,R,this.index,!0)}}addFeatures(h,v,b){for(const E of this.features){const{geometry:I}=E;this.addFeature(E,I,E.index,v,b)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,Aye),this.centroidVertexBuffer=h.createVertexBuffer(this.centroidVertexArray,Cye.members,!0),this.indexBuffer=h.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(h),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(h,v,b,E,I){for(const k of pf(v,500)){const R={x:0,y:0,vertexCount:0};let z=0;for(const se of k)z+=se.length;let G=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const se of k){if(se.length===0||zye(se))continue;let ce=0;for(let ye=0;ye<se.length;ye++){const we=se[ye];if(ye>=1){const Oe=se[ye-1];if(!Oye(we,Oe)){G.vertexLength+4>Pr.MAX_VERTEX_ARRAY_LENGTH&&(G=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Ae=we.sub(Oe)._perp()._unit(),Re=Oe.dist(we);ce+Re>32768&&(ce=0),om(this.layoutVertexArray,we.x,we.y,Ae.x,Ae.y,0,0,ce),om(this.layoutVertexArray,we.x,we.y,Ae.x,Ae.y,0,1,ce),R.x+=2*we.x,R.y+=2*we.y,R.vertexCount+=2,ce+=Re,om(this.layoutVertexArray,Oe.x,Oe.y,Ae.x,Ae.y,0,0,ce),om(this.layoutVertexArray,Oe.x,Oe.y,Ae.x,Ae.y,0,1,ce),R.x+=2*Oe.x,R.y+=2*Oe.y,R.vertexCount+=2;const He=G.vertexLength;this.indexArray.emplaceBack(He,He+2,He+1),this.indexArray.emplaceBack(He+1,He+2,He+3),G.vertexLength+=4,G.primitiveLength+=2}}}}if(G.vertexLength+z>Pr.MAX_VERTEX_ARRAY_LENGTH&&(G=this.segments.prepareSegment(z,this.layoutVertexArray,this.indexArray)),Nye[h.type]!=="Polygon")continue;const W=[],j=[],ee=G.vertexLength;for(const se of k)if(se.length!==0){se!==k[0]&&j.push(W.length/2);for(let ce=0;ce<se.length;ce++){const ye=se[ce];om(this.layoutVertexArray,ye.x,ye.y,0,0,1,1,0),R.x+=ye.x,R.y+=ye.y,R.vertexCount+=1,W.push(ye.x),W.push(ye.y)}}const ne=l6(W,j);for(let se=0;se<ne.length;se+=3)this.indexArray.emplaceBack(ee+ne[se],ee+ne[se+2],ee+ne[se+1]);G.primitiveLength+=ne.length/3,G.vertexLength+=z;for(let se=0;se<R.vertexCount;se++){const ce=Math.floor(R.x/R.vertexCount),ye=Math.floor(R.y/R.vertexCount);this.centroidVertexArray.emplaceBack(ce,ye)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,I,E)}}function Oye(p,h){return p.x===h.x&&(p.x<0||p.x>Fn)||p.y===h.y&&(p.y<0||p.y>Fn)}function zye(p){return p.every(h=>h.x<0)||p.every(h=>h.x>Fn)||p.every(h=>h.y<0)||p.every(h=>h.y>Fn)}let y6;Pt("FillExtrusionBucket",KA,{omit:["layers","features"]});var Bye={get paint(){return y6=y6||new D({"fill-extrusion-opacity":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Kt(Le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Rf(Le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Kt(Le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Kt(Le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ot(Le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Vye extends y{constructor(h){super(h,Bye)}createBucket(h){return new KA(h)}queryRadius(){return $b(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(h,v,b,E,I,k,R,z){const G=Gb(h,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),k.angle,R),W=this.paint.get("fill-extrusion-height").evaluate(v,b),j=this.paint.get("fill-extrusion-base").evaluate(v,b),ee=function(se,ce,ye,we){const Oe=[];for(const Ae of se){const Re=[Ae.x,Ae.y,0,1];Ub(Re,Re,ce),Oe.push(new f(Re[0]/Re[3],Re[1]/Re[3]))}return Oe}(G,z),ne=function(se,ce,ye,we){const Oe=[],Ae=[],Re=we[8]*ce,He=we[9]*ce,et=we[10]*ce,Ct=we[11]*ce,Yt=we[8]*ye,xt=we[9]*ye,_t=we[10]*ye,Gt=we[11]*ye;for(const Rt of se){const It=[],Ye=[];for(const Ut of Rt){const Ft=Ut.x,nr=Ut.y,rn=we[0]*Ft+we[4]*nr+we[12],en=we[1]*Ft+we[5]*nr+we[13],Kn=we[2]*Ft+we[6]*nr+we[14],Lo=we[3]*Ft+we[7]*nr+we[15],bi=Kn+et,Jn=Lo+Ct,Wi=rn+Yt,qi=en+xt,Zi=Kn+_t,Mn=Lo+Gt,Qn=new f((rn+Re)/Jn,(en+He)/Jn);Qn.z=bi/Jn,It.push(Qn);const Pi=new f(Wi/Mn,qi/Mn);Pi.z=Zi/Mn,Ye.push(Pi)}Oe.push(It),Ae.push(Ye)}return[Oe,Ae]}(E,j,W,z);return function(se,ce,ye){let we=1/0;Y$(ye,ce)&&(we=_6(ye,ce[0]));for(let Oe=0;Oe<ce.length;Oe++){const Ae=ce[Oe],Re=se[Oe];for(let He=0;He<Ae.length-1;He++){const et=Ae[He],Ct=[et,Ae[He+1],Re[He+1],Re[He],et];X$(ye,Ct)&&(we=Math.min(we,_6(ye,Ct)))}}return we!==1/0&&we}(ne[0],ne[1],ee)}}function sm(p,h){return p.x*h.x+p.y*h.y}function _6(p,h){if(p.length===1){let v=0;const b=h[v++];let E;for(;!E||b.equals(E);)if(E=h[v++],!E)return 1/0;for(;v<h.length;v++){const I=h[v],k=p[0],R=E.sub(b),z=I.sub(b),G=k.sub(b),W=sm(R,R),j=sm(R,z),ee=sm(z,z),ne=sm(G,R),se=sm(G,z),ce=W*ee-j*j,ye=(ee*ne-j*se)/ce,we=(W*se-j*ne)/ce,Oe=b.z*(1-ye-we)+E.z*ye+I.z*we;if(isFinite(Oe))return Oe}return 1/0}{let v=1/0;for(const b of h)v=Math.min(v,b.z);return v}}const Fye=N([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:$ye}=Fye,Gye=N([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Uye}=Gye,Hye=zc.VectorTileFeature.types,Wye=Math.cos(Math.PI/180*37.5),b6=Math.pow(2,14)/.5;class JA{constructor(h){this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(v=>v.id),this.index=h.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(v=>{this.gradients[v.id]={}}),this.layoutVertexArray=new Of,this.layoutVertexArray2=new Lc,this.indexArray=new Xa,this.programConfigurations=new Lh(h.layers,h.zoom),this.segments=new Pr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id)}populate(h,v,b){this.hasPattern=ZA("line",this.layers,v);const E=this.layers[0].layout.get("line-sort-key"),I=!E.isConstant(),k=[];for(const{feature:R,id:z,index:G,sourceLayerIndex:W}of h){const j=this.layers[0]._featureFilter.needGeometry,ee=Rh(R,j);if(!this.layers[0]._featureFilter.filter(new dn(this.zoom),ee,b))continue;const ne=I?E.evaluate(ee,{},b):void 0,se={id:z,properties:R.properties,type:R.type,sourceLayerIndex:W,index:G,geometry:j?ee.geometry:Ph(R),patterns:{},sortKey:ne};k.push(se)}I&&k.sort((R,z)=>R.sortKey-z.sortKey);for(const R of k){const{geometry:z,index:G,sourceLayerIndex:W}=R;if(this.hasPattern){const j=jA("line",this.layers,R,this.zoom,v);this.patternFeatures.push(j)}else this.addFeature(R,z,G,b,{});v.featureIndex.insert(h[G].feature,z,G,W,this.index)}}update(h,v,b){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(h,v,this.stateDependentLayers,b)}addFeatures(h,v,b){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,v,b)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(h){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=h.createVertexBuffer(this.layoutVertexArray2,Uye)),this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,$ye),this.indexBuffer=h.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(h),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(h){if(h.properties&&Object.prototype.hasOwnProperty.call(h.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(h.properties,"mapbox_clip_end"))return{start:+h.properties.mapbox_clip_start,end:+h.properties.mapbox_clip_end}}addFeature(h,v,b,E,I){const k=this.layers[0].layout,R=k.get("line-join").evaluate(h,{}),z=k.get("line-cap"),G=k.get("line-miter-limit"),W=k.get("line-round-limit");this.lineClips=this.lineFeatureClips(h);for(const j of v)this.addLine(j,h,R,z,G,W);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,h,b,I,E)}addLine(h,v,b,E,I,k){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let we=0;we<h.length-1;we++)this.totalDistance+=h[we].dist(h[we+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const R=Hye[v.type]==="Polygon";let z=h.length;for(;z>=2&&h[z-1].equals(h[z-2]);)z--;let G=0;for(;G<z-1&&h[G].equals(h[G+1]);)G++;if(z<(R?3:2))return;b==="bevel"&&(I=1.05);const W=this.overscaling<=16?15*Fn/(512*this.overscaling):0,j=this.segments.prepareSegment(10*z,this.layoutVertexArray,this.indexArray);let ee,ne,se,ce,ye;this.e1=this.e2=-1,R&&(ee=h[z-2],ye=h[G].sub(ee)._unit()._perp());for(let we=G;we<z;we++){if(se=we===z-1?R?h[G+1]:void 0:h[we+1],se&&h[we].equals(se))continue;ye&&(ce=ye),ee&&(ne=ee),ee=h[we],ye=se?se.sub(ee)._unit()._perp():ce,ce=ce||ye;let Oe=ce.add(ye);Oe.x===0&&Oe.y===0||Oe._unit();const Ae=ce.x*ye.x+ce.y*ye.y,Re=Oe.x*ye.x+Oe.y*ye.y,He=Re!==0?1/Re:1/0,et=2*Math.sqrt(2-2*Re),Ct=Re<Wye&&ne&&se,Yt=ce.x*ye.y-ce.y*ye.x>0;if(Ct&&we>G){const Gt=ee.dist(ne);if(Gt>2*W){const Rt=ee.sub(ee.sub(ne)._mult(W/Gt)._round());this.updateDistance(ne,Rt),this.addCurrentVertex(Rt,ce,0,0,j),ne=Rt}}const xt=ne&&se;let _t=xt?b:R?"butt":E;if(xt&&_t==="round"&&(He<k?_t="miter":He<=2&&(_t="fakeround")),_t==="miter"&&He>I&&(_t="bevel"),_t==="bevel"&&(He>2&&(_t="flipbevel"),He<I&&(_t="miter")),ne&&this.updateDistance(ne,ee),_t==="miter")Oe._mult(He),this.addCurrentVertex(ee,Oe,0,0,j);else if(_t==="flipbevel"){if(He>100)Oe=ye.mult(-1);else{const Gt=He*ce.add(ye).mag()/ce.sub(ye).mag();Oe._perp()._mult(Gt*(Yt?-1:1))}this.addCurrentVertex(ee,Oe,0,0,j),this.addCurrentVertex(ee,Oe.mult(-1),0,0,j)}else if(_t==="bevel"||_t==="fakeround"){const Gt=-Math.sqrt(He*He-1),Rt=Yt?Gt:0,It=Yt?0:Gt;if(ne&&this.addCurrentVertex(ee,ce,Rt,It,j),_t==="fakeround"){const Ye=Math.round(180*et/Math.PI/20);for(let Ut=1;Ut<Ye;Ut++){let Ft=Ut/Ye;if(Ft!==.5){const rn=Ft-.5;Ft+=Ft*rn*(Ft-1)*((1.0904+Ae*(Ae*(3.55645-1.43519*Ae)-3.2452))*rn*rn+(.848013+Ae*(.215638*Ae-1.06021)))}const nr=ye.sub(ce)._mult(Ft)._add(ce)._unit()._mult(Yt?-1:1);this.addHalfVertex(ee,nr.x,nr.y,!1,Yt,0,j)}}se&&this.addCurrentVertex(ee,ye,-Rt,-It,j)}else if(_t==="butt")this.addCurrentVertex(ee,Oe,0,0,j);else if(_t==="square"){const Gt=ne?1:-1;this.addCurrentVertex(ee,Oe,Gt,Gt,j)}else _t==="round"&&(ne&&(this.addCurrentVertex(ee,ce,0,0,j),this.addCurrentVertex(ee,ce,1,1,j,!0)),se&&(this.addCurrentVertex(ee,ye,-1,-1,j,!0),this.addCurrentVertex(ee,ye,0,0,j)));if(Ct&&we<z-1){const Gt=ee.dist(se);if(Gt>2*W){const Rt=ee.add(se.sub(ee)._mult(W/Gt)._round());this.updateDistance(ee,Rt),this.addCurrentVertex(Rt,ye,0,0,j),ee=Rt}}}}addCurrentVertex(h,v,b,E,I,k=!1){const R=v.y*E-v.x,z=-v.y-v.x*E;this.addHalfVertex(h,v.x+v.y*b,v.y-v.x*b,k,!1,b,I),this.addHalfVertex(h,R,z,k,!0,-E,I),this.distance>b6/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(h,v,b,E,I,k))}addHalfVertex({x:h,y:v},b,E,I,k,R,z){const G=.5*(this.lineClips?this.scaledDistance*(b6-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((h<<1)+(I?1:0),(v<<1)+(k?1:0),Math.round(63*b)+128,Math.round(63*E)+128,1+(R===0?0:R<0?-1:1)|(63&G)<<2,G>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const W=z.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,W),z.primitiveLength++),k?this.e2=W:this.e1=W}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(h,v){this.distance+=h.dist(v),this.updateScaledDistance()}}let x6,w6;Pt("LineBucket",JA,{omit:["layers","patternFeatures"]});var S6={get paint(){return w6=w6||new D({"line-opacity":new Kt(Le.paint_line["line-opacity"]),"line-color":new Kt(Le.paint_line["line-color"]),"line-translate":new Ot(Le.paint_line["line-translate"]),"line-translate-anchor":new Ot(Le.paint_line["line-translate-anchor"]),"line-width":new Kt(Le.paint_line["line-width"]),"line-gap-width":new Kt(Le.paint_line["line-gap-width"]),"line-offset":new Kt(Le.paint_line["line-offset"]),"line-blur":new Kt(Le.paint_line["line-blur"]),"line-dasharray":new Nf(Le.paint_line["line-dasharray"]),"line-pattern":new Rf(Le.paint_line["line-pattern"]),"line-gradient":new Kv(Le.paint_line["line-gradient"])})},get layout(){return x6=x6||new D({"line-cap":new Ot(Le.layout_line["line-cap"]),"line-join":new Kt(Le.layout_line["line-join"]),"line-miter-limit":new Ot(Le.layout_line["line-miter-limit"]),"line-round-limit":new Ot(Le.layout_line["line-round-limit"]),"line-sort-key":new Kt(Le.layout_line["line-sort-key"])})}};class qye extends Kt{possiblyEvaluate(h,v){return v=new dn(Math.floor(v.zoom),{now:v.now,fadeDuration:v.fadeDuration,zoomHistory:v.zoomHistory,transition:v.transition}),super.possiblyEvaluate(h,v)}evaluate(h,v,b,E){return v=U({},v,{zoom:Math.floor(v.zoom)}),super.evaluate(h,v,b,E)}}let Zb;class Zye extends y{constructor(h){super(h,S6),this.gradientVersion=0,Zb||(Zb=new qye(S6.paint.properties["line-width"].specification),Zb.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(h){if(h==="line-gradient"){const v=this.gradientExpression();this.stepInterpolant=!!function(b){return b._styleExpression!==void 0}(v)&&v._styleExpression.expression instanceof dc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(h,v){super.recalculate(h,v),this.paint._values["line-floorwidth"]=Zb.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,h)}createBucket(h){return new JA(h)}queryRadius(h){const v=h,b=T6(em("line-width",this,v),em("line-gap-width",this,v)),E=em("line-offset",this,v);return b/2+Math.abs(E)+$b(this.paint.get("line-translate"))}queryIntersectsFeature(h,v,b,E,I,k,R){const z=Gb(h,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,R),G=R/2*T6(this.paint.get("line-width").evaluate(v,b),this.paint.get("line-gap-width").evaluate(v,b)),W=this.paint.get("line-offset").evaluate(v,b);return W&&(E=function(j,ee){const ne=[];for(let se=0;se<j.length;se++){const ce=j[se],ye=[];for(let we=0;we<ce.length;we++){const Oe=ce[we-1],Ae=ce[we],Re=ce[we+1],He=we===0?new f(0,0):Ae.sub(Oe)._unit()._perp(),et=we===ce.length-1?new f(0,0):Re.sub(Ae)._unit()._perp(),Ct=He._add(et)._unit(),Yt=Ct.x*et.x+Ct.y*et.y;Yt!==0&&Ct._mult(1/Yt),ye.push(Ct._mult(ee)._add(Ae))}ne.push(ye)}return ne}(E,W*R)),function(j,ee,ne){for(let se=0;se<ee.length;se++){const ce=ee[se];if(j.length>=3){for(let ye=0;ye<ce.length;ye++)if(Gf(j,ce[ye]))return!0}if(rye(j,ce,ne))return!0}return!1}(z,E,G)}isTileClipped(){return!0}}function T6(p,h){return h>0?h+2*p:p}const jye=N([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xye=N([{name:"a_projected_pos",components:3,type:"Float32"}],4);N([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Yye=N([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);N([{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 E6=N([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Kye=N([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Jye(p,h,v){return p.sections.forEach(b=>{b.text=function(E,I,k){const R=I.layout.get("text-transform").evaluate(k,{});return R==="uppercase"?E=E.toLocaleUpperCase():R==="lowercase"&&(E=E.toLocaleLowerCase()),fa.applyArabicShaping&&(E=fa.applyArabicShaping(E)),E}(b.text,h,v)}),p}N([{name:"triangle",components:3,type:"Uint16"}]),N([{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"}]),N([{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"}]),N([{type:"Float32",name:"offsetX"}]),N([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),N([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const lm={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Zn=24,C6=Qr,A6=function(p,h,v,b,E){var I,k,R=8*E-b-1,z=(1<<R)-1,G=z>>1,W=-7,j=E-1,ee=-1,ne=p[h+j];for(j+=ee,I=ne&(1<<-W)-1,ne>>=-W,W+=R;W>0;I=256*I+p[h+j],j+=ee,W-=8);for(k=I&(1<<-W)-1,I>>=-W,W+=b;W>0;k=256*k+p[h+j],j+=ee,W-=8);if(I===0)I=1-G;else{if(I===z)return k?NaN:1/0*(ne?-1:1);k+=Math.pow(2,b),I-=G}return(ne?-1:1)*k*Math.pow(2,I-b)},D6=function(p,h,v,b,E,I){var k,R,z,G=8*I-E-1,W=(1<<G)-1,j=W>>1,ee=E===23?Math.pow(2,-24)-Math.pow(2,-77):0,ne=0,se=1,ce=h<0||h===0&&1/h<0?1:0;for(h=Math.abs(h),isNaN(h)||h===1/0?(R=isNaN(h)?1:0,k=W):(k=Math.floor(Math.log(h)/Math.LN2),h*(z=Math.pow(2,-k))<1&&(k--,z*=2),(h+=k+j>=1?ee/z:ee*Math.pow(2,1-j))*z>=2&&(k++,z/=2),k+j>=W?(R=0,k=W):k+j>=1?(R=(h*z-1)*Math.pow(2,E),k+=j):(R=h*Math.pow(2,j-1)*Math.pow(2,E),k=0));E>=8;p[v+ne]=255&R,ne+=se,R/=256,E-=8);for(k=k<<E|R,G+=E;G>0;p[v+ne]=255&k,ne+=se,k/=256,G-=8);p[v+ne-se]|=128*ce};function Qr(p){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(p)?p:new Uint8Array(p||0),this.pos=0,this.type=0,this.length=this.buf.length}Qr.Varint=0,Qr.Fixed64=1,Qr.Bytes=2,Qr.Fixed32=5;var QA=4294967296,M6=1/QA,I6=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function bl(p){return p.type===Qr.Bytes?p.readVarint()+p.pos:p.pos+1}function qf(p,h,v){return v?4294967296*h+(p>>>0):4294967296*(h>>>0)+(p>>>0)}function k6(p,h,v){var b=h<=16383?1:h<=2097151?2:h<=268435455?3:Math.floor(Math.log(h)/(7*Math.LN2));v.realloc(b);for(var E=v.pos-1;E>=p;E--)v.buf[E+b]=v.buf[E]}function Qye(p,h){for(var v=0;v<p.length;v++)h.writeVarint(p[v])}function e_e(p,h){for(var v=0;v<p.length;v++)h.writeSVarint(p[v])}function t_e(p,h){for(var v=0;v<p.length;v++)h.writeFloat(p[v])}function r_e(p,h){for(var v=0;v<p.length;v++)h.writeDouble(p[v])}function n_e(p,h){for(var v=0;v<p.length;v++)h.writeBoolean(p[v])}function i_e(p,h){for(var v=0;v<p.length;v++)h.writeFixed32(p[v])}function a_e(p,h){for(var v=0;v<p.length;v++)h.writeSFixed32(p[v])}function o_e(p,h){for(var v=0;v<p.length;v++)h.writeFixed64(p[v])}function s_e(p,h){for(var v=0;v<p.length;v++)h.writeSFixed64(p[v])}function jb(p,h){return(p[h]|p[h+1]<<8|p[h+2]<<16)+16777216*p[h+3]}function Zf(p,h,v){p[v]=h,p[v+1]=h>>>8,p[v+2]=h>>>16,p[v+3]=h>>>24}function L6(p,h){return(p[h]|p[h+1]<<8|p[h+2]<<16)+(p[h+3]<<24)}Qr.prototype={destroy:function(){this.buf=null},readFields:function(p,h,v){for(v=v||this.length;this.pos<v;){var b=this.readVarint(),E=b>>3,I=this.pos;this.type=7&b,p(E,h,this),this.pos===I&&this.skip(b)}return h},readMessage:function(p,h){return this.readFields(p,h,this.readVarint()+this.pos)},readFixed32:function(){var p=jb(this.buf,this.pos);return this.pos+=4,p},readSFixed32:function(){var p=L6(this.buf,this.pos);return this.pos+=4,p},readFixed64:function(){var p=jb(this.buf,this.pos)+jb(this.buf,this.pos+4)*QA;return this.pos+=8,p},readSFixed64:function(){var p=jb(this.buf,this.pos)+L6(this.buf,this.pos+4)*QA;return this.pos+=8,p},readFloat:function(){var p=A6(this.buf,this.pos,!0,23,4);return this.pos+=4,p},readDouble:function(){var p=A6(this.buf,this.pos,!0,52,8);return this.pos+=8,p},readVarint:function(p){var h,v,b=this.buf;return h=127&(v=b[this.pos++]),v<128?h:(h|=(127&(v=b[this.pos++]))<<7,v<128?h:(h|=(127&(v=b[this.pos++]))<<14,v<128?h:(h|=(127&(v=b[this.pos++]))<<21,v<128?h:function(E,I,k){var R,z,G=k.buf;if(R=(112&(z=G[k.pos++]))>>4,z<128||(R|=(127&(z=G[k.pos++]))<<3,z<128)||(R|=(127&(z=G[k.pos++]))<<10,z<128)||(R|=(127&(z=G[k.pos++]))<<17,z<128)||(R|=(127&(z=G[k.pos++]))<<24,z<128)||(R|=(1&(z=G[k.pos++]))<<31,z<128))return qf(E,R,I);throw new Error("Expected varint not more than 10 bytes")}(h|=(15&(v=b[this.pos]))<<28,p,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var p=this.readVarint();return p%2==1?(p+1)/-2:p/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var p=this.readVarint()+this.pos,h=this.pos;return this.pos=p,p-h>=12&&I6?function(v,b,E){return I6.decode(v.subarray(b,E))}(this.buf,h,p):function(v,b,E){for(var I="",k=b;k<E;){var R,z,G,W=v[k],j=null,ee=W>239?4:W>223?3:W>191?2:1;if(k+ee>E)break;ee===1?W<128&&(j=W):ee===2?(192&(R=v[k+1]))==128&&(j=(31&W)<<6|63&R)<=127&&(j=null):ee===3?(z=v[k+2],(192&(R=v[k+1]))==128&&(192&z)==128&&((j=(15&W)<<12|(63&R)<<6|63&z)<=2047||j>=55296&&j<=57343)&&(j=null)):ee===4&&(z=v[k+2],G=v[k+3],(192&(R=v[k+1]))==128&&(192&z)==128&&(192&G)==128&&((j=(15&W)<<18|(63&R)<<12|(63&z)<<6|63&G)<=65535||j>=1114112)&&(j=null)),j===null?(j=65533,ee=1):j>65535&&(j-=65536,I+=String.fromCharCode(j>>>10&1023|55296),j=56320|1023&j),I+=String.fromCharCode(j),k+=ee}return I}(this.buf,h,p)},readBytes:function(){var p=this.readVarint()+this.pos,h=this.buf.subarray(this.pos,p);return this.pos=p,h},readPackedVarint:function(p,h){if(this.type!==Qr.Bytes)return p.push(this.readVarint(h));var v=bl(this);for(p=p||[];this.pos<v;)p.push(this.readVarint(h));return p},readPackedSVarint:function(p){if(this.type!==Qr.Bytes)return p.push(this.readSVarint());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readSVarint());return p},readPackedBoolean:function(p){if(this.type!==Qr.Bytes)return p.push(this.readBoolean());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readBoolean());return p},readPackedFloat:function(p){if(this.type!==Qr.Bytes)return p.push(this.readFloat());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readFloat());return p},readPackedDouble:function(p){if(this.type!==Qr.Bytes)return p.push(this.readDouble());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readDouble());return p},readPackedFixed32:function(p){if(this.type!==Qr.Bytes)return p.push(this.readFixed32());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readFixed32());return p},readPackedSFixed32:function(p){if(this.type!==Qr.Bytes)return p.push(this.readSFixed32());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readSFixed32());return p},readPackedFixed64:function(p){if(this.type!==Qr.Bytes)return p.push(this.readFixed64());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readFixed64());return p},readPackedSFixed64:function(p){if(this.type!==Qr.Bytes)return p.push(this.readSFixed64());var h=bl(this);for(p=p||[];this.pos<h;)p.push(this.readSFixed64());return p},skip:function(p){var h=7&p;if(h===Qr.Varint)for(;this.buf[this.pos++]>127;);else if(h===Qr.Bytes)this.pos=this.readVarint()+this.pos;else if(h===Qr.Fixed32)this.pos+=4;else{if(h!==Qr.Fixed64)throw new Error("Unimplemented type: "+h);this.pos+=8}},writeTag:function(p,h){this.writeVarint(p<<3|h)},realloc:function(p){for(var h=this.length||16;h<this.pos+p;)h*=2;if(h!==this.length){var v=new Uint8Array(h);v.set(this.buf),this.buf=v,this.length=h}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(p){this.realloc(4),Zf(this.buf,p,this.pos),this.pos+=4},writeSFixed32:function(p){this.realloc(4),Zf(this.buf,p,this.pos),this.pos+=4},writeFixed64:function(p){this.realloc(8),Zf(this.buf,-1&p,this.pos),Zf(this.buf,Math.floor(p*M6),this.pos+4),this.pos+=8},writeSFixed64:function(p){this.realloc(8),Zf(this.buf,-1&p,this.pos),Zf(this.buf,Math.floor(p*M6),this.pos+4),this.pos+=8},writeVarint:function(p){(p=+p||0)>268435455||p<0?function(h,v){var b,E;if(h>=0?(b=h%4294967296|0,E=h/4294967296|0):(E=~(-h/4294967296),4294967295^(b=~(-h%4294967296))?b=b+1|0:(b=0,E=E+1|0)),h>=18446744073709552e3||h<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");v.realloc(10),function(I,k,R){R.buf[R.pos++]=127&I|128,I>>>=7,R.buf[R.pos++]=127&I|128,I>>>=7,R.buf[R.pos++]=127&I|128,I>>>=7,R.buf[R.pos++]=127&I|128,R.buf[R.pos]=127&(I>>>=7)}(b,0,v),function(I,k){var R=(7&I)<<4;k.buf[k.pos++]|=R|((I>>>=3)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I|((I>>>=7)?128:0),I&&(k.buf[k.pos++]=127&I)))))}(E,v)}(p,this):(this.realloc(4),this.buf[this.pos++]=127&p|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=p>>>7&127))))},writeSVarint:function(p){this.writeVarint(p<0?2*-p-1:2*p)},writeBoolean:function(p){this.writeVarint(!!p)},writeString:function(p){p=String(p),this.realloc(4*p.length),this.pos++;var h=this.pos;this.pos=function(b,E,I){for(var k,R,z=0;z<E.length;z++){if((k=E.charCodeAt(z))>55295&&k<57344){if(!R){k>56319||z+1===E.length?(b[I++]=239,b[I++]=191,b[I++]=189):R=k;continue}if(k<56320){b[I++]=239,b[I++]=191,b[I++]=189,R=k;continue}k=R-55296<<10|k-56320|65536,R=null}else R&&(b[I++]=239,b[I++]=191,b[I++]=189,R=null);k<128?b[I++]=k:(k<2048?b[I++]=k>>6|192:(k<65536?b[I++]=k>>12|224:(b[I++]=k>>18|240,b[I++]=k>>12&63|128),b[I++]=k>>6&63|128),b[I++]=63&k|128)}return I}(this.buf,p,this.pos);var v=this.pos-h;v>=128&&k6(h,v,this),this.pos=h-1,this.writeVarint(v),this.pos+=v},writeFloat:function(p){this.realloc(4),D6(this.buf,p,this.pos,!0,23,4),this.pos+=4},writeDouble:function(p){this.realloc(8),D6(this.buf,p,this.pos,!0,52,8),this.pos+=8},writeBytes:function(p){var h=p.length;this.writeVarint(h),this.realloc(h);for(var v=0;v<h;v++)this.buf[this.pos++]=p[v]},writeRawMessage:function(p,h){this.pos++;var v=this.pos;p(h,this);var b=this.pos-v;b>=128&&k6(v,b,this),this.pos=v-1,this.writeVarint(b),this.pos+=b},writeMessage:function(p,h,v){this.writeTag(p,Qr.Bytes),this.writeRawMessage(h,v)},writePackedVarint:function(p,h){h.length&&this.writeMessage(p,Qye,h)},writePackedSVarint:function(p,h){h.length&&this.writeMessage(p,e_e,h)},writePackedBoolean:function(p,h){h.length&&this.writeMessage(p,n_e,h)},writePackedFloat:function(p,h){h.length&&this.writeMessage(p,t_e,h)},writePackedDouble:function(p,h){h.length&&this.writeMessage(p,r_e,h)},writePackedFixed32:function(p,h){h.length&&this.writeMessage(p,i_e,h)},writePackedSFixed32:function(p,h){h.length&&this.writeMessage(p,a_e,h)},writePackedFixed64:function(p,h){h.length&&this.writeMessage(p,o_e,h)},writePackedSFixed64:function(p,h){h.length&&this.writeMessage(p,s_e,h)},writeBytesField:function(p,h){this.writeTag(p,Qr.Bytes),this.writeBytes(h)},writeFixed32Field:function(p,h){this.writeTag(p,Qr.Fixed32),this.writeFixed32(h)},writeSFixed32Field:function(p,h){this.writeTag(p,Qr.Fixed32),this.writeSFixed32(h)},writeFixed64Field:function(p,h){this.writeTag(p,Qr.Fixed64),this.writeFixed64(h)},writeSFixed64Field:function(p,h){this.writeTag(p,Qr.Fixed64),this.writeSFixed64(h)},writeVarintField:function(p,h){this.writeTag(p,Qr.Varint),this.writeVarint(h)},writeSVarintField:function(p,h){this.writeTag(p,Qr.Varint),this.writeSVarint(h)},writeStringField:function(p,h){this.writeTag(p,Qr.Bytes),this.writeString(h)},writeFloatField:function(p,h){this.writeTag(p,Qr.Fixed32),this.writeFloat(h)},writeDoubleField:function(p,h){this.writeTag(p,Qr.Fixed64),this.writeDouble(h)},writeBooleanField:function(p,h){this.writeVarintField(p,!!h)}};var eD=l(C6);const tD=3;function l_e(p,h,v){p===1&&v.readMessage(c_e,h)}function c_e(p,h,v){if(p===3){const{id:b,bitmap:E,width:I,height:k,left:R,top:z,advance:G}=v.readMessage(u_e,{});h.push({id:b,bitmap:new rm({width:I+2*tD,height:k+2*tD},E),metrics:{width:I,height:k,left:R,top:z,advance:G}})}}function u_e(p,h,v){p===1?h.id=v.readVarint():p===2?h.bitmap=v.readBytes():p===3?h.width=v.readVarint():p===4?h.height=v.readVarint():p===5?h.left=v.readSVarint():p===6?h.top=v.readSVarint():p===7&&(h.advance=v.readVarint())}const P6=tD;function R6(p){let h=0,v=0;for(const k of p)h+=k.w*k.h,v=Math.max(v,k.w);p.sort((k,R)=>R.h-k.h);const b=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(h/.95)),v),h:1/0}];let E=0,I=0;for(const k of p)for(let R=b.length-1;R>=0;R--){const z=b[R];if(!(k.w>z.w||k.h>z.h)){if(k.x=z.x,k.y=z.y,I=Math.max(I,k.y+k.h),E=Math.max(E,k.x+k.w),k.w===z.w&&k.h===z.h){const G=b.pop();R<b.length&&(b[R]=G)}else k.h===z.h?(z.x+=k.w,z.w-=k.w):k.w===z.w?(z.y+=k.h,z.h-=k.h):(b.push({x:z.x+k.w,y:z.y,w:z.w-k.w,h:k.h}),z.y+=k.h,z.h-=k.h);break}}return{w:E,h:I,fill:h/(E*I)||0}}const ga=1;class rD{constructor(h,{pixelRatio:v,version:b,stretchX:E,stretchY:I,content:k,textFitWidth:R,textFitHeight:z}){this.paddedRect=h,this.pixelRatio=v,this.stretchX=E,this.stretchY=I,this.content=k,this.version=b,this.textFitWidth=R,this.textFitHeight=z}get tl(){return[this.paddedRect.x+ga,this.paddedRect.y+ga]}get br(){return[this.paddedRect.x+this.paddedRect.w-ga,this.paddedRect.y+this.paddedRect.h-ga]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*ga)/this.pixelRatio,(this.paddedRect.h-2*ga)/this.pixelRatio]}}class N6{constructor(h,v){const b={},E={};this.haveRenderCallbacks=[];const I=[];this.addImages(h,b,I),this.addImages(v,E,I);const{w:k,h:R}=R6(I),z=new Ya({width:k||1,height:R||1});for(const G in h){const W=h[G],j=b[G].paddedRect;Ya.copy(W.data,z,{x:0,y:0},{x:j.x+ga,y:j.y+ga},W.data)}for(const G in v){const W=v[G],j=E[G].paddedRect,ee=j.x+ga,ne=j.y+ga,se=W.data.width,ce=W.data.height;Ya.copy(W.data,z,{x:0,y:0},{x:ee,y:ne},W.data),Ya.copy(W.data,z,{x:0,y:ce-1},{x:ee,y:ne-1},{width:se,height:1}),Ya.copy(W.data,z,{x:0,y:0},{x:ee,y:ne+ce},{width:se,height:1}),Ya.copy(W.data,z,{x:se-1,y:0},{x:ee-1,y:ne},{width:1,height:ce}),Ya.copy(W.data,z,{x:0,y:0},{x:ee+se,y:ne},{width:1,height:ce})}this.image=z,this.iconPositions=b,this.patternPositions=E}addImages(h,v,b){for(const E in h){const I=h[E],k={x:0,y:0,w:I.data.width+2*ga,h:I.data.height+2*ga};b.push(k),v[E]=new rD(k,I),I.hasRenderCallback&&this.haveRenderCallbacks.push(E)}}patchUpdatedImages(h,v){h.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const b in h.updatedImages)this.patchUpdatedImage(this.iconPositions[b],h.getImage(b),v),this.patchUpdatedImage(this.patternPositions[b],h.getImage(b),v)}patchUpdatedImage(h,v,b){if(!h||!v||h.version===v.version)return;h.version=v.version;const[E,I]=h.tl;b.update(v.data,void 0,{x:E,y:I})}}var Bc;Pt("ImagePosition",rD),Pt("ImageAtlas",N6),o.ah=void 0,(Bc=o.ah||(o.ah={}))[Bc.none=0]="none",Bc[Bc.horizontal=1]="horizontal",Bc[Bc.vertical=2]="vertical",Bc[Bc.horizontalOnly=3]="horizontalOnly";const cm=-17;class um{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(h,v){const b=new um;return b.scale=h||1,b.fontStack=v,b}static forImage(h){const v=new um;return v.imageName=h,v}}class jf{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(h,v){const b=new jf;for(let E=0;E<h.sections.length;E++){const I=h.sections[E];I.image?b.addImageSection(I):b.addTextSection(I,v)}return b}length(){return this.text.length}getSection(h){return this.sections[this.sectionIndex[h]]}getSectionIndex(h){return this.sectionIndex[h]}getCharCode(h){return this.text.charCodeAt(h)}verticalizePunctuation(){this.text=function(h){let v="";for(let b=0;b<h.length;b++){const E=h.charCodeAt(b+1)||null,I=h.charCodeAt(b-1)||null;v+=E&&Rb(E)&&!lm[h[b+1]]||I&&Rb(I)&&!lm[h[b-1]]||!lm[h[b]]?h[b]:lm[h[b]]}return v}(this.text)}trim(){let h=0;for(let b=0;b<this.text.length&&Yb[this.text.charCodeAt(b)];b++)h++;let v=this.text.length;for(let b=this.text.length-1;b>=0&&b>=h&&Yb[this.text.charCodeAt(b)];b--)v--;this.text=this.text.substring(h,v),this.sectionIndex=this.sectionIndex.slice(h,v)}substring(h,v){const b=new jf;return b.text=this.text.substring(h,v),b.sectionIndex=this.sectionIndex.slice(h,v),b.sections=this.sections,b}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((h,v)=>Math.max(h,this.sections[v].scale),0)}addTextSection(h,v){this.text+=h.text,this.sections.push(um.forText(h.scale,h.fontStack||v));const b=this.sections.length-1;for(let E=0;E<h.text.length;++E)this.sectionIndex.push(b)}addImageSection(h){const v=h.image?h.image.name:"";if(v.length===0)return void oe("Can't add FormattedSection with an empty image.");const b=this.getNextImageSectionCharCode();b?(this.text+=String.fromCharCode(b),this.sections.push(um.forImage(v)),this.sectionIndex.push(this.sections.length-1)):oe("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Xb(p,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se){const ce=jf.fromFeature(p,E);let ye;j===o.ah.vertical&&ce.verticalizePunctuation();const{processBidirectionalText:we,processStyledBidirectionalText:Oe}=fa;if(we&&ce.sections.length===1){ye=[];const He=we(ce.toString(),nD(ce,G,I,h,b,ne));for(const et of He){const Ct=new jf;Ct.text=et,Ct.sections=ce.sections;for(let Yt=0;Yt<et.length;Yt++)Ct.sectionIndex.push(0);ye.push(Ct)}}else if(Oe){ye=[];const He=Oe(ce.text,ce.sectionIndex,nD(ce,G,I,h,b,ne));for(const et of He){const Ct=new jf;Ct.text=et[0],Ct.sectionIndex=et[1],Ct.sections=ce.sections,ye.push(Ct)}}else ye=function(He,et){const Ct=[],Yt=He.text;let xt=0;for(const _t of et)Ct.push(He.substring(xt,_t)),xt=_t;return xt<Yt.length&&Ct.push(He.substring(xt,Yt.length)),Ct}(ce,nD(ce,G,I,h,b,ne));const Ae=[],Re={positionedLines:Ae,text:ce.toString(),top:W[1],bottom:W[1],left:W[0],right:W[0],writingMode:j,iconsInText:!1,verticalizable:!1};return function(He,et,Ct,Yt,xt,_t,Gt,Rt,It,Ye,Ut,Ft){let nr=0,rn=cm,en=0,Kn=0;const Lo=Rt==="right"?1:Rt==="left"?0:.5;let bi=0;for(const Mn of xt){Mn.trim();const Qn=Mn.getMaxScale(),Pi=(Qn-1)*Zn,xi={positionedGlyphs:[],lineOffset:0};He.positionedLines[bi]=xi;const ji=xi.positionedGlyphs;let wi=0;if(!Mn.length()){rn+=_t,++bi;continue}for(let va=0;va<Mn.length();va++){const $r=Mn.getSection(va),cn=Mn.getSectionIndex(va),vn=Mn.getCharCode(va);let Pa=0,Tn=null,Jf=null,Ls=null,Ps=Zn;const Po=!(It===o.ah.horizontal||!Ut&&!Xv(vn)||Ut&&(Yb[vn]||(Jn=vn,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Jn)))));if($r.imageName){const Qa=Yt[$r.imageName];if(!Qa)continue;Ls=$r.imageName,He.iconsInText=He.iconsInText||!0,Jf=Qa.paddedRect;const ui=Qa.displaySize;$r.scale=$r.scale*Zn/Ft,Tn={width:ui[0],height:ui[1],left:ga,top:-P6,advance:Po?ui[1]:ui[0]},Pa=Pi+(Zn-ui[1]*$r.scale),Ps=Tn.advance;const xl=Po?ui[0]*$r.scale-Zn*Qn:ui[1]*$r.scale-Zn*Qn;xl>0&&xl>wi&&(wi=xl)}else{const Qa=Ct[$r.fontStack],ui=Qa&&Qa[vn];if(ui&&ui.rect)Jf=ui.rect,Tn=ui.metrics;else{const xl=et[$r.fontStack],vm=xl&&xl[vn];if(!vm)continue;Tn=vm.metrics}Pa=(Qn-$r.scale)*Zn}Po?(He.verticalizable=!0,ji.push({glyph:vn,imageName:Ls,x:nr,y:rn+Pa,vertical:Po,scale:$r.scale,fontStack:$r.fontStack,sectionIndex:cn,metrics:Tn,rect:Jf}),nr+=Ps*$r.scale+Ye):(ji.push({glyph:vn,imageName:Ls,x:nr,y:rn+Pa,vertical:Po,scale:$r.scale,fontStack:$r.fontStack,sectionIndex:cn,metrics:Tn,rect:Jf}),nr+=Tn.advance*$r.scale+Ye)}ji.length!==0&&(en=Math.max(nr-Ye,en),p_e(ji,0,ji.length-1,Lo,wi)),nr=0;const Ja=_t*Qn+wi;xi.lineOffset=Math.max(wi,Pi),rn+=Ja,Kn=Math.max(Ja,Kn),++bi}var Jn;const Wi=rn-cm,{horizontalAlign:qi,verticalAlign:Zi}=iD(Gt);(function(Mn,Qn,Pi,xi,ji,wi,Ja,va,$r){const cn=(Qn-Pi)*ji;let vn=0;vn=wi!==Ja?-va*xi-cm:(-xi*$r+.5)*Ja;for(const Pa of Mn)for(const Tn of Pa.positionedGlyphs)Tn.x+=cn,Tn.y+=vn})(He.positionedLines,Lo,qi,Zi,en,Kn,_t,Wi,xt.length),He.top+=-Zi*Wi,He.bottom=He.top+Wi,He.left+=-qi*en,He.right=He.left+en}(Re,h,v,b,ye,k,R,z,j,G,ee,se),!function(He){for(const et of He)if(et.positionedGlyphs.length!==0)return!1;return!0}(Ae)&&Re}const Yb={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},h_e={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},d_e={40:!0};function O6(p,h,v,b,E,I){if(h.imageName){const k=b[h.imageName];return k?k.displaySize[0]*h.scale*Zn/I+E:0}{const k=v[h.fontStack],R=k&&k[p];return R?R.metrics.advance*h.scale+E:0}}function z6(p,h,v,b){const E=Math.pow(p-h,2);return b?p<h?E/2:2*E:E+Math.abs(v)*v}function f_e(p,h,v){let b=0;return p===10&&(b-=1e4),v&&(b+=150),p!==40&&p!==65288||(b+=50),h!==41&&h!==65289||(b+=50),b}function B6(p,h,v,b,E,I){let k=null,R=z6(h,v,E,I);for(const z of b){const G=z6(h-z.x,v,E,I)+z.badness;G<=R&&(k=z,R=G)}return{index:p,x:h,priorBreak:k,badness:R}}function V6(p){return p?V6(p.priorBreak).concat(p.index):[]}function nD(p,h,v,b,E,I){if(!p)return[];const k=[],R=function(j,ee,ne,se,ce,ye){let we=0;for(let Oe=0;Oe<j.length();Oe++){const Ae=j.getSection(Oe);we+=O6(j.getCharCode(Oe),Ae,se,ce,ee,ye)}return we/Math.max(1,Math.ceil(we/ne))}(p,h,v,b,E,I),z=p.text.indexOf("")>=0;let G=0;for(let j=0;j<p.length();j++){const ee=p.getSection(j),ne=p.getCharCode(j);if(Yb[ne]||(G+=O6(ne,ee,b,E,h,I)),j<p.length()-1){const se=!((W=ne)<11904)&&(!!Lr["CJK Compatibility Forms"](W)||!!Lr["CJK Compatibility"](W)||!!Lr["CJK Strokes"](W)||!!Lr["CJK Symbols and Punctuation"](W)||!!Lr["Enclosed CJK Letters and Months"](W)||!!Lr["Halfwidth and Fullwidth Forms"](W)||!!Lr["Ideographic Description Characters"](W)||!!Lr["Vertical Forms"](W)||Pb.test(String.fromCodePoint(W)));(h_e[ne]||se||ee.imageName||j!==p.length()-2&&d_e[p.getCharCode(j+1)])&&k.push(B6(j+1,G,R,k,f_e(ne,p.getCharCode(j+1),se&&z),!1))}}var W;return V6(B6(p.length(),G,R,k,0,!0))}function iD(p){let h=.5,v=.5;switch(p){case"right":case"top-right":case"bottom-right":h=1;break;case"left":case"top-left":case"bottom-left":h=0}switch(p){case"bottom":case"bottom-right":case"bottom-left":v=1;break;case"top":case"top-right":case"top-left":v=0}return{horizontalAlign:h,verticalAlign:v}}function p_e(p,h,v,b,E){if(!b&&!E)return;const I=p[v],k=(p[v].x+I.metrics.advance*I.scale)*b;for(let R=h;R<=v;R++)p[R].x-=k,p[R].y+=E}function g_e(p,h,v){const{horizontalAlign:b,verticalAlign:E}=iD(v),I=h[0]-p.displaySize[0]*b,k=h[1]-p.displaySize[1]*E;return{image:p,top:k,bottom:k+p.displaySize[1],left:I,right:I+p.displaySize[0]}}function F6(p){var h,v;let b=p.left,E=p.top,I=p.right-b,k=p.bottom-E;const R=(h=p.image.textFitWidth)!==null&&h!==void 0?h:"stretchOrShrink",z=(v=p.image.textFitHeight)!==null&&v!==void 0?v:"stretchOrShrink",G=(p.image.content[2]-p.image.content[0])/(p.image.content[3]-p.image.content[1]);if(z==="proportional"){if(R==="stretchOnly"&&I/k<G||R==="proportional"){const W=Math.ceil(k*G);b*=W/I,I=W}}else if(R==="proportional"&&z==="stretchOnly"&&G!==0&&I/k>G){const W=Math.ceil(I/G);E*=W/k,k=W}return{x1:b,y1:E,x2:b+I,y2:E+k}}function $6(p,h,v,b,E,I){const k=p.image;let R;if(k.content){const ye=k.content,we=k.pixelRatio||1;R=[ye[0]/we,ye[1]/we,k.displaySize[0]-ye[2]/we,k.displaySize[1]-ye[3]/we]}const z=h.left*I,G=h.right*I;let W,j,ee,ne;v==="width"||v==="both"?(ne=E[0]+z-b[3],j=E[0]+G+b[1]):(ne=E[0]+(z+G-k.displaySize[0])/2,j=ne+k.displaySize[0]);const se=h.top*I,ce=h.bottom*I;return v==="height"||v==="both"?(W=E[1]+se-b[0],ee=E[1]+ce+b[2]):(W=E[1]+(se+ce-k.displaySize[1])/2,ee=W+k.displaySize[1]),{image:k,top:W,right:j,bottom:ee,left:ne,collisionPadding:R}}const hm=255,ks=128,Vc=hm*ks;function G6(p,h){const{expression:v}=h;if(v.kind==="constant")return{kind:"constant",layoutSize:v.evaluate(new dn(p+1))};if(v.kind==="source")return{kind:"source"};{const{zoomStops:b,interpolationType:E}=v;let I=0;for(;I<b.length&&b[I]<=p;)I++;I=Math.max(0,I-1);let k=I;for(;k<b.length&&b[k]<p+1;)k++;k=Math.min(b.length-1,k);const R=b[I],z=b[k];return v.kind==="composite"?{kind:"composite",minZoom:R,maxZoom:z,interpolationType:E}:{kind:"camera",minZoom:R,maxZoom:z,minSize:v.evaluate(new dn(R)),maxSize:v.evaluate(new dn(z)),interpolationType:E}}}function aD(p,h,v){let b="never";const E=p.get(h);return E?b=E:p.get(v)&&(b="always"),b}const v_e=zc.VectorTileFeature.types,m_e=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Kb(p,h,v,b,E,I,k,R,z,G,W,j,ee){const ne=R?Math.min(Vc,Math.round(R[0])):0,se=R?Math.min(Vc,Math.round(R[1])):0;p.emplaceBack(h,v,Math.round(32*b),Math.round(32*E),I,k,(ne<<1)+(z?1:0),se,16*G,16*W,256*j,256*ee)}function oD(p,h,v){p.emplaceBack(h.x,h.y,v),p.emplaceBack(h.x,h.y,v),p.emplaceBack(h.x,h.y,v),p.emplaceBack(h.x,h.y,v)}function y_e(p){for(const h of p.sections)if(RA(h.text))return!0;return!1}class sD{constructor(h){this.layoutVertexArray=new zf,this.indexArray=new Xa,this.programConfigurations=h,this.segments=new Pr,this.dynamicLayoutVertexArray=new Jv,this.opacityVertexArray=new ka,this.hasVisibleVertices=!1,this.placedSymbolArray=new fn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(h,v,b,E){this.isEmpty()||(b&&(this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,jye.members),this.indexBuffer=h.createIndexBuffer(this.indexArray,v),this.dynamicLayoutVertexBuffer=h.createVertexBuffer(this.dynamicLayoutVertexArray,Xye.members,!0),this.opacityVertexBuffer=h.createVertexBuffer(this.opacityVertexArray,m_e,!0),this.opacityVertexBuffer.itemSize=1),(b||E)&&this.programConfigurations.upload(h))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Pt("SymbolBuffers",sD);class lD{constructor(h,v,b){this.layoutVertexArray=new h,this.layoutAttributes=v,this.indexArray=new b,this.segments=new Pr,this.collisionVertexArray=new Ms}upload(h){this.layoutVertexBuffer=h.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=h.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=h.createVertexBuffer(this.collisionVertexArray,Yye.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Pt("CollisionBuffers",lD);class Xf{constructor(h){this.collisionBoxArray=h.collisionBoxArray,this.zoom=h.zoom,this.overscaling=h.overscaling,this.layers=h.layers,this.layerIds=this.layers.map(k=>k.id),this.index=h.index,this.pixelRatio=h.pixelRatio,this.sourceLayerIndex=h.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=$A([]),this.placementViewportMatrix=$A([]);const v=this.layers[0]._unevaluatedLayout._values;this.textSizeData=G6(this.zoom,v["text-size"]),this.iconSizeData=G6(this.zoom,v["icon-size"]);const b=this.layers[0].layout,E=b.get("symbol-sort-key"),I=b.get("symbol-z-order");this.canOverlap=aD(b,"text-overlap","text-allow-overlap")!=="never"||aD(b,"icon-overlap","icon-allow-overlap")!=="never"||b.get("text-ignore-placement")||b.get("icon-ignore-placement"),this.sortFeaturesByKey=I!=="viewport-y"&&!E.isConstant(),this.sortFeaturesByY=(I==="viewport-y"||I==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,b.get("symbol-placement")==="point"&&(this.writingModes=b.get("text-writing-mode").map(k=>o.ah[k])),this.stateDependentLayerIds=this.layers.filter(k=>k.isStateDependent()).map(k=>k.id),this.sourceID=h.sourceID}createArrays(){this.text=new sD(new Lh(this.layers,this.zoom,h=>/^text/.test(h))),this.icon=new sD(new Lh(this.layers,this.zoom,h=>/^icon/.test(h))),this.glyphOffsetArray=new pn,this.lineVertexArray=new vi,this.symbolInstances=new Mr,this.textAnchorOffsets=new gn}calculateGlyphDependencies(h,v,b,E,I){for(let k=0;k<h.length;k++)if(v[h.charCodeAt(k)]=!0,(b||E)&&I){const R=lm[h.charAt(k)];R&&(v[R.charCodeAt(0)]=!0)}}populate(h,v,b){const E=this.layers[0],I=E.layout,k=I.get("text-font"),R=I.get("text-field"),z=I.get("icon-image"),G=(R.value.kind!=="constant"||R.value.value instanceof ca&&!R.value.value.isEmpty()||R.value.value.toString().length>0)&&(k.value.kind!=="constant"||k.value.value.length>0),W=z.value.kind!=="constant"||!!z.value.value||Object.keys(z.parameters).length>0,j=I.get("symbol-sort-key");if(this.features=[],!G&&!W)return;const ee=v.iconDependencies,ne=v.glyphDependencies,se=v.availableImages,ce=new dn(this.zoom);for(const{feature:ye,id:we,index:Oe,sourceLayerIndex:Ae}of h){const Re=E._featureFilter.needGeometry,He=Rh(ye,Re);if(!E._featureFilter.filter(ce,He,b))continue;let et,Ct;if(Re||(He.geometry=Ph(ye)),G){const xt=E.getValueAndResolveTokens("text-field",He,b,se),_t=ca.factory(xt),Gt=this.hasRTLText=this.hasRTLText||y_e(_t);(!Gt||fa.getRTLTextPluginStatus()==="unavailable"||Gt&&fa.isParsed())&&(et=Jye(_t,E,He))}if(W){const xt=E.getValueAndResolveTokens("icon-image",He,b,se);Ct=xt instanceof ha?xt:ha.fromString(xt)}if(!et&&!Ct)continue;const Yt=this.sortFeaturesByKey?j.evaluate(He,{},b):void 0;if(this.features.push({id:we,text:et,icon:Ct,index:Oe,sourceLayerIndex:Ae,geometry:He.geometry,properties:ye.properties,type:v_e[ye.type],sortKey:Yt}),Ct&&(ee[Ct.name]=!0),et){const xt=k.evaluate(He,{},b).join(","),_t=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(o.ah.vertical)>=0;for(const Gt of et.sections)if(Gt.image)ee[Gt.image.name]=!0;else{const Rt=Zv(et.toString()),It=Gt.fontStack||xt,Ye=ne[It]=ne[It]||{};this.calculateGlyphDependencies(Gt.text,Ye,_t,this.allowVerticalPlacement,Rt)}}}I.get("symbol-placement")==="line"&&(this.features=function(ye){const we={},Oe={},Ae=[];let Re=0;function He(xt){Ae.push(ye[xt]),Re++}function et(xt,_t,Gt){const Rt=Oe[xt];return delete Oe[xt],Oe[_t]=Rt,Ae[Rt].geometry[0].pop(),Ae[Rt].geometry[0]=Ae[Rt].geometry[0].concat(Gt[0]),Rt}function Ct(xt,_t,Gt){const Rt=we[_t];return delete we[_t],we[xt]=Rt,Ae[Rt].geometry[0].shift(),Ae[Rt].geometry[0]=Gt[0].concat(Ae[Rt].geometry[0]),Rt}function Yt(xt,_t,Gt){const Rt=Gt?_t[0][_t[0].length-1]:_t[0][0];return`${xt}:${Rt.x}:${Rt.y}`}for(let xt=0;xt<ye.length;xt++){const _t=ye[xt],Gt=_t.geometry,Rt=_t.text?_t.text.toString():null;if(!Rt){He(xt);continue}const It=Yt(Rt,Gt),Ye=Yt(Rt,Gt,!0);if(It in Oe&&Ye in we&&Oe[It]!==we[Ye]){const Ut=Ct(It,Ye,Gt),Ft=et(It,Ye,Ae[Ut].geometry);delete we[It],delete Oe[Ye],Oe[Yt(Rt,Ae[Ft].geometry,!0)]=Ft,Ae[Ut].geometry=null}else It in Oe?et(It,Ye,Gt):Ye in we?Ct(It,Ye,Gt):(He(xt),we[It]=Re-1,Oe[Ye]=Re-1)}return Ae.filter(xt=>xt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ye,we)=>ye.sortKey-we.sortKey)}update(h,v,b){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(h,v,this.layers,b),this.icon.programConfigurations.updatePaintArrays(h,v,this.layers,b))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(h){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(h),this.iconCollisionBox.upload(h)),this.text.upload(h,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(h,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(h,v){const b=this.lineVertexArray.length;if(h.segment!==void 0){let E=h.dist(v[h.segment+1]),I=h.dist(v[h.segment]);const k={};for(let R=h.segment+1;R<v.length;R++)k[R]={x:v[R].x,y:v[R].y,tileUnitDistanceFromAnchor:E},R<v.length-1&&(E+=v[R+1].dist(v[R]));for(let R=h.segment||0;R>=0;R--)k[R]={x:v[R].x,y:v[R].y,tileUnitDistanceFromAnchor:I},R>0&&(I+=v[R-1].dist(v[R]));for(let R=0;R<v.length;R++){const z=k[R];this.lineVertexArray.emplaceBack(z.x,z.y,z.tileUnitDistanceFromAnchor)}}return{lineStartIndex:b,lineLength:this.lineVertexArray.length-b}}addSymbols(h,v,b,E,I,k,R,z,G,W,j,ee){const ne=h.indexArray,se=h.layoutVertexArray,ce=h.segments.prepareSegment(4*v.length,se,ne,this.canOverlap?k.sortKey:void 0),ye=this.glyphOffsetArray.length,we=ce.vertexLength,Oe=this.allowVerticalPlacement&&R===o.ah.vertical?Math.PI/2:0,Ae=k.text&&k.text.sections;for(let Re=0;Re<v.length;Re++){const{tl:He,tr:et,bl:Ct,br:Yt,tex:xt,pixelOffsetTL:_t,pixelOffsetBR:Gt,minFontScaleX:Rt,minFontScaleY:It,glyphOffset:Ye,isSDF:Ut,sectionIndex:Ft}=v[Re],nr=ce.vertexLength,rn=Ye[1];Kb(se,z.x,z.y,He.x,rn+He.y,xt.x,xt.y,b,Ut,_t.x,_t.y,Rt,It),Kb(se,z.x,z.y,et.x,rn+et.y,xt.x+xt.w,xt.y,b,Ut,Gt.x,_t.y,Rt,It),Kb(se,z.x,z.y,Ct.x,rn+Ct.y,xt.x,xt.y+xt.h,b,Ut,_t.x,Gt.y,Rt,It),Kb(se,z.x,z.y,Yt.x,rn+Yt.y,xt.x+xt.w,xt.y+xt.h,b,Ut,Gt.x,Gt.y,Rt,It),oD(h.dynamicLayoutVertexArray,z,Oe),ne.emplaceBack(nr,nr+1,nr+2),ne.emplaceBack(nr+1,nr+2,nr+3),ce.vertexLength+=4,ce.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ye[0]),Re!==v.length-1&&Ft===v[Re+1].sectionIndex||h.programConfigurations.populatePaintArrays(se.length,k,k.index,{},ee,Ae&&Ae[Ft])}h.placedSymbolArray.emplaceBack(z.x,z.y,ye,this.glyphOffsetArray.length-ye,we,G,W,z.segment,b?b[0]:0,b?b[1]:0,E[0],E[1],R,0,!1,0,j)}_addCollisionDebugVertex(h,v,b,E,I,k){return v.emplaceBack(0,0),h.emplaceBack(b.x,b.y,E,I,Math.round(k.x),Math.round(k.y))}addCollisionDebugVertices(h,v,b,E,I,k,R){const z=I.segments.prepareSegment(4,I.layoutVertexArray,I.indexArray),G=z.vertexLength,W=I.layoutVertexArray,j=I.collisionVertexArray,ee=R.anchorX,ne=R.anchorY;this._addCollisionDebugVertex(W,j,k,ee,ne,new f(h,v)),this._addCollisionDebugVertex(W,j,k,ee,ne,new f(b,v)),this._addCollisionDebugVertex(W,j,k,ee,ne,new f(b,E)),this._addCollisionDebugVertex(W,j,k,ee,ne,new f(h,E)),z.vertexLength+=4;const se=I.indexArray;se.emplaceBack(G,G+1),se.emplaceBack(G+1,G+2),se.emplaceBack(G+2,G+3),se.emplaceBack(G+3,G),z.primitiveLength+=4}addDebugCollisionBoxes(h,v,b,E){for(let I=h;I<v;I++){const k=this.collisionBoxArray.get(I);this.addCollisionDebugVertices(k.x1,k.y1,k.x2,k.y2,E?this.textCollisionBox:this.iconCollisionBox,k.anchorPoint,b)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new lD(La,E6.members,ci),this.iconCollisionBox=new lD(La,E6.members,ci);for(let h=0;h<this.symbolInstances.length;h++){const v=this.symbolInstances.get(h);this.addDebugCollisionBoxes(v.textBoxStartIndex,v.textBoxEndIndex,v,!0),this.addDebugCollisionBoxes(v.verticalTextBoxStartIndex,v.verticalTextBoxEndIndex,v,!0),this.addDebugCollisionBoxes(v.iconBoxStartIndex,v.iconBoxEndIndex,v,!1),this.addDebugCollisionBoxes(v.verticalIconBoxStartIndex,v.verticalIconBoxEndIndex,v,!1)}}_deserializeCollisionBoxesForSymbol(h,v,b,E,I,k,R,z,G){const W={};for(let j=v;j<b;j++){const ee=h.get(j);W.textBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.textFeatureIndex=ee.featureIndex;break}for(let j=E;j<I;j++){const ee=h.get(j);W.verticalTextBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.verticalTextFeatureIndex=ee.featureIndex;break}for(let j=k;j<R;j++){const ee=h.get(j);W.iconBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.iconFeatureIndex=ee.featureIndex;break}for(let j=z;j<G;j++){const ee=h.get(j);W.verticalIconBox={x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,anchorPointX:ee.anchorPointX,anchorPointY:ee.anchorPointY},W.verticalIconFeatureIndex=ee.featureIndex;break}return W}deserializeCollisionBoxes(h){this.collisionArrays=[];for(let v=0;v<this.symbolInstances.length;v++){const b=this.symbolInstances.get(v);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(h,b.textBoxStartIndex,b.textBoxEndIndex,b.verticalTextBoxStartIndex,b.verticalTextBoxEndIndex,b.iconBoxStartIndex,b.iconBoxEndIndex,b.verticalIconBoxStartIndex,b.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(h,v){const b=h.placedSymbolArray.get(v),E=b.vertexStartIndex+4*b.numGlyphs;for(let I=b.vertexStartIndex;I<E;I+=4)h.indexArray.emplaceBack(I,I+1,I+2),h.indexArray.emplaceBack(I+1,I+2,I+3)}getSortedSymbolIndexes(h){if(this.sortedAngle===h&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const v=Math.sin(h),b=Math.cos(h),E=[],I=[],k=[];for(let R=0;R<this.symbolInstances.length;++R){k.push(R);const z=this.symbolInstances.get(R);E.push(0|Math.round(v*z.anchorX+b*z.anchorY)),I.push(z.featureIndex)}return k.sort((R,z)=>E[R]-E[z]||I[z]-I[R]),k}addToSortKeyRanges(h,v){const b=this.sortKeyRanges[this.sortKeyRanges.length-1];b&&b.sortKey===v?b.symbolInstanceEnd=h+1:this.sortKeyRanges.push({sortKey:v,symbolInstanceStart:h,symbolInstanceEnd:h+1})}sortFeatures(h){if(this.sortFeaturesByY&&this.sortedAngle!==h&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(h),this.sortedAngle=h,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const v of this.symbolInstanceIndexes){const b=this.symbolInstances.get(v);this.featureSortOrder.push(b.featureIndex),[b.rightJustifiedTextSymbolIndex,b.centerJustifiedTextSymbolIndex,b.leftJustifiedTextSymbolIndex].forEach((E,I,k)=>{E>=0&&k.indexOf(E)===I&&this.addIndicesForPlacedSymbol(this.text,E)}),b.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,b.verticalPlacedTextSymbolIndex),b.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,b.placedIconSymbolIndex),b.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,b.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let U6,H6;Pt("SymbolBucket",Xf,{omit:["layers","collisionBoxArray","features","compareText"]}),Xf.MAX_GLYPHS=65535,Xf.addDynamicAttributes=oD;var cD={get paint(){return H6=H6||new D({"icon-opacity":new Kt(Le.paint_symbol["icon-opacity"]),"icon-color":new Kt(Le.paint_symbol["icon-color"]),"icon-halo-color":new Kt(Le.paint_symbol["icon-halo-color"]),"icon-halo-width":new Kt(Le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Kt(Le.paint_symbol["icon-halo-blur"]),"icon-translate":new Ot(Le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ot(Le.paint_symbol["icon-translate-anchor"]),"text-opacity":new Kt(Le.paint_symbol["text-opacity"]),"text-color":new Kt(Le.paint_symbol["text-color"],{runtimeType:pi,getOverride:p=>p.textColor,hasOverride:p=>!!p.textColor}),"text-halo-color":new Kt(Le.paint_symbol["text-halo-color"]),"text-halo-width":new Kt(Le.paint_symbol["text-halo-width"]),"text-halo-blur":new Kt(Le.paint_symbol["text-halo-blur"]),"text-translate":new Ot(Le.paint_symbol["text-translate"]),"text-translate-anchor":new Ot(Le.paint_symbol["text-translate-anchor"])})},get layout(){return U6=U6||new D({"symbol-placement":new Ot(Le.layout_symbol["symbol-placement"]),"symbol-spacing":new Ot(Le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ot(Le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Kt(Le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ot(Le.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ot(Le.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ot(Le.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ot(Le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ot(Le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ot(Le.layout_symbol["icon-rotation-alignment"]),"icon-size":new Kt(Le.layout_symbol["icon-size"]),"icon-text-fit":new Ot(Le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ot(Le.layout_symbol["icon-text-fit-padding"]),"icon-image":new Kt(Le.layout_symbol["icon-image"]),"icon-rotate":new Kt(Le.layout_symbol["icon-rotate"]),"icon-padding":new Kt(Le.layout_symbol["icon-padding"]),"icon-keep-upright":new Ot(Le.layout_symbol["icon-keep-upright"]),"icon-offset":new Kt(Le.layout_symbol["icon-offset"]),"icon-anchor":new Kt(Le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ot(Le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ot(Le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ot(Le.layout_symbol["text-rotation-alignment"]),"text-field":new Kt(Le.layout_symbol["text-field"]),"text-font":new Kt(Le.layout_symbol["text-font"]),"text-size":new Kt(Le.layout_symbol["text-size"]),"text-max-width":new Kt(Le.layout_symbol["text-max-width"]),"text-line-height":new Ot(Le.layout_symbol["text-line-height"]),"text-letter-spacing":new Kt(Le.layout_symbol["text-letter-spacing"]),"text-justify":new Kt(Le.layout_symbol["text-justify"]),"text-radial-offset":new Kt(Le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ot(Le.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Kt(Le.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Kt(Le.layout_symbol["text-anchor"]),"text-max-angle":new Ot(Le.layout_symbol["text-max-angle"]),"text-writing-mode":new Ot(Le.layout_symbol["text-writing-mode"]),"text-rotate":new Kt(Le.layout_symbol["text-rotate"]),"text-padding":new Ot(Le.layout_symbol["text-padding"]),"text-keep-upright":new Ot(Le.layout_symbol["text-keep-upright"]),"text-transform":new Kt(Le.layout_symbol["text-transform"]),"text-offset":new Kt(Le.layout_symbol["text-offset"]),"text-allow-overlap":new Ot(Le.layout_symbol["text-allow-overlap"]),"text-overlap":new Ot(Le.layout_symbol["text-overlap"]),"text-ignore-placement":new Ot(Le.layout_symbol["text-ignore-placement"]),"text-optional":new Ot(Le.layout_symbol["text-optional"])})}};class W6{constructor(h){if(h.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=h.property.overrides?h.property.overrides.runtimeType:Ln,this.defaultValue=h}evaluate(h){if(h.formattedSection){const v=this.defaultValue.property.overrides;if(v&&v.hasOverride(h.formattedSection))return v.getOverride(h.formattedSection)}return h.feature&&h.featureState?this.defaultValue.evaluate(h.feature,h.featureState):this.defaultValue.property.specification.default}eachChild(h){this.defaultValue.isConstant()||h(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Pt("FormatSectionOverride",W6,{omit:["defaultValue"]});class Jb extends y{constructor(h){super(h,cD)}recalculate(h,v){if(super.recalculate(h,v),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const b=this.layout.get("text-writing-mode");if(b){const E=[];for(const I of b)E.indexOf(I)<0&&E.push(I);this.layout._values["text-writing-mode"]=E}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(h,v,b,E){const I=this.layout.get(h).evaluate(v,{},b,E),k=this._unevaluatedLayout._values[h];return k.isDataDriven()||wf(k.value)||!I?I:function(R,z){return z.replace(/{([^{}]+)}/g,(G,W)=>R&&W in R?String(R[W]):"")}(v.properties,I)}createBucket(h){return new Xf(h)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const h of cD.paint.overridableProperties){if(!Jb.hasPaintOverride(this.layout,h))continue;const v=this.paint.get(h),b=new W6(v),E=new xf(b,v.property.specification);let I=null;I=v.value.kind==="constant"||v.value.kind==="source"?new xc("source",E):new wc("composite",E,v.value.zoomStops),this.paint._values[h]=new Io(v.property,I,v.parameters)}}_handleOverridablePaintPropertyUpdate(h,v,b){return!(!this.layout||v.isDataDriven()||b.isDataDriven())&&Jb.hasPaintOverride(this.layout,h)}static hasPaintOverride(h,v){const b=h.get("text-field"),E=cD.paint.properties[v];let I=!1;const k=R=>{for(const z of R)if(E.overrides&&E.overrides.hasOverride(z))return void(I=!0)};if(b.value.kind==="constant"&&b.value.value instanceof ca)k(b.value.value.sections);else if(b.value.kind==="source"){const R=G=>{I||(G instanceof Ua&&Vn(G.value)===Mi?k(G.value.sections):G instanceof df?k(G.sections):G.eachChild(R))},z=b.value;z._styleExpression&&R(z._styleExpression.expression)}return I}}let q6;var __e={get paint(){return q6=q6||new D({"background-color":new Ot(Le.paint_background["background-color"]),"background-pattern":new Nf(Le.paint_background["background-pattern"]),"background-opacity":new Ot(Le.paint_background["background-opacity"])})}};class b_e extends y{constructor(h){super(h,__e)}}let Z6;var x_e={get paint(){return Z6=Z6||new D({"raster-opacity":new Ot(Le.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ot(Le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ot(Le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ot(Le.paint_raster["raster-brightness-max"]),"raster-saturation":new Ot(Le.paint_raster["raster-saturation"]),"raster-contrast":new Ot(Le.paint_raster["raster-contrast"]),"raster-resampling":new Ot(Le.paint_raster["raster-resampling"]),"raster-fade-duration":new Ot(Le.paint_raster["raster-fade-duration"])})}};class w_e extends y{constructor(h){super(h,x_e)}}class S_e extends y{constructor(h){super(h,{}),this.onAdd=v=>{this.implementation.onAdd&&this.implementation.onAdd(v,v.painter.context.gl)},this.onRemove=v=>{this.implementation.onRemove&&this.implementation.onRemove(v,v.painter.context.gl)},this.implementation=h}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class T_e{constructor(h){this._methodToThrottle=h,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const uD=63710088e-1;class Fc{constructor(h,v){if(isNaN(h)||isNaN(v))throw new Error(`Invalid LngLat object: (${h}, ${v})`);if(this.lng=+h,this.lat=+v,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Fc(V(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(h){const v=Math.PI/180,b=this.lat*v,E=h.lat*v,I=Math.sin(b)*Math.sin(E)+Math.cos(b)*Math.cos(E)*Math.cos((h.lng-this.lng)*v);return uD*Math.acos(Math.min(I,1))}static convert(h){if(h instanceof Fc)return h;if(Array.isArray(h)&&(h.length===2||h.length===3))return new Fc(Number(h[0]),Number(h[1]));if(!Array.isArray(h)&&typeof h=="object"&&h!==null)return new Fc(Number("lng"in h?h.lng:h.lon),Number(h.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 j6=2*Math.PI*uD;function X6(p){return j6*Math.cos(p*Math.PI/180)}function Y6(p){return(180+p)/360}function K6(p){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p*Math.PI/360)))/360}function J6(p,h){return p/X6(h)}function hD(p){return 360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90}class dm{constructor(h,v,b=0){this.x=+h,this.y=+v,this.z=+b}static fromLngLat(h,v=0){const b=Fc.convert(h);return new dm(Y6(b.lng),K6(b.lat),J6(v,b.lat))}toLngLat(){return new Fc(360*this.x-180,hD(this.y))}toAltitude(){return this.z*X6(hD(this.y))}meterInMercatorCoordinateUnits(){return 1/j6*(h=hD(this.y),1/Math.cos(h*Math.PI/180));var h}}function Q6(p,h,v){var b=2*Math.PI*6378137/256/Math.pow(2,v);return[p*b-2*Math.PI*6378137/2,h*b-2*Math.PI*6378137/2]}class dD{constructor(h,v,b){if(!function(E,I,k){return!(E<0||E>25||k<0||k>=Math.pow(2,E)||I<0||I>=Math.pow(2,E))}(h,v,b))throw new Error(`x=${v}, y=${b}, z=${h} outside of bounds. 0<=x<${Math.pow(2,h)}, 0<=y<${Math.pow(2,h)} 0<=z<=25 `);this.z=h,this.x=v,this.y=b,this.key=fm(0,h,h,v,b)}equals(h){return this.z===h.z&&this.x===h.x&&this.y===h.y}url(h,v,b){const E=(k=this.y,R=this.z,z=Q6(256*(I=this.x),256*(k=Math.pow(2,R)-k-1),R),G=Q6(256*(I+1),256*(k+1),R),z[0]+","+z[1]+","+G[0]+","+G[1]);var I,k,R,z,G;const W=function(j,ee,ne){let se,ce="";for(let ye=j;ye>0;ye--)se=1<<ye-1,ce+=(ee&se?1:0)+(ne&se?2:0);return ce}(this.z,this.x,this.y);return h[(this.x+this.y)%h.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(b==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,v>1?"@2x":"").replace(/{quadkey}/g,W).replace(/{bbox-epsg-3857}/g,E)}isChildOf(h){const v=this.z-h.z;return v>0&&h.x===this.x>>v&&h.y===this.y>>v}getTilePoint(h){const v=Math.pow(2,this.z);return new f((h.x*v-this.x)*Fn,(h.y*v-this.y)*Fn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class eG{constructor(h,v){this.wrap=h,this.canonical=v,this.key=fm(h,v.z,v.z,v.x,v.y)}}class Ka{constructor(h,v,b,E,I){if(h<b)throw new Error(`overscaledZ should be >= z; overscaledZ = ${h}; z = ${b}`);this.overscaledZ=h,this.wrap=v,this.canonical=new dD(b,+E,+I),this.key=fm(v,h,b,E,I)}clone(){return new Ka(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(h){return this.overscaledZ===h.overscaledZ&&this.wrap===h.wrap&&this.canonical.equals(h.canonical)}scaledTo(h){if(h>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${h}; overscaledZ = ${this.overscaledZ}`);const v=this.canonical.z-h;return h>this.canonical.z?new Ka(h,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ka(h,this.wrap,h,this.canonical.x>>v,this.canonical.y>>v)}calculateScaledKey(h,v){if(h>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${h}; overscaledZ = ${this.overscaledZ}`);const b=this.canonical.z-h;return h>this.canonical.z?fm(this.wrap*+v,h,this.canonical.z,this.canonical.x,this.canonical.y):fm(this.wrap*+v,h,h,this.canonical.x>>b,this.canonical.y>>b)}isChildOf(h){if(h.wrap!==this.wrap)return!1;const v=this.canonical.z-h.canonical.z;return h.overscaledZ===0||h.overscaledZ<this.overscaledZ&&h.canonical.x===this.canonical.x>>v&&h.canonical.y===this.canonical.y>>v}children(h){if(this.overscaledZ>=h)return[new Ka(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const v=this.canonical.z+1,b=2*this.canonical.x,E=2*this.canonical.y;return[new Ka(v,this.wrap,v,b,E),new Ka(v,this.wrap,v,b+1,E),new Ka(v,this.wrap,v,b,E+1),new Ka(v,this.wrap,v,b+1,E+1)]}isLessThan(h){return this.wrap<h.wrap||!(this.wrap>h.wrap)&&(this.overscaledZ<h.overscaledZ||!(this.overscaledZ>h.overscaledZ)&&(this.canonical.x<h.canonical.x||!(this.canonical.x>h.canonical.x)&&this.canonical.y<h.canonical.y))}wrapped(){return new Ka(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(h){return new Ka(this.overscaledZ,h,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new eG(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(h){return this.canonical.getTilePoint(new dm(h.x-this.wrap,h.y))}}function fm(p,h,v,b,E){(p*=2)<0&&(p=-1*p-1);const I=1<<v;return(I*I*p+I*E+b).toString(36)+v.toString(36)+h.toString(36)}Pt("CanonicalTileID",dD),Pt("OverscaledTileID",Ka,{omit:["posMatrix"]});class tG{constructor(h,v,b,E=1,I=1,k=1,R=0){if(this.uid=h,v.height!==v.width)throw new RangeError("DEM tiles must be square");if(b&&!["mapbox","terrarium","custom"].includes(b))return void oe(`"${b}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=v.height;const z=this.dim=v.height-2;switch(this.data=new Uint32Array(v.data.buffer),b){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=E,this.greenFactor=I,this.blueFactor=k,this.baseShift=R;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let G=0;G<z;G++)this.data[this._idx(-1,G)]=this.data[this._idx(0,G)],this.data[this._idx(z,G)]=this.data[this._idx(z-1,G)],this.data[this._idx(G,-1)]=this.data[this._idx(G,0)],this.data[this._idx(G,z)]=this.data[this._idx(G,z-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(z,-1)]=this.data[this._idx(z-1,0)],this.data[this._idx(-1,z)]=this.data[this._idx(0,z-1)],this.data[this._idx(z,z)]=this.data[this._idx(z-1,z-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let G=0;G<z;G++)for(let W=0;W<z;W++){const j=this.get(G,W);j>this.max&&(this.max=j),j<this.min&&(this.min=j)}}get(h,v){const b=new Uint8Array(this.data.buffer),E=4*this._idx(h,v);return this.unpack(b[E],b[E+1],b[E+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(h,v){if(h<-1||h>=this.dim+1||v<-1||v>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(v+1)*this.stride+(h+1)}unpack(h,v,b){return h*this.redFactor+v*this.greenFactor+b*this.blueFactor-this.baseShift}getPixels(){return new Ya({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(h,v,b){if(this.dim!==h.dim)throw new Error("dem dimension mismatch");let E=v*this.dim,I=v*this.dim+this.dim,k=b*this.dim,R=b*this.dim+this.dim;switch(v){case-1:E=I-1;break;case 1:I=E+1}switch(b){case-1:k=R-1;break;case 1:R=k+1}const z=-v*this.dim,G=-b*this.dim;for(let W=k;W<R;W++)for(let j=E;j<I;j++)this.data[this._idx(j,W)]=h.data[this._idx(j+z,W+G)]}}Pt("DEMData",tG);class rG{constructor(h){this._stringToNumber={},this._numberToString=[];for(let v=0;v<h.length;v++){const b=h[v];this._stringToNumber[b]=v,this._numberToString[v]=b}}encode(h){return this._stringToNumber[h]}decode(h){if(h>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${h} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[h]}}class nG{constructor(h,v,b,E,I){this.type="Feature",this._vectorTileFeature=h,h._z=v,h._x=b,h._y=E,this.properties=h.properties,this.id=I}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(h){this._geometry=h}toJSON(){const h={geometry:this.geometry};for(const v in this)v!=="_geometry"&&v!=="_vectorTileFeature"&&(h[v]=this[v]);return h}}class iG{constructor(h,v){this.tileID=h,this.x=h.canonical.x,this.y=h.canonical.y,this.z=h.canonical.z,this.grid=new Cc(Fn,16,0),this.grid3D=new Cc(Fn,16,0),this.featureIndexArray=new ki,this.promoteId=v}insert(h,v,b,E,I,k){const R=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(b,E,I);const z=k?this.grid3D:this.grid;for(let G=0;G<v.length;G++){const W=v[G],j=[1/0,1/0,-1/0,-1/0];for(let ee=0;ee<W.length;ee++){const ne=W[ee];j[0]=Math.min(j[0],ne.x),j[1]=Math.min(j[1],ne.y),j[2]=Math.max(j[2],ne.x),j[3]=Math.max(j[3],ne.y)}j[0]<Fn&&j[1]<Fn&&j[2]>=0&&j[3]>=0&&z.insert(R,j[0],j[1],j[2],j[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new zc.VectorTile(new eD(this.rawTileData)).layers,this.sourceLayerCoder=new rG(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(h,v,b,E){this.loadVTLayers();const I=h.params||{},k=Fn/h.tileSize/h.scale,R=Lv(I.filter),z=h.queryGeometry,G=h.queryPadding*k,W=oG(z),j=this.grid.query(W.minX-G,W.minY-G,W.maxX+G,W.maxY+G),ee=oG(h.cameraQueryGeometry),ne=this.grid3D.query(ee.minX-G,ee.minY-G,ee.maxX+G,ee.maxY+G,(ye,we,Oe,Ae)=>function(Re,He,et,Ct,Yt){for(const _t of Re)if(He<=_t.x&&et<=_t.y&&Ct>=_t.x&&Yt>=_t.y)return!0;const xt=[new f(He,et),new f(He,Yt),new f(Ct,Yt),new f(Ct,et)];if(Re.length>2){for(const _t of xt)if(Gf(Re,_t))return!0}for(let _t=0;_t<Re.length-1;_t++)if(iye(Re[_t],Re[_t+1],xt))return!0;return!1}(h.cameraQueryGeometry,ye-G,we-G,Oe+G,Ae+G));for(const ye of ne)j.push(ye);j.sort(E_e);const se={};let ce;for(let ye=0;ye<j.length;ye++){const we=j[ye];if(we===ce)continue;ce=we;const Oe=this.featureIndexArray.get(we);let Ae=null;this.loadMatchingFeature(se,Oe.bucketIndex,Oe.sourceLayerIndex,Oe.featureIndex,R,I.layers,I.availableImages,v,b,E,(Re,He,et)=>(Ae||(Ae=Ph(Re)),He.queryIntersectsFeature(z,Re,et,Ae,this.z,h.transform,k,h.pixelPosMatrix)))}return se}loadMatchingFeature(h,v,b,E,I,k,R,z,G,W,j){const ee=this.bucketLayerIDs[v];if(k&&!function(ye,we){for(let Oe=0;Oe<ye.length;Oe++)if(we.indexOf(ye[Oe])>=0)return!0;return!1}(k,ee))return;const ne=this.sourceLayerCoder.decode(b),se=this.vtLayers[ne].feature(E);if(I.needGeometry){const ye=Rh(se,!0);if(!I.filter(new dn(this.tileID.overscaledZ),ye,this.tileID.canonical))return}else if(!I.filter(new dn(this.tileID.overscaledZ),se))return;const ce=this.getId(se,ne);for(let ye=0;ye<ee.length;ye++){const we=ee[ye];if(k&&k.indexOf(we)<0)continue;const Oe=z[we];if(!Oe)continue;let Ae={};ce&&W&&(Ae=W.getState(Oe.sourceLayer||"_geojsonTileLayer",ce));const Re=U({},G[we]);Re.paint=aG(Re.paint,Oe.paint,se,Ae,R),Re.layout=aG(Re.layout,Oe.layout,se,Ae,R);const He=!j||j(se,Oe,Ae);if(!He)continue;const et=new nG(se,this.z,this.x,this.y,ce);et.layer=Re;let Ct=h[we];Ct===void 0&&(Ct=h[we]=[]),Ct.push({featureIndex:E,feature:et,intersectionZ:He})}}lookupSymbolFeatures(h,v,b,E,I,k,R,z){const G={};this.loadVTLayers();const W=Lv(I);for(const j of h)this.loadMatchingFeature(G,b,E,j,W,k,R,z,v);return G}hasLayer(h){for(const v of this.bucketLayerIDs)for(const b of v)if(h===b)return!0;return!1}getId(h,v){let b=h.id;return this.promoteId&&(b=h.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[v]],typeof b=="boolean"&&(b=Number(b))),b}}function aG(p,h,v,b,E){return Z(p,(I,k)=>{const R=h instanceof Mh?h.get(k):null;return R&&R.evaluate?R.evaluate(v,b,E):R})}function oG(p){let h=1/0,v=1/0,b=-1/0,E=-1/0;for(const I of p)h=Math.min(h,I.x),v=Math.min(v,I.y),b=Math.max(b,I.x),E=Math.max(E,I.y);return{minX:h,minY:v,maxX:b,maxY:E}}function E_e(p,h){return h-p}function sG(p,h,v,b,E){const I=[];for(let k=0;k<p.length;k++){const R=p[k];let z;for(let G=0;G<R.length-1;G++){let W=R[G],j=R[G+1];W.x<h&&j.x<h||(W.x<h?W=new f(h,W.y+(h-W.x)/(j.x-W.x)*(j.y-W.y))._round():j.x<h&&(j=new f(h,W.y+(h-W.x)/(j.x-W.x)*(j.y-W.y))._round()),W.y<v&&j.y<v||(W.y<v?W=new f(W.x+(v-W.y)/(j.y-W.y)*(j.x-W.x),v)._round():j.y<v&&(j=new f(W.x+(v-W.y)/(j.y-W.y)*(j.x-W.x),v)._round()),W.x>=b&&j.x>=b||(W.x>=b?W=new f(b,W.y+(b-W.x)/(j.x-W.x)*(j.y-W.y))._round():j.x>=b&&(j=new f(b,W.y+(b-W.x)/(j.x-W.x)*(j.y-W.y))._round()),W.y>=E&&j.y>=E||(W.y>=E?W=new f(W.x+(E-W.y)/(j.y-W.y)*(j.x-W.x),E)._round():j.y>=E&&(j=new f(W.x+(E-W.y)/(j.y-W.y)*(j.x-W.x),E)._round()),z&&W.equals(z[z.length-1])||(z=[W],I.push(z)),z.push(j)))))}}return I}Pt("FeatureIndex",iG,{omit:["rawTileData","sourceLayerCoder"]});class $c extends f{constructor(h,v,b,E){super(h,v),this.angle=b,E!==void 0&&(this.segment=E)}clone(){return new $c(this.x,this.y,this.angle,this.segment)}}function lG(p,h,v,b,E){if(h.segment===void 0||v===0)return!0;let I=h,k=h.segment+1,R=0;for(;R>-v/2;){if(k--,k<0)return!1;R-=p[k].dist(I),I=p[k]}R+=p[k].dist(p[k+1]),k++;const z=[];let G=0;for(;R<v/2;){const W=p[k],j=p[k+1];if(!j)return!1;let ee=p[k-1].angleTo(W)-W.angleTo(j);for(ee=Math.abs((ee+3*Math.PI)%(2*Math.PI)-Math.PI),z.push({distance:R,angleDelta:ee}),G+=ee;R-z[0].distance>b;)G-=z.shift().angleDelta;if(G>E)return!1;k++,R+=W.dist(j)}return!0}function cG(p){let h=0;for(let v=0;v<p.length-1;v++)h+=p[v].dist(p[v+1]);return h}function uG(p,h,v){return p?.6*h*v:0}function hG(p,h){return Math.max(p?p.right-p.left:0,h?h.right-h.left:0)}function C_e(p,h,v,b,E,I){const k=uG(v,E,I),R=hG(v,b)*I;let z=0;const G=cG(p)/2;for(let W=0;W<p.length-1;W++){const j=p[W],ee=p[W+1],ne=j.dist(ee);if(z+ne>G){const se=(G-z)/ne,ce=$i.number(j.x,ee.x,se),ye=$i.number(j.y,ee.y,se),we=new $c(ce,ye,ee.angleTo(j),W);return we._round(),!k||lG(p,we,R,k,h)?we:void 0}z+=ne}}function A_e(p,h,v,b,E,I,k,R,z){const G=uG(b,I,k),W=hG(b,E),j=W*k,ee=p[0].x===0||p[0].x===z||p[0].y===0||p[0].y===z;return h-j<h/4&&(h=j+h/4),dG(p,ee?h/2*R%h:(W/2+2*I)*k*R%h,h,G,v,j,ee,!1,z)}function dG(p,h,v,b,E,I,k,R,z){const G=I/2,W=cG(p);let j=0,ee=h-v,ne=[];for(let se=0;se<p.length-1;se++){const ce=p[se],ye=p[se+1],we=ce.dist(ye),Oe=ye.angleTo(ce);for(;ee+v<j+we;){ee+=v;const Ae=(ee-j)/we,Re=$i.number(ce.x,ye.x,Ae),He=$i.number(ce.y,ye.y,Ae);if(Re>=0&&Re<z&&He>=0&&He<z&&ee-G>=0&&ee+G<=W){const et=new $c(Re,He,Oe,se);et._round(),b&&!lG(p,et,I,b,E)||ne.push(et)}}j+=we}return R||ne.length||k||(ne=dG(p,j/2,v,b,E,I,k,!0,z)),ne}Pt("Anchor",$c);const Yf=ga;function fG(p,h,v,b){const E=[],I=p.image,k=I.pixelRatio,R=I.paddedRect.w-2*Yf,z=I.paddedRect.h-2*Yf;let G={x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};const W=I.stretchX||[[0,R]],j=I.stretchY||[[0,z]],ee=(Ye,Ut)=>Ye+Ut[1]-Ut[0],ne=W.reduce(ee,0),se=j.reduce(ee,0),ce=R-ne,ye=z-se;let we=0,Oe=ne,Ae=0,Re=se,He=0,et=ce,Ct=0,Yt=ye;if(I.content&&b){const Ye=I.content,Ut=Ye[2]-Ye[0],Ft=Ye[3]-Ye[1];(I.textFitWidth||I.textFitHeight)&&(G=F6(p)),we=Qb(W,0,Ye[0]),Ae=Qb(j,0,Ye[1]),Oe=Qb(W,Ye[0],Ye[2]),Re=Qb(j,Ye[1],Ye[3]),He=Ye[0]-we,Ct=Ye[1]-Ae,et=Ut-Oe,Yt=Ft-Re}const xt=G.x1,_t=G.y1,Gt=G.x2-xt,Rt=G.y2-_t,It=(Ye,Ut,Ft,nr)=>{const rn=ex(Ye.stretch-we,Oe,Gt,xt),en=tx(Ye.fixed-He,et,Ye.stretch,ne),Kn=ex(Ut.stretch-Ae,Re,Rt,_t),Lo=tx(Ut.fixed-Ct,Yt,Ut.stretch,se),bi=ex(Ft.stretch-we,Oe,Gt,xt),Jn=tx(Ft.fixed-He,et,Ft.stretch,ne),Wi=ex(nr.stretch-Ae,Re,Rt,_t),qi=tx(nr.fixed-Ct,Yt,nr.stretch,se),Zi=new f(rn,Kn),Mn=new f(bi,Kn),Qn=new f(bi,Wi),Pi=new f(rn,Wi),xi=new f(en/k,Lo/k),ji=new f(Jn/k,qi/k),wi=h*Math.PI/180;if(wi){const $r=Math.sin(wi),cn=Math.cos(wi),vn=[cn,-$r,$r,cn];Zi._matMult(vn),Mn._matMult(vn),Pi._matMult(vn),Qn._matMult(vn)}const Ja=Ye.stretch+Ye.fixed,va=Ut.stretch+Ut.fixed;return{tl:Zi,tr:Mn,bl:Pi,br:Qn,tex:{x:I.paddedRect.x+Yf+Ja,y:I.paddedRect.y+Yf+va,w:Ft.stretch+Ft.fixed-Ja,h:nr.stretch+nr.fixed-va},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xi,pixelOffsetBR:ji,minFontScaleX:et/k/Gt,minFontScaleY:Yt/k/Rt,isSDF:v}};if(b&&(I.stretchX||I.stretchY)){const Ye=pG(W,ce,ne),Ut=pG(j,ye,se);for(let Ft=0;Ft<Ye.length-1;Ft++){const nr=Ye[Ft],rn=Ye[Ft+1];for(let en=0;en<Ut.length-1;en++)E.push(It(nr,Ut[en],rn,Ut[en+1]))}}else E.push(It({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:R+1},{fixed:0,stretch:z+1}));return E}function Qb(p,h,v){let b=0;for(const E of p)b+=Math.max(h,Math.min(v,E[1]))-Math.max(h,Math.min(v,E[0]));return b}function pG(p,h,v){const b=[{fixed:-Yf,stretch:0}];for(const[E,I]of p){const k=b[b.length-1];b.push({fixed:E-k.stretch,stretch:k.stretch}),b.push({fixed:E-k.stretch,stretch:k.stretch+(I-E)})}return b.push({fixed:h+Yf,stretch:v}),b}function ex(p,h,v,b){return p/h*v+b}function tx(p,h,v,b){return p-h*v/b}class rx{constructor(h,v,b,E,I,k,R,z,G,W){var j;if(this.boxStartIndex=h.length,G){let ee=k.top,ne=k.bottom;const se=k.collisionPadding;se&&(ee-=se[1],ne+=se[3]);let ce=ne-ee;ce>0&&(ce=Math.max(10,ce),this.circleDiameter=ce)}else{const ee=!((j=k.image)===null||j===void 0)&&j.content&&(k.image.textFitWidth||k.image.textFitHeight)?F6(k):{x1:k.left,y1:k.top,x2:k.right,y2:k.bottom};ee.y1=ee.y1*R-z[0],ee.y2=ee.y2*R+z[2],ee.x1=ee.x1*R-z[3],ee.x2=ee.x2*R+z[1];const ne=k.collisionPadding;if(ne&&(ee.x1-=ne[0]*R,ee.y1-=ne[1]*R,ee.x2+=ne[2]*R,ee.y2+=ne[3]*R),W){const se=new f(ee.x1,ee.y1),ce=new f(ee.x2,ee.y1),ye=new f(ee.x1,ee.y2),we=new f(ee.x2,ee.y2),Oe=W*Math.PI/180;se._rotate(Oe),ce._rotate(Oe),ye._rotate(Oe),we._rotate(Oe),ee.x1=Math.min(se.x,ce.x,ye.x,we.x),ee.x2=Math.max(se.x,ce.x,ye.x,we.x),ee.y1=Math.min(se.y,ce.y,ye.y,we.y),ee.y2=Math.max(se.y,ce.y,ye.y,we.y)}h.emplaceBack(v.x,v.y,ee.x1,ee.y1,ee.x2,ee.y2,b,E,I)}this.boxEndIndex=h.length}}class D_e{constructor(h=[],v=(b,E)=>b<E?-1:b>E?1:0){if(this.data=h,this.length=this.data.length,this.compare=v,this.length>0)for(let b=(this.length>>1)-1;b>=0;b--)this._down(b)}push(h){this.data.push(h),this._up(this.length++)}pop(){if(this.length===0)return;const h=this.data[0],v=this.data.pop();return--this.length>0&&(this.data[0]=v,this._down(0)),h}peek(){return this.data[0]}_up(h){const{data:v,compare:b}=this,E=v[h];for(;h>0;){const I=h-1>>1,k=v[I];if(b(E,k)>=0)break;v[h]=k,h=I}v[h]=E}_down(h){const{data:v,compare:b}=this,E=this.length>>1,I=v[h];for(;h<E;){let k=1+(h<<1);const R=k+1;if(R<this.length&&b(v[R],v[k])<0&&(k=R),b(v[k],I)>=0)break;v[h]=v[k],h=k}v[h]=I}}function M_e(p,h=1,v=!1){let b=1/0,E=1/0,I=-1/0,k=-1/0;const R=p[0];for(let ne=0;ne<R.length;ne++){const se=R[ne];(!ne||se.x<b)&&(b=se.x),(!ne||se.y<E)&&(E=se.y),(!ne||se.x>I)&&(I=se.x),(!ne||se.y>k)&&(k=se.y)}const z=Math.min(I-b,k-E);let G=z/2;const W=new D_e([],I_e);if(z===0)return new f(b,E);for(let ne=b;ne<I;ne+=z)for(let se=E;se<k;se+=z)W.push(new Kf(ne+G,se+G,G,p));let j=function(ne){let se=0,ce=0,ye=0;const we=ne[0];for(let Oe=0,Ae=we.length,Re=Ae-1;Oe<Ae;Re=Oe++){const He=we[Oe],et=we[Re],Ct=He.x*et.y-et.x*He.y;ce+=(He.x+et.x)*Ct,ye+=(He.y+et.y)*Ct,se+=3*Ct}return new Kf(ce/se,ye/se,0,ne)}(p),ee=W.length;for(;W.length;){const ne=W.pop();(ne.d>j.d||!j.d)&&(j=ne,v&&console.log("found best %d after %d probes",Math.round(1e4*ne.d)/1e4,ee)),ne.max-j.d<=h||(G=ne.h/2,W.push(new Kf(ne.p.x-G,ne.p.y-G,G,p)),W.push(new Kf(ne.p.x+G,ne.p.y-G,G,p)),W.push(new Kf(ne.p.x-G,ne.p.y+G,G,p)),W.push(new Kf(ne.p.x+G,ne.p.y+G,G,p)),ee+=4)}return v&&(console.log(`num probes: ${ee}`),console.log(`best distance: ${j.d}`)),j.p}function I_e(p,h){return h.max-p.max}function Kf(p,h,v,b){this.p=new f(p,h),this.h=v,this.d=function(E,I){let k=!1,R=1/0;for(let z=0;z<I.length;z++){const G=I[z];for(let W=0,j=G.length,ee=j-1;W<j;ee=W++){const ne=G[W],se=G[ee];ne.y>E.y!=se.y>E.y&&E.x<(se.x-ne.x)*(E.y-ne.y)/(se.y-ne.y)+ne.x&&(k=!k),R=Math.min(R,K$(E,ne,se))}}return(k?1:-1)*Math.sqrt(R)}(this.p,b),this.max=this.d+this.h*Math.SQRT2}var _i;o.aq=void 0,(_i=o.aq||(o.aq={}))[_i.center=1]="center",_i[_i.left=2]="left",_i[_i.right=3]="right",_i[_i.top=4]="top",_i[_i.bottom=5]="bottom",_i[_i["top-left"]=6]="top-left",_i[_i["top-right"]=7]="top-right",_i[_i["bottom-left"]=8]="bottom-left",_i[_i["bottom-right"]=9]="bottom-right";const Gc=7,fD=Number.POSITIVE_INFINITY;function gG(p,h){return h[1]!==fD?function(v,b,E){let I=0,k=0;switch(b=Math.abs(b),E=Math.abs(E),v){case"top-right":case"top-left":case"top":k=E-Gc;break;case"bottom-right":case"bottom-left":case"bottom":k=-E+Gc}switch(v){case"top-right":case"bottom-right":case"right":I=-b;break;case"top-left":case"bottom-left":case"left":I=b}return[I,k]}(p,h[0],h[1]):function(v,b){let E=0,I=0;b<0&&(b=0);const k=b/Math.SQRT2;switch(v){case"top-right":case"top-left":I=k-Gc;break;case"bottom-right":case"bottom-left":I=-k+Gc;break;case"bottom":I=-b+Gc;break;case"top":I=b-Gc}switch(v){case"top-right":case"bottom-right":E=-k;break;case"top-left":case"bottom-left":E=k;break;case"left":E=b;break;case"right":E=-b}return[E,I]}(p,h[0])}function vG(p,h,v){var b;const E=p.layout,I=(b=E.get("text-variable-anchor-offset"))===null||b===void 0?void 0:b.evaluate(h,{},v);if(I){const R=I.values,z=[];for(let G=0;G<R.length;G+=2){const W=z[G]=R[G],j=R[G+1].map(ee=>ee*Zn);W.startsWith("top")?j[1]-=Gc:W.startsWith("bottom")&&(j[1]+=Gc),z[G+1]=j}return new Ca(z)}const k=E.get("text-variable-anchor");if(k){let R;R=p._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[E.get("text-radial-offset").evaluate(h,{},v)*Zn,fD]:E.get("text-offset").evaluate(h,{},v).map(G=>G*Zn);const z=[];for(const G of k)z.push(G,gG(G,R));return new Ca(z)}return null}function pD(p){switch(p){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function k_e(p,h,v,b,E,I,k,R,z,G,W){let j=I.textMaxSize.evaluate(h,{});j===void 0&&(j=k);const ee=p.layers[0].layout,ne=ee.get("icon-offset").evaluate(h,{},W),se=yG(v.horizontal),ce=k/24,ye=p.tilePixelRatio*ce,we=p.tilePixelRatio*j/24,Oe=p.tilePixelRatio*R,Ae=p.tilePixelRatio*ee.get("symbol-spacing"),Re=ee.get("text-padding")*p.tilePixelRatio,He=function(Ye,Ut,Ft,nr=1){const rn=Ye.get("icon-padding").evaluate(Ut,{},Ft),en=rn&&rn.values;return[en[0]*nr,en[1]*nr,en[2]*nr,en[3]*nr]}(ee,h,W,p.tilePixelRatio),et=ee.get("text-max-angle")/180*Math.PI,Ct=ee.get("text-rotation-alignment")!=="viewport"&&ee.get("symbol-placement")!=="point",Yt=ee.get("icon-rotation-alignment")==="map"&&ee.get("symbol-placement")!=="point",xt=ee.get("symbol-placement"),_t=Ae/2,Gt=ee.get("icon-text-fit");let Rt;b&&Gt!=="none"&&(p.allowVerticalPlacement&&v.vertical&&(Rt=$6(b,v.vertical,Gt,ee.get("icon-text-fit-padding"),ne,ce)),se&&(b=$6(b,se,Gt,ee.get("icon-text-fit-padding"),ne,ce)));const It=(Ye,Ut)=>{Ut.x<0||Ut.x>=Fn||Ut.y<0||Ut.y>=Fn||function(Ft,nr,rn,en,Kn,Lo,bi,Jn,Wi,qi,Zi,Mn,Qn,Pi,xi,ji,wi,Ja,va,$r,cn,vn,Pa,Tn,Jf){const Ls=Ft.addToLineVertexArray(nr,rn);let Ps,Po,Qa,ui,xl=0,vm=0,wG=0,SG=0,wD=-1,SD=-1;const wl={};let TG=Bf("");if(Ft.allowVerticalPlacement&&en.vertical){const Ri=Jn.layout.get("text-rotate").evaluate(cn,{},Tn)+90;Qa=new rx(Wi,nr,qi,Zi,Mn,en.vertical,Qn,Pi,xi,Ri),bi&&(ui=new rx(Wi,nr,qi,Zi,Mn,bi,wi,Ja,xi,Ri))}if(Kn){const Ri=Jn.layout.get("icon-rotate").evaluate(cn,{}),eo=Jn.layout.get("icon-text-fit")!=="none",Oh=fG(Kn,Ri,Pa,eo),ts=bi?fG(bi,Ri,Pa,eo):void 0;Po=new rx(Wi,nr,qi,Zi,Mn,Kn,wi,Ja,!1,Ri),xl=4*Oh.length;const zh=Ft.iconSizeData;let Rs=null;zh.kind==="source"?(Rs=[ks*Jn.layout.get("icon-size").evaluate(cn,{})],Rs[0]>Vc&&oe(`${Ft.layerIds[0]}: Value for "icon-size" is >= ${hm}. Reduce your "icon-size".`)):zh.kind==="composite"&&(Rs=[ks*vn.compositeIconSizes[0].evaluate(cn,{},Tn),ks*vn.compositeIconSizes[1].evaluate(cn,{},Tn)],(Rs[0]>Vc||Rs[1]>Vc)&&oe(`${Ft.layerIds[0]}: Value for "icon-size" is >= ${hm}. Reduce your "icon-size".`)),Ft.addSymbols(Ft.icon,Oh,Rs,$r,va,cn,o.ah.none,nr,Ls.lineStartIndex,Ls.lineLength,-1,Tn),wD=Ft.icon.placedSymbolArray.length-1,ts&&(vm=4*ts.length,Ft.addSymbols(Ft.icon,ts,Rs,$r,va,cn,o.ah.vertical,nr,Ls.lineStartIndex,Ls.lineLength,-1,Tn),SD=Ft.icon.placedSymbolArray.length-1)}const EG=Object.keys(en.horizontal);for(const Ri of EG){const eo=en.horizontal[Ri];if(!Ps){TG=Bf(eo.text);const ts=Jn.layout.get("text-rotate").evaluate(cn,{},Tn);Ps=new rx(Wi,nr,qi,Zi,Mn,eo,Qn,Pi,xi,ts)}const Oh=eo.positionedLines.length===1;if(wG+=mG(Ft,nr,eo,Lo,Jn,xi,cn,ji,Ls,en.vertical?o.ah.horizontal:o.ah.horizontalOnly,Oh?EG:[Ri],wl,wD,vn,Tn),Oh)break}en.vertical&&(SG+=mG(Ft,nr,en.vertical,Lo,Jn,xi,cn,ji,Ls,o.ah.vertical,["vertical"],wl,SD,vn,Tn));const R_e=Ps?Ps.boxStartIndex:Ft.collisionBoxArray.length,N_e=Ps?Ps.boxEndIndex:Ft.collisionBoxArray.length,O_e=Qa?Qa.boxStartIndex:Ft.collisionBoxArray.length,z_e=Qa?Qa.boxEndIndex:Ft.collisionBoxArray.length,B_e=Po?Po.boxStartIndex:Ft.collisionBoxArray.length,V_e=Po?Po.boxEndIndex:Ft.collisionBoxArray.length,F_e=ui?ui.boxStartIndex:Ft.collisionBoxArray.length,$_e=ui?ui.boxEndIndex:Ft.collisionBoxArray.length;let es=-1;const ix=(Ri,eo)=>Ri&&Ri.circleDiameter?Math.max(Ri.circleDiameter,eo):eo;es=ix(Ps,es),es=ix(Qa,es),es=ix(Po,es),es=ix(ui,es);const CG=es>-1?1:0;CG&&(es*=Jf/Zn),Ft.glyphOffsetArray.length>=Xf.MAX_GLYPHS&&oe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),cn.sortKey!==void 0&&Ft.addToSortKeyRanges(Ft.symbolInstances.length,cn.sortKey);const G_e=vG(Jn,cn,Tn),[U_e,H_e]=function(Ri,eo){const Oh=Ri.length,ts=eo==null?void 0:eo.values;if((ts==null?void 0:ts.length)>0)for(let zh=0;zh<ts.length;zh+=2){const Rs=ts[zh+1];Ri.emplaceBack(o.aq[ts[zh]],Rs[0],Rs[1])}return[Oh,Ri.length]}(Ft.textAnchorOffsets,G_e);Ft.symbolInstances.emplaceBack(nr.x,nr.y,wl.right>=0?wl.right:-1,wl.center>=0?wl.center:-1,wl.left>=0?wl.left:-1,wl.vertical||-1,wD,SD,TG,R_e,N_e,O_e,z_e,B_e,V_e,F_e,$_e,qi,wG,SG,xl,vm,CG,0,Qn,es,U_e,H_e)}(p,Ut,Ye,v,b,E,Rt,p.layers[0],p.collisionBoxArray,h.index,h.sourceLayerIndex,p.index,ye,[Re,Re,Re,Re],Ct,z,Oe,He,Yt,ne,h,I,G,W,k)};if(xt==="line")for(const Ye of sG(h.geometry,0,0,Fn,Fn)){const Ut=A_e(Ye,Ae,et,v.vertical||se,b,24,we,p.overscaling,Fn);for(const Ft of Ut)se&&L_e(p,se.text,_t,Ft)||It(Ye,Ft)}else if(xt==="line-center"){for(const Ye of h.geometry)if(Ye.length>1){const Ut=C_e(Ye,et,v.vertical||se,b,24,we);Ut&&It(Ye,Ut)}}else if(h.type==="Polygon")for(const Ye of pf(h.geometry,0)){const Ut=M_e(Ye,16);It(Ye[0],new $c(Ut.x,Ut.y,0))}else if(h.type==="LineString")for(const Ye of h.geometry)It(Ye,new $c(Ye[0].x,Ye[0].y,0));else if(h.type==="Point")for(const Ye of h.geometry)for(const Ut of Ye)It([Ut],new $c(Ut.x,Ut.y,0))}function mG(p,h,v,b,E,I,k,R,z,G,W,j,ee,ne,se){const ce=function(Oe,Ae,Re,He,et,Ct,Yt,xt){const _t=He.layout.get("text-rotate").evaluate(Ct,{})*Math.PI/180,Gt=[];for(const Rt of Ae.positionedLines)for(const It of Rt.positionedGlyphs){if(!It.rect)continue;const Ye=It.rect||{};let Ut=P6+1,Ft=!0,nr=1,rn=0;const en=(et||xt)&&It.vertical,Kn=It.metrics.advance*It.scale/2;if(xt&&Ae.verticalizable&&(rn=Rt.lineOffset/2-(It.imageName?-(Zn-It.metrics.width*It.scale)/2:(It.scale-1)*Zn)),It.imageName){const $r=Yt[It.imageName];Ft=$r.sdf,nr=$r.pixelRatio,Ut=ga/nr}const Lo=et?[It.x+Kn,It.y]:[0,0];let bi=et?[0,0]:[It.x+Kn+Re[0],It.y+Re[1]-rn],Jn=[0,0];en&&(Jn=bi,bi=[0,0]);const Wi=It.metrics.isDoubleResolution?2:1,qi=(It.metrics.left-Ut)*It.scale-Kn+bi[0],Zi=(-It.metrics.top-Ut)*It.scale+bi[1],Mn=qi+Ye.w/Wi*It.scale/nr,Qn=Zi+Ye.h/Wi*It.scale/nr,Pi=new f(qi,Zi),xi=new f(Mn,Zi),ji=new f(qi,Qn),wi=new f(Mn,Qn);if(en){const $r=new f(-Kn,Kn-cm),cn=-Math.PI/2,vn=Zn/2-Kn,Pa=new f(5-cm-vn,-(It.imageName?vn:0)),Tn=new f(...Jn);Pi._rotateAround(cn,$r)._add(Pa)._add(Tn),xi._rotateAround(cn,$r)._add(Pa)._add(Tn),ji._rotateAround(cn,$r)._add(Pa)._add(Tn),wi._rotateAround(cn,$r)._add(Pa)._add(Tn)}if(_t){const $r=Math.sin(_t),cn=Math.cos(_t),vn=[cn,-$r,$r,cn];Pi._matMult(vn),xi._matMult(vn),ji._matMult(vn),wi._matMult(vn)}const Ja=new f(0,0),va=new f(0,0);Gt.push({tl:Pi,tr:xi,bl:ji,br:wi,tex:Ye,writingMode:Ae.writingMode,glyphOffset:Lo,sectionIndex:It.sectionIndex,isSDF:Ft,pixelOffsetTL:Ja,pixelOffsetBR:va,minFontScaleX:0,minFontScaleY:0})}return Gt}(0,v,R,E,I,k,b,p.allowVerticalPlacement),ye=p.textSizeData;let we=null;ye.kind==="source"?(we=[ks*E.layout.get("text-size").evaluate(k,{})],we[0]>Vc&&oe(`${p.layerIds[0]}: Value for "text-size" is >= ${hm}. Reduce your "text-size".`)):ye.kind==="composite"&&(we=[ks*ne.compositeTextSizes[0].evaluate(k,{},se),ks*ne.compositeTextSizes[1].evaluate(k,{},se)],(we[0]>Vc||we[1]>Vc)&&oe(`${p.layerIds[0]}: Value for "text-size" is >= ${hm}. Reduce your "text-size".`)),p.addSymbols(p.text,ce,we,R,I,k,G,h,z.lineStartIndex,z.lineLength,ee,se);for(const Oe of W)j[Oe]=p.text.placedSymbolArray.length-1;return 4*ce.length}function yG(p){for(const h in p)return p[h];return null}function L_e(p,h,v,b){const E=p.compareText;if(h in E){const I=E[h];for(let k=I.length-1;k>=0;k--)if(b.dist(I[k])<v)return!0}else E[h]=[];return E[h].push(b),!1}const _G=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class gD{static from(h){if(!(h instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[v,b]=new Uint8Array(h,0,2);if(v!==219)throw new Error("Data does not appear to be in a KDBush format.");const E=b>>4;if(E!==1)throw new Error(`Got v${E} data when expected v1.`);const I=_G[15&b];if(!I)throw new Error("Unrecognized array type.");const[k]=new Uint16Array(h,2,1),[R]=new Uint32Array(h,4,1);return new gD(R,k,I,h)}constructor(h,v=64,b=Float64Array,E){if(isNaN(h)||h<0)throw new Error(`Unpexpected numItems value: ${h}.`);this.numItems=+h,this.nodeSize=Math.min(Math.max(+v,2),65535),this.ArrayType=b,this.IndexArrayType=h<65536?Uint16Array:Uint32Array;const I=_G.indexOf(this.ArrayType),k=2*h*this.ArrayType.BYTES_PER_ELEMENT,R=h*this.IndexArrayType.BYTES_PER_ELEMENT,z=(8-R%8)%8;if(I<0)throw new Error(`Unexpected typed array class: ${b}.`);E&&E instanceof ArrayBuffer?(this.data=E,this.ids=new this.IndexArrayType(this.data,8,h),this.coords=new this.ArrayType(this.data,8+R+z,2*h),this._pos=2*h,this._finished=!0):(this.data=new ArrayBuffer(8+k+R+z),this.ids=new this.IndexArrayType(this.data,8,h),this.coords=new this.ArrayType(this.data,8+R+z,2*h),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+I]),new Uint16Array(this.data,2,1)[0]=v,new Uint32Array(this.data,4,1)[0]=h)}add(h,v){const b=this._pos>>1;return this.ids[b]=b,this.coords[this._pos++]=h,this.coords[this._pos++]=v,b}finish(){const h=this._pos>>1;if(h!==this.numItems)throw new Error(`Added ${h} items when expected ${this.numItems}.`);return vD(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(h,v,b,E){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:I,coords:k,nodeSize:R}=this,z=[0,I.length-1,0],G=[];for(;z.length;){const W=z.pop()||0,j=z.pop()||0,ee=z.pop()||0;if(j-ee<=R){for(let ye=ee;ye<=j;ye++){const we=k[2*ye],Oe=k[2*ye+1];we>=h&&we<=b&&Oe>=v&&Oe<=E&&G.push(I[ye])}continue}const ne=ee+j>>1,se=k[2*ne],ce=k[2*ne+1];se>=h&&se<=b&&ce>=v&&ce<=E&&G.push(I[ne]),(W===0?h<=se:v<=ce)&&(z.push(ee),z.push(ne-1),z.push(1-W)),(W===0?b>=se:E>=ce)&&(z.push(ne+1),z.push(j),z.push(1-W))}return G}within(h,v,b){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:E,coords:I,nodeSize:k}=this,R=[0,E.length-1,0],z=[],G=b*b;for(;R.length;){const W=R.pop()||0,j=R.pop()||0,ee=R.pop()||0;if(j-ee<=k){for(let ye=ee;ye<=j;ye++)xG(I[2*ye],I[2*ye+1],h,v)<=G&&z.push(E[ye]);continue}const ne=ee+j>>1,se=I[2*ne],ce=I[2*ne+1];xG(se,ce,h,v)<=G&&z.push(E[ne]),(W===0?h-b<=se:v-b<=ce)&&(R.push(ee),R.push(ne-1),R.push(1-W)),(W===0?h+b>=se:v+b>=ce)&&(R.push(ne+1),R.push(j),R.push(1-W))}return z}}function vD(p,h,v,b,E,I){if(E-b<=v)return;const k=b+E>>1;bG(p,h,k,b,E,I),vD(p,h,v,b,k-1,1-I),vD(p,h,v,k+1,E,1-I)}function bG(p,h,v,b,E,I){for(;E>b;){if(E-b>600){const G=E-b+1,W=v-b+1,j=Math.log(G),ee=.5*Math.exp(2*j/3),ne=.5*Math.sqrt(j*ee*(G-ee)/G)*(W-G/2<0?-1:1);bG(p,h,v,Math.max(b,Math.floor(v-W*ee/G+ne)),Math.min(E,Math.floor(v+(G-W)*ee/G+ne)),I)}const k=h[2*v+I];let R=b,z=E;for(pm(p,h,b,v),h[2*E+I]>k&&pm(p,h,b,E);R<z;){for(pm(p,h,R,z),R++,z--;h[2*R+I]<k;)R++;for(;h[2*z+I]>k;)z--}h[2*b+I]===k?pm(p,h,b,z):(z++,pm(p,h,z,E)),z<=v&&(b=z+1),v<=z&&(E=z-1)}}function pm(p,h,v,b){mD(p,v,b),mD(h,2*v,2*b),mD(h,2*v+1,2*b+1)}function mD(p,h,v){const b=p[h];p[h]=p[v],p[v]=b}function xG(p,h,v,b){const E=p-v,I=h-b;return E*E+I*I}var yD;o.bg=void 0,(yD=o.bg||(o.bg={})).create="create",yD.load="load",yD.fullLoad="fullLoad";let nx=null,gm=[];const _D=1e3/60,bD="loadTime",xD="fullLoadTime",P_e={mark(p){performance.mark(p)},frame(p){const h=p;nx!=null&&gm.push(h-nx),nx=h},clearMetrics(){nx=null,gm=[],performance.clearMeasures(bD),performance.clearMeasures(xD);for(const p in o.bg)performance.clearMarks(o.bg[p])},getPerformanceMetrics(){performance.measure(bD,o.bg.create,o.bg.load),performance.measure(xD,o.bg.create,o.bg.fullLoad);const p=performance.getEntriesByName(bD)[0].duration,h=performance.getEntriesByName(xD)[0].duration,v=gm.length,b=1/(gm.reduce((I,k)=>I+k,0)/v/1e3),E=gm.filter(I=>I>_D).reduce((I,k)=>I+(k-_D)/_D,0);return{loadTime:p,fullLoadTime:h,fps:b,percentDroppedFrames:E/(v+E)*100,totalFrames:v}}};o.$=class extends K{},o.A=Uf,o.B=MA,o.C=function(p){if(ge==null){const h=p.navigator?p.navigator.userAgent:null;ge=!!p.safari||!(!h||!(/\b(iPad|iPhone|iPod)\b/.test(h)||h.match("Safari")&&!h.match("Chrome")))}return ge},o.D=Ot,o.E=_r,o.F=class{constructor(p,h){this.target=p,this.mapId=h,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new T_e(()=>this.process()),this.subscription=function(v,b,E,I){return v.addEventListener(b,E,!1),{unsubscribe:()=>{v.removeEventListener(b,E,!1)}}}(this.target,"message",v=>this.receive(v)),this.globalScope=de(self)?p:window}registerMessageHandler(p,h){this.messageHandlers[p]=h}sendAsync(p,h){return new Promise((v,b)=>{const E=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[E]={resolve:v,reject:b},h&&h.signal.addEventListener("abort",()=>{delete this.resolveRejects[E];const R={id:E,type:"<cancel>",origin:location.origin,targetMapId:p.targetMapId,sourceMapId:this.mapId};this.target.postMessage(R)},{once:!0});const I=[],k=Object.assign(Object.assign({},p),{id:E,sourceMapId:this.mapId,origin:location.origin,data:Ac(p.data,I)});this.target.postMessage(k,{transfer:I})})}receive(p){const h=p.data,v=h.id;if(!(h.origin!=="file://"&&location.origin!=="file://"&&h.origin!=="resource://android"&&location.origin!=="resource://android"&&h.origin!==location.origin||h.targetMapId&&this.mapId!==h.targetMapId)){if(h.type==="<cancel>"){delete this.tasks[v];const b=this.abortControllers[v];return delete this.abortControllers[v],void(b&&b.abort())}if(de(self)||h.mustQueue)return this.tasks[v]=h,this.taskQueue.push(v),void this.invoker.trigger();this.processTask(v,h)}}process(){if(this.taskQueue.length===0)return;const p=this.taskQueue.shift(),h=this.tasks[p];delete this.tasks[p],this.taskQueue.length>0&&this.invoker.trigger(),h&&this.processTask(p,h)}processTask(p,h){return s(this,void 0,void 0,function*(){if(h.type==="<response>"){const E=this.resolveRejects[p];return delete this.resolveRejects[p],E?void(h.error?E.reject(Dc(h.error)):E.resolve(Dc(h.data))):void 0}if(!this.messageHandlers[h.type])return void this.completeTask(p,new Error(`Could not find a registered handler for ${h.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const v=Dc(h.data),b=new AbortController;this.abortControllers[p]=b;try{const E=yield this.messageHandlers[h.type](h.sourceMapId,v,b);this.completeTask(p,null,E)}catch(E){this.completeTask(p,E)}})}completeTask(p,h,v){const b=[];delete this.abortControllers[p];const E={id:p,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:h?Ac(h):null,data:Ac(v,b)};this.target.postMessage(E,{transfer:b})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},o.G=ct,o.H=function(){var p=new Uf(16);return Uf!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p},o.I=rD,o.J=function(p,h,v){var b,E,I,k,R,z,G,W,j,ee,ne,se,ce=v[0],ye=v[1],we=v[2];return h===p?(p[12]=h[0]*ce+h[4]*ye+h[8]*we+h[12],p[13]=h[1]*ce+h[5]*ye+h[9]*we+h[13],p[14]=h[2]*ce+h[6]*ye+h[10]*we+h[14],p[15]=h[3]*ce+h[7]*ye+h[11]*we+h[15]):(E=h[1],I=h[2],k=h[3],R=h[4],z=h[5],G=h[6],W=h[7],j=h[8],ee=h[9],ne=h[10],se=h[11],p[0]=b=h[0],p[1]=E,p[2]=I,p[3]=k,p[4]=R,p[5]=z,p[6]=G,p[7]=W,p[8]=j,p[9]=ee,p[10]=ne,p[11]=se,p[12]=b*ce+R*ye+j*we+h[12],p[13]=E*ce+z*ye+ee*we+h[13],p[14]=I*ce+G*ye+ne*we+h[14],p[15]=k*ce+W*ye+se*we+h[15]),p},o.K=function(p,h,v){var b=v[0],E=v[1],I=v[2];return p[0]=h[0]*b,p[1]=h[1]*b,p[2]=h[2]*b,p[3]=h[3]*b,p[4]=h[4]*E,p[5]=h[5]*E,p[6]=h[6]*E,p[7]=h[7]*E,p[8]=h[8]*I,p[9]=h[9]*I,p[10]=h[10]*I,p[11]=h[11]*I,p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15],p},o.L=t6,o.M=function(p,h){const v={};for(let b=0;b<h.length;b++){const E=h[b];E in p&&(v[E]=p[E])}return v},o.N=Fc,o.O=Y6,o.P=f,o.Q=K6,o.R=Ya,o.S=Ka,o.T=Pf,o.U=C,o.V=M,o.W=Me,o.X=Fn,o.Y=N,o.Z=dm,o._=s,o.a=at,o.a$=function(p,h){var v=p[0],b=p[1],E=p[2],I=p[3],k=p[4],R=p[5],z=p[6],G=p[7],W=p[8],j=p[9],ee=p[10],ne=p[11],se=p[12],ce=p[13],ye=p[14],we=p[15],Oe=h[0],Ae=h[1],Re=h[2],He=h[3],et=h[4],Ct=h[5],Yt=h[6],xt=h[7],_t=h[8],Gt=h[9],Rt=h[10],It=h[11],Ye=h[12],Ut=h[13],Ft=h[14],nr=h[15];return Math.abs(v-Oe)<=Hi*Math.max(1,Math.abs(v),Math.abs(Oe))&&Math.abs(b-Ae)<=Hi*Math.max(1,Math.abs(b),Math.abs(Ae))&&Math.abs(E-Re)<=Hi*Math.max(1,Math.abs(E),Math.abs(Re))&&Math.abs(I-He)<=Hi*Math.max(1,Math.abs(I),Math.abs(He))&&Math.abs(k-et)<=Hi*Math.max(1,Math.abs(k),Math.abs(et))&&Math.abs(R-Ct)<=Hi*Math.max(1,Math.abs(R),Math.abs(Ct))&&Math.abs(z-Yt)<=Hi*Math.max(1,Math.abs(z),Math.abs(Yt))&&Math.abs(G-xt)<=Hi*Math.max(1,Math.abs(G),Math.abs(xt))&&Math.abs(W-_t)<=Hi*Math.max(1,Math.abs(W),Math.abs(_t))&&Math.abs(j-Gt)<=Hi*Math.max(1,Math.abs(j),Math.abs(Gt))&&Math.abs(ee-Rt)<=Hi*Math.max(1,Math.abs(ee),Math.abs(Rt))&&Math.abs(ne-It)<=Hi*Math.max(1,Math.abs(ne),Math.abs(It))&&Math.abs(se-Ye)<=Hi*Math.max(1,Math.abs(se),Math.abs(Ye))&&Math.abs(ce-Ut)<=Hi*Math.max(1,Math.abs(ce),Math.abs(Ut))&&Math.abs(ye-Ft)<=Hi*Math.max(1,Math.abs(ye),Math.abs(Ft))&&Math.abs(we-nr)<=Hi*Math.max(1,Math.abs(we),Math.abs(nr))},o.a0=Pr,o.a1=dD,o.a2=$e,o.a3=p=>{const h=window.document.createElement("video");return h.muted=!0,new Promise(v=>{h.onloadstart=()=>{v(h)};for(const b of p){const E=window.document.createElement("source");wt(b)||(h.crossOrigin="Anonymous"),E.src=b,h.appendChild(E)}})},o.a4=function(){return H++},o.a5=Et,o.a6=Xf,o.a7=Lv,o.a8=Rh,o.a9=nG,o.aA=function(p){if(p.type==="custom")return new S_e(p);switch(p.type){case"background":return new b_e(p);case"circle":return new sye(p);case"fill":return new Tye(p);case"fill-extrusion":return new Vye(p);case"heatmap":return new cye(p);case"hillshade":return new hye(p);case"line":return new Zye(p);case"raster":return new w_e(p);case"symbol":return new Jb(p)}},o.aB=X,o.aC=function(p,h){if(!p)return[{command:"setStyle",args:[h]}];let v=[];try{if(!nt(p.version,h.version))return[{command:"setStyle",args:[h]}];nt(p.center,h.center)||v.push({command:"setCenter",args:[h.center]}),nt(p.zoom,h.zoom)||v.push({command:"setZoom",args:[h.zoom]}),nt(p.bearing,h.bearing)||v.push({command:"setBearing",args:[h.bearing]}),nt(p.pitch,h.pitch)||v.push({command:"setPitch",args:[h.pitch]}),nt(p.sprite,h.sprite)||v.push({command:"setSprite",args:[h.sprite]}),nt(p.glyphs,h.glyphs)||v.push({command:"setGlyphs",args:[h.glyphs]}),nt(p.transition,h.transition)||v.push({command:"setTransition",args:[h.transition]}),nt(p.light,h.light)||v.push({command:"setLight",args:[h.light]}),nt(p.terrain,h.terrain)||v.push({command:"setTerrain",args:[h.terrain]}),nt(p.sky,h.sky)||v.push({command:"setSky",args:[h.sky]}),nt(p.projection,h.projection)||v.push({command:"setProjection",args:[h.projection]});const b={},E=[];(function(k,R,z,G){let W;for(W in R=R||{},k=k||{})Object.prototype.hasOwnProperty.call(k,W)&&(Object.prototype.hasOwnProperty.call(R,W)||Ar(W,z,G));for(W in R)Object.prototype.hasOwnProperty.call(R,W)&&(Object.prototype.hasOwnProperty.call(k,W)?nt(k[W],R[W])||(k[W].type==="geojson"&&R[W].type==="geojson"&&fi(k,R,W)?Nr(z,{command:"setGeoJSONSourceData",args:[W,R[W].data]}):zn(W,R,z,G)):br(W,R,z))})(p.sources,h.sources,E,b);const I=[];p.layers&&p.layers.forEach(k=>{"source"in k&&b[k.source]?v.push({command:"removeLayer",args:[k.id]}):I.push(k)}),v=v.concat(E),function(k,R,z){R=R||[];const G=(k=k||[]).map(si),W=R.map(si),j=k.reduce(Tt,{}),ee=R.reduce(Tt,{}),ne=G.slice(),se=Object.create(null);let ce,ye,we,Oe,Ae;for(let Re=0,He=0;Re<G.length;Re++)ce=G[Re],Object.prototype.hasOwnProperty.call(ee,ce)?He++:(Nr(z,{command:"removeLayer",args:[ce]}),ne.splice(ne.indexOf(ce,He),1));for(let Re=0,He=0;Re<W.length;Re++)ce=W[W.length-1-Re],ne[ne.length-1-Re]!==ce&&(Object.prototype.hasOwnProperty.call(j,ce)?(Nr(z,{command:"removeLayer",args:[ce]}),ne.splice(ne.lastIndexOf(ce,ne.length-He),1)):He++,Oe=ne[ne.length-Re],Nr(z,{command:"addLayer",args:[ee[ce],Oe]}),ne.splice(ne.length-Re,0,ce),se[ce]=!0);for(let Re=0;Re<W.length;Re++)if(ce=W[Re],ye=j[ce],we=ee[ce],!se[ce]&&!nt(ye,we))if(nt(ye.source,we.source)&&nt(ye["source-layer"],we["source-layer"])&&nt(ye.type,we.type)){for(Ae in kn(ye.layout,we.layout,z,ce,null,"setLayoutProperty"),kn(ye.paint,we.paint,z,ce,null,"setPaintProperty"),nt(ye.filter,we.filter)||Nr(z,{command:"setFilter",args:[ce,we.filter]}),nt(ye.minzoom,we.minzoom)&&nt(ye.maxzoom,we.maxzoom)||Nr(z,{command:"setLayerZoomRange",args:[ce,we.minzoom,we.maxzoom]}),ye)Object.prototype.hasOwnProperty.call(ye,Ae)&&Ae!=="layout"&&Ae!=="paint"&&Ae!=="filter"&&Ae!=="metadata"&&Ae!=="minzoom"&&Ae!=="maxzoom"&&(Ae.indexOf("paint.")===0?kn(ye[Ae],we[Ae],z,ce,Ae.slice(6),"setPaintProperty"):nt(ye[Ae],we[Ae])||Nr(z,{command:"setLayerProperty",args:[ce,Ae,we[Ae]]}));for(Ae in we)Object.prototype.hasOwnProperty.call(we,Ae)&&!Object.prototype.hasOwnProperty.call(ye,Ae)&&Ae!=="layout"&&Ae!=="paint"&&Ae!=="filter"&&Ae!=="metadata"&&Ae!=="minzoom"&&Ae!=="maxzoom"&&(Ae.indexOf("paint.")===0?kn(ye[Ae],we[Ae],z,ce,Ae.slice(6),"setPaintProperty"):nt(ye[Ae],we[Ae])||Nr(z,{command:"setLayerProperty",args:[ce,Ae,we[Ae]]}))}else Nr(z,{command:"removeLayer",args:[ce]}),Oe=ne[ne.lastIndexOf(ce)+1],Nr(z,{command:"addLayer",args:[we,Oe]})}(I,h.layers,v)}catch(b){console.warn("Unable to compute style diff:",b),v=[{command:"setStyle",args:[h]}]}return v},o.aD=function(p){const h=[],v=p.id;return v===void 0&&h.push({message:`layers.${v}: missing required property "id"`}),p.render===void 0&&h.push({message:`layers.${v}: missing required method "render"`}),p.renderingMode&&p.renderingMode!=="2d"&&p.renderingMode!=="3d"&&h.push({message:`layers.${v}: property "renderingMode" must be either "2d" or "3d"`}),h},o.aE=function p(h,v){if(Array.isArray(h)){if(!Array.isArray(v)||h.length!==v.length)return!1;for(let b=0;b<h.length;b++)if(!p(h[b],v[b]))return!1;return!0}if(typeof h=="object"&&h!==null&&v!==null){if(typeof v!="object"||Object.keys(h).length!==Object.keys(v).length)return!1;for(const b in h)if(!p(h[b],v[b]))return!1;return!0}return h===v},o.aF=Z,o.aG=Y,o.aH=class extends kh{constructor(p,h){super(p,h),this.current=0}set(p){this.current!==p&&(this.current=p,this.gl.uniform1i(this.location,p))}},o.aI=Vb,o.aJ=class extends kh{constructor(p,h){super(p,h),this.current=Qme}set(p){if(p[12]!==this.current[12]||p[0]!==this.current[0])return this.current=p,void this.gl.uniformMatrix4fv(this.location,!1,p);for(let h=1;h<16;h++)if(p[h]!==this.current[h]){this.current=p,this.gl.uniformMatrix4fv(this.location,!1,p);break}}},o.aK=H$,o.aL=W$,o.aM=Xr,o.aN=class extends kh{constructor(p,h){super(p,h),this.current=[0,0,0]}set(p){p[0]===this.current[0]&&p[1]===this.current[1]&&p[2]===this.current[2]||(this.current=p,this.gl.uniform3f(this.location,p[0],p[1],p[2]))}},o.aO=class extends kh{constructor(p,h){super(p,h),this.current=[0,0]}set(p){p[0]===this.current[0]&&p[1]===this.current[1]||(this.current=p,this.gl.uniform2f(this.location,p[0],p[1]))}},o.aP=function(p,h,v,b,E,I,k){var R=1/(h-v),z=1/(b-E),G=1/(I-k);return p[0]=-2*R,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=-2*z,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=2*G,p[11]=0,p[12]=(h+v)*R,p[13]=(E+b)*z,p[14]=(k+I)*G,p[15]=1,p},o.aQ=oye,o.aR=class extends Ie{},o.aS=Kye,o.aT=class extends Ve{},o.aU=HA,o.aV=function(p){return p<=1?1:Math.pow(2,Math.ceil(Math.log(p)/Math.LN2))},o.aW=o6,o.aX=mi,o.aY=Xa,o.aZ=class extends zt{},o.a_=function(p,h){return p[0]===h[0]&&p[1]===h[1]&&p[2]===h[2]&&p[3]===h[3]&&p[4]===h[4]&&p[5]===h[5]&&p[6]===h[6]&&p[7]===h[7]&&p[8]===h[8]&&p[9]===h[9]&&p[10]===h[10]&&p[11]===h[11]&&p[12]===h[12]&&p[13]===h[13]&&p[14]===h[14]&&p[15]===h[15]},o.aa=function(p){const h={};if(p.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(v,b,E,I)=>{const k=E||I;return h[b]=!k||k.toLowerCase(),""}),h["max-age"]){const v=parseInt(h["max-age"],10);isNaN(v)?delete h["max-age"]:h["max-age"]=v}return h},o.ab=function(p,h){const v=[];for(const b in p)b in h||v.push(b);return v},o.ac=F,o.ad=function(p,h,v){var b=Math.sin(v),E=Math.cos(v),I=h[0],k=h[1],R=h[2],z=h[3],G=h[4],W=h[5],j=h[6],ee=h[7];return h!==p&&(p[8]=h[8],p[9]=h[9],p[10]=h[10],p[11]=h[11],p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15]),p[0]=I*E+G*b,p[1]=k*E+W*b,p[2]=R*E+j*b,p[3]=z*E+ee*b,p[4]=G*E-I*b,p[5]=W*E-k*b,p[6]=j*E-R*b,p[7]=ee*E-z*b,p},o.ae=function(p){var h=new Uf(16);return h[0]=p[0],h[1]=p[1],h[2]=p[2],h[3]=p[3],h[4]=p[4],h[5]=p[5],h[6]=p[6],h[7]=p[7],h[8]=p[8],h[9]=p[9],h[10]=p[10],h[11]=p[11],h[12]=p[12],h[13]=p[13],h[14]=p[14],h[15]=p[15],h},o.af=Ub,o.ag=function(p,h){let v=0,b=0;if(p.kind==="constant")b=p.layoutSize;else if(p.kind!=="source"){const{interpolationType:E,minZoom:I,maxZoom:k}=p,R=E?F(Gi.interpolationFactor(E,h,I,k),0,1):0;p.kind==="camera"?b=$i.number(p.minSize,p.maxSize,R):v=R}return{uSizeT:v,uSize:b}},o.ai=function(p,{uSize:h,uSizeT:v},{lowerSize:b,upperSize:E}){return p.kind==="source"?b/ks:p.kind==="composite"?$i.number(b/ks,E/ks,v):h},o.aj=oD,o.ak=function(p,h,v,b){const E=h.y-p.y,I=h.x-p.x,k=b.y-v.y,R=b.x-v.x,z=k*I-R*E;if(z===0)return null;const G=(R*(p.y-v.y)-k*(p.x-v.x))/z;return new f(p.x+G*I,p.y+G*E)},o.al=sG,o.am=X$,o.an=$A,o.ao=function(p){let h=1/0,v=1/0,b=-1/0,E=-1/0;for(const I of p)h=Math.min(h,I.x),v=Math.min(v,I.y),b=Math.max(b,I.x),E=Math.max(E,I.y);return[h,v,b,E]},o.ap=Zn,o.ar=aD,o.as=function(p,h){var v=h[0],b=h[1],E=h[2],I=h[3],k=h[4],R=h[5],z=h[6],G=h[7],W=h[8],j=h[9],ee=h[10],ne=h[11],se=h[12],ce=h[13],ye=h[14],we=h[15],Oe=v*R-b*k,Ae=v*z-E*k,Re=v*G-I*k,He=b*z-E*R,et=b*G-I*R,Ct=E*G-I*z,Yt=W*ce-j*se,xt=W*ye-ee*se,_t=W*we-ne*se,Gt=j*ye-ee*ce,Rt=j*we-ne*ce,It=ee*we-ne*ye,Ye=Oe*It-Ae*Rt+Re*Gt+He*_t-et*xt+Ct*Yt;return Ye?(p[0]=(R*It-z*Rt+G*Gt)*(Ye=1/Ye),p[1]=(E*Rt-b*It-I*Gt)*Ye,p[2]=(ce*Ct-ye*et+we*He)*Ye,p[3]=(ee*et-j*Ct-ne*He)*Ye,p[4]=(z*_t-k*It-G*xt)*Ye,p[5]=(v*It-E*_t+I*xt)*Ye,p[6]=(ye*Re-se*Ct-we*Ae)*Ye,p[7]=(W*Ct-ee*Re+ne*Ae)*Ye,p[8]=(k*Rt-R*_t+G*Yt)*Ye,p[9]=(b*_t-v*Rt-I*Yt)*Ye,p[10]=(se*et-ce*Re+we*Oe)*Ye,p[11]=(j*Re-W*et-ne*Oe)*Ye,p[12]=(R*xt-k*Gt-z*Yt)*Ye,p[13]=(v*Gt-b*xt+E*Yt)*Ye,p[14]=(ce*Ae-se*He-ye*Oe)*Ye,p[15]=(W*He-j*Ae+ee*Oe)*Ye,p):null},o.at=pD,o.au=iD,o.av=gD,o.aw=function(){const p={},h=Le.$version;for(const v in Le.$root){const b=Le.$root[v];if(b.required){let E=null;E=v==="version"?h:b.type==="array"?[]:{},E!=null&&(p[v]=E)}}return p},o.ax=qv,o.ay=Qe,o.az=function(p){p=p.slice();const h=Object.create(null);for(let v=0;v<p.length;v++)h[p[v].id]=p[v];for(let v=0;v<p.length;v++)"ref"in p[v]&&(p[v]=yn(p[v],h[p[v].ref]));return p},o.b=pe,o.b0=function(p,h){return p[0]=h[0],p[1]=h[1],p[2]=h[2],p[3]=h[3],p[4]=h[4],p[5]=h[5],p[6]=h[6],p[7]=h[7],p[8]=h[8],p[9]=h[9],p[10]=h[10],p[11]=h[11],p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15],p},o.b1=function(p,h,v){return p[0]=h[0]*v[0],p[1]=h[1]*v[1],p[2]=h[2]*v[2],p[3]=h[3]*v[3],p},o.b2=function(p,h){return p[0]*h[0]+p[1]*h[1]+p[2]*h[2]+p[3]*h[3]},o.b3=V,o.b4=eG,o.b5=J6,o.b6=function(p,h,v,b,E){var I,k=1/Math.tan(h/2);return p[0]=k/v,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=k,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=-1,p[12]=0,p[13]=0,p[15]=0,E!=null&&E!==1/0?(p[10]=(E+b)*(I=1/(b-E)),p[14]=2*E*b*I):(p[10]=-1,p[14]=-2*b),p},o.b7=function(p,h,v){var b=Math.sin(v),E=Math.cos(v),I=h[4],k=h[5],R=h[6],z=h[7],G=h[8],W=h[9],j=h[10],ee=h[11];return h!==p&&(p[0]=h[0],p[1]=h[1],p[2]=h[2],p[3]=h[3],p[12]=h[12],p[13]=h[13],p[14]=h[14],p[15]=h[15]),p[4]=I*E+G*b,p[5]=k*E+W*b,p[6]=R*E+j*b,p[7]=z*E+ee*b,p[8]=G*E-I*b,p[9]=W*E-k*b,p[10]=j*E-R*b,p[11]=ee*E-z*b,p},o.b8=L,o.b9=O,o.bA=C6,o.bB=function(p){return p.message===Xe},o.bC=bc,o.bD=fa,o.ba=function(p){return p*Math.PI/180},o.bb=function(p,h){const{x:v,y:b}=dm.fromLngLat(h);return!(p<0||p>25||b<0||b>=1||v<0||v>=1)},o.bc=function(p,h){return p[0]=h[0],p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=h[1],p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=h[2],p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p},o.bd=class extends q{},o.be=uD,o.bf=P_e,o.bh=dt,o.bi=function(p,h){at.REGISTERED_PROTOCOLS[p]=h},o.bj=function(p){delete at.REGISTERED_PROTOCOLS[p]},o.bk=function(p,h){const v={};for(let E=0;E<p.length;E++){const I=h&&h[p[E].id]||Ab(p[E]);h&&(h[p[E].id]=I);let k=v[I];k||(k=v[I]=[]),k.push(p[E])}const b=[];for(const E in v)b.push(v[E]);return b},o.bl=Pt,o.bm=rG,o.bn=iG,o.bo=N6,o.bp=function(p){p.bucket.createArrays(),p.bucket.tilePixelRatio=Fn/(512*p.bucket.overscaling),p.bucket.compareText={},p.bucket.iconsNeedLinear=!1;const h=p.bucket.layers[0],v=h.layout,b=h._unevaluatedLayout._values,E={layoutIconSize:b["icon-size"].possiblyEvaluate(new dn(p.bucket.zoom+1),p.canonical),layoutTextSize:b["text-size"].possiblyEvaluate(new dn(p.bucket.zoom+1),p.canonical),textMaxSize:b["text-size"].possiblyEvaluate(new dn(18))};if(p.bucket.textSizeData.kind==="composite"){const{minZoom:G,maxZoom:W}=p.bucket.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new dn(G),p.canonical),b["text-size"].possiblyEvaluate(new dn(W),p.canonical)]}if(p.bucket.iconSizeData.kind==="composite"){const{minZoom:G,maxZoom:W}=p.bucket.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new dn(G),p.canonical),b["icon-size"].possiblyEvaluate(new dn(W),p.canonical)]}const I=v.get("text-line-height")*Zn,k=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point",R=v.get("text-keep-upright"),z=v.get("text-size");for(const G of p.bucket.features){const W=v.get("text-font").evaluate(G,{},p.canonical).join(","),j=z.evaluate(G,{},p.canonical),ee=E.layoutTextSize.evaluate(G,{},p.canonical),ne=E.layoutIconSize.evaluate(G,{},p.canonical),se={horizontal:{},vertical:void 0},ce=G.text;let ye,we=[0,0];if(ce){const Re=ce.toString(),He=v.get("text-letter-spacing").evaluate(G,{},p.canonical)*Zn,et=IA(Re)?He:0,Ct=v.get("text-anchor").evaluate(G,{},p.canonical),Yt=vG(h,G,p.canonical);if(!Yt){const Rt=v.get("text-radial-offset").evaluate(G,{},p.canonical);we=Rt?gG(Ct,[Rt*Zn,fD]):v.get("text-offset").evaluate(G,{},p.canonical).map(It=>It*Zn)}let xt=k?"center":v.get("text-justify").evaluate(G,{},p.canonical);const _t=v.get("symbol-placement")==="point"?v.get("text-max-width").evaluate(G,{},p.canonical)*Zn:1/0,Gt=()=>{p.bucket.allowVerticalPlacement&&Zv(Re)&&(se.vertical=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,Ct,"left",et,we,o.ah.vertical,!0,ee,j))};if(!k&&Yt){const Rt=new Set;if(xt==="auto")for(let Ye=0;Ye<Yt.values.length;Ye+=2)Rt.add(pD(Yt.values[Ye]));else Rt.add(xt);let It=!1;for(const Ye of Rt)if(!se.horizontal[Ye])if(It)se.horizontal[Ye]=se.horizontal[0];else{const Ut=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,"center",Ye,et,we,o.ah.horizontal,!1,ee,j);Ut&&(se.horizontal[Ye]=Ut,It=Ut.positionedLines.length===1)}Gt()}else{xt==="auto"&&(xt=pD(Ct));const Rt=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,Ct,xt,et,we,o.ah.horizontal,!1,ee,j);Rt&&(se.horizontal[xt]=Rt),Gt(),Zv(Re)&&k&&R&&(se.vertical=Xb(ce,p.glyphMap,p.glyphPositions,p.imagePositions,W,_t,I,Ct,xt,et,we,o.ah.vertical,!1,ee,j))}}let Oe=!1;if(G.icon&&G.icon.name){const Re=p.imageMap[G.icon.name];Re&&(ye=g_e(p.imagePositions[G.icon.name],v.get("icon-offset").evaluate(G,{},p.canonical),v.get("icon-anchor").evaluate(G,{},p.canonical)),Oe=!!Re.sdf,p.bucket.sdfIcons===void 0?p.bucket.sdfIcons=Oe:p.bucket.sdfIcons!==Oe&&oe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Re.pixelRatio!==p.bucket.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(p.bucket.iconsNeedLinear=!0))}const Ae=yG(se.horizontal)||se.vertical;p.bucket.iconsInText=!!Ae&&Ae.iconsInText,(Ae||ye)&&k_e(p.bucket,G,se,ye,p.imageMap,E,ee,ne,we,Oe,p.canonical)}p.showCollisionBoxes&&p.bucket.generateCollisionDebugBuffers()},o.bq=JA,o.br=XA,o.bs=KA,o.bt=zc,o.bu=eD,o.bv=class{constructor(p){this._marks={start:[p.url,"start"].join("#"),end:[p.url,"end"].join("#"),measure:p.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let p=performance.getEntriesByName(this._marks.measure);return p.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),p=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),p}},o.bw=function(p,h,v,b,E){return s(this,void 0,void 0,function*(){if(M())try{return yield Me(p,h,v,b,E)}catch{}return function(I,k,R,z,G){const W=I.width,j=I.height;Be&&Fe||(Be=new OffscreenCanvas(W,j),Fe=Be.getContext("2d",{willReadFrequently:!0})),Be.width=W,Be.height=j,Fe.drawImage(I,0,0,W,j);const ee=Fe.getImageData(k,R,z,G);return Fe.clearRect(0,0,W,j),ee.data}(p,h,v,b,E)})},o.bx=tG,o.by=l,o.bz=c,o.c=it,o.d=p=>s(void 0,void 0,void 0,function*(){if(p.byteLength===0)return createImageBitmap(new ImageData(1,1));const h=new Blob([new Uint8Array(p)],{type:"image/png"});try{return createImageBitmap(h)}catch(v){throw new Error(`Could not load image because of ${v.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),o.e=U,o.f=p=>new Promise((h,v)=>{const b=new Image;b.onload=()=>{h(b),URL.revokeObjectURL(b.src),b.onload=null,window.requestAnimationFrame(()=>{b.src=me})},b.onerror=()=>v(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 E=new Blob([new Uint8Array(p)],{type:"image/png"});b.src=p.byteLength?URL.createObjectURL(E):me}),o.g=ht,o.h=(p,h)=>Dt(U(p,{type:"json"}),h),o.i=de,o.j=kt,o.k=tt,o.l=(p,h)=>Dt(U(p,{type:"arrayBuffer"}),h),o.m=Dt,o.n=function(p){return new eD(p).readFields(l_e,[])},o.o=rm,o.p=R6,o.q=D,o.r=DA,o.s=wt,o.t=Hv,o.u=ml,o.v=Le,o.w=oe,o.x=function([p,h,v]){return h+=90,h*=Math.PI/180,v*=Math.PI/180,{x:p*Math.cos(h)*Math.sin(v),y:p*Math.sin(h)*Math.sin(v),z:p*Math.cos(v)}},o.y=$i,o.z=dn}),i("worker",["./shared"],function(o){class s{constructor(re){this.keyCache={},re&&this.replace(re)}replace(re){this._layerConfigs={},this._layers={},this.update(re,[])}update(re,te){for(const _e of re){this._layerConfigs[_e.id]=_e;const De=this._layers[_e.id]=o.aA(_e);De._featureFilter=o.a7(De.filter),this.keyCache[_e.id]&&delete this.keyCache[_e.id]}for(const _e of te)delete this.keyCache[_e],delete this._layerConfigs[_e],delete this._layers[_e];this.familiesBySource={};const he=o.bk(Object.values(this._layerConfigs),this.keyCache);for(const _e of he){const De=_e.map(Ge=>this._layers[Ge.id]),ke=De[0];if(ke.visibility==="none")continue;const Ne=ke.source||"";let Ee=this.familiesBySource[Ne];Ee||(Ee=this.familiesBySource[Ne]={});const We=ke.sourceLayer||"_geojsonTileLayer";let Je=Ee[We];Je||(Je=Ee[We]=[]),Je.push(De)}}}class l{constructor(re){const te={},he=[];for(const Ne in re){const Ee=re[Ne],We=te[Ne]={};for(const Je in Ee){const Ge=Ee[+Je];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const ft={x:0,y:0,w:Ge.bitmap.width+2,h:Ge.bitmap.height+2};he.push(ft),We[Je]={rect:ft,metrics:Ge.metrics}}}const{w:_e,h:De}=o.p(he),ke=new o.o({width:_e||1,height:De||1});for(const Ne in re){const Ee=re[Ne];for(const We in Ee){const Je=Ee[+We];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const Ge=te[Ne][We].rect;o.o.copy(Je.bitmap,ke,{x:0,y:0},{x:Ge.x+1,y:Ge.y+1},Je.bitmap)}}this.image=ke,this.positions=te}}o.bl("GlyphAtlas",l);class c{constructor(re){this.tileID=new o.S(re.tileID.overscaledZ,re.tileID.wrap,re.tileID.canonical.z,re.tileID.canonical.x,re.tileID.canonical.y),this.uid=re.uid,this.zoom=re.zoom,this.pixelRatio=re.pixelRatio,this.tileSize=re.tileSize,this.source=re.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=re.showCollisionBoxes,this.collectResourceTiming=!!re.collectResourceTiming,this.returnDependencies=!!re.returnDependencies,this.promoteId=re.promoteId,this.inFlightDependencies=[]}parse(re,te,he,_e){return o._(this,void 0,void 0,function*(){this.status="parsing",this.data=re,this.collisionBoxArray=new o.a5;const De=new o.bm(Object.keys(re.layers).sort()),ke=new o.bn(this.tileID,this.promoteId);ke.bucketLayerIDs=[];const Ne={},Ee={featureIndex:ke,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:he},We=te.familiesBySource[this.source];for(const xr in We){const jr=re.layers[xr];if(!jr)continue;jr.version===1&&o.w(`Vector tile source "${this.source}" layer "${xr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _n=De.encode(xr),Yn=[];for(let li=0;li<jr.length;li++){const Ii=jr.feature(li),cc=ke.getId(Ii,xr);Yn.push({feature:Ii,id:cc,index:li,sourceLayerIndex:_n})}for(const li of We[xr]){const Ii=li[0];Ii.source!==this.source&&o.w(`layer.source = ${Ii.source} does not equal this.source = ${this.source}`),Ii.minzoom&&this.zoom<Math.floor(Ii.minzoom)||Ii.maxzoom&&this.zoom>=Ii.maxzoom||Ii.visibility!=="none"&&(d(li,this.zoom,he),(Ne[Ii.id]=Ii.createBucket({index:ke.bucketLayerIDs.length,layers:li,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_n,sourceID:this.source})).populate(Yn,Ee,this.tileID.canonical),ke.bucketLayerIDs.push(li.map(cc=>cc.id)))}}const Je=o.aF(Ee.glyphDependencies,xr=>Object.keys(xr).map(Number));this.inFlightDependencies.forEach(xr=>xr==null?void 0:xr.abort()),this.inFlightDependencies=[];let Ge=Promise.resolve({});if(Object.keys(Je).length){const xr=new AbortController;this.inFlightDependencies.push(xr),Ge=_e.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},xr)}const ft=Object.keys(Ee.iconDependencies);let Wt=Promise.resolve({});if(ft.length){const xr=new AbortController;this.inFlightDependencies.push(xr),Wt=_e.sendAsync({type:"GI",data:{icons:ft,source:this.source,tileID:this.tileID,type:"icons"}},xr)}const Xt=Object.keys(Ee.patternDependencies);let Or=Promise.resolve({});if(Xt.length){const xr=new AbortController;this.inFlightDependencies.push(xr),Or=_e.sendAsync({type:"GI",data:{icons:Xt,source:this.source,tileID:this.tileID,type:"patterns"}},xr)}const[dr,zr,Dr]=yield Promise.all([Ge,Wt,Or]),Bn=new l(dr),Sn=new o.bo(zr,Dr);for(const xr in Ne){const jr=Ne[xr];jr instanceof o.a6?(d(jr.layers,this.zoom,he),o.bp({bucket:jr,glyphMap:dr,glyphPositions:Bn.positions,imageMap:zr,imagePositions:Sn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):jr.hasPattern&&(jr instanceof o.bq||jr instanceof o.br||jr instanceof o.bs)&&(d(jr.layers,this.zoom,he),jr.addFeatures(Ee,this.tileID.canonical,Sn.patternPositions))}return this.status="done",{buckets:Object.values(Ne).filter(xr=>!xr.isEmpty()),featureIndex:ke,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Bn.image,imageAtlas:Sn,glyphMap:this.returnDependencies?dr:null,iconMap:this.returnDependencies?zr:null,glyphPositions:this.returnDependencies?Bn.positions:null}})}}function d(xe,re,te){const he=new o.z(re);for(const _e of xe)_e.recalculate(he,te)}class f{constructor(re,te,he){this.actor=re,this.layerIndex=te,this.availableImages=he,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(re,te){return o._(this,void 0,void 0,function*(){const he=yield o.l(re.request,te);try{return{vectorTile:new o.bt.VectorTile(new o.bu(he.data)),rawData:he.data,cacheControl:he.cacheControl,expires:he.expires}}catch(_e){const De=new Uint8Array(he.data);let ke=`Unable to parse the tile at ${re.request.url}, `;throw ke+=De[0]===31&&De[1]===139?"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(ke)}})}loadTile(re){return o._(this,void 0,void 0,function*(){const te=re.uid,he=!!(re&&re.request&&re.request.collectResourceTiming)&&new o.bv(re.request),_e=new c(re);this.loading[te]=_e;const De=new AbortController;_e.abort=De;try{const ke=yield this.loadVectorTile(re,De);if(delete this.loading[te],!ke)return null;const Ne=ke.rawData,Ee={};ke.expires&&(Ee.expires=ke.expires),ke.cacheControl&&(Ee.cacheControl=ke.cacheControl);const We={};if(he){const Ge=he.finish();Ge&&(We.resourceTiming=JSON.parse(JSON.stringify(Ge)))}_e.vectorTile=ke.vectorTile;const Je=_e.parse(ke.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[te]=_e,this.fetching[te]={rawTileData:Ne,cacheControl:Ee,resourceTiming:We};try{const Ge=yield Je;return o.e({rawTileData:Ne.slice(0)},Ge,Ee,We)}finally{delete this.fetching[te]}}catch(ke){throw delete this.loading[te],_e.status="done",this.loaded[te]=_e,ke}})}reloadTile(re){return o._(this,void 0,void 0,function*(){const te=re.uid;if(!this.loaded||!this.loaded[te])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const he=this.loaded[te];if(he.showCollisionBoxes=re.showCollisionBoxes,he.status==="parsing"){const _e=yield he.parse(he.vectorTile,this.layerIndex,this.availableImages,this.actor);let De;if(this.fetching[te]){const{rawTileData:ke,cacheControl:Ne,resourceTiming:Ee}=this.fetching[te];delete this.fetching[te],De=o.e({rawTileData:ke.slice(0)},_e,Ne,Ee)}else De=_e;return De}if(he.status==="done"&&he.vectorTile)return he.parse(he.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(re){return o._(this,void 0,void 0,function*(){const te=this.loading,he=re.uid;te&&te[he]&&te[he].abort&&(te[he].abort.abort(),delete te[he])})}removeTile(re){return o._(this,void 0,void 0,function*(){this.loaded&&this.loaded[re.uid]&&delete this.loaded[re.uid]})}}class g{constructor(){this.loaded={}}loadTile(re){return o._(this,void 0,void 0,function*(){const{uid:te,encoding:he,rawImageData:_e,redFactor:De,greenFactor:ke,blueFactor:Ne,baseShift:Ee}=re,We=_e.width+2,Je=_e.height+2,Ge=o.b(_e)?new o.R({width:We,height:Je},yield o.bw(_e,-1,-1,We,Je)):_e,ft=new o.bx(te,Ge,he,De,ke,Ne,Ee);return this.loaded=this.loaded||{},this.loaded[te]=ft,ft})}removeTile(re){const te=this.loaded,he=re.uid;te&&te[he]&&delete te[he]}}function m(xe,re){if(xe.length!==0){_(xe[0],re);for(var te=1;te<xe.length;te++)_(xe[te],!re)}}function _(xe,re){for(var te=0,he=0,_e=0,De=xe.length,ke=De-1;_e<De;ke=_e++){var Ne=(xe[_e][0]-xe[ke][0])*(xe[ke][1]+xe[_e][1]),Ee=te+Ne;he+=Math.abs(te)>=Math.abs(Ne)?te-Ee+Ne:Ne-Ee+te,te=Ee}te+he>=0!=!!re&&xe.reverse()}var x=o.by(function xe(re,te){var he,_e=re&&re.type;if(_e==="FeatureCollection")for(he=0;he<re.features.length;he++)xe(re.features[he],te);else if(_e==="GeometryCollection")for(he=0;he<re.geometries.length;he++)xe(re.geometries[he],te);else if(_e==="Feature")xe(re.geometry,te);else if(_e==="Polygon")m(re.coordinates,te);else if(_e==="MultiPolygon")for(he=0;he<re.coordinates.length;he++)m(re.coordinates[he],te);return re});const w=o.bt.VectorTileFeature.prototype.toGeoJSON;var C={exports:{}},M=o.bz,L=o.bt.VectorTileFeature,O=F;function F(xe,re){this.options=re||{},this.features=xe,this.length=xe.length}function V(xe,re){this.id=typeof xe.id=="number"?xe.id:void 0,this.type=xe.type,this.rawGeometry=xe.type===1?[xe.geometry]:xe.geometry,this.properties=xe.tags,this.extent=re||4096}F.prototype.feature=function(xe){return new V(this.features[xe],this.options.extent)},V.prototype.loadGeometry=function(){var xe=this.rawGeometry;this.geometry=[];for(var re=0;re<xe.length;re++){for(var te=xe[re],he=[],_e=0;_e<te.length;_e++)he.push(new M(te[_e][0],te[_e][1]));this.geometry.push(he)}return this.geometry},V.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var xe=this.geometry,re=1/0,te=-1/0,he=1/0,_e=-1/0,De=0;De<xe.length;De++)for(var ke=xe[De],Ne=0;Ne<ke.length;Ne++){var Ee=ke[Ne];re=Math.min(re,Ee.x),te=Math.max(te,Ee.x),he=Math.min(he,Ee.y),_e=Math.max(_e,Ee.y)}return[re,he,te,_e]},V.prototype.toGeoJSON=L.prototype.toGeoJSON;var U=o.bA,H=O;function Z(xe){var re=new U;return function(te,he){for(var _e in te.layers)he.writeMessage(3,Y,te.layers[_e])}(xe,re),re.finish()}function Y(xe,re){var te;re.writeVarintField(15,xe.version||1),re.writeStringField(1,xe.name||""),re.writeVarintField(5,xe.extent||4096);var he={keys:[],values:[],keycache:{},valuecache:{}};for(te=0;te<xe.length;te++)he.feature=xe.feature(te),re.writeMessage(2,X,he);var _e=he.keys;for(te=0;te<_e.length;te++)re.writeStringField(3,_e[te]);var De=he.values;for(te=0;te<De.length;te++)re.writeMessage(4,ge,De[te])}function X(xe,re){var te=xe.feature;te.id!==void 0&&re.writeVarintField(1,te.id),re.writeMessage(2,ie,xe),re.writeVarintField(3,te.type),re.writeMessage(4,de,te)}function ie(xe,re){var te=xe.feature,he=xe.keys,_e=xe.values,De=xe.keycache,ke=xe.valuecache;for(var Ne in te.properties){var Ee=te.properties[Ne],We=De[Ne];if(Ee!==null){We===void 0&&(he.push(Ne),De[Ne]=We=he.length-1),re.writeVarint(We);var Je=typeof Ee;Je!=="string"&&Je!=="boolean"&&Je!=="number"&&(Ee=JSON.stringify(Ee));var Ge=Je+":"+Ee,ft=ke[Ge];ft===void 0&&(_e.push(Ee),ke[Ge]=ft=_e.length-1),re.writeVarint(ft)}}}function oe(xe,re){return(re<<3)+(7&xe)}function le(xe){return xe<<1^xe>>31}function de(xe,re){for(var te=xe.loadGeometry(),he=xe.type,_e=0,De=0,ke=te.length,Ne=0;Ne<ke;Ne++){var Ee=te[Ne],We=1;he===1&&(We=Ee.length),re.writeVarint(oe(1,We));for(var Je=he===3?Ee.length-1:Ee.length,Ge=0;Ge<Je;Ge++){Ge===1&&he!==1&&re.writeVarint(oe(2,Je-1));var ft=Ee[Ge].x-_e,Wt=Ee[Ge].y-De;re.writeVarint(le(ft)),re.writeVarint(le(Wt)),_e+=ft,De+=Wt}he===3&&re.writeVarint(oe(7,1))}}function ge(xe,re){var te=typeof xe;te==="string"?re.writeStringField(1,xe):te==="boolean"?re.writeBooleanField(7,xe):te==="number"&&(xe%1!=0?re.writeDoubleField(3,xe):xe<0?re.writeSVarintField(6,xe):re.writeVarintField(5,xe))}C.exports=Z,C.exports.fromVectorTileJs=Z,C.exports.fromGeojsonVt=function(xe,re){re=re||{};var te={};for(var he in xe)te[he]=new H(xe[he].features,re),te[he].name=he,te[he].version=re.version,te[he].extent=re.extent;return Z({layers:te})},C.exports.GeoJSONWrapper=H;var pe=o.by(C.exports);const me={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:xe=>xe},Me=Math.fround||(Be=new Float32Array(1),xe=>(Be[0]=+xe,Be[0]));var Be;const Fe=3,Xe=5,it=6;class at{constructor(re){this.options=Object.assign(Object.create(me),re),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(re){const{log:te,minZoom:he,maxZoom:_e}=this.options;te&&console.time("total time");const De=`prepare ${re.length} points`;te&&console.time(De),this.points=re;const ke=[];for(let Ee=0;Ee<re.length;Ee++){const We=re[Ee];if(!We.geometry)continue;const[Je,Ge]=We.geometry.coordinates,ft=Me(dt(Je)),Wt=Me(Qe(Ge));ke.push(ft,Wt,1/0,Ee,-1,1),this.options.reduce&&ke.push(0)}let Ne=this.trees[_e+1]=this._createTree(ke);te&&console.timeEnd(De);for(let Ee=_e;Ee>=he;Ee--){const We=+Date.now();Ne=this.trees[Ee]=this._createTree(this._cluster(Ne,Ee)),te&&console.log("z%d: %d clusters in %dms",Ee,Ne.numItems,+Date.now()-We)}return te&&console.timeEnd("total time"),this}getClusters(re,te){let he=((re[0]+180)%360+360)%360-180;const _e=Math.max(-90,Math.min(90,re[1]));let De=re[2]===180?180:((re[2]+180)%360+360)%360-180;const ke=Math.max(-90,Math.min(90,re[3]));if(re[2]-re[0]>=360)he=-180,De=180;else if(he>De){const Ge=this.getClusters([he,_e,180,ke],te),ft=this.getClusters([-180,_e,De,ke],te);return Ge.concat(ft)}const Ne=this.trees[this._limitZoom(te)],Ee=Ne.range(dt(he),Qe(ke),dt(De),Qe(_e)),We=Ne.data,Je=[];for(const Ge of Ee){const ft=this.stride*Ge;Je.push(We[ft+Xe]>1?ht(We,ft,this.clusterProps):this.points[We[ft+Fe]])}return Je}getChildren(re){const te=this._getOriginId(re),he=this._getOriginZoom(re),_e="No cluster with the specified id.",De=this.trees[he];if(!De)throw new Error(_e);const ke=De.data;if(te*this.stride>=ke.length)throw new Error(_e);const Ne=this.options.radius/(this.options.extent*Math.pow(2,he-1)),Ee=De.within(ke[te*this.stride],ke[te*this.stride+1],Ne),We=[];for(const Je of Ee){const Ge=Je*this.stride;ke[Ge+4]===re&&We.push(ke[Ge+Xe]>1?ht(ke,Ge,this.clusterProps):this.points[ke[Ge+Fe]])}if(We.length===0)throw new Error(_e);return We}getLeaves(re,te,he){const _e=[];return this._appendLeaves(_e,re,te=te||10,he=he||0,0),_e}getTile(re,te,he){const _e=this.trees[this._limitZoom(re)],De=Math.pow(2,re),{extent:ke,radius:Ne}=this.options,Ee=Ne/ke,We=(he-Ee)/De,Je=(he+1+Ee)/De,Ge={features:[]};return this._addTileFeatures(_e.range((te-Ee)/De,We,(te+1+Ee)/De,Je),_e.data,te,he,De,Ge),te===0&&this._addTileFeatures(_e.range(1-Ee/De,We,1,Je),_e.data,De,he,De,Ge),te===De-1&&this._addTileFeatures(_e.range(0,We,Ee/De,Je),_e.data,-1,he,De,Ge),Ge.features.length?Ge:null}getClusterExpansionZoom(re){let te=this._getOriginZoom(re)-1;for(;te<=this.options.maxZoom;){const he=this.getChildren(re);if(te++,he.length!==1)break;re=he[0].properties.cluster_id}return te}_appendLeaves(re,te,he,_e,De){const ke=this.getChildren(te);for(const Ne of ke){const Ee=Ne.properties;if(Ee&&Ee.cluster?De+Ee.point_count<=_e?De+=Ee.point_count:De=this._appendLeaves(re,Ee.cluster_id,he,_e,De):De<_e?De++:re.push(Ne),re.length===he)break}return De}_createTree(re){const te=new o.av(re.length/this.stride|0,this.options.nodeSize,Float32Array);for(let he=0;he<re.length;he+=this.stride)te.add(re[he],re[he+1]);return te.finish(),te.data=re,te}_addTileFeatures(re,te,he,_e,De,ke){for(const Ne of re){const Ee=Ne*this.stride,We=te[Ee+Xe]>1;let Je,Ge,ft;if(We)Je=ct(te,Ee,this.clusterProps),Ge=te[Ee],ft=te[Ee+1];else{const Or=this.points[te[Ee+Fe]];Je=Or.properties;const[dr,zr]=Or.geometry.coordinates;Ge=dt(dr),ft=Qe(zr)}const Wt={type:1,geometry:[[Math.round(this.options.extent*(Ge*De-he)),Math.round(this.options.extent*(ft*De-_e))]],tags:Je};let Xt;Xt=We||this.options.generateId?te[Ee+Fe]:this.points[te[Ee+Fe]].id,Xt!==void 0&&(Wt.id=Xt),ke.features.push(Wt)}}_limitZoom(re){return Math.max(this.options.minZoom,Math.min(Math.floor(+re),this.options.maxZoom+1))}_cluster(re,te){const{radius:he,extent:_e,reduce:De,minPoints:ke}=this.options,Ne=he/(_e*Math.pow(2,te)),Ee=re.data,We=[],Je=this.stride;for(let Ge=0;Ge<Ee.length;Ge+=Je){if(Ee[Ge+2]<=te)continue;Ee[Ge+2]=te;const ft=Ee[Ge],Wt=Ee[Ge+1],Xt=re.within(Ee[Ge],Ee[Ge+1],Ne),Or=Ee[Ge+Xe];let dr=Or;for(const zr of Xt){const Dr=zr*Je;Ee[Dr+2]>te&&(dr+=Ee[Dr+Xe])}if(dr>Or&&dr>=ke){let zr,Dr=ft*Or,Bn=Wt*Or,Sn=-1;const xr=((Ge/Je|0)<<5)+(te+1)+this.points.length;for(const jr of Xt){const _n=jr*Je;if(Ee[_n+2]<=te)continue;Ee[_n+2]=te;const Yn=Ee[_n+Xe];Dr+=Ee[_n]*Yn,Bn+=Ee[_n+1]*Yn,Ee[_n+4]=xr,De&&(zr||(zr=this._map(Ee,Ge,!0),Sn=this.clusterProps.length,this.clusterProps.push(zr)),De(zr,this._map(Ee,_n)))}Ee[Ge+4]=xr,We.push(Dr/dr,Bn/dr,1/0,xr,-1,dr),De&&We.push(Sn)}else{for(let zr=0;zr<Je;zr++)We.push(Ee[Ge+zr]);if(dr>1)for(const zr of Xt){const Dr=zr*Je;if(!(Ee[Dr+2]<=te)){Ee[Dr+2]=te;for(let Bn=0;Bn<Je;Bn++)We.push(Ee[Dr+Bn])}}}}return We}_getOriginId(re){return re-this.points.length>>5}_getOriginZoom(re){return(re-this.points.length)%32}_map(re,te,he){if(re[te+Xe]>1){const ke=this.clusterProps[re[te+it]];return he?Object.assign({},ke):ke}const _e=this.points[re[te+Fe]].properties,De=this.options.map(_e);return he&&De===_e?Object.assign({},De):De}}function ht(xe,re,te){return{type:"Feature",id:xe[re+Fe],properties:ct(xe,re,te),geometry:{type:"Point",coordinates:[(he=xe[re],360*(he-.5)),Dt(xe[re+1])]}};var he}function ct(xe,re,te){const he=xe[re+Xe],_e=he>=1e4?`${Math.round(he/1e3)}k`:he>=1e3?Math.round(he/100)/10+"k":he,De=xe[re+it],ke=De===-1?{}:Object.assign({},te[De]);return Object.assign(ke,{cluster:!0,cluster_id:xe[re+Fe],point_count:he,point_count_abbreviated:_e})}function dt(xe){return xe/360+.5}function Qe(xe){const re=Math.sin(xe*Math.PI/180),te=.5-.25*Math.log((1+re)/(1-re))/Math.PI;return te<0?0:te>1?1:te}function Dt(xe){const re=(180-360*xe)*Math.PI/180;return 360*Math.atan(Math.exp(re))/Math.PI-90}function wt(xe,re,te,he){let _e=he;const De=re+(te-re>>1);let ke,Ne=te-re;const Ee=xe[re],We=xe[re+1],Je=xe[te],Ge=xe[te+1];for(let ft=re+3;ft<te;ft+=3){const Wt=ot(xe[ft],xe[ft+1],Ee,We,Je,Ge);if(Wt>_e)ke=ft,_e=Wt;else if(Wt===_e){const Xt=Math.abs(ft-De);Xt<Ne&&(ke=ft,Ne=Xt)}}_e>he&&(ke-re>3&&wt(xe,re,ke,he),xe[ke+2]=_e,te-ke>3&&wt(xe,ke,te,he))}function ot(xe,re,te,he,_e,De){let ke=_e-te,Ne=De-he;if(ke!==0||Ne!==0){const Ee=((xe-te)*ke+(re-he)*Ne)/(ke*ke+Ne*Ne);Ee>1?(te=_e,he=De):Ee>0&&(te+=ke*Ee,he+=Ne*Ee)}return ke=xe-te,Ne=re-he,ke*ke+Ne*Ne}function St(xe,re,te,he){const _e={id:xe??null,type:re,geometry:te,tags:he,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(re==="Point"||re==="MultiPoint"||re==="LineString")tt(_e,te);else if(re==="Polygon")tt(_e,te[0]);else if(re==="MultiLineString")for(const De of te)tt(_e,De);else if(re==="MultiPolygon")for(const De of te)tt(_e,De[0]);return _e}function tt(xe,re){for(let te=0;te<re.length;te+=3)xe.minX=Math.min(xe.minX,re[te]),xe.minY=Math.min(xe.minY,re[te+1]),xe.maxX=Math.max(xe.maxX,re[te]),xe.maxY=Math.max(xe.maxY,re[te+1])}function kt(xe,re,te,he){if(!re.geometry)return;const _e=re.geometry.coordinates;if(_e&&_e.length===0)return;const De=re.geometry.type,ke=Math.pow(te.tolerance/((1<<te.maxZoom)*te.extent),2);let Ne=[],Ee=re.id;if(te.promoteId?Ee=re.properties[te.promoteId]:te.generateId&&(Ee=he||0),De==="Point")_r(_e,Ne);else if(De==="MultiPoint")for(const We of _e)_r(We,Ne);else if(De==="LineString")Le(_e,Ne,ke,!1);else if(De==="MultiLineString"){if(te.lineMetrics){for(const We of _e)Ne=[],Le(We,Ne,ke,!1),xe.push(St(Ee,"LineString",Ne,re.properties));return}Vr(_e,Ne,ke,!1)}else if(De==="Polygon")Vr(_e,Ne,ke,!0);else{if(De!=="MultiPolygon"){if(De==="GeometryCollection"){for(const We of re.geometry.geometries)kt(xe,{id:Ee,geometry:We,properties:re.properties},te,he);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const We of _e){const Je=[];Vr(We,Je,ke,!0),Ne.push(Je)}}xe.push(St(Ee,De,Ne,re.properties))}function _r(xe,re){re.push(yn(xe[0]),nt(xe[1]),0)}function Le(xe,re,te,he){let _e,De,ke=0;for(let Ee=0;Ee<xe.length;Ee++){const We=yn(xe[Ee][0]),Je=nt(xe[Ee][1]);re.push(We,Je,0),Ee>0&&(ke+=he?(_e*Je-We*De)/2:Math.sqrt(Math.pow(We-_e,2)+Math.pow(Je-De,2))),_e=We,De=Je}const Ne=re.length-3;re[2]=1,wt(re,0,Ne,te),re[Ne+2]=1,re.size=Math.abs(ke),re.start=0,re.end=re.size}function Vr(xe,re,te,he){for(let _e=0;_e<xe.length;_e++){const De=[];Le(xe[_e],De,te,he),re.push(De)}}function yn(xe){return xe/360+.5}function nt(xe){const re=Math.sin(xe*Math.PI/180),te=.5-.25*Math.log((1+re)/(1-re))/Math.PI;return te<0?0:te>1?1:te}function Nr(xe,re,te,he,_e,De,ke,Ne){if(he/=re,De>=(te/=re)&&ke<he)return xe;if(ke<te||De>=he)return null;const Ee=[];for(const We of xe){const Je=We.geometry;let Ge=We.type;const ft=_e===0?We.minX:We.minY,Wt=_e===0?We.maxX:We.maxY;if(ft>=te&&Wt<he){Ee.push(We);continue}if(Wt<te||ft>=he)continue;let Xt=[];if(Ge==="Point"||Ge==="MultiPoint")br(Je,Xt,te,he,_e);else if(Ge==="LineString")Ar(Je,Xt,te,he,_e,!1,Ne.lineMetrics);else if(Ge==="MultiLineString")fi(Je,Xt,te,he,_e,!1);else if(Ge==="Polygon")fi(Je,Xt,te,he,_e,!0);else if(Ge==="MultiPolygon")for(const Or of Je){const dr=[];fi(Or,dr,te,he,_e,!0),dr.length&&Xt.push(dr)}if(Xt.length){if(Ne.lineMetrics&&Ge==="LineString"){for(const Or of Xt)Ee.push(St(We.id,Ge,Or,We.tags));continue}Ge!=="LineString"&&Ge!=="MultiLineString"||(Xt.length===1?(Ge="LineString",Xt=Xt[0]):Ge="MultiLineString"),Ge!=="Point"&&Ge!=="MultiPoint"||(Ge=Xt.length===3?"Point":"MultiPoint"),Ee.push(St(We.id,Ge,Xt,We.tags))}}return Ee.length?Ee:null}function br(xe,re,te,he,_e){for(let De=0;De<xe.length;De+=3){const ke=xe[De+_e];ke>=te&&ke<=he&&kn(re,xe[De],xe[De+1],xe[De+2])}}function Ar(xe,re,te,he,_e,De,ke){let Ne=zn(xe);const Ee=_e===0?si:Tt;let We,Je,Ge=xe.start;for(let dr=0;dr<xe.length-3;dr+=3){const zr=xe[dr],Dr=xe[dr+1],Bn=xe[dr+2],Sn=xe[dr+3],xr=xe[dr+4],jr=_e===0?zr:Dr,_n=_e===0?Sn:xr;let Yn=!1;ke&&(We=Math.sqrt(Math.pow(zr-Sn,2)+Math.pow(Dr-xr,2))),jr<te?_n>te&&(Je=Ee(Ne,zr,Dr,Sn,xr,te),ke&&(Ne.start=Ge+We*Je)):jr>he?_n<he&&(Je=Ee(Ne,zr,Dr,Sn,xr,he),ke&&(Ne.start=Ge+We*Je)):kn(Ne,zr,Dr,Bn),_n<te&&jr>=te&&(Je=Ee(Ne,zr,Dr,Sn,xr,te),Yn=!0),_n>he&&jr<=he&&(Je=Ee(Ne,zr,Dr,Sn,xr,he),Yn=!0),!De&&Yn&&(ke&&(Ne.end=Ge+We*Je),re.push(Ne),Ne=zn(xe)),ke&&(Ge+=We)}let ft=xe.length-3;const Wt=xe[ft],Xt=xe[ft+1],Or=_e===0?Wt:Xt;Or>=te&&Or<=he&&kn(Ne,Wt,Xt,xe[ft+2]),ft=Ne.length-3,De&&ft>=3&&(Ne[ft]!==Ne[0]||Ne[ft+1]!==Ne[1])&&kn(Ne,Ne[0],Ne[1],Ne[2]),Ne.length&&re.push(Ne)}function zn(xe){const re=[];return re.size=xe.size,re.start=xe.start,re.end=xe.end,re}function fi(xe,re,te,he,_e,De){for(const ke of xe)Ar(ke,re,te,he,_e,De,!1)}function kn(xe,re,te,he){xe.push(re,te,he)}function si(xe,re,te,he,_e,De){const ke=(De-re)/(he-re);return kn(xe,De,te+(_e-te)*ke,1),ke}function Tt(xe,re,te,he,_e,De){const ke=(De-te)/(_e-te);return kn(xe,re+(he-re)*ke,De,1),ke}function $e(xe,re){const te=[];for(let he=0;he<xe.length;he++){const _e=xe[he],De=_e.type;let ke;if(De==="Point"||De==="MultiPoint"||De==="LineString")ke=er(_e.geometry,re);else if(De==="MultiLineString"||De==="Polygon"){ke=[];for(const Ne of _e.geometry)ke.push(er(Ne,re))}else if(De==="MultiPolygon"){ke=[];for(const Ne of _e.geometry){const Ee=[];for(const We of Ne)Ee.push(er(We,re));ke.push(Ee)}}te.push(St(_e.id,De,ke,_e.tags))}return te}function er(xe,re){const te=[];te.size=xe.size,xe.start!==void 0&&(te.start=xe.start,te.end=xe.end);for(let he=0;he<xe.length;he+=3)te.push(xe[he]+re,xe[he+1],xe[he+2]);return te}function sr(xe,re){if(xe.transformed)return xe;const te=1<<xe.z,he=xe.x,_e=xe.y;for(const De of xe.features){const ke=De.geometry,Ne=De.type;if(De.geometry=[],Ne===1)for(let Ee=0;Ee<ke.length;Ee+=2)De.geometry.push(Kr(ke[Ee],ke[Ee+1],re,te,he,_e));else for(let Ee=0;Ee<ke.length;Ee++){const We=[];for(let Je=0;Je<ke[Ee].length;Je+=2)We.push(Kr(ke[Ee][Je],ke[Ee][Je+1],re,te,he,_e));De.geometry.push(We)}}return xe.transformed=!0,xe}function Kr(xe,re,te,he,_e,De){return[Math.round(te*(xe*he-_e)),Math.round(te*(re*he-De))]}function Ln(xe,re,te,he,_e){const De=re===_e.maxZoom?0:_e.tolerance/((1<<re)*_e.extent),ke={features:[],numPoints:0,numSimplified:0,numFeatures:xe.length,source:null,x:te,y:he,z:re,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Ne of xe)ut(ke,Ne,De,_e);return ke}function ut(xe,re,te,he){const _e=re.geometry,De=re.type,ke=[];if(xe.minX=Math.min(xe.minX,re.minX),xe.minY=Math.min(xe.minY,re.minY),xe.maxX=Math.max(xe.maxX,re.maxX),xe.maxY=Math.max(xe.maxY,re.maxY),De==="Point"||De==="MultiPoint")for(let Ne=0;Ne<_e.length;Ne+=3)ke.push(_e[Ne],_e[Ne+1]),xe.numPoints++,xe.numSimplified++;else if(De==="LineString")hr(ke,_e,xe,te,!1,!1);else if(De==="MultiLineString"||De==="Polygon")for(let Ne=0;Ne<_e.length;Ne++)hr(ke,_e[Ne],xe,te,De==="Polygon",Ne===0);else if(De==="MultiPolygon")for(let Ne=0;Ne<_e.length;Ne++){const Ee=_e[Ne];for(let We=0;We<Ee.length;We++)hr(ke,Ee[We],xe,te,!0,We===0)}if(ke.length){let Ne=re.tags||null;if(De==="LineString"&&he.lineMetrics){Ne={};for(const We in re.tags)Ne[We]=re.tags[We];Ne.mapbox_clip_start=_e.start/_e.size,Ne.mapbox_clip_end=_e.end/_e.size}const Ee={geometry:ke,type:De==="Polygon"||De==="MultiPolygon"?3:De==="LineString"||De==="MultiLineString"?2:1,tags:Ne};re.id!==null&&(Ee.id=re.id),xe.features.push(Ee)}}function hr(xe,re,te,he,_e,De){const ke=he*he;if(he>0&&re.size<(_e?ke:he))return void(te.numPoints+=re.length/3);const Ne=[];for(let Ee=0;Ee<re.length;Ee+=3)(he===0||re[Ee+2]>ke)&&(te.numSimplified++,Ne.push(re[Ee],re[Ee+1])),te.numPoints++;_e&&function(Ee,We){let Je=0;for(let Ge=0,ft=Ee.length,Wt=ft-2;Ge<ft;Wt=Ge,Ge+=2)Je+=(Ee[Ge]-Ee[Wt])*(Ee[Ge+1]+Ee[Wt+1]);if(Je>0===We)for(let Ge=0,ft=Ee.length;Ge<ft/2;Ge+=2){const Wt=Ee[Ge],Xt=Ee[Ge+1];Ee[Ge]=Ee[ft-2-Ge],Ee[Ge+1]=Ee[ft-1-Ge],Ee[ft-2-Ge]=Wt,Ee[ft-1-Ge]=Xt}}(Ne,De),xe.push(Ne)}const Qt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class pi{constructor(re,te){const he=(te=this.options=function(De,ke){for(const Ne in ke)De[Ne]=ke[Ne];return De}(Object.create(Qt),te)).debug;if(he&&console.time("preprocess data"),te.maxZoom<0||te.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(te.promoteId&&te.generateId)throw new Error("promoteId and generateId cannot be used together.");let _e=function(De,ke){const Ne=[];if(De.type==="FeatureCollection")for(let Ee=0;Ee<De.features.length;Ee++)kt(Ne,De.features[Ee],ke,Ee);else kt(Ne,De.type==="Feature"?De:{geometry:De},ke);return Ne}(re,te);this.tiles={},this.tileCoords=[],he&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",te.indexMaxZoom,te.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),_e=function(De,ke){const Ne=ke.buffer/ke.extent;let Ee=De;const We=Nr(De,1,-1-Ne,Ne,0,-1,2,ke),Je=Nr(De,1,1-Ne,2+Ne,0,-1,2,ke);return(We||Je)&&(Ee=Nr(De,1,-Ne,1+Ne,0,-1,2,ke)||[],We&&(Ee=$e(We,1).concat(Ee)),Je&&(Ee=Ee.concat($e(Je,-1)))),Ee}(_e,te),_e.length&&this.splitTile(_e,0,0,0),he&&(_e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(re,te,he,_e,De,ke,Ne){const Ee=[re,te,he,_e],We=this.options,Je=We.debug;for(;Ee.length;){_e=Ee.pop(),he=Ee.pop(),te=Ee.pop(),re=Ee.pop();const Ge=1<<te,ft=la(te,he,_e);let Wt=this.tiles[ft];if(!Wt&&(Je>1&&console.time("creation"),Wt=this.tiles[ft]=Ln(re,te,he,_e,We),this.tileCoords.push({z:te,x:he,y:_e}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",te,he,_e,Wt.numFeatures,Wt.numPoints,Wt.numSimplified),console.timeEnd("creation"));const Yn=`z${te}`;this.stats[Yn]=(this.stats[Yn]||0)+1,this.total++}if(Wt.source=re,De==null){if(te===We.indexMaxZoom||Wt.numPoints<=We.indexMaxPoints)continue}else{if(te===We.maxZoom||te===De)continue;if(De!=null){const Yn=De-te;if(he!==ke>>Yn||_e!==Ne>>Yn)continue}}if(Wt.source=null,re.length===0)continue;Je>1&&console.time("clipping");const Xt=.5*We.buffer/We.extent,Or=.5-Xt,dr=.5+Xt,zr=1+Xt;let Dr=null,Bn=null,Sn=null,xr=null,jr=Nr(re,Ge,he-Xt,he+dr,0,Wt.minX,Wt.maxX,We),_n=Nr(re,Ge,he+Or,he+zr,0,Wt.minX,Wt.maxX,We);re=null,jr&&(Dr=Nr(jr,Ge,_e-Xt,_e+dr,1,Wt.minY,Wt.maxY,We),Bn=Nr(jr,Ge,_e+Or,_e+zr,1,Wt.minY,Wt.maxY,We),jr=null),_n&&(Sn=Nr(_n,Ge,_e-Xt,_e+dr,1,Wt.minY,Wt.maxY,We),xr=Nr(_n,Ge,_e+Or,_e+zr,1,Wt.minY,Wt.maxY,We),_n=null),Je>1&&console.timeEnd("clipping"),Ee.push(Dr||[],te+1,2*he,2*_e),Ee.push(Bn||[],te+1,2*he,2*_e+1),Ee.push(Sn||[],te+1,2*he+1,2*_e),Ee.push(xr||[],te+1,2*he+1,2*_e+1)}}getTile(re,te,he){re=+re,te=+te,he=+he;const _e=this.options,{extent:De,debug:ke}=_e;if(re<0||re>24)return null;const Ne=1<<re,Ee=la(re,te=te+Ne&Ne-1,he);if(this.tiles[Ee])return sr(this.tiles[Ee],De);ke>1&&console.log("drilling down to z%d-%d-%d",re,te,he);let We,Je=re,Ge=te,ft=he;for(;!We&&Je>0;)Je--,Ge>>=1,ft>>=1,We=this.tiles[la(Je,Ge,ft)];return We&&We.source?(ke>1&&(console.log("found parent tile z%d-%d-%d",Je,Ge,ft),console.time("drilling down")),this.splitTile(We.source,Je,Ge,ft,re,te,he),ke>1&&console.timeEnd("drilling down"),this.tiles[Ee]?sr(this.tiles[Ee],De):null):null}}function la(xe,re,te){return 32*((1<<xe)*te+re)+xe}function Lt(xe,re){return re?xe.properties[re]:xe.id}function Di(xe,re){if(xe==null)return!0;if(xe.type==="Feature")return Lt(xe,re)!=null;if(xe.type==="FeatureCollection"){const te=new Set;for(const he of xe.features){const _e=Lt(he,re);if(_e==null||te.has(_e))return!1;te.add(_e)}return!0}return!1}function Mi(xe,re){const te=new Map;if(xe!=null)if(xe.type==="Feature")te.set(Lt(xe,re),xe);else for(const he of xe.features)te.set(Lt(he,re),he);return te}class Co extends f{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(re,te){return o._(this,void 0,void 0,function*(){const he=re.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const _e=this._geoJSONIndex.getTile(he.z,he.x,he.y);if(!_e)return null;const De=new class{constructor(Ne){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.X,this.length=Ne.length,this._features=Ne}feature(Ne){return new class{constructor(Ee){this._feature=Ee,this.extent=o.X,this.type=Ee.type,this.properties=Ee.tags,"id"in Ee&&!isNaN(Ee.id)&&(this.id=parseInt(Ee.id,10))}loadGeometry(){if(this._feature.type===1){const Ee=[];for(const We of this._feature.geometry)Ee.push([new o.P(We[0],We[1])]);return Ee}{const Ee=[];for(const We of this._feature.geometry){const Je=[];for(const Ge of We)Je.push(new o.P(Ge[0],Ge[1]));Ee.push(Je)}return Ee}}toGeoJSON(Ee,We,Je){return w.call(this,Ee,We,Je)}}(this._features[Ne])}}(_e.features);let ke=pe(De);return ke.byteOffset===0&&ke.byteLength===ke.buffer.byteLength||(ke=new Uint8Array(ke)),{vectorTile:De,rawData:ke.buffer}})}loadData(re){return o._(this,void 0,void 0,function*(){var te;(te=this._pendingRequest)===null||te===void 0||te.abort();const he=!!(re&&re.request&&re.request.collectResourceTiming)&&new o.bv(re.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(re,this._pendingRequest),this._geoJSONIndex=re.cluster?new at(function({superclusterOptions:ke,clusterProperties:Ne}){if(!Ne||!ke)return ke;const Ee={},We={},Je={accumulated:null,zoom:0},Ge={properties:null},ft=Object.keys(Ne);for(const Wt of ft){const[Xt,Or]=Ne[Wt],dr=o.bC(Or),zr=o.bC(typeof Xt=="string"?[Xt,["accumulated"],["get",Wt]]:Xt);Ee[Wt]=dr.value,We[Wt]=zr.value}return ke.map=Wt=>{Ge.properties=Wt;const Xt={};for(const Or of ft)Xt[Or]=Ee[Or].evaluate(Je,Ge);return Xt},ke.reduce=(Wt,Xt)=>{Ge.properties=Xt;for(const Or of ft)Je.accumulated=Wt[Or],Wt[Or]=We[Or].evaluate(Je,Ge)},ke}(re)).load((yield this._pendingData).features):(_e=yield this._pendingData,new pi(_e,re.geojsonVtOptions)),this.loaded={};const De={};if(he){const ke=he.finish();ke&&(De.resourceTiming={},De.resourceTiming[re.source]=JSON.parse(JSON.stringify(ke)))}return De}catch(De){if(delete this._pendingRequest,o.bB(De))return{abandoned:!0};throw De}var _e})}getData(){return o._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(re){const te=this.loaded;return te&&te[re.uid]?super.reloadTile(re):this.loadTile(re)}loadAndProcessGeoJSON(re,te){return o._(this,void 0,void 0,function*(){let he=yield this.loadGeoJSON(re,te);if(delete this._pendingRequest,typeof he!="object")throw new Error(`Input data given to '${re.source}' is not a valid GeoJSON object.`);if(x(he,!0),re.filter){const _e=o.bC(re.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(_e.result==="error")throw new Error(_e.value.map(ke=>`${ke.key}: ${ke.message}`).join(", "));he={type:"FeatureCollection",features:he.features.filter(ke=>_e.value.evaluate({zoom:0},ke))}}return he})}loadGeoJSON(re,te){return o._(this,void 0,void 0,function*(){const{promoteId:he}=re;if(re.request){const _e=yield o.h(re.request,te);return this._dataUpdateable=Di(_e.data,he)?Mi(_e.data,he):void 0,_e.data}if(typeof re.data=="string")try{const _e=JSON.parse(re.data);return this._dataUpdateable=Di(_e,he)?Mi(_e,he):void 0,_e}catch{throw new Error(`Input data given to '${re.source}' is not a valid GeoJSON object.`)}if(!re.dataDiff)throw new Error(`Input data given to '${re.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${re.source}`);return function(_e,De,ke){var Ne,Ee,We,Je;if(De.removeAll&&_e.clear(),De.remove)for(const Ge of De.remove)_e.delete(Ge);if(De.add)for(const Ge of De.add){const ft=Lt(Ge,ke);ft!=null&&_e.set(ft,Ge)}if(De.update)for(const Ge of De.update){let ft=_e.get(Ge.id);if(ft==null)continue;const Wt=!Ge.removeAllProperties&&(((Ne=Ge.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0||((Ee=Ge.addOrUpdateProperties)===null||Ee===void 0?void 0:Ee.length)>0);if((Ge.newGeometry||Ge.removeAllProperties||Wt)&&(ft=Object.assign({},ft),_e.set(Ge.id,ft),Wt&&(ft.properties=Object.assign({},ft.properties))),Ge.newGeometry&&(ft.geometry=Ge.newGeometry),Ge.removeAllProperties)ft.properties={};else if(((We=Ge.removeProperties)===null||We===void 0?void 0:We.length)>0)for(const Xt of Ge.removeProperties)Object.prototype.hasOwnProperty.call(ft.properties,Xt)&&delete ft.properties[Xt];if(((Je=Ge.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Xt,value:Or}of Ge.addOrUpdateProperties)ft.properties[Xt]=Or}}(this._dataUpdateable,re.dataDiff,he),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(re){return o._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(re){return this._geoJSONIndex.getClusterExpansionZoom(re.clusterId)}getClusterChildren(re){return this._geoJSONIndex.getChildren(re.clusterId)}getClusterLeaves(re){return this._geoJSONIndex.getLeaves(re.clusterId,re.limit,re.offset)}}class Ao{constructor(re){this.self=re,this.actor=new o.F(re),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(te,he)=>{if(this.externalWorkerSourceTypes[te])throw new Error(`Worker source with name "${te}" already registered.`);this.externalWorkerSourceTypes[te]=he},this.self.addProtocol=o.bi,this.self.removeProtocol=o.bj,this.self.registerRTLTextPlugin=te=>{if(o.bD.isParsed())throw new Error("RTL text plugin already registered.");o.bD.setMethods(te)},this.actor.registerMessageHandler("LDT",(te,he)=>this._getDEMWorkerSource(te,he.source).loadTile(he)),this.actor.registerMessageHandler("RDT",(te,he)=>o._(this,void 0,void 0,function*(){this._getDEMWorkerSource(te,he.source).removeTile(he)})),this.actor.registerMessageHandler("GCEZ",(te,he)=>o._(this,void 0,void 0,function*(){return this._getWorkerSource(te,he.type,he.source).getClusterExpansionZoom(he)})),this.actor.registerMessageHandler("GCC",(te,he)=>o._(this,void 0,void 0,function*(){return this._getWorkerSource(te,he.type,he.source).getClusterChildren(he)})),this.actor.registerMessageHandler("GCL",(te,he)=>o._(this,void 0,void 0,function*(){return this._getWorkerSource(te,he.type,he.source).getClusterLeaves(he)})),this.actor.registerMessageHandler("LD",(te,he)=>this._getWorkerSource(te,he.type,he.source).loadData(he)),this.actor.registerMessageHandler("GD",(te,he)=>this._getWorkerSource(te,he.type,he.source).getData()),this.actor.registerMessageHandler("LT",(te,he)=>this._getWorkerSource(te,he.type,he.source).loadTile(he)),this.actor.registerMessageHandler("RT",(te,he)=>this._getWorkerSource(te,he.type,he.source).reloadTile(he)),this.actor.registerMessageHandler("AT",(te,he)=>this._getWorkerSource(te,he.type,he.source).abortTile(he)),this.actor.registerMessageHandler("RMT",(te,he)=>this._getWorkerSource(te,he.type,he.source).removeTile(he)),this.actor.registerMessageHandler("RS",(te,he)=>o._(this,void 0,void 0,function*(){if(!this.workerSources[te]||!this.workerSources[te][he.type]||!this.workerSources[te][he.type][he.source])return;const _e=this.workerSources[te][he.type][he.source];delete this.workerSources[te][he.type][he.source],_e.removeSource!==void 0&&_e.removeSource(he)})),this.actor.registerMessageHandler("RM",te=>o._(this,void 0,void 0,function*(){delete this.layerIndexes[te],delete this.availableImages[te],delete this.workerSources[te],delete this.demWorkerSources[te]})),this.actor.registerMessageHandler("SR",(te,he)=>o._(this,void 0,void 0,function*(){this.referrer=he})),this.actor.registerMessageHandler("SRPS",(te,he)=>this._syncRTLPluginState(te,he)),this.actor.registerMessageHandler("IS",(te,he)=>o._(this,void 0,void 0,function*(){this.self.importScripts(he)})),this.actor.registerMessageHandler("SI",(te,he)=>this._setImages(te,he)),this.actor.registerMessageHandler("UL",(te,he)=>o._(this,void 0,void 0,function*(){this._getLayerIndex(te).update(he.layers,he.removedIds)})),this.actor.registerMessageHandler("SL",(te,he)=>o._(this,void 0,void 0,function*(){this._getLayerIndex(te).replace(he)}))}_setImages(re,te){return o._(this,void 0,void 0,function*(){this.availableImages[re]=te;for(const he in this.workerSources[re]){const _e=this.workerSources[re][he];for(const De in _e)_e[De].availableImages=te}})}_syncRTLPluginState(re,te){return o._(this,void 0,void 0,function*(){if(o.bD.isParsed())return o.bD.getState();if(te.pluginStatus!=="loading")return o.bD.setState(te),te;const he=te.pluginURL;if(this.self.importScripts(he),o.bD.isParsed()){const _e={pluginStatus:"loaded",pluginURL:he};return o.bD.setState(_e),_e}throw o.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${he}`)})}_getAvailableImages(re){let te=this.availableImages[re];return te||(te=[]),te}_getLayerIndex(re){let te=this.layerIndexes[re];return te||(te=this.layerIndexes[re]=new s),te}_getWorkerSource(re,te,he){if(this.workerSources[re]||(this.workerSources[re]={}),this.workerSources[re][te]||(this.workerSources[re][te]={}),!this.workerSources[re][te][he]){const _e={sendAsync:(De,ke)=>(De.targetMapId=re,this.actor.sendAsync(De,ke))};switch(te){case"vector":this.workerSources[re][te][he]=new f(_e,this._getLayerIndex(re),this._getAvailableImages(re));break;case"geojson":this.workerSources[re][te][he]=new Co(_e,this._getLayerIndex(re),this._getAvailableImages(re));break;default:this.workerSources[re][te][he]=new this.externalWorkerSourceTypes[te](_e,this._getLayerIndex(re),this._getAvailableImages(re))}}return this.workerSources[re][te][he]}_getDEMWorkerSource(re,te){return this.demWorkerSources[re]||(this.demWorkerSources[re]={}),this.demWorkerSources[re][te]||(this.demWorkerSources[re][te]=new g),this.demWorkerSources[re][te]}}return o.i(self)&&(self.worker=new Ao(self)),Ao}),i("index",["exports","./shared"],function(o,s){var l="4.7.1";let c,d;const f={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:D=>new Promise((u,y)=>{const S=requestAnimationFrame(u);D.signal.addEventListener("abort",()=>{cancelAnimationFrame(S),y(s.c())})}),getImageData(D,u=0){return this.getImageCanvasContext(D).getImageData(-u,-u,D.width+2*u,D.height+2*u)},getImageCanvasContext(D){const u=window.document.createElement("canvas"),y=u.getContext("2d",{willReadFrequently:!0});if(!y)throw new Error("failed to create canvas 2d context");return u.width=D.width,u.height=D.height,y.drawImage(D,0,0,D.width,D.height),y},resolveURL:D=>(c||(c=document.createElement("a")),c.href=D,c.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(d==null&&(d=matchMedia("(prefers-reduced-motion: reduce)")),d.matches)}};class g{static testProp(u){if(!g.docStyle)return u[0];for(let y=0;y<u.length;y++)if(u[y]in g.docStyle)return u[y];return u[0]}static create(u,y,S){const T=window.document.createElement(u);return y!==void 0&&(T.className=y),S&&S.appendChild(T),T}static createNS(u,y){return window.document.createElementNS(u,y)}static disableDrag(){g.docStyle&&g.selectProp&&(g.userSelect=g.docStyle[g.selectProp],g.docStyle[g.selectProp]="none")}static enableDrag(){g.docStyle&&g.selectProp&&(g.docStyle[g.selectProp]=g.userSelect)}static setTransform(u,y){u.style[g.transformProp]=y}static addEventListener(u,y,S,T={}){u.addEventListener(y,S,"passive"in T?T:T.capture)}static removeEventListener(u,y,S,T={}){u.removeEventListener(y,S,"passive"in T?T:T.capture)}static suppressClickInternal(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",g.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",g.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",g.suppressClickInternal,!0)},0)}static getScale(u){const y=u.getBoundingClientRect();return{x:y.width/u.offsetWidth||1,y:y.height/u.offsetHeight||1,boundingClientRect:y}}static getPoint(u,y,S){const T=y.boundingClientRect;return new s.P((S.clientX-T.left)/y.x-u.clientLeft,(S.clientY-T.top)/y.y-u.clientTop)}static mousePos(u,y){const S=g.getScale(u);return g.getPoint(u,S,y)}static touchPos(u,y){const S=[],T=g.getScale(u);for(let A=0;A<y.length;A++)S.push(g.getPoint(u,T,y[A]));return S}static mouseButton(u){return u.button}static remove(u){u.parentNode&&u.parentNode.removeChild(u)}}g.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,g.selectProp=g.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),g.transformProp=g.testProp(["transform","WebkitTransform"]);const m={supported:!1,testSupport:function(D){!w&&x&&(C?M(D):_=D)}};let _,x,w=!1,C=!1;function M(D){const u=D.createTexture();D.bindTexture(D.TEXTURE_2D,u);try{if(D.texImage2D(D.TEXTURE_2D,0,D.RGBA,D.RGBA,D.UNSIGNED_BYTE,x),D.isContextLost())return;m.supported=!0}catch{}D.deleteTexture(u),w=!0}var L;typeof document<"u"&&(x=document.createElement("img"),x.onload=()=>{_&&M(_),_=null,C=!0},x.onerror=()=>{w=!0,_=null},x.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(D){let u,y,S,T;D.resetRequestQueue=()=>{u=[],y=0,S=0,T={}},D.addThrottleControl=$=>{const q=S++;return T[q]=$,q},D.removeThrottleControl=$=>{delete T[$],N()},D.getImage=($,q,K=!0)=>new Promise((J,ae)=>{m.supported&&($.headers||($.headers={}),$.headers.accept="image/webp,*/*"),s.e($,{type:"image"}),u.push({abortController:q,requestParameters:$,supportImageRefresh:K,state:"queued",onError:ue=>{ae(ue)},onSuccess:ue=>{J(ue)}}),N()});const A=$=>s._(this,void 0,void 0,function*(){$.state="running";const{requestParameters:q,supportImageRefresh:K,onError:J,onSuccess:ae,abortController:ue}=$,fe=K===!1&&!s.i(self)&&!s.g(q.url)&&(!q.headers||Object.keys(q.headers).reduce((Te,Ce)=>Te&&Ce==="accept",!0));y++;const be=fe?B(q,ue):s.m(q,ue);try{const Te=yield be;delete $.abortController,$.state="completed",Te.data instanceof HTMLImageElement||s.b(Te.data)?ae(Te):Te.data&&ae({data:yield(Se=Te.data,typeof createImageBitmap=="function"?s.d(Se):s.f(Se)),cacheControl:Te.cacheControl,expires:Te.expires})}catch(Te){delete $.abortController,J(Te)}finally{y--,N()}var Se}),N=()=>{const $=(()=>{for(const q of Object.keys(T))if(T[q]())return!0;return!1})()?s.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:s.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let q=y;q<$&&u.length>0;q++){const K=u.shift();K.abortController.signal.aborted?q--:A(K)}},B=($,q)=>new Promise((K,J)=>{const ae=new Image,ue=$.url,fe=$.credentials;fe&&fe==="include"?ae.crossOrigin="use-credentials":(fe&&fe==="same-origin"||!s.s(ue))&&(ae.crossOrigin="anonymous"),q.signal.addEventListener("abort",()=>{ae.src="",J(s.c())}),ae.fetchPriority="high",ae.onload=()=>{ae.onerror=ae.onload=null,K({data:ae})},ae.onerror=()=>{ae.onerror=ae.onload=null,q.signal.aborted||J(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."))},ae.src=ue})}(L||(L={})),L.resetRequestQueue();class O{constructor(u){this._transformRequestFn=u}transformRequest(u,y){return this._transformRequestFn&&this._transformRequestFn(u,y)||{url:u}}setTransformRequest(u){this._transformRequestFn=u}}function F(D){var u=new s.A(3);return u[0]=D[0],u[1]=D[1],u[2]=D[2],u}var V,U=function(D,u,y){return D[0]=u[0]-y[0],D[1]=u[1]-y[1],D[2]=u[2]-y[2],D};V=new s.A(3),s.A!=Float32Array&&(V[0]=0,V[1]=0,V[2]=0);var H=function(D){var u=D[0],y=D[1];return u*u+y*y};function Z(D){const u=[];if(typeof D=="string")u.push({id:"default",url:D});else if(D&&D.length>0){const y=[];for(const{id:S,url:T}of D){const A=`${S}${T}`;y.indexOf(A)===-1&&(y.push(A),u.push({id:S,url:T}))}}return u}function Y(D,u,y){const S=D.split("?");return S[0]+=`${u}${y}`,S.join("?")}(function(){var D=new s.A(2);s.A!=Float32Array&&(D[0]=0,D[1]=0)})();class X{constructor(u,y,S,T){this.context=u,this.format=S,this.texture=u.gl.createTexture(),this.update(y,T)}update(u,y,S){const{width:T,height:A}=u,N=!(this.size&&this.size[0]===T&&this.size[1]===A||S),{context:B}=this,{gl:$}=B;if(this.useMipmap=!!(y&&y.useMipmap),$.bindTexture($.TEXTURE_2D,this.texture),B.pixelStoreUnpackFlipY.set(!1),B.pixelStoreUnpack.set(1),B.pixelStoreUnpackPremultiplyAlpha.set(this.format===$.RGBA&&(!y||y.premultiply!==!1)),N)this.size=[T,A],u instanceof HTMLImageElement||u instanceof HTMLCanvasElement||u instanceof HTMLVideoElement||u instanceof ImageData||s.b(u)?$.texImage2D($.TEXTURE_2D,0,this.format,this.format,$.UNSIGNED_BYTE,u):$.texImage2D($.TEXTURE_2D,0,this.format,T,A,0,this.format,$.UNSIGNED_BYTE,u.data);else{const{x:q,y:K}=S||{x:0,y:0};u instanceof HTMLImageElement||u instanceof HTMLCanvasElement||u instanceof HTMLVideoElement||u instanceof ImageData||s.b(u)?$.texSubImage2D($.TEXTURE_2D,0,q,K,$.RGBA,$.UNSIGNED_BYTE,u):$.texSubImage2D($.TEXTURE_2D,0,q,K,T,A,$.RGBA,$.UNSIGNED_BYTE,u.data)}this.useMipmap&&this.isSizePowerOfTwo()&&$.generateMipmap($.TEXTURE_2D)}bind(u,y,S){const{context:T}=this,{gl:A}=T;A.bindTexture(A.TEXTURE_2D,this.texture),S!==A.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(S=A.LINEAR),u!==this.filter&&(A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,u),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,S||u),this.filter=u),y!==this.wrap&&(A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,y),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,y),this.wrap=y)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:u}=this.context;u.deleteTexture(this.texture),this.texture=null}}function ie(D){const{userImage:u}=D;return!!(u&&u.render&&u.render())&&(D.data.replace(new Uint8Array(u.data.buffer)),!0)}class oe extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new s.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(u){if(this.loaded!==u&&(this.loaded=u,u)){for(const{ids:y,promiseResolve:S}of this.requestors)S(this._getImagesForIds(y));this.requestors=[]}}getImage(u){const y=this.images[u];if(y&&!y.data&&y.spriteData){const S=y.spriteData;y.data=new s.R({width:S.width,height:S.height},S.context.getImageData(S.x,S.y,S.width,S.height).data),y.spriteData=null}return y}addImage(u,y){if(this.images[u])throw new Error(`Image id ${u} already exist, use updateImage instead`);this._validate(u,y)&&(this.images[u]=y)}_validate(u,y){let S=!0;const T=y.data||y.spriteData;return this._validateStretch(y.stretchX,T&&T.width)||(this.fire(new s.j(new Error(`Image "${u}" has invalid "stretchX" value`))),S=!1),this._validateStretch(y.stretchY,T&&T.height)||(this.fire(new s.j(new Error(`Image "${u}" has invalid "stretchY" value`))),S=!1),this._validateContent(y.content,y)||(this.fire(new s.j(new Error(`Image "${u}" has invalid "content" value`))),S=!1),S}_validateStretch(u,y){if(!u)return!0;let S=0;for(const T of u){if(T[0]<S||T[1]<T[0]||y<T[1])return!1;S=T[1]}return!0}_validateContent(u,y){if(!u)return!0;if(u.length!==4)return!1;const S=y.spriteData,T=S&&S.width||y.data.width,A=S&&S.height||y.data.height;return!(u[0]<0||T<u[0]||u[1]<0||A<u[1]||u[2]<0||T<u[2]||u[3]<0||A<u[3]||u[2]<u[0]||u[3]<u[1])}updateImage(u,y,S=!0){const T=this.getImage(u);if(S&&(T.data.width!==y.data.width||T.data.height!==y.data.height))throw new Error(`size mismatch between old image (${T.data.width}x${T.data.height}) and new image (${y.data.width}x${y.data.height}).`);y.version=T.version+1,this.images[u]=y,this.updatedImages[u]=!0}removeImage(u){const y=this.images[u];delete this.images[u],delete this.patterns[u],y.userImage&&y.userImage.onRemove&&y.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(u){return new Promise((y,S)=>{let T=!0;if(!this.isLoaded())for(const A of u)this.images[A]||(T=!1);this.isLoaded()||T?y(this._getImagesForIds(u)):this.requestors.push({ids:u,promiseResolve:y})})}_getImagesForIds(u){const y={};for(const S of u){let T=this.getImage(S);T||(this.fire(new s.k("styleimagemissing",{id:S})),T=this.getImage(S)),T?y[S]={data:T.data.clone(),pixelRatio:T.pixelRatio,sdf:T.sdf,version:T.version,stretchX:T.stretchX,stretchY:T.stretchY,content:T.content,textFitWidth:T.textFitWidth,textFitHeight:T.textFitHeight,hasRenderCallback:!!(T.userImage&&T.userImage.render)}:s.w(`Image "${S}" 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 y}getPixelSize(){const{width:u,height:y}=this.atlasImage;return{width:u,height:y}}getPattern(u){const y=this.patterns[u],S=this.getImage(u);if(!S)return null;if(y&&y.position.version===S.version)return y.position;if(y)y.position.version=S.version;else{const T={w:S.data.width+2,h:S.data.height+2,x:0,y:0},A=new s.I(T,S);this.patterns[u]={bin:T,position:A}}return this._updatePatternAtlas(),this.patterns[u].position}bind(u){const y=u.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new X(u,this.atlasImage,y.RGBA),this.atlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE)}_updatePatternAtlas(){const u=[];for(const A in this.patterns)u.push(this.patterns[A].bin);const{w:y,h:S}=s.p(u),T=this.atlasImage;T.resize({width:y||1,height:S||1});for(const A in this.patterns){const{bin:N}=this.patterns[A],B=N.x+1,$=N.y+1,q=this.getImage(A).data,K=q.width,J=q.height;s.R.copy(q,T,{x:0,y:0},{x:B,y:$},{width:K,height:J}),s.R.copy(q,T,{x:0,y:J-1},{x:B,y:$-1},{width:K,height:1}),s.R.copy(q,T,{x:0,y:0},{x:B,y:$+J},{width:K,height:1}),s.R.copy(q,T,{x:K-1,y:0},{x:B-1,y:$},{width:1,height:J}),s.R.copy(q,T,{x:0,y:0},{x:B+K,y:$},{width:1,height:J})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(u){for(const y of u){if(this.callbackDispatchedThisFrame[y])continue;this.callbackDispatchedThisFrame[y]=!0;const S=this.getImage(y);S||s.w(`Image with ID: "${y}" was not found`),ie(S)&&this.updateImage(y,S)}}}const le=1e20;function de(D,u,y,S,T,A,N,B,$){for(let q=u;q<u+S;q++)ge(D,y*A+q,A,T,N,B,$);for(let q=y;q<y+T;q++)ge(D,q*A+u,1,S,N,B,$)}function ge(D,u,y,S,T,A,N){A[0]=0,N[0]=-le,N[1]=le,T[0]=D[u];for(let B=1,$=0,q=0;B<S;B++){T[B]=D[u+B*y];const K=B*B;do{const J=A[$];q=(T[B]-T[J]+K-J*J)/(B-J)/2}while(q<=N[$]&&--$>-1);$++,A[$]=B,N[$]=q,N[$+1]=le}for(let B=0,$=0;B<S;B++){for(;N[$+1]<B;)$++;const q=A[$],K=B-q;D[u+B*y]=T[q]+K*K}}class pe{constructor(u,y){this.requestManager=u,this.localIdeographFontFamily=y,this.entries={}}setURL(u){this.url=u}getGlyphs(u){return s._(this,void 0,void 0,function*(){const y=[];for(const A in u)for(const N of u[A])y.push(this._getAndCacheGlyphsPromise(A,N));const S=yield Promise.all(y),T={};for(const{stack:A,id:N,glyph:B}of S)T[A]||(T[A]={}),T[A][N]=B&&{id:B.id,bitmap:B.bitmap.clone(),metrics:B.metrics};return T})}_getAndCacheGlyphsPromise(u,y){return s._(this,void 0,void 0,function*(){let S=this.entries[u];S||(S=this.entries[u]={glyphs:{},requests:{},ranges:{}});let T=S.glyphs[y];if(T!==void 0)return{stack:u,id:y,glyph:T};if(T=this._tinySDF(S,u,y),T)return S.glyphs[y]=T,{stack:u,id:y,glyph:T};const A=Math.floor(y/256);if(256*A>65535)throw new Error("glyphs > 65535 not supported");if(S.ranges[A])return{stack:u,id:y,glyph:T};if(!this.url)throw new Error("glyphsUrl is not set");if(!S.requests[A]){const B=pe.loadGlyphRange(u,A,this.url,this.requestManager);S.requests[A]=B}const N=yield S.requests[A];for(const B in N)this._doesCharSupportLocalGlyph(+B)||(S.glyphs[+B]=N[+B]);return S.ranges[A]=!0,{stack:u,id:y,glyph:N[y]||null}})}_doesCharSupportLocalGlyph(u){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(u))}_tinySDF(u,y,S){const T=this.localIdeographFontFamily;if(!T||!this._doesCharSupportLocalGlyph(S))return;let A=u.tinySDF;if(!A){let B="400";/bold/i.test(y)?B="900":/medium/i.test(y)?B="500":/light/i.test(y)&&(B="200"),A=u.tinySDF=new pe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:T,fontWeight:B})}const N=A.draw(String.fromCharCode(S));return{id:S,bitmap:new s.o({width:N.width||60,height:N.height||60},N.data),metrics:{width:N.glyphWidth/2||24,height:N.glyphHeight/2||24,left:N.glyphLeft/2+.5||0,top:N.glyphTop/2-27.5||-8,advance:N.glyphAdvance/2||24,isDoubleResolution:!0}}}}pe.loadGlyphRange=function(D,u,y,S){return s._(this,void 0,void 0,function*(){const T=256*u,A=T+255,N=S.transformRequest(y.replace("{fontstack}",D).replace("{range}",`${T}-${A}`),"Glyphs"),B=yield s.l(N,new AbortController);if(!B||!B.data)throw new Error(`Could not load glyph range. range: ${u}, ${T}-${A}`);const $={};for(const q of s.n(B.data))$[q.id]=q;return $})},pe.TinySDF=class{constructor({fontSize:D=24,buffer:u=3,radius:y=8,cutoff:S=.25,fontFamily:T="sans-serif",fontWeight:A="normal",fontStyle:N="normal"}={}){this.buffer=u,this.cutoff=S,this.radius=y;const B=this.size=D+4*u,$=this._createCanvas(B),q=this.ctx=$.getContext("2d",{willReadFrequently:!0});q.font=`${N} ${A} ${D}px ${T}`,q.textBaseline="alphabetic",q.textAlign="left",q.fillStyle="black",this.gridOuter=new Float64Array(B*B),this.gridInner=new Float64Array(B*B),this.f=new Float64Array(B),this.z=new Float64Array(B+1),this.v=new Uint16Array(B)}_createCanvas(D){const u=document.createElement("canvas");return u.width=u.height=D,u}draw(D){const{width:u,actualBoundingBoxAscent:y,actualBoundingBoxDescent:S,actualBoundingBoxLeft:T,actualBoundingBoxRight:A}=this.ctx.measureText(D),N=Math.ceil(y),B=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(A-T))),$=Math.min(this.size-this.buffer,N+Math.ceil(S)),q=B+2*this.buffer,K=$+2*this.buffer,J=Math.max(q*K,0),ae=new Uint8ClampedArray(J),ue={data:ae,width:q,height:K,glyphWidth:B,glyphHeight:$,glyphTop:N,glyphLeft:0,glyphAdvance:u};if(B===0||$===0)return ue;const{ctx:fe,buffer:be,gridInner:Se,gridOuter:Te}=this;fe.clearRect(be,be,B,$),fe.fillText(D,be,be+N);const Ce=fe.getImageData(be,be,B,$);Te.fill(le,0,J),Se.fill(0,0,J);for(let ve=0;ve<$;ve++)for(let Ie=0;Ie<B;Ie++){const Pe=Ce.data[4*(ve*B+Ie)+3]/255;if(Pe===0)continue;const Ve=(ve+be)*q+Ie+be;if(Pe===1)Te[Ve]=0,Se[Ve]=le;else{const Ke=.5-Pe;Te[Ve]=Ke>0?Ke*Ke:0,Se[Ve]=Ke<0?Ke*Ke:0}}de(Te,0,0,q,K,q,this.f,this.v,this.z),de(Se,be,be,B,$,q,this.f,this.v,this.z);for(let ve=0;ve<J;ve++){const Ie=Math.sqrt(Te[ve])-Math.sqrt(Se[ve]);ae[ve]=Math.round(255-255*(Ie/this.radius+this.cutoff))}return ue}};class me{constructor(){this.specification=s.v.light.position}possiblyEvaluate(u,y){return s.x(u.expression.evaluate(y))}interpolate(u,y,S){return{x:s.y.number(u.x,y.x,S),y:s.y.number(u.y,y.y,S),z:s.y.number(u.z,y.z,S)}}}let Me;class Be extends s.E{constructor(u){super(),Me=Me||new s.q({anchor:new s.D(s.v.light.anchor),position:new me,color:new s.D(s.v.light.color),intensity:new s.D(s.v.light.intensity)}),this._transitionable=new s.T(Me),this.setLight(u),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(u,y={}){if(!this._validate(s.r,u,y))for(const S in u){const T=u[S];S.endsWith("-transition")?this._transitionable.setTransition(S.slice(0,-11),T):this._transitionable.setValue(S,T)}}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,y,S){return(!S||S.validate!==!1)&&s.t(this,u.call(s.u,{value:y,style:{glyphs:!0,sprite:!0},styleSpec:s.v}))}}const Fe=new s.q({"sky-color":new s.D(s.v.sky["sky-color"]),"horizon-color":new s.D(s.v.sky["horizon-color"]),"fog-color":new s.D(s.v.sky["fog-color"]),"fog-ground-blend":new s.D(s.v.sky["fog-ground-blend"]),"horizon-fog-blend":new s.D(s.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new s.D(s.v.sky["sky-horizon-blend"]),"atmosphere-blend":new s.D(s.v.sky["atmosphere-blend"])});class Xe extends s.E{constructor(u){super(),this._transitionable=new s.T(Fe),this.setSky(u),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new s.z(0))}setSky(u,y={}){if(!this._validate(s.B,u,y)){u||(u={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const S in u){const T=u[S];S.endsWith("-transition")?this._transitionable.setTransition(S.slice(0,-11),T):this._transitionable.setValue(S,T)}}}getSky(){return this._transitionable.serialize()}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,y,S={}){return(S==null?void 0:S.validate)!==!1&&s.t(this,u.call(s.u,s.e({value:y,style:{glyphs:!0,sprite:!0},styleSpec:s.v})))}calculateFogBlendOpacity(u){return u<60?0:u<70?(u-60)/10:1}}class it{constructor(u,y){this.width=u,this.height=y,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(u,y){const S=u.join(",")+String(y);return this.dashEntry[S]||(this.dashEntry[S]=this.addDash(u,y)),this.dashEntry[S]}getDashRanges(u,y,S){const T=[];let A=u.length%2==1?-u[u.length-1]*S:0,N=u[0]*S,B=!0;T.push({left:A,right:N,isDash:B,zeroLength:u[0]===0});let $=u[0];for(let q=1;q<u.length;q++){B=!B;const K=u[q];A=$*S,$+=K,N=$*S,T.push({left:A,right:N,isDash:B,zeroLength:K===0})}return T}addRoundDash(u,y,S){const T=y/2;for(let A=-S;A<=S;A++){const N=this.width*(this.nextRow+S+A);let B=0,$=u[B];for(let q=0;q<this.width;q++){q/$.right>1&&($=u[++B]);const K=Math.abs(q-$.left),J=Math.abs(q-$.right),ae=Math.min(K,J);let ue;const fe=A/S*(T+1);if($.isDash){const be=T-Math.abs(fe);ue=Math.sqrt(ae*ae+be*be)}else ue=T-Math.sqrt(ae*ae+fe*fe);this.data[N+q]=Math.max(0,Math.min(255,ue+128))}}}addRegularDash(u){for(let B=u.length-1;B>=0;--B){const $=u[B],q=u[B+1];$.zeroLength?u.splice(B,1):q&&q.isDash===$.isDash&&(q.left=$.left,u.splice(B,1))}const y=u[0],S=u[u.length-1];y.isDash===S.isDash&&(y.left=S.left-this.width,S.right=y.right+this.width);const T=this.width*this.nextRow;let A=0,N=u[A];for(let B=0;B<this.width;B++){B/N.right>1&&(N=u[++A]);const $=Math.abs(B-N.left),q=Math.abs(B-N.right),K=Math.min($,q);this.data[T+B]=Math.max(0,Math.min(255,(N.isDash?K:-K)+128))}}addDash(u,y){const S=y?7:0,T=2*S+1;if(this.nextRow+T>this.height)return s.w("LineAtlas out of space"),null;let A=0;for(let B=0;B<u.length;B++)A+=u[B];if(A!==0){const B=this.width/A,$=this.getDashRanges(u,this.width,B);y?this.addRoundDash($,B,S):this.addRegularDash($)}const N={y:(this.nextRow+S+.5)/this.height,height:2*S/this.height,width:A};return this.nextRow+=T,this.dirty=!0,N}bind(u){const y=u.gl;this.texture?(y.bindTexture(y.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,y.texSubImage2D(y.TEXTURE_2D,0,0,0,this.width,this.height,y.ALPHA,y.UNSIGNED_BYTE,this.data))):(this.texture=y.createTexture(),y.bindTexture(y.TEXTURE_2D,this.texture),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.REPEAT),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.REPEAT),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.texImage2D(y.TEXTURE_2D,0,y.ALPHA,this.width,this.height,0,y.ALPHA,y.UNSIGNED_BYTE,this.data))}}const at="maplibre_preloaded_worker_pool";class ht{constructor(){this.active={}}acquire(u){if(!this.workers)for(this.workers=[];this.workers.length<ht.workerCount;)this.workers.push(new Worker(s.a.WORKER_URL));return this.active[u]=!0,this.workers.slice()}release(u){delete this.active[u],this.numActive()===0&&(this.workers.forEach(y=>{y.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[at]}numActive(){return Object.keys(this.active).length}}const ct=Math.floor(f.hardwareConcurrency/2);let dt,Qe;function Dt(){return dt||(dt=new ht),dt}ht.workerCount=s.C(globalThis)?Math.max(Math.min(ct,3),1):1;class wt{constructor(u,y){this.workerPool=u,this.actors=[],this.currentActor=0,this.id=y;const S=this.workerPool.acquire(y);for(let T=0;T<S.length;T++){const A=new s.F(S[T],y);A.name=`Worker ${T}`,this.actors.push(A)}if(!this.actors.length)throw new Error("No actors found")}broadcast(u,y){const S=[];for(const T of this.actors)S.push(T.sendAsync({type:u,data:y}));return Promise.all(S)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(u=!0){this.actors.forEach(y=>{y.remove()}),this.actors=[],u&&this.workerPool.release(this.id)}registerMessageHandler(u,y){for(const S of this.actors)S.registerMessageHandler(u,y)}}function ot(){return Qe||(Qe=new wt(Dt(),s.G),Qe.registerMessageHandler("GR",(D,u,y)=>s.m(u,y))),Qe}function St(D,u){const y=s.H();return s.J(y,y,[1,1,0]),s.K(y,y,[.5*D.width,.5*D.height,1]),s.L(y,y,D.calculatePosMatrix(u.toUnwrapped()))}function tt(D,u,y,S,T,A){const N=function(J,ae,ue){if(J)for(const fe of J){const be=ae[fe];if(be&&be.source===ue&&be.type==="fill-extrusion")return!0}else for(const fe in ae){const be=ae[fe];if(be.source===ue&&be.type==="fill-extrusion")return!0}return!1}(T&&T.layers,u,D.id),B=A.maxPitchScaleFactor(),$=D.tilesIn(S,B,N);$.sort(kt);const q=[];for(const J of $)q.push({wrappedTileID:J.tileID.wrapped().key,queryResults:J.tile.queryRenderedFeatures(u,y,D._state,J.queryGeometry,J.cameraQueryGeometry,J.scale,T,A,B,St(D.transform,J.tileID))});const K=function(J){const ae={},ue={};for(const fe of J){const be=fe.queryResults,Se=fe.wrappedTileID,Te=ue[Se]=ue[Se]||{};for(const Ce in be){const ve=be[Ce],Ie=Te[Ce]=Te[Ce]||{},Pe=ae[Ce]=ae[Ce]||[];for(const Ve of ve)Ie[Ve.featureIndex]||(Ie[Ve.featureIndex]=!0,Pe.push(Ve))}}return ae}(q);for(const J in K)K[J].forEach(ae=>{const ue=ae.feature,fe=D.getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=fe});return K}function kt(D,u){const y=D.tileID,S=u.tileID;return y.overscaledZ-S.overscaledZ||y.canonical.y-S.canonical.y||y.wrap-S.wrap||y.canonical.x-S.canonical.x}function _r(D,u,y){return s._(this,void 0,void 0,function*(){let S=D;if(D.url?S=(yield s.h(u.transformRequest(D.url,"Source"),y)).data:yield f.frameAsync(y),!S)return null;const T=s.M(s.e(S,D),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in S&&S.vector_layers&&(T.vectorLayerIds=S.vector_layers.map(A=>A.id)),T})}class Le{constructor(u,y){u&&(y?this.setSouthWest(u).setNorthEast(y):Array.isArray(u)&&(u.length===4?this.setSouthWest([u[0],u[1]]).setNorthEast([u[2],u[3]]):this.setSouthWest(u[0]).setNorthEast(u[1])))}setNorthEast(u){return this._ne=u instanceof s.N?new s.N(u.lng,u.lat):s.N.convert(u),this}setSouthWest(u){return this._sw=u instanceof s.N?new s.N(u.lng,u.lat):s.N.convert(u),this}extend(u){const y=this._sw,S=this._ne;let T,A;if(u instanceof s.N)T=u,A=u;else{if(!(u instanceof Le))return Array.isArray(u)?u.length===4||u.every(Array.isArray)?this.extend(Le.convert(u)):this.extend(s.N.convert(u)):u&&("lng"in u||"lon"in u)&&"lat"in u?this.extend(s.N.convert(u)):this;if(T=u._sw,A=u._ne,!T||!A)return this}return y||S?(y.lng=Math.min(T.lng,y.lng),y.lat=Math.min(T.lat,y.lat),S.lng=Math.max(A.lng,S.lng),S.lat=Math.max(A.lat,S.lat)):(this._sw=new s.N(T.lng,T.lat),this._ne=new s.N(A.lng,A.lat)),this}getCenter(){return new s.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new s.N(this.getWest(),this.getNorth())}getSouthEast(){return new s.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(u){const{lng:y,lat:S}=s.N.convert(u);let T=this._sw.lng<=y&&y<=this._ne.lng;return this._sw.lng>this._ne.lng&&(T=this._sw.lng>=y&&y>=this._ne.lng),this._sw.lat<=S&&S<=this._ne.lat&&T}static convert(u){return u instanceof Le?u:u&&new Le(u)}static fromLngLat(u,y=0){const S=360*y/40075017,T=S/Math.cos(Math.PI/180*u.lat);return new Le(new s.N(u.lng-T,u.lat-S),new s.N(u.lng+T,u.lat+S))}adjustAntiMeridian(){const u=new s.N(this._sw.lng,this._sw.lat),y=new s.N(this._ne.lng,this._ne.lat);return new Le(u,u.lng>y.lng?new s.N(y.lng+360,y.lat):y)}}class Vr{constructor(u,y,S){this.bounds=Le.convert(this.validateBounds(u)),this.minzoom=y||0,this.maxzoom=S||24}validateBounds(u){return Array.isArray(u)&&u.length===4?[Math.max(-180,u[0]),Math.max(-90,u[1]),Math.min(180,u[2]),Math.min(90,u[3])]:[-180,-90,180,90]}contains(u){const y=Math.pow(2,u.z),S=Math.floor(s.O(this.bounds.getWest())*y),T=Math.floor(s.Q(this.bounds.getNorth())*y),A=Math.ceil(s.O(this.bounds.getEast())*y),N=Math.ceil(s.Q(this.bounds.getSouth())*y);return u.x>=S&&u.x<A&&u.y>=T&&u.y<N}}class yn extends s.E{constructor(u,y,S,T){if(super(),this.id=u,this.dispatcher=S,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.e(this,s.M(y,["url","scheme","tileSize","promoteId"])),this._options=s.e({type:"vector"},y),this._collectResourceTiming=y.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(T)}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const u=yield _r(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),u&&(s.e(this,u),u.bounds&&(this.tileBounds=new Vr(u.bounds,this.minzoom,this.maxzoom)),this.fire(new s.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})))}catch(u){this._tileJSONRequest=null,this.fire(new s.j(u))}})}loaded(){return this._loaded}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}onAdd(u){this.map=u,this.load()}setSourceProperty(u){this._tileJSONRequest&&this._tileJSONRequest.abort(),u(),this.load()}setTiles(u){return this.setSourceProperty(()=>{this._options.tiles=u}),this}setUrl(u){return this.setSourceProperty(()=>{this.url=u,this._options.url=u}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return s.e({},this._options)}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),S={request:this.map._requestManager.transformRequest(y,"Tile"),uid:u.uid,tileID:u.tileID,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};S.request.collectResourceTiming=this._collectResourceTiming;let T="RT";if(u.actor&&u.state!=="expired"){if(u.state==="loading")return new Promise((A,N)=>{u.reloadPromise={resolve:A,reject:N}})}else u.actor=this.dispatcher.getActor(),T="LT";u.abortController=new AbortController;try{const A=yield u.actor.sendAsync({type:T,data:S},u.abortController);if(delete u.abortController,u.aborted)return;this._afterTileLoadWorkerResponse(u,A)}catch(A){if(delete u.abortController,u.aborted)return;if(A&&A.status!==404)throw A;this._afterTileLoadWorkerResponse(u,null)}})}_afterTileLoadWorkerResponse(u,y){if(y&&y.resourceTiming&&(u.resourceTiming=y.resourceTiming),y&&this.map._refreshExpiredTiles&&u.setExpiryData(y),u.loadVectorData(y,this.map.painter),u.reloadPromise){const S=u.reloadPromise;u.reloadPromise=null,this.loadTile(u).then(S.resolve).catch(S.reject)}}abortTile(u){return s._(this,void 0,void 0,function*(){u.abortController&&(u.abortController.abort(),delete u.abortController),u.actor&&(yield u.actor.sendAsync({type:"AT",data:{uid:u.uid,type:this.type,source:this.id}}))})}unloadTile(u){return s._(this,void 0,void 0,function*(){u.unloadVectorData(),u.actor&&(yield u.actor.sendAsync({type:"RMT",data:{uid:u.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class nt extends s.E{constructor(u,y,S,T){super(),this.id=u,this.dispatcher=S,this.setEventedParent(T),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.e({type:"raster"},y),s.e(this,s.M(y,["url","scheme","tileSize"]))}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const u=yield _r(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,u&&(s.e(this,u),u.bounds&&(this.tileBounds=new Vr(u.bounds,this.minzoom,this.maxzoom)),this.fire(new s.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})))}catch(u){this._tileJSONRequest=null,this.fire(new s.j(u))}})}loaded(){return this._loaded}onAdd(u){this.map=u,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(u){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),u(),this.load()}setTiles(u){return this.setSourceProperty(()=>{this._options.tiles=u}),this}setUrl(u){return this.setSourceProperty(()=>{this.url=u,this._options.url=u}),this}serialize(){return s.e({},this._options)}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);u.abortController=new AbortController;try{const S=yield L.getImage(this.map._requestManager.transformRequest(y,"Tile"),u.abortController,this.map._refreshExpiredTiles);if(delete u.abortController,u.aborted)return void(u.state="unloaded");if(S&&S.data){this.map._refreshExpiredTiles&&S.cacheControl&&S.expires&&u.setExpiryData({cacheControl:S.cacheControl,expires:S.expires});const T=this.map.painter.context,A=T.gl,N=S.data;u.texture=this.map.painter.getTileTexture(N.width),u.texture?u.texture.update(N,{useMipmap:!0}):(u.texture=new X(T,N,A.RGBA,{useMipmap:!0}),u.texture.bind(A.LINEAR,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST)),u.state="loaded"}}catch(S){if(delete u.abortController,u.aborted)u.state="unloaded";else if(S)throw u.state="errored",S}})}abortTile(u){return s._(this,void 0,void 0,function*(){u.abortController&&(u.abortController.abort(),delete u.abortController)})}unloadTile(u){return s._(this,void 0,void 0,function*(){u.texture&&this.map.painter.saveTileTexture(u.texture)})}hasTransition(){return!1}}class Nr extends nt{constructor(u,y,S,T){super(u,y,S,T),this.type="raster-dem",this.maxzoom=22,this._options=s.e({type:"raster-dem"},y),this.encoding=y.encoding||"mapbox",this.redFactor=y.redFactor,this.greenFactor=y.greenFactor,this.blueFactor=y.blueFactor,this.baseShift=y.baseShift}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),S=this.map._requestManager.transformRequest(y,"Tile");u.neighboringTiles=this._getNeighboringTiles(u.tileID),u.abortController=new AbortController;try{const T=yield L.getImage(S,u.abortController,this.map._refreshExpiredTiles);if(delete u.abortController,u.aborted)return void(u.state="unloaded");if(T&&T.data){const A=T.data;this.map._refreshExpiredTiles&&T.cacheControl&&T.expires&&u.setExpiryData({cacheControl:T.cacheControl,expires:T.expires});const N=s.b(A)&&s.U()?A:yield this.readImageNow(A),B={type:this.type,uid:u.uid,source:this.id,rawImageData:N,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!u.actor||u.state==="expired"){u.actor=this.dispatcher.getActor();const $=yield u.actor.sendAsync({type:"LDT",data:B});u.dem=$,u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0,u.state="loaded"}}}catch(T){if(delete u.abortController,u.aborted)u.state="unloaded";else if(T)throw u.state="errored",T}})}readImageNow(u){return s._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&s.V()){const y=u.width+2,S=u.height+2;try{return new s.R({width:y,height:S},yield s.W(u,-1,-1,y,S))}catch{}}return f.getImageData(u,1)})}_getNeighboringTiles(u){const y=u.canonical,S=Math.pow(2,y.z),T=(y.x-1+S)%S,A=y.x===0?u.wrap-1:u.wrap,N=(y.x+1+S)%S,B=y.x+1===S?u.wrap+1:u.wrap,$={};return $[new s.S(u.overscaledZ,A,y.z,T,y.y).key]={backfilled:!1},$[new s.S(u.overscaledZ,B,y.z,N,y.y).key]={backfilled:!1},y.y>0&&($[new s.S(u.overscaledZ,A,y.z,T,y.y-1).key]={backfilled:!1},$[new s.S(u.overscaledZ,u.wrap,y.z,y.x,y.y-1).key]={backfilled:!1},$[new s.S(u.overscaledZ,B,y.z,N,y.y-1).key]={backfilled:!1}),y.y+1<S&&($[new s.S(u.overscaledZ,A,y.z,T,y.y+1).key]={backfilled:!1},$[new s.S(u.overscaledZ,u.wrap,y.z,y.x,y.y+1).key]={backfilled:!1},$[new s.S(u.overscaledZ,B,y.z,N,y.y+1).key]={backfilled:!1}),$}unloadTile(u){return s._(this,void 0,void 0,function*(){u.demTexture&&this.map.painter.saveTileTexture(u.demTexture),u.fbo&&(u.fbo.destroy(),delete u.fbo),u.dem&&delete u.dem,delete u.neighboringTiles,u.state="unloaded",u.actor&&(yield u.actor.sendAsync({type:"RDT",data:{type:this.type,uid:u.uid,source:this.id}}))})}}class br extends s.E{constructor(u,y,S,T){super(),this.id=u,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=S.getActor(),this.setEventedParent(T),this._data=y.data,this._options=s.e({},y),this._collectResourceTiming=y.collectResourceTiming,y.maxzoom!==void 0&&(this.maxzoom=y.maxzoom),y.type&&(this.type=y.type),y.attribution&&(this.attribution=y.attribution),this.promoteId=y.promoteId;const A=s.X/this.tileSize;y.clusterMaxZoom!==void 0&&this.maxzoom<=y.clusterMaxZoom&&s.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${y.clusterMaxZoom}".`),this.workerOptions=s.e({source:this.id,cluster:y.cluster||!1,geojsonVtOptions:{buffer:(y.buffer!==void 0?y.buffer:128)*A,tolerance:(y.tolerance!==void 0?y.tolerance:.375)*A,extent:s.X,maxZoom:this.maxzoom,lineMetrics:y.lineMetrics||!1,generateId:y.generateId||!1},superclusterOptions:{maxZoom:y.clusterMaxZoom!==void 0?y.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,y.clusterMinPoints||2),extent:s.X,radius:(y.clusterRadius||50)*A,log:!1,generateId:y.generateId||!1},clusterProperties:y.clusterProperties,filter:y.filter},y.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return s._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(u){this.map=u,this.load()}setData(u){return this._data=u,this._updateWorkerData(),this}updateData(u){return this._updateWorkerData(u),this}getData(){return s._(this,void 0,void 0,function*(){const u=s.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:u})})}setClusterOptions(u){return this.workerOptions.cluster=u.cluster,u&&(u.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=u.clusterRadius),u.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=u.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(u){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:u,source:this.id}})}getClusterChildren(u){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:u,source:this.id}})}getClusterLeaves(u,y,S){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:u,limit:y,offset:S}})}_updateWorkerData(u){return s._(this,void 0,void 0,function*(){const y=s.e({type:this.type},this.workerOptions);u?y.dataDiff=u:typeof this._data=="string"?(y.request=this.map._requestManager.transformRequest(f.resolveURL(this._data),"Source"),y.request.collectResourceTiming=this._collectResourceTiming):y.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new s.k("dataloading",{dataType:"source"}));try{const S=yield this.actor.sendAsync({type:"LD",data:y});if(this._pendingLoads--,this._removed||S.abandoned)return void this.fire(new s.k("dataabort",{dataType:"source"}));let T=null;S.resourceTiming&&S.resourceTiming[this.id]&&(T=S.resourceTiming[this.id].slice(0));const A={dataType:"source"};this._collectResourceTiming&&T&&T.length>0&&s.e(A,{resourceTiming:T}),this.fire(new s.k("data",Object.assign(Object.assign({},A),{sourceDataType:"metadata"}))),this.fire(new s.k("data",Object.assign(Object.assign({},A),{sourceDataType:"content"})))}catch(S){if(this._pendingLoads--,this._removed)return void this.fire(new s.k("dataabort",{dataType:"source"}));this.fire(new s.j(S))}})}loaded(){return this._pendingLoads===0}loadTile(u){return s._(this,void 0,void 0,function*(){const y=u.actor?"RT":"LT";u.actor=this.actor;const S={type:this.type,uid:u.uid,tileID:u.tileID,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};u.abortController=new AbortController;const T=yield this.actor.sendAsync({type:y,data:S},u.abortController);delete u.abortController,u.unloadVectorData(),u.aborted||u.loadVectorData(T,this.map.painter,y==="RT")})}abortTile(u){return s._(this,void 0,void 0,function*(){u.abortController&&(u.abortController.abort(),delete u.abortController),u.aborted=!0})}unloadTile(u){return s._(this,void 0,void 0,function*(){u.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:u.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 s.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ar=s.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class zn extends s.E{constructor(u,y,S,T){super(),this.id=u,this.dispatcher=S,this.coordinates=y.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(T),this.options=y}load(u){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const y=yield L.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,y&&y.data&&(this.image=y.data,u&&(this.coordinates=u),this._finishLoading())}catch(y){this._request=null,this._loaded=!0,this.fire(new s.j(y))}})}loaded(){return this._loaded}updateImage(u){return u.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=u.url,this.load(u.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new s.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(u){this.map=u,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(u){this.coordinates=u;const y=u.map(s.Z.fromLngLat);this.tileID=function(T){let A=1/0,N=1/0,B=-1/0,$=-1/0;for(const ae of T)A=Math.min(A,ae.x),N=Math.min(N,ae.y),B=Math.max(B,ae.x),$=Math.max($,ae.y);const q=Math.max(B-A,$-N),K=Math.max(0,Math.floor(-Math.log(q)/Math.LN2)),J=Math.pow(2,K);return new s.a1(K,Math.floor((A+B)/2*J),Math.floor((N+$)/2*J))}(y),this.minzoom=this.maxzoom=this.tileID.z;const S=y.map(T=>this.tileID.getTilePoint(T)._round());return this._boundsArray=new s.$,this._boundsArray.emplaceBack(S[0].x,S[0].y,0,0),this._boundsArray.emplaceBack(S[1].x,S[1].y,s.X,0),this._boundsArray.emplaceBack(S[3].x,S[3].y,0,s.X),this._boundsArray.emplaceBack(S[2].x,S[2].y,s.X,s.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const u=this.map.painter.context,y=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ar.members)),this.boundsSegments||(this.boundsSegments=s.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new X(u,this.image,y.RGBA),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE));let S=!1;for(const T in this.tiles){const A=this.tiles[T];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture,S=!0)}S&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(u){return s._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(u.tileID.canonical)?(this.tiles[String(u.tileID.wrap)]=u,u.buckets={}):u.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class fi extends zn{constructor(u,y,S,T){super(u,y,S,T),this.roundZoom=!0,this.type="video",this.options=y}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1;const u=this.options;this.urls=[];for(const y of u.urls)this.urls.push(this.map._requestManager.transformRequest(y,"Source").url);try{const y=yield s.a3(this.urls);if(this._loaded=!0,!y)return;this.video=y,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(y){this.fire(new s.j(y))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(u){if(this.video){const y=this.video.seekable;u<y.start(0)||u>y.end(0)?this.fire(new s.j(new s.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${y.start(0)} and ${y.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const u=this.map.painter.context,y=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ar.members)),this.boundsSegments||(this.boundsSegments=s.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE),y.texSubImage2D(y.TEXTURE_2D,0,0,0,y.RGBA,y.UNSIGNED_BYTE,this.video)):(this.texture=new X(u,this.video,y.RGBA),this.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE));let S=!1;for(const T in this.tiles){const A=this.tiles[T];A.state!=="loaded"&&(A.state="loaded",A.texture=this.texture,S=!0)}S&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class kn extends zn{constructor(u,y,S,T){super(u,y,S,T),y.coordinates?Array.isArray(y.coordinates)&&y.coordinates.length===4&&!y.coordinates.some(A=>!Array.isArray(A)||A.length!==2||A.some(N=>typeof N!="number"))||this.fire(new s.j(new s.a2(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.j(new s.a2(`sources.${u}`,null,'missing required property "coordinates"'))),y.animate&&typeof y.animate!="boolean"&&this.fire(new s.j(new s.a2(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),y.canvas?typeof y.canvas=="string"||y.canvas instanceof HTMLCanvasElement||this.fire(new s.j(new s.a2(`sources.${u}`,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 s.j(new s.a2(`sources.${u}`,null,'missing required property "canvas"'))),this.options=y,this.animate=y.animate===void 0||y.animate}load(){return s._(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 s.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const y=this.map.painter.context,S=y.gl;this.boundsBuffer||(this.boundsBuffer=y.createVertexBuffer(this._boundsArray,Ar.members)),this.boundsSegments||(this.boundsSegments=s.a0.simpleSegment(0,0,4,2)),this.texture?(u||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new X(y,this.canvas,S.RGBA,{premultiply:!0});let T=!1;for(const A in this.tiles){const N=this.tiles[A];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture,T=!0)}T&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}}const si={},Tt=D=>{switch(D){case"geojson":return br;case"image":return zn;case"raster":return nt;case"raster-dem":return Nr;case"vector":return yn;case"video":return fi;case"canvas":return kn}return si[D]},$e="RTLPluginLoaded";class er extends s.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ot()}_syncState(u){return this.status=u,this.dispatcher.broadcast("SRPS",{pluginStatus:u,pluginURL:this.url}).catch(y=>{throw this.status="error",y})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(u){return s._(this,arguments,void 0,function*(y,S=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=f.resolveURL(y),!this.url)throw new Error(`requested url ${y} is invalid`);if(this.status==="unavailable"){if(!S)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return s._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new s.k($e))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let sr=null;function Kr(){return sr||(sr=new er),sr}class Ln{constructor(u,y){this.timeAdded=0,this.fadeEndTime=0,this.tileID=u,this.uid=s.a4(),this.uses=0,this.tileSize=y,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(u){const y=u+this.timeAdded;y<this.fadeEndTime||(this.fadeEndTime=y)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(u){this.demTexture&&u.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(u,y,S){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",u){u.featureIndex&&(this.latestFeatureIndex=u.featureIndex,u.rawTileData?(this.latestRawTileData=u.rawTileData,this.latestFeatureIndex.rawTileData=u.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=u.collisionBoxArray,this.buckets=function(T,A){const N={};if(!A)return N;for(const B of T){const $=B.layerIds.map(q=>A.getLayer(q)).filter(Boolean);if($.length!==0){B.layers=$,B.stateDependentLayerIds&&(B.stateDependentLayers=B.stateDependentLayerIds.map(q=>$.filter(K=>K.id===q)[0]));for(const q of $)N[q.id]=B}}return N}(u.buckets,y.style),this.hasSymbolBuckets=!1;for(const T in this.buckets){const A=this.buckets[T];if(A instanceof s.a6){if(this.hasSymbolBuckets=!0,!S)break;A.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const T in this.buckets){const A=this.buckets[T];if(A instanceof s.a6&&A.hasRTLText){this.hasRTLText=!0,Kr().lazyLoad();break}}this.queryPadding=0;for(const T in this.buckets){const A=this.buckets[T];this.queryPadding=Math.max(this.queryPadding,y.style.getLayer(T).queryRadius(A))}u.imageAtlas&&(this.imageAtlas=u.imageAtlas),u.glyphAtlasImage&&(this.glyphAtlasImage=u.glyphAtlasImage)}else this.collisionBoxArray=new s.a5}unloadVectorData(){for(const u in this.buckets)this.buckets[u].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(u){return this.buckets[u.id]}upload(u){for(const S in this.buckets){const T=this.buckets[S];T.uploadPending()&&T.upload(u)}const y=u.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new X(u,this.imageAtlas.image,y.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new X(u,this.glyphAtlasImage,y.ALPHA),this.glyphAtlasImage=null)}prepare(u){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(u,this.imageAtlasTexture)}queryRenderedFeatures(u,y,S,T,A,N,B,$,q,K){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:T,cameraQueryGeometry:A,scale:N,tileSize:this.tileSize,pixelPosMatrix:K,transform:$,params:B,queryPadding:this.queryPadding*q},u,y,S):{}}querySourceFeatures(u,y){const S=this.latestFeatureIndex;if(!S||!S.rawTileData)return;const T=S.loadVTLayers(),A=y&&y.sourceLayer?y.sourceLayer:"",N=T._geojsonTileLayer||T[A];if(!N)return;const B=s.a7(y&&y.filter),{z:$,x:q,y:K}=this.tileID.canonical,J={z:$,x:q,y:K};for(let ae=0;ae<N.length;ae++){const ue=N.feature(ae);if(B.needGeometry){const Se=s.a8(ue,!0);if(!B.filter(new s.z(this.tileID.overscaledZ),Se,this.tileID.canonical))continue}else if(!B.filter(new s.z(this.tileID.overscaledZ),ue))continue;const fe=S.getId(ue,A),be=new s.a9(ue,$,q,K,fe);be.tile=J,u.push(be)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(u){const y=this.expirationTime;if(u.cacheControl){const S=s.aa(u.cacheControl);S["max-age"]&&(this.expirationTime=Date.now()+1e3*S["max-age"])}else u.expires&&(this.expirationTime=new Date(u.expires).getTime());if(this.expirationTime){const S=Date.now();let T=!1;if(this.expirationTime>S)T=!1;else if(y)if(this.expirationTime<y)T=!0;else{const A=this.expirationTime-y;A?this.expirationTime=S+Math.max(A,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(u,y){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(u).length===0)return;const S=this.latestFeatureIndex.loadVTLayers();for(const T in this.buckets){if(!y.style.hasLayer(T))continue;const A=this.buckets[T],N=A.layers[0].sourceLayer||"_geojsonTileLayer",B=S[N],$=u[N];if(!B||!$||Object.keys($).length===0)continue;A.update($,B,this.imageAtlas&&this.imageAtlas.patternPositions||{});const q=y&&y.style&&y.style.getLayer(T);q&&(this.queryPadding=Math.max(this.queryPadding,q.queryRadius(A)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<f.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(u){this.symbolFadeHoldUntil=f.now()+u}setDependencies(u,y){const S={};for(const T of y)S[T]=!0;this.dependencies[u]=S}hasDependency(u,y){for(const S of u){const T=this.dependencies[S];if(T){for(const A of y)if(T[A])return!0}}return!1}}class ut{constructor(u,y){this.max=u,this.onRemove=y,this.reset()}reset(){for(const u in this.data)for(const y of this.data[u])y.timeout&&clearTimeout(y.timeout),this.onRemove(y.value);return this.data={},this.order=[],this}add(u,y,S){const T=u.wrapped().key;this.data[T]===void 0&&(this.data[T]=[]);const A={value:y,timeout:void 0};if(S!==void 0&&(A.timeout=setTimeout(()=>{this.remove(u,A)},S)),this.data[T].push(A),this.order.push(T),this.order.length>this.max){const N=this._getAndRemoveByKey(this.order[0]);N&&this.onRemove(N)}return this}has(u){return u.wrapped().key in this.data}getAndRemove(u){return this.has(u)?this._getAndRemoveByKey(u.wrapped().key):null}_getAndRemoveByKey(u){const y=this.data[u].shift();return y.timeout&&clearTimeout(y.timeout),this.data[u].length===0&&delete this.data[u],this.order.splice(this.order.indexOf(u),1),y.value}getByKey(u){const y=this.data[u];return y?y[0].value:null}get(u){return this.has(u)?this.data[u.wrapped().key][0].value:null}remove(u,y){if(!this.has(u))return this;const S=u.wrapped().key,T=y===void 0?0:this.data[S].indexOf(y),A=this.data[S][T];return this.data[S].splice(T,1),A.timeout&&clearTimeout(A.timeout),this.data[S].length===0&&delete this.data[S],this.onRemove(A.value),this.order.splice(this.order.indexOf(S),1),this}setMaxSize(u){for(this.max=u;this.order.length>this.max;){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}return this}filter(u){const y=[];for(const S in this.data)for(const T of this.data[S])u(T.value)||y.push(T);for(const S of y)this.remove(S.value.tileID,S)}}class hr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(u,y,S){const T=String(y);if(this.stateChanges[u]=this.stateChanges[u]||{},this.stateChanges[u][T]=this.stateChanges[u][T]||{},s.e(this.stateChanges[u][T],S),this.deletedStates[u]===null){this.deletedStates[u]={};for(const A in this.state[u])A!==T&&(this.deletedStates[u][A]=null)}else if(this.deletedStates[u]&&this.deletedStates[u][T]===null){this.deletedStates[u][T]={};for(const A in this.state[u][T])S[A]||(this.deletedStates[u][T][A]=null)}else for(const A in S)this.deletedStates[u]&&this.deletedStates[u][T]&&this.deletedStates[u][T][A]===null&&delete this.deletedStates[u][T][A]}removeFeatureState(u,y,S){if(this.deletedStates[u]===null)return;const T=String(y);if(this.deletedStates[u]=this.deletedStates[u]||{},S&&y!==void 0)this.deletedStates[u][T]!==null&&(this.deletedStates[u][T]=this.deletedStates[u][T]||{},this.deletedStates[u][T][S]=null);else if(y!==void 0)if(this.stateChanges[u]&&this.stateChanges[u][T])for(S in this.deletedStates[u][T]={},this.stateChanges[u][T])this.deletedStates[u][T][S]=null;else this.deletedStates[u][T]=null;else this.deletedStates[u]=null}getState(u,y){const S=String(y),T=s.e({},(this.state[u]||{})[S],(this.stateChanges[u]||{})[S]);if(this.deletedStates[u]===null)return{};if(this.deletedStates[u]){const A=this.deletedStates[u][y];if(A===null)return{};for(const N in A)delete T[N]}return T}initializeTileState(u,y){u.setFeatureState(this.state,y)}coalesceChanges(u,y){const S={};for(const T in this.stateChanges){this.state[T]=this.state[T]||{};const A={};for(const N in this.stateChanges[T])this.state[T][N]||(this.state[T][N]={}),s.e(this.state[T][N],this.stateChanges[T][N]),A[N]=this.state[T][N];S[T]=A}for(const T in this.deletedStates){this.state[T]=this.state[T]||{};const A={};if(this.deletedStates[T]===null)for(const N in this.state[T])A[N]={},this.state[T][N]={};else for(const N in this.deletedStates[T]){if(this.deletedStates[T][N]===null)this.state[T][N]={};else for(const B of Object.keys(this.deletedStates[T][N]))delete this.state[T][N][B];A[N]=this.state[T][N]}S[T]=S[T]||{},s.e(S[T],A)}if(this.stateChanges={},this.deletedStates={},Object.keys(S).length!==0)for(const T in u)u[T].setFeatureState(S,y)}}class Qt extends s.E{constructor(u,y,S){super(),this.id=u,this.dispatcher=S,this.on("data",T=>this._dataHandler(T)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((T,A,N,B)=>{const $=new(Tt(A.type))(T,A,N,B);if($.id!==T)throw new Error(`Expected Source id to be ${T} instead of ${$.id}`);return $})(u,y,S,this),this._tiles={},this._cache=new ut(0,T=>this._unloadTile(T)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new hr,this._didEmitContent=!1,this._updated=!1}onAdd(u){this.map=u,this._maxTileCacheSize=u?u._maxTileCacheSize:null,this._maxTileCacheZoomLevels=u?u._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(u)}onRemove(u){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(u)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const u in this._tiles){const y=this._tiles[u];if(y.state!=="loaded"&&y.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const u=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,u&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(u,y,S){return s._(this,void 0,void 0,function*(){try{yield this._source.loadTile(u),this._tileLoaded(u,y,S)}catch(T){u.state="errored",T.status!==404?this._source.fire(new s.j(T,{tile:u})):this.update(this.transform,this.terrain)}})}_unloadTile(u){this._source.unloadTile&&this._source.unloadTile(u)}_abortTile(u){this._source.abortTile&&this._source.abortTile(u),this._source.fire(new s.k("dataabort",{tile:u,coord:u.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(u){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const y in this._tiles){const S=this._tiles[y];S.upload(u),S.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(u=>u.tileID).sort(pi).map(u=>u.key)}getRenderableIds(u){const y=[];for(const S in this._tiles)this._isIdRenderable(S,u)&&y.push(this._tiles[S]);return u?y.sort((S,T)=>{const A=S.tileID,N=T.tileID,B=new s.P(A.canonical.x,A.canonical.y)._rotate(this.transform.angle),$=new s.P(N.canonical.x,N.canonical.y)._rotate(this.transform.angle);return A.overscaledZ-N.overscaledZ||$.y-B.y||$.x-B.x}).map(S=>S.tileID.key):y.map(S=>S.tileID).sort(pi).map(S=>S.key)}hasRenderableParent(u){const y=this.findLoadedParent(u,0);return!!y&&this._isIdRenderable(y.tileID.key)}_isIdRenderable(u,y){return this._tiles[u]&&this._tiles[u].hasData()&&!this._coveredTiles[u]&&(y||!this._tiles[u].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const u in this._tiles)this._tiles[u].state!=="errored"&&this._reloadTile(u,"reloading")}}_reloadTile(u,y){return s._(this,void 0,void 0,function*(){const S=this._tiles[u];S&&(S.state!=="loading"&&(S.state=y),yield this._loadTile(S,u,y))})}_tileLoaded(u,y,S){u.timeAdded=f.now(),S==="expired"&&(u.refreshedUponExpiration=!0),this._setTileReloadTimer(y,u),this.getSource().type==="raster-dem"&&u.dem&&this._backfillDEM(u),this._state.initializeTileState(u,this.map?this.map.painter:null),u.aborted||this._source.fire(new s.k("data",{dataType:"source",tile:u,coord:u.tileID}))}_backfillDEM(u){const y=this.getRenderableIds();for(let T=0;T<y.length;T++){const A=y[T];if(u.neighboringTiles&&u.neighboringTiles[A]){const N=this.getTileByID(A);S(u,N),S(N,u)}}function S(T,A){T.needsHillshadePrepare=!0,T.needsTerrainPrepare=!0;let N=A.tileID.canonical.x-T.tileID.canonical.x;const B=A.tileID.canonical.y-T.tileID.canonical.y,$=Math.pow(2,T.tileID.canonical.z),q=A.tileID.key;N===0&&B===0||Math.abs(B)>1||(Math.abs(N)>1&&(Math.abs(N+$)===1?N+=$:Math.abs(N-$)===1&&(N-=$)),A.dem&&T.dem&&(T.dem.backfillBorder(A.dem,N,B),T.neighboringTiles&&T.neighboringTiles[q]&&(T.neighboringTiles[q].backfilled=!0)))}}getTile(u){return this.getTileByID(u.key)}getTileByID(u){return this._tiles[u]}_retainLoadedChildren(u,y,S,T){for(const A in this._tiles){let N=this._tiles[A];if(T[A]||!N.hasData()||N.tileID.overscaledZ<=y||N.tileID.overscaledZ>S)continue;let B=N.tileID;for(;N&&N.tileID.overscaledZ>y+1;){const q=N.tileID.scaledTo(N.tileID.overscaledZ-1);N=this._tiles[q.key],N&&N.hasData()&&(B=q)}let $=B;for(;$.overscaledZ>y;)if($=$.scaledTo($.overscaledZ-1),u[$.key]){T[B.key]=B;break}}}findLoadedParent(u,y){if(u.key in this._loadedParentTiles){const S=this._loadedParentTiles[u.key];return S&&S.tileID.overscaledZ>=y?S:null}for(let S=u.overscaledZ-1;S>=y;S--){const T=u.scaledTo(S),A=this._getLoadedTile(T);if(A)return A}}findLoadedSibling(u){return this._getLoadedTile(u)}_getLoadedTile(u){const y=this._tiles[u.key];return y&&y.hasData()?y:this._cache.getByKey(u.wrapped().key)}updateCacheSize(u){const y=Math.ceil(u.width/this._source.tileSize)+1,S=Math.ceil(u.height/this._source.tileSize)+1,T=Math.floor(y*S*(this._maxTileCacheZoomLevels===null?s.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),A=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,T):T;this._cache.setMaxSize(A)}handleWrapJump(u){const y=Math.round((u-(this._prevLng===void 0?u:this._prevLng))/360);if(this._prevLng=u,y){const S={};for(const T in this._tiles){const A=this._tiles[T];A.tileID=A.tileID.unwrapTo(A.tileID.wrap+y),S[A.tileID.key]=A}this._tiles=S;for(const T in this._timers)clearTimeout(this._timers[T]),delete this._timers[T];for(const T in this._tiles)this._setTileReloadTimer(T,this._tiles[T])}}_updateCoveredAndRetainedTiles(u,y,S,T,A,N){const B={},$={},q=Object.keys(u),K=f.now();for(const J of q){const ae=u[J],ue=this._tiles[J];if(!ue||ue.fadeEndTime!==0&&ue.fadeEndTime<=K)continue;const fe=this.findLoadedParent(ae,y),be=this.findLoadedSibling(ae),Se=fe||be||null;Se&&(this._addTile(Se.tileID),B[Se.tileID.key]=Se.tileID),$[J]=ae}this._retainLoadedChildren($,T,S,u);for(const J in B)u[J]||(this._coveredTiles[J]=!0,u[J]=B[J]);if(N){const J={},ae={};for(const ue of A)this._tiles[ue.key].hasData()?J[ue.key]=ue:ae[ue.key]=ue;for(const ue in ae){const fe=ae[ue].children(this._source.maxzoom);this._tiles[fe[0].key]&&this._tiles[fe[1].key]&&this._tiles[fe[2].key]&&this._tiles[fe[3].key]&&(J[fe[0].key]=u[fe[0].key]=fe[0],J[fe[1].key]=u[fe[1].key]=fe[1],J[fe[2].key]=u[fe[2].key]=fe[2],J[fe[3].key]=u[fe[3].key]=fe[3],delete ae[ue])}for(const ue in ae){const fe=ae[ue],be=this.findLoadedParent(fe,this._source.minzoom),Se=this.findLoadedSibling(fe),Te=be||Se||null;if(Te){J[Te.tileID.key]=u[Te.tileID.key]=Te.tileID;for(const Ce in J)J[Ce].isChildOf(Te.tileID)&&delete J[Ce]}}for(const ue in this._tiles)J[ue]||(this._coveredTiles[ue]=!0)}}update(u,y){if(!this._sourceLoaded||this._paused)return;let S;this.transform=u,this.terrain=y,this.updateCacheSize(u),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?S=u.getVisibleUnwrappedCoordinates(this._source.tileID).map(K=>new s.S(K.canonical.z,K.wrap,K.canonical.z,K.canonical.x,K.canonical.y)):(S=u.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:y}),this._source.hasTile&&(S=S.filter(K=>this._source.hasTile(K)))):S=[];const T=u.coveringZoomLevel(this._source),A=Math.max(T-Qt.maxOverzooming,this._source.minzoom),N=Math.max(T+Qt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const K={};for(const J of S)if(J.canonical.z>this._source.minzoom){const ae=J.scaledTo(J.canonical.z-1);K[ae.key]=ae;const ue=J.scaledTo(Math.max(this._source.minzoom,Math.min(J.canonical.z,5)));K[ue.key]=ue}S=S.concat(Object.values(K))}const B=S.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,B&&this.fire(new s.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const $=this._updateRetainedTiles(S,T);la(this._source.type)&&this._updateCoveredAndRetainedTiles($,A,N,T,S,y);for(const K in $)this._tiles[K].clearFadeHold();const q=s.ab(this._tiles,$);for(const K of q){const J=this._tiles[K];J.hasSymbolBuckets&&!J.holdingForFade()?J.setHoldDuration(this.map._fadeDuration):J.hasSymbolBuckets&&!J.symbolFadeFinished()||this._removeTile(K)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const u in this._tiles)this._tiles[u].holdingForFade()&&this._removeTile(u)}_updateRetainedTiles(u,y){var S;const T={},A={},N=Math.max(y-Qt.maxOverzooming,this._source.minzoom),B=Math.max(y+Qt.maxUnderzooming,this._source.minzoom),$={};for(const q of u){const K=this._addTile(q);T[q.key]=q,K.hasData()||y<this._source.maxzoom&&($[q.key]=q)}this._retainLoadedChildren($,y,B,T);for(const q of u){let K=this._tiles[q.key];if(K.hasData())continue;if(y+1>this._source.maxzoom){const ae=q.children(this._source.maxzoom)[0],ue=this.getTile(ae);if(ue&&ue.hasData()){T[ae.key]=ae;continue}}else{const ae=q.children(this._source.maxzoom);if(T[ae[0].key]&&T[ae[1].key]&&T[ae[2].key]&&T[ae[3].key])continue}let J=K.wasRequested();for(let ae=q.overscaledZ-1;ae>=N;--ae){const ue=q.scaledTo(ae);if(A[ue.key])break;if(A[ue.key]=!0,K=this.getTile(ue),!K&&J&&(K=this._addTile(ue)),K){const fe=K.hasData();if((fe||!(!((S=this.map)===null||S===void 0)&&S.cancelPendingTileRequestsWhileZooming)||J)&&(T[ue.key]=ue),J=K.wasRequested(),fe)break}}}return T}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const u in this._tiles){const y=[];let S,T=this._tiles[u].tileID;for(;T.overscaledZ>0;){if(T.key in this._loadedParentTiles){S=this._loadedParentTiles[T.key];break}y.push(T.key);const A=T.scaledTo(T.overscaledZ-1);if(S=this._getLoadedTile(A),S)break;T=A}for(const A of y)this._loadedParentTiles[A]=S}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const u in this._tiles){const y=this._tiles[u].tileID,S=this._getLoadedTile(y);this._loadedSiblingTiles[y.key]=S}}_addTile(u){let y=this._tiles[u.key];if(y)return y;y=this._cache.getAndRemove(u),y&&(this._setTileReloadTimer(u.key,y),y.tileID=u,this._state.initializeTileState(y,this.map?this.map.painter:null),this._cacheTimers[u.key]&&(clearTimeout(this._cacheTimers[u.key]),delete this._cacheTimers[u.key],this._setTileReloadTimer(u.key,y)));const S=y;return y||(y=new Ln(u,this._source.tileSize*u.overscaleFactor()),this._loadTile(y,u.key,y.state)),y.uses++,this._tiles[u.key]=y,S||this._source.fire(new s.k("dataloading",{tile:y,coord:y.tileID,dataType:"source"})),y}_setTileReloadTimer(u,y){u in this._timers&&(clearTimeout(this._timers[u]),delete this._timers[u]);const S=y.getExpiryTimeout();S&&(this._timers[u]=setTimeout(()=>{this._reloadTile(u,"expired"),delete this._timers[u]},S))}_removeTile(u){const y=this._tiles[u];y&&(y.uses--,delete this._tiles[u],this._timers[u]&&(clearTimeout(this._timers[u]),delete this._timers[u]),y.uses>0||(y.hasData()&&y.state!=="reloading"?this._cache.add(y.tileID,y,y.getExpiryTimeout()):(y.aborted=!0,this._abortTile(y),this._unloadTile(y))))}_dataHandler(u){const y=u.sourceDataType;u.dataType==="source"&&y==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&y==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const u in this._tiles)this._removeTile(u);this._cache.reset()}tilesIn(u,y,S){const T=[],A=this.transform;if(!A)return T;const N=S?A.getCameraQueryGeometry(u):u,B=u.map(fe=>A.pointCoordinate(fe,this.terrain)),$=N.map(fe=>A.pointCoordinate(fe,this.terrain)),q=this.getIds();let K=1/0,J=1/0,ae=-1/0,ue=-1/0;for(const fe of $)K=Math.min(K,fe.x),J=Math.min(J,fe.y),ae=Math.max(ae,fe.x),ue=Math.max(ue,fe.y);for(let fe=0;fe<q.length;fe++){const be=this._tiles[q[fe]];if(be.holdingForFade())continue;const Se=be.tileID,Te=Math.pow(2,A.zoom-be.tileID.overscaledZ),Ce=y*be.queryPadding*s.X/be.tileSize/Te,ve=[Se.getTilePoint(new s.Z(K,J)),Se.getTilePoint(new s.Z(ae,ue))];if(ve[0].x-Ce<s.X&&ve[0].y-Ce<s.X&&ve[1].x+Ce>=0&&ve[1].y+Ce>=0){const Ie=B.map(Ve=>Se.getTilePoint(Ve)),Pe=$.map(Ve=>Se.getTilePoint(Ve));T.push({tile:be,tileID:Se,queryGeometry:Ie,cameraQueryGeometry:Pe,scale:Te})}}return T}getVisibleCoordinates(u){const y=this.getRenderableIds(u).map(S=>this._tiles[S].tileID);for(const S of y)S.posMatrix=this.transform.calculatePosMatrix(S.toUnwrapped());return y}hasTransition(){if(this._source.hasTransition())return!0;if(la(this._source.type)){const u=f.now();for(const y in this._tiles)if(this._tiles[y].fadeEndTime>=u)return!0}return!1}setFeatureState(u,y,S){this._state.updateState(u=u||"_geojsonTileLayer",y,S)}removeFeatureState(u,y,S){this._state.removeFeatureState(u=u||"_geojsonTileLayer",y,S)}getFeatureState(u,y){return this._state.getState(u=u||"_geojsonTileLayer",y)}setDependencies(u,y,S){const T=this._tiles[u];T&&T.setDependencies(y,S)}reloadTilesForDependencies(u,y){for(const S in this._tiles)this._tiles[S].hasDependency(u,y)&&this._reloadTile(S,"reloading");this._cache.filter(S=>!S.hasDependency(u,y))}}function pi(D,u){const y=Math.abs(2*D.wrap)-+(D.wrap<0),S=Math.abs(2*u.wrap)-+(u.wrap<0);return D.overscaledZ-u.overscaledZ||S-y||u.canonical.y-D.canonical.y||u.canonical.x-D.canonical.x}function la(D){return D==="raster"||D==="image"||D==="video"}Qt.maxOverzooming=10,Qt.maxUnderzooming=3;class Lt{constructor(u,y){this.reset(u,y)}reset(u,y){this.points=u||[],this._distances=[0];for(let S=1;S<this.points.length;S++)this._distances[S]=this._distances[S-1]+this.points[S].dist(this.points[S-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(y||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(u){if(this.points.length===1)return this.points[0];u=s.ac(u,0,1);let y=1,S=this._distances[y];const T=u*this.paddedLength+this.padding;for(;S<T&&y<this._distances.length;)S=this._distances[++y];const A=y-1,N=this._distances[A],B=S-N,$=B>0?(T-N)/B:0;return this.points[A].mult(1-$).add(this.points[y].mult($))}}function Di(D,u){let y=!0;return D==="always"||D!=="never"&&u!=="never"||(y=!1),y}class Mi{constructor(u,y,S){const T=this.boxCells=[],A=this.circleCells=[];this.xCellCount=Math.ceil(u/S),this.yCellCount=Math.ceil(y/S);for(let N=0;N<this.xCellCount*this.yCellCount;N++)T.push([]),A.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=u,this.height=y,this.xScale=this.xCellCount/u,this.yScale=this.yCellCount/y,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(u,y,S,T,A){this._forEachCell(y,S,T,A,this._insertBoxCell,this.boxUid++),this.boxKeys.push(u),this.bboxes.push(y),this.bboxes.push(S),this.bboxes.push(T),this.bboxes.push(A)}insertCircle(u,y,S,T){this._forEachCell(y-T,S-T,y+T,S+T,this._insertCircleCell,this.circleUid++),this.circleKeys.push(u),this.circles.push(y),this.circles.push(S),this.circles.push(T)}_insertBoxCell(u,y,S,T,A,N){this.boxCells[A].push(N)}_insertCircleCell(u,y,S,T,A,N){this.circleCells[A].push(N)}_query(u,y,S,T,A,N,B){if(S<0||u>this.width||T<0||y>this.height)return[];const $=[];if(u<=0&&y<=0&&this.width<=S&&this.height<=T){if(A)return[{key:null,x1:u,y1:y,x2:S,y2:T}];for(let q=0;q<this.boxKeys.length;q++)$.push({key:this.boxKeys[q],x1:this.bboxes[4*q],y1:this.bboxes[4*q+1],x2:this.bboxes[4*q+2],y2:this.bboxes[4*q+3]});for(let q=0;q<this.circleKeys.length;q++){const K=this.circles[3*q],J=this.circles[3*q+1],ae=this.circles[3*q+2];$.push({key:this.circleKeys[q],x1:K-ae,y1:J-ae,x2:K+ae,y2:J+ae})}}else this._forEachCell(u,y,S,T,this._queryCell,$,{hitTest:A,overlapMode:N,seenUids:{box:{},circle:{}}},B);return $}query(u,y,S,T){return this._query(u,y,S,T,!1,null)}hitTest(u,y,S,T,A,N){return this._query(u,y,S,T,!0,A,N).length>0}hitTestCircle(u,y,S,T,A){const N=u-S,B=u+S,$=y-S,q=y+S;if(B<0||N>this.width||q<0||$>this.height)return!1;const K=[];return this._forEachCell(N,$,B,q,this._queryCellCircle,K,{hitTest:!0,overlapMode:T,circle:{x:u,y,radius:S},seenUids:{box:{},circle:{}}},A),K.length>0}_queryCell(u,y,S,T,A,N,B,$){const{seenUids:q,hitTest:K,overlapMode:J}=B,ae=this.boxCells[A];if(ae!==null){const fe=this.bboxes;for(const be of ae)if(!q.box[be]){q.box[be]=!0;const Se=4*be,Te=this.boxKeys[be];if(u<=fe[Se+2]&&y<=fe[Se+3]&&S>=fe[Se+0]&&T>=fe[Se+1]&&(!$||$(Te))&&(!K||!Di(J,Te.overlapMode))&&(N.push({key:Te,x1:fe[Se],y1:fe[Se+1],x2:fe[Se+2],y2:fe[Se+3]}),K))return!0}}const ue=this.circleCells[A];if(ue!==null){const fe=this.circles;for(const be of ue)if(!q.circle[be]){q.circle[be]=!0;const Se=3*be,Te=this.circleKeys[be];if(this._circleAndRectCollide(fe[Se],fe[Se+1],fe[Se+2],u,y,S,T)&&(!$||$(Te))&&(!K||!Di(J,Te.overlapMode))){const Ce=fe[Se],ve=fe[Se+1],Ie=fe[Se+2];if(N.push({key:Te,x1:Ce-Ie,y1:ve-Ie,x2:Ce+Ie,y2:ve+Ie}),K)return!0}}}return!1}_queryCellCircle(u,y,S,T,A,N,B,$){const{circle:q,seenUids:K,overlapMode:J}=B,ae=this.boxCells[A];if(ae!==null){const fe=this.bboxes;for(const be of ae)if(!K.box[be]){K.box[be]=!0;const Se=4*be,Te=this.boxKeys[be];if(this._circleAndRectCollide(q.x,q.y,q.radius,fe[Se+0],fe[Se+1],fe[Se+2],fe[Se+3])&&(!$||$(Te))&&!Di(J,Te.overlapMode))return N.push(!0),!0}}const ue=this.circleCells[A];if(ue!==null){const fe=this.circles;for(const be of ue)if(!K.circle[be]){K.circle[be]=!0;const Se=3*be,Te=this.circleKeys[be];if(this._circlesCollide(fe[Se],fe[Se+1],fe[Se+2],q.x,q.y,q.radius)&&(!$||$(Te))&&!Di(J,Te.overlapMode))return N.push(!0),!0}}}_forEachCell(u,y,S,T,A,N,B,$){const q=this._convertToXCellCoord(u),K=this._convertToYCellCoord(y),J=this._convertToXCellCoord(S),ae=this._convertToYCellCoord(T);for(let ue=q;ue<=J;ue++)for(let fe=K;fe<=ae;fe++)if(A.call(this,u,y,S,T,this.xCellCount*fe+ue,N,B,$))return}_convertToXCellCoord(u){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(u*this.xScale)))}_convertToYCellCoord(u){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(u*this.yScale)))}_circlesCollide(u,y,S,T,A,N){const B=T-u,$=A-y,q=S+N;return q*q>B*B+$*$}_circleAndRectCollide(u,y,S,T,A,N,B){const $=(N-T)/2,q=Math.abs(u-(T+$));if(q>$+S)return!1;const K=(B-A)/2,J=Math.abs(y-(A+K));if(J>K+S)return!1;if(q<=$||J<=K)return!0;const ae=q-$,ue=J-K;return ae*ae+ue*ue<=S*S}}function Co(D,u,y,S,T){const A=s.H();return u?(s.K(A,A,[1/T,1/T,1]),y||s.ad(A,A,S.angle)):s.L(A,S.labelPlaneMatrix,D),A}function Ao(D,u,y,S,T){if(u){const A=s.ae(D);return s.K(A,A,[T,T,1]),y||s.ad(A,A,-S.angle),A}return S.glCoordMatrix}function xe(D,u,y,S){let T;S?(T=[D,u,S(D,u),1],s.af(T,T,y)):(T=[D,u,0,1],Or(T,T,y));const A=T[3];return{point:new s.P(T[0]/A,T[1]/A),signedDistanceFromCamera:A,isOccluded:!1}}function re(D,u){return .5+D/u*.5}function te(D,u){return D.x>=-u[0]&&D.x<=u[0]&&D.y>=-u[1]&&D.y<=u[1]}function he(D,u,y,S,T,A,N,B,$,q,K,J,ae,ue,fe){const be=S?D.textSizeData:D.iconSizeData,Se=s.ag(be,y.transform.zoom),Te=[256/y.width*2+1,256/y.height*2+1],Ce=S?D.text.dynamicLayoutVertexArray:D.icon.dynamicLayoutVertexArray;Ce.clear();const ve=D.lineVertexArray,Ie=S?D.text.placedSymbolArray:D.icon.placedSymbolArray,Pe=y.transform.width/y.transform.height;let Ve=!1;for(let Ke=0;Ke<Ie.length;Ke++){const st=Ie.get(Ke);if(st.hidden||st.writingMode===s.ah.vertical&&!Ve){Xt(st.numGlyphs,Ce);continue}Ve=!1;const bt=xe(st.anchorX,st.anchorY,u,fe);if(!te(bt.point,Te)){Xt(st.numGlyphs,Ce);continue}const Mt=re(y.transform.cameraToCenterDistance,bt.signedDistanceFromCamera),gt=s.ai(be,Se,st),pt=N?gt/Mt:gt*Mt,zt={getElevation:fe,labelPlaneMatrix:T,lineVertexArray:ve,pitchWithMap:N,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:q,tileAnchorPoint:new s.P(st.anchorX,st.anchorY),unwrappedTileID:K,width:J,height:ae,translation:ue},or=ke(zt,st,pt,!1,B,u,A,D.glyphOffsetArray,Ce,Pe,$);Ve=or.useVertical,(or.notEnoughRoom||Ve||or.needsFlipping&&ke(zt,st,pt,!0,B,u,A,D.glyphOffsetArray,Ce,Pe,$).notEnoughRoom)&&Xt(st.numGlyphs,Ce)}S?D.text.dynamicLayoutVertexBuffer.updateData(Ce):D.icon.dynamicLayoutVertexBuffer.updateData(Ce)}function _e(D,u,y,S,T,A,N,B){const $=A.glyphStartIndex+A.numGlyphs,q=A.lineStartIndex,K=A.lineStartIndex+A.lineLength,J=u.getoffsetX(A.glyphStartIndex),ae=u.getoffsetX($-1),ue=ft(D*J,y,S,T,A.segment,q,K,B,N);if(!ue)return null;const fe=ft(D*ae,y,S,T,A.segment,q,K,B,N);return fe?B.projectionCache.anyProjectionOccluded?null:{first:ue,last:fe}:null}function De(D,u,y,S){return D===s.ah.horizontal&&Math.abs(y.y-u.y)>Math.abs(y.x-u.x)*S?{useVertical:!0}:(D===s.ah.vertical?u.y<y.y:u.x>y.x)?{needsFlipping:!0}:null}function ke(D,u,y,S,T,A,N,B,$,q,K){const J=y/24,ae=u.lineOffsetX*J,ue=u.lineOffsetY*J;let fe;if(u.numGlyphs>1){const be=u.glyphStartIndex+u.numGlyphs,Se=u.lineStartIndex,Te=u.lineStartIndex+u.lineLength,Ce=_e(J,B,ae,ue,S,u,K,D);if(!Ce)return{notEnoughRoom:!0};const ve=xe(Ce.first.point.x,Ce.first.point.y,N,D.getElevation).point,Ie=xe(Ce.last.point.x,Ce.last.point.y,N,D.getElevation).point;if(T&&!S){const Pe=De(u.writingMode,ve,Ie,q);if(Pe)return Pe}fe=[Ce.first];for(let Pe=u.glyphStartIndex+1;Pe<be-1;Pe++)fe.push(ft(J*B.getoffsetX(Pe),ae,ue,S,u.segment,Se,Te,D,K));fe.push(Ce.last)}else{if(T&&!S){const Se=xe(D.tileAnchorPoint.x,D.tileAnchorPoint.y,A,D.getElevation).point,Te=u.lineStartIndex+u.segment+1,Ce=new s.P(D.lineVertexArray.getx(Te),D.lineVertexArray.gety(Te)),ve=xe(Ce.x,Ce.y,A,D.getElevation),Ie=ve.signedDistanceFromCamera>0?ve.point:function(Ve,Ke,st,bt,Mt,gt){return Ne(Ve,Ke,st,1,Mt,gt)}(D.tileAnchorPoint,Ce,Se,0,A,D),Pe=De(u.writingMode,Se,Ie,q);if(Pe)return Pe}const be=ft(J*B.getoffsetX(u.glyphStartIndex),ae,ue,S,u.segment,u.lineStartIndex,u.lineStartIndex+u.lineLength,D,K);if(!be||D.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};fe=[be]}for(const be of fe)s.aj($,be.point,be.angle);return{}}function Ne(D,u,y,S,T,A){const N=D.add(D.sub(u)._unit()),B=T!==void 0?xe(N.x,N.y,T,A.getElevation).point:We(N.x,N.y,A).point,$=y.sub(B);return y.add($._mult(S/$.mag()))}function Ee(D,u,y){const S=u.projectionCache;if(S.projections[D])return S.projections[D];const T=new s.P(u.lineVertexArray.getx(D),u.lineVertexArray.gety(D)),A=We(T.x,T.y,u);if(A.signedDistanceFromCamera>0)return S.projections[D]=A.point,S.anyProjectionOccluded=S.anyProjectionOccluded||A.isOccluded,A.point;const N=D-y.direction;return function(B,$,q,K,J){return Ne(B,$,q,K,void 0,J)}(y.distanceFromAnchor===0?u.tileAnchorPoint:new s.P(u.lineVertexArray.getx(N),u.lineVertexArray.gety(N)),T,y.previousVertex,y.absOffsetX-y.distanceFromAnchor+1,u)}function We(D,u,y){const S=D+y.translation[0],T=u+y.translation[1];let A;return!y.pitchWithMap&&y.projection.useSpecialProjectionForSymbols?(A=y.projection.projectTileCoordinates(S,T,y.unwrappedTileID,y.getElevation),A.point.x=(.5*A.point.x+.5)*y.width,A.point.y=(.5*-A.point.y+.5)*y.height):(A=xe(S,T,y.labelPlaneMatrix,y.getElevation),A.isOccluded=!1),A}function Je(D,u,y){return D._unit()._perp()._mult(u*y)}function Ge(D,u,y,S,T,A,N,B,$){if(B.projectionCache.offsets[D])return B.projectionCache.offsets[D];const q=y.add(u);if(D+$.direction<S||D+$.direction>=T)return B.projectionCache.offsets[D]=q,q;const K=Ee(D+$.direction,B,$),J=Je(K.sub(y),N,$.direction),ae=y.add(J),ue=K.add(J);return B.projectionCache.offsets[D]=s.ak(A,q,ae,ue)||q,B.projectionCache.offsets[D]}function ft(D,u,y,S,T,A,N,B,$){const q=S?D-u:D+u;let K=q>0?1:-1,J=0;S&&(K*=-1,J=Math.PI),K<0&&(J+=Math.PI);let ae,ue=K>0?A+T:A+T+1;B.projectionCache.cachedAnchorPoint?ae=B.projectionCache.cachedAnchorPoint:(ae=We(B.tileAnchorPoint.x,B.tileAnchorPoint.y,B).point,B.projectionCache.cachedAnchorPoint=ae);let fe,be,Se=ae,Te=ae,Ce=0,ve=0;const Ie=Math.abs(q),Pe=[];let Ve;for(;Ce+ve<=Ie;){if(ue+=K,ue<A||ue>=N)return null;Ce+=ve,Te=Se,be=fe;const bt={absOffsetX:Ie,direction:K,distanceFromAnchor:Ce,previousVertex:Te};if(Se=Ee(ue,B,bt),y===0)Pe.push(Te),Ve=Se.sub(Te);else{let Mt;const gt=Se.sub(Te);Mt=gt.mag()===0?Je(Ee(ue+K,B,bt).sub(Se),y,K):Je(gt,y,K),be||(be=Te.add(Mt)),fe=Ge(ue,Mt,Se,A,N,be,y,B,bt),Pe.push(be),Ve=fe.sub(be)}ve=Ve.mag()}const Ke=Ve._mult((Ie-Ce)/ve)._add(be||Te),st=J+Math.atan2(Se.y-Te.y,Se.x-Te.x);return Pe.push(Ke),{point:Ke,angle:$?st:0,path:Pe}}const Wt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(D,u){for(let y=0;y<D;y++){const S=u.length;u.resize(S+4),u.float32.set(Wt,3*S)}}function Or(D,u,y){const S=u[0],T=u[1];return D[0]=y[0]*S+y[4]*T+y[12],D[1]=y[1]*S+y[5]*T+y[13],D[3]=y[3]*S+y[7]*T+y[15],D}const dr=100;class zr{constructor(u,y,S=new Mi(u.width+200,u.height+200,25),T=new Mi(u.width+200,u.height+200,25)){this.transform=u,this.mapProjection=y,this.grid=S,this.ignoredGrid=T,this.pitchFactor=Math.cos(u._pitch)*u.cameraToCenterDistance,this.screenRightBoundary=u.width+dr,this.screenBottomBoundary=u.height+dr,this.gridRightBoundary=u.width+200,this.gridBottomBoundary=u.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(u,y,S,T,A,N,B,$,q,K,J){const ae=u.anchorPointX+$[0],ue=u.anchorPointY+$[1],fe=this.projectAndGetPerspectiveRatio(T,ae,ue,A,K),be=S*fe.perspectiveRatio;let Se;if(N||B)Se=this._projectCollisionBox(u,be,T,A,N,B,$,fe,K,J);else{const Pe=fe.point.x+(J?J.x*be:0),Ve=fe.point.y+(J?J.y*be:0);Se={allPointsOccluded:!1,box:[Pe+u.x1*be,Ve+u.y1*be,Pe+u.x2*be,Ve+u.y2*be]}}const[Te,Ce,ve,Ie]=Se.box;return this.mapProjection.useSpecialProjectionForSymbols&&(N?Se.allPointsOccluded:this.mapProjection.isOccluded(ae,ue,A))||fe.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(Te,Ce,ve,Ie)||y!=="always"&&this.grid.hitTest(Te,Ce,ve,Ie,y,q)?{box:[Te,Ce,ve,Ie],placeable:!1,offscreen:!1}:{box:[Te,Ce,ve,Ie],placeable:!0,offscreen:this.isOffscreen(Te,Ce,ve,Ie)}}placeCollisionCircles(u,y,S,T,A,N,B,$,q,K,J,ae,ue,fe,be,Se){const Te=[],Ce=new s.P(y.anchorX,y.anchorY),ve=this.getPerspectiveRatio(N,Ce.x,Ce.y,B,Se),Ie=(J?A/ve:A*ve)/s.ap,Pe={getElevation:Se,labelPlaneMatrix:$,lineVertexArray:S,pitchWithMap:J,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Ce,unwrappedTileID:B,width:this.transform.width,height:this.transform.height,translation:be},Ve=_e(Ie,T,y.lineOffsetX*Ie,y.lineOffsetY*Ie,!1,y,!1,Pe);let Ke=!1,st=!1,bt=!0;if(Ve){const Mt=.5*ue*ve+fe,gt=new s.P(-100,-100),pt=new s.P(this.screenRightBoundary,this.screenBottomBoundary),zt=new Lt,or=Ve.first,mt=Ve.last;let Et=[];for(let mr=or.path.length-1;mr>=1;mr--)Et.push(or.path[mr]);for(let mr=1;mr<mt.path.length;mr++)Et.push(mt.path[mr]);const rr=2.5*Mt;if(q){const mr=this.projectPathToScreenSpace(Et,Pe,q);Et=mr.some(Mr=>Mr.signedDistanceFromCamera<=0)?[]:mr.map(Mr=>Mr.point)}let fn=[];if(Et.length>0){const mr=Et[0].clone(),Mr=Et[0].clone();for(let pn=1;pn<Et.length;pn++)mr.x=Math.min(mr.x,Et[pn].x),mr.y=Math.min(mr.y,Et[pn].y),Mr.x=Math.max(Mr.x,Et[pn].x),Mr.y=Math.max(Mr.y,Et[pn].y);fn=mr.x>=gt.x&&Mr.x<=pt.x&&mr.y>=gt.y&&Mr.y<=pt.y?[Et]:Mr.x<gt.x||mr.x>pt.x||Mr.y<gt.y||mr.y>pt.y?[]:s.al([Et],gt.x,gt.y,pt.x,pt.y)}for(const mr of fn){zt.reset(mr,.25*Mt);let Mr=0;Mr=zt.length<=.5*Mt?1:Math.ceil(zt.paddedLength/rr)+1;for(let pn=0;pn<Mr;pn++){const vi=pn/Math.max(Mr-1,1),ja=zt.lerp(vi),gn=ja.x+dr,Ui=ja.y+dr;Te.push(gn,Ui,Mt,0);const ki=gn-Mt,mi=Ui-Mt,Li=gn+Mt,ko=Ui+Mt;if(bt=bt&&this.isOffscreen(ki,mi,Li,ko),st=st||this.isInsideGrid(ki,mi,Li,ko),u!=="always"&&this.grid.hitTestCircle(gn,Ui,Mt,u,ae)&&(Ke=!0,!K))return{circles:[],offscreen:!1,collisionDetected:Ke}}}}return{circles:!K&&Ke||!st||ve<this.perspectiveRatioCutoff?[]:Te,offscreen:bt,collisionDetected:Ke}}projectPathToScreenSpace(u,y,S){return u.map(T=>xe(T.x,T.y,S,y.getElevation))}queryRenderedSymbols(u){if(u.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const y=[];let S=1/0,T=1/0,A=-1/0,N=-1/0;for(const K of u){const J=new s.P(K.x+dr,K.y+dr);S=Math.min(S,J.x),T=Math.min(T,J.y),A=Math.max(A,J.x),N=Math.max(N,J.y),y.push(J)}const B=this.grid.query(S,T,A,N).concat(this.ignoredGrid.query(S,T,A,N)),$={},q={};for(const K of B){const J=K.key;if($[J.bucketInstanceId]===void 0&&($[J.bucketInstanceId]={}),$[J.bucketInstanceId][J.featureIndex])continue;const ae=[new s.P(K.x1,K.y1),new s.P(K.x2,K.y1),new s.P(K.x2,K.y2),new s.P(K.x1,K.y2)];s.am(y,ae)&&($[J.bucketInstanceId][J.featureIndex]=!0,q[J.bucketInstanceId]===void 0&&(q[J.bucketInstanceId]=[]),q[J.bucketInstanceId].push(J.featureIndex))}return q}insertCollisionBox(u,y,S,T,A,N){(S?this.ignoredGrid:this.grid).insert({bucketInstanceId:T,featureIndex:A,collisionGroupID:N,overlapMode:y},u[0],u[1],u[2],u[3])}insertCollisionCircles(u,y,S,T,A,N){const B=S?this.ignoredGrid:this.grid,$={bucketInstanceId:T,featureIndex:A,collisionGroupID:N,overlapMode:y};for(let q=0;q<u.length;q+=4)B.insertCircle($,u[q],u[q+1],u[q+2])}projectAndGetPerspectiveRatio(u,y,S,T,A){let N;A?(N=[y,S,A(y,S),1],s.af(N,N,u)):(N=[y,S,0,1],Or(N,N,u));const B=N[3];return{point:new s.P((N[0]/B+1)/2*this.transform.width+dr,(-N[1]/B+1)/2*this.transform.height+dr),perspectiveRatio:.5+this.transform.cameraToCenterDistance/B*.5,isOccluded:!1,signedDistanceFromCamera:B}}getPerspectiveRatio(u,y,S,T,A){const N=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(y,S,T,A):xe(y,S,u,A);return .5+this.transform.cameraToCenterDistance/N.signedDistanceFromCamera*.5}isOffscreen(u,y,S,T){return S<dr||u>=this.screenRightBoundary||T<dr||y>this.screenBottomBoundary}isInsideGrid(u,y,S,T){return S>=0&&u<this.gridRightBoundary&&T>=0&&y<this.gridBottomBoundary}getViewportMatrix(){const u=s.an([]);return s.J(u,u,[-100,-100,0]),u}_projectCollisionBox(u,y,S,T,A,N,B,$,q,K){let J=new s.P(1,0),ae=new s.P(0,1);const ue=new s.P(u.anchorPointX+B[0],u.anchorPointY+B[1]);if(N&&!A){const bt=this.projectAndGetPerspectiveRatio(S,ue.x+1,ue.y,T,q).point.sub($.point).unit(),Mt=Math.atan(bt.y/bt.x)+(bt.x<0?Math.PI:0),gt=Math.sin(Mt),pt=Math.cos(Mt);J=new s.P(pt,gt),ae=new s.P(-gt,pt)}else if(!N&&A){const bt=-this.transform.angle,Mt=Math.sin(bt),gt=Math.cos(bt);J=new s.P(gt,Mt),ae=new s.P(-Mt,gt)}let fe=$.point,be=y;if(A){fe=ue;const bt=this.transform.zoom-Math.floor(this.transform.zoom);be=Math.pow(2,-bt),be*=this.mapProjection.getPitchedTextCorrection(this.transform,ue,T),K||(be*=s.ac(.5+$.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}K&&(fe=fe.add(J.mult(K.x*be)).add(ae.mult(K.y*be)));const Se=u.x1*be,Te=u.x2*be,Ce=(Se+Te)/2,ve=u.y1*be,Ie=u.y2*be,Pe=(ve+Ie)/2,Ve=[{offsetX:Se,offsetY:ve},{offsetX:Ce,offsetY:ve},{offsetX:Te,offsetY:ve},{offsetX:Te,offsetY:Pe},{offsetX:Te,offsetY:Ie},{offsetX:Ce,offsetY:Ie},{offsetX:Se,offsetY:Ie},{offsetX:Se,offsetY:Pe}];let Ke=[];for(const{offsetX:bt,offsetY:Mt}of Ve)Ke.push(new s.P(fe.x+J.x*bt+ae.x*Mt,fe.y+J.y*bt+ae.y*Mt));let st=!1;if(A){const bt=Ke.map(Mt=>this.projectAndGetPerspectiveRatio(S,Mt.x,Mt.y,T,q));st=bt.some(Mt=>!Mt.isOccluded),Ke=bt.map(Mt=>Mt.point)}else st=!0;return{box:s.ao(Ke),allPointsOccluded:!st}}}function Dr(D,u,y){return u*(s.X/(D.tileSize*Math.pow(2,y-D.tileID.overscaledZ)))}class Bn{constructor(u,y,S,T){this.opacity=u?Math.max(0,Math.min(1,u.opacity+(u.placed?y:-y))):T&&S?1:0,this.placed=S}isHidden(){return this.opacity===0&&!this.placed}}class Sn{constructor(u,y,S,T,A){this.text=new Bn(u?u.text:null,y,S,A),this.icon=new Bn(u?u.icon:null,y,T,A)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class xr{constructor(u,y,S){this.text=u,this.icon=y,this.skipFade=S}}class jr{constructor(){this.invProjMatrix=s.H(),this.viewportMatrix=s.H(),this.circles=[]}}class _n{constructor(u,y,S,T,A){this.bucketInstanceId=u,this.featureIndex=y,this.sourceLayerIndex=S,this.bucketIndex=T,this.tileID=A}}class Yn{constructor(u){this.crossSourceCollisions=u,this.maxGroupID=0,this.collisionGroups={}}get(u){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[u]){const y=++this.maxGroupID;this.collisionGroups[u]={ID:y,predicate:S=>S.collisionGroupID===y}}return this.collisionGroups[u]}}function li(D,u,y,S,T){const{horizontalAlign:A,verticalAlign:N}=s.au(D);return new s.P(-(A-.5)*u+S[0]*T,-(N-.5)*y+S[1]*T)}class Ii{constructor(u,y,S,T,A,N){this.transform=u.clone(),this.terrain=S,this.collisionIndex=new zr(this.transform,y),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=T,this.retainedQueryData={},this.collisionGroups=new Yn(A),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=N,N&&(N.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(u){const y=this.terrain;return y?(S,T)=>y.getElevation(u,S,T):null}getBucketParts(u,y,S,T){const A=S.getBucket(y),N=S.latestFeatureIndex;if(!A||!N||y.id!==A.layerIds[0])return;const B=S.collisionBoxArray,$=A.layers[0].layout,q=A.layers[0].paint,K=Math.pow(2,this.transform.zoom-S.tileID.overscaledZ),J=S.tileSize/s.X,ae=S.tileID.toUnwrapped(),ue=this.transform.calculatePosMatrix(ae),fe=$.get("text-pitch-alignment")==="map",be=$.get("text-rotation-alignment")==="map",Se=Dr(S,1,this.transform.zoom),Te=this.collisionIndex.mapProjection.translatePosition(this.transform,S,q.get("text-translate"),q.get("text-translate-anchor")),Ce=this.collisionIndex.mapProjection.translatePosition(this.transform,S,q.get("icon-translate"),q.get("icon-translate-anchor")),ve=Co(ue,fe,be,this.transform,Se);let Ie=null;if(fe){const Ve=Ao(ue,fe,be,this.transform,Se);Ie=s.L([],this.transform.labelPlaneMatrix,Ve)}this.retainedQueryData[A.bucketInstanceId]=new _n(A.bucketInstanceId,N,A.sourceLayerIndex,A.index,S.tileID);const Pe={bucket:A,layout:$,translationText:Te,translationIcon:Ce,posMatrix:ue,unwrappedTileID:ae,textLabelPlaneMatrix:ve,labelToScreenMatrix:Ie,scale:K,textPixelRatio:J,holdingForFade:S.holdingForFade(),collisionBoxArray:B,partiallyEvaluatedTextSize:s.ag(A.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(A.sourceID)};if(T)for(const Ve of A.sortKeyRanges){const{sortKey:Ke,symbolInstanceStart:st,symbolInstanceEnd:bt}=Ve;u.push({sortKey:Ke,symbolInstanceStart:st,symbolInstanceEnd:bt,parameters:Pe})}else u.push({symbolInstanceStart:0,symbolInstanceEnd:A.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(u,y,S,T,A,N,B,$,q,K,J,ae,ue,fe,be,Se,Te,Ce,ve){const Ie=s.aq[u.textAnchor],Pe=[u.textOffset0,u.textOffset1],Ve=li(Ie,S,T,Pe,A),Ke=this.collisionIndex.placeCollisionBox(y,ae,$,q,K,B,N,Se,J.predicate,ve,Ve);if((!Ce||this.collisionIndex.placeCollisionBox(Ce,ae,$,q,K,B,N,Te,J.predicate,ve,Ve).placeable)&&Ke.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ue.crossTileID]&&this.prevPlacement.placements[ue.crossTileID]&&this.prevPlacement.placements[ue.crossTileID].text&&(st=this.prevPlacement.variableOffsets[ue.crossTileID].anchor),ue.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ue.crossTileID]={textOffset:Pe,width:S,height:T,anchor:Ie,textBoxScale:A,prevAnchor:st},this.markUsedJustification(fe,Ie,ue,be),fe.allowVerticalPlacement&&(this.markUsedOrientation(fe,be,ue),this.placedOrientations[ue.crossTileID]=be),{shift:Ve,placedGlyphBoxes:Ke}}}placeLayerBucketPart(u,y,S){const{bucket:T,layout:A,translationText:N,translationIcon:B,posMatrix:$,unwrappedTileID:q,textLabelPlaneMatrix:K,labelToScreenMatrix:J,textPixelRatio:ae,holdingForFade:ue,collisionBoxArray:fe,partiallyEvaluatedTextSize:be,collisionGroup:Se}=u.parameters,Te=A.get("text-optional"),Ce=A.get("icon-optional"),ve=s.ar(A,"text-overlap","text-allow-overlap"),Ie=ve==="always",Pe=s.ar(A,"icon-overlap","icon-allow-overlap"),Ve=Pe==="always",Ke=A.get("text-rotation-alignment")==="map",st=A.get("text-pitch-alignment")==="map",bt=A.get("icon-text-fit")!=="none",Mt=A.get("symbol-z-order")==="viewport-y",gt=Ie&&(Ve||!T.hasIconData()||Ce),pt=Ve&&(Ie||!T.hasTextData()||Te);!T.collisionArrays&&fe&&T.deserializeCollisionBoxes(fe);const zt=this._getTerrainElevationFunc(this.retainedQueryData[T.bucketInstanceId].tileID),or=(mt,Et,rr)=>{var fn,mr;if(y[mt.crossTileID])return;if(ue)return void(this.placements[mt.crossTileID]=new xr(!1,!1,!1));let Mr=!1,pn=!1,vi=!0,ja=null,gn={box:null,placeable:!1,offscreen:null},Ui={box:null,placeable:!1,offscreen:null},ki=null,mi=null,Li=null,ko=0,kc=0,Of=0;Et.textFeatureIndex?ko=Et.textFeatureIndex:mt.useRuntimeCollisionCircles&&(ko=mt.featureIndex),Et.verticalTextFeatureIndex&&(kc=Et.verticalTextFeatureIndex);const Lc=Et.textBox;if(Lc){const ka=ci=>{let yi=s.ah.horizontal;if(T.allowVerticalPlacement&&!ci&&this.prevPlacement){const pa=this.prevPlacement.placedOrientations[mt.crossTileID];pa&&(this.placedOrientations[mt.crossTileID]=pa,yi=pa,this.markUsedOrientation(T,yi,mt))}return yi},La=(ci,yi)=>{if(T.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&Et.verticalTextBox){for(const pa of T.writingModes)if(pa===s.ah.vertical?(gn=yi(),Ui=gn):gn=ci(),gn&&gn.placeable)break}else gn=ci()},Ms=mt.textAnchorOffsetStartIndex,Xa=mt.textAnchorOffsetEndIndex;if(Xa===Ms){const ci=(yi,pa)=>{const Pr=this.collisionIndex.placeCollisionBox(yi,ve,ae,$,q,st,Ke,N,Se.predicate,zt);return Pr&&Pr.placeable&&(this.markUsedOrientation(T,pa,mt),this.placedOrientations[mt.crossTileID]=pa),Pr};La(()=>ci(Lc,s.ah.horizontal),()=>{const yi=Et.verticalTextBox;return T.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&yi?ci(yi,s.ah.vertical):{box:null,offscreen:null}}),ka(gn&&gn.placeable)}else{let ci=s.aq[(mr=(fn=this.prevPlacement)===null||fn===void 0?void 0:fn.variableOffsets[mt.crossTileID])===null||mr===void 0?void 0:mr.anchor];const yi=(Pr,yl,Pc)=>{const Rc=Pr.x2-Pr.x1,Ob=Pr.y2-Pr.y1,NA=mt.textBoxScale,zb=bt&&Pe==="never"?yl:null;let Is=null,Bb=ve==="never"?1:2,Bf="never";ci&&Bb++;for(let Ih=0;Ih<Bb;Ih++){for(let Vf=Ms;Vf<Xa;Vf++){const Ff=T.textAnchorOffsets.get(Vf);if(ci&&Ff.textAnchor!==ci)continue;const Nc=this.attemptAnchorPlacement(Ff,Pr,Rc,Ob,NA,Ke,st,ae,$,q,Se,Bf,mt,T,Pc,N,B,zb,zt);if(Nc&&(Is=Nc.placedGlyphBoxes,Is&&Is.placeable))return Mr=!0,ja=Nc.shift,Is}ci?ci=null:Bf=ve}return S&&!Is&&(Is={box:this.collisionIndex.placeCollisionBox(Lc,"always",ae,$,q,st,Ke,N,Se.predicate,zt,new s.P(0,0)).box,offscreen:!1,placeable:!1}),Is};La(()=>yi(Lc,Et.iconBox,s.ah.horizontal),()=>{const Pr=Et.verticalTextBox;return T.allowVerticalPlacement&&(!gn||!gn.placeable)&&mt.numVerticalGlyphVertices>0&&Pr?yi(Pr,Et.verticalIconBox,s.ah.vertical):{box:null,occluded:!0,offscreen:null}}),gn&&(Mr=gn.placeable,vi=gn.offscreen);const pa=ka(gn&&gn.placeable);if(!Mr&&this.prevPlacement){const Pr=this.prevPlacement.variableOffsets[mt.crossTileID];Pr&&(this.variableOffsets[mt.crossTileID]=Pr,this.markUsedJustification(T,Pr.anchor,mt,pa))}}}if(ki=gn,Mr=ki&&ki.placeable,vi=ki&&ki.offscreen,mt.useRuntimeCollisionCircles){const ka=T.text.placedSymbolArray.get(mt.centerJustifiedTextSymbolIndex),La=s.ai(T.textSizeData,be,ka),Ms=A.get("text-padding");mi=this.collisionIndex.placeCollisionCircles(ve,ka,T.lineVertexArray,T.glyphOffsetArray,La,$,q,K,J,S,st,Se.predicate,mt.collisionCircleDiameter,Ms,N,zt),mi.circles.length&&mi.collisionDetected&&!S&&s.w("Collisions detected, but collision boxes are not shown"),Mr=Ie||mi.circles.length>0&&!mi.collisionDetected,vi=vi&&mi.offscreen}if(Et.iconFeatureIndex&&(Of=Et.iconFeatureIndex),Et.iconBox){const ka=La=>this.collisionIndex.placeCollisionBox(La,Pe,ae,$,q,st,Ke,B,Se.predicate,zt,bt&&ja?ja:void 0);Ui&&Ui.placeable&&Et.verticalIconBox?(Li=ka(Et.verticalIconBox),pn=Li.placeable):(Li=ka(Et.iconBox),pn=Li.placeable),vi=vi&&Li.offscreen}const Ia=Te||mt.numHorizontalGlyphVertices===0&&mt.numVerticalGlyphVertices===0,zf=Ce||mt.numIconVertices===0;Ia||zf?zf?Ia||(pn=pn&&Mr):Mr=pn&&Mr:pn=Mr=pn&&Mr;const Jv=pn&&Li.placeable;if(Mr&&ki.placeable&&this.collisionIndex.insertCollisionBox(ki.box,ve,A.get("text-ignore-placement"),T.bucketInstanceId,Ui&&Ui.placeable&&kc?kc:ko,Se.ID),Jv&&this.collisionIndex.insertCollisionBox(Li.box,Pe,A.get("icon-ignore-placement"),T.bucketInstanceId,Of,Se.ID),mi&&Mr&&this.collisionIndex.insertCollisionCircles(mi.circles,ve,A.get("text-ignore-placement"),T.bucketInstanceId,ko,Se.ID),S&&this.storeCollisionData(T.bucketInstanceId,rr,Et,ki,Li,mi),mt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(T.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[mt.crossTileID]=new xr(Mr||gt,pn||pt,vi||T.justReloaded),y[mt.crossTileID]=!0};if(Mt){if(u.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const mt=T.getSortedSymbolIndexes(this.transform.angle);for(let Et=mt.length-1;Et>=0;--Et){const rr=mt[Et];or(T.symbolInstances.get(rr),T.collisionArrays[rr],rr)}}else for(let mt=u.symbolInstanceStart;mt<u.symbolInstanceEnd;mt++)or(T.symbolInstances.get(mt),T.collisionArrays[mt],mt);if(S&&T.bucketInstanceId in this.collisionCircleArrays){const mt=this.collisionCircleArrays[T.bucketInstanceId];s.as(mt.invProjMatrix,$),mt.viewportMatrix=this.collisionIndex.getViewportMatrix()}T.justReloaded=!1}storeCollisionData(u,y,S,T,A,N){if(S.textBox||S.iconBox){let B,$;this.collisionBoxArrays.has(u)?B=this.collisionBoxArrays.get(u):(B=new Map,this.collisionBoxArrays.set(u,B)),B.has(y)?$=B.get(y):($={text:null,icon:null},B.set(y,$)),S.textBox&&($.text=T.box),S.iconBox&&($.icon=A.box)}if(N){let B=this.collisionCircleArrays[u];B===void 0&&(B=this.collisionCircleArrays[u]=new jr);for(let $=0;$<N.circles.length;$+=4)B.circles.push(N.circles[$+0]),B.circles.push(N.circles[$+1]),B.circles.push(N.circles[$+2]),B.circles.push(N.collisionDetected?1:0)}}markUsedJustification(u,y,S,T){let A;A=T===s.ah.vertical?S.verticalPlacedTextSymbolIndex:{left:S.leftJustifiedTextSymbolIndex,center:S.centerJustifiedTextSymbolIndex,right:S.rightJustifiedTextSymbolIndex}[s.at(y)];const N=[S.leftJustifiedTextSymbolIndex,S.centerJustifiedTextSymbolIndex,S.rightJustifiedTextSymbolIndex,S.verticalPlacedTextSymbolIndex];for(const B of N)B>=0&&(u.text.placedSymbolArray.get(B).crossTileID=A>=0&&B!==A?0:S.crossTileID)}markUsedOrientation(u,y,S){const T=y===s.ah.horizontal||y===s.ah.horizontalOnly?y:0,A=y===s.ah.vertical?y:0,N=[S.leftJustifiedTextSymbolIndex,S.centerJustifiedTextSymbolIndex,S.rightJustifiedTextSymbolIndex];for(const B of N)u.text.placedSymbolArray.get(B).placedOrientation=T;S.verticalPlacedTextSymbolIndex&&(u.text.placedSymbolArray.get(S.verticalPlacedTextSymbolIndex).placedOrientation=A)}commit(u){this.commitTime=u,this.zoomAtLastRecencyCheck=this.transform.zoom;const y=this.prevPlacement;let S=!1;this.prevZoomAdjustment=y?y.zoomAdjustment(this.transform.zoom):0;const T=y?y.symbolFadeChange(u):1,A=y?y.opacities:{},N=y?y.variableOffsets:{},B=y?y.placedOrientations:{};for(const $ in this.placements){const q=this.placements[$],K=A[$];K?(this.opacities[$]=new Sn(K,T,q.text,q.icon),S=S||q.text!==K.text.placed||q.icon!==K.icon.placed):(this.opacities[$]=new Sn(null,T,q.text,q.icon,q.skipFade),S=S||q.text||q.icon)}for(const $ in A){const q=A[$];if(!this.opacities[$]){const K=new Sn(q,T,!1,!1);K.isHidden()||(this.opacities[$]=K,S=S||q.text.placed||q.icon.placed)}}for(const $ in N)this.variableOffsets[$]||!this.opacities[$]||this.opacities[$].isHidden()||(this.variableOffsets[$]=N[$]);for(const $ in B)this.placedOrientations[$]||!this.opacities[$]||this.opacities[$].isHidden()||(this.placedOrientations[$]=B[$]);if(y&&y.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");S?this.lastPlacementChangeTime=u:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=y?y.lastPlacementChangeTime:u)}updateLayerOpacities(u,y){const S={};for(const T of y){const A=T.getBucket(u);A&&T.latestFeatureIndex&&u.id===A.layerIds[0]&&this.updateBucketOpacities(A,T.tileID,S,T.collisionBoxArray)}}updateBucketOpacities(u,y,S,T){u.hasTextData()&&(u.text.opacityVertexArray.clear(),u.text.hasVisibleVertices=!1),u.hasIconData()&&(u.icon.opacityVertexArray.clear(),u.icon.hasVisibleVertices=!1),u.hasIconCollisionBoxData()&&u.iconCollisionBox.collisionVertexArray.clear(),u.hasTextCollisionBoxData()&&u.textCollisionBox.collisionVertexArray.clear();const A=u.layers[0],N=A.layout,B=new Sn(null,0,!1,!1,!0),$=N.get("text-allow-overlap"),q=N.get("icon-allow-overlap"),K=A._unevaluatedLayout.hasValue("text-variable-anchor")||A._unevaluatedLayout.hasValue("text-variable-anchor-offset"),J=N.get("text-rotation-alignment")==="map",ae=N.get("text-pitch-alignment")==="map",ue=N.get("icon-text-fit")!=="none",fe=new Sn(null,0,$&&(q||!u.hasIconData()||N.get("icon-optional")),q&&($||!u.hasTextData()||N.get("text-optional")),!0);!u.collisionArrays&&T&&(u.hasIconCollisionBoxData()||u.hasTextCollisionBoxData())&&u.deserializeCollisionBoxes(T);const be=(Te,Ce,ve)=>{for(let Ie=0;Ie<Ce/4;Ie++)Te.opacityVertexArray.emplaceBack(ve);Te.hasVisibleVertices=Te.hasVisibleVertices||ve!==uc},Se=this.collisionBoxArrays.get(u.bucketInstanceId);for(let Te=0;Te<u.symbolInstances.length;Te++){const Ce=u.symbolInstances.get(Te),{numHorizontalGlyphVertices:ve,numVerticalGlyphVertices:Ie,crossTileID:Pe}=Ce;let Ve=this.opacities[Pe];S[Pe]?Ve=B:Ve||(Ve=fe,this.opacities[Pe]=Ve),S[Pe]=!0;const Ke=Ce.numIconVertices>0,st=this.placedOrientations[Ce.crossTileID],bt=st===s.ah.vertical,Mt=st===s.ah.horizontal||st===s.ah.horizontalOnly;if(ve>0||Ie>0){const pt=ha(Ve.text);be(u.text,ve,bt?uc:pt),be(u.text,Ie,Mt?uc:pt);const zt=Ve.text.isHidden();[Ce.rightJustifiedTextSymbolIndex,Ce.centerJustifiedTextSymbolIndex,Ce.leftJustifiedTextSymbolIndex].forEach(Et=>{Et>=0&&(u.text.placedSymbolArray.get(Et).hidden=zt||bt?1:0)}),Ce.verticalPlacedTextSymbolIndex>=0&&(u.text.placedSymbolArray.get(Ce.verticalPlacedTextSymbolIndex).hidden=zt||Mt?1:0);const or=this.variableOffsets[Ce.crossTileID];or&&this.markUsedJustification(u,or.anchor,Ce,st);const mt=this.placedOrientations[Ce.crossTileID];mt&&(this.markUsedJustification(u,"left",Ce,mt),this.markUsedOrientation(u,mt,Ce))}if(Ke){const pt=ha(Ve.icon),zt=!(ue&&Ce.verticalPlacedIconSymbolIndex&&bt);Ce.placedIconSymbolIndex>=0&&(be(u.icon,Ce.numIconVertices,zt?pt:uc),u.icon.placedSymbolArray.get(Ce.placedIconSymbolIndex).hidden=Ve.icon.isHidden()),Ce.verticalPlacedIconSymbolIndex>=0&&(be(u.icon,Ce.numVerticalIconVertices,zt?uc:pt),u.icon.placedSymbolArray.get(Ce.verticalPlacedIconSymbolIndex).hidden=Ve.icon.isHidden())}const gt=Se&&Se.has(Te)?Se.get(Te):{text:null,icon:null};if(u.hasIconCollisionBoxData()||u.hasTextCollisionBoxData()){const pt=u.collisionArrays[Te];if(pt){let zt=new s.P(0,0);if(pt.textBox||pt.verticalTextBox){let or=!0;if(K){const mt=this.variableOffsets[Pe];mt?(zt=li(mt.anchor,mt.width,mt.height,mt.textOffset,mt.textBoxScale),J&&zt._rotate(ae?this.transform.angle:-this.transform.angle)):or=!1}if(pt.textBox||pt.verticalTextBox){let mt;pt.textBox&&(mt=bt),pt.verticalTextBox&&(mt=Mt),cc(u.textCollisionBox.collisionVertexArray,Ve.text.placed,!or||mt,gt.text,zt.x,zt.y)}}if(pt.iconBox||pt.verticalIconBox){const or=!!(!Mt&&pt.verticalIconBox);let mt;pt.iconBox&&(mt=or),pt.verticalIconBox&&(mt=!or),cc(u.iconCollisionBox.collisionVertexArray,Ve.icon.placed,mt,gt.icon,ue?zt.x:0,ue?zt.y:0)}}}}if(u.sortFeatures(this.transform.angle),this.retainedQueryData[u.bucketInstanceId]&&(this.retainedQueryData[u.bucketInstanceId].featureSortOrder=u.featureSortOrder),u.hasTextData()&&u.text.opacityVertexBuffer&&u.text.opacityVertexBuffer.updateData(u.text.opacityVertexArray),u.hasIconData()&&u.icon.opacityVertexBuffer&&u.icon.opacityVertexBuffer.updateData(u.icon.opacityVertexArray),u.hasIconCollisionBoxData()&&u.iconCollisionBox.collisionVertexBuffer&&u.iconCollisionBox.collisionVertexBuffer.updateData(u.iconCollisionBox.collisionVertexArray),u.hasTextCollisionBoxData()&&u.textCollisionBox.collisionVertexBuffer&&u.textCollisionBox.collisionVertexBuffer.updateData(u.textCollisionBox.collisionVertexArray),u.text.opacityVertexArray.length!==u.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${u.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${u.text.layoutVertexArray.length}) / 4`);if(u.icon.opacityVertexArray.length!==u.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${u.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${u.icon.layoutVertexArray.length}) / 4`);if(u.bucketInstanceId in this.collisionCircleArrays){const Te=this.collisionCircleArrays[u.bucketInstanceId];u.placementInvProjMatrix=Te.invProjMatrix,u.placementViewportMatrix=Te.viewportMatrix,u.collisionCircleArray=Te.circles,delete this.collisionCircleArrays[u.bucketInstanceId]}}symbolFadeChange(u){return this.fadeDuration===0?1:(u-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(u){return Math.max(0,(this.transform.zoom-u)/1.5)}hasTransitions(u){return this.stale||u-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(u,y){const S=this.zoomAtLastRecencyCheck===y?1-this.zoomAdjustment(y):1;return this.zoomAtLastRecencyCheck=y,this.commitTime+this.fadeDuration*S>u}setStale(){this.stale=!0}}function cc(D,u,y,S,T,A){S&&S.length!==0||(S=[0,0,0,0]);const N=S[0]-dr,B=S[1]-dr,$=S[2]-dr,q=S[3]-dr;D.emplaceBack(u?1:0,y?1:0,T||0,A||0,N,B),D.emplaceBack(u?1:0,y?1:0,T||0,A||0,$,B),D.emplaceBack(u?1:0,y?1:0,T||0,A||0,$,q),D.emplaceBack(u?1:0,y?1:0,T||0,A||0,N,q)}const Xr=Math.pow(2,25),cv=Math.pow(2,24),uv=Math.pow(2,17),ca=Math.pow(2,16),ua=Math.pow(2,9),cA=Math.pow(2,8),Ca=Math.pow(2,1);function ha(D){if(D.opacity===0&&!D.placed)return 0;if(D.opacity===1&&D.placed)return 4294967295;const u=D.placed?1:0,y=Math.floor(127*D.opacity);return y*Xr+u*cv+y*uv+u*ca+y*ua+u*cA+y*Ca+u}const uc=0;function ol(){return{isOccluded:(D,u,y)=>!1,getPitchedTextCorrection:(D,u,y)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(D,u,y,S){throw new Error("Not implemented.")},translatePosition:(D,u,y,S)=>function(T,A,N,B,$=!1){if(!N[0]&&!N[1])return[0,0];const q=$?B==="map"?T.angle:0:B==="viewport"?-T.angle:0;if(q){const K=Math.sin(q),J=Math.cos(q);N=[N[0]*J-N[1]*K,N[0]*K+N[1]*J]}return[$?N[0]:Dr(A,N[0],T.zoom),$?N[1]:Dr(A,N[1],T.zoom)]}(D,u,y,S),getCircleRadiusCorrection:D=>1}}class Vn{constructor(u){this._sortAcrossTiles=u.layout.get("symbol-z-order")!=="viewport-y"&&!u.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(u,y,S,T,A){const N=this._bucketParts;for(;this._currentTileIndex<u.length;)if(y.getBucketParts(N,T,u[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,A())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,N.sort((B,$)=>B.sortKey-$.sortKey));this._currentPartIndex<N.length;)if(y.placeLayerBucketPart(N[this._currentPartIndex],this._seenCrossTileIDs,S),this._currentPartIndex++,A())return!0;return!1}}class dh{constructor(u,y,S,T,A,N,B,$){this.placement=new Ii(u,ol(),y,N,B,$),this._currentPlacementIndex=S.length-1,this._forceFullPlacement=T,this._showCollisionBoxes=A,this._done=!1}isDone(){return this._done}continuePlacement(u,y,S){const T=f.now(),A=()=>!this._forceFullPlacement&&f.now()-T>2;for(;this._currentPlacementIndex>=0;){const N=y[u[this._currentPlacementIndex]],B=this.placement.collisionIndex.transform.zoom;if(N.type==="symbol"&&(!N.minzoom||N.minzoom<=B)&&(!N.maxzoom||N.maxzoom>B)){if(this._inProgressLayer||(this._inProgressLayer=new Vn(N)),this._inProgressLayer.continuePlacement(S[N.source],this.placement,this._showCollisionBoxes,N,A))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(u){return this.placement.commit(u),this.placement}}const Ua=512/s.X/2;class Pn{constructor(u,y,S){this.tileID=u,this.bucketInstanceId=S,this._symbolsByKey={};const T=new Map;for(let A=0;A<y.length;A++){const N=y.get(A),B=N.key,$=T.get(B);$?$.push(N):T.set(B,[N])}for(const[A,N]of T){const B={positions:N.map($=>({x:Math.floor($.anchorX*Ua),y:Math.floor($.anchorY*Ua)})),crossTileIDs:N.map($=>$.crossTileID)};if(B.positions.length>128){const $=new s.av(B.positions.length,16,Uint16Array);for(const{x:q,y:K}of B.positions)$.add(q,K);$.finish(),delete B.positions,B.index=$}this._symbolsByKey[A]=B}}getScaledCoordinates(u,y){const{x:S,y:T,z:A}=this.tileID.canonical,{x:N,y:B,z:$}=y.canonical,q=Ua/Math.pow(2,$-A),K=(B*s.X+u.anchorY)*q,J=T*s.X*Ua;return{x:Math.floor((N*s.X+u.anchorX)*q-S*s.X*Ua),y:Math.floor(K-J)}}findMatches(u,y,S){const T=this.tileID.canonical.z<y.canonical.z?1:Math.pow(2,this.tileID.canonical.z-y.canonical.z);for(let A=0;A<u.length;A++){const N=u.get(A);if(N.crossTileID)continue;const B=this._symbolsByKey[N.key];if(!B)continue;const $=this.getScaledCoordinates(N,y);if(B.index){const q=B.index.range($.x-T,$.y-T,$.x+T,$.y+T).sort();for(const K of q){const J=B.crossTileIDs[K];if(!S[J]){S[J]=!0,N.crossTileID=J;break}}}else if(B.positions)for(let q=0;q<B.positions.length;q++){const K=B.positions[q],J=B.crossTileIDs[q];if(Math.abs(K.x-$.x)<=T&&Math.abs(K.y-$.y)<=T&&!S[J]){S[J]=!0,N.crossTileID=J;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:u})=>u)}}class af{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ha{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(u){const y=Math.round((u-this.lng)/360);if(y!==0)for(const S in this.indexes){const T=this.indexes[S],A={};for(const N in T){const B=T[N];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+y),A[B.tileID.key]=B}this.indexes[S]=A}this.lng=u}addBucket(u,y,S){if(this.indexes[u.overscaledZ]&&this.indexes[u.overscaledZ][u.key]){if(this.indexes[u.overscaledZ][u.key].bucketInstanceId===y.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(u.overscaledZ,this.indexes[u.overscaledZ][u.key])}for(let A=0;A<y.symbolInstances.length;A++)y.symbolInstances.get(A).crossTileID=0;this.usedCrossTileIDs[u.overscaledZ]||(this.usedCrossTileIDs[u.overscaledZ]={});const T=this.usedCrossTileIDs[u.overscaledZ];for(const A in this.indexes){const N=this.indexes[A];if(Number(A)>u.overscaledZ)for(const B in N){const $=N[B];$.tileID.isChildOf(u)&&$.findMatches(y.symbolInstances,u,T)}else{const B=N[u.scaledTo(Number(A)).key];B&&B.findMatches(y.symbolInstances,u,T)}}for(let A=0;A<y.symbolInstances.length;A++){const N=y.symbolInstances.get(A);N.crossTileID||(N.crossTileID=S.generate(),T[N.crossTileID]=!0)}return this.indexes[u.overscaledZ]===void 0&&(this.indexes[u.overscaledZ]={}),this.indexes[u.overscaledZ][u.key]=new Pn(u,y.symbolInstances,y.bucketInstanceId),!0}removeBucketCrossTileIDs(u,y){for(const S of y.getCrossTileIDsLists())for(const T of S)delete this.usedCrossTileIDs[u][T]}removeStaleBuckets(u){let y=!1;for(const S in this.indexes){const T=this.indexes[S];for(const A in T)u[T[A].bucketInstanceId]||(this.removeBucketCrossTileIDs(S,T[A]),delete T[A],y=!0)}return y}}class hv{constructor(){this.layerIndexes={},this.crossTileIDs=new af,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(u,y,S){let T=this.layerIndexes[u.id];T===void 0&&(T=this.layerIndexes[u.id]=new Ha);let A=!1;const N={};T.handleWrapJump(S);for(const B of y){const $=B.getBucket(u);$&&u.id===$.layerIds[0]&&($.bucketInstanceId||($.bucketInstanceId=++this.maxBucketInstanceId),T.addBucket(B.tileID,$,this.crossTileIDs)&&(A=!0),N[$.bucketInstanceId]=!0)}return T.removeStaleBuckets(N)&&(A=!0),A}pruneUnusedLayers(u){const y={};u.forEach(S=>{y[S]=!0});for(const S in this.layerIndexes)y[S]||delete this.layerIndexes[S]}}const Wa=(D,u)=>s.t(D,u&&u.filter(y=>y.identifier!=="source.canvas")),uA=s.aw();class of extends s.E{constructor(u,y={}){super(),this._rtlPluginLoaded=()=>{for(const S in this.sourceCaches){const T=this.sourceCaches[S].getSource().type;T!=="vector"&&T!=="geojson"||this.sourceCaches[S].reload()}},this.map=u,this.dispatcher=new wt(Dt(),u._getMapId()),this.dispatcher.registerMessageHandler("GG",(S,T)=>this.getGlyphs(S,T)),this.dispatcher.registerMessageHandler("GI",(S,T)=>this.getImages(S,T)),this.imageManager=new oe,this.imageManager.setEventedParent(this),this.glyphManager=new pe(u._requestManager,y.localIdeographFontFamily),this.lineAtlas=new it(256,512),this.crossTileSymbolIndex=new hv,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new s.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",s.ay()),Kr().on($e,this._rtlPluginLoaded),this.on("data",S=>{if(S.dataType!=="source"||S.sourceDataType!=="metadata")return;const T=this.sourceCaches[S.sourceId];if(!T)return;const A=T.getSource();if(A&&A.vectorLayerIds)for(const N in this._layers){const B=this._layers[N];B.source===A.id&&this._validateLayer(B)}})}loadURL(u,y={},S){this.fire(new s.k("dataloading",{dataType:"style"})),y.validate=typeof y.validate!="boolean"||y.validate;const T=this.map._requestManager.transformRequest(u,"Style");this._loadStyleRequest=new AbortController;const A=this._loadStyleRequest;s.h(T,this._loadStyleRequest).then(N=>{this._loadStyleRequest=null,this._load(N.data,y,S)}).catch(N=>{this._loadStyleRequest=null,N&&!A.signal.aborted&&this.fire(new s.j(N))})}loadJSON(u,y={},S){this.fire(new s.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,f.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,y.validate=y.validate!==!1,this._load(u,y,S)}).catch(()=>{})}loadEmpty(){this.fire(new s.k("dataloading",{dataType:"style"})),this._load(uA,{validate:!1})}_load(u,y,S){var T;const A=y.transformStyle?y.transformStyle(S,u):u;if(!y.validate||!Wa(this,s.u(A))){this._loaded=!0,this.stylesheet=A;for(const N in A.sources)this.addSource(N,A.sources[N],{validate:!1});A.sprite?this._loadSprite(A.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(A.glyphs),this._createLayers(),this.light=new Be(this.stylesheet.light),this.sky=new Xe(this.stylesheet.sky),this.map.setTerrain((T=this.stylesheet.terrain)!==null&&T!==void 0?T:null),this.fire(new s.k("data",{dataType:"style"})),this.fire(new s.k("style.load"))}}_createLayers(){const u=s.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",u),this._order=u.map(y=>y.id),this._layers={},this._serializedLayers=null;for(const y of u){const S=s.aA(y);S.setEventedParent(this,{layer:{id:y.id}}),this._layers[y.id]=S}}_loadSprite(u,y=!1,S=void 0){let T;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(A,N,B,$){return s._(this,void 0,void 0,function*(){const q=Z(A),K=B>1?"@2x":"",J={},ae={};for(const{id:ue,url:fe}of q){const be=N.transformRequest(Y(fe,K,".json"),"SpriteJSON");J[ue]=s.h(be,$);const Se=N.transformRequest(Y(fe,K,".png"),"SpriteImage");ae[ue]=L.getImage(Se,$)}return yield Promise.all([...Object.values(J),...Object.values(ae)]),function(ue,fe){return s._(this,void 0,void 0,function*(){const be={};for(const Se in ue){be[Se]={};const Te=f.getImageCanvasContext((yield fe[Se]).data),Ce=(yield ue[Se]).data;for(const ve in Ce){const{width:Ie,height:Pe,x:Ve,y:Ke,sdf:st,pixelRatio:bt,stretchX:Mt,stretchY:gt,content:pt,textFitWidth:zt,textFitHeight:or}=Ce[ve];be[Se][ve]={data:null,pixelRatio:bt,sdf:st,stretchX:Mt,stretchY:gt,content:pt,textFitWidth:zt,textFitHeight:or,spriteData:{width:Ie,height:Pe,x:Ve,y:Ke,context:Te}}}}return be})}(J,ae)})}(u,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(A=>{if(this._spriteRequest=null,A)for(const N in A){this._spritesImagesIds[N]=[];const B=this._spritesImagesIds[N]?this._spritesImagesIds[N].filter($=>!($ in A)):[];for(const $ of B)this.imageManager.removeImage($),this._changedImages[$]=!0;for(const $ in A[N]){const q=N==="default"?$:`${N}:${$}`;this._spritesImagesIds[N].push(q),q in this.imageManager.images?this.imageManager.updateImage(q,A[N][$],!1):this.imageManager.addImage(q,A[N][$]),y&&(this._changedImages[q]=!0)}}}).catch(A=>{this._spriteRequest=null,T=A,this.fire(new s.j(T))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),y&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"})),S&&S(T)})}_unloadSprite(){for(const u of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(u),this._changedImages[u]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"}))}_validateLayer(u){const y=this.sourceCaches[u.source];if(!y)return;const S=u.sourceLayer;if(!S)return;const T=y.getSource();(T.type==="geojson"||T.vectorLayerIds&&T.vectorLayerIds.indexOf(S)===-1)&&this.fire(new s.j(new Error(`Source layer "${S}" does not exist on source "${T.id}" as specified by style layer "${u.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const u in this.sourceCaches)if(!this.sourceCaches[u].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(u,y=!1){const S=this._serializedAllLayers();if(!u||u.length===0)return Object.values(y?s.aB(S):S);const T=[];for(const A of u)if(S[A]){const N=y?s.aB(S[A]):S[A];T.push(N)}return T}_serializedAllLayers(){let u=this._serializedLayers;if(u)return u;u=this._serializedLayers={};const y=Object.keys(this._layers);for(const S of y){const T=this._layers[S];T.type!=="custom"&&(u[S]=T.serialize())}return u}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const u in this.sourceCaches)if(this.sourceCaches[u].hasTransition())return!0;for(const u in this._layers)if(this._layers[u].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(u){if(!this._loaded)return;const y=this._changed;if(y){const T=Object.keys(this._updatedLayers),A=Object.keys(this._removedLayers);(T.length||A.length)&&this._updateWorkerLayers(T,A);for(const N in this._updatedSources){const B=this._updatedSources[N];if(B==="reload")this._reloadSource(N);else{if(B!=="clear")throw new Error(`Invalid action ${B}`);this._clearSource(N)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const N in this._updatedPaintProps)this._layers[N].updateTransitions(u);this.light.updateTransitions(u),this.sky.updateTransitions(u),this._resetUpdates()}const S={};for(const T in this.sourceCaches){const A=this.sourceCaches[T];S[T]=A.used,A.used=!1}for(const T of this._order){const A=this._layers[T];A.recalculate(u,this._availableImages),!A.isHidden(u.zoom)&&A.source&&(this.sourceCaches[A.source].used=!0)}for(const T in S){const A=this.sourceCaches[T];!!S[T]!=!!A.used&&A.fire(new s.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:T}))}this.light.recalculate(u),this.sky.recalculate(u),this.z=u.zoom,y&&this.fire(new s.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const u=Object.keys(this._changedImages);if(u.length){for(const y in this.sourceCaches)this.sourceCaches[y].reloadTilesForDependencies(["icons","patterns"],u);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(u,y){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(u,!1),removedIds:y})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(u,y={}){var S;this._checkLoaded();const T=this.serialize();if(u=y.transformStyle?y.transformStyle(T,u):u,((S=y.validate)===null||S===void 0||S)&&Wa(this,s.u(u)))return!1;(u=s.aB(u)).layers=s.az(u.layers);const A=s.aC(T,u),N=this._getOperationsToPerform(A);if(N.unimplemented.length>0)throw new Error(`Unimplemented: ${N.unimplemented.join(", ")}.`);if(N.operations.length===0)return!1;for(const B of N.operations)B();return this.stylesheet=u,this._serializedLayers=null,!0}_getOperationsToPerform(u){const y=[],S=[];for(const T of u)switch(T.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":y.push(()=>this.addLayer.apply(this,T.args));break;case"removeLayer":y.push(()=>this.removeLayer.apply(this,T.args));break;case"setPaintProperty":y.push(()=>this.setPaintProperty.apply(this,T.args));break;case"setLayoutProperty":y.push(()=>this.setLayoutProperty.apply(this,T.args));break;case"setFilter":y.push(()=>this.setFilter.apply(this,T.args));break;case"addSource":y.push(()=>this.addSource.apply(this,T.args));break;case"removeSource":y.push(()=>this.removeSource.apply(this,T.args));break;case"setLayerZoomRange":y.push(()=>this.setLayerZoomRange.apply(this,T.args));break;case"setLight":y.push(()=>this.setLight.apply(this,T.args));break;case"setGeoJSONSourceData":y.push(()=>this.setGeoJSONSourceData.apply(this,T.args));break;case"setGlyphs":y.push(()=>this.setGlyphs.apply(this,T.args));break;case"setSprite":y.push(()=>this.setSprite.apply(this,T.args));break;case"setSky":y.push(()=>this.setSky.apply(this,T.args));break;case"setTerrain":y.push(()=>this.map.setTerrain.apply(this,T.args));break;case"setTransition":y.push(()=>{});break;default:S.push(T.command)}return{operations:y,unimplemented:S}}addImage(u,y){if(this.getImage(u))return this.fire(new s.j(new Error(`An image named "${u}" already exists.`)));this.imageManager.addImage(u,y),this._afterImageUpdated(u)}updateImage(u,y){this.imageManager.updateImage(u,y)}getImage(u){return this.imageManager.getImage(u)}removeImage(u){if(!this.getImage(u))return this.fire(new s.j(new Error(`An image named "${u}" does not exist.`)));this.imageManager.removeImage(u),this._afterImageUpdated(u)}_afterImageUpdated(u){this._availableImages=this.imageManager.listImages(),this._changedImages[u]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(u,y,S={}){if(this._checkLoaded(),this.sourceCaches[u]!==void 0)throw new Error(`Source "${u}" already exists.`);if(!y.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(y).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(y.type)>=0&&this._validate(s.u.source,`sources.${u}`,y,null,S))return;this.map&&this.map._collectResourceTiming&&(y.collectResourceTiming=!0);const T=this.sourceCaches[u]=new Qt(u,y,this.dispatcher);T.style=this,T.setEventedParent(this,()=>({isSourceLoaded:T.loaded(),source:T.serialize(),sourceId:u})),T.onAdd(this.map),this._changed=!0}removeSource(u){if(this._checkLoaded(),this.sourceCaches[u]===void 0)throw new Error("There is no source with this ID");for(const S in this._layers)if(this._layers[S].source===u)return this.fire(new s.j(new Error(`Source "${u}" cannot be removed while layer "${S}" is using it.`)));const y=this.sourceCaches[u];delete this.sourceCaches[u],delete this._updatedSources[u],y.fire(new s.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:u})),y.setEventedParent(null),y.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(u,y){if(this._checkLoaded(),this.sourceCaches[u]===void 0)throw new Error(`There is no source with this ID=${u}`);const S=this.sourceCaches[u].getSource();if(S.type!=="geojson")throw new Error(`geojsonSource.type is ${S.type}, which is !== 'geojson`);S.setData(y),this._changed=!0}getSource(u){return this.sourceCaches[u]&&this.sourceCaches[u].getSource()}addLayer(u,y,S={}){this._checkLoaded();const T=u.id;if(this.getLayer(T))return void this.fire(new s.j(new Error(`Layer "${T}" already exists on this map.`)));let A;if(u.type==="custom"){if(Wa(this,s.aD(u)))return;A=s.aA(u)}else{if("source"in u&&typeof u.source=="object"&&(this.addSource(T,u.source),u=s.aB(u),u=s.e(u,{source:T})),this._validate(s.u.layer,`layers.${T}`,u,{arrayIndex:-1},S))return;A=s.aA(u),this._validateLayer(A),A.setEventedParent(this,{layer:{id:T}})}const N=y?this._order.indexOf(y):this._order.length;if(y&&N===-1)this.fire(new s.j(new Error(`Cannot add layer "${T}" before non-existing layer "${y}".`)));else{if(this._order.splice(N,0,T),this._layerOrderChanged=!0,this._layers[T]=A,this._removedLayers[T]&&A.source&&A.type!=="custom"){const B=this._removedLayers[T];delete this._removedLayers[T],B.type!==A.type?this._updatedSources[A.source]="clear":(this._updatedSources[A.source]="reload",this.sourceCaches[A.source].pause())}this._updateLayer(A),A.onAdd&&A.onAdd(this.map)}}moveLayer(u,y){if(this._checkLoaded(),this._changed=!0,!this._layers[u])return void this.fire(new s.j(new Error(`The layer '${u}' does not exist in the map's style and cannot be moved.`)));if(u===y)return;const S=this._order.indexOf(u);this._order.splice(S,1);const T=y?this._order.indexOf(y):this._order.length;y&&T===-1?this.fire(new s.j(new Error(`Cannot move layer "${u}" before non-existing layer "${y}".`))):(this._order.splice(T,0,u),this._layerOrderChanged=!0)}removeLayer(u){this._checkLoaded();const y=this._layers[u];if(!y)return void this.fire(new s.j(new Error(`Cannot remove non-existing layer "${u}".`)));y.setEventedParent(null);const S=this._order.indexOf(u);this._order.splice(S,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[u]=y,delete this._layers[u],this._serializedLayers&&delete this._serializedLayers[u],delete this._updatedLayers[u],delete this._updatedPaintProps[u],y.onRemove&&y.onRemove(this.map)}getLayer(u){return this._layers[u]}getLayersOrder(){return[...this._order]}hasLayer(u){return u in this._layers}setLayerZoomRange(u,y,S){this._checkLoaded();const T=this.getLayer(u);T?T.minzoom===y&&T.maxzoom===S||(y!=null&&(T.minzoom=y),S!=null&&(T.maxzoom=S),this._updateLayer(T)):this.fire(new s.j(new Error(`Cannot set the zoom range of non-existing layer "${u}".`)))}setFilter(u,y,S={}){this._checkLoaded();const T=this.getLayer(u);if(T){if(!s.aE(T.filter,y))return y==null?(T.filter=void 0,void this._updateLayer(T)):void(this._validate(s.u.filter,`layers.${T.id}.filter`,y,null,S)||(T.filter=s.aB(y),this._updateLayer(T)))}else this.fire(new s.j(new Error(`Cannot filter non-existing layer "${u}".`)))}getFilter(u){return s.aB(this.getLayer(u).filter)}setLayoutProperty(u,y,S,T={}){this._checkLoaded();const A=this.getLayer(u);A?s.aE(A.getLayoutProperty(y),S)||(A.setLayoutProperty(y,S,T),this._updateLayer(A)):this.fire(new s.j(new Error(`Cannot style non-existing layer "${u}".`)))}getLayoutProperty(u,y){const S=this.getLayer(u);if(S)return S.getLayoutProperty(y);this.fire(new s.j(new Error(`Cannot get style of non-existing layer "${u}".`)))}setPaintProperty(u,y,S,T={}){this._checkLoaded();const A=this.getLayer(u);A?s.aE(A.getPaintProperty(y),S)||(A.setPaintProperty(y,S,T)&&this._updateLayer(A),this._changed=!0,this._updatedPaintProps[u]=!0,this._serializedLayers=null):this.fire(new s.j(new Error(`Cannot style non-existing layer "${u}".`)))}getPaintProperty(u,y){return this.getLayer(u).getPaintProperty(y)}setFeatureState(u,y){this._checkLoaded();const S=u.source,T=u.sourceLayer,A=this.sourceCaches[S];if(A===void 0)return void this.fire(new s.j(new Error(`The source '${S}' does not exist in the map's style.`)));const N=A.getSource().type;N==="geojson"&&T?this.fire(new s.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):N!=="vector"||T?(u.id===void 0&&this.fire(new s.j(new Error("The feature id parameter must be provided."))),A.setFeatureState(T,u.id,y)):this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(u,y){this._checkLoaded();const S=u.source,T=this.sourceCaches[S];if(T===void 0)return void this.fire(new s.j(new Error(`The source '${S}' does not exist in the map's style.`)));const A=T.getSource().type,N=A==="vector"?u.sourceLayer:void 0;A!=="vector"||N?y&&typeof u.id!="string"&&typeof u.id!="number"?this.fire(new s.j(new Error("A feature id is required to remove its specific state property."))):T.removeFeatureState(N,u.id,y):this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(u){this._checkLoaded();const y=u.source,S=u.sourceLayer,T=this.sourceCaches[y];if(T!==void 0)return T.getSource().type!=="vector"||S?(u.id===void 0&&this.fire(new s.j(new Error("The feature id parameter must be provided."))),T.getFeatureState(S,u.id)):void this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new s.j(new Error(`The source '${y}' does not exist in the map's style.`)))}getTransition(){return s.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const u=s.aF(this.sourceCaches,A=>A.serialize()),y=this._serializeByIds(this._order,!0),S=this.map.getTerrain()||void 0,T=this.stylesheet;return s.aG({version:T.version,name:T.name,metadata:T.metadata,light:T.light,sky:T.sky,center:T.center,zoom:T.zoom,bearing:T.bearing,pitch:T.pitch,sprite:T.sprite,glyphs:T.glyphs,transition:T.transition,sources:u,layers:y,terrain:S},A=>A!==void 0)}_updateLayer(u){this._updatedLayers[u.id]=!0,u.source&&!this._updatedSources[u.source]&&this.sourceCaches[u.source].getSource().type!=="raster"&&(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(u){const y=N=>this._layers[N].type==="fill-extrusion",S={},T=[];for(let N=this._order.length-1;N>=0;N--){const B=this._order[N];if(y(B)){S[B]=N;for(const $ of u){const q=$[B];if(q)for(const K of q)T.push(K)}}}T.sort((N,B)=>B.intersectionZ-N.intersectionZ);const A=[];for(let N=this._order.length-1;N>=0;N--){const B=this._order[N];if(y(B))for(let $=T.length-1;$>=0;$--){const q=T[$].feature;if(S[q.layer.id]<N)break;A.push(q),T.pop()}else for(const $ of u){const q=$[B];if(q)for(const K of q)A.push(K.feature)}}return A}queryRenderedFeatures(u,y,S){y&&y.filter&&this._validate(s.u.filter,"queryRenderedFeatures.filter",y.filter,null,y);const T={};if(y&&y.layers){if(!Array.isArray(y.layers))return this.fire(new s.j(new Error("parameters.layers must be an Array."))),[];for(const B of y.layers){const $=this._layers[B];if(!$)return this.fire(new s.j(new Error(`The layer '${B}' does not exist in the map's style and cannot be queried for features.`))),[];T[$.source]=!0}}const A=[];y.availableImages=this._availableImages;const N=this._serializedAllLayers();for(const B in this.sourceCaches)y.layers&&!T[B]||A.push(tt(this.sourceCaches[B],this._layers,N,u,y,S));return this.placement&&A.push(function(B,$,q,K,J,ae,ue){const fe={},be=ae.queryRenderedSymbols(K),Se=[];for(const Te of Object.keys(be).map(Number))Se.push(ue[Te]);Se.sort(kt);for(const Te of Se){const Ce=Te.featureIndex.lookupSymbolFeatures(be[Te.bucketInstanceId],$,Te.bucketIndex,Te.sourceLayerIndex,J.filter,J.layers,J.availableImages,B);for(const ve in Ce){const Ie=fe[ve]=fe[ve]||[],Pe=Ce[ve];Pe.sort((Ve,Ke)=>{const st=Te.featureSortOrder;if(st){const bt=st.indexOf(Ve.featureIndex);return st.indexOf(Ke.featureIndex)-bt}return Ke.featureIndex-Ve.featureIndex});for(const Ve of Pe)Ie.push(Ve)}}for(const Te in fe)fe[Te].forEach(Ce=>{const ve=Ce.feature,Ie=q[B[Te].source].getFeatureState(ve.layer["source-layer"],ve.id);ve.source=ve.layer.source,ve.layer["source-layer"]&&(ve.sourceLayer=ve.layer["source-layer"]),ve.state=Ie});return fe}(this._layers,N,this.sourceCaches,u,y,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(A)}querySourceFeatures(u,y){y&&y.filter&&this._validate(s.u.filter,"querySourceFeatures.filter",y.filter,null,y);const S=this.sourceCaches[u];return S?function(T,A){const N=T.getRenderableIds().map(q=>T.getTileByID(q)),B=[],$={};for(let q=0;q<N.length;q++){const K=N[q],J=K.tileID.canonical.key;$[J]||($[J]=!0,K.querySourceFeatures(B,A))}return B}(S,y):[]}getLight(){return this.light.getLight()}setLight(u,y={}){this._checkLoaded();const S=this.light.getLight();let T=!1;for(const N in u)if(!s.aE(u[N],S[N])){T=!0;break}if(!T)return;const A={now:f.now(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(u,y),this.light.updateTransitions(A)}getSky(){var u;return(u=this.stylesheet)===null||u===void 0?void 0:u.sky}setSky(u,y={}){const S=this.getSky();let T=!1;if(!u&&!S)return;if(u&&!S)T=!0;else if(!u&&S)T=!0;else for(const N in u)if(!s.aE(u[N],S[N])){T=!0;break}if(!T)return;const A={now:f.now(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=u,this.sky.setSky(u,y),this.sky.updateTransitions(A)}_validate(u,y,S,T,A={}){return(!A||A.validate!==!1)&&Wa(this,u.call(s.u,s.e({key:y,style:this.serialize(),value:S,styleSpec:s.v},T)))}_remove(u=!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),Kr().off($e,this._rtlPluginLoaded);for(const y in this._layers)this._layers[y].setEventedParent(null);for(const y in this.sourceCaches){const S=this.sourceCaches[y];S.setEventedParent(null),S.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),u&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(u)}_clearSource(u){this.sourceCaches[u].clearTiles()}_reloadSource(u){this.sourceCaches[u].resume(),this.sourceCaches[u].reload()}_updateSources(u){for(const y in this.sourceCaches)this.sourceCaches[y].update(u,this.map.terrain)}_generateCollisionBoxes(){for(const u in this.sourceCaches)this._reloadSource(u)}_updatePlacement(u,y,S,T,A=!1){let N=!1,B=!1;const $={};for(const q of this._order){const K=this._layers[q];if(K.type!=="symbol")continue;if(!$[K.source]){const ae=this.sourceCaches[K.source];$[K.source]=ae.getRenderableIds(!0).map(ue=>ae.getTileByID(ue)).sort((ue,fe)=>fe.tileID.overscaledZ-ue.tileID.overscaledZ||(ue.tileID.isLessThan(fe.tileID)?-1:1))}const J=this.crossTileSymbolIndex.addLayer(K,$[K.source],u.center.lng);N=N||J}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((A=A||this._layerOrderChanged||S===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(f.now(),u.zoom))&&(this.pauseablePlacement=new dh(u,this.map.terrain,this._order,A,y,S,T,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,$),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(f.now()),B=!0),N&&this.pauseablePlacement.placement.setStale()),B||N)for(const q of this._order){const K=this._layers[q];K.type==="symbol"&&this.placement.updateLayerOpacities(K,$[K.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(f.now())}_releaseSymbolFadeTiles(){for(const u in this.sourceCaches)this.sourceCaches[u].releaseSymbolFadeTiles()}getImages(u,y){return s._(this,void 0,void 0,function*(){const S=yield this.imageManager.getImages(y.icons);this._updateTilesForChangedImages();const T=this.sourceCaches[y.source];return T&&T.setDependencies(y.tileID.key,y.type,y.icons),S})}getGlyphs(u,y){return s._(this,void 0,void 0,function*(){const S=yield this.glyphManager.getGlyphs(y.stacks),T=this.sourceCaches[y.source];return T&&T.setDependencies(y.tileID.key,y.type,[""]),S})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(u,y={}){this._checkLoaded(),u&&this._validate(s.u.glyphs,"glyphs",u,null,y)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=u,this.glyphManager.entries={},this.glyphManager.setURL(u))}addSprite(u,y,S={},T){this._checkLoaded();const A=[{id:u,url:y}],N=[...Z(this.stylesheet.sprite),...A];this._validate(s.u.sprite,"sprite",N,null,S)||(this.stylesheet.sprite=N,this._loadSprite(A,!0,T))}removeSprite(u){this._checkLoaded();const y=Z(this.stylesheet.sprite);if(y.find(S=>S.id===u)){if(this._spritesImagesIds[u])for(const S of this._spritesImagesIds[u])this.imageManager.removeImage(S),this._changedImages[S]=!0;y.splice(y.findIndex(S=>S.id===u),1),this.stylesheet.sprite=y.length>0?y:void 0,delete this._spritesImagesIds[u],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.k("data",{dataType:"style"}))}else this.fire(new s.j(new Error(`Sprite "${u}" doesn't exists on this map.`)))}getSprite(){return Z(this.stylesheet.sprite)}setSprite(u,y={},S){this._checkLoaded(),u&&this._validate(s.u.sprite,"sprite",u,null,y)||(this.stylesheet.sprite=u,u?this._loadSprite(u,!0,S):(this._unloadSprite(),S&&S(null)))}}var sl=s.Y([{name:"a_pos",type:"Int16",components:2}]);const As={prelude:Ur(`#ifdef GL_ES
|
|
170
170
|
precision mediump float;
|
|
171
171
|
#else
|
|
172
172
|
#if !defined(lowp)
|
|
@@ -750,7 +750,7 @@ uniform ${K} ${J} u_${ae};
|
|
|
750
750
|
<span class="font-medium mr-[6px]">Значення</span>
|
|
751
751
|
</span>
|
|
752
752
|
<span>${(n==null?void 0:n.metric)||0}</span>
|
|
753
|
-
</div>`;const i=this.map.project(r.lngLat);this.popupElement.style.left=`${i.x}px`,this.popupElement.style.top=`${i.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(t){console.error(t)}}}}],name:"VsMap",async mounted(){await this.getMapData(),await this.createMap()},methods:{async getMapData(){const e=await(await fetch(`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`)).json();this.data=e},async loadHandler(){const r=["#69D2E7","yellow","#FE4365"],e=this.data.colors?["match",["get","x"]].concat(this.data.colors.reduce((a,o,s)=>a.concat(o.val,(o==null?void 0:o.color)||r[s]),[])).concat(["gray"]):"blue",t=[5,7,9,11,13],n=this.data.sizes?["case"]:5;this.data.sizes&&(this.data.sizes.reverse().forEach((a,o)=>{n.push([">",["get","metric"],a]),n.push(t[o])}),n.push(5));const i={type:"circle",color:e,width:2,radius:n,stroke:"#eee"};Object.assign(i,this.data.style||{}),this.addVtileLayer({id:"bi",url:`${window.top.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:i})}}},cme=["id"],
|
|
753
|
+
</div>`;const i=this.map.project(r.lngLat);this.popupElement.style.left=`${i.x}px`,this.popupElement.style.top=`${i.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(t){console.error(t)}}}}],name:"VsMap",async mounted(){await this.getMapData(),await this.createMap()},methods:{async getMapData(){const e=await(await fetch(`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`)).json();this.data=e,this.$emit("update:widgetData",e),setTimeout(()=>{var t;return(t=this.map)==null?void 0:t.resize()})},async loadHandler(){const r=["#69D2E7","yellow","#FE4365"],e=this.data.colors?["match",["get","x"]].concat(this.data.colors.reduce((a,o,s)=>a.concat(o.val,(o==null?void 0:o.color)||r[s]),[])).concat(["gray"]):"blue",t=[5,7,9,11,13],n=this.data.sizes?["case"]:5;this.data.sizes&&(this.data.sizes.reverse().forEach((a,o)=>{n.push([">",["get","metric"],a]),n.push(t[o])}),n.push(5));const i={type:"circle",color:e,width:2,radius:n,stroke:"#eee"};Object.assign(i,this.data.style||{}),this.addVtileLayer({id:"bi",url:`${window.top.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:i})}}},cme={class:"w-full h-full"},ume={class:"flex items-start justify-between mb-[6px] w-full"},hme={class:"text-gray-800 font-[600]"},dme=["id"],fme=["id"],pme={class:"absolute flex flex-col right-[10px] top-[105px] gap-1"};function gme(r,e,t,n,i,a){var d,f,g;const o=P.resolveComponent("VsMapSetting"),s=P.resolveComponent("VsMapSlotLayers"),l=P.resolveComponent("VsMapLegend"),c=P.resolveComponent("VsMapGoHome");return P.openBlock(),P.createElementBlock("div",cme,[P.createElementVNode("div",ume,[P.createElementVNode("h5",hme,P.toDisplayString(r.title),1)]),P.createElementVNode("div",{class:"relative w-full h-[calc(100%-40px)]",id:`wrapper-${r.mapId}`},[P.createElementVNode("div",{id:r.mapId,class:"w-full flex items-end relative h-full min-h-[250px]"},null,8,fme),r.showSetting?(P.openBlock(),P.createBlock(o,{key:0,map:r.map,coordinates:r.coordinatesByMouse},null,8,["map","coordinates"])):P.createCommentVNode("",!0),P.createVNode(s,{map:r.map},null,8,["map"]),P.createElementVNode("div",pme,[P.createVNode(l,{mapId:r.mapId,colors:(d=r.data)==null?void 0:d.colors,sizes:(f=r.data)==null?void 0:f.sizes,color:r.color,resizeItem:"true"},null,8,["mapId","colors","sizes","color"]),P.createVNode(c,{map:r.map,bbox:(g=r.data)==null?void 0:g.bounds},null,8,["map","bbox"])])],8,dme)])}const vme=Object.freeze(Object.defineProperty({__proto__:null,default:ur(lme,[["render",gme]])},Symbol.toStringTag,{value:"Module"})),mme={components:{legendIcon:sA,closeIcon:lC},props:{mapId:{type:String},colors:{type:Array},sizes:{type:Array,default:()=>[]},cluster:{type:[Boolean,String]},color:{type:String,default:"gray"},colorTitle:{type:String},sizesTitle:{type:String},resizeItem:{type:[Boolean,String],default:!1},changeOpacityItem:{type:[Boolean,String],default:!1}},data(){return{isOpenLegend:!1,palette:lA}},computed:{borderRadius(){return this.cluster?"rounded-sm":"rounded-full"},sortedSizes(){return[...this.sizes].sort((r,e)=>r-e)},maxWidht(){var t;const r=((t=this.sizes)==null?void 0:t.length)-1;return this.calcSize(r)}},methods:{sizeClass(r){return this.resizeItem?`h-[${this.calcSize(r)}] w-[${this.calcSize(r)}] ${this.borderRadius}`:`h-[10px] ${this.borderRadius}`},calcSize(r){return`${10+r*2}px`},getOpacity(r){return(r+1)/this.sortedSizes.length}}},yme={key:0,class:"absolute flex items-end w-fit bottom-[10px] max-w-[80%] left-[50%] translate-x-[-50%] bg-[rgba(255,255,255,0.7)] p-[10px] rounded"},_me={class:"w-[80px] mr-[10px]"},bme=["title"],xme={class:"text-[10px] mb-[2px] text-[#1F2937] font-normal leading-[1.2]"};function wme(r,e,t,n,i,a){var o;return(o=t.sizes)!=null&&o.length?(P.openBlock(),P.createElementBlock("div",yme,[P.createElementVNode("div",_me,[e[0]||(e[0]=P.createElementVNode("p",{class:"text-[10px] mb-[2px] text-[#1F2937] leading-[1.2]"}," Дані відсутні ",-1)),P.createElementVNode("div",{class:P.normalizeClass([a.sizeClass(r.index),"w-full border border-gray-500"])},null,2)]),a.sortedSizes.length?(P.openBlock(!0),P.createElementBlock(P.Fragment,{key:0},P.renderList(a.sortedSizes,(s,l)=>{var c,d,f,g,m,_,x,w;return P.openBlock(),P.createElementBlock("div",{class:"w-[80px]",title:l===((c=a.sortedSizes)==null?void 0:c.length)-1?">"+s:l==((d=a.sortedSizes)==null?void 0:d.length)-1?">"+a.sortedSizes[((f=a.sortedSizes)==null?void 0:f.length)-1]:s+"-"+a.sortedSizes[l+1]},[P.createElementVNode("p",xme,P.toDisplayString(l===((g=a.sortedSizes)==null?void 0:g.length)-1?">"+parseInt(s):l==((m=a.sortedSizes)==null?void 0:m.length)-1?">"+parseInt(a.sortedSizes[((_=a.sortedSizes)==null?void 0:_.length)-1]):parseInt(s)+"-"+parseInt(a.sortedSizes[l+1])),1),P.createElementVNode("div",{class:P.normalizeClass([a.sizeClass(l),"w-full border border-r-0 border-gray-500"]),style:P.normalizeStyle({backgroundColor:((w=(x=i.palette)==null?void 0:x[t.color])==null?void 0:w[l])||t.color})},null,6)],8,bme)}),256)):P.createCommentVNode("",!0)])):P.createCommentVNode("",!0)}const Sme=ur(mme,[["render",wme]]),Tme={},Eme={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map"};function Cme(r,e){return P.openBlock(),P.createElementBlock("svg",Eme,e[0]||(e[0]=[P.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),P.createElementVNode("path",{d:"M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13"},null,-1),P.createElementVNode("path",{d:"M9 4v13"},null,-1),P.createElementVNode("path",{d:"M15 7v13"},null,-1)]))}const Ame=ur(Tme,[["render",Cme]]),Dme={mixins:[Ea,oA],components:{VsMapSetting:F$,VsClusterLegend:Sme,VsMapGoHome:G$,VsList:U$,VsMapSlotLayers:$$,VsBar:q0},data(){return{baseColor:"pink",kattotg:"",options:[{id:"map",text:"Карта",component:Ame},{id:"table",text:"Таблиця",component:mC},{id:"chart",text:"Віджет",component:R$}],activeTab:"map",mapId:`map-${Math.floor(Math.random()*1e3)}`,layerId:`layer${Math.floor(Math.random()*1e3)}`,map:null,hoverData:null,data:null,coordinatesByMouse:[],showSetting:!1,popup:null,color:"#69D2E7",label:"<div><icon-map/></div>"}},async mounted(){await this.getMapData(),await this.createMap()},watch:{kattotg(){this.loadHandler()}},methods:{async getMapData(){const r=await yr.get(`/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`);this.data=r.data,this.$emit("update:widgetData",this.data),setTimeout(()=>{var e;return(e=this.map)==null?void 0:e.resize()})},async loadHandler(){var n,i,a,o;this.baseColor=((n=this.data.style)==null?void 0:n.color)||"blue";const r=["case"];(o=(a=(i=this.data)==null?void 0:i.sizes)==null?void 0:a.toReversed())==null||o.forEach((s,l)=>{var c,d;r.push([">",["get","metric"],s]),r.push((d=(c=lA[this.baseColor])==null?void 0:c.toReversed())==null?void 0:d[l]),l++}),r.push("gray");const e={type:"polygon",color:r,opacity:.4};Object.assign(e,this.data.style||{}),this.map.getSource("bi")||this.addVtileLayer({id:"bi",url:`${window.location.origin}/api/bi-cluster-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:e}),this.map.getLayer("highlighted")&&this.map.removeLayer("highlighted"),this.map.getSource("highlighted")&&this.map.removeSource("highlighted");const t=["case"];this.kattotg&&t.push(["==",["to-string",["get","name"]],String(this.kattotg)],"red"),t.push("transparent"),this.map.addLayer({id:"highlighted",type:"fill",source:"bi","source-layer":"bi",paint:{"fill-color":t,"fill-opacity":.6}})},async createMap(){const r={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new rb.Map({container:this.mapId,style:r,center:[31,48.5],zoom:5,minZoom:3,maxZoom:20,attributionControl:!1}),this.map.addControl(new rb.NavigationControl({visualizePitch:!0})),this.map.on("load",()=>{this.loadHandler()}),this.map.on("mousemove",e=>{this.moveMouseHadler(e)}),this.map.on("mouseout",()=>{var e;this.showLegend=!1,this.showSetting=!1,this.coordinatesByMouse=0,(e=this.popup)==null||e.remove()})},moveMouseHadler(r){var e;try{const t=this.map.queryRenderedFeatures(r.point),n=((e=t[0])==null?void 0:e.properties)||{};if(!t.length){this.map.getCanvas().style.cursor="",this.popupElement&&this.popupElement.remove();return}this.map.getCanvas().style.cursor="pointer",this.popupElement&&this.popupElement.remove(),this.popupElement=document.createElement("div"),this.popupElement.className="absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28",this.popupElement.style.backgroundColor="rgba(255, 255, 255, 0.7)",this.popupElement.innerHTML=`<div class="px-2 py-1 text-sm font-semibold text-gray-800 border-b border-gray-200 border-solid rounded-t-lg">
|
|
754
754
|
${(n==null?void 0:n.x)||(n==null?void 0:n.title)||(n==null?void 0:n.name)||""}
|
|
755
755
|
</div>
|
|
756
756
|
|
|
@@ -759,4 +759,4 @@ uniform ${K} ${J} u_${ae};
|
|
|
759
759
|
<span class="font-medium mr-[6px]">Значення</span>
|
|
760
760
|
</span>
|
|
761
761
|
<span>${(n==null?void 0:n.metric)||0}</span>
|
|
762
|
-
</div>`;const i=this.map.project(r.lngLat);this.popupElement.style.left=`${i.x}px`,this.popupElement.style.top=`${i.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(t){console.error(t)}}}},
|
|
762
|
+
</div>`;const i=this.map.project(r.lngLat);this.popupElement.style.left=`${i.x}px`,this.popupElement.style.top=`${i.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(t){console.error(t)}}}},Mme={class:"h-full"},Ime={class:"flex items-start justify-between mb-[6px] w-full"},kme={class:"text-gray-800 font-[600]"},Lme={class:"flex gap-2"},Pme=["onClick"],Rme=["id"],Nme=["id"],Ome={class:"absolute flex flex-col right-[10px] top-[105px] gap-1"},zme={class:"h-[calc(250px)]"};function Bme(r,e,t,n,i,a){var g,m,_,x,w,C,M,L,O,F;const o=P.resolveComponent("VsMapSetting"),s=P.resolveComponent("VsMapSlotLayers"),l=P.resolveComponent("VsMapGoHome"),c=P.resolveComponent("VsClusterLegend"),d=P.resolveComponent("VsList"),f=P.resolveComponent("VsBar");return P.openBlock(),P.createElementBlock("div",Mme,[P.createElementVNode("div",Ime,[P.createElementVNode("h3",kme,P.toDisplayString(r.title),1),P.createElementVNode("div",Lme,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(i.options,V=>(P.openBlock(),P.createElementBlock("button",{class:P.normalizeClass(["p-1 text-gray-700 border rounded",[i.activeTab===(V==null?void 0:V.id)?"ring-2 ring-blue-500":""]]),onClick:U=>i.activeTab=V==null?void 0:V.id},[(P.openBlock(),P.createBlock(P.resolveDynamicComponent(V==null?void 0:V.component),{height:"16",width:"16"}))],10,Pme))),256))])]),P.withDirectives(P.createElementVNode("div",{class:"relative w-full h-[calc(100%-40px)]",id:`wrapper-${i.mapId}`},[P.createElementVNode("div",{id:i.mapId,class:"h-full w-full flex items-end min-h-[250px]"},null,8,Nme),i.showSetting?(P.openBlock(),P.createBlock(o,{key:0,map:i.map,coordinates:i.coordinatesByMouse},null,8,["map","coordinates"])):P.createCommentVNode("",!0),P.createVNode(s,{map:i.map},null,8,["map"]),P.createElementVNode("div",Ome,[P.createVNode(l,{map:i.map,bbox:(g=i.data)==null?void 0:g.bounds},null,8,["map","bbox"])]),P.createVNode(c,{mapId:i.mapId,colors:(m=i.data)==null?void 0:m.colors,sizes:(_=i.data)==null?void 0:_.sizes,color:i.baseColor,changeOpacityItem:"true",cluster:"true"},null,8,["mapId","colors","sizes","color"])],8,Rme),[[P.vShow,i.activeTab=="map"]]),P.withDirectives(P.createVNode(d,{mapId:i.mapId,source:(x=i.data)==null?void 0:x.rows,total:((w=i.data)==null?void 0:w.total)||0,count:((C=i.data)==null?void 0:C.count)||0,onKattotg:e[0]||(e[0]=V=>i.kattotg=V)},null,8,["mapId","source","total","count"]),[[P.vShow,i.activeTab=="table"]]),P.withDirectives(P.createElementVNode("div",zme,[(L=(M=i.data)==null?void 0:M.rows)!=null&&L.length?(P.openBlock(),P.createBlock(f,{key:0,source:(F=(O=i.data)==null?void 0:O.rows)==null?void 0:F.map(V=>({title:V==null?void 0:V.title,metric:V==null?void 0:V.metric}))},null,8,["source"])):P.createCommentVNode("",!0)],512),[[P.vShow,i.activeTab=="chart"]])])}const Vme=Object.freeze(Object.defineProperty({__proto__:null,default:ur(Dme,[["render",Bme]])},Symbol.toStringTag,{value:"Module"})),Fme={name:"VsTable",mixins:[Ea],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>rs(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(n=>parseFloat(n[e])).map(n=>En(parseFloat(n[e])))}))}catch(r){console.error(r)}}}},$me={class:"flex flex-col h-full pt-[16px] pb-[16px] space-y-4 rounded-xl"},Gme={class:"overflow-auto h-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},Ume={class:"inline-block min-w-full align-middle"},Hme={class:"relative min-w-full divide-y divide-gray-200 text-[12px]"},Wme={class:"sticky top-0 bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},qme={class:"space-x-2"},Zme={scope:"col",class:"xl:min-w-[120px] min-w-48"},jme={class:"flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1"},Xme={class:"divide-y divide-gray-200"},Yme={class:"text-gray-600"};function Kme(r,e,t,n,i,a){return P.openBlock(),P.createElementBlock("div",$me,[P.createElementVNode("div",Gme,[P.createElementVNode("div",Ume,[P.createElementVNode("table",Hme,[P.createElementVNode("thead",Wme,[P.createElementVNode("tr",qme,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.dimensions,o=>(P.openBlock(),P.createElementBlock("th",Zme,[P.createElementVNode("div",jme,P.toDisplayString(o),1)]))),256))])]),P.createElementVNode("tbody",Xme,[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.sourceData,(o,s)=>(P.openBlock(),P.createElementBlock("tr",{key:s},[(P.openBlock(!0),P.createElementBlock(P.Fragment,null,P.renderList(r.dimensions,(l,c)=>(P.openBlock(),P.createElementBlock("td",{key:c,class:"py-3 whitespace-nowrap"},[P.createElementVNode("span",Yme,P.toDisplayString(o==null?void 0:o[l]),1)]))),128))]))),128))])])])])])}const Jme=Object.freeze(Object.defineProperty({__proto__:null,default:ur(Fme,[["render",Kme]])},Symbol.toStringTag,{value:"Module"}));return O$});
|