maplibre-gl 2.1.8-pre.2 → 2.1.8-pre.3
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/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +24 -23
- package/dist/maplibre-gl.d.ts +3 -1
- package/dist/maplibre-gl.js +2 -2
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +2 -2
- package/src/style/query_utils.test.ts +107 -0
- package/src/style/query_utils.ts +25 -0
- package/src/style/style_layer/line_style_layer.ts +1 -25
- package/src/util/vectortile_to_geojson.ts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var maplibregl=function(){"use strict";var t=e;function e(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}function r(t,e,r){return Math.min(r,Math.max(e,t))}function n(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function i(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function s(t){return Array.isArray(t)?t.map(s):"object"==typeof t&&t?i(t,s):t}e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},new t(.25,.1,.25,1);const a={};function o(t){a[t]||("undefined"!=typeof console&&console.warn(t),a[t]=!0)}function l(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function u(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function c(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let h=null;function p(t){if(null==h){const e=t.navigator?t.navigator.userAgent:null;h=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return h}function f(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}class d{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],r=i[3+t+1];n.push(e===r?null:i.subarray(e,r))}const s=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],s),this.bboxes=i.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const i=r/e*t;this.min=-i,this.max=t+i}insert(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,n,i,s){this.cells[i].push(s)}query(t,e,r,n,i){const s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);{const s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s}}_queryCell(t,e,r,n,i,s,a,o){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===a[h]){const l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&r>=u[l+0]&&n>=u[l+1])?(a[h]=!0,s.push(i[h])):a[h]=!1}}}}_forEachCell(t,e,r,n,i,s,a,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,a,o))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const n=new Int32Array(e+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const r=t[e];n[3+e]=i,n.set(r,i),i+=r.length}return n[3+t.length]=i,n.set(this.keys,i),i+=this.keys.length,n[3+t.length+1]=i,n.set(this.bboxes,i),i+=this.bboxes.length,n.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new d(t.buffer)}}var y,m={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function g(t){return(t=Math.round(t))<0?0:t>255?255:t}function x(t){return g("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function v(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function b(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{y={}.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in m)return m[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=r.indexOf("("),i=r.indexOf(")");if(-1!==n&&i+1===r.length){var s=r.substr(0,n),a=r.substr(n+1,i-(n+1)).split(","),o=1;switch(s){case"rgba":if(4!==a.length)return null;o=v(a.pop());case"rgb":return 3!==a.length?null:[x(a[0]),x(a[1]),x(a[2]),o];case"hsla":if(4!==a.length)return null;o=v(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=v(a[1]),c=v(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return[g(255*b(p,h,l+1/3)),g(255*b(p,h,l)),g(255*b(p,h,l-1/3)),o];default:return null}}return null}}catch(t){}class w{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof w)return t;if("string"!=typeof t)return;const e=y(t);return e?new w(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}}function _(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}w.black=new w(0,0,0,1),w.white=new w(1,1,1,1),w.transparent=new w(0,0,0,0),w.red=new w(1,0,0,1);class k extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class S{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new S(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const z={kind:"null"},A={kind:"number"},I={kind:"string"},M={kind:"boolean"},P={kind:"color"},B={kind:"object"},C={kind:"value"},V={kind:"collator"},T={kind:"formatted"},E={kind:"resolvedImage"};function D(t,e){return{kind:"array",itemType:t,N:e}}function F(t){if("array"===t.kind){const e=F(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const L=[z,A,I,M,P,T,B,D(C),E];function $(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!$(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of L)if(!$(t,e))return null}return`Expected ${F(t)} but found ${F(e)} instead.`}function O(t,e){return e.some((e=>e.kind===t.kind))}function q(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class j{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class R{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class U{constructor(t){this.sections=t}static fromString(t){return new U([new R(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof U?t:U.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(r)}return t}}class N{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new N({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Z(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function G(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof w)return!0;if(t instanceof j)return!0;if(t instanceof U)return!0;if(t instanceof N)return!0;if(Array.isArray(t)){for(const e of t)if(!G(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!G(t[e]))return!1;return!0}return!1}function X(t){if(null===t)return z;if("string"==typeof t)return I;if("boolean"==typeof t)return M;if("number"==typeof t)return A;if(t instanceof w)return P;if(t instanceof j)return V;if(t instanceof U)return T;if(t instanceof N)return E;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=X(e);if(r){if(r===t)continue;r=C;break}r=t}return D(r||C,e)}return B}function Y(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof w||t instanceof U||t instanceof N?t.toString():JSON.stringify(t)}class J{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!G(t[1]))return e.error("invalid value");const r=t[1];let n=X(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new J(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof w?["rgba"].concat(this.value.toArray()):this.value instanceof U?this.value.serialize():this.value}}class K{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const W={string:I,number:A,boolean:M,object:B};class H{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in W)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=W[r],n++}else i=C;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=D(i,s)}else r=W[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,C);if(!r)return null;s.push(r)}return new H(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!$(this.type,X(r)))return r;if(e===this.args.length-1)throw new K(`Expected value to be of type ${F(this.type)}, but found ${F(X(r))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}class Q{constructor(t){this.type=T,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,A),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,D(I)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,P),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a}else{const s=e.parse(t[r],1,C);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Q(n)}evaluate(t){return new U(this.sections.map((e=>{const r=e.content.evaluate(t);return X(r)===E?new R("",r,null,null,null):new R(Y(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r)}return t}}class tt{constructor(t){this.type=E,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,I);return r?new tt(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=N.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const et={"to-boolean":M,"to-color":P,"to-number":A,"to-string":I};class rt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const n=et[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,C);if(!n)return null;i.push(n)}return new rt(n,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof w)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Z(e[0],e[1],e[2],e[3]),!r))return new w(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new K(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new K(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?U.fromString(Y(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?N.fromString(Y(this.args[0].evaluate(t))):Y(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Q([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tt(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const nt=["Unknown","Point","LineString","Polygon"];class it{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?"number"==typeof this.feature.type?nt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=w.parse(t)),e}}class st{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=st.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new Mt(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=o.parse(r,1+a.length,i);if(!s){l=!0;break}a.push(s)}if(!l)if(Array.isArray(n)&&n.length!==a.length)o.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=a[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new st(r,i,s,a)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(F).join(", ")})`:`(${F(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(F(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){st.definitions=e;for(const r in e)t[r]=st}}class at{constructor(t,e,r){this.type=V,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,M);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,M);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,I),!s)?null:new at(n,i,s)}evaluate(t){return new j(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const ot=8192;function lt(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function ut(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ct(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*ot),Math.round(n*i*ot)]}function ht(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function pt(t,e){let r=!1;for(let a=0,o=e.length;a<o;a++){const o=e[a];for(let e=0,a=o.length;e<a-1;e++){if(ht(t,o[e],o[e+1]))return!1;(i=o[e])[1]>(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function ft(t,e){for(let r=0;r<e.length;r++)if(pt(t,e[r]))return!0;return!1}function dt(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function yt(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(a=u[r+1])[0]-(s=u[r])[0],a[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&dt(n,i,s,a)&&dt(s,a,n,i))return!0;var n,i,s,a,o,l;return!1}function mt(t,e){for(let r=0;r<t.length;++r)if(!pt(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(yt(t[r],t[r+1],e))return!1;return!0}function gt(t,e){for(let r=0;r<e.length;r++)if(mt(t,e[r]))return!0;return!1}function xt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=ct(t[i][n],r);lt(e,a),s.push(a)}n.push(s)}return n}function vt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=xt(t[i],e,r);n.push(s)}return n}function bt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}lt(e,t)}function wt(t,e,r,n){const i=Math.pow(2,n.z)*ot,s=[n.x*ot,n.y*ot],a=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];bt(n,e,r,i),a.push(n)}return a}function _t(t,e,r,n){const i=Math.pow(2,n.z)*ot,s=[n.x*ot,n.y*ot],a=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];lt(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)bt(n,e,r,i)}var o;return a}class kt{constructor(t,e){this.type=M,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(G(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new kt(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new kt(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new kt(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=xt(e.coordinates,n,i),a=wt(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!pt(t,s))return!1}if("MultiPolygon"===e.type){const s=vt(e.coordinates,n,i),a=wt(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!ft(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=xt(e.coordinates,n,i),a=_t(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!mt(t,s))return!1}if("MultiPolygon"===e.type){const s=vt(e.coordinates,n,i),a=_t(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!gt(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function St(t){if(t instanceof st){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof kt)return!1;let e=!0;return t.eachChild((t=>{e&&!St(t)&&(e=!1)})),e}function zt(t){if(t instanceof st&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!zt(t)&&(e=!1)})),e}function At(t,e){if(t instanceof st&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!At(t,e)&&(r=!1)})),r}class It{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new It(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Mt{constructor(t,e=[],r,n=new S,i=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return"assert"===r?new H(e,[t]):"coerce"===r?new rt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof J)&&"resolvedImage"!==n.type.kind&&Pt(n)){const t=new it;try{n=new J(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Mt(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new k(r,t))}checkSubtype(t,e){const r=$(t,e);return r&&this.error(r),r}}function Pt(t){if(t instanceof It)return Pt(t.boundExpression);if(t instanceof st&&"error"===t.name)return!1;if(t instanceof at)return!1;if(t instanceof kt)return!1;const e=t instanceof rt||t instanceof H;let r=!0;return t.eachChild((t=>{r=e?r&&Pt(t):r&&t instanceof J})),!!r&&St(t)&&At(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Bt(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new K("Input is not a number.");a=o-1}return 0}class Ct{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,A);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new Ct(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Bt(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function Vt(t,e,r){return t*(1-r)+e*r}var Tt=Object.freeze({__proto__:null,number:Vt,color:function(t,e,r){return new w(Vt(t.r,e.r,r),Vt(t.g,e.g,r),Vt(t.b,e.b,r),Vt(t.a,e.a,r))},array:function(t,e,r){return t.map(((t,n)=>Vt(t,e[n],r)))}});const Et=.95047,Dt=1.08883,Ft=4/29,Lt=6/29,$t=3*Lt*Lt,Ot=Math.PI/180,qt=180/Math.PI;function jt(t){return t>.008856451679035631?Math.pow(t,1/3):t/$t+Ft}function Rt(t){return t>Lt?t*t*t:$t*(t-Ft)}function Ut(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Nt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Zt(t){const e=Nt(t.r),r=Nt(t.g),n=Nt(t.b),i=jt((.4124564*e+.3575761*r+.1804375*n)/Et),s=jt((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-jt((.0193339*e+.119192*r+.9503041*n)/Dt)),alpha:t.a}}function Gt(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Rt(e),r=Et*Rt(r),n=Dt*Rt(n),new w(Ut(3.2404542*r-1.5371385*e-.4985314*n),Ut(-.969266*r+1.8760108*e+.041556*n),Ut(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Xt(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Yt={forward:Zt,reverse:Gt,interpolate:function(t,e,r){return{l:Vt(t.l,e.l,r),a:Vt(t.a,e.a,r),b:Vt(t.b,e.b,r),alpha:Vt(t.alpha,e.alpha,r)}}},Jt={forward:function(t){const{l:e,a:r,b:n}=Zt(t),i=Math.atan2(n,r)*qt;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ot,r=t.c;return Gt({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:Xt(t.h,e.h,r),c:Vt(t.c,e.c,r),l:Vt(t.l,e.l,r),alpha:Vt(t.alpha,e.alpha,r)}}};var Kt=Object.freeze({__proto__:null,lab:Yt,hcl:Jt});class Wt{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(e,r,n,i){let s=0;if("exponential"===e.name)s=Ht(r,e.base,n,i);else if("linear"===e.name)s=Ht(r,1,n,i);else if("cubic-bezier"===e.name){const a=e.controlPoints;s=new t(a[0],a[1],a[2],a[3]).solve(Ht(r,1,n,i))}return s}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,A),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=P:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return"number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Wt(o,r,n,i,a):e.error(`Type ${F(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Bt(e,n),a=Wt.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?Tt[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?Jt.reverse(Jt.interpolate(Jt.forward(o),Jt.forward(l),a)):Yt.reverse(Yt.interpolate(Yt.forward(o),Yt.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function Ht(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class Qt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}const s=n&&i.some((t=>$(n,t.type)));return new Qt(s?C:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof N&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class te{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new te(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,r]of this.bindings)t.push(e,r.serialize());return t.push(this.result.serialize()),t}}class ee{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,A),n=e.parse(t[2],2,D(e.expectedType||C));return r&&n?new ee(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new K(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new K(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new K(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class re{constructor(t,e){this.type=M,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,C),n=e.parse(t[2],2,C);return r&&n?O(r.type,[M,I,A,z,C])?new re(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!q(e,["boolean","string","number","null"]))throw new K(`Expected first argument to be of type boolean, string, number or null, but found ${F(X(e))} instead.`);if(!q(r,["string","array"]))throw new K(`Expected second argument to be of type array or string, but found ${F(X(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ne{constructor(t,e,r){this.type=A,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,C),n=e.parse(t[2],2,C);if(!r||!n)return null;if(!O(r.type,[M,I,A,z,C]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,A);return i?new ne(r,n,i):null}return new ne(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!q(e,["boolean","string","number","null"]))throw new K(`Expected first argument to be of type boolean, string, number or null, but found ${F(X(e))} instead.`);if(!q(r,["string","array"]))throw new K(`Expected second argument to be of type array or string, but found ${F(X(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ie{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,X(t)))return null}else r=X(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,C);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new ie(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(X(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class se{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,M);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new se(r,n,i):null}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class ae{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,C),n=e.parse(t[2],2,A);if(!r||!n)return null;if(!O(r.type,[D(C),I,C]))return e.error(`Expected first argument to be of type array or string, but found ${F(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,A);return i?new ae(r.type,r,n,i):null}return new ae(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!q(e,["string","array"]))throw new K(`Expected first argument to be of type array or string, but found ${F(X(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function oe(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function le(t,e,r,n){return 0===n.compare(e,r)}function ue(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=M,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,C);if(!s)return null;if(!oe(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${F(s.type)}'.`);let a=e.parse(t[2],2,C);if(!a)return null;if(!oe(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${F(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${F(s.type)}' and '${F(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new H(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new H(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,V),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=X(s),r=X(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new K(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=X(s),r=X(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const ce=ue("==",(function(t,e,r){return e===r}),le),he=ue("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!le(0,e,r,n)})),pe=ue("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),fe=ue(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),de=ue("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),ye=ue(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class me{constructor(t,e,r,n,i){this.type=I,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,A);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,I),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,I),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,A),!a))return null;let o=null;return n["max-fraction-digits"]&&(o=e.parse(n["max-fraction-digits"],1,A),!o)?null:new me(r,i,s,a,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class ge{constructor(t){this.type=A,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${F(r.type)} instead.`):new ge(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new K(`Expected value to be of type string or array, but found ${F(X(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const xe={"==":ce,"!=":he,">":fe,"<":pe,">=":ye,"<=":de,array:H,at:ee,boolean:H,case:se,coalesce:Qt,collator:at,format:Q,image:tt,in:re,"index-of":ne,interpolate:Wt,"interpolate-hcl":Wt,"interpolate-lab":Wt,length:ge,let:te,literal:J,match:ie,number:H,"number-format":me,object:H,slice:ae,step:Ct,string:H,"to-boolean":rt,"to-color":rt,"to-number":rt,"to-string":rt,var:It,within:kt};function ve(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=Z(e,r,n,s);if(a)throw new K(a);return new w(e/255*s,r/255*s,n/255*s,s)}function be(t,e){return t in e}function we(t,e){const r=e[t];return void 0===r?null:r}function _e(t){return{type:t}}function ke(t){return{result:"success",value:t}}function Se(t){return{result:"error",value:t}}function ze(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ae(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ie(t){return!!t.expression&&t.expression.interpolated}function Me(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Pe(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Be(t){return t}function Ce(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ie(e)?"exponential":"interval");if(r&&((t=_({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],w.parse(t[1])]))),t.default=w.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Kt[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=De;else if("interval"===s)a=Ee;else if("categorical"===s){a=Te,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Fe}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Ce(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Wt.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>De({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:Wt.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Ve(t.default,e.default):a(t,e,i,o,l)}}}function Ve(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Te(t,e,r,n,i){return Ve(typeof r===i?n[r]:void 0,t.default,e.default)}function Ee(t,e,r){if("number"!==Me(r))return Ve(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Bt(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function De(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Me(r))return Ve(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Bt(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=Tt[e.type]||Be;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Kt[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a))}return"function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function Fe(t,e,r){return"color"===e.type?r=w.parse(r):"formatted"===e.type?r=U.fromString(r.toString()):"resolvedImage"===e.type?r=N.fromString(r.toString()):Me(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ve(r,t.default,e.default)}st.register(xe,{error:[{kind:"error"},[I],(t,[e])=>{throw new K(e.evaluate(t))}],typeof:[I,[C],(t,[e])=>F(X(e.evaluate(t)))],"to-rgba":[D(A,4),[P],(t,[e])=>e.evaluate(t).toArray()],rgb:[P,[A,A,A],ve],rgba:[P,[A,A,A,A],ve],has:{type:M,overloads:[[[I],(t,[e])=>be(e.evaluate(t),t.properties())],[[I,B],(t,[e,r])=>be(e.evaluate(t),r.evaluate(t))]]},get:{type:C,overloads:[[[I],(t,[e])=>we(e.evaluate(t),t.properties())],[[I,B],(t,[e,r])=>we(e.evaluate(t),r.evaluate(t))]]},"feature-state":[C,[I],(t,[e])=>we(e.evaluate(t),t.featureState||{})],properties:[B,[],t=>t.properties()],"geometry-type":[I,[],t=>t.geometryType()],id:[C,[],t=>t.id()],zoom:[A,[],t=>t.globals.zoom],"heatmap-density":[A,[],t=>t.globals.heatmapDensity||0],"line-progress":[A,[],t=>t.globals.lineProgress||0],accumulated:[C,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[A,_e(A),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[A,_e(A),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:A,overloads:[[[A,A],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[A],(t,[e])=>-e.evaluate(t)]]},"/":[A,[A,A],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[A,[A,A],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[A,[],()=>Math.LN2],pi:[A,[],()=>Math.PI],e:[A,[],()=>Math.E],"^":[A,[A,A],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[A,[A],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[A,[A],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[A,[A],(t,[e])=>Math.log(e.evaluate(t))],log2:[A,[A],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[A,[A],(t,[e])=>Math.sin(e.evaluate(t))],cos:[A,[A],(t,[e])=>Math.cos(e.evaluate(t))],tan:[A,[A],(t,[e])=>Math.tan(e.evaluate(t))],asin:[A,[A],(t,[e])=>Math.asin(e.evaluate(t))],acos:[A,[A],(t,[e])=>Math.acos(e.evaluate(t))],atan:[A,[A],(t,[e])=>Math.atan(e.evaluate(t))],min:[A,_e(A),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[A,_e(A),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[A,[A],(t,[e])=>Math.abs(e.evaluate(t))],round:[A,[A],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[A,[A],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[A,[A],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[M,[I,C],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[M,[C],(t,[e])=>t.id()===e.value],"filter-type-==":[M,[I],(t,[e])=>t.geometryType()===e.value],"filter-<":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[M,[C],(t,[e])=>e.value in t.properties()],"filter-has-id":[M,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[M,[D(I)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[M,[D(C)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[M,[I,D(C)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[M,[I,D(C)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:M,overloads:[[[M,M],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[_e(M),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:M,overloads:[[[M,M],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[_e(M),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[M,[M],(t,[e])=>!e.evaluate(t)],"is-supported-script":[M,[I],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[I,[I],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[I,[I],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[I,_e(C),(t,e)=>e.map((e=>Y(e.evaluate(t)))).join("")],"resolved-locale":[I,[V],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Le{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new it,this._defaultValue=e?function(t){return"color"===t.type&&Pe(t.default)?new w(0,0,0,0):"color"===t.type?w.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new K(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function $e(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xe}function Oe(t,e){const r=new Mt(xe,[],e?function(t){const e={color:P,string:I,number:A,enum:I,boolean:M,formatted:T,resolvedImage:E};return"array"===t.type?D(e[t.value]||C,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?ke(new Le(n,e)):Se(r.errors)}class qe{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!zt(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class je{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!zt(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?Wt.interpolationFactor(this.interpolationType,t,e,r):0}}function Re(t,e){const r=Oe(t,e);if("error"===r.result)return r;const n=r.value.expression,i=St(n);if(!i&&!ze(e))return Se([new k("","data expressions not supported")]);const s=At(n,["zoom"]);if(!s&&!Ae(e))return Se([new k("","zoom expressions not supported")]);const a=Ne(n);return a||s?a instanceof k?Se([a]):a instanceof Wt&&!Ie(e)?Se([new k("",'"interpolate" expressions cannot be used with this property')]):ke(a?new je(i?"camera":"composite",r.value,a.labels,a instanceof Wt?a.interpolation:void 0):new qe(i?"constant":"source",r.value)):Se([new k("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ue{constructor(t,e){this._parameters=t,this._specification=e,_(this,Ce(this._parameters,this._specification))}static deserialize(t){return new Ue(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ne(t){let e=null;if(t instanceof te)e=Ne(t.result);else if(t instanceof Qt){for(const r of t.args)if(e=Ne(r),e)break}else(t instanceof Ct||t instanceof Wt)&&t.input instanceof st&&"zoom"===t.input.name&&(e=t);return e instanceof k||t.eachChild((t=>{const r=Ne(t);r instanceof k?e=r:!e&&r?e=new k("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new k("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}const Ze={};let Ge,Xe;function Ye(){"undefined"==typeof caches||Ge||(Ge=caches.open("mapbox-tiles"))}const Je={supported:!1,testSupport:function(t){!He&&We&&(Qe?tr(t):Ke=t)}};let Ke,We,He=!1,Qe=!1;function tr(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,We),t.isContextLost())return;Je.supported=!0}catch(t){}t.deleteTexture(e),He=!0}"undefined"!=typeof document&&(We=document.createElement("img"),We.onload=function(){Ke&&tr(Ke),Ke=null,Qe=!0},We.onerror=function(){He=!0,Ke=null},We.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),"function"==typeof Object.freeze&&Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"});class er extends Error{constructor(t,e,r,n){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=n}}const rr=c()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function nr(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:rr(),signal:r.signal});let i=!1,s=!1;"json"===t.type&&n.headers.set("Accept","application/json");return((r,a,l)=>{if(s)return;const u=Date.now();fetch(n).then((r=>r.ok?((r,a,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(a&&l&&function(t,e,r){if(Ye(),!Ge)return;const n={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const i=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===Xe)try{new Response(new ReadableStream),Xe=!0}catch(t){Xe=!1}Xe?e(t.body):t.blob().then(e)}(e,(e=>{const r=new Response(e,n);Ye(),Ge&&Ge.then((e=>e.put(function(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}(t.url),r))).catch((t=>o(t.message)))})))}(n,a,l),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{s||e(new Error(t.message))}))})(r,null,u):r.blob().then((n=>e(new er(r.status,r.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))}))})(),{cancel:()=>{s=!0,i||r.abort()}}}const ir=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(c()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!c()){const r=t.url.substring(0,t.url.indexOf("://"));return(Ze[r]||nr)(t,e)}}if(!(/^file:/.test(r=t.url)||/^file:/.test(rr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return nr(t,e);if(c()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{const n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new er(r.status,r.statusText,t.url,n))}},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},sr={};function ar(t,e,r={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),sr[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}ar("Object",Object),ar("TransferableGridIndex",d),ar("Color",w),ar("Error",Error),ar("AJAXError",er),ar("ResolvedImage",N),ar("StylePropertyFunction",Ue),ar("StyleExpression",Le,{omit:["_evaluator"]}),ar("ZoomDependentExpression",je),ar("ZoomConstantExpression",qe),ar("CompoundExpression",st,{omit:["_evaluate"]});for(const t in xe)xe[t]._classRegistryKey||ar(`Expression_${t}`,xe[t]);function or(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function lr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(or(t))return e&&e.push(t),t;if(f(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(lr(n,e));return r}if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t){if(!t.hasOwnProperty(r))continue;if(sr[n].omit.indexOf(r)>=0)continue;const s=t[r];i[r]=sr[n].shallow.indexOf(r)>=0?s:lr(s,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function ur(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||or(t)||f(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(ur);if("object"==typeof t){const e=t.$name||"Object";if(!sr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=sr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=sr[e].shallow.indexOf(r)>=0?i:ur(i)}return n}throw new Error("can't deserialize object of type "+typeof t)}class cr{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}class hr{constructor(t,e,r){var n;this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},n=this,["receive","process"].forEach((t=>{n[t]&&(n[t]=n[t].bind(n))})),this.invoker=new cr(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=c()?t:window}send(t,e,r,n,i=!1){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[s]=r);const a=p(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:lr(e,a)},a),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t()}else c()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if("<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(ur(e.error)):r(null,ur(e.data)))}else{let r=!1;const n=p(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?lr(e):null,data:lr(i,n)},n)}:t=>{r=!0};let s=null;const a=ur(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,a,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,i)}else i(new Error(`Could not find function ${e.type}`));!r&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}}var pr={$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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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-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":{},within:{}}},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}},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"}}};class fr{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function dr(t){const e=t.value;return e?[new fr(t.key,e,"constants have been deprecated as of v8")]:[]}function yr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function mr(t){if(Array.isArray(t))return t.map(mr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=mr(t[r]);return e}return yr(t)}function gr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let o=[];const l=Me(r);if("object"!==l)return[new fr(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(i[l])c=i[l];else if(n[l])c=Nr;else if(i["*"])c=i["*"];else{if(!n["*"]){o.push(new fr(e,r[t],`unknown property "${t}"`));continue}c=Nr}o=o.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:a,object:r,objectKey:t},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&o.push(new fr(e,r,`missing required property "${t}"`));return o}function xr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||Nr;if("array"!==Me(e))return[new fr(s,e,`array expected, ${Me(e)} found`)];if(r.length&&e.length!==r.length)return[new fr(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new fr(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values};i.$version<7&&(o.function=r.function),"object"===Me(r.value)&&(o=r.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(a({array:e,arrayIndex:t,value:e[t],valueSpec:o,style:n,styleSpec:i,key:`${s}[${t}]`}));return l}function vr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Me(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new fr(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new fr(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new fr(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function br(t){const e=t.valueSpec,r=yr(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Me(t.value.stops)&&"array"===Me(t.value.stops[0])&&"object"===Me(t.value.stops[0][0]),c=gr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new fr(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(xr({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Me(n)&&0===n.length&&e.push(new fr(t.key,n,"array must have at least one stop")),e},default:function(t){return Nr({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&o&&c.push(new fr(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new fr(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Ie(t.valueSpec)&&c.push(new fr(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ze(t.valueSpec)?c.push(new fr(t.key,t.value,"property functions not supported")):o&&!Ae(t.valueSpec)&&c.push(new fr(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new fr(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Me(n))return[new fr(o,n,`array expected, ${Me(n)} found`)];if(2!==n.length)return[new fr(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Me(n[0]))return[new fr(o,n,`object expected, ${Me(n[0])} found`)];if(void 0===n[0].zoom)return[new fr(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new fr(o,n,"object stop key must have value")];if(s&&s>yr(n[0].zoom))return[new fr(o,n[0].zoom,"stop zoom values must appear in ascending order")];yr(n[0].zoom)!==s&&(s=yr(n[0].zoom),i=void 0,a={}),r=r.concat(gr({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:vr,value:p}}))}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return $e(mr(n[1]))?r.concat([new fr(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(Nr({key:`${o}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=Me(t.value),l=yr(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return[new fr(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new fr(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return ze(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new fr(t.key,u,n)]}return"categorical"!==r||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&void 0!==i&&l<i?[new fr(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in a?[new fr(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new fr(t.key,u,`integer expected, found ${l}`)]}}function wr(t){const e=("property"===t.expressionContext?Re:Oe)(mr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new fr(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new fr(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!zt(r))return[new fr(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!zt(r))return[new fr(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!At(r,["zoom","feature-state"]))return[new fr(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!St(r))return[new fr(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function _r(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(yr(r))&&i.push(new fr(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(yr(r))&&i.push(new fr(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function kr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!kr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Sr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zr(t){if(null==t)return{filter:()=>!0,needGeometry:!1};kr(t)||(t=Mr(t));const e=Oe(t,Sr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:Ir(t)}}function Ar(t,e){return t<e?-1:t>e?1:0}function Ir(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Ir(t[e]))return!0;return!1}function Mr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Pr(t[1],t[2],"=="):"!="===e?Vr(Pr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Pr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Mr))):"all"===e?["all"].concat(t.slice(1).map(Mr)):"none"===e?["all"].concat(t.slice(1).map(Mr).map(Vr)):"in"===e?Br(t[1],t.slice(2)):"!in"===e?Vr(Br(t[1],t.slice(2))):"has"===e?Cr(t[1]):"!has"===e?Vr(Cr(t[1])):"within"!==e||t;var r}function Pr(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Br(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Ar)]]:["filter-in-small",t,["literal",e]]}}function Cr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Vr(t){return["!",t]}function Tr(t){return kr(mr(t.value))?wr(_({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Er(t)}function Er(t){const e=t.value,r=t.key;if("array"!==Me(e))return[new fr(r,e,`array expected, ${Me(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new fr(r,e,"filter array must have at least 1 element")];switch(s=s.concat(_r({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),yr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===yr(e[1])&&s.push(new fr(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new fr(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Me(e[1]),"string"!==i&&s.push(new fr(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Me(e[a]),"$type"===yr(e[1])?s=s.concat(_r({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new fr(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Er({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Me(e[1]),2!==e.length?s.push(new fr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new fr(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Me(e[1]),2!==e.length?s.push(new fr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new fr(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function Dr(t,e){const r=t.key,n=t.style,i=t.styleSpec,s=t.value,a=t.objectKey,o=i[`${e}_${t.layerType}`];if(!o)return[];const l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&o[l[1]]&&o[l[1]].transition)return Nr({key:r,value:s,valueSpec:i.transition,style:n,styleSpec:i});const u=t.valueSpec||o[a];if(!u)return[new fr(r,s,`unknown property "${a}"`)];let c;if("string"===Me(s)&&ze(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new fr(r,s,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&h.push(new fr(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Pe(mr(s))&&"identity"===yr(s.type)&&h.push(new fr(r,s,'"text-font" does not support identity functions'))),h.concat(Nr({key:t.key,value:s,valueSpec:u,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function Fr(t){return Dr(t,"paint")}function Lr(t){return Dr(t,"layout")}function $r(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new fr(n,r,'either "type" or "ref" is required'));let a=yr(r.type);const o=yr(r.ref);if(r.id){const s=yr(r.id);for(let a=0;a<t.arrayIndex;a++){const t=i.layers[a];yr(t.id)===s&&e.push(new fr(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new fr(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{yr(e.id)===o&&(t=e)})),t?t.ref?e.push(new fr(n,r.ref,"ref cannot reference another ref layer")):a=yr(t.type):e.push(new fr(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&yr(t.type);t?"vector"===s&&"raster"===a?e.push(new fr(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?e.push(new fr(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new fr(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new fr(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new fr(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new fr(n,r.source,`source "${r.source}" not found`))}else e.push(new fr(n,r,'missing required property "source"'));return e=e.concat(gr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Nr({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:Tr,layout:t=>gr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Lr(_({layerType:a},t))}}),paint:t=>gr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Fr(_({layerType:a},t))}})}})),e}function Or(t){const e=t.value,r=t.key,n=Me(e);return"string"!==n?[new fr(r,e,`string expected, ${n} found`)]:[]}const qr={promoteId:function({key:t,value:e}){if("string"===Me(e))return Or({key:t,value:e});{const r=[];for(const n in e)r.push(...Or({key:`${t}.${n}`,value:e[n]}));return r}}};function jr(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new fr(r,e,'"type" is required')];const s=yr(e.type);let a;switch(s){case"vector":case"raster":case"raster-dem":return a=gr({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qr}),a;case"geojson":if(a=gr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:qr}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...wr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...wr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return gr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return gr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new fr(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return _r({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function Rr(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=Me(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new fr("light",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?Nr({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?Nr({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new fr(t,e[t],`unknown property "${t}"`)])}return s}const Ur={"*":()=>[],array:xr,boolean:function(t){const e=t.value,r=t.key,n=Me(e);return"boolean"!==n?[new fr(r,e,`boolean expected, ${n} found`)]:[]},number:vr,color:function(t){const e=t.key,r=t.value,n=Me(r);return"string"!==n?[new fr(e,r,`color expected, ${n} found`)]:null===y(r)?[new fr(e,r,`color expected, "${r}" found`)]:[]},constants:dr,enum:_r,filter:Tr,function:br,layer:$r,object:gr,source:jr,light:Rr,string:Or,formatted:function(t){return 0===Or(t).length?[]:wr(t)},resolvedImage:function(t){return 0===Or(t).length?[]:wr(t)}};function Nr(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Pe(yr(e))?br(t):r.expression&&$e(mr(e))?wr(t):r.type&&Ur[r.type]?Ur[r.type](t):gr(_({},t,{valueSpec:r.type?n[r.type]:r}))}function Zr(t){const e=t.value,r=t.key,n=Or(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new fr(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new fr(r,e,'"glyphs" url must include a "{range}" token'))),n}function Gr(t,e=pr){let r=[];return r=r.concat(Nr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Zr,"*":()=>[]}})),t.constants&&(r=r.concat(dr({key:"constants",value:t.constants,style:t,styleSpec:e}))),Xr(r)}function Xr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Yr(t){return function(...e){return Xr(t.apply(this,e))}}function Jr(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function Kr(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}Gr.source=Yr(jr),Gr.light=Yr(Rr),Gr.layer=Yr($r),Gr.filter=Yr(Tr),Gr.paintProperty=Yr(Fr),Gr.layoutProperty=Yr(Lr);class Wr{constructor(t,e={}){n(this,e),this.type=t}}class Hr extends Wr{constructor(t,e={}){super("error",n({error:t},e))}}const Qr=Gr,tn=Qr.paintProperty,en=Qr.layoutProperty;class rn{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const nn=t=>t>=1536&&t<=1791,sn=t=>t>=1872&&t<=1919,an=t=>t>=2208&&t<=2303,on=t=>t>=11904&&t<=12031,ln=t=>t>=12032&&t<=12255,un=t=>t>=12272&&t<=12287,cn=t=>t>=12288&&t<=12351,hn=t=>t>=12352&&t<=12447,pn=t=>t>=12448&&t<=12543,fn=t=>t>=12544&&t<=12591,dn=t=>t>=12704&&t<=12735,yn=t=>t>=12736&&t<=12783,mn=t=>t>=12784&&t<=12799,gn=t=>t>=12800&&t<=13055,xn=t=>t>=13056&&t<=13311,vn=t=>t>=13312&&t<=19903,bn=t=>t>=19968&&t<=40959,wn=t=>t>=40960&&t<=42127,_n=t=>t>=42128&&t<=42191,kn=t=>t>=63744&&t<=64255,Sn=t=>t>=64336&&t<=65023,zn=t=>t>=65040&&t<=65055,An=t=>t>=65072&&t<=65103,In=t=>t>=65104&&t<=65135,Mn=t=>t>=65136&&t<=65279,Pn=t=>t>=65280&&t<=65519;function Bn(t){for(const e of t)if(Tn(e.charCodeAt(0)))return!0;return!1}function Cn(t){for(const e of t)if(!Vn(e.charCodeAt(0)))return!1;return!0}function Vn(t){return!(nn(t)||sn(t)||an(t)||Sn(t)||Mn(t))}function Tn(t){return!(746!==t&&747!==t&&(t<4352||!(dn(t)||fn(t)||An(t)&&!(t>=65097&&t<=65103)||kn(t)||xn(t)||on(t)||yn(t)||!(!cn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||vn(t)||bn(t)||gn(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||hn(t)||un(t)||(t=>t>=12688&&t<=12703)(t)||ln(t)||mn(t)||pn(t)&&12540!==t||!(!Pn(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!In(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||zn(t)||(t=>t>=19904&&t<=19967)(t)||wn(t)||_n(t))))}function En(t){return!(Tn(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||cn(t)||pn(t)||(t=>t>=57344&&t<=63743)(t)||An(t)||In(t)||Pn(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Dn(t){return t>=1424&&t<=2303||Sn(t)||Mn(t)}function Fn(t,e){return!(!e&&Dn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function Ln(t){for(const e of t)if(Dn(e.charCodeAt(0)))return!0;return!1}"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date);let $n="unavailable",On=null;const qn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===$n||null!=qn.applyArabicShaping,isLoading:()=>"loading"===$n,setState(t){$n=t.pluginStatus,On=t.pluginURL},isParsed:()=>null!=qn.applyArabicShaping&&null!=qn.processBidirectionalText&&null!=qn.processStyledBidirectionalText,getPluginURL:()=>On};class jn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rn,this.transition={})}isSupportedScript(t){return function(t,e){for(const r of t)if(!Fn(r.charCodeAt(0),e))return!1;return!0}(t,qn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Rn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Pe(t))return new Ue(t,e);if($e(t)){const r=Re(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"string"==typeof t&&"color"===e.type&&(r=w.parse(t)),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Un{constructor(t){this.property=t,this.value=new Rn(t,void 0)}transitioned(t,e){return new Zn(this.property,this.value,e,n({},t.transition,this.transition),t.now)}untransitioned(){return new Zn(this.property,this.value,null,{},0)}}class Nn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return s(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Un(this._values[t].property)),this._values[t].value=new Rn(this._values[t].property,null===e?void 0:s(e))}getTransition(t){return s(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Un(this._values[t].property)),this._values[t].transition=s(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Gn(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Gn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Zn{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Gn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Jn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Xn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return s(this._values[t].value)}setValue(t,e){this._values[t]=new Rn(this._values[t].property,null===e?void 0:s(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const n=new Jn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class Yn{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Jn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Kn{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=Tt[this.specification.type];return n?n(t,e,r):t}}class Wn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new Yn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Yn(this,{kind:"constant",value:void 0},t.parameters);const n=Tt[this.specification.type];return n?new Yn(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Hn extends Wn{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new Yn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new Yn(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Yn(this,{kind:"constant",value:r},e)}return new Yn(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Qn{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new jn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new jn(Math.floor(e.zoom),e)),t.expression.evaluate(new jn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class ti{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class ei{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Rn(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Un(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}ar("DataDrivenProperty",Wn),ar("DataConstantProperty",Kn),ar("CrossFadedDataDrivenProperty",Hn),ar("CrossFadedProperty",Qn),ar("ColorRampProperty",ti);const ri="-transition";class ni extends class{on(t,e){return this._listeners=this._listeners||{},Jr(t,e,this._listeners),this}off(t,e){return Kr(t,e,this._listeners),Kr(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},Jr(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new Wr(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of i)Kr(r,e,this._oneTimeListeners),e.call(this,t);const s=this._eventedParent;s&&(n(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),s.fire(t))}else t instanceof Hr&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Xn(e.layout)),e.paint)){this._transitionablePaint=new Nn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Jn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(en,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(ri)?this._transitionablePaint.getTransition(t.slice(0,-ri.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(tn,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(ri))return this._transitionablePaint.setTransition(t.slice(0,-ri.length),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),function(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return(!i||!1!==i.validate)&&function(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new Hr(new Error(n.message))),r=!0;return r}(this,t.call(Qr,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:pr,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Yn&&ze(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const ii={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class si{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ai{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function oi(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=ii[t.type].BYTES_PER_ELEMENT,s=r=li(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:li(r,Math.max(n,e)),alignment:e}}function li(t,e){return Math.ceil(t/e)*e}var ui=ci;function ci(t,e){this.x=t,this.y=e}ci.prototype={clone:function(){return new ci(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ci.convert=function(t){return t instanceof ci?t:Array.isArray(t)?new ci(t[0],t[1]):t};class hi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}hi.prototype.bytesPerElement=4,ar("StructArrayLayout2i4",hi);class pi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}pi.prototype.bytesPerElement=8,ar("StructArrayLayout4i8",pi);class fi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}fi.prototype.bytesPerElement=12,ar("StructArrayLayout2i4i12",fi);class di extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=a,t}}di.prototype.bytesPerElement=8,ar("StructArrayLayout2i4ub8",di);class yi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}yi.prototype.bytesPerElement=8,ar("StructArrayLayout2f8",yi);class mi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}mi.prototype.bytesPerElement=20,ar("StructArrayLayout10ui20",mi);class gi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}gi.prototype.bytesPerElement=24,ar("StructArrayLayout4i4ui4i24",gi);class xi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}xi.prototype.bytesPerElement=12,ar("StructArrayLayout3f12",xi);class vi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}vi.prototype.bytesPerElement=4,ar("StructArrayLayout1ul4",vi);class bi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=a,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}bi.prototype.bytesPerElement=20,ar("StructArrayLayout6i1ul2ui20",bi);class wi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}wi.prototype.bytesPerElement=12,ar("StructArrayLayout2i2i2i12",wi);class _i extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}_i.prototype.bytesPerElement=16,ar("StructArrayLayout2f1f2i16",_i);class ki extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}ki.prototype.bytesPerElement=12,ar("StructArrayLayout2ub2f12",ki);class Si extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}Si.prototype.bytesPerElement=6,ar("StructArrayLayout3ui6",Si);class zi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=a,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}zi.prototype.bytesPerElement=48,ar("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",zi);class Ai extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z,A,I){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z,A,I)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z,A,I,M){const P=34*t,B=17*t;return this.int16[P+0]=e,this.int16[P+1]=r,this.int16[P+2]=n,this.int16[P+3]=i,this.int16[P+4]=s,this.int16[P+5]=a,this.int16[P+6]=o,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=f,this.uint16[P+13]=d,this.uint16[P+14]=y,this.uint16[P+15]=m,this.uint16[P+16]=g,this.uint16[P+17]=x,this.uint16[P+18]=v,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=_,this.uint16[P+22]=k,this.uint32[B+12]=S,this.float32[B+13]=z,this.float32[B+14]=A,this.float32[B+15]=I,this.float32[B+16]=M,t}}Ai.prototype.bytesPerElement=68,ar("StructArrayLayout8i15ui1ul4f68",Ai);class Ii extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ii.prototype.bytesPerElement=4,ar("StructArrayLayout1f4",Ii);class Mi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Mi.prototype.bytesPerElement=6,ar("StructArrayLayout3i6",Mi);class Pi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}Pi.prototype.bytesPerElement=8,ar("StructArrayLayout1ul2ui8",Pi);class Bi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Bi.prototype.bytesPerElement=4,ar("StructArrayLayout2ui4",Bi);class Ci extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ci.prototype.bytesPerElement=2,ar("StructArrayLayout1ui2",Ci);class Vi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Vi.prototype.bytesPerElement=16,ar("StructArrayLayout4f16",Vi);class Ti extends si{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 ui(this.anchorPointX,this.anchorPointY)}}Ti.prototype.size=20;class Ei extends bi{get(t){return new Ti(this,t)}}ar("CollisionBoxArray",Ei);class Di extends si{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Di.prototype.size=48;class Fi extends zi{get(t){return new Di(this,t)}}ar("PlacedSymbolArray",Fi);class Li extends si{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Li.prototype.size=68;class $i extends Ai{get(t){return new Li(this,t)}}ar("SymbolInstanceArray",$i);class Oi extends Ii{getoffsetX(t){return this.float32[1*t+0]}}ar("GlyphOffsetArray",Oi);class qi extends Mi{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ar("SymbolLineVertexArray",qi);class ji extends si{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]}}ji.prototype.size=8;class Ri extends Pi{get(t){return new ji(this,t)}}ar("FeatureIndexArray",Ri);class Ui extends hi{}class Ni extends hi{}class Zi extends fi{}class Gi extends di{}class Xi extends yi{}class Yi extends mi{}class Ji extends gi{}class Ki extends xi{}class Wi extends vi{}class Hi extends wi{}class Qi extends ki{}class ts extends Si{}class es extends Bi{}const rs=oi([{name:"a_pos",components:2,type:"Int16"}],4),{members:ns}=rs;class is{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>is.MAX_VERTEX_ARRAY_LENGTH&&o(`Max vertices per segment is ${is.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>is.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new is([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function ss(t,e){return 256*(t=r(Math.floor(t),0,255))+r(Math.floor(e),0,255)}is.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ar("SegmentVector",is);const as=oi([{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 os={exports:{}},ls={exports:{}};ls.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var us={exports:{}};us.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var cs=ls.exports,hs=us.exports;os.exports=cs,os.exports.murmur3=cs,os.exports.murmur2=hs;var ps=os.exports;class fs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(ds(t)),this.positions.push(e,r,n)}getPositions(t){const e=ds(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return ys(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new fs;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ds(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ps(String(t))}function ys(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;ms(t,s,a),ms(e,3*s,3*a),ms(e,3*s+1,3*a+1),ms(e,3*s+2,3*a+2)}a-r<n-a?(ys(t,e,r,a),r=a+1):(ys(t,e,a+1,n),n=a)}}function ms(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}ar("FeaturePositionMap",fs);class gs{constructor(t,e){this.gl=t.gl,this.location=e}}class xs extends gs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class vs extends gs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class bs extends gs{constructor(t,e){super(t,e),this.current=w.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}function ws(t){return[ss(255*t.r,255*t.g),ss(255*t.b,255*t.a)]}class _s{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new bs(t,e):new xs(t,e)}}class ks{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,n){const i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,r){return"u_pattern"===r.substr(0,9)?new vs(t,e):new xs(t,e)}}class Ss{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i){const s=this.paintVertexArray.length,a=this.expression.evaluate(new jn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i)}_setPaintValue(t,e,r){if("color"===this.type){const n=ws(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class zs{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new jn(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new jn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,s,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),s=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,s)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=ws(r),s=ws(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const n=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=r(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new xs(t,e)}}class As{constructor(t,e,r,n,i,s){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=s,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i)}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:s,max:a}=r,o=n[i],l=n[s],u=n[a];if(o&&l&&u)for(let r=t;r<e;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,as.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,as.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Is{constructor(t,e,r){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const s=t.paint.get(i);if(!(s instanceof Yn&&ze(s.property.specification)))continue;const a=Ps(i,t.type),o=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===o.kind)this.binders[i]=h?new ks(o.value,a):new _s(o.value,a,l),n.push(`/u_${i}`);else if("source"===o.kind||h){const r=Bs(i,l,"source");this.binders[i]=h?new As(o,l,u,e,r,t.id):new Ss(o,a,l,r),n.push(`/a_${i}`)}else{const t=Bs(i,l,"composite");this.binders[i]=new zs(o,a,l,u,e,t),n.push(`/z_${i}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Ss||e instanceof zs?e.maxValue:0}populatePaintArrays(t,e,r,n,i){for(const s in this.binders){const a=this.binders[s];(a instanceof Ss||a instanceof zs||a instanceof As)&&a.populatePaintArray(t,e,r,n,i)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof ks&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i){let s=!1;for(const a in t){const o=e.getPositions(a);for(const e of o){const o=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof Ss||l instanceof zs||l instanceof As)&&!0===l.expression.isStateDependent){const u=n.paint.get(r);l.expression=u.value,l.updatePaintArray(e.start,e.end,o,t[a],i),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof _s||r instanceof ks)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ss||r instanceof zs)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof As)for(let e=0;e<as.members.length;e++)t.push(as.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof _s||r instanceof ks||r instanceof zs)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof _s||i instanceof ks||i instanceof zs)for(const s of i.uniformNames)if(e[s]){const a=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:a})}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,n,r.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof As){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof Ss||r instanceof zs)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof Ss||r instanceof zs||r instanceof As)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Ss||e instanceof zs||e instanceof As)&&e.destroy()}}}class Ms{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Is(n,e,r);this.needsUpload=!1,this._featureMap=new fs,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ps(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Bs(t,e,r){const n={color:{source:yi,composite:Vi},number:{source:Ii,composite:yi}},i=function(t){return{"line-pattern":{source:Yi,composite:Yi},"fill-pattern":{source:Yi,composite:Yi},"fill-extrusion-pattern":{source:Yi,composite:Yi}}[t]}(t);return i&&i[r]||n[e][r]}ar("ConstantBinder",_s),ar("CrossFadedConstantBinder",ks),ar("SourceExpressionBinder",Ss),ar("CrossFadedCompositeBinder",As),ar("CompositeExpressionBinder",zs),ar("ProgramConfiguration",Is,{omit:["_buffers"]}),ar("ProgramConfigurationSet",Ms);var Cs=8192;const Vs=Math.pow(2,14)-1,Ts=-Vs-1;function Es(t){const e=Cs/t.extent,n=t.loadGeometry();for(let t=0;t<n.length;t++){const i=n[t];for(let t=0;t<i.length;t++){const n=i[t],s=Math.round(n.x*e),a=Math.round(n.y*e);n.x=r(s,Ts,Vs),n.y=r(a,Ts,Vs),(s<n.x||s>n.x+1||a<n.y||a>n.y+1)&&o("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Ds(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Es(t):[]}}function Fs(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}class Ls{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ui,this.indexArray=new ts,this.segments=new is,this.programConfigurations=new Ms(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){const n=this.layers[0],i=[];let s=null,a=!1;"circle"===n.type&&(s=n.layout.get("circle-sort-key"),a=!s.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ds(e,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),u,r))continue;const c=a?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Es(e),patterns:{},sortKey:c};i.push(h)}a&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n,o=t[s].feature;this.addFeature(n,i,s,r),e.featureIndex.insert(o,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ns),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Cs||n<0||n>=Cs)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;Fs(this.layoutVertexArray,r,n,-1,-1),Fs(this.layoutVertexArray,r,n,1,-1),Fs(this.layoutVertexArray,r,n,1,1),Fs(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)}}function $s(t,e){for(let r=0;r<t.length;r++)if(Xs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Xs(t,e[r]))return!0;return!!Rs(t,e)}function Os(t,e,r){return!!Xs(t,e)||!!Ns(e,t,r)}function qs(t,e){if(1===t.length)return Gs(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Xs(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(Gs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Rs(t,e[r]))return!0;return!1}function js(t,e,r){if(t.length>1){if(Rs(t,e))return!0;for(let n=0;n<e.length;n++)if(Ns(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Ns(t[n],e,r))return!0;return!1}function Rs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(Us(n,i,e[t],e[t+1]))return!0}return!1}function Us(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function Ns(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Zs(t,e[r-1],e[r])<n)return!0;return!1}function Zs(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Gs(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Xs(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Ys(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=l(t,e,r[0]);return s!==l(t,e,r[1])||s!==l(t,e,r[2])||s!==l(t,e,r[3])}function Js(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ks(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ws(t,e,r,n,i){if(!e[0]&&!e[1])return t;const s=ui.convert(e)._mult(i);"viewport"===r&&s._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(s));return a}ar("CircleBucket",Ls,{omit:["layers"]});const Hs=new ei({"circle-sort-key":new Wn(pr.layout_circle["circle-sort-key"])});var Qs,ta={paint:new ei({"circle-radius":new Wn(pr.paint_circle["circle-radius"]),"circle-color":new Wn(pr.paint_circle["circle-color"]),"circle-blur":new Wn(pr.paint_circle["circle-blur"]),"circle-opacity":new Wn(pr.paint_circle["circle-opacity"]),"circle-translate":new Kn(pr.paint_circle["circle-translate"]),"circle-translate-anchor":new Kn(pr.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Kn(pr.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Kn(pr.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wn(pr.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wn(pr.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wn(pr.paint_circle["circle-stroke-opacity"])}),layout:Hs},ea="undefined"!=typeof Float32Array?Float32Array:Array;function ra(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function na(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}function ia(t,e){const r=na([],[t.x,t.y,0,1],e);return new ui(r[0]/r[3],r[1]/r[3])}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Qs=new ea(4),ea!=Float32Array&&(Qs[0]=0,Qs[1]=0,Qs[2]=0,Qs[3]=0);class sa extends Ls{}ar("HeatmapBucket",sa,{omit:["layers"]});var aa={paint:new ei({"heatmap-radius":new Wn(pr.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wn(pr.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Kn(pr.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ti(pr.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Kn(pr.paint_heatmap["heatmap-opacity"])})};function oa(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`)}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function la(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=oa({},{width:e,height:r},n);ua(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function ua(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)o[c+t]=a[u+t]}return e}class ca{constructor(t,e){oa(this,t,1,e)}resize(t){la(this,t,1)}clone(){return new ca({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ua(t,e,r,n,i,1)}}class ha{constructor(t,e){oa(this,t,4,e)}resize(t){la(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new ha({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ua(t,e,r,n,i,4)}}ar("AlphaImage",ca),ar("RGBAImage",ha);var pa={paint:new ei({"hillshade-illumination-direction":new Kn(pr.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Kn(pr.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Kn(pr.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Kn(pr.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Kn(pr.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Kn(pr.paint_hillshade["hillshade-accent-color"])})};const fa=oi([{name:"a_pos",components:2,type:"Int16"}],4),{members:da}=fa;var ya={exports:{}};function ma(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=ga(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=ga(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(Ma(a));for(o.sort(Sa),i=0;i<o.length;i++)r=xa(r=za(o[i],r),r.next);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(o=t[d])<n&&(n=o),(l=t[d+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?1/u:0}return va(p,f,r,n,i,u),f}function ga(t,e,r,n,i){var s,a;if(i===ja(t,e,r,n)>0)for(s=e;s<r;s+=n)a=$a(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=$a(s,t[s],t[s+1],a);return a&&Va(a,a.next)&&(Oa(a),a=a.next),a}function xa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Va(n,n.next)&&0!==Ca(n.prev,n,n.next))n=n.next;else{if(Oa(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function va(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Ia(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?wa(t,n,i,s):ba(t))e.push(o.i/r),e.push(t.i/r),e.push(l.i/r),Oa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?va(t=_a(xa(t),e,r),e,r,n,i,s,2):2===a&&ka(t,e,r,n,i,s):va(xa(t),e,r,n,i,s,1);break}}}function ba(t){var e=t.prev,r=t,n=t.next;if(Ca(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Pa(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ca(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wa(t,e,r,n){var i=t.prev,s=t,a=t.next;if(Ca(i,s,a)>=0)return!1;for(var o=i.x>s.x?i.x>a.x?i.x:a.x:s.x>a.x?s.x:a.x,l=i.y>s.y?i.y>a.y?i.y:a.y:s.y>a.y?s.y:a.y,u=Ia(i.x<s.x?i.x<a.x?i.x:a.x:s.x<a.x?s.x:a.x,i.y<s.y?i.y<a.y?i.y:a.y:s.y<a.y?s.y:a.y,e,r,n),c=Ia(o,l,e,r,n),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,h.x,h.y)&&Ca(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Ca(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,h.x,h.y)&&Ca(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Ca(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function _a(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Va(i,s)&&Ta(i,n,n.next,s)&&Fa(i,s)&&Fa(s,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(s.i/r),Oa(n),Oa(n.next),n=t=s),n=n.next}while(n!==t);return xa(n)}function ka(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Ba(a,o)){var l=La(a,o);return a=xa(a,a.next),l=xa(l,l.next),va(a,e,r,n,i,s),void va(l,e,r,n,i,s)}o=o.next}a=a.next}while(a!==t)}function Sa(t,e){return t.x-e.x}function za(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a){if(a=o,o===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Pa(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),Fa(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&Aa(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=La(r,t),i=xa(r,r.next);return xa(n,n.next),e===r?i:e}function Aa(t,e){return Ca(t.prev,t,e.prev)<0&&Ca(e.next,t,t.next)<0}function Ia(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ma(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Pa(t,e,r,n,i,s,a,o){return(i-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(n-o)-(r-a)*(e-o)>=0&&(r-a)*(s-o)-(i-a)*(n-o)>=0}function Ba(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ta(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Fa(t,e)&&Fa(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ca(t.prev,t,e.prev)||Ca(t,e.prev,e))||Va(t,e)&&Ca(t.prev,t,t.next)>0&&Ca(e.prev,e,e.next)>0)}function Ca(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Va(t,e){return t.x===e.x&&t.y===e.y}function Ta(t,e,r,n){var i=Da(Ca(t,e,r)),s=Da(Ca(t,e,n)),a=Da(Ca(r,n,t)),o=Da(Ca(r,n,e));return i!==s&&a!==o||!(0!==i||!Ea(t,r,e))||!(0!==s||!Ea(t,n,e))||!(0!==a||!Ea(r,t,n))||!(0!==o||!Ea(r,e,n))}function Ea(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Da(t){return t>0?1:t<0?-1:0}function Fa(t,e){return Ca(t.prev,t,t.next)<0?Ca(t,e,t.next)>=0&&Ca(t,t.prev,e)>=0:Ca(t,e,t.prev)<0||Ca(t,t.next,e)<0}function La(t,e){var r=new qa(t.i,t.x,t.y),n=new qa(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function $a(t,e,r,n){var i=new qa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Oa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function qa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ja(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}ya.exports=ma,ya.exports.default=ma,ma.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(ja(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(ja(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},ma.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r};var Ra=ya.exports;function Ua(t,e,r,n,i){Na(t,e,r||0,n||t.length-1,i||Ga)}function Na(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);Na(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Za(t,r,e),i(t[n],c)>0&&Za(t,r,n);h<p;){for(Za(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Za(t,r,p):Za(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Za(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Ga(t,e){return t<e?-1:t>e?1:0}function Xa(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=u(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Ua(n[t],e,1,n[t].length-1,Ya),n[t]=n[t].slice(0,e));return n}function Ya(t,e){return e.area-t.area}function Ja(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ka(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l}}}return r}class Wa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ni,this.indexArray=new ts,this.indexArray2=new es,this.programConfigurations=new Ms(t.layers,t.zoom),this.segments=new is,this.segments2=new is,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Ja("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ds(a,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Es(a),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ka("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,da),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,n,i){for(const t of Xa(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const a=Ra(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}ar("FillBucket",Wa,{omit:["layers","patternFeatures"]});const Ha=new ei({"fill-sort-key":new Wn(pr.layout_fill["fill-sort-key"])});var Qa={paint:new ei({"fill-antialias":new Kn(pr.paint_fill["fill-antialias"]),"fill-opacity":new Wn(pr.paint_fill["fill-opacity"]),"fill-color":new Wn(pr.paint_fill["fill-color"]),"fill-outline-color":new Wn(pr.paint_fill["fill-outline-color"]),"fill-translate":new Kn(pr.paint_fill["fill-translate"]),"fill-translate-anchor":new Kn(pr.paint_fill["fill-translate-anchor"]),"fill-pattern":new Hn(pr.paint_fill["fill-pattern"])}),layout:Ha};const to=oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:eo}=to;var ro={},no=ui,io=so;function so(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(ao,this,e)}function ao(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function oo(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}so.types=["Unknown","Point","LineString","Polygon"],so.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,s=0,a=0,o=[];t.pos<r;){if(i<=0){var l=t.readVarint();n=7&l,i=l>>3}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new no(s,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&o.push(e),o},so.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,o,u]},so.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=so.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var a=oo(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var lo=io,uo=co;function co(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ho,this,e),this.length=this._features.length}function ho(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}co.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new lo(this._pbf,e,this.extent,this._keys,this._values)};var po=uo;function fo(t,e,r){if(3===t){var n=new po(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}ro.VectorTile=function(t,e){this.layers=t.readFields(fo,{},e)},ro.VectorTileFeature=io,ro.VectorTileLayer=uo;const yo=ro.VectorTileFeature.types,mo=Math.pow(2,13);function go(t,e,r,n,i,s,a,o){t.emplaceBack(e,r,2*Math.floor(n*mo)+a,i*mo*2,s*mo*2,Math.round(o))}class xo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new ts,this.programConfigurations=new Ms(t.layers,t.zoom),this.segments=new is,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.features=[],this.hasPattern=Ja("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,o=Ds(n,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:a,index:s,geometry:t?o.geometry:Es(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Ka("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,r,{}),e.featureIndex.insert(n,l.geometry,s,a,this.index,!0)}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,eo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i){for(const r of Xa(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(bo(t))continue;let e=0;for(let r=0;r<t.length;r++){const i=t[r];if(r>=1){const s=t[r-1];if(!vo(i,s)){n.vertexLength+4>is.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(s)._perp()._unit(),r=s.dist(i);e+r>32768&&(e=0),go(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),go(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),e+=r,go(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),go(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e);const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>is.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==yo[t.type])continue;const i=[],s=[],a=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&s.push(i.length/2);for(let e=0;e<t.length;e++){const r=t[e];go(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),i.push(r.x),i.push(r.y)}}const o=Ra(i,s);for(let t=0;t<o.length;t+=3)this.indexArray.emplaceBack(a+o[t],a+o[t+2],a+o[t+1]);n.primitiveLength+=o.length/3,n.vertexLength+=e}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}function vo(t,e){return t.x===e.x&&(t.x<0||t.x>Cs)||t.y===e.y&&(t.y<0||t.y>Cs)}function bo(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Cs))||t.every((t=>t.y<0))||t.every((t=>t.y>Cs))}ar("FillExtrusionBucket",xo,{omit:["layers","features"]});var wo={paint:new ei({"fill-extrusion-opacity":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wn(pr["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Hn(pr["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wn(pr["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wn(pr["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function _o(t,e){return t.x*e.x+t.y*e.y}function ko(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=_o(o,o),h=_o(o,l),p=_o(l,l),f=_o(u,o),d=_o(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const So=oi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:zo}=So,Ao=oi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Io}=Ao,Mo=ro.VectorTileFeature.types,Po=Math.cos(Math.PI/180*37.5),Bo=Math.pow(2,14)/.5;class Co{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Gi,this.layoutVertexArray2=new Xi,this.indexArray=new ts,this.programConfigurations=new Ms(t.layers,t.zoom),this.segments=new is,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Ja("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ds(e,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Es(e),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ka("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Io)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const s=this.layers[0].layout,a=s.get("line-join").evaluate(t,{}),o=s.get("line-cap"),l=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===Mo[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(a?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,a&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(f=e===o-1?a?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<Po&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const k=p&&f;let S=k?r:a?"butt":n;if(k&&"round"===S&&(v<s?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>i&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<i&&(S="miter")),p&&this.updateDistance(p,h),"miter"===S)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===S){if(v>100)m=y.mult(-1);else{const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===S){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===S)this.addCurrentVertex(h,m,0,0,c);else if("square"===S){const t=p?1:-1;this.addCurrentVertex(h,m,t,t,c)}else"round"===S&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<o-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.distance>Bo/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,s))}addHalfVertex({x:t,y:e},r,n,i,s,a,o){const l=.5*(this.lineClips?this.scaledDistance*(Bo-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}ar("LineBucket",Co,{omit:["layers","patternFeatures"]});const Vo=new ei({"line-cap":new Kn(pr.layout_line["line-cap"]),"line-join":new Wn(pr.layout_line["line-join"]),"line-miter-limit":new Kn(pr.layout_line["line-miter-limit"]),"line-round-limit":new Kn(pr.layout_line["line-round-limit"]),"line-sort-key":new Wn(pr.layout_line["line-sort-key"])});var To={paint:new ei({"line-opacity":new Wn(pr.paint_line["line-opacity"]),"line-color":new Wn(pr.paint_line["line-color"]),"line-translate":new Kn(pr.paint_line["line-translate"]),"line-translate-anchor":new Kn(pr.paint_line["line-translate-anchor"]),"line-width":new Wn(pr.paint_line["line-width"]),"line-gap-width":new Wn(pr.paint_line["line-gap-width"]),"line-offset":new Wn(pr.paint_line["line-offset"]),"line-blur":new Wn(pr.paint_line["line-blur"]),"line-dasharray":new Qn(pr.paint_line["line-dasharray"]),"line-pattern":new Hn(pr.paint_line["line-pattern"]),"line-gradient":new ti(pr.paint_line["line-gradient"])}),layout:Vo};const Eo=new class extends Wn{possiblyEvaluate(t,e){return e=new jn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=n({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}}(To.paint.properties["line-width"].specification);function Do(t,e){return e>0?e+2*t:t}Eo.useIntegerZoom=!0;const Fo=oi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Lo=oi([{name:"a_projected_pos",components:3,type:"Float32"}],4);oi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $o=oi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);oi([{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 Oo=oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function qo(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),qn.applyArabicShaping&&(t=qn.applyArabicShaping(t)),t}(t.text,e,r)})),t}oi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),oi([{name:"triangle",components:3,type:"Uint16"}]),oi([{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"}]),oi([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),oi([{type:"Float32",name:"offsetX"}]),oi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const jo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ro=24,Uo=Go,No=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u}return(f?-1:1)*a*Math.pow(2,s-n)},Zo=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*y};function Go(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Go.Varint=0,Go.Fixed64=1,Go.Bytes=2,Go.Fixed32=5;var Xo,Yo=4294967296,Jo=1/Yo,Ko="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Wo(t){return t.type===Go.Bytes?t.readVarint()+t.pos:t.pos+1}function Ho(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qo(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function tl(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function el(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function rl(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function nl(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function il(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function sl(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function al(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ol(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function ll(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ul(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function cl(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function hl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function pl(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}Go.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ul(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ul(this.buf,this.pos)+ul(this.buf,this.pos+4)*Yo;return this.pos+=8,t},readSFixed64:function(){var t=ul(this.buf,this.pos)+hl(this.buf,this.pos+4)*Yo;return this.pos+=8,t},readFloat:function(){var t=No(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=No(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return Ho(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return Ho(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ko?function(t,e,r){return Ko.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Go.Bytes)return t.push(this.readVarint(e));var r=Wo(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Go.Bytes)return t.push(this.readSVarint());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Go.Bytes)return t.push(this.readBoolean());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Go.Bytes)return t.push(this.readFloat());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Go.Bytes)return t.push(this.readDouble());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Go.Bytes)return t.push(this.readFixed32());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Go.Bytes)return t.push(this.readSFixed32());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Go.Bytes)return t.push(this.readFixed64());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Go.Bytes)return t.push(this.readSFixed64());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Go.Varint)for(;this.buf[this.pos++]>127;);else if(e===Go.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Go.Fixed32)this.pos+=4;else{if(e!==Go.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Jo),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Jo),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Qo(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Zo(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Zo(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&Qo(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Go.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ll,e)},writeBytesField:function(t,e){this.writeTag(t,Go.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Go.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Go.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Go.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Go.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Go.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Go.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Go.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Go.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Go.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class fl{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class dl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=pl(i),o=new ha({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;ha.copy(n.data,o,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+1,a=i.y+1,l=r.data.width,u=r.data.height;ha.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),ha.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),ha.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),ha.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),ha.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new fl(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i})}}ar("ImagePosition",fl),ar("ImageAtlas",dl),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}(Xo||(Xo={}));const yl=-17;class ml{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new ml;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new ml;return e.imageName=t,e}}class gl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new gl;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let r=0;r<t.length;r++){const n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;e+=n&&En(n)&&!jo[t[r+1]]||i&&En(i)&&!jo[t[r-1]]||!jo[t[r]]?t[r]:jo[t[r]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&vl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&vl[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new gl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(ml.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void o("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(ml.forImage(e)),this.sectionIndex.push(this.sections.length-1)):o("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function xl(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y){const m=gl.fromFeature(t,i);let g;h===Xo.vertical&&m.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=qn;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Al(m,u,s,e,n,f,d));for(const e of t){const t=new gl;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(v){g=[];const t=v(m.text,m.sectionIndex,Al(m,u,s,e,n,f,d));for(const e of t){const t=new gl;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,Al(m,u,s,e,n,f,d));const b=[],w={positionedLines:b,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,s,a,o,l,u,c,h){let p=0,f=yl,d=0,y=0;const m="right"===o?1:"left"===o?0:.5;let g=0;for(const a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*Ro,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!a.length()){f+=s,++g;continue}for(let s=0;s<a.length();s++){const d=a.getSection(s),y=a.getSectionIndex(s),m=a.getCharCode(s);let g=0,v=null,_=null,k=null,S=Ro;const z=!(l===Xo.horizontal||!c&&!Tn(m)||c&&(vl[m]||(x=m,nn(x)||sn(x)||an(x)||Sn(x)||Mn(x))));if(d.imageName){const e=n[d.imageName];if(!e)continue;k=d.imageName,t.iconsInText=t.iconsInText||!0,_=e.paddedRect;const r=e.displaySize;d.scale=d.scale*Ro/h,v={width:r[0],height:r[1],left:1,top:-3,advance:z?r[1]:r[0]},g=o+(Ro-r[1]*d.scale),S=v.advance;const s=z?r[0]*d.scale-Ro*i:r[1]*d.scale-Ro*i;s>0&&s>w&&(w=s)}else{const t=r[d.fontStack],n=t&&t[m];if(n&&n.rect)_=n.rect,v=n.metrics;else{const t=e[d.fontStack],r=t&&t[m];if(!r)continue;v=r.metrics}g=(i-d.scale)*Ro}z?(t.verticalizable=!0,b.push({glyph:m,imageName:k,x:p,y:f+g,vertical:z,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=S*d.scale+u):(b.push({glyph:m,imageName:k,x:p,y:f+g,vertical:z,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=v.advance*d.scale+u)}0!==b.length&&(d=Math.max(p-u,d),Ml(b,0,b.length-1,m,w)),p=0;const _=s*i+w;v.lineOffset=Math.max(w,o),f+=_,y=Math.max(_,y),++g}var x;const v=f-yl,{horizontalAlign:b,verticalAlign:w}=Il(a);(function(t,e,r,n,i,s,a,o,l){const u=(e-r)*i;let c=0;c=s!==a?-o*n-yl:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(t.positionedLines,m,b,w,d,y,s,v,i.length),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*d,t.right=t.left+d}(w,e,r,n,g,a,o,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const vl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bl={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function wl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*Ro/s+i:0}{const n=r[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+i:0}}function _l(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function kl(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Sl(t,e,r,n,i,s){let a=null,o=_l(e,r,i,s);for(const t of n){const n=_l(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function zl(t){return t?zl(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,s,a){if("point"!==s)return[];if(!t)return[];const o=[],l=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=wl(t.getCharCode(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),u=t.text.indexOf("")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(vl[p]||(c+=wl(p,s,n,i,e,a)),r<t.length()-1){const e=!((h=p)<11904||!(dn(h)||fn(h)||An(h)||kn(h)||xn(h)||on(h)||yn(h)||cn(h)||vn(h)||bn(h)||gn(h)||Pn(h)||hn(h)||un(h)||ln(h)||mn(h)||pn(h)||zn(h)||_n(h)||wn(h)));(bl[p]||e||s.imageName)&&o.push(Sl(r+1,c,l,o,kl(p,t.getCharCode(r+1),e&&u),!1))}}var h;return zl(Sl(t.length(),c,l,o,0,!0))}function Il(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Ml(t,e,r,n,i){if(!n&&!i)return;const s=t[r],a=(t[r].x+s.metrics.advance*s.scale)*n;for(let n=e;n<=r;n++)t[n].x-=a,t[n].y+=i}function Pl(t,e,r){const{horizontalAlign:n,verticalAlign:i}=Il(r),s=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*i;return{image:t,top:a,bottom:a+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function Bl(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===r||"both"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-a.displaySize[0])/2,h=f+a.displaySize[0]);const d=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:f,collisionPadding:o}}const Cl=128;function Vl(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new jn(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:o,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:o,minSize:r.evaluate(new jn(a)),maxSize:r.evaluate(new jn(o)),interpolationType:n}}}class Tl extends ui{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n)}clone(){return new Tl(this.x,this.y,this.angle,this.segment)}}function El(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function Dl(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Fl(t,e,r){return t?.6*e*r:0}function Ll(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function $l(t,e,r,n,i,s){const a=Fl(r,i,s),o=Ll(r,n)*s;let l=0;const u=Dl(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=Vt(n.x,i.x,c),p=Vt(n.y,i.y,c),f=new Tl(h,p,i.angleTo(n),r);return f._round(),!a||El(t,f,o,a,e)?f:void 0}l+=s}}function Ol(t,e,r,n,i,s,a,o,l){const u=Fl(n,s,a),c=Ll(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),ql(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function ql(t,e,r,n,i,s,a,o,l){const u=s/2,c=Dl(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],d=a.dist(o),y=o.angleTo(a);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=Vt(a.x,o.x,m),x=Vt(a.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Tl(g,x,y,e);r._round(),n&&!El(t,r,s,n,i)||f.push(r)}}h+=d}return o||f.length||a||(f=ql(t,h/2,r,n,i,s,a,!0,l)),f}function jl(t,e,r,n){const i=[],s=t.image,a=s.pixelRatio,o=s.paddedRect.w-2,l=s.paddedRect.h-2,u=t.right-t.left,c=t.bottom-t.top,h=s.stretchX||[[0,o]],p=s.stretchY||[[0,l]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=o-d,g=l-y;let x=0,v=d,b=0,w=y,_=0,k=m,S=0,z=g;if(s.content&&n){const t=s.content;x=Rl(h,0,t[0]),b=Rl(p,0,t[1]),v=Rl(h,t[0],t[2]),w=Rl(p,t[1],t[3]),_=t[0]-x,S=t[1]-b,k=t[2]-t[0]-v,z=t[3]-t[1]-w}const A=(n,i,o,l)=>{const h=Nl(n.stretch-x,v,u,t.left),p=Zl(n.fixed-_,k,n.stretch,d),f=Nl(i.stretch-b,w,c,t.top),m=Zl(i.fixed-S,z,i.stretch,y),g=Nl(o.stretch-x,v,u,t.left),A=Zl(o.fixed-_,k,o.stretch,d),I=Nl(l.stretch-b,w,c,t.top),M=Zl(l.fixed-S,z,l.stretch,y),P=new ui(h,f),B=new ui(g,f),C=new ui(g,I),V=new ui(h,I),T=new ui(p/a,m/a),E=new ui(A/a,M/a),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),r=[e,-t,t,e];P._matMult(r),B._matMult(r),V._matMult(r),C._matMult(r)}const F=n.stretch+n.fixed,L=i.stretch+i.fixed;return{tl:P,tr:B,bl:V,br:C,tex:{x:s.paddedRect.x+1+F,y:s.paddedRect.y+1+L,w:o.stretch+o.fixed-F,h:l.stretch+l.fixed-L},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:T,pixelOffsetBR:E,minFontScaleX:k/a/u,minFontScaleY:z/a/c,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){const t=Ul(h,m,d),e=Ul(p,g,y);for(let r=0;r<t.length-1;r++){const n=t[r],s=t[r+1];for(let t=0;t<e.length-1;t++)i.push(A(n,e[t],s,e[t+1]))}}else i.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));return i}function Rl(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Ul(t,e,r){const n=[{fixed:-1,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+1,stretch:r}),n}function Nl(t,e,r,n){return t/e*r+n}function Zl(t,e,r,n){return t-e*r/n}ar("Anchor",Tl);class Gl{constructor(t,e,r,n,i,s,a,o,l,u){if(this.boxStartIndex=t.length,l){let t=s.top,e=s.bottom;const r=s.collisionPadding;r&&(t-=r[1],e+=r[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let l=s.top*a-o,c=s.bottom*a+o,h=s.left*a-o,p=s.right*a+o;const f=s.collisionPadding;if(f&&(h-=f[0]*a,l-=f[1]*a,p+=f[2]*a,c+=f[3]*a),u){const t=new ui(h,l),e=new ui(p,l),r=new ui(h,c),n=new ui(p,c),i=u*Math.PI/180;t._rotate(i),e._rotate(i),r._rotate(i),n._rotate(i),h=Math.min(t.x,e.x,r.x,n.x),p=Math.max(t.x,e.x,r.x,n.x),l=Math.min(t.y,e.y,r.y,n.y),c=Math.max(t.y,e.y,r.y,n.y)}t.emplaceBack(e.x,e.y,h,l,p,c,r,n,i)}this.boxEndIndex=t.length}}class Xl{constructor(t=[],e=Yl){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const a=n+1;if(a<this.length&&r(e[a],s)<0&&(n=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Yl(t,e){return t<e?-1:t>e?1:0}function Jl(t,e=1,r=!1){let n=1/0,i=1/0,s=-1/0,a=-1/0;const o=t[0];for(let t=0;t<o.length;t++){const e=o[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<i)&&(i=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>a)&&(a=e.y)}const l=Math.min(s-n,a-i);let u=l/2;const c=new Xl([],Kl);if(0===l)return new ui(n,i);for(let e=n;e<s;e+=l)for(let r=i;r<a;r+=l)c.push(new Wl(e+u,r+u,u,t));let h=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new Wl(r/e,n/e,0,t)}(t),p=c.length;for(;c.length;){const n=c.pop();(n.d>h.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new Wl(n.p.x-u,n.p.y-u,u,t)),c.push(new Wl(n.p.x+u,n.p.y-u,u,t)),c.push(new Wl(n.p.x-u,n.p.y+u,u,t)),c.push(new Wl(n.p.x+u,n.p.y+u,u,t)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function Kl(t,e){return e.max-t.max}function Wl(t,e,r,n){this.p=new ui(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Zs(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const Hl=Number.POSITIVE_INFINITY;function Ql(t,e,r,n,i,s,a){t.createArrays(),t.tilePixelRatio=Cs/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const l=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,c={layoutIconSize:u["icon-size"].possiblyEvaluate(new jn(t.zoom+1),a),layoutTextSize:u["text-size"].possiblyEvaluate(new jn(t.zoom+1),a),textMaxSize:u["text-size"].possiblyEvaluate(new jn(18))};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new jn(e),a),u["text-size"].possiblyEvaluate(new jn(r),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new jn(e),a),u["icon-size"].possiblyEvaluate(new jn(r),a)]}const h=l.get("text-line-height")*Ro,p="viewport"!==l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),f=l.get("text-keep-upright"),d=l.get("text-size");for(const s of t.features){const u=l.get("text-font").evaluate(s,{},a).join(","),g=d.evaluate(s,{},a),x=c.layoutTextSize.evaluate(s,{},a),v=c.layoutIconSize.evaluate(s,{},a),b={horizontal:{},vertical:void 0},w=s.text;let _,k=[0,0];if(w){const n=w.toString(),o=l.get("text-letter-spacing").evaluate(s,{},a)*Ro,c=Cn(n)?o:0,d=l.get("text-anchor").evaluate(s,{},a),v=l.get("text-variable-anchor");if(!v){const t=l.get("text-radial-offset").evaluate(s,{},a);t?(y=d,k=(m=[t*Ro,Hl])[1]!==Hl?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(y,m[0],m[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(y,m[0])):k=l.get("text-offset").evaluate(s,{},a).map((t=>t*Ro))}let _=p?"center":l.get("text-justify").evaluate(s,{},a);const S=l.get("symbol-placement"),z="point"===S?l.get("text-max-width").evaluate(s,{},a)*Ro:0,A=()=>{t.allowVerticalPlacement&&Bn(n)&&(b.vertical=xl(w,e,r,i,u,z,h,d,"left",c,k,Xo.vertical,!0,S,x,g))};if(!p&&v){const t="auto"===_?v.map((t=>tu(t))):[_];let n=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!b.horizontal[a])if(n)b.horizontal[a]=b.horizontal[0];else{const t=xl(w,e,r,i,u,z,h,"center",a,c,k,Xo.horizontal,!1,S,x,g);t&&(b.horizontal[a]=t,n=1===t.positionedLines.length)}}A()}else{"auto"===_&&(_=tu(d));const t=xl(w,e,r,i,u,z,h,d,_,c,k,Xo.horizontal,!1,S,x,g);t&&(b.horizontal[_]=t),A(),Bn(n)&&p&&f&&(b.vertical=xl(w,e,r,i,u,z,h,d,_,c,k,Xo.vertical,!1,S,x,g))}}let S=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(_=Pl(i[s.icon.name],l.get("icon-offset").evaluate(s,{},a),l.get("icon-anchor").evaluate(s,{},a)),S=!!e.sdf,void 0===t.sdfIcons?t.sdfIcons=S:t.sdfIcons!==S&&o("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}const z=iu(b.horizontal)||b.vertical;t.iconsInText=!!z&&z.iconsInText,(z||_)&&eu(t,s,b,_,n,c,x,v,k,S,a)}var y,m;s&&t.generateCollisionDebugBuffers()}function tu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eu(t,e,r,n,i,s,a,l,u,c,h){let p=s.textMaxSize.evaluate(e,{});void 0===p&&(p=a);const f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},h),y=iu(r.horizontal),m=a/24,g=t.tilePixelRatio*m,x=t.tilePixelRatio*p/24,v=t.tilePixelRatio*l,b=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,_=f.get("icon-padding")*t.tilePixelRatio,k=f.get("text-max-angle")/180*Math.PI,S="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),z="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),A=f.get("symbol-placement"),I=b/2,M=f.get("icon-text-fit");let P;n&&"none"!==M&&(t.allowVerticalPlacement&&r.vertical&&(P=Bl(n,r.vertical,M,f.get("icon-text-fit-padding"),d,m)),y&&(n=Bl(n,y,M,f.get("icon-text-fit-padding"),d,m)));const B=(l,p)=>{p.x<0||p.x>=Cs||p.y<0||p.y>=Cs||function(t,e,r,n,i,s,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z){const A=t.addToLineVertexArray(e,r);let I,M,P,B,C=0,V=0,T=0,E=0,D=-1,F=-1;const L={};let $=ps(""),O=0,q=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[O,q]=l.layout.get("text-offset").evaluate(w,{},S).map((t=>t*Ro)):(O=l.layout.get("text-radial-offset").evaluate(w,{},S)*Ro,q=Hl),t.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},S)+90;P=new Gl(u,e,c,h,p,n.vertical,f,d,y,t),a&&(B=new Gl(u,e,c,h,p,a,g,x,y,t))}if(i){const r=l.layout.get("icon-rotate").evaluate(w,{}),n="none"!==l.layout.get("icon-text-fit"),s=jl(i,r,k,n),f=a?jl(a,r,k,n):void 0;M=new Gl(u,e,c,h,p,i,g,x,!1,r),C=4*s.length;const d=t.iconSizeData;let y=null;"source"===d.kind?(y=[Cl*l.layout.get("icon-size").evaluate(w,{})],y[0]>ru&&o(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===d.kind&&(y=[Cl*_.compositeIconSizes[0].evaluate(w,{},S),Cl*_.compositeIconSizes[1].evaluate(w,{},S)],(y[0]>ru||y[1]>ru)&&o(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,y,b,v,w,Xo.none,e,A.lineStartIndex,A.lineLength,-1,S),D=t.icon.placedSymbolArray.length-1,f&&(V=4*f.length,t.addSymbols(t.icon,f,y,b,v,w,Xo.vertical,e,A.lineStartIndex,A.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const r of j){const i=n.horizontal[r];if(!I){$=ps(i.text);const t=l.layout.get("text-rotate").evaluate(w,{},S);I=new Gl(u,e,c,h,p,i,f,d,y,t)}const a=1===i.positionedLines.length;if(T+=nu(t,e,i,s,l,y,w,m,A,n.vertical?Xo.horizontal:Xo.horizontalOnly,a?j:[r],L,D,_,S),a)break}n.vertical&&(E+=nu(t,e,n.vertical,s,l,y,w,m,A,Xo.vertical,["vertical"],L,F,_,S));const R=I?I.boxStartIndex:t.collisionBoxArray.length,U=I?I.boxEndIndex:t.collisionBoxArray.length,N=P?P.boxStartIndex:t.collisionBoxArray.length,Z=P?P.boxEndIndex:t.collisionBoxArray.length,G=M?M.boxStartIndex:t.collisionBoxArray.length,X=M?M.boxEndIndex:t.collisionBoxArray.length,Y=B?B.boxStartIndex:t.collisionBoxArray.length,J=B?B.boxEndIndex:t.collisionBoxArray.length;let K=-1;const W=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;K=W(I,K),K=W(P,K),K=W(M,K),K=W(B,K);const H=K>-1?1:0;H&&(K*=z/Ro),t.glyphOffsetArray.length>=fu.MAX_GLYPHS&&o("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,w.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,L.right>=0?L.right:-1,L.center>=0?L.center:-1,L.left>=0?L.left:-1,L.vertical||-1,D,F,$,R,U,N,Z,G,X,Y,J,c,T,E,C,V,H,0,f,O,q,K)}(t,p,l,r,n,i,P,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,w,S,u,v,_,z,d,e,s,c,h,a)};if("line"===A)for(const i of function(t,e,r,n,i){const s=[];for(let e=0;e<t.length;e++){const r=t[e];let a;for(let t=0;t<r.length-1;t++){let e=r[t],o=r[t+1];e.x<0&&o.x<0||(e.x<0?e=new ui(0,e.y+(0-e.x)/(o.x-e.x)*(o.y-e.y))._round():o.x<0&&(o=new ui(0,e.y+(0-e.x)/(o.x-e.x)*(o.y-e.y))._round()),e.y<0&&o.y<0||(e.y<0?e=new ui(e.x+(0-e.y)/(o.y-e.y)*(o.x-e.x),0)._round():o.y<0&&(o=new ui(e.x+(0-e.y)/(o.y-e.y)*(o.x-e.x),0)._round()),e.x>=n&&o.x>=n||(e.x>=n?e=new ui(n,e.y+(n-e.x)/(o.x-e.x)*(o.y-e.y))._round():o.x>=n&&(o=new ui(n,e.y+(n-e.x)/(o.x-e.x)*(o.y-e.y))._round()),e.y>=i&&o.y>=i||(e.y>=i?e=new ui(e.x+(i-e.y)/(o.y-e.y)*(o.x-e.x),i)._round():o.y>=i&&(o=new ui(e.x+(i-e.y)/(o.y-e.y)*(o.x-e.x),i)._round()),a&&e.equals(a[a.length-1])||(a=[e],s.push(a)),a.push(o)))))}}return s}(e.geometry,0,0,Cs,Cs)){const e=Ol(i,b,k,r.vertical||y,n,24,x,t.overscaling,Cs);for(const r of e){const e=y;e&&su(t,e.text,I,r)||B(i,r)}}else if("line-center"===A){for(const t of e.geometry)if(t.length>1){const e=$l(t,k,r.vertical||y,n,24,x);e&&B(t,e)}}else if("Polygon"===e.type)for(const t of Xa(e.geometry,0)){const e=Jl(t,16);B(t[0],new Tl(e.x,e.y,0))}else if("LineString"===e.type)for(const t of e.geometry)B(t,new Tl(t[0].x,t[0].y,0));else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new Tl(e.x,e.y,0))}const ru=32640;function nu(t,e,r,n,i,s,a,l,u,c,h,p,f,d,y){const m=function(t,e,r,n,i,s,a,o){const l=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const s=n.rect||{};let c=4,h=!0,p=1,f=0;const d=(i||o)&&n.vertical,y=n.metrics.advance*n.scale/2;if(o&&e.verticalizable){const e=(n.scale-1)*Ro,r=(Ro-n.metrics.width*n.scale)/2;f=t.lineOffset/2-(n.imageName?-r:e)}if(n.imageName){const t=a[n.imageName];h=t.sdf,p=t.pixelRatio,c=1/p}const m=i?[n.x+y,n.y]:[0,0];let g=i?[0,0]:[n.x+y+r[0],n.y+r[1]-f],x=[0,0];d&&(x=g,g=[0,0]);const v=(n.metrics.left-c)*n.scale-y+g[0],b=(-n.metrics.top-c)*n.scale+g[1],w=v+s.w*n.scale/p,_=b+s.h*n.scale/p,k=new ui(v,b),S=new ui(w,b),z=new ui(v,_),A=new ui(w,_);if(d){const t=new ui(-y,y-yl),e=-Math.PI/2,r=12-y,i=new ui(22-r,-(n.imageName?r:0)),s=new ui(...x);k._rotateAround(e,t)._add(i)._add(s),S._rotateAround(e,t)._add(i)._add(s),z._rotateAround(e,t)._add(i)._add(s),A._rotateAround(e,t)._add(i)._add(s)}if(l){const t=Math.sin(l),e=Math.cos(l),r=[e,-t,t,e];k._matMult(r),S._matMult(r),z._matMult(r),A._matMult(r)}const I=new ui(0,0),M=new ui(0,0);u.push({tl:k,tr:S,bl:z,br:A,tex:s,writingMode:e.writingMode,glyphOffset:m,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:I,pixelOffsetBR:M,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,l,i,s,a,n,t.allowVerticalPlacement),g=t.textSizeData;let x=null;"source"===g.kind?(x=[Cl*i.layout.get("text-size").evaluate(a,{})],x[0]>ru&&o(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[Cl*d.compositeTextSizes[0].evaluate(a,{},y),Cl*d.compositeTextSizes[1].evaluate(a,{},y)],(x[0]>ru||x[1]>ru)&&o(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,l,s,a,c,e,u.lineStartIndex,u.lineLength,f,y);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function iu(t){for(const e in t)return t[e];return null}function su(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}const au=ro.VectorTileFeature.types,ou=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lu(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=o?Math.min(ru,Math.round(o[0])):0,d=o?Math.min(ru,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p)}function uu(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function cu(t){for(const e of t.sections)if(Ln(e.text))return!0;return!1}class hu{constructor(t){this.layoutVertexArray=new Ji,this.indexArray=new ts,this.programConfigurations=t,this.segments=new is,this.dynamicLayoutVertexArray=new Ki,this.opacityVertexArray=new Wi,this.placedSymbolArray=new Fi}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fo.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Lo.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,ou,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ar("SymbolBuffers",hu);class pu{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new is,this.collisionVertexArray=new Qi}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,$o.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ar("CollisionBuffers",pu);class fu{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ra([]),this.placementViewportMatrix=ra([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vl(this.zoom,e["text-size"]),this.iconSizeData=Vl(this.zoom,e["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==xu(r,"text-overlap","text-allow-overlap")||"never"!==xu(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>Xo[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new hu(new Ms(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new hu(new Ms(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Oi,this.lineVertexArray=new qi,this.symbolInstances=new $i}calculateGlyphDependencies(t,e,r,n,i){for(let s=0;s<t.length;s++)if(e[t.charCodeAt(s)]=!0,(r||n)&&i){const r=jo[t.charAt(s)];r&&(e[r.charCodeAt(0)]=!0)}}populate(t,e,r){const n=this.layers[0],i=n.layout,s=i.get("text-font"),a=i.get("text-field"),o=i.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof U&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],!l&&!u)return;const h=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new jn(this.zoom);for(const{feature:e,id:a,index:o,sourceLayerIndex:y}of t){const t=n._featureFilter.needGeometry,m=Ds(e,t);if(!n._featureFilter.filter(d,m,r))continue;let g,x;if(t||(m.geometry=Es(e)),l){const t=n.getValueAndResolveTokens("text-field",m,r,f),e=U.factory(t);cu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===$n||this.hasRTLText&&qn.isParsed())&&(g=qo(e,n,m))}if(u){const t=n.getValueAndResolveTokens("icon-image",m,r,f);x=t instanceof N?t:N.fromString(t)}if(!g&&!x)continue;const v=this.sortFeaturesByKey?c.evaluate(m,{},r):void 0;if(this.features.push({id:a,text:g,icon:x,index:o,sourceLayerIndex:y,geometry:m.geometry,properties:e.properties,type:au[e.type],sortKey:v}),x&&(h[x.name]=!0),g){const t=s.evaluate(m,{},r).join(","),e="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Xo.vertical)>=0;for(const r of g.sections)if(r.image)h[r.image.name]=!0;else{const n=Bn(g.toString()),i=r.fontStack||t,s=p[i]=p[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}"line"===i.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=o(f,d,h),i=a(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else f in r?a(f,d,h):d in e?o(f,d,h):(s(u),e[f]=i-1,r[d]=i-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h){const p=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,p,this.canOverlap?s.sortKey:void 0),y=this.glyphOffsetArray.length,m=d.vertexLength,g=this.allowVerticalPlacement&&a===Xo.vertical?Math.PI/2:0,x=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:l,br:u,tex:c,pixelOffsetTL:y,pixelOffsetBR:m,minFontScaleX:v,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:k}=e[n],S=d.vertexLength,z=w[1];lu(f,o.x,o.y,i.x,z+i.y,c.x,c.y,r,_,y.x,y.y,v,b),lu(f,o.x,o.y,a.x,z+a.y,c.x+c.w,c.y,r,_,m.x,y.y,v,b),lu(f,o.x,o.y,l.x,z+l.y,c.x,c.y+c.h,r,_,y.x,m.y,v,b),lu(f,o.x,o.y,u.x,z+u.y,c.x+c.w,c.y+c.h,r,_,m.x,m.y,v,b),uu(t.dynamicLayoutVertexArray,o,g),p.emplaceBack(S,S+1,S+2),p.emplaceBack(S+1,S+2,S+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),n!==e.length-1&&k===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{},h,x&&x[k])}t.placedSymbolArray.emplaceBack(o.x,o.y,y,this.glyphOffsetArray.length-y,m,l,u,o.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,c)}_addCollisionDebugVertex(t,e,r,n,i,s){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,r,n,i,s,a){const o=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=o.vertexLength,u=i.layoutVertexArray,c=i.collisionVertexArray,h=a.anchorX,p=a.anchorY;this._addCollisionDebugVertex(u,c,s,h,p,new ui(t,e)),this._addCollisionDebugVertex(u,c,s,h,p,new ui(r,e)),this._addCollisionDebugVertex(u,c,s,h,p,new ui(r,n)),this._addCollisionDebugVertex(u,c,s,h,p,new ui(t,n)),o.vertexLength+=4;const f=i.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,n){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new pu(Hi,Oo.members,es),this.iconCollisionBox=new pu(Hi,Oo.members,es);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,a,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=s;e<a;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let e=o;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.anchorX+r*a.anchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ar("SymbolBucket",fu,{omit:["layers","collisionBoxArray","features","compareText"]}),fu.MAX_GLYPHS=65535,fu.addDynamicAttributes=uu;const du=new ei({"symbol-placement":new Kn(pr.layout_symbol["symbol-placement"]),"symbol-spacing":new Kn(pr.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Kn(pr.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wn(pr.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Kn(pr.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Kn(pr.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Kn(pr.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Kn(pr.layout_symbol["icon-ignore-placement"]),"icon-optional":new Kn(pr.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Kn(pr.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wn(pr.layout_symbol["icon-size"]),"icon-text-fit":new Kn(pr.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Kn(pr.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wn(pr.layout_symbol["icon-image"]),"icon-rotate":new Wn(pr.layout_symbol["icon-rotate"]),"icon-padding":new Kn(pr.layout_symbol["icon-padding"]),"icon-keep-upright":new Kn(pr.layout_symbol["icon-keep-upright"]),"icon-offset":new Wn(pr.layout_symbol["icon-offset"]),"icon-anchor":new Wn(pr.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Kn(pr.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Kn(pr.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Kn(pr.layout_symbol["text-rotation-alignment"]),"text-field":new Wn(pr.layout_symbol["text-field"]),"text-font":new Wn(pr.layout_symbol["text-font"]),"text-size":new Wn(pr.layout_symbol["text-size"]),"text-max-width":new Wn(pr.layout_symbol["text-max-width"]),"text-line-height":new Kn(pr.layout_symbol["text-line-height"]),"text-letter-spacing":new Wn(pr.layout_symbol["text-letter-spacing"]),"text-justify":new Wn(pr.layout_symbol["text-justify"]),"text-radial-offset":new Wn(pr.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Kn(pr.layout_symbol["text-variable-anchor"]),"text-anchor":new Wn(pr.layout_symbol["text-anchor"]),"text-max-angle":new Kn(pr.layout_symbol["text-max-angle"]),"text-writing-mode":new Kn(pr.layout_symbol["text-writing-mode"]),"text-rotate":new Wn(pr.layout_symbol["text-rotate"]),"text-padding":new Kn(pr.layout_symbol["text-padding"]),"text-keep-upright":new Kn(pr.layout_symbol["text-keep-upright"]),"text-transform":new Wn(pr.layout_symbol["text-transform"]),"text-offset":new Wn(pr.layout_symbol["text-offset"]),"text-allow-overlap":new Kn(pr.layout_symbol["text-allow-overlap"]),"text-overlap":new Kn(pr.layout_symbol["text-overlap"]),"text-ignore-placement":new Kn(pr.layout_symbol["text-ignore-placement"]),"text-optional":new Kn(pr.layout_symbol["text-optional"])});var yu={paint:new ei({"icon-opacity":new Wn(pr.paint_symbol["icon-opacity"]),"icon-color":new Wn(pr.paint_symbol["icon-color"]),"icon-halo-color":new Wn(pr.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wn(pr.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wn(pr.paint_symbol["icon-halo-blur"]),"icon-translate":new Kn(pr.paint_symbol["icon-translate"]),"icon-translate-anchor":new Kn(pr.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wn(pr.paint_symbol["text-opacity"]),"text-color":new Wn(pr.paint_symbol["text-color"],{runtimeType:P,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Wn(pr.paint_symbol["text-halo-color"]),"text-halo-width":new Wn(pr.paint_symbol["text-halo-width"]),"text-halo-blur":new Wn(pr.paint_symbol["text-halo-blur"]),"text-translate":new Kn(pr.paint_symbol["text-translate"]),"text-translate-anchor":new Kn(pr.paint_symbol["text-translate-anchor"])}),layout:du};class mu{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:z,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ar("FormatSectionOverride",mu,{omit:["defaultValue"]});class gu extends ni{constructor(t){super(t,yu)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||$e(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new fu(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of yu.paint.overridableProperties){if(!gu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new mu(e),n=new Le(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new qe("source",n):new je("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new Yn(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&gu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=yu.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof U)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof J&&X(e.value)===T?s(e.value.sections):e instanceof Q?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}}function xu(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var vu={paint:new ei({"background-color":new Kn(pr.paint_background["background-color"]),"background-pattern":new Qn(pr.paint_background["background-pattern"]),"background-opacity":new Kn(pr.paint_background["background-opacity"])})},bu={paint:new ei({"raster-opacity":new Kn(pr.paint_raster["raster-opacity"]),"raster-hue-rotate":new Kn(pr.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Kn(pr.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Kn(pr.paint_raster["raster-brightness-max"]),"raster-saturation":new Kn(pr.paint_raster["raster-saturation"]),"raster-contrast":new Kn(pr.paint_raster["raster-contrast"]),"raster-resampling":new Kn(pr.paint_raster["raster-resampling"]),"raster-fade-duration":new Kn(pr.paint_raster["raster-fade-duration"])})};class wu extends ni{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}const _u={circle:class extends ni{constructor(t){super(t,ta)}createBucket(t){return new Ls(t)}queryRadius(t){const e=t;return Js("circle-radius",this,e)+Js("circle-stroke-width",this,e)+Ks(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Ws(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>ia(t,e)))}(l,o),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:ia(e,o);let r=p;const n=na([],[e.x,e.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=n[3]/s.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=s.cameraToCenterDistance/n[3]),Os(h,t,r))return!0}return!1}},heatmap:class extends ni{constructor(t){super(t,aa),this._updateColorRamp()}createBucket(t){return new sa(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=function(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new ha({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends ni{constructor(t){super(t,pa)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends ni{constructor(t){super(t,Qa)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Wa(t)}queryRadius(){return Ks(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){return qs(Ws(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,a),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ni{constructor(t){super(t,wo)}createBucket(t){return new xo(t)}queryRadius(){return Ks(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Ws(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,a),u=this.paint.get("fill-extrusion-height").evaluate(e,r),c=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e,r,n){const i=[];for(const r of t){const t=[r.x,r.y,0,1];na(t,t,e),i.push(new ui(t[0]/t[3],t[1]/t[3]))}return i}(l,o),p=function(t,e,r,n){const i=[],s=[],a=n[8]*e,o=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,h=n[9]*r,p=n[10]*r,f=n[11]*r;for(const e of t){const t=[],r=[];for(const i of e){const e=i.x,s=i.y,d=n[0]*e+n[4]*s+n[12],y=n[1]*e+n[5]*s+n[13],m=n[2]*e+n[6]*s+n[14],g=n[3]*e+n[7]*s+n[15],x=m+l,v=g+u,b=d+c,w=y+h,_=m+p,k=g+f,S=new ui((d+a)/v,(y+o)/v);S.z=x/v,t.push(S);const z=new ui(b/k,w/k);z.z=_/k,r.push(z)}i.push(t),s.push(r)}return[i,s]}(n,c,u,o);return function(t,e,r){let n=1/0;qs(r,e)&&(n=ko(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];$s(r,i)&&(n=Math.min(n,ko(r,i)))}}return n!==1/0&&n}(p[0],p[1],h)}},line:class extends ni{constructor(t){super(t,To),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ct,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Eo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Co(t)}queryRadius(t){const e=t,r=Do(Js("line-width",this,e),Js("line-gap-width",this,e)),n=Js("line-offset",this,e);return r/2+Math.abs(n)+Ks(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){const o=Ws(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,a),l=a/2*Do(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){const r=[],n=new ui(0,0);for(let i=0;i<t.length;i++){const s=t[i],a=[];for(let t=0;t<s.length;t++){const r=s[t-1],i=s[t],o=s[t+1],l=0===t?n:i.sub(r)._unit()._perp(),u=t===s.length-1?n:o.sub(i)._unit()._perp(),c=l._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),a.push(c._mult(e)._add(i))}r.push(a)}return r}(n,u*a)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Xs(t,i[e]))return!0;if(js(t,i,r))return!0}return!1}(o,n,l)}isTileClipped(){return!0}},symbol:gu,background:class extends ni{constructor(t){super(t,vu)}},raster:class extends ni{constructor(t){super(t,bu)}}};function ku(t){return"custom"===t.type?new wu(t):new _u[t.type](t)}var Su=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function zu(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${zu(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${zu(t[r[e]])},`;return`${n}}`}function Au(t){let e="";for(const r of Su)e+=`/${zu(t[r])}`;return e}class Iu{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,e){for(const e of t){this._layerConfigs[e.id]=e;const t=this._layers[e.id]=ku(e);t._featureFilter=zr(t.filter),this.keyCache[e.id]&&delete this.keyCache[e.id]}for(const t of e)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||Au(t[n]);e&&(e[t[n].id]=i);let s=r[i];s||(s=r[i]=[]),s.push(t[n])}const n=[];for(const t in r)n.push(r[t]);return n}(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||"_geojsonTileLayer";let a=i[s];a||(a=i[s]=[]),a.push(e)}}}class Mu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Pu{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Bu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new d(Cs,16,0),this.grid3D=new d(Cs,16,0),this.featureIndexArray=new Ri,this.promoteId=e}insert(t,e,r,n,i,s){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=s?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Cs&&n[1]<Cs&&n[2]>=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ro.VectorTile(new Uo(this.rawTileData)).layers,this.sourceLayerCoder=new Mu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},s=Cs/t.tileSize/t.scale,a=zr(i.filter),o=t.queryGeometry,l=t.queryPadding*s,u=Vu(o),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=Vu(t.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,((e,r,n,i)=>function(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return!0;const s=[new ui(e,r),new ui(e,i),new ui(n,i),new ui(n,r)];if(t.length>2)for(const e of s)if(Xs(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Ys(t[e],t[e+1],s))return!0;return!1}(t.cameraQueryGeometry,e-l,r-l,n+l,i+l)));for(const t of p)c.push(t);c.sort(Tu);const f={};let d;for(let l=0;l<c.length;l++){const u=c[l];if(u===d)continue;d=u;const h=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(f,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,i.layers,i.availableImages,e,r,n,((e,r,n)=>(p||(p=Es(e)),r.queryIntersectsFeature(o,e,n,p,this.z,t.transform,s,t.pixelPosMatrix))))}return f}loadMatchingFeature(t,e,r,i,s,a,o,l,u,c,h){const p=this.bucketLayerIDs[e];if(a&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(a,p))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(i);if(s.needGeometry){const t=Ds(d,!0);if(!s.filter(new jn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!s.filter(new jn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e<p.length;e++){const r=p[e];if(a&&a.indexOf(r)<0)continue;const s=l[r];if(!s)continue;let f={};y&&c&&(f=c.getState(s.sourceLayer||"_geojsonTileLayer",y));const m=n({},u[r]);m.paint=Cu(m.paint,s.paint,d,f,o),m.layout=Cu(m.layout,s.layout,d,f,o);const g=!h||h(d,s,f);if(!g)continue;const x=new Pu(d,this.z,this.x,this.y,y);x.layer=m;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:i,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=zr(i);for(const i of t)this.loadMatchingFeature(l,r,n,i,u,s,a,o,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r))),r}}function Cu(t,e,r,n,s){return i(t,((t,i)=>{const a=e instanceof Jn?e.get(i):null;return a&&a.evaluate?a.evaluate(r,n,s):a}))}function Vu(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return{minX:e,minY:r,maxX:n,maxY:i}}function Tu(t,e){return e-t}ar("FeatureIndex",Bu,{omit:["rawTileData","sourceLayerCoder"]});class Eu{constructor(t){const e={},r=[];for(const n in t){const i=t[n],s=e[n]={};for(const t in i){const e=i[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(n),s[t]={rect:n,metrics:e.metrics}}}const{w:n,h:i}=pl(r),s=new ca({width:n||1,height:i||1});for(const r in t){const n=t[r];for(const t in n){const i=n[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const a=e[r][t].rect;ca.copy(i.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},i.bitmap)}}this.image=s,this.positions=e}}function Du(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}ar("GlyphAtlas",Eu);class Fu{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof $u?new $u(t.lng,t.lat):$u.convert(t),this}setSouthWest(t){return this._sw=t instanceof $u?new $u(t.lng,t.lat):$u.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof $u)n=t,i=t;else{if(!(t instanceof Fu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Fu.convert(t)):this.extend($u.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new $u(n.lng,n.lat),this._ne=new $u(i.lng,i.lat)),this}getCenter(){return new $u((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 $u(this.getWest(),this.getNorth())}getSouthEast(){return new $u(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:e,lat:r}=$u.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof Fu?t:t?new Fu(t):t}}const Lu=6371008.8;class $u{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $u(function(t,e,r){const n=((t-e)%360+360)%360+e;return n===e?180:n}(this.lng,-180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Lu*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Fu(new $u(this.lng-r,this.lat-e),new $u(this.lng+r,this.lat+e))}static convert(t){if(t instanceof $u)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new $u(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new $u(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Ou=2*Math.PI*Lu;function qu(t){return Ou*Math.cos(t*Math.PI/180)}function ju(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Ru{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=$u.convert(t);return new Ru((180+r.lng)/360,(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r.lat*Math.PI/360)))/360,function(t,e){return t/qu(e)}(e,r.lat))}toLngLat(){return new $u(360*this.x-180,ju(this.y))}toAltitude(){return this.z*qu(ju(this.y))}meterInMercatorCoordinateUnits(){return 1/Ou*(t=ju(this.y),1/Math.cos(t*Math.PI/180));var t}}class Uu{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Gu(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(s=this.y,a=this.z,o=Du(256*(i=this.x),256*(s=Math.pow(2,a)-s-1),a),l=Du(256*(i+1),256*(s+1),a),o[0]+","+o[1]+","+l[0]+","+l[1]);var i,s,a,o,l;const u=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}getTilePoint(t){const e=Math.pow(2,this.z);return new ui((t.x*e-this.x)*Cs,(t.y*e-this.y)*Cs)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Nu{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Gu(t,e.z,e.z,e.x,e.y)}}class Zu{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Uu(r,+n,+i),this.key=Gu(e,t,r,n,i)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Zu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){const r=this.canonical.z-t;return t>this.canonical.z?Gu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Gu(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Zu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Zu(e,this.wrap,e,r,n),new Zu(e,this.wrap,e,r+1,n),new Zu(e,this.wrap,e,r,n+1),new Zu(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Zu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Zu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Nu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Ru(t.x-this.wrap,t.y))}}function Gu(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);const s=1<<r;return(s*s*t+s*i+n).toString(36)+r.toString(36)+e.toString(36)}ar("CanonicalTileID",Uu),ar("OverscaledTileID",Zu,{omit:["posMatrix"]});class Xu{constructor(t){this.tileID=new Zu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId}parse(t,e,r,n,s){this.status="parsing",this.data=t,this.collisionBoxArray=new Ei;const a=new Mu(Object.keys(t.layers).sort()),l=new Bu(this.tileID,this.promoteId);l.bucketLayerIDs=[];const u={},c={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},h=e.familiesBySource[this.source];for(const e in h){const n=t.layers[e];if(!n)continue;1===n.version&&o(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const i=a.encode(e),s=[];for(let t=0;t<n.length;t++){const r=n.feature(t),a=l.getId(r,e);s.push({feature:r,id:a,index:t,sourceLayerIndex:i})}for(const t of h[e]){const e=t[0];e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(Yu(t,this.zoom,r),(u[e.id]=e.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:i,sourceID:this.source})).populate(s,c,this.tileID.canonical),l.bucketLayerIDs.push(t.map((t=>t.id))))}}let p,f,d,y;const m=i(c.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(m).length?n.send("getGlyphs",{uid:this.uid,stacks:m},((t,e)=>{p||(p=t,f=e,v.call(this))})):f={};const g=Object.keys(c.iconDependencies);g.length?n.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{p||(p=t,d=e,v.call(this))})):d={};const x=Object.keys(c.patternDependencies);function v(){if(p)return s(p);if(f&&d&&y){const t=new Eu(f),e=new dl(d,y);for(const n in u){const i=u[n];i instanceof fu?(Yu(i.layers,this.zoom,r),Ql(i,f,t.positions,d,e.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):i.hasPattern&&(i instanceof Co||i instanceof Wa||i instanceof xo)&&(Yu(i.layers,this.zoom,r),i.addFeatures(c,this.tileID.canonical,e.patternPositions))}this.status="done",s(null,{buckets:Object.values(u).filter((t=>!t.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:e,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?t.positions:null})}}x.length?n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{p||(p=t,y=e,v.call(this))})):y={},v.call(this)}}function Yu(t,e,r){const n=new jn(e);for(const e of t)e.recalculate(n,r)}var Ju;!function(t){t.create="create",t.load="load",t.fullLoad="fullLoad"}(Ju||(Ju={}));class Ku{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}}function Wu(t,e){const r=function(t,e){return ir(n(t,{type:"arrayBuffer"}),e)}(t.request,((t,r,n,i)=>{t?e(t):r&&e(null,{vectorTile:new ro.VectorTile(new Uo(r)),rawData:r,cacheControl:n,expires:i})}));return()=>{r.cancel(),e()}}class Hu{constructor(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||Wu,this.loading={},this.loaded={}}loadTile(t,e){const r=t.uid;this.loading||(this.loading={});const i=!!(t&&t.request&&t.request.collectResourceTiming)&&new Ku(t.request),s=this.loading[r]=new Xu(t);s.abort=this.loadVectorData(t,((t,a)=>{if(delete this.loading[r],t||!a)return s.status="done",this.loaded[r]=s,e(t);const o=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);const u={};if(i){const t=i.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}s.vectorTile=a.vectorTile,s.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t);e(null,n({rawTileData:o.slice(0)},r,l,u))})),this.loaded=this.loaded||{},this.loaded[r]=s}))}reloadTile(t,e){const r=this.loaded,n=t.uid,i=this;if(r&&r[n]){const s=r[n];s.showCollisionBoxes=t.showCollisionBoxes;const a=(t,r)=>{const n=s.reloadCallback;n&&(delete s.reloadCallback,s.parse(s.vectorTile,i.layerIndex,this.availableImages,i.actor,n)),e(t,r)};"parsing"===s.status?s.reloadCallback=a:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()}}class Qu{constructor(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void o(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)]}get(t,e){const r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[n],r[n+1],r[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return(256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}getPixels(){return new ha({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+o,e+l)]}}ar("DEMData",Qu);class tc{constructor(){this.loaded={}}loadTile(t,e){const{uid:r,encoding:n,rawImageData:i}=t,s=f(i)?this.getImageData(i):i,a=new Qu(r,s,n);this.loaded=this.loaded||{},this.loaded[r]=a,e(null,a)}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const e=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new ha({width:e.width,height:e.height},e.data)}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}var ec=function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)rc(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)rc(e.coordinates[n],r);return e};function rc(t,e){if(0!==t.length){nc(t[0],e);for(var r=1;r<t.length;r++)nc(t[r],!e)}}function nc(t,e){for(var r=0,n=0,i=0,s=t.length,a=s-1;i<s;a=i++){var o=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+o;n+=Math.abs(r)>=Math.abs(o)?r-l+o:o-l+r,r=l}r+n>=0!=!!e&&t.reverse()}const ic=ro.VectorTileFeature.prototype.toGeoJSON;class sc{constructor(t){this._feature=t,this.extent=Cs,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const e of this._feature.geometry)t.push([new ui(e[0],e[1])]);return t}{const t=[];for(const e of this._feature.geometry){const r=[];for(const t of e)r.push(new ui(t[0],t[1]));t.push(r)}return t}}toGeoJSON(t,e,r){return ic.call(this,t,e,r)}}class ac{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=Cs,this.length=t.length,this._features=t}feature(t){return new sc(this._features[t])}}var oc={exports:{}},lc=ui,uc=ro.VectorTileFeature,cc=hc;function hc(t,e){this.options=e||{},this.features=t,this.length=t.length}function pc(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}hc.prototype.feature=function(t){return new pc(this.features[t],this.options.extent)},pc.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new lc(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},pc.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var a=t[s],o=0;o<a.length;o++){var l=a[o];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},pc.prototype.toGeoJSON=uc.prototype.toGeoJSON;var fc=Uo,dc=cc;function yc(t){var e=new fc;return function(t,e){for(var r in t.layers)e.writeMessage(3,mc,t.layers[r])}(t,e),e.finish()}function mc(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,gc,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var s=n.values;for(r=0;r<s.length;r++)e.writeMessage(4,_c,s[r])}function gc(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,xc,t),e.writeVarintField(3,r.type),e.writeMessage(4,wc,r)}function xc(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,a=t.valuecache;for(var o in r.properties){var l=r.properties[o],u=s[o];if(null!==l){void 0===u&&(n.push(o),s[o]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}}function vc(t,e){return(e<<3)+(7&t)}function bc(t){return t<<1^t>>31}function wc(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,a=r.length,o=0;o<a;o++){var l=r[o],u=1;1===n&&(u=l.length),e.writeVarint(vc(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(vc(2,c-1));var p=l[h].x-i,f=l[h].y-s;e.writeVarint(bc(p)),e.writeVarint(bc(f)),i+=p,s+=f}3===n&&e.writeVarint(vc(7,1))}}function _c(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}oc.exports=yc,oc.exports.fromVectorTileJs=yc,oc.exports.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new dc(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return yc({layers:r})},oc.exports.GeoJSONWrapper=dc;var kc=oc.exports;function Sc(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;zc(t,e,a,n,i,s%2),Sc(t,e,r,n,a-1,s+1),Sc(t,e,r,a+1,i,s+1)}function zc(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);zc(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(Ac(t,e,n,r),e[2*i+s]>a&&Ac(t,e,n,i);o<l;){for(Ac(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?Ac(t,e,n,l):(l++,Ac(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Ac(t,e,r,n){Ic(t,r,n),Ic(e,2*r,2*n),Ic(e,2*r+1,2*n+1)}function Ic(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Mc(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}const Pc=t=>t[0],Bc=t=>t[1];class Cc{constructor(t,e=Pc,r=Bc,n=64,i=Float64Array){this.nodeSize=n,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),o=this.coords=new i(2*t.length);for(let n=0;n<t.length;n++)a[n]=n,o[2*n]=e(t[n]),o[2*n+1]=r(t[n]);Sc(a,o,n,0,a.length-1,0)}range(t,e,r,n){return function(t,e,r,n,i,s,a){const o=[0,t.length-1,0],l=[];let u,c;for(;o.length;){const h=o.pop(),p=o.pop(),f=o.pop();if(p-f<=a){for(let a=f;a<=p;a++)u=e[2*a],c=e[2*a+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[a]);continue}const d=Math.floor((f+p)/2);u=e[2*d],c=e[2*d+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[d]);const y=(h+1)%2;(0===h?r<=u:n<=c)&&(o.push(f),o.push(d-1),o.push(y)),(0===h?i>=u:s>=c)&&(o.push(d+1),o.push(p),o.push(y))}return l}(this.ids,this.coords,t,e,r,n,this.nodeSize)}within(t,e,r){return function(t,e,r,n,i,s){const a=[0,t.length-1,0],o=[],l=i*i;for(;a.length;){const u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=s){for(let i=h;i<=c;i++)Mc(e[2*i],e[2*i+1],r,n)<=l&&o.push(t[i]);continue}const p=Math.floor((h+c)/2),f=e[2*p],d=e[2*p+1];Mc(f,d,r,n)<=l&&o.push(t[p]);const y=(u+1)%2;(0===u?r-i<=f:n-i<=d)&&(a.push(h),a.push(p-1),a.push(y)),(0===u?r+i>=f:n+i>=d)&&(a.push(p+1),a.push(c),a.push(y))}return o}(this.ids,this.coords,t,e,r,this.nodeSize)}}const Vc={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Tc=Math.fround||(Ec=new Float32Array(1),t=>(Ec[0]=+t,Ec[0]));var Ec;class Dc{constructor(t){this.options=Uc(Object.create(Vc),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:r,maxZoom:n,nodeSize:i}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;let a=[];for(let e=0;e<t.length;e++)t[e].geometry&&a.push(Lc(t[e],e));this.trees[n+1]=new Cc(a,Nc,Zc,i,Float32Array),e&&console.timeEnd(s);for(let t=n;t>=r;t--){const r=+Date.now();a=this._cluster(a,t),this.trees[t]=new Cc(a,Nc,Zc,i,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,a.length,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const t=this.getClusters([r,n,180,s],e),a=this.getClusters([-180,n,i,s],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],o=a.range(qc(r),jc(s),qc(i),jc(n)),l=[];for(const t of o){const e=a.points[t];l.push(e.numPoints?$c(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.points[e];if(!s)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),o=i.within(s.x,s.y,a),l=[];for(const e of o){const r=i.points[e];r.parentId===t&&l.push(r.numPoints?$c(r):this.points[r.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){const n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:a}=this.options,o=a/s,l=(r-o)/i,u=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,l,(e+1+o)/i,u),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,l,1,u),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,o/i,u),n.points,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?i+s.point_count<=n?i+=s.point_count:i=this._appendLeaves(t,s.cluster_id,r,n,i):i<n?i++:t.push(e),t.length===r)break}return i}_addTileFeatures(t,e,r,n,i,s){for(const a of t){const t=e[a],o=t.numPoints;let l,u,c;if(o)l=Oc(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=qc(e.geometry.coordinates[0]),c=jc(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;o?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const r=[],{radius:n,extent:i,reduce:s,minPoints:a}=this.options,o=n/(i*Math.pow(2,e));for(let n=0;n<t.length;n++){const i=t[n];if(i.zoom<=e)continue;i.zoom=e;const l=this.trees[e+1],u=l.within(i.x,i.y,o),c=i.numPoints||1;let h=c;for(const t of u){const r=l.points[t];r.zoom>e&&(h+=r.numPoints||1)}if(h>c&&h>=a){let t=i.x*c,a=i.y*c,o=s&&c>1?this._map(i,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const r of u){const n=l.points[r];if(n.zoom<=e)continue;n.zoom=e;const u=n.numPoints||1;t+=n.x*u,a+=n.y*u,n.parentId=p,s&&(o||(o=this._map(i,!0)),s(o,this._map(n)))}i.parentId=p,r.push(Fc(t/h,a/h,p,h,o))}else if(r.push(i),h>1)for(const t of u){const n=l.points[t];n.zoom<=e||(n.zoom=e,r.push(n))}}return r}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?Uc({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?Uc({},n):n}}function Fc(t,e,r,n,i){return{x:Tc(t),y:Tc(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function Lc(t,e){const[r,n]=t.geometry.coordinates;return{x:Tc(qc(r)),y:Tc(jc(n)),zoom:1/0,index:e,parentId:-1}}function $c(t){return{type:"Feature",id:t.id,properties:Oc(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),Rc(t.y)]}};var e}function Oc(t){const e=t.numPoints,r=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return Uc(Uc({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function qc(t){return t/360+.5}function jc(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Rc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Uc(t,e){for(const r in e)t[r]=e[r];return t}function Nc(t){return t.x}function Zc(t){return t.y}function Gc(t,e,r,n){for(var i,s=n,a=r-e>>1,o=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var f=Xc(t[p],t[p+1],l,u,c,h);if(f>s)i=p,s=f;else if(f===s){var d=Math.abs(p-a);d<o&&(i=p,o=d)}}s>n&&(i-e>3&&Gc(t,e,i,n),t[i+2]=s,r-i>3&&Gc(t,i,r,n))}function Xc(t,e,r,n,i,s){var a=i-r,o=s-n;if(0!==a||0!==o){var l=((t-r)*a+(e-n)*o)/(a*a+o*o);l>1?(r=i,n=s):l>0&&(r+=a*l,n+=o*l)}return(a=t-r)*a+(o=e-n)*o}function Yc(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Jc(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)Jc(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)Jc(t,e[n][i])}(i),i}function Jc(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Kc(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),o=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)Wc(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Wc(i[u],o);else if("LineString"===s)Hc(i,o,a,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)Hc(i[u],o=[],a,!1),t.push(Yc(l,"LineString",o,e.properties));return}Qc(i,o,a,!1)}else if("Polygon"===s)Qc(i,o,a,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)Kc(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Qc(i[u],c,a,!0),o.push(c)}}t.push(Yc(l,s,o,e.properties))}}function Wc(t,e){e.push(th(t[0])),e.push(eh(t[1])),e.push(0)}function Hc(t,e,r,n){for(var i,s,a=0,o=0;o<t.length;o++){var l=th(t[o][0]),u=eh(t[o][1]);e.push(l),e.push(u),e.push(0),o>0&&(a+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,Gc(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Qc(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];Hc(t[i],s,r,n),e.push(s)}}function th(t){return t/360+.5}function eh(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function rh(t,e,r,n,i,s,a,o){if(n/=e,s>=(r/=e)&&a<n)return t;if(a<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)l.push(c);else if(!(d<r||f>=n)){var y=[];if("Point"===p||"MultiPoint"===p)nh(h,y,r,n,i);else if("LineString"===p)ih(h,y,r,n,i,!1,o.lineMetrics);else if("MultiLineString"===p)ah(h,y,r,n,i,!1);else if("Polygon"===p)ah(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];ah(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(o.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(Yc(c.id,p,y[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===y.length?(p="LineString",y=y[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===y.length?"Point":"MultiPoint"),l.push(Yc(c.id,p,y,c.tags))}}}return l.length?l:null}function nh(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var a=t[s+i];a>=r&&a<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function ih(t,e,r,n,i,s,a){for(var o,l,u=sh(t),c=0===i?lh:uh,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;a&&(o=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(l=c(u,f,d,m,g,r),a&&(u.start=h+o*l)):x>n?v<n&&(l=c(u,f,d,m,g,n),a&&(u.start=h+o*l)):oh(u,f,d,y),v<r&&x>=r&&(l=c(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,f,d,m,g,n),b=!0),!s&&b&&(a&&(u.end=h+o*l),e.push(u),u=sh(t)),a&&(h+=o)}var w=t.length-3;f=t[w],d=t[w+1],y=t[w+2],(x=0===i?f:d)>=r&&x<=n&&oh(u,f,d,y),w=u.length-3,s&&w>=3&&(u[w]!==u[0]||u[w+1]!==u[1])&&oh(u,u[0],u[1],u[2]),u.length&&e.push(u)}function sh(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ah(t,e,r,n,i,s){for(var a=0;a<t.length;a++)ih(t[a],e,r,n,i,s,!1)}function oh(t,e,r,n){t.push(e),t.push(r),t.push(n)}function lh(t,e,r,n,i,s){var a=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*a),t.push(1),a}function uh(t,e,r,n,i,s){var a=(s-r)/(i-r);return t.push(e+(n-e)*a),t.push(s),t.push(1),a}function ch(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],a=s.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=hh(s.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var o=0;o<s.geometry.length;o++)i.push(hh(s.geometry[o],e))}else if("MultiPolygon"===a)for(i=[],o=0;o<s.geometry.length;o++){for(var l=[],u=0;u<s.geometry[o].length;u++)l.push(hh(s.geometry[o][u],e));i.push(l)}r.push(Yc(s.id,a,i,s.tags))}return r}function hh(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ph(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,a=t.x,o=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(fh(u[n],u[n+1],e,s,a,o));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(fh(u[n][i],u[n][i+1],e,s,a,o));l.geometry.push(h)}}return t.transformed=!0,t}function fh(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function dh(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<t.length;o++){a.numFeatures++,yh(a,t[o],s,i);var l=t[o].minX,u=t[o].minY,c=t[o].maxX,h=t[o].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function yh(t,e,r,n){var i=e.geometry,s=e.type,a=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<i.length;o+=3)a.push(i[o]),a.push(i[o+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)mh(a,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<i.length;o++)mh(a,i[o],t,r,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(o=0;o<u.length;o++)mh(a,u[o],t,r,!0,0===o)}if(a.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function mh(t,e,r,n,i,s){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var o=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(r.numSimplified++,o.push(e[l]),o.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],o=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=o}}(o,s),t.push(o)}}function gh(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)Kc(r,t.features[n],e,n);else Kc(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(t,e){var r=e.buffer/e.extent,n=t,i=rh(t,1,-1-r,r,0,-1,2,e),s=rh(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=rh(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=ch(i,1).concat(n)),s&&(n=n.concat(ch(s,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}function xh(t,e,r){return 32*((1<<t)*r+e)+t}function vh(t,e){const r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);const i=new ac(n.features);let s=kc(i);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),e(null,{vectorTile:i,rawData:s.buffer})}gh.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},gh.prototype.splitTile=function(t,e,r,n,i,s,a){for(var o=[t,e,r,n],l=this.options,u=l.debug;o.length;){n=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();var c=1<<e,h=xh(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=dh(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(s/d)||n!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var y,m,g,x,v,b,w=.5*l.buffer/l.extent,_=.5-w,k=.5+w,S=1+w;y=m=g=x=null,v=rh(t,c,r-w,r+k,0,p.minX,p.maxX,l),b=rh(t,c,r+_,r+S,0,p.minX,p.maxX,l),t=null,v&&(y=rh(v,c,n-w,n+k,1,p.minY,p.maxY,l),m=rh(v,c,n+_,n+S,1,p.minY,p.maxY,l),v=null),b&&(g=rh(b,c,n-w,n+k,1,p.minY,p.maxY,l),x=rh(b,c,n+_,n+S,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),o.push(y||[],e+1,2*r,2*n),o.push(m||[],e+1,2*r,2*n+1),o.push(g||[],e+1,2*r+1,2*n),o.push(x||[],e+1,2*r+1,2*n+1)}}},gh.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var a=1<<t,o=xh(t,e=(e%a+a)%a,r);if(this.tiles[o])return ph(this.tiles[o],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[xh(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[o]?ph(this.tiles[o],i):null):null};class bh extends Hu{constructor(t,e,r,n){super(t,e,r,vh),n&&(this.loadGeoJSON=n)}loadData(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const t=this._pendingCallback,e=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new Ku(e.request);this.loadGeoJSON(e,((n,i)=>{if(n||!i)return t(n);if("object"!=typeof i)return t(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{ec(i,!0);try{if(e.filter){const t=Oe(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=i.features.filter((e=>t.value.evaluate({zoom:0},e)));i={type:"FeatureCollection",features:r}}this._geoJSONIndex=e.cluster?new Dc(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(e);for(const t of a){const[i,s]=e[t],a=Oe(s),o=Oe("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=a.value,n[t]=o.value}return t.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of a)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(e)).load(i.features):function(t,e){return new gh(t,e)}(i,e.geojsonVtOptions)}catch(n){return t(n)}this.loaded={};const s={};if(r){const t=r.finish();t&&(s.resourceTiming={},s.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}t(null,s)}}))}coalesce(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())}reloadTile(t,e){const r=this.loaded;return r&&r[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(t,e){if(t.request)!function(t,e){ir(n(t,{type:"json"}),e)}(t.request,e);else{if("string"!=typeof t.data)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return e(null,JSON.parse(t.data))}catch(r){return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class wh{constructor(t){this.self=t,this.actor=new hr(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Hu,geojson:bh},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=t=>{if(qn.isParsed())throw new Error("RTL text plugin already registered.");qn.applyArabicShaping=t.applyArabicShaping,qn.processBidirectionalText=t.processBidirectionalText,qn.processStyledBidirectionalText=t.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,r){this.availableImages[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t].availableImages=e}r()}setLayers(t,e,r){this.getLayerIndex(t).replace(e),r()}updateLayers(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()}loadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)}loadDEMTile(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)}reloadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)}abortTile(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)}removeTile(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,r){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}loadWorkerSource(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}}syncRTLPluginState(t,e,r){try{qn.setState(e);const t=qn.getPluginURL();if(qn.isLoaded()&&!qn.isParsed()&&null!=t){this.self.importScripts(t);const e=qn.isParsed();r(e?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),e)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new Iu),e}getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const n={send:(e,r,n)=>{this.actor.send(e,r,n,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][r]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new tc),this.demWorkerSources[t][e]}enforceCacheSizeLimit(t,e){!function(t){Ye(),Ge&&Ge.then((e=>{e.keys().then((r=>{for(let n=0;n<r.length-t;n++)e.delete(r[n])}))}))}(e)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new wh(self)),wh}();
|
|
1
|
+
var maplibregl=function(){"use strict";var t=e;function e(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}function r(t,e,r){return Math.min(r,Math.max(e,t))}function n(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function i(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function s(t){return Array.isArray(t)?t.map(s):"object"==typeof t&&t?i(t,s):t}e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},new t(.25,.1,.25,1);const a={};function o(t){a[t]||("undefined"!=typeof console&&console.warn(t),a[t]=!0)}function l(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function u(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function c(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let h=null;function p(t){if(null==h){const e=t.navigator?t.navigator.userAgent:null;h=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return h}function f(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}class d{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],r=i[3+t+1];n.push(e===r?null:i.subarray(e,r))}const s=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],s),this.bboxes=i.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const i=r/e*t;this.min=-i,this.max=t+i}insert(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,n,i,s){this.cells[i].push(s)}query(t,e,r,n,i){const s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);{const s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s}}_queryCell(t,e,r,n,i,s,a,o){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===a[h]){const l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&r>=u[l+0]&&n>=u[l+1])?(a[h]=!0,s.push(i[h])):a[h]=!1}}}}_forEachCell(t,e,r,n,i,s,a,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,a,o))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const n=new Int32Array(e+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const r=t[e];n[3+e]=i,n.set(r,i),i+=r.length}return n[3+t.length]=i,n.set(this.keys,i),i+=this.keys.length,n[3+t.length+1]=i,n.set(this.bboxes,i),i+=this.bboxes.length,n.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new d(t.buffer)}}var y,m={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function g(t){return(t=Math.round(t))<0?0:t>255?255:t}function x(t){return g("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function v(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function b(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{y={}.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in m)return m[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=r.indexOf("("),i=r.indexOf(")");if(-1!==n&&i+1===r.length){var s=r.substr(0,n),a=r.substr(n+1,i-(n+1)).split(","),o=1;switch(s){case"rgba":if(4!==a.length)return null;o=v(a.pop());case"rgb":return 3!==a.length?null:[x(a[0]),x(a[1]),x(a[2]),o];case"hsla":if(4!==a.length)return null;o=v(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=v(a[1]),c=v(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return[g(255*b(p,h,l+1/3)),g(255*b(p,h,l)),g(255*b(p,h,l-1/3)),o];default:return null}}return null}}catch(t){}class w{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof w)return t;if("string"!=typeof t)return;const e=y(t);return e?new w(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}}function _(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}w.black=new w(0,0,0,1),w.white=new w(1,1,1,1),w.transparent=new w(0,0,0,0),w.red=new w(1,0,0,1);class k extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class S{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new S(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const z={kind:"null"},A={kind:"number"},I={kind:"string"},M={kind:"boolean"},P={kind:"color"},B={kind:"object"},C={kind:"value"},V={kind:"collator"},T={kind:"formatted"},E={kind:"resolvedImage"};function D(t,e){return{kind:"array",itemType:t,N:e}}function F(t){if("array"===t.kind){const e=F(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const L=[z,A,I,M,P,T,B,D(C),E];function $(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!$(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of L)if(!$(t,e))return null}return`Expected ${F(t)} but found ${F(e)} instead.`}function O(t,e){return e.some((e=>e.kind===t.kind))}function q(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class j{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class R{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class U{constructor(t){this.sections=t}static fromString(t){return new U([new R(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof U?t:U.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(r)}return t}}class N{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new N({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Z(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function G(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof w)return!0;if(t instanceof j)return!0;if(t instanceof U)return!0;if(t instanceof N)return!0;if(Array.isArray(t)){for(const e of t)if(!G(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!G(t[e]))return!1;return!0}return!1}function X(t){if(null===t)return z;if("string"==typeof t)return I;if("boolean"==typeof t)return M;if("number"==typeof t)return A;if(t instanceof w)return P;if(t instanceof j)return V;if(t instanceof U)return T;if(t instanceof N)return E;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=X(e);if(r){if(r===t)continue;r=C;break}r=t}return D(r||C,e)}return B}function Y(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof w||t instanceof U||t instanceof N?t.toString():JSON.stringify(t)}class J{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!G(t[1]))return e.error("invalid value");const r=t[1];let n=X(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new J(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof w?["rgba"].concat(this.value.toArray()):this.value instanceof U?this.value.serialize():this.value}}class K{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const W={string:I,number:A,boolean:M,object:B};class H{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in W)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=W[r],n++}else i=C;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=D(i,s)}else r=W[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,C);if(!r)return null;s.push(r)}return new H(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!$(this.type,X(r)))return r;if(e===this.args.length-1)throw new K(`Expected value to be of type ${F(this.type)}, but found ${F(X(r))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}class Q{constructor(t){this.type=T,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,A),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,D(I)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,P),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a}else{const s=e.parse(t[r],1,C);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Q(n)}evaluate(t){return new U(this.sections.map((e=>{const r=e.content.evaluate(t);return X(r)===E?new R("",r,null,null,null):new R(Y(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r)}return t}}class tt{constructor(t){this.type=E,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,I);return r?new tt(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=N.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const et={"to-boolean":M,"to-color":P,"to-number":A,"to-string":I};class rt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const n=et[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,C);if(!n)return null;i.push(n)}return new rt(n,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof w)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Z(e[0],e[1],e[2],e[3]),!r))return new w(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new K(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new K(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?U.fromString(Y(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?N.fromString(Y(this.args[0].evaluate(t))):Y(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Q([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tt(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const nt=["Unknown","Point","LineString","Polygon"];class it{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?"number"==typeof this.feature.type?nt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=w.parse(t)),e}}class st{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=st.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new Mt(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,s=o.parse(r,1+a.length,i);if(!s){l=!0;break}a.push(s)}if(!l)if(Array.isArray(n)&&n.length!==a.length)o.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=a[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new st(r,i,s,a)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(F).join(", ")})`:`(${F(e.type)}...)`;var e})).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(F(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){st.definitions=e;for(const r in e)t[r]=st}}class at{constructor(t,e,r){this.type=V,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,M);if(!n)return null;const i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,M);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,I),!s)?null:new at(n,i,s)}evaluate(t){return new j(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const ot=8192;function lt(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function ut(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ct(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*ot),Math.round(n*i*ot)]}function ht(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function pt(t,e){let r=!1;for(let a=0,o=e.length;a<o;a++){const o=e[a];for(let e=0,a=o.length;e<a-1;e++){if(ht(t,o[e],o[e+1]))return!1;(i=o[e])[1]>(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r)}}var n,i,s;return r}function ft(t,e){for(let r=0;r<e.length;r++)if(pt(t,e[r]))return!0;return!1}function dt(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function yt(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(a=u[r+1])[0]-(s=u[r])[0],a[1]-s[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&dt(n,i,s,a)&&dt(s,a,n,i))return!0;var n,i,s,a,o,l;return!1}function mt(t,e){for(let r=0;r<t.length;++r)if(!pt(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(yt(t[r],t[r+1],e))return!1;return!0}function gt(t,e){for(let r=0;r<e.length;r++)if(mt(t,e[r]))return!0;return!1}function xt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=ct(t[i][n],r);lt(e,a),s.push(a)}n.push(s)}return n}function vt(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=xt(t[i],e,r);n.push(s)}return n}function bt(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}lt(e,t)}function wt(t,e,r,n){const i=Math.pow(2,n.z)*ot,s=[n.x*ot,n.y*ot],a=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];bt(n,e,r,i),a.push(n)}return a}function _t(t,e,r,n){const i=Math.pow(2,n.z)*ot,s=[n.x*ot,n.y*ot],a=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];lt(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)bt(n,e,r,i)}var o;return a}class kt{constructor(t,e){this.type=M,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(G(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new kt(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new kt(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new kt(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=xt(e.coordinates,n,i),a=wt(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!pt(t,s))return!1}if("MultiPolygon"===e.type){const s=vt(e.coordinates,n,i),a=wt(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!ft(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=xt(e.coordinates,n,i),a=_t(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!mt(t,s))return!1}if("MultiPolygon"===e.type){const s=vt(e.coordinates,n,i),a=_t(t.geometry(),r,n,i);if(!ut(r,n))return!1;for(const t of a)if(!gt(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function St(t){if(t instanceof st){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof kt)return!1;let e=!0;return t.eachChild((t=>{e&&!St(t)&&(e=!1)})),e}function zt(t){if(t instanceof st&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!zt(t)&&(e=!1)})),e}function At(t,e){if(t instanceof st&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!At(t,e)&&(r=!1)})),r}class It{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new It(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Mt{constructor(t,e=[],r,n=new S,i=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return"assert"===r?new H(e,[t]):"coerce"===r?new rt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert")}if(!(n instanceof J)&&"resolvedImage"!==n.type.kind&&Pt(n)){const t=new it;try{n=new J(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Mt(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new k(r,t))}checkSubtype(t,e){const r=$(t,e);return r&&this.error(r),r}}function Pt(t){if(t instanceof It)return Pt(t.boundExpression);if(t instanceof st&&"error"===t.name)return!1;if(t instanceof at)return!1;if(t instanceof kt)return!1;const e=t instanceof rt||t instanceof H;let r=!0;return t.eachChild((t=>{r=e?r&&Pt(t):r&&t instanceof J})),!!r&&St(t)&&At(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Bt(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new K("Input is not a number.");a=o-1}return 0}class Ct{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,A);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new Ct(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Bt(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function Vt(t,e,r){return t*(1-r)+e*r}var Tt=Object.freeze({__proto__:null,number:Vt,color:function(t,e,r){return new w(Vt(t.r,e.r,r),Vt(t.g,e.g,r),Vt(t.b,e.b,r),Vt(t.a,e.a,r))},array:function(t,e,r){return t.map(((t,n)=>Vt(t,e[n],r)))}});const Et=.95047,Dt=1.08883,Ft=4/29,Lt=6/29,$t=3*Lt*Lt,Ot=Math.PI/180,qt=180/Math.PI;function jt(t){return t>.008856451679035631?Math.pow(t,1/3):t/$t+Ft}function Rt(t){return t>Lt?t*t*t:$t*(t-Ft)}function Ut(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Nt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Zt(t){const e=Nt(t.r),r=Nt(t.g),n=Nt(t.b),i=jt((.4124564*e+.3575761*r+.1804375*n)/Et),s=jt((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-jt((.0193339*e+.119192*r+.9503041*n)/Dt)),alpha:t.a}}function Gt(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Rt(e),r=Et*Rt(r),n=Dt*Rt(n),new w(Ut(3.2404542*r-1.5371385*e-.4985314*n),Ut(-.969266*r+1.8760108*e+.041556*n),Ut(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Xt(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Yt={forward:Zt,reverse:Gt,interpolate:function(t,e,r){return{l:Vt(t.l,e.l,r),a:Vt(t.a,e.a,r),b:Vt(t.b,e.b,r),alpha:Vt(t.alpha,e.alpha,r)}}},Jt={forward:function(t){const{l:e,a:r,b:n}=Zt(t),i=Math.atan2(n,r)*qt;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ot,r=t.c;return Gt({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:Xt(t.h,e.h,r),c:Vt(t.c,e.c,r),l:Vt(t.l,e.l,r),alpha:Vt(t.alpha,e.alpha,r)}}};var Kt=Object.freeze({__proto__:null,lab:Yt,hcl:Jt});class Wt{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(e,r,n,i){let s=0;if("exponential"===e.name)s=Ht(r,e.base,n,i);else if("linear"===e.name)s=Ht(r,1,n,i);else if("cubic-bezier"===e.name){const a=e.controlPoints;s=new t(a[0],a[1],a[2],a[3]).solve(Ht(r,1,n,i))}return s}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,A),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=P:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return"number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Wt(o,r,n,i,a):e.error(`Type ${F(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Bt(e,n),a=Wt.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?Tt[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?Jt.reverse(Jt.interpolate(Jt.forward(o),Jt.forward(l),a)):Yt.reverse(Yt.interpolate(Yt.forward(o),Yt.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function Ht(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class Qt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}const s=n&&i.some((t=>$(n,t.type)));return new Qt(s?C:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof N&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class te{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new te(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,r]of this.bindings)t.push(e,r.serialize());return t.push(this.result.serialize()),t}}class ee{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,A),n=e.parse(t[2],2,D(e.expectedType||C));return r&&n?new ee(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new K(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new K(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new K(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class re{constructor(t,e){this.type=M,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,C),n=e.parse(t[2],2,C);return r&&n?O(r.type,[M,I,A,z,C])?new re(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!q(e,["boolean","string","number","null"]))throw new K(`Expected first argument to be of type boolean, string, number or null, but found ${F(X(e))} instead.`);if(!q(r,["string","array"]))throw new K(`Expected second argument to be of type array or string, but found ${F(X(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ne{constructor(t,e,r){this.type=A,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,C),n=e.parse(t[2],2,C);if(!r||!n)return null;if(!O(r.type,[M,I,A,z,C]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,A);return i?new ne(r,n,i):null}return new ne(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!q(e,["boolean","string","number","null"]))throw new K(`Expected first argument to be of type boolean, string, number or null, but found ${F(X(e))} instead.`);if(!q(r,["string","array"]))throw new K(`Expected second argument to be of type array or string, but found ${F(X(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ie{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,X(t)))return null}else r=X(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,C);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new ie(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(X(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class se{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,M);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new se(r,n,i):null}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class ae{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,C),n=e.parse(t[2],2,A);if(!r||!n)return null;if(!O(r.type,[D(C),I,C]))return e.error(`Expected first argument to be of type array or string, but found ${F(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,A);return i?new ae(r.type,r,n,i):null}return new ae(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!q(e,["string","array"]))throw new K(`Expected first argument to be of type array or string, but found ${F(X(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function oe(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function le(t,e,r,n){return 0===n.compare(e,r)}function ue(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=M,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,C);if(!s)return null;if(!oe(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${F(s.type)}'.`);let a=e.parse(t[2],2,C);if(!a)return null;if(!oe(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${F(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${F(s.type)}' and '${F(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new H(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new H(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,V),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=X(s),r=X(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new K(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=X(s),r=X(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const ce=ue("==",(function(t,e,r){return e===r}),le),he=ue("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!le(0,e,r,n)})),pe=ue("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),fe=ue(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),de=ue("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),ye=ue(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class me{constructor(t,e,r,n,i){this.type=I,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,A);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,I),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,I),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,A),!a))return null;let o=null;return n["max-fraction-digits"]&&(o=e.parse(n["max-fraction-digits"],1,A),!o)?null:new me(r,i,s,a,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class ge{constructor(t){this.type=A,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${F(r.type)} instead.`):new ge(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new K(`Expected value to be of type string or array, but found ${F(X(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const xe={"==":ce,"!=":he,">":fe,"<":pe,">=":ye,"<=":de,array:H,at:ee,boolean:H,case:se,coalesce:Qt,collator:at,format:Q,image:tt,in:re,"index-of":ne,interpolate:Wt,"interpolate-hcl":Wt,"interpolate-lab":Wt,length:ge,let:te,literal:J,match:ie,number:H,"number-format":me,object:H,slice:ae,step:Ct,string:H,"to-boolean":rt,"to-color":rt,"to-number":rt,"to-string":rt,var:It,within:kt};function ve(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=Z(e,r,n,s);if(a)throw new K(a);return new w(e/255*s,r/255*s,n/255*s,s)}function be(t,e){return t in e}function we(t,e){const r=e[t];return void 0===r?null:r}function _e(t){return{type:t}}function ke(t){return{result:"success",value:t}}function Se(t){return{result:"error",value:t}}function ze(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ae(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ie(t){return!!t.expression&&t.expression.interpolated}function Me(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Pe(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Be(t){return t}function Ce(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ie(e)?"exponential":"interval");if(r&&((t=_({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],w.parse(t[1])]))),t.default=w.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Kt[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=De;else if("interval"===s)a=Ee;else if("categorical"===s){a=Te,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Fe}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Ce(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Wt.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>De({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:Wt.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Ve(t.default,e.default):a(t,e,i,o,l)}}}function Ve(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Te(t,e,r,n,i){return Ve(typeof r===i?n[r]:void 0,t.default,e.default)}function Ee(t,e,r){if("number"!==Me(r))return Ve(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Bt(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function De(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Me(r))return Ve(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Bt(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=Tt[e.type]||Be;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Kt[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a))}return"function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function Fe(t,e,r){return"color"===e.type?r=w.parse(r):"formatted"===e.type?r=U.fromString(r.toString()):"resolvedImage"===e.type?r=N.fromString(r.toString()):Me(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ve(r,t.default,e.default)}st.register(xe,{error:[{kind:"error"},[I],(t,[e])=>{throw new K(e.evaluate(t))}],typeof:[I,[C],(t,[e])=>F(X(e.evaluate(t)))],"to-rgba":[D(A,4),[P],(t,[e])=>e.evaluate(t).toArray()],rgb:[P,[A,A,A],ve],rgba:[P,[A,A,A,A],ve],has:{type:M,overloads:[[[I],(t,[e])=>be(e.evaluate(t),t.properties())],[[I,B],(t,[e,r])=>be(e.evaluate(t),r.evaluate(t))]]},get:{type:C,overloads:[[[I],(t,[e])=>we(e.evaluate(t),t.properties())],[[I,B],(t,[e,r])=>we(e.evaluate(t),r.evaluate(t))]]},"feature-state":[C,[I],(t,[e])=>we(e.evaluate(t),t.featureState||{})],properties:[B,[],t=>t.properties()],"geometry-type":[I,[],t=>t.geometryType()],id:[C,[],t=>t.id()],zoom:[A,[],t=>t.globals.zoom],"heatmap-density":[A,[],t=>t.globals.heatmapDensity||0],"line-progress":[A,[],t=>t.globals.lineProgress||0],accumulated:[C,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[A,_e(A),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[A,_e(A),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:A,overloads:[[[A,A],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[A],(t,[e])=>-e.evaluate(t)]]},"/":[A,[A,A],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[A,[A,A],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[A,[],()=>Math.LN2],pi:[A,[],()=>Math.PI],e:[A,[],()=>Math.E],"^":[A,[A,A],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[A,[A],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[A,[A],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[A,[A],(t,[e])=>Math.log(e.evaluate(t))],log2:[A,[A],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[A,[A],(t,[e])=>Math.sin(e.evaluate(t))],cos:[A,[A],(t,[e])=>Math.cos(e.evaluate(t))],tan:[A,[A],(t,[e])=>Math.tan(e.evaluate(t))],asin:[A,[A],(t,[e])=>Math.asin(e.evaluate(t))],acos:[A,[A],(t,[e])=>Math.acos(e.evaluate(t))],atan:[A,[A],(t,[e])=>Math.atan(e.evaluate(t))],min:[A,_e(A),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[A,_e(A),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[A,[A],(t,[e])=>Math.abs(e.evaluate(t))],round:[A,[A],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[A,[A],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[A,[A],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[M,[I,C],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[M,[C],(t,[e])=>t.id()===e.value],"filter-type-==":[M,[I],(t,[e])=>t.geometryType()===e.value],"filter-<":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[M,[I,C],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[M,[C],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[M,[C],(t,[e])=>e.value in t.properties()],"filter-has-id":[M,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[M,[D(I)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[M,[D(C)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[M,[I,D(C)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[M,[I,D(C)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:M,overloads:[[[M,M],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[_e(M),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:M,overloads:[[[M,M],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[_e(M),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[M,[M],(t,[e])=>!e.evaluate(t)],"is-supported-script":[M,[I],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[I,[I],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[I,[I],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[I,_e(C),(t,e)=>e.map((e=>Y(e.evaluate(t)))).join("")],"resolved-locale":[I,[V],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Le{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new it,this._defaultValue=e?function(t){return"color"===t.type&&Pe(t.default)?new w(0,0,0,0):"color"===t.type?w.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new K(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function $e(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xe}function Oe(t,e){const r=new Mt(xe,[],e?function(t){const e={color:P,string:I,number:A,enum:I,boolean:M,formatted:T,resolvedImage:E};return"array"===t.type?D(e[t.value]||C,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?ke(new Le(n,e)):Se(r.errors)}class qe{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!zt(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class je{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!zt(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?Wt.interpolationFactor(this.interpolationType,t,e,r):0}}function Re(t,e){const r=Oe(t,e);if("error"===r.result)return r;const n=r.value.expression,i=St(n);if(!i&&!ze(e))return Se([new k("","data expressions not supported")]);const s=At(n,["zoom"]);if(!s&&!Ae(e))return Se([new k("","zoom expressions not supported")]);const a=Ne(n);return a||s?a instanceof k?Se([a]):a instanceof Wt&&!Ie(e)?Se([new k("",'"interpolate" expressions cannot be used with this property')]):ke(a?new je(i?"camera":"composite",r.value,a.labels,a instanceof Wt?a.interpolation:void 0):new qe(i?"constant":"source",r.value)):Se([new k("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ue{constructor(t,e){this._parameters=t,this._specification=e,_(this,Ce(this._parameters,this._specification))}static deserialize(t){return new Ue(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ne(t){let e=null;if(t instanceof te)e=Ne(t.result);else if(t instanceof Qt){for(const r of t.args)if(e=Ne(r),e)break}else(t instanceof Ct||t instanceof Wt)&&t.input instanceof st&&"zoom"===t.input.name&&(e=t);return e instanceof k||t.eachChild((t=>{const r=Ne(t);r instanceof k?e=r:!e&&r?e=new k("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new k("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}const Ze={};let Ge,Xe;function Ye(){"undefined"==typeof caches||Ge||(Ge=caches.open("mapbox-tiles"))}const Je={supported:!1,testSupport:function(t){!He&&We&&(Qe?tr(t):Ke=t)}};let Ke,We,He=!1,Qe=!1;function tr(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,We),t.isContextLost())return;Je.supported=!0}catch(t){}t.deleteTexture(e),He=!0}"undefined"!=typeof document&&(We=document.createElement("img"),We.onload=function(){Ke&&tr(Ke),Ke=null,Qe=!0},We.onerror=function(){He=!0,Ke=null},We.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),"function"==typeof Object.freeze&&Object.freeze({Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"});class er extends Error{constructor(t,e,r,n){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=n}}const rr=c()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function nr(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:rr(),signal:r.signal});let i=!1,s=!1;"json"===t.type&&n.headers.set("Accept","application/json");return((r,a,l)=>{if(s)return;const u=Date.now();fetch(n).then((r=>r.ok?((r,a,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(a&&l&&function(t,e,r){if(Ye(),!Ge)return;const n={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const i=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===Xe)try{new Response(new ReadableStream),Xe=!0}catch(t){Xe=!1}Xe?e(t.body):t.blob().then(e)}(e,(e=>{const r=new Response(e,n);Ye(),Ge&&Ge.then((e=>e.put(function(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}(t.url),r))).catch((t=>o(t.message)))})))}(n,a,l),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{s||e(new Error(t.message))}))})(r,null,u):r.blob().then((n=>e(new er(r.status,r.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))}))})(),{cancel:()=>{s=!0,i||r.abort()}}}const ir=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(c()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!c()){const r=t.url.substring(0,t.url.indexOf("://"));return(Ze[r]||nr)(t,e)}}if(!(/^file:/.test(r=t.url)||/^file:/.test(rr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return nr(t,e);if(c()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{const n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new er(r.status,r.statusText,t.url,n))}},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},sr={};function ar(t,e,r={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),sr[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}ar("Object",Object),ar("TransferableGridIndex",d),ar("Color",w),ar("Error",Error),ar("AJAXError",er),ar("ResolvedImage",N),ar("StylePropertyFunction",Ue),ar("StyleExpression",Le,{omit:["_evaluator"]}),ar("ZoomDependentExpression",je),ar("ZoomConstantExpression",qe),ar("CompoundExpression",st,{omit:["_evaluate"]});for(const t in xe)xe[t]._classRegistryKey||ar(`Expression_${t}`,xe[t]);function or(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function lr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(or(t))return e&&e.push(t),t;if(f(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(lr(n,e));return r}if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t){if(!t.hasOwnProperty(r))continue;if(sr[n].omit.indexOf(r)>=0)continue;const s=t[r];i[r]=sr[n].shallow.indexOf(r)>=0?s:lr(s,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function ur(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||or(t)||f(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(ur);if("object"==typeof t){const e=t.$name||"Object";if(!sr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=sr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=sr[e].shallow.indexOf(r)>=0?i:ur(i)}return n}throw new Error("can't deserialize object of type "+typeof t)}class cr{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}class hr{constructor(t,e,r){var n;this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},n=this,["receive","process"].forEach((t=>{n[t]&&(n[t]=n[t].bind(n))})),this.invoker=new cr(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=c()?t:window}send(t,e,r,n,i=!1){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[s]=r);const a=p(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:lr(e,a)},a),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t()}else c()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if("<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(ur(e.error)):r(null,ur(e.data)))}else{let r=!1;const n=p(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?lr(e):null,data:lr(i,n)},n)}:t=>{r=!0};let s=null;const a=ur(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,a,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,i)}else i(new Error(`Could not find function ${e.type}`));!r&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}}var pr={$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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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-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":{},within:{}}},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}},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"}}};class fr{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function dr(t){const e=t.value;return e?[new fr(t.key,e,"constants have been deprecated as of v8")]:[]}function yr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function mr(t){if(Array.isArray(t))return t.map(mr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=mr(t[r]);return e}return yr(t)}function gr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let o=[];const l=Me(r);if("object"!==l)return[new fr(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(i[l])c=i[l];else if(n[l])c=Nr;else if(i["*"])c=i["*"];else{if(!n["*"]){o.push(new fr(e,r[t],`unknown property "${t}"`));continue}c=Nr}o=o.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:a,object:r,objectKey:t},r))}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&o.push(new fr(e,r,`missing required property "${t}"`));return o}function xr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||Nr;if("array"!==Me(e))return[new fr(s,e,`array expected, ${Me(e)} found`)];if(r.length&&e.length!==r.length)return[new fr(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new fr(s,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values};i.$version<7&&(o.function=r.function),"object"===Me(r.value)&&(o=r.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(a({array:e,arrayIndex:t,value:e[t],valueSpec:o,style:n,styleSpec:i,key:`${s}[${t}]`}));return l}function vr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=Me(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new fr(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new fr(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new fr(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function br(t){const e=t.valueSpec,r=yr(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Me(t.value.stops)&&"array"===Me(t.value.stops[0])&&"object"===Me(t.value.stops[0][0]),c=gr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new fr(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(xr({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Me(n)&&0===n.length&&e.push(new fr(t.key,n,"array must have at least one stop")),e},default:function(t){return Nr({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&o&&c.push(new fr(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new fr(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Ie(t.valueSpec)&&c.push(new fr(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ze(t.valueSpec)?c.push(new fr(t.key,t.value,"property functions not supported")):o&&!Ae(t.valueSpec)&&c.push(new fr(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new fr(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Me(n))return[new fr(o,n,`array expected, ${Me(n)} found`)];if(2!==n.length)return[new fr(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Me(n[0]))return[new fr(o,n,`object expected, ${Me(n[0])} found`)];if(void 0===n[0].zoom)return[new fr(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new fr(o,n,"object stop key must have value")];if(s&&s>yr(n[0].zoom))return[new fr(o,n[0].zoom,"stop zoom values must appear in ascending order")];yr(n[0].zoom)!==s&&(s=yr(n[0].zoom),i=void 0,a={}),r=r.concat(gr({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:vr,value:p}}))}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return $e(mr(n[1]))?r.concat([new fr(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(Nr({key:`${o}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=Me(t.value),l=yr(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return[new fr(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new fr(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return ze(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new fr(t.key,u,n)]}return"categorical"!==r||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&void 0!==i&&l<i?[new fr(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in a?[new fr(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new fr(t.key,u,`integer expected, found ${l}`)]}}function wr(t){const e=("property"===t.expressionContext?Re:Oe)(mr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new fr(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new fr(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!zt(r))return[new fr(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!zt(r))return[new fr(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!At(r,["zoom","feature-state"]))return[new fr(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!St(r))return[new fr(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function _r(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(yr(r))&&i.push(new fr(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(yr(r))&&i.push(new fr(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function kr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!kr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Sr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zr(t){if(null==t)return{filter:()=>!0,needGeometry:!1};kr(t)||(t=Mr(t));const e=Oe(t,Sr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:Ir(t)}}function Ar(t,e){return t<e?-1:t>e?1:0}function Ir(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Ir(t[e]))return!0;return!1}function Mr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Pr(t[1],t[2],"=="):"!="===e?Vr(Pr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Pr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Mr))):"all"===e?["all"].concat(t.slice(1).map(Mr)):"none"===e?["all"].concat(t.slice(1).map(Mr).map(Vr)):"in"===e?Br(t[1],t.slice(2)):"!in"===e?Vr(Br(t[1],t.slice(2))):"has"===e?Cr(t[1]):"!has"===e?Vr(Cr(t[1])):"within"!==e||t;var r}function Pr(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Br(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Ar)]]:["filter-in-small",t,["literal",e]]}}function Cr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Vr(t){return["!",t]}function Tr(t){return kr(mr(t.value))?wr(_({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Er(t)}function Er(t){const e=t.value,r=t.key;if("array"!==Me(e))return[new fr(r,e,`array expected, ${Me(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return[new fr(r,e,"filter array must have at least 1 element")];switch(s=s.concat(_r({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),yr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===yr(e[1])&&s.push(new fr(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new fr(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Me(e[1]),"string"!==i&&s.push(new fr(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Me(e[a]),"$type"===yr(e[1])?s=s.concat(_r({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new fr(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Er({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Me(e[1]),2!==e.length?s.push(new fr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new fr(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Me(e[1]),2!==e.length?s.push(new fr(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&s.push(new fr(`${r}[1]`,e[1],`object expected, ${i} found`))}return s}function Dr(t,e){const r=t.key,n=t.style,i=t.styleSpec,s=t.value,a=t.objectKey,o=i[`${e}_${t.layerType}`];if(!o)return[];const l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&o[l[1]]&&o[l[1]].transition)return Nr({key:r,value:s,valueSpec:i.transition,style:n,styleSpec:i});const u=t.valueSpec||o[a];if(!u)return[new fr(r,s,`unknown property "${a}"`)];let c;if("string"===Me(s)&&ze(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new fr(r,s,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&h.push(new fr(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Pe(mr(s))&&"identity"===yr(s.type)&&h.push(new fr(r,s,'"text-font" does not support identity functions'))),h.concat(Nr({key:t.key,value:s,valueSpec:u,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function Fr(t){return Dr(t,"paint")}function Lr(t){return Dr(t,"layout")}function $r(t){let e=[];const r=t.value,n=t.key,i=t.style,s=t.styleSpec;r.type||r.ref||e.push(new fr(n,r,'either "type" or "ref" is required'));let a=yr(r.type);const o=yr(r.ref);if(r.id){const s=yr(r.id);for(let a=0;a<t.arrayIndex;a++){const t=i.layers[a];yr(t.id)===s&&e.push(new fr(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&e.push(new fr(n,r[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{yr(e.id)===o&&(t=e)})),t?t.ref?e.push(new fr(n,r.ref,"ref cannot reference another ref layer")):a=yr(t.type):e.push(new fr(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&yr(t.type);t?"vector"===s&&"raster"===a?e.push(new fr(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?e.push(new fr(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new fr(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new fr(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new fr(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new fr(n,r.source,`source "${r.source}" not found`))}else e.push(new fr(n,r,'missing required property "source"'));return e=e.concat(gr({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Nr({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:Tr,layout:t=>gr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Lr(_({layerType:a},t))}}),paint:t=>gr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Fr(_({layerType:a},t))}})}})),e}function Or(t){const e=t.value,r=t.key,n=Me(e);return"string"!==n?[new fr(r,e,`string expected, ${n} found`)]:[]}const qr={promoteId:function({key:t,value:e}){if("string"===Me(e))return Or({key:t,value:e});{const r=[];for(const n in e)r.push(...Or({key:`${t}.${n}`,value:e[n]}));return r}}};function jr(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new fr(r,e,'"type" is required')];const s=yr(e.type);let a;switch(s){case"vector":case"raster":case"raster-dem":return a=gr({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qr}),a;case"geojson":if(a=gr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:qr}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...wr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...wr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return gr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return gr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new fr(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return _r({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function Rr(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=Me(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new fr("light",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?Nr({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?Nr({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new fr(t,e[t],`unknown property "${t}"`)])}return s}const Ur={"*":()=>[],array:xr,boolean:function(t){const e=t.value,r=t.key,n=Me(e);return"boolean"!==n?[new fr(r,e,`boolean expected, ${n} found`)]:[]},number:vr,color:function(t){const e=t.key,r=t.value,n=Me(r);return"string"!==n?[new fr(e,r,`color expected, ${n} found`)]:null===y(r)?[new fr(e,r,`color expected, "${r}" found`)]:[]},constants:dr,enum:_r,filter:Tr,function:br,layer:$r,object:gr,source:jr,light:Rr,string:Or,formatted:function(t){return 0===Or(t).length?[]:wr(t)},resolvedImage:function(t){return 0===Or(t).length?[]:wr(t)}};function Nr(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Pe(yr(e))?br(t):r.expression&&$e(mr(e))?wr(t):r.type&&Ur[r.type]?Ur[r.type](t):gr(_({},t,{valueSpec:r.type?n[r.type]:r}))}function Zr(t){const e=t.value,r=t.key,n=Or(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new fr(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new fr(r,e,'"glyphs" url must include a "{range}" token'))),n}function Gr(t,e=pr){let r=[];return r=r.concat(Nr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Zr,"*":()=>[]}})),t.constants&&(r=r.concat(dr({key:"constants",value:t.constants,style:t,styleSpec:e}))),Xr(r)}function Xr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Yr(t){return function(...e){return Xr(t.apply(this,e))}}function Jr(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function Kr(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}Gr.source=Yr(jr),Gr.light=Yr(Rr),Gr.layer=Yr($r),Gr.filter=Yr(Tr),Gr.paintProperty=Yr(Fr),Gr.layoutProperty=Yr(Lr);class Wr{constructor(t,e={}){n(this,e),this.type=t}}class Hr extends Wr{constructor(t,e={}){super("error",n({error:t},e))}}const Qr=Gr,tn=Qr.paintProperty,en=Qr.layoutProperty;class rn{constructor(){this.first=!0}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const nn=t=>t>=1536&&t<=1791,sn=t=>t>=1872&&t<=1919,an=t=>t>=2208&&t<=2303,on=t=>t>=11904&&t<=12031,ln=t=>t>=12032&&t<=12255,un=t=>t>=12272&&t<=12287,cn=t=>t>=12288&&t<=12351,hn=t=>t>=12352&&t<=12447,pn=t=>t>=12448&&t<=12543,fn=t=>t>=12544&&t<=12591,dn=t=>t>=12704&&t<=12735,yn=t=>t>=12736&&t<=12783,mn=t=>t>=12784&&t<=12799,gn=t=>t>=12800&&t<=13055,xn=t=>t>=13056&&t<=13311,vn=t=>t>=13312&&t<=19903,bn=t=>t>=19968&&t<=40959,wn=t=>t>=40960&&t<=42127,_n=t=>t>=42128&&t<=42191,kn=t=>t>=63744&&t<=64255,Sn=t=>t>=64336&&t<=65023,zn=t=>t>=65040&&t<=65055,An=t=>t>=65072&&t<=65103,In=t=>t>=65104&&t<=65135,Mn=t=>t>=65136&&t<=65279,Pn=t=>t>=65280&&t<=65519;function Bn(t){for(const e of t)if(Tn(e.charCodeAt(0)))return!0;return!1}function Cn(t){for(const e of t)if(!Vn(e.charCodeAt(0)))return!1;return!0}function Vn(t){return!(nn(t)||sn(t)||an(t)||Sn(t)||Mn(t))}function Tn(t){return!(746!==t&&747!==t&&(t<4352||!(dn(t)||fn(t)||An(t)&&!(t>=65097&&t<=65103)||kn(t)||xn(t)||on(t)||yn(t)||!(!cn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||vn(t)||bn(t)||gn(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||hn(t)||un(t)||(t=>t>=12688&&t<=12703)(t)||ln(t)||mn(t)||pn(t)&&12540!==t||!(!Pn(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!In(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||zn(t)||(t=>t>=19904&&t<=19967)(t)||wn(t)||_n(t))))}function En(t){return!(Tn(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||cn(t)||pn(t)||(t=>t>=57344&&t<=63743)(t)||An(t)||In(t)||Pn(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Dn(t){return t>=1424&&t<=2303||Sn(t)||Mn(t)}function Fn(t,e){return!(!e&&Dn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function Ln(t){for(const e of t)if(Dn(e.charCodeAt(0)))return!0;return!1}"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date);let $n="unavailable",On=null;const qn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>"loaded"===$n||null!=qn.applyArabicShaping,isLoading:()=>"loading"===$n,setState(t){$n=t.pluginStatus,On=t.pluginURL},isParsed:()=>null!=qn.applyArabicShaping&&null!=qn.processBidirectionalText&&null!=qn.processStyledBidirectionalText,getPluginURL:()=>On};class jn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rn,this.transition={})}isSupportedScript(t){return function(t,e){for(const r of t)if(!Fn(r.charCodeAt(0),e))return!1;return!0}(t,qn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Rn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Pe(t))return new Ue(t,e);if($e(t)){const r=Re(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return"string"==typeof t&&"color"===e.type&&(r=w.parse(t)),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Un{constructor(t){this.property=t,this.value=new Rn(t,void 0)}transitioned(t,e){return new Zn(this.property,this.value,e,n({},t.transition,this.transition),t.now)}untransitioned(){return new Zn(this.property,this.value,null,{},0)}}class Nn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return s(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Un(this._values[t].property)),this._values[t].value=new Rn(this._values[t].property,null===e?void 0:s(e))}getTransition(t){return s(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Un(this._values[t].property)),this._values[t].transition=s(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Gn(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Gn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Zn{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Gn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Jn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Xn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return s(this._values[t].value)}setValue(t,e){this._values[t]=new Rn(this._values[t].property,null===e?void 0:s(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const n=new Jn(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class Yn{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Jn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Kn{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=Tt[this.specification.type];return n?n(t,e,r):t}}class Wn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n){return new Yn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Yn(this,{kind:"constant",value:void 0},t.parameters);const n=Tt[this.specification.type];return n?new Yn(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Hn extends Wn{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new Yn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new Yn(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Yn(this,{kind:"constant",value:r},e)}return new Yn(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class Qn{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new jn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new jn(Math.floor(e.zoom),e)),t.expression.evaluate(new jn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class ti{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class ei{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Rn(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Un(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}ar("DataDrivenProperty",Wn),ar("DataConstantProperty",Kn),ar("CrossFadedDataDrivenProperty",Hn),ar("CrossFadedProperty",Qn),ar("ColorRampProperty",ti);const ri="-transition";class ni extends class{on(t,e){return this._listeners=this._listeners||{},Jr(t,e,this._listeners),this}off(t,e){return Kr(t,e,this._listeners),Kr(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},Jr(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new Wr(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of i)Kr(r,e,this._oneTimeListeners),e.call(this,t);const s=this._eventedParent;s&&(n(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),s.fire(t))}else t instanceof Hr&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Xn(e.layout)),e.paint)){this._transitionablePaint=new Nn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Jn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(en,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(ri)?this._transitionablePaint.getTransition(t.slice(0,-ri.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(tn,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(ri))return this._transitionablePaint.setTransition(t.slice(0,-ri.length),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),function(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return(!i||!1!==i.validate)&&function(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new Hr(new Error(n.message))),r=!0;return r}(this,t.call(Qr,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:pr,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Yn&&ze(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const ii={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class si{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ai{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function oi(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=ii[t.type].BYTES_PER_ELEMENT,s=r=li(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:li(r,Math.max(n,e)),alignment:e}}function li(t,e){return Math.ceil(t/e)*e}var ui=ci;function ci(t,e){this.x=t,this.y=e}ci.prototype={clone:function(){return new ci(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ci.convert=function(t){return t instanceof ci?t:Array.isArray(t)?new ci(t[0],t[1]):t};class hi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}hi.prototype.bytesPerElement=4,ar("StructArrayLayout2i4",hi);class pi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}pi.prototype.bytesPerElement=8,ar("StructArrayLayout4i8",pi);class fi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}fi.prototype.bytesPerElement=12,ar("StructArrayLayout2i4i12",fi);class di extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=a,t}}di.prototype.bytesPerElement=8,ar("StructArrayLayout2i4ub8",di);class yi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}yi.prototype.bytesPerElement=8,ar("StructArrayLayout2f8",yi);class mi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}mi.prototype.bytesPerElement=20,ar("StructArrayLayout10ui20",mi);class gi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}gi.prototype.bytesPerElement=24,ar("StructArrayLayout4i4ui4i24",gi);class xi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}xi.prototype.bytesPerElement=12,ar("StructArrayLayout3f12",xi);class vi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}vi.prototype.bytesPerElement=4,ar("StructArrayLayout1ul4",vi);class bi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=a,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}bi.prototype.bytesPerElement=20,ar("StructArrayLayout6i1ul2ui20",bi);class wi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}wi.prototype.bytesPerElement=12,ar("StructArrayLayout2i2i2i12",wi);class _i extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}_i.prototype.bytesPerElement=16,ar("StructArrayLayout2f1f2i16",_i);class ki extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}ki.prototype.bytesPerElement=12,ar("StructArrayLayout2ub2f12",ki);class Si extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}Si.prototype.bytesPerElement=6,ar("StructArrayLayout3ui6",Si);class zi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=a,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}zi.prototype.bytesPerElement=48,ar("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",zi);class Ai extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z,A,I){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z,A,I)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z,A,I,M){const P=34*t,B=17*t;return this.int16[P+0]=e,this.int16[P+1]=r,this.int16[P+2]=n,this.int16[P+3]=i,this.int16[P+4]=s,this.int16[P+5]=a,this.int16[P+6]=o,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=f,this.uint16[P+13]=d,this.uint16[P+14]=y,this.uint16[P+15]=m,this.uint16[P+16]=g,this.uint16[P+17]=x,this.uint16[P+18]=v,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=_,this.uint16[P+22]=k,this.uint32[B+12]=S,this.float32[B+13]=z,this.float32[B+14]=A,this.float32[B+15]=I,this.float32[B+16]=M,t}}Ai.prototype.bytesPerElement=68,ar("StructArrayLayout8i15ui1ul4f68",Ai);class Ii extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ii.prototype.bytesPerElement=4,ar("StructArrayLayout1f4",Ii);class Mi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Mi.prototype.bytesPerElement=6,ar("StructArrayLayout3i6",Mi);class Pi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}Pi.prototype.bytesPerElement=8,ar("StructArrayLayout1ul2ui8",Pi);class Bi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Bi.prototype.bytesPerElement=4,ar("StructArrayLayout2ui4",Bi);class Ci extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ci.prototype.bytesPerElement=2,ar("StructArrayLayout1ui2",Ci);class Vi extends ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Vi.prototype.bytesPerElement=16,ar("StructArrayLayout4f16",Vi);class Ti extends si{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 ui(this.anchorPointX,this.anchorPointY)}}Ti.prototype.size=20;class Ei extends bi{get(t){return new Ti(this,t)}}ar("CollisionBoxArray",Ei);class Di extends si{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Di.prototype.size=48;class Fi extends zi{get(t){return new Di(this,t)}}ar("PlacedSymbolArray",Fi);class Li extends si{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Li.prototype.size=68;class $i extends Ai{get(t){return new Li(this,t)}}ar("SymbolInstanceArray",$i);class Oi extends Ii{getoffsetX(t){return this.float32[1*t+0]}}ar("GlyphOffsetArray",Oi);class qi extends Mi{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ar("SymbolLineVertexArray",qi);class ji extends si{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]}}ji.prototype.size=8;class Ri extends Pi{get(t){return new ji(this,t)}}ar("FeatureIndexArray",Ri);class Ui extends hi{}class Ni extends hi{}class Zi extends fi{}class Gi extends di{}class Xi extends yi{}class Yi extends mi{}class Ji extends gi{}class Ki extends xi{}class Wi extends vi{}class Hi extends wi{}class Qi extends ki{}class ts extends Si{}class es extends Bi{}const rs=oi([{name:"a_pos",components:2,type:"Int16"}],4),{members:ns}=rs;class is{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>is.MAX_VERTEX_ARRAY_LENGTH&&o(`Max vertices per segment is ${is.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>is.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new is([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function ss(t,e){return 256*(t=r(Math.floor(t),0,255))+r(Math.floor(e),0,255)}is.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ar("SegmentVector",is);const as=oi([{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 os={exports:{}},ls={exports:{}};ls.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var us={exports:{}};us.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var cs=ls.exports,hs=us.exports;os.exports=cs,os.exports.murmur3=cs,os.exports.murmur2=hs;var ps=os.exports;class fs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(ds(t)),this.positions.push(e,r,n)}getPositions(t){const e=ds(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return ys(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new fs;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ds(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ps(String(t))}function ys(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;ms(t,s,a),ms(e,3*s,3*a),ms(e,3*s+1,3*a+1),ms(e,3*s+2,3*a+2)}a-r<n-a?(ys(t,e,r,a),r=a+1):(ys(t,e,a+1,n),n=a)}}function ms(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}ar("FeaturePositionMap",fs);class gs{constructor(t,e){this.gl=t.gl,this.location=e}}class xs extends gs{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class vs extends gs{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class bs extends gs{constructor(t,e){super(t,e),this.current=w.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}function ws(t){return[ss(255*t.r,255*t.g),ss(255*t.b,255*t.a)]}class _s{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new bs(t,e):new xs(t,e)}}class ks{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,n){const i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,r){return"u_pattern"===r.substr(0,9)?new vs(t,e):new xs(t,e)}}class Ss{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i){const s=this.paintVertexArray.length,a=this.expression.evaluate(new jn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i)}_setPaintValue(t,e,r){if("color"===this.type){const n=ws(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class zs{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new jn(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new jn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,s,a)}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),s=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,s)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=ws(r),s=ws(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const n=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=r(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new xs(t,e)}}class As{constructor(t,e,r,n,i,s){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=s,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i)}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:s,max:a}=r,o=n[i],l=n[s],u=n[a];if(o&&l&&u)for(let r=t;r<e;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,as.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,as.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Is{constructor(t,e,r){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const s=t.paint.get(i);if(!(s instanceof Yn&&ze(s.property.specification)))continue;const a=Ps(i,t.type),o=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===o.kind)this.binders[i]=h?new ks(o.value,a):new _s(o.value,a,l),n.push(`/u_${i}`);else if("source"===o.kind||h){const r=Bs(i,l,"source");this.binders[i]=h?new As(o,l,u,e,r,t.id):new Ss(o,a,l,r),n.push(`/a_${i}`)}else{const t=Bs(i,l,"composite");this.binders[i]=new zs(o,a,l,u,e,t),n.push(`/z_${i}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Ss||e instanceof zs?e.maxValue:0}populatePaintArrays(t,e,r,n,i){for(const s in this.binders){const a=this.binders[s];(a instanceof Ss||a instanceof zs||a instanceof As)&&a.populatePaintArray(t,e,r,n,i)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof ks&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,n,i){let s=!1;for(const a in t){const o=e.getPositions(a);for(const e of o){const o=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof Ss||l instanceof zs||l instanceof As)&&!0===l.expression.isStateDependent){const u=n.paint.get(r);l.expression=u.value,l.updatePaintArray(e.start,e.end,o,t[a],i),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof _s||r instanceof ks)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ss||r instanceof zs)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof As)for(let e=0;e<as.members.length;e++)t.push(as.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof _s||r instanceof ks||r instanceof zs)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof _s||i instanceof ks||i instanceof zs)for(const s of i.uniformNames)if(e[s]){const a=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:a})}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,n,r.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof As){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof Ss||r instanceof zs)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof Ss||r instanceof zs||r instanceof As)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Ss||e instanceof zs||e instanceof As)&&e.destroy()}}}class Ms{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Is(n,e,r);this.needsUpload=!1,this._featureMap=new fs,this._bufferOffset=0}populatePaintArrays(t,e,r,n,i,s){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ps(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Bs(t,e,r){const n={color:{source:yi,composite:Vi},number:{source:Ii,composite:yi}},i=function(t){return{"line-pattern":{source:Yi,composite:Yi},"fill-pattern":{source:Yi,composite:Yi},"fill-extrusion-pattern":{source:Yi,composite:Yi}}[t]}(t);return i&&i[r]||n[e][r]}ar("ConstantBinder",_s),ar("CrossFadedConstantBinder",ks),ar("SourceExpressionBinder",Ss),ar("CrossFadedCompositeBinder",As),ar("CompositeExpressionBinder",zs),ar("ProgramConfiguration",Is,{omit:["_buffers"]}),ar("ProgramConfigurationSet",Ms);var Cs=8192;const Vs=Math.pow(2,14)-1,Ts=-Vs-1;function Es(t){const e=Cs/t.extent,n=t.loadGeometry();for(let t=0;t<n.length;t++){const i=n[t];for(let t=0;t<i.length;t++){const n=i[t],s=Math.round(n.x*e),a=Math.round(n.y*e);n.x=r(s,Ts,Vs),n.y=r(a,Ts,Vs),(s<n.x||s>n.x+1||a<n.y||a>n.y+1)&&o("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Ds(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Es(t):[]}}function Fs(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}class Ls{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ui,this.indexArray=new ts,this.segments=new is,this.programConfigurations=new Ms(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){const n=this.layers[0],i=[];let s=null,a=!1;"circle"===n.type&&(s=n.layout.get("circle-sort-key"),a=!s.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ds(e,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),u,r))continue;const c=a?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Es(e),patterns:{},sortKey:c};i.push(h)}a&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n,o=t[s].feature;this.addFeature(n,i,s,r),e.featureIndex.insert(o,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ns),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Cs||n<0||n>=Cs)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;Fs(this.layoutVertexArray,r,n,-1,-1),Fs(this.layoutVertexArray,r,n,1,-1),Fs(this.layoutVertexArray,r,n,1,1),Fs(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)}}function $s(t,e){for(let r=0;r<t.length;r++)if(Xs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Xs(t,e[r]))return!0;return!!Rs(t,e)}function Os(t,e,r){return!!Xs(t,e)||!!Ns(e,t,r)}function qs(t,e){if(1===t.length)return Gs(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Xs(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(Gs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Rs(t,e[r]))return!0;return!1}function js(t,e,r){if(t.length>1){if(Rs(t,e))return!0;for(let n=0;n<e.length;n++)if(Ns(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Ns(t[n],e,r))return!0;return!1}function Rs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(Us(n,i,e[t],e[t+1]))return!0}return!1}function Us(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function Ns(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Zs(t,e[r-1],e[r])<n)return!0;return!1}function Zs(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Gs(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Xs(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Ys(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=l(t,e,r[0]);return s!==l(t,e,r[1])||s!==l(t,e,r[2])||s!==l(t,e,r[3])}function Js(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ks(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ws(t,e,r,n,i){if(!e[0]&&!e[1])return t;const s=ui.convert(e)._mult(i);"viewport"===r&&s._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(s));return a}ar("CircleBucket",Ls,{omit:["layers"]});const Hs=new ei({"circle-sort-key":new Wn(pr.layout_circle["circle-sort-key"])});var Qs,ta={paint:new ei({"circle-radius":new Wn(pr.paint_circle["circle-radius"]),"circle-color":new Wn(pr.paint_circle["circle-color"]),"circle-blur":new Wn(pr.paint_circle["circle-blur"]),"circle-opacity":new Wn(pr.paint_circle["circle-opacity"]),"circle-translate":new Kn(pr.paint_circle["circle-translate"]),"circle-translate-anchor":new Kn(pr.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Kn(pr.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Kn(pr.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wn(pr.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wn(pr.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wn(pr.paint_circle["circle-stroke-opacity"])}),layout:Hs},ea="undefined"!=typeof Float32Array?Float32Array:Array;function ra(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function na(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}function ia(t,e){const r=na([],[t.x,t.y,0,1],e);return new ui(r[0]/r[3],r[1]/r[3])}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Qs=new ea(4),ea!=Float32Array&&(Qs[0]=0,Qs[1]=0,Qs[2]=0,Qs[3]=0);class sa extends Ls{}ar("HeatmapBucket",sa,{omit:["layers"]});var aa={paint:new ei({"heatmap-radius":new Wn(pr.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wn(pr.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Kn(pr.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ti(pr.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Kn(pr.paint_heatmap["heatmap-opacity"])})};function oa(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`)}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function la(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=oa({},{width:e,height:r},n);ua(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function ua(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<i.width*s;t++)o[c+t]=a[u+t]}return e}class ca{constructor(t,e){oa(this,t,1,e)}resize(t){la(this,t,1)}clone(){return new ca({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ua(t,e,r,n,i,1)}}class ha{constructor(t,e){oa(this,t,4,e)}resize(t){la(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new ha({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ua(t,e,r,n,i,4)}}ar("AlphaImage",ca),ar("RGBAImage",ha);var pa={paint:new ei({"hillshade-illumination-direction":new Kn(pr.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Kn(pr.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Kn(pr.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Kn(pr.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Kn(pr.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Kn(pr.paint_hillshade["hillshade-accent-color"])})};const fa=oi([{name:"a_pos",components:2,type:"Int16"}],4),{members:da}=fa;var ya={exports:{}};function ma(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=ga(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=ga(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(Ma(a));for(o.sort(Sa),i=0;i<o.length;i++)r=xa(r=za(o[i],r),r.next);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(o=t[d])<n&&(n=o),(l=t[d+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?1/u:0}return va(p,f,r,n,i,u),f}function ga(t,e,r,n,i){var s,a;if(i===ja(t,e,r,n)>0)for(s=e;s<r;s+=n)a=$a(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=$a(s,t[s],t[s+1],a);return a&&Va(a,a.next)&&(Oa(a),a=a.next),a}function xa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Va(n,n.next)&&0!==Ca(n.prev,n,n.next))n=n.next;else{if(Oa(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function va(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Ia(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?wa(t,n,i,s):ba(t))e.push(o.i/r),e.push(t.i/r),e.push(l.i/r),Oa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?va(t=_a(xa(t),e,r),e,r,n,i,s,2):2===a&&ka(t,e,r,n,i,s):va(xa(t),e,r,n,i,s,1);break}}}function ba(t){var e=t.prev,r=t,n=t.next;if(Ca(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Pa(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ca(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wa(t,e,r,n){var i=t.prev,s=t,a=t.next;if(Ca(i,s,a)>=0)return!1;for(var o=i.x>s.x?i.x>a.x?i.x:a.x:s.x>a.x?s.x:a.x,l=i.y>s.y?i.y>a.y?i.y:a.y:s.y>a.y?s.y:a.y,u=Ia(i.x<s.x?i.x<a.x?i.x:a.x:s.x<a.x?s.x:a.x,i.y<s.y?i.y<a.y?i.y:a.y:s.y<a.y?s.y:a.y,e,r,n),c=Ia(o,l,e,r,n),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,h.x,h.y)&&Ca(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Ca(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,h.x,h.y)&&Ca(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Pa(i.x,i.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Ca(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function _a(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Va(i,s)&&Ta(i,n,n.next,s)&&Fa(i,s)&&Fa(s,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(s.i/r),Oa(n),Oa(n.next),n=t=s),n=n.next}while(n!==t);return xa(n)}function ka(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Ba(a,o)){var l=La(a,o);return a=xa(a,a.next),l=xa(l,l.next),va(a,e,r,n,i,s),void va(l,e,r,n,i,s)}o=o.next}a=a.next}while(a!==t)}function Sa(t,e){return t.x-e.x}function za(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a){if(a=o,o===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Pa(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),Fa(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&Aa(r,n)))&&(r=n,p=l)),n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=La(r,t),i=xa(r,r.next);return xa(n,n.next),e===r?i:e}function Aa(t,e){return Ca(t.prev,t,e.prev)<0&&Ca(e.next,t,t.next)<0}function Ia(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ma(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Pa(t,e,r,n,i,s,a,o){return(i-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(n-o)-(r-a)*(e-o)>=0&&(r-a)*(s-o)-(i-a)*(n-o)>=0}function Ba(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ta(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Fa(t,e)&&Fa(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ca(t.prev,t,e.prev)||Ca(t,e.prev,e))||Va(t,e)&&Ca(t.prev,t,t.next)>0&&Ca(e.prev,e,e.next)>0)}function Ca(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Va(t,e){return t.x===e.x&&t.y===e.y}function Ta(t,e,r,n){var i=Da(Ca(t,e,r)),s=Da(Ca(t,e,n)),a=Da(Ca(r,n,t)),o=Da(Ca(r,n,e));return i!==s&&a!==o||!(0!==i||!Ea(t,r,e))||!(0!==s||!Ea(t,n,e))||!(0!==a||!Ea(r,t,n))||!(0!==o||!Ea(r,e,n))}function Ea(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Da(t){return t>0?1:t<0?-1:0}function Fa(t,e){return Ca(t.prev,t,t.next)<0?Ca(t,e,t.next)>=0&&Ca(t,t.prev,e)>=0:Ca(t,e,t.prev)<0||Ca(t,t.next,e)<0}function La(t,e){var r=new qa(t.i,t.x,t.y),n=new qa(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function $a(t,e,r,n){var i=new qa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Oa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function qa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ja(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}ya.exports=ma,ya.exports.default=ma,ma.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(ja(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(ja(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},ma.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r};var Ra=ya.exports;function Ua(t,e,r,n,i){Na(t,e,r||0,n||t.length-1,i||Ga)}function Na(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);Na(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}var c=t[e],h=r,p=n;for(Za(t,r,e),i(t[n],c)>0&&Za(t,r,n);h<p;){for(Za(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?Za(t,r,p):Za(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Za(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Ga(t,e){return t<e?-1:t>e?1:0}function Xa(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=u(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Ua(n[t],e,1,n[t].length-1,Ya),n[t]=n[t].slice(0,e));return n}function Ya(t,e){return e.area-t.area}function Ja(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ka(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l}}}return r}class Wa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ni,this.indexArray=new ts,this.indexArray2=new es,this.programConfigurations=new Ms(t.layers,t.zoom),this.segments=new is,this.segments2=new is,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Ja("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ds(a,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Es(a),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ka("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,da),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,n,i){for(const t of Xa(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length}const a=Ra(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}ar("FillBucket",Wa,{omit:["layers","patternFeatures"]});const Ha=new ei({"fill-sort-key":new Wn(pr.layout_fill["fill-sort-key"])});var Qa={paint:new ei({"fill-antialias":new Kn(pr.paint_fill["fill-antialias"]),"fill-opacity":new Wn(pr.paint_fill["fill-opacity"]),"fill-color":new Wn(pr.paint_fill["fill-color"]),"fill-outline-color":new Wn(pr.paint_fill["fill-outline-color"]),"fill-translate":new Kn(pr.paint_fill["fill-translate"]),"fill-translate-anchor":new Kn(pr.paint_fill["fill-translate-anchor"]),"fill-pattern":new Hn(pr.paint_fill["fill-pattern"])}),layout:Ha};const to=oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:eo}=to;var ro={},no=ui,io=so;function so(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(ao,this,e)}function ao(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function oo(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}so.types=["Unknown","Point","LineString","Polygon"],so.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,s=0,a=0,o=[];t.pos<r;){if(i<=0){var l=t.readVarint();n=7&l,i=l>>3}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new no(s,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&o.push(e),o},so.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,o,u]},so.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=so.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],s=0;s<e;s++){var a=oo(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]))}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var lo=io,uo=co;function co(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ho,this,e),this.length=this._features.length}function ho(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}co.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new lo(this._pbf,e,this.extent,this._keys,this._values)};var po=uo;function fo(t,e,r){if(3===t){var n=new po(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}ro.VectorTile=function(t,e){this.layers=t.readFields(fo,{},e)},ro.VectorTileFeature=io,ro.VectorTileLayer=uo;const yo=ro.VectorTileFeature.types,mo=Math.pow(2,13);function go(t,e,r,n,i,s,a,o){t.emplaceBack(e,r,2*Math.floor(n*mo)+a,i*mo*2,s*mo*2,Math.round(o))}class xo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new ts,this.programConfigurations=new Ms(t.layers,t.zoom),this.segments=new is,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.features=[],this.hasPattern=Ja("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,o=Ds(n,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:a,index:s,geometry:t?o.geometry:Es(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Ka("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,r,{}),e.featureIndex.insert(n,l.geometry,s,a,this.index,!0)}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,eo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i){for(const r of Xa(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(bo(t))continue;let e=0;for(let r=0;r<t.length;r++){const i=t[r];if(r>=1){const s=t[r-1];if(!vo(i,s)){n.vertexLength+4>is.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(s)._perp()._unit(),r=s.dist(i);e+r>32768&&(e=0),go(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),go(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),e+=r,go(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),go(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e);const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>is.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==yo[t.type])continue;const i=[],s=[],a=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&s.push(i.length/2);for(let e=0;e<t.length;e++){const r=t[e];go(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),i.push(r.x),i.push(r.y)}}const o=Ra(i,s);for(let t=0;t<o.length;t+=3)this.indexArray.emplaceBack(a+o[t],a+o[t+2],a+o[t+1]);n.primitiveLength+=o.length/3,n.vertexLength+=e}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}}function vo(t,e){return t.x===e.x&&(t.x<0||t.x>Cs)||t.y===e.y&&(t.y<0||t.y>Cs)}function bo(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Cs))||t.every((t=>t.y<0))||t.every((t=>t.y>Cs))}ar("FillExtrusionBucket",xo,{omit:["layers","features"]});var wo={paint:new ei({"fill-extrusion-opacity":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wn(pr["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Hn(pr["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wn(pr["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wn(pr["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Kn(pr["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function _o(t,e){return t.x*e.x+t.y*e.y}function ko(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=_o(o,o),h=_o(o,l),p=_o(l,l),f=_o(u,o),d=_o(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const So=oi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:zo}=So,Ao=oi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Io}=Ao,Mo=ro.VectorTileFeature.types,Po=Math.cos(Math.PI/180*37.5),Bo=Math.pow(2,14)/.5;class Co{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Gi,this.layoutVertexArray2=new Xi,this.indexArray=new ts,this.programConfigurations=new Ms(t.layers,t.zoom),this.segments=new is,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,r){this.hasPattern=Ja("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ds(e,t);if(!this.layers[0]._featureFilter.filter(new jn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Es(e),patterns:{},sortKey:c};s.push(h)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ka("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Io)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const s=this.layers[0].layout,a=s.get("line-join").evaluate(t,{}),o=s.get("line-cap"),l=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===Mo[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(a?3:2))return;"bevel"===r&&(i=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,a&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(f=e===o-1?a?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<Po&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const k=p&&f;let S=k?r:a?"butt":n;if(k&&"round"===S&&(v<s?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>i&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<i&&(S="miter")),p&&this.updateDistance(p,h),"miter"===S)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===S){if(v>100)m=y.mult(-1);else{const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===S){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(h,y,-e,-r,c)}else if("butt"===S)this.addCurrentVertex(h,m,0,0,c);else if("square"===S){const t=p?1:-1;this.addCurrentVertex(h,m,t,t,c)}else"round"===S&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<o-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.distance>Bo/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,s))}addHalfVertex({x:t,y:e},r,n,i,s,a,o){const l=.5*(this.lineClips?this.scaledDistance*(Bo-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}ar("LineBucket",Co,{omit:["layers","patternFeatures"]});const Vo=new ei({"line-cap":new Kn(pr.layout_line["line-cap"]),"line-join":new Wn(pr.layout_line["line-join"]),"line-miter-limit":new Kn(pr.layout_line["line-miter-limit"]),"line-round-limit":new Kn(pr.layout_line["line-round-limit"]),"line-sort-key":new Wn(pr.layout_line["line-sort-key"])});var To={paint:new ei({"line-opacity":new Wn(pr.paint_line["line-opacity"]),"line-color":new Wn(pr.paint_line["line-color"]),"line-translate":new Kn(pr.paint_line["line-translate"]),"line-translate-anchor":new Kn(pr.paint_line["line-translate-anchor"]),"line-width":new Wn(pr.paint_line["line-width"]),"line-gap-width":new Wn(pr.paint_line["line-gap-width"]),"line-offset":new Wn(pr.paint_line["line-offset"]),"line-blur":new Wn(pr.paint_line["line-blur"]),"line-dasharray":new Qn(pr.paint_line["line-dasharray"]),"line-pattern":new Hn(pr.paint_line["line-pattern"]),"line-gradient":new ti(pr.paint_line["line-gradient"])}),layout:Vo};const Eo=new class extends Wn{possiblyEvaluate(t,e){return e=new jn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=n({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}}(To.paint.properties["line-width"].specification);function Do(t,e){return e>0?e+2*t:t}Eo.useIntegerZoom=!0;const Fo=oi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Lo=oi([{name:"a_projected_pos",components:3,type:"Float32"}],4);oi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $o=oi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);oi([{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 Oo=oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function qo(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),qn.applyArabicShaping&&(t=qn.applyArabicShaping(t)),t}(t.text,e,r)})),t}oi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),oi([{name:"triangle",components:3,type:"Uint16"}]),oi([{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"}]),oi([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),oi([{type:"Float32",name:"offsetX"}]),oi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const jo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ro=24,Uo=Go,No=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u}return(f?-1:1)*a*Math.pow(2,s-n)},Zo=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*y};function Go(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Go.Varint=0,Go.Fixed64=1,Go.Bytes=2,Go.Fixed32=5;var Xo,Yo=4294967296,Jo=1/Yo,Ko="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Wo(t){return t.type===Go.Bytes?t.readVarint()+t.pos:t.pos+1}function Ho(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qo(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function tl(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function el(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function rl(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function nl(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function il(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function sl(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function al(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ol(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function ll(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ul(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function cl(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function hl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function pl(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}Go.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ul(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ul(this.buf,this.pos)+ul(this.buf,this.pos+4)*Yo;return this.pos+=8,t},readSFixed64:function(){var t=ul(this.buf,this.pos)+hl(this.buf,this.pos+4)*Yo;return this.pos+=8,t},readFloat:function(){var t=No(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=No(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return Ho(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return Ho(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return Ho(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ko?function(t,e,r){return Ko.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Go.Bytes)return t.push(this.readVarint(e));var r=Wo(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Go.Bytes)return t.push(this.readSVarint());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Go.Bytes)return t.push(this.readBoolean());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Go.Bytes)return t.push(this.readFloat());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Go.Bytes)return t.push(this.readDouble());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Go.Bytes)return t.push(this.readFixed32());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Go.Bytes)return t.push(this.readSFixed32());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Go.Bytes)return t.push(this.readFixed64());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Go.Bytes)return t.push(this.readSFixed64());var e=Wo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Go.Varint)for(;this.buf[this.pos++]>127;);else if(e===Go.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Go.Fixed32)this.pos+=4;else{if(e!==Go.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Jo),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Jo),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Qo(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Zo(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Zo(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&Qo(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Go.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ll,e)},writeBytesField:function(t,e){this.writeTag(t,Go.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Go.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Go.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Go.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Go.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Go.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Go.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Go.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Go.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Go.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class fl{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class dl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=pl(i),o=new ha({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;ha.copy(n.data,o,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data)}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+1,a=i.y+1,l=r.data.width,u=r.data.height;ha.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),ha.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),ha.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),ha.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),ha.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new fl(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i})}}ar("ImagePosition",fl),ar("ImageAtlas",dl),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}(Xo||(Xo={}));const yl=-17;class ml{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const r=new ml;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new ml;return e.imageName=t,e}}class gl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new gl;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let r=0;r<t.length;r++){const n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;e+=n&&En(n)&&!jo[t[r+1]]||i&&En(i)&&!jo[t[r-1]]||!jo[t[r]]?t[r]:jo[t[r]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&vl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&vl[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new gl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(ml.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void o("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(ml.forImage(e)),this.sectionIndex.push(this.sections.length-1)):o("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function xl(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y){const m=gl.fromFeature(t,i);let g;h===Xo.vertical&&m.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=qn;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Al(m,u,s,e,n,f,d));for(const e of t){const t=new gl;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(v){g=[];const t=v(m.text,m.sectionIndex,Al(m,u,s,e,n,f,d));for(const e of t){const t=new gl;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,Al(m,u,s,e,n,f,d));const b=[],w={positionedLines:b,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,s,a,o,l,u,c,h){let p=0,f=yl,d=0,y=0;const m="right"===o?1:"left"===o?0:.5;let g=0;for(const a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*Ro,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!a.length()){f+=s,++g;continue}for(let s=0;s<a.length();s++){const d=a.getSection(s),y=a.getSectionIndex(s),m=a.getCharCode(s);let g=0,v=null,_=null,k=null,S=Ro;const z=!(l===Xo.horizontal||!c&&!Tn(m)||c&&(vl[m]||(x=m,nn(x)||sn(x)||an(x)||Sn(x)||Mn(x))));if(d.imageName){const e=n[d.imageName];if(!e)continue;k=d.imageName,t.iconsInText=t.iconsInText||!0,_=e.paddedRect;const r=e.displaySize;d.scale=d.scale*Ro/h,v={width:r[0],height:r[1],left:1,top:-3,advance:z?r[1]:r[0]},g=o+(Ro-r[1]*d.scale),S=v.advance;const s=z?r[0]*d.scale-Ro*i:r[1]*d.scale-Ro*i;s>0&&s>w&&(w=s)}else{const t=r[d.fontStack],n=t&&t[m];if(n&&n.rect)_=n.rect,v=n.metrics;else{const t=e[d.fontStack],r=t&&t[m];if(!r)continue;v=r.metrics}g=(i-d.scale)*Ro}z?(t.verticalizable=!0,b.push({glyph:m,imageName:k,x:p,y:f+g,vertical:z,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=S*d.scale+u):(b.push({glyph:m,imageName:k,x:p,y:f+g,vertical:z,scale:d.scale,fontStack:d.fontStack,sectionIndex:y,metrics:v,rect:_}),p+=v.advance*d.scale+u)}0!==b.length&&(d=Math.max(p-u,d),Ml(b,0,b.length-1,m,w)),p=0;const _=s*i+w;v.lineOffset=Math.max(w,o),f+=_,y=Math.max(_,y),++g}var x;const v=f-yl,{horizontalAlign:b,verticalAlign:w}=Il(a);(function(t,e,r,n,i,s,a,o,l){const u=(e-r)*i;let c=0;c=s!==a?-o*n-yl:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(t.positionedLines,m,b,w,d,y,s,v,i.length),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*d,t.right=t.left+d}(w,e,r,n,g,a,o,l,h,u,p,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const vl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bl={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function wl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*Ro/s+i:0}{const n=r[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+i:0}}function _l(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function kl(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Sl(t,e,r,n,i,s){let a=null,o=_l(e,r,i,s);for(const t of n){const n=_l(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function zl(t){return t?zl(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,s,a){if("point"!==s)return[];if(!t)return[];const o=[],l=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=wl(t.getCharCode(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),u=t.text.indexOf("")>=0;let c=0;for(let r=0;r<t.length();r++){const s=t.getSection(r),p=t.getCharCode(r);if(vl[p]||(c+=wl(p,s,n,i,e,a)),r<t.length()-1){const e=!((h=p)<11904||!(dn(h)||fn(h)||An(h)||kn(h)||xn(h)||on(h)||yn(h)||cn(h)||vn(h)||bn(h)||gn(h)||Pn(h)||hn(h)||un(h)||ln(h)||mn(h)||pn(h)||zn(h)||_n(h)||wn(h)));(bl[p]||e||s.imageName)&&o.push(Sl(r+1,c,l,o,kl(p,t.getCharCode(r+1),e&&u),!1))}}var h;return zl(Sl(t.length(),c,l,o,0,!0))}function Il(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Ml(t,e,r,n,i){if(!n&&!i)return;const s=t[r],a=(t[r].x+s.metrics.advance*s.scale)*n;for(let n=e;n<=r;n++)t[n].x-=a,t[n].y+=i}function Pl(t,e,r){const{horizontalAlign:n,verticalAlign:i}=Il(r),s=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*i;return{image:t,top:a,bottom:a+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function Bl(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===r||"both"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-a.displaySize[0])/2,h=f+a.displaySize[0]);const d=e.top*s,y=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:f,collisionPadding:o}}const Cl=128;function Vl(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new jn(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:o,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:o,minSize:r.evaluate(new jn(a)),maxSize:r.evaluate(new jn(o)),interpolationType:n}}}class Tl extends ui{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n)}clone(){return new Tl(this.x,this.y,this.angle,this.segment)}}function El(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function Dl(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Fl(t,e,r){return t?.6*e*r:0}function Ll(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function $l(t,e,r,n,i,s){const a=Fl(r,i,s),o=Ll(r,n)*s;let l=0;const u=Dl(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=Vt(n.x,i.x,c),p=Vt(n.y,i.y,c),f=new Tl(h,p,i.angleTo(n),r);return f._round(),!a||El(t,f,o,a,e)?f:void 0}l+=s}}function Ol(t,e,r,n,i,s,a,o,l){const u=Fl(n,s,a),c=Ll(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),ql(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function ql(t,e,r,n,i,s,a,o,l){const u=s/2,c=Dl(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],d=a.dist(o),y=o.angleTo(a);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=Vt(a.x,o.x,m),x=Vt(a.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new Tl(g,x,y,e);r._round(),n&&!El(t,r,s,n,i)||f.push(r)}}h+=d}return o||f.length||a||(f=ql(t,h/2,r,n,i,s,a,!0,l)),f}function jl(t,e,r,n){const i=[],s=t.image,a=s.pixelRatio,o=s.paddedRect.w-2,l=s.paddedRect.h-2,u=t.right-t.left,c=t.bottom-t.top,h=s.stretchX||[[0,o]],p=s.stretchY||[[0,l]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=o-d,g=l-y;let x=0,v=d,b=0,w=y,_=0,k=m,S=0,z=g;if(s.content&&n){const t=s.content;x=Rl(h,0,t[0]),b=Rl(p,0,t[1]),v=Rl(h,t[0],t[2]),w=Rl(p,t[1],t[3]),_=t[0]-x,S=t[1]-b,k=t[2]-t[0]-v,z=t[3]-t[1]-w}const A=(n,i,o,l)=>{const h=Nl(n.stretch-x,v,u,t.left),p=Zl(n.fixed-_,k,n.stretch,d),f=Nl(i.stretch-b,w,c,t.top),m=Zl(i.fixed-S,z,i.stretch,y),g=Nl(o.stretch-x,v,u,t.left),A=Zl(o.fixed-_,k,o.stretch,d),I=Nl(l.stretch-b,w,c,t.top),M=Zl(l.fixed-S,z,l.stretch,y),P=new ui(h,f),B=new ui(g,f),C=new ui(g,I),V=new ui(h,I),T=new ui(p/a,m/a),E=new ui(A/a,M/a),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),r=[e,-t,t,e];P._matMult(r),B._matMult(r),V._matMult(r),C._matMult(r)}const F=n.stretch+n.fixed,L=i.stretch+i.fixed;return{tl:P,tr:B,bl:V,br:C,tex:{x:s.paddedRect.x+1+F,y:s.paddedRect.y+1+L,w:o.stretch+o.fixed-F,h:l.stretch+l.fixed-L},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:T,pixelOffsetBR:E,minFontScaleX:k/a/u,minFontScaleY:z/a/c,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){const t=Ul(h,m,d),e=Ul(p,g,y);for(let r=0;r<t.length-1;r++){const n=t[r],s=t[r+1];for(let t=0;t<e.length-1;t++)i.push(A(n,e[t],s,e[t+1]))}}else i.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));return i}function Rl(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Ul(t,e,r){const n=[{fixed:-1,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+1,stretch:r}),n}function Nl(t,e,r,n){return t/e*r+n}function Zl(t,e,r,n){return t-e*r/n}ar("Anchor",Tl);class Gl{constructor(t,e,r,n,i,s,a,o,l,u){if(this.boxStartIndex=t.length,l){let t=s.top,e=s.bottom;const r=s.collisionPadding;r&&(t-=r[1],e+=r[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let l=s.top*a-o,c=s.bottom*a+o,h=s.left*a-o,p=s.right*a+o;const f=s.collisionPadding;if(f&&(h-=f[0]*a,l-=f[1]*a,p+=f[2]*a,c+=f[3]*a),u){const t=new ui(h,l),e=new ui(p,l),r=new ui(h,c),n=new ui(p,c),i=u*Math.PI/180;t._rotate(i),e._rotate(i),r._rotate(i),n._rotate(i),h=Math.min(t.x,e.x,r.x,n.x),p=Math.max(t.x,e.x,r.x,n.x),l=Math.min(t.y,e.y,r.y,n.y),c=Math.max(t.y,e.y,r.y,n.y)}t.emplaceBack(e.x,e.y,h,l,p,c,r,n,i)}this.boxEndIndex=t.length}}class Xl{constructor(t=[],e=Yl){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const a=n+1;if(a<this.length&&r(e[a],s)<0&&(n=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=n}e[t]=i}}function Yl(t,e){return t<e?-1:t>e?1:0}function Jl(t,e=1,r=!1){let n=1/0,i=1/0,s=-1/0,a=-1/0;const o=t[0];for(let t=0;t<o.length;t++){const e=o[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<i)&&(i=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>a)&&(a=e.y)}const l=Math.min(s-n,a-i);let u=l/2;const c=new Xl([],Kl);if(0===l)return new ui(n,i);for(let e=n;e<s;e+=l)for(let r=i;r<a;r+=l)c.push(new Wl(e+u,r+u,u,t));let h=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new Wl(r/e,n/e,0,t)}(t),p=c.length;for(;c.length;){const n=c.pop();(n.d>h.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new Wl(n.p.x-u,n.p.y-u,u,t)),c.push(new Wl(n.p.x+u,n.p.y-u,u,t)),c.push(new Wl(n.p.x-u,n.p.y+u,u,t)),c.push(new Wl(n.p.x+u,n.p.y+u,u,t)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function Kl(t,e){return e.max-t.max}function Wl(t,e,r,n){this.p=new ui(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Zs(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const Hl=Number.POSITIVE_INFINITY;function Ql(t,e,r,n,i,s,a){t.createArrays(),t.tilePixelRatio=Cs/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const l=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,c={layoutIconSize:u["icon-size"].possiblyEvaluate(new jn(t.zoom+1),a),layoutTextSize:u["text-size"].possiblyEvaluate(new jn(t.zoom+1),a),textMaxSize:u["text-size"].possiblyEvaluate(new jn(18))};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new jn(e),a),u["text-size"].possiblyEvaluate(new jn(r),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new jn(e),a),u["icon-size"].possiblyEvaluate(new jn(r),a)]}const h=l.get("text-line-height")*Ro,p="viewport"!==l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),f=l.get("text-keep-upright"),d=l.get("text-size");for(const s of t.features){const u=l.get("text-font").evaluate(s,{},a).join(","),g=d.evaluate(s,{},a),x=c.layoutTextSize.evaluate(s,{},a),v=c.layoutIconSize.evaluate(s,{},a),b={horizontal:{},vertical:void 0},w=s.text;let _,k=[0,0];if(w){const n=w.toString(),o=l.get("text-letter-spacing").evaluate(s,{},a)*Ro,c=Cn(n)?o:0,d=l.get("text-anchor").evaluate(s,{},a),v=l.get("text-variable-anchor");if(!v){const t=l.get("text-radial-offset").evaluate(s,{},a);t?(y=d,k=(m=[t*Ro,Hl])[1]!==Hl?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(y,m[0],m[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(y,m[0])):k=l.get("text-offset").evaluate(s,{},a).map((t=>t*Ro))}let _=p?"center":l.get("text-justify").evaluate(s,{},a);const S=l.get("symbol-placement"),z="point"===S?l.get("text-max-width").evaluate(s,{},a)*Ro:0,A=()=>{t.allowVerticalPlacement&&Bn(n)&&(b.vertical=xl(w,e,r,i,u,z,h,d,"left",c,k,Xo.vertical,!0,S,x,g))};if(!p&&v){const t="auto"===_?v.map((t=>tu(t))):[_];let n=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!b.horizontal[a])if(n)b.horizontal[a]=b.horizontal[0];else{const t=xl(w,e,r,i,u,z,h,"center",a,c,k,Xo.horizontal,!1,S,x,g);t&&(b.horizontal[a]=t,n=1===t.positionedLines.length)}}A()}else{"auto"===_&&(_=tu(d));const t=xl(w,e,r,i,u,z,h,d,_,c,k,Xo.horizontal,!1,S,x,g);t&&(b.horizontal[_]=t),A(),Bn(n)&&p&&f&&(b.vertical=xl(w,e,r,i,u,z,h,d,_,c,k,Xo.vertical,!1,S,x,g))}}let S=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(_=Pl(i[s.icon.name],l.get("icon-offset").evaluate(s,{},a),l.get("icon-anchor").evaluate(s,{},a)),S=!!e.sdf,void 0===t.sdfIcons?t.sdfIcons=S:t.sdfIcons!==S&&o("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}const z=iu(b.horizontal)||b.vertical;t.iconsInText=!!z&&z.iconsInText,(z||_)&&eu(t,s,b,_,n,c,x,v,k,S,a)}var y,m;s&&t.generateCollisionDebugBuffers()}function tu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eu(t,e,r,n,i,s,a,l,u,c,h){let p=s.textMaxSize.evaluate(e,{});void 0===p&&(p=a);const f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},h),y=iu(r.horizontal),m=a/24,g=t.tilePixelRatio*m,x=t.tilePixelRatio*p/24,v=t.tilePixelRatio*l,b=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,_=f.get("icon-padding")*t.tilePixelRatio,k=f.get("text-max-angle")/180*Math.PI,S="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),z="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),A=f.get("symbol-placement"),I=b/2,M=f.get("icon-text-fit");let P;n&&"none"!==M&&(t.allowVerticalPlacement&&r.vertical&&(P=Bl(n,r.vertical,M,f.get("icon-text-fit-padding"),d,m)),y&&(n=Bl(n,y,M,f.get("icon-text-fit-padding"),d,m)));const B=(l,p)=>{p.x<0||p.x>=Cs||p.y<0||p.y>=Cs||function(t,e,r,n,i,s,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,k,S,z){const A=t.addToLineVertexArray(e,r);let I,M,P,B,C=0,V=0,T=0,E=0,D=-1,F=-1;const L={};let $=ps(""),O=0,q=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[O,q]=l.layout.get("text-offset").evaluate(w,{},S).map((t=>t*Ro)):(O=l.layout.get("text-radial-offset").evaluate(w,{},S)*Ro,q=Hl),t.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},S)+90;P=new Gl(u,e,c,h,p,n.vertical,f,d,y,t),a&&(B=new Gl(u,e,c,h,p,a,g,x,y,t))}if(i){const r=l.layout.get("icon-rotate").evaluate(w,{}),n="none"!==l.layout.get("icon-text-fit"),s=jl(i,r,k,n),f=a?jl(a,r,k,n):void 0;M=new Gl(u,e,c,h,p,i,g,x,!1,r),C=4*s.length;const d=t.iconSizeData;let y=null;"source"===d.kind?(y=[Cl*l.layout.get("icon-size").evaluate(w,{})],y[0]>ru&&o(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===d.kind&&(y=[Cl*_.compositeIconSizes[0].evaluate(w,{},S),Cl*_.compositeIconSizes[1].evaluate(w,{},S)],(y[0]>ru||y[1]>ru)&&o(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,y,b,v,w,Xo.none,e,A.lineStartIndex,A.lineLength,-1,S),D=t.icon.placedSymbolArray.length-1,f&&(V=4*f.length,t.addSymbols(t.icon,f,y,b,v,w,Xo.vertical,e,A.lineStartIndex,A.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const r of j){const i=n.horizontal[r];if(!I){$=ps(i.text);const t=l.layout.get("text-rotate").evaluate(w,{},S);I=new Gl(u,e,c,h,p,i,f,d,y,t)}const a=1===i.positionedLines.length;if(T+=nu(t,e,i,s,l,y,w,m,A,n.vertical?Xo.horizontal:Xo.horizontalOnly,a?j:[r],L,D,_,S),a)break}n.vertical&&(E+=nu(t,e,n.vertical,s,l,y,w,m,A,Xo.vertical,["vertical"],L,F,_,S));const R=I?I.boxStartIndex:t.collisionBoxArray.length,U=I?I.boxEndIndex:t.collisionBoxArray.length,N=P?P.boxStartIndex:t.collisionBoxArray.length,Z=P?P.boxEndIndex:t.collisionBoxArray.length,G=M?M.boxStartIndex:t.collisionBoxArray.length,X=M?M.boxEndIndex:t.collisionBoxArray.length,Y=B?B.boxStartIndex:t.collisionBoxArray.length,J=B?B.boxEndIndex:t.collisionBoxArray.length;let K=-1;const W=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;K=W(I,K),K=W(P,K),K=W(M,K),K=W(B,K);const H=K>-1?1:0;H&&(K*=z/Ro),t.glyphOffsetArray.length>=fu.MAX_GLYPHS&&o("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,w.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,L.right>=0?L.right:-1,L.center>=0?L.center:-1,L.left>=0?L.left:-1,L.vertical||-1,D,F,$,R,U,N,Z,G,X,Y,J,c,T,E,C,V,H,0,f,O,q,K)}(t,p,l,r,n,i,P,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,w,S,u,v,_,z,d,e,s,c,h,a)};if("line"===A)for(const i of function(t,e,r,n,i){const s=[];for(let e=0;e<t.length;e++){const r=t[e];let a;for(let t=0;t<r.length-1;t++){let e=r[t],o=r[t+1];e.x<0&&o.x<0||(e.x<0?e=new ui(0,e.y+(0-e.x)/(o.x-e.x)*(o.y-e.y))._round():o.x<0&&(o=new ui(0,e.y+(0-e.x)/(o.x-e.x)*(o.y-e.y))._round()),e.y<0&&o.y<0||(e.y<0?e=new ui(e.x+(0-e.y)/(o.y-e.y)*(o.x-e.x),0)._round():o.y<0&&(o=new ui(e.x+(0-e.y)/(o.y-e.y)*(o.x-e.x),0)._round()),e.x>=n&&o.x>=n||(e.x>=n?e=new ui(n,e.y+(n-e.x)/(o.x-e.x)*(o.y-e.y))._round():o.x>=n&&(o=new ui(n,e.y+(n-e.x)/(o.x-e.x)*(o.y-e.y))._round()),e.y>=i&&o.y>=i||(e.y>=i?e=new ui(e.x+(i-e.y)/(o.y-e.y)*(o.x-e.x),i)._round():o.y>=i&&(o=new ui(e.x+(i-e.y)/(o.y-e.y)*(o.x-e.x),i)._round()),a&&e.equals(a[a.length-1])||(a=[e],s.push(a)),a.push(o)))))}}return s}(e.geometry,0,0,Cs,Cs)){const e=Ol(i,b,k,r.vertical||y,n,24,x,t.overscaling,Cs);for(const r of e){const e=y;e&&su(t,e.text,I,r)||B(i,r)}}else if("line-center"===A){for(const t of e.geometry)if(t.length>1){const e=$l(t,k,r.vertical||y,n,24,x);e&&B(t,e)}}else if("Polygon"===e.type)for(const t of Xa(e.geometry,0)){const e=Jl(t,16);B(t[0],new Tl(e.x,e.y,0))}else if("LineString"===e.type)for(const t of e.geometry)B(t,new Tl(t[0].x,t[0].y,0));else if("Point"===e.type)for(const t of e.geometry)for(const e of t)B([e],new Tl(e.x,e.y,0))}const ru=32640;function nu(t,e,r,n,i,s,a,l,u,c,h,p,f,d,y){const m=function(t,e,r,n,i,s,a,o){const l=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const s=n.rect||{};let c=4,h=!0,p=1,f=0;const d=(i||o)&&n.vertical,y=n.metrics.advance*n.scale/2;if(o&&e.verticalizable){const e=(n.scale-1)*Ro,r=(Ro-n.metrics.width*n.scale)/2;f=t.lineOffset/2-(n.imageName?-r:e)}if(n.imageName){const t=a[n.imageName];h=t.sdf,p=t.pixelRatio,c=1/p}const m=i?[n.x+y,n.y]:[0,0];let g=i?[0,0]:[n.x+y+r[0],n.y+r[1]-f],x=[0,0];d&&(x=g,g=[0,0]);const v=(n.metrics.left-c)*n.scale-y+g[0],b=(-n.metrics.top-c)*n.scale+g[1],w=v+s.w*n.scale/p,_=b+s.h*n.scale/p,k=new ui(v,b),S=new ui(w,b),z=new ui(v,_),A=new ui(w,_);if(d){const t=new ui(-y,y-yl),e=-Math.PI/2,r=12-y,i=new ui(22-r,-(n.imageName?r:0)),s=new ui(...x);k._rotateAround(e,t)._add(i)._add(s),S._rotateAround(e,t)._add(i)._add(s),z._rotateAround(e,t)._add(i)._add(s),A._rotateAround(e,t)._add(i)._add(s)}if(l){const t=Math.sin(l),e=Math.cos(l),r=[e,-t,t,e];k._matMult(r),S._matMult(r),z._matMult(r),A._matMult(r)}const I=new ui(0,0),M=new ui(0,0);u.push({tl:k,tr:S,bl:z,br:A,tex:s,writingMode:e.writingMode,glyphOffset:m,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:I,pixelOffsetBR:M,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,l,i,s,a,n,t.allowVerticalPlacement),g=t.textSizeData;let x=null;"source"===g.kind?(x=[Cl*i.layout.get("text-size").evaluate(a,{})],x[0]>ru&&o(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[Cl*d.compositeTextSizes[0].evaluate(a,{},y),Cl*d.compositeTextSizes[1].evaluate(a,{},y)],(x[0]>ru||x[1]>ru)&&o(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,l,s,a,c,e,u.lineStartIndex,u.lineLength,f,y);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function iu(t){for(const e in t)return t[e];return null}function su(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}const au=ro.VectorTileFeature.types,ou=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lu(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=o?Math.min(ru,Math.round(o[0])):0,d=o?Math.min(ru,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p)}function uu(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function cu(t){for(const e of t.sections)if(Ln(e.text))return!0;return!1}class hu{constructor(t){this.layoutVertexArray=new Ji,this.indexArray=new ts,this.programConfigurations=t,this.segments=new is,this.dynamicLayoutVertexArray=new Ki,this.opacityVertexArray=new Wi,this.placedSymbolArray=new Fi}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fo.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Lo.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,ou,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ar("SymbolBuffers",hu);class pu{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new is,this.collisionVertexArray=new Qi}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,$o.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ar("CollisionBuffers",pu);class fu{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ra([]),this.placementViewportMatrix=ra([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vl(this.zoom,e["text-size"]),this.iconSizeData=Vl(this.zoom,e["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==xu(r,"text-overlap","text-allow-overlap")||"never"!==xu(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>Xo[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new hu(new Ms(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new hu(new Ms(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Oi,this.lineVertexArray=new qi,this.symbolInstances=new $i}calculateGlyphDependencies(t,e,r,n,i){for(let s=0;s<t.length;s++)if(e[t.charCodeAt(s)]=!0,(r||n)&&i){const r=jo[t.charAt(s)];r&&(e[r.charCodeAt(0)]=!0)}}populate(t,e,r){const n=this.layers[0],i=n.layout,s=i.get("text-font"),a=i.get("text-field"),o=i.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof U&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],!l&&!u)return;const h=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new jn(this.zoom);for(const{feature:e,id:a,index:o,sourceLayerIndex:y}of t){const t=n._featureFilter.needGeometry,m=Ds(e,t);if(!n._featureFilter.filter(d,m,r))continue;let g,x;if(t||(m.geometry=Es(e)),l){const t=n.getValueAndResolveTokens("text-field",m,r,f),e=U.factory(t);cu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===$n||this.hasRTLText&&qn.isParsed())&&(g=qo(e,n,m))}if(u){const t=n.getValueAndResolveTokens("icon-image",m,r,f);x=t instanceof N?t:N.fromString(t)}if(!g&&!x)continue;const v=this.sortFeaturesByKey?c.evaluate(m,{},r):void 0;if(this.features.push({id:a,text:g,icon:x,index:o,sourceLayerIndex:y,geometry:m.geometry,properties:e.properties,type:au[e.type],sortKey:v}),x&&(h[x.name]=!0),g){const t=s.evaluate(m,{},r).join(","),e="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Xo.vertical)>=0;for(const r of g.sections)if(r.image)h[r.image.name]=!0;else{const n=Bn(g.toString()),i=r.fontStack||t,s=p[i]=p[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}"line"===i.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=o(f,d,h),i=a(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else f in r?a(f,d,h):d in e?o(f,d,h):(s(u),e[f]=i-1,r[d]=i-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h){const p=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,p,this.canOverlap?s.sortKey:void 0),y=this.glyphOffsetArray.length,m=d.vertexLength,g=this.allowVerticalPlacement&&a===Xo.vertical?Math.PI/2:0,x=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:l,br:u,tex:c,pixelOffsetTL:y,pixelOffsetBR:m,minFontScaleX:v,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:k}=e[n],S=d.vertexLength,z=w[1];lu(f,o.x,o.y,i.x,z+i.y,c.x,c.y,r,_,y.x,y.y,v,b),lu(f,o.x,o.y,a.x,z+a.y,c.x+c.w,c.y,r,_,m.x,y.y,v,b),lu(f,o.x,o.y,l.x,z+l.y,c.x,c.y+c.h,r,_,y.x,m.y,v,b),lu(f,o.x,o.y,u.x,z+u.y,c.x+c.w,c.y+c.h,r,_,m.x,m.y,v,b),uu(t.dynamicLayoutVertexArray,o,g),p.emplaceBack(S,S+1,S+2),p.emplaceBack(S+1,S+2,S+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),n!==e.length-1&&k===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{},h,x&&x[k])}t.placedSymbolArray.emplaceBack(o.x,o.y,y,this.glyphOffsetArray.length-y,m,l,u,o.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,c)}_addCollisionDebugVertex(t,e,r,n,i,s){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,r,n,i,s,a){const o=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=o.vertexLength,u=i.layoutVertexArray,c=i.collisionVertexArray,h=a.anchorX,p=a.anchorY;this._addCollisionDebugVertex(u,c,s,h,p,new ui(t,e)),this._addCollisionDebugVertex(u,c,s,h,p,new ui(r,e)),this._addCollisionDebugVertex(u,c,s,h,p,new ui(r,n)),this._addCollisionDebugVertex(u,c,s,h,p,new ui(t,n)),o.vertexLength+=4;const f=i.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,n){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new pu(Hi,Oo.members,es),this.iconCollisionBox=new pu(Hi,Oo.members,es);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,a,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=s;e<a;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let e=o;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.anchorX+r*a.anchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ar("SymbolBucket",fu,{omit:["layers","collisionBoxArray","features","compareText"]}),fu.MAX_GLYPHS=65535,fu.addDynamicAttributes=uu;const du=new ei({"symbol-placement":new Kn(pr.layout_symbol["symbol-placement"]),"symbol-spacing":new Kn(pr.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Kn(pr.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wn(pr.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Kn(pr.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Kn(pr.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Kn(pr.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Kn(pr.layout_symbol["icon-ignore-placement"]),"icon-optional":new Kn(pr.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Kn(pr.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wn(pr.layout_symbol["icon-size"]),"icon-text-fit":new Kn(pr.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Kn(pr.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wn(pr.layout_symbol["icon-image"]),"icon-rotate":new Wn(pr.layout_symbol["icon-rotate"]),"icon-padding":new Kn(pr.layout_symbol["icon-padding"]),"icon-keep-upright":new Kn(pr.layout_symbol["icon-keep-upright"]),"icon-offset":new Wn(pr.layout_symbol["icon-offset"]),"icon-anchor":new Wn(pr.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Kn(pr.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Kn(pr.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Kn(pr.layout_symbol["text-rotation-alignment"]),"text-field":new Wn(pr.layout_symbol["text-field"]),"text-font":new Wn(pr.layout_symbol["text-font"]),"text-size":new Wn(pr.layout_symbol["text-size"]),"text-max-width":new Wn(pr.layout_symbol["text-max-width"]),"text-line-height":new Kn(pr.layout_symbol["text-line-height"]),"text-letter-spacing":new Wn(pr.layout_symbol["text-letter-spacing"]),"text-justify":new Wn(pr.layout_symbol["text-justify"]),"text-radial-offset":new Wn(pr.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Kn(pr.layout_symbol["text-variable-anchor"]),"text-anchor":new Wn(pr.layout_symbol["text-anchor"]),"text-max-angle":new Kn(pr.layout_symbol["text-max-angle"]),"text-writing-mode":new Kn(pr.layout_symbol["text-writing-mode"]),"text-rotate":new Wn(pr.layout_symbol["text-rotate"]),"text-padding":new Kn(pr.layout_symbol["text-padding"]),"text-keep-upright":new Kn(pr.layout_symbol["text-keep-upright"]),"text-transform":new Wn(pr.layout_symbol["text-transform"]),"text-offset":new Wn(pr.layout_symbol["text-offset"]),"text-allow-overlap":new Kn(pr.layout_symbol["text-allow-overlap"]),"text-overlap":new Kn(pr.layout_symbol["text-overlap"]),"text-ignore-placement":new Kn(pr.layout_symbol["text-ignore-placement"]),"text-optional":new Kn(pr.layout_symbol["text-optional"])});var yu={paint:new ei({"icon-opacity":new Wn(pr.paint_symbol["icon-opacity"]),"icon-color":new Wn(pr.paint_symbol["icon-color"]),"icon-halo-color":new Wn(pr.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wn(pr.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wn(pr.paint_symbol["icon-halo-blur"]),"icon-translate":new Kn(pr.paint_symbol["icon-translate"]),"icon-translate-anchor":new Kn(pr.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wn(pr.paint_symbol["text-opacity"]),"text-color":new Wn(pr.paint_symbol["text-color"],{runtimeType:P,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Wn(pr.paint_symbol["text-halo-color"]),"text-halo-width":new Wn(pr.paint_symbol["text-halo-width"]),"text-halo-blur":new Wn(pr.paint_symbol["text-halo-blur"]),"text-translate":new Kn(pr.paint_symbol["text-translate"]),"text-translate-anchor":new Kn(pr.paint_symbol["text-translate-anchor"])}),layout:du};class mu{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:z,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ar("FormatSectionOverride",mu,{omit:["defaultValue"]});class gu extends ni{constructor(t){super(t,yu)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||$e(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new fu(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of yu.paint.overridableProperties){if(!gu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new mu(e),n=new Le(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new qe("source",n):new je("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new Yn(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&gu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=yu.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof U)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof J&&X(e.value)===T?s(e.value.sections):e instanceof Q?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}}function xu(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var vu={paint:new ei({"background-color":new Kn(pr.paint_background["background-color"]),"background-pattern":new Qn(pr.paint_background["background-pattern"]),"background-opacity":new Kn(pr.paint_background["background-opacity"])})},bu={paint:new ei({"raster-opacity":new Kn(pr.paint_raster["raster-opacity"]),"raster-hue-rotate":new Kn(pr.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Kn(pr.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Kn(pr.paint_raster["raster-brightness-max"]),"raster-saturation":new Kn(pr.paint_raster["raster-saturation"]),"raster-contrast":new Kn(pr.paint_raster["raster-contrast"]),"raster-resampling":new Kn(pr.paint_raster["raster-resampling"]),"raster-fade-duration":new Kn(pr.paint_raster["raster-fade-duration"])})};class wu extends ni{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}const _u={circle:class extends ni{constructor(t){super(t,ta)}createBucket(t){return new Ls(t)}queryRadius(t){const e=t;return Js("circle-radius",this,e)+Js("circle-stroke-width",this,e)+Ks(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Ws(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>ia(t,e)))}(l,o),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:ia(e,o);let r=p;const n=na([],[e.x,e.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=n[3]/s.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=s.cameraToCenterDistance/n[3]),Os(h,t,r))return!0}return!1}},heatmap:class extends ni{constructor(t){super(t,aa),this._updateColorRamp()}createBucket(t){return new sa(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=function(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new ha({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends ni{constructor(t){super(t,pa)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends ni{constructor(t){super(t,Qa)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Wa(t)}queryRadius(){return Ks(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){return qs(Ws(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,a),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ni{constructor(t){super(t,wo)}createBucket(t){return new xo(t)}queryRadius(){return Ks(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Ws(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,a),u=this.paint.get("fill-extrusion-height").evaluate(e,r),c=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e,r,n){const i=[];for(const r of t){const t=[r.x,r.y,0,1];na(t,t,e),i.push(new ui(t[0]/t[3],t[1]/t[3]))}return i}(l,o),p=function(t,e,r,n){const i=[],s=[],a=n[8]*e,o=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,h=n[9]*r,p=n[10]*r,f=n[11]*r;for(const e of t){const t=[],r=[];for(const i of e){const e=i.x,s=i.y,d=n[0]*e+n[4]*s+n[12],y=n[1]*e+n[5]*s+n[13],m=n[2]*e+n[6]*s+n[14],g=n[3]*e+n[7]*s+n[15],x=m+l,v=g+u,b=d+c,w=y+h,_=m+p,k=g+f,S=new ui((d+a)/v,(y+o)/v);S.z=x/v,t.push(S);const z=new ui(b/k,w/k);z.z=_/k,r.push(z)}i.push(t),s.push(r)}return[i,s]}(n,c,u,o);return function(t,e,r){let n=1/0;qs(r,e)&&(n=ko(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];$s(r,i)&&(n=Math.min(n,ko(r,i)))}}return n!==1/0&&n}(p[0],p[1],h)}},line:class extends ni{constructor(t){super(t,To),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ct,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Eo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Co(t)}queryRadius(t){const e=t,r=Do(Js("line-width",this,e),Js("line-gap-width",this,e)),n=Js("line-offset",this,e);return r/2+Math.abs(n)+Ks(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){const o=Ws(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,a),l=a/2*Do(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){const r=[];for(let n=0;n<t.length;n++){const i=t[n],s=[];for(let t=0;t<i.length;t++){const r=i[t-1],n=i[t],a=i[t+1],o=0===t?new ui(0,0):n.sub(r)._unit()._perp(),l=t===i.length-1?new ui(0,0):a.sub(n)._unit()._perp(),u=o._add(l)._unit(),c=u.x*l.x+u.y*l.y;0!==c&&u._mult(1/c),s.push(u._mult(e)._add(n))}r.push(s)}return r}(n,u*a)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Xs(t,i[e]))return!0;if(js(t,i,r))return!0}return!1}(o,n,l)}isTileClipped(){return!0}},symbol:gu,background:class extends ni{constructor(t){super(t,vu)}},raster:class extends ni{constructor(t){super(t,bu)}}};function ku(t){return"custom"===t.type?new wu(t):new _u[t.type](t)}var Su=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function zu(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${zu(r)},`;return`${e}]`}const r=Object.keys(t).sort();let n="{";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${zu(t[r[e]])},`;return`${n}}`}function Au(t){let e="";for(const r of Su)e+=`/${zu(t[r])}`;return e}class Iu{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,e){for(const e of t){this._layerConfigs[e.id]=e;const t=this._layers[e.id]=ku(e);t._featureFilter=zr(t.filter),this.keyCache[e.id]&&delete this.keyCache[e.id]}for(const t of e)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||Au(t[n]);e&&(e[t[n].id]=i);let s=r[i];s||(s=r[i]=[]),s.push(t[n])}const n=[];for(const t in r)n.push(r[t]);return n}(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),r=e[0];if("none"===r.visibility)continue;const n=r.source||"";let i=this.familiesBySource[n];i||(i=this.familiesBySource[n]={});const s=r.sourceLayer||"_geojsonTileLayer";let a=i[s];a||(a=i[s]=[]),a.push(e)}}}class Mu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Pu{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Bu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new d(Cs,16,0),this.grid3D=new d(Cs,16,0),this.featureIndexArray=new Ri,this.promoteId=e}insert(t,e,r,n,i,s){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=s?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Cs&&n[1]<Cs&&n[2]>=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ro.VectorTile(new Uo(this.rawTileData)).layers,this.sourceLayerCoder=new Mu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},s=Cs/t.tileSize/t.scale,a=zr(i.filter),o=t.queryGeometry,l=t.queryPadding*s,u=Vu(o),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=Vu(t.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,((e,r,n,i)=>function(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return!0;const s=[new ui(e,r),new ui(e,i),new ui(n,i),new ui(n,r)];if(t.length>2)for(const e of s)if(Xs(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Ys(t[e],t[e+1],s))return!0;return!1}(t.cameraQueryGeometry,e-l,r-l,n+l,i+l)));for(const t of p)c.push(t);c.sort(Tu);const f={};let d;for(let l=0;l<c.length;l++){const u=c[l];if(u===d)continue;d=u;const h=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(f,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,i.layers,i.availableImages,e,r,n,((e,r,n)=>(p||(p=Es(e)),r.queryIntersectsFeature(o,e,n,p,this.z,t.transform,s,t.pixelPosMatrix))))}return f}loadMatchingFeature(t,e,r,i,s,a,o,l,u,c,h){const p=this.bucketLayerIDs[e];if(a&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(a,p))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(i);if(s.needGeometry){const t=Ds(d,!0);if(!s.filter(new jn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!s.filter(new jn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e<p.length;e++){const r=p[e];if(a&&a.indexOf(r)<0)continue;const s=l[r];if(!s)continue;let f={};y&&c&&(f=c.getState(s.sourceLayer||"_geojsonTileLayer",y));const m=n({},u[r]);m.paint=Cu(m.paint,s.paint,d,f,o),m.layout=Cu(m.layout,s.layout,d,f,o);const g=!h||h(d,s,f);if(!g)continue;const x=new Pu(d,this.z,this.x,this.y,y);x.layer=m;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:i,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=zr(i);for(const i of t)this.loadMatchingFeature(l,r,n,i,u,s,a,o,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r))),r}}function Cu(t,e,r,n,s){return i(t,((t,i)=>{const a=e instanceof Jn?e.get(i):null;return a&&a.evaluate?a.evaluate(r,n,s):a}))}function Vu(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return{minX:e,minY:r,maxX:n,maxY:i}}function Tu(t,e){return e-t}ar("FeatureIndex",Bu,{omit:["rawTileData","sourceLayerCoder"]});class Eu{constructor(t){const e={},r=[];for(const n in t){const i=t[n],s=e[n]={};for(const t in i){const e=i[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(n),s[t]={rect:n,metrics:e.metrics}}}const{w:n,h:i}=pl(r),s=new ca({width:n||1,height:i||1});for(const r in t){const n=t[r];for(const t in n){const i=n[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const a=e[r][t].rect;ca.copy(i.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},i.bitmap)}}this.image=s,this.positions=e}}function Du(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}ar("GlyphAtlas",Eu);class Fu{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof $u?new $u(t.lng,t.lat):$u.convert(t),this}setSouthWest(t){return this._sw=t instanceof $u?new $u(t.lng,t.lat):$u.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof $u)n=t,i=t;else{if(!(t instanceof Fu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Fu.convert(t)):this.extend($u.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new $u(n.lng,n.lat),this._ne=new $u(i.lng,i.lat)),this}getCenter(){return new $u((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 $u(this.getWest(),this.getNorth())}getSouthEast(){return new $u(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:e,lat:r}=$u.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof Fu?t:t?new Fu(t):t}}const Lu=6371008.8;class $u{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $u(function(t,e,r){const n=((t-e)%360+360)%360+e;return n===e?180:n}(this.lng,-180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Lu*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Fu(new $u(this.lng-r,this.lat-e),new $u(this.lng+r,this.lat+e))}static convert(t){if(t instanceof $u)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new $u(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new $u(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Ou=2*Math.PI*Lu;function qu(t){return Ou*Math.cos(t*Math.PI/180)}function ju(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Ru{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=$u.convert(t);return new Ru((180+r.lng)/360,(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r.lat*Math.PI/360)))/360,function(t,e){return t/qu(e)}(e,r.lat))}toLngLat(){return new $u(360*this.x-180,ju(this.y))}toAltitude(){return this.z*qu(ju(this.y))}meterInMercatorCoordinateUnits(){return 1/Ou*(t=ju(this.y),1/Math.cos(t*Math.PI/180));var t}}class Uu{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Gu(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(s=this.y,a=this.z,o=Du(256*(i=this.x),256*(s=Math.pow(2,a)-s-1),a),l=Du(256*(i+1),256*(s+1),a),o[0]+","+o[1]+","+l[0]+","+l[1]);var i,s,a,o,l;const u=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}getTilePoint(t){const e=Math.pow(2,this.z);return new ui((t.x*e-this.x)*Cs,(t.y*e-this.y)*Cs)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Nu{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Gu(t,e.z,e.z,e.x,e.y)}}class Zu{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Uu(r,+n,+i),this.key=Gu(e,t,r,n,i)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Zu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){const r=this.canonical.z-t;return t>this.canonical.z?Gu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Gu(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Zu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Zu(e,this.wrap,e,r,n),new Zu(e,this.wrap,e,r+1,n),new Zu(e,this.wrap,e,r,n+1),new Zu(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Zu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Zu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Nu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Ru(t.x-this.wrap,t.y))}}function Gu(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);const s=1<<r;return(s*s*t+s*i+n).toString(36)+r.toString(36)+e.toString(36)}ar("CanonicalTileID",Uu),ar("OverscaledTileID",Zu,{omit:["posMatrix"]});class Xu{constructor(t){this.tileID=new Zu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId}parse(t,e,r,n,s){this.status="parsing",this.data=t,this.collisionBoxArray=new Ei;const a=new Mu(Object.keys(t.layers).sort()),l=new Bu(this.tileID,this.promoteId);l.bucketLayerIDs=[];const u={},c={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},h=e.familiesBySource[this.source];for(const e in h){const n=t.layers[e];if(!n)continue;1===n.version&&o(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const i=a.encode(e),s=[];for(let t=0;t<n.length;t++){const r=n.feature(t),a=l.getId(r,e);s.push({feature:r,id:a,index:t,sourceLayerIndex:i})}for(const t of h[e]){const e=t[0];e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(Yu(t,this.zoom,r),(u[e.id]=e.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:i,sourceID:this.source})).populate(s,c,this.tileID.canonical),l.bucketLayerIDs.push(t.map((t=>t.id))))}}let p,f,d,y;const m=i(c.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(m).length?n.send("getGlyphs",{uid:this.uid,stacks:m},((t,e)=>{p||(p=t,f=e,v.call(this))})):f={};const g=Object.keys(c.iconDependencies);g.length?n.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{p||(p=t,d=e,v.call(this))})):d={};const x=Object.keys(c.patternDependencies);function v(){if(p)return s(p);if(f&&d&&y){const t=new Eu(f),e=new dl(d,y);for(const n in u){const i=u[n];i instanceof fu?(Yu(i.layers,this.zoom,r),Ql(i,f,t.positions,d,e.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):i.hasPattern&&(i instanceof Co||i instanceof Wa||i instanceof xo)&&(Yu(i.layers,this.zoom,r),i.addFeatures(c,this.tileID.canonical,e.patternPositions))}this.status="done",s(null,{buckets:Object.values(u).filter((t=>!t.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:e,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?t.positions:null})}}x.length?n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{p||(p=t,y=e,v.call(this))})):y={},v.call(this)}}function Yu(t,e,r){const n=new jn(e);for(const e of t)e.recalculate(n,r)}var Ju;!function(t){t.create="create",t.load="load",t.fullLoad="fullLoad"}(Ju||(Ju={}));class Ku{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}}function Wu(t,e){const r=function(t,e){return ir(n(t,{type:"arrayBuffer"}),e)}(t.request,((t,r,n,i)=>{t?e(t):r&&e(null,{vectorTile:new ro.VectorTile(new Uo(r)),rawData:r,cacheControl:n,expires:i})}));return()=>{r.cancel(),e()}}class Hu{constructor(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||Wu,this.loading={},this.loaded={}}loadTile(t,e){const r=t.uid;this.loading||(this.loading={});const i=!!(t&&t.request&&t.request.collectResourceTiming)&&new Ku(t.request),s=this.loading[r]=new Xu(t);s.abort=this.loadVectorData(t,((t,a)=>{if(delete this.loading[r],t||!a)return s.status="done",this.loaded[r]=s,e(t);const o=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);const u={};if(i){const t=i.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}s.vectorTile=a.vectorTile,s.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t);e(null,n({rawTileData:o.slice(0)},r,l,u))})),this.loaded=this.loaded||{},this.loaded[r]=s}))}reloadTile(t,e){const r=this.loaded,n=t.uid,i=this;if(r&&r[n]){const s=r[n];s.showCollisionBoxes=t.showCollisionBoxes;const a=(t,r)=>{const n=s.reloadCallback;n&&(delete s.reloadCallback,s.parse(s.vectorTile,i.layerIndex,this.availableImages,i.actor,n)),e(t,r)};"parsing"===s.status?s.reloadCallback=a:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()}}class Qu{constructor(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void o(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)]}get(t,e){const r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[n],r[n+1],r[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return(256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}getPixels(){return new ha({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+o,e+l)]}}ar("DEMData",Qu);class tc{constructor(){this.loaded={}}loadTile(t,e){const{uid:r,encoding:n,rawImageData:i}=t,s=f(i)?this.getImageData(i):i,a=new Qu(r,s,n);this.loaded=this.loaded||{},this.loaded[r]=a,e(null,a)}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const e=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new ha({width:e.width,height:e.height},e.data)}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}var ec=function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)rc(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)rc(e.coordinates[n],r);return e};function rc(t,e){if(0!==t.length){nc(t[0],e);for(var r=1;r<t.length;r++)nc(t[r],!e)}}function nc(t,e){for(var r=0,n=0,i=0,s=t.length,a=s-1;i<s;a=i++){var o=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+o;n+=Math.abs(r)>=Math.abs(o)?r-l+o:o-l+r,r=l}r+n>=0!=!!e&&t.reverse()}const ic=ro.VectorTileFeature.prototype.toGeoJSON;class sc{constructor(t){this._feature=t,this.extent=Cs,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const e of this._feature.geometry)t.push([new ui(e[0],e[1])]);return t}{const t=[];for(const e of this._feature.geometry){const r=[];for(const t of e)r.push(new ui(t[0],t[1]));t.push(r)}return t}}toGeoJSON(t,e,r){return ic.call(this,t,e,r)}}class ac{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=Cs,this.length=t.length,this._features=t}feature(t){return new sc(this._features[t])}}var oc={exports:{}},lc=ui,uc=ro.VectorTileFeature,cc=hc;function hc(t,e){this.options=e||{},this.features=t,this.length=t.length}function pc(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}hc.prototype.feature=function(t){return new pc(this.features[t],this.options.extent)},pc.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new lc(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},pc.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,s=0;s<t.length;s++)for(var a=t[s],o=0;o<a.length;o++){var l=a[o];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},pc.prototype.toGeoJSON=uc.prototype.toGeoJSON;var fc=Uo,dc=cc;function yc(t){var e=new fc;return function(t,e){for(var r in t.layers)e.writeMessage(3,mc,t.layers[r])}(t,e),e.finish()}function mc(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,gc,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var s=n.values;for(r=0;r<s.length;r++)e.writeMessage(4,_c,s[r])}function gc(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,xc,t),e.writeVarintField(3,r.type),e.writeMessage(4,wc,r)}function xc(t,e){var r=t.feature,n=t.keys,i=t.values,s=t.keycache,a=t.valuecache;for(var o in r.properties){var l=r.properties[o],u=s[o];if(null!==l){void 0===u&&(n.push(o),s[o]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}}function vc(t,e){return(e<<3)+(7&t)}function bc(t){return t<<1^t>>31}function wc(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,s=0,a=r.length,o=0;o<a;o++){var l=r[o],u=1;1===n&&(u=l.length),e.writeVarint(vc(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(vc(2,c-1));var p=l[h].x-i,f=l[h].y-s;e.writeVarint(bc(p)),e.writeVarint(bc(f)),i+=p,s+=f}3===n&&e.writeVarint(vc(7,1))}}function _c(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}oc.exports=yc,oc.exports.fromVectorTileJs=yc,oc.exports.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new dc(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return yc({layers:r})},oc.exports.GeoJSONWrapper=dc;var kc=oc.exports;function Sc(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;zc(t,e,a,n,i,s%2),Sc(t,e,r,n,a-1,s+1),Sc(t,e,r,a+1,i,s+1)}function zc(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);zc(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(Ac(t,e,n,r),e[2*i+s]>a&&Ac(t,e,n,i);o<l;){for(Ac(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?Ac(t,e,n,l):(l++,Ac(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Ac(t,e,r,n){Ic(t,r,n),Ic(e,2*r,2*n),Ic(e,2*r+1,2*n+1)}function Ic(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Mc(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}const Pc=t=>t[0],Bc=t=>t[1];class Cc{constructor(t,e=Pc,r=Bc,n=64,i=Float64Array){this.nodeSize=n,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),o=this.coords=new i(2*t.length);for(let n=0;n<t.length;n++)a[n]=n,o[2*n]=e(t[n]),o[2*n+1]=r(t[n]);Sc(a,o,n,0,a.length-1,0)}range(t,e,r,n){return function(t,e,r,n,i,s,a){const o=[0,t.length-1,0],l=[];let u,c;for(;o.length;){const h=o.pop(),p=o.pop(),f=o.pop();if(p-f<=a){for(let a=f;a<=p;a++)u=e[2*a],c=e[2*a+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[a]);continue}const d=Math.floor((f+p)/2);u=e[2*d],c=e[2*d+1],u>=r&&u<=i&&c>=n&&c<=s&&l.push(t[d]);const y=(h+1)%2;(0===h?r<=u:n<=c)&&(o.push(f),o.push(d-1),o.push(y)),(0===h?i>=u:s>=c)&&(o.push(d+1),o.push(p),o.push(y))}return l}(this.ids,this.coords,t,e,r,n,this.nodeSize)}within(t,e,r){return function(t,e,r,n,i,s){const a=[0,t.length-1,0],o=[],l=i*i;for(;a.length;){const u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=s){for(let i=h;i<=c;i++)Mc(e[2*i],e[2*i+1],r,n)<=l&&o.push(t[i]);continue}const p=Math.floor((h+c)/2),f=e[2*p],d=e[2*p+1];Mc(f,d,r,n)<=l&&o.push(t[p]);const y=(u+1)%2;(0===u?r-i<=f:n-i<=d)&&(a.push(h),a.push(p-1),a.push(y)),(0===u?r+i>=f:n+i>=d)&&(a.push(p+1),a.push(c),a.push(y))}return o}(this.ids,this.coords,t,e,r,this.nodeSize)}}const Vc={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Tc=Math.fround||(Ec=new Float32Array(1),t=>(Ec[0]=+t,Ec[0]));var Ec;class Dc{constructor(t){this.options=Uc(Object.create(Vc),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:r,maxZoom:n,nodeSize:i}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;let a=[];for(let e=0;e<t.length;e++)t[e].geometry&&a.push(Lc(t[e],e));this.trees[n+1]=new Cc(a,Nc,Zc,i,Float32Array),e&&console.timeEnd(s);for(let t=n;t>=r;t--){const r=+Date.now();a=this._cluster(a,t),this.trees[t]=new Cc(a,Nc,Zc,i,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,a.length,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){const t=this.getClusters([r,n,180,s],e),a=this.getClusters([-180,n,i,s],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],o=a.range(qc(r),jc(s),qc(i),jc(n)),l=[];for(const t of o){const e=a.points[t];l.push(e.numPoints?$c(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.points[e];if(!s)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),o=i.within(s.x,s.y,a),l=[];for(const e of o){const r=i.points[e];r.parentId===t&&l.push(r.numPoints?$c(r):this.points[r.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){const n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:a}=this.options,o=a/s,l=(r-o)/i,u=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,l,(e+1+o)/i,u),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,l,1,u),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,l,o/i,u),n.points,-1,r,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?i+s.point_count<=n?i+=s.point_count:i=this._appendLeaves(t,s.cluster_id,r,n,i):i<n?i++:t.push(e),t.length===r)break}return i}_addTileFeatures(t,e,r,n,i,s){for(const a of t){const t=e[a],o=t.numPoints;let l,u,c;if(o)l=Oc(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=qc(e.geometry.coordinates[0]),c=jc(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;o?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const r=[],{radius:n,extent:i,reduce:s,minPoints:a}=this.options,o=n/(i*Math.pow(2,e));for(let n=0;n<t.length;n++){const i=t[n];if(i.zoom<=e)continue;i.zoom=e;const l=this.trees[e+1],u=l.within(i.x,i.y,o),c=i.numPoints||1;let h=c;for(const t of u){const r=l.points[t];r.zoom>e&&(h+=r.numPoints||1)}if(h>c&&h>=a){let t=i.x*c,a=i.y*c,o=s&&c>1?this._map(i,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const r of u){const n=l.points[r];if(n.zoom<=e)continue;n.zoom=e;const u=n.numPoints||1;t+=n.x*u,a+=n.y*u,n.parentId=p,s&&(o||(o=this._map(i,!0)),s(o,this._map(n)))}i.parentId=p,r.push(Fc(t/h,a/h,p,h,o))}else if(r.push(i),h>1)for(const t of u){const n=l.points[t];n.zoom<=e||(n.zoom=e,r.push(n))}}return r}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?Uc({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?Uc({},n):n}}function Fc(t,e,r,n,i){return{x:Tc(t),y:Tc(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function Lc(t,e){const[r,n]=t.geometry.coordinates;return{x:Tc(qc(r)),y:Tc(jc(n)),zoom:1/0,index:e,parentId:-1}}function $c(t){return{type:"Feature",id:t.id,properties:Oc(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),Rc(t.y)]}};var e}function Oc(t){const e=t.numPoints,r=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return Uc(Uc({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function qc(t){return t/360+.5}function jc(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Rc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Uc(t,e){for(const r in e)t[r]=e[r];return t}function Nc(t){return t.x}function Zc(t){return t.y}function Gc(t,e,r,n){for(var i,s=n,a=r-e>>1,o=r-e,l=t[e],u=t[e+1],c=t[r],h=t[r+1],p=e+3;p<r;p+=3){var f=Xc(t[p],t[p+1],l,u,c,h);if(f>s)i=p,s=f;else if(f===s){var d=Math.abs(p-a);d<o&&(i=p,o=d)}}s>n&&(i-e>3&&Gc(t,e,i,n),t[i+2]=s,r-i>3&&Gc(t,i,r,n))}function Xc(t,e,r,n,i,s){var a=i-r,o=s-n;if(0!==a||0!==o){var l=((t-r)*a+(e-n)*o)/(a*a+o*o);l>1?(r=i,n=s):l>0&&(r+=a*l,n+=o*l)}return(a=t-r)*a+(o=e-n)*o}function Yc(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Jc(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)Jc(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)Jc(t,e[n][i])}(i),i}function Jc(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Kc(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,s=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),o=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)Wc(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Wc(i[u],o);else if("LineString"===s)Hc(i,o,a,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(u=0;u<i.length;u++)Hc(i[u],o=[],a,!1),t.push(Yc(l,"LineString",o,e.properties));return}Qc(i,o,a,!1)}else if("Polygon"===s)Qc(i,o,a,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<e.geometry.geometries.length;u++)Kc(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Qc(i[u],c,a,!0),o.push(c)}}t.push(Yc(l,s,o,e.properties))}}function Wc(t,e){e.push(th(t[0])),e.push(eh(t[1])),e.push(0)}function Hc(t,e,r,n){for(var i,s,a=0,o=0;o<t.length;o++){var l=th(t[o][0]),u=eh(t[o][1]);e.push(l),e.push(u),e.push(0),o>0&&(a+=n?(i*u-l*s)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-s,2))),i=l,s=u}var c=e.length-3;e[2]=1,Gc(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Qc(t,e,r,n){for(var i=0;i<t.length;i++){var s=[];Hc(t[i],s,r,n),e.push(s)}}function th(t){return t/360+.5}function eh(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function rh(t,e,r,n,i,s,a,o){if(n/=e,s>=(r/=e)&&a<n)return t;if(a<r||s>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)l.push(c);else if(!(d<r||f>=n)){var y=[];if("Point"===p||"MultiPoint"===p)nh(h,y,r,n,i);else if("LineString"===p)ih(h,y,r,n,i,!1,o.lineMetrics);else if("MultiLineString"===p)ah(h,y,r,n,i,!1);else if("Polygon"===p)ah(h,y,r,n,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var g=[];ah(h[m],g,r,n,i,!0),g.length&&y.push(g)}if(y.length){if(o.lineMetrics&&"LineString"===p){for(m=0;m<y.length;m++)l.push(Yc(c.id,p,y[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===y.length?(p="LineString",y=y[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===y.length?"Point":"MultiPoint"),l.push(Yc(c.id,p,y,c.tags))}}}return l.length?l:null}function nh(t,e,r,n,i){for(var s=0;s<t.length;s+=3){var a=t[s+i];a>=r&&a<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function ih(t,e,r,n,i,s,a){for(var o,l,u=sh(t),c=0===i?lh:uh,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;a&&(o=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<r?v>r&&(l=c(u,f,d,m,g,r),a&&(u.start=h+o*l)):x>n?v<n&&(l=c(u,f,d,m,g,n),a&&(u.start=h+o*l)):oh(u,f,d,y),v<r&&x>=r&&(l=c(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=c(u,f,d,m,g,n),b=!0),!s&&b&&(a&&(u.end=h+o*l),e.push(u),u=sh(t)),a&&(h+=o)}var w=t.length-3;f=t[w],d=t[w+1],y=t[w+2],(x=0===i?f:d)>=r&&x<=n&&oh(u,f,d,y),w=u.length-3,s&&w>=3&&(u[w]!==u[0]||u[w+1]!==u[1])&&oh(u,u[0],u[1],u[2]),u.length&&e.push(u)}function sh(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ah(t,e,r,n,i,s){for(var a=0;a<t.length;a++)ih(t[a],e,r,n,i,s,!1)}function oh(t,e,r,n){t.push(e),t.push(r),t.push(n)}function lh(t,e,r,n,i,s){var a=(s-e)/(n-e);return t.push(s),t.push(r+(i-r)*a),t.push(1),a}function uh(t,e,r,n,i,s){var a=(s-r)/(i-r);return t.push(e+(n-e)*a),t.push(s),t.push(1),a}function ch(t,e){for(var r=[],n=0;n<t.length;n++){var i,s=t[n],a=s.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=hh(s.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var o=0;o<s.geometry.length;o++)i.push(hh(s.geometry[o],e))}else if("MultiPolygon"===a)for(i=[],o=0;o<s.geometry.length;o++){for(var l=[],u=0;u<s.geometry[o].length;u++)l.push(hh(s.geometry[o][u],e));i.push(l)}r.push(Yc(s.id,a,i,s.tags))}return r}function hh(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ph(t,e){if(t.transformed)return t;var r,n,i,s=1<<t.z,a=t.x,o=t.y;for(r=0;r<t.features.length;r++){var l=t.features[r],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(fh(u[n],u[n+1],e,s,a,o));else for(n=0;n<u.length;n++){var h=[];for(i=0;i<u[n].length;i+=2)h.push(fh(u[n][i],u[n][i+1],e,s,a,o));l.geometry.push(h)}}return t.transformed=!0,t}function fh(t,e,r,n,i,s){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-s))]}function dh(t,e,r,n,i){for(var s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<t.length;o++){a.numFeatures++,yh(a,t[o],s,i);var l=t[o].minX,u=t[o].minY,c=t[o].maxX,h=t[o].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function yh(t,e,r,n){var i=e.geometry,s=e.type,a=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<i.length;o+=3)a.push(i[o]),a.push(i[o+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)mh(a,i,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<i.length;o++)mh(a,i[o],t,r,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<i.length;l++){var u=i[l];for(o=0;o<u.length;o++)mh(a,u[o],t,r,!0,0===o)}if(a.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function mh(t,e,r,n,i,s){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var o=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(r.numSimplified++,o.push(e[l]),o.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,s=i-2;n<i;s=n,n+=2)r+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],o=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=o}}(o,s),t.push(o)}}function gh(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)Kc(r,t.features[n],e,n);else Kc(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(t,e){var r=e.buffer/e.extent,n=t,i=rh(t,1,-1-r,r,0,-1,2,e),s=rh(t,1,1-r,2+r,0,-1,2,e);return(i||s)&&(n=rh(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=ch(i,1).concat(n)),s&&(n=n.concat(ch(s,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}function xh(t,e,r){return 32*((1<<t)*r+e)+t}function vh(t,e){const r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);const i=new ac(n.features);let s=kc(i);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),e(null,{vectorTile:i,rawData:s.buffer})}gh.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},gh.prototype.splitTile=function(t,e,r,n,i,s,a){for(var o=[t,e,r,n],l=this.options,u=l.debug;o.length;){n=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();var c=1<<e,h=xh(e,r,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=dh(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(s/d)||n!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var y,m,g,x,v,b,w=.5*l.buffer/l.extent,_=.5-w,k=.5+w,S=1+w;y=m=g=x=null,v=rh(t,c,r-w,r+k,0,p.minX,p.maxX,l),b=rh(t,c,r+_,r+S,0,p.minX,p.maxX,l),t=null,v&&(y=rh(v,c,n-w,n+k,1,p.minY,p.maxY,l),m=rh(v,c,n+_,n+S,1,p.minY,p.maxY,l),v=null),b&&(g=rh(b,c,n-w,n+k,1,p.minY,p.maxY,l),x=rh(b,c,n+_,n+S,1,p.minY,p.maxY,l),b=null),u>1&&console.timeEnd("clipping"),o.push(y||[],e+1,2*r,2*n),o.push(m||[],e+1,2*r,2*n+1),o.push(g||[],e+1,2*r+1,2*n),o.push(x||[],e+1,2*r+1,2*n+1)}}},gh.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,s=n.debug;if(t<0||t>24)return null;var a=1<<t,o=xh(t,e=(e%a+a)%a,r);if(this.tiles[o])return ph(this.tiles[o],i);s>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[xh(u,c,h)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,c,h),s>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[o]?ph(this.tiles[o],i):null):null};class bh extends Hu{constructor(t,e,r,n){super(t,e,r,vh),n&&(this.loadGeoJSON=n)}loadData(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const t=this._pendingCallback,e=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new Ku(e.request);this.loadGeoJSON(e,((n,i)=>{if(n||!i)return t(n);if("object"!=typeof i)return t(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{ec(i,!0);try{if(e.filter){const t=Oe(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=i.features.filter((e=>t.value.evaluate({zoom:0},e)));i={type:"FeatureCollection",features:r}}this._geoJSONIndex=e.cluster?new Dc(function({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(e);for(const t of a){const[i,s]=e[t],a=Oe(s),o=Oe("string"==typeof i?[i,["accumulated"],["get",t]]:i);r[t]=a.value,n[t]=o.value}return t.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(i,s);return e},t.reduce=(t,e)=>{s.properties=e;for(const e of a)i.accumulated=t[e],t[e]=n[e].evaluate(i,s)},t}(e)).load(i.features):function(t,e){return new gh(t,e)}(i,e.geojsonVtOptions)}catch(n){return t(n)}this.loaded={};const s={};if(r){const t=r.finish();t&&(s.resourceTiming={},s.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}t(null,s)}}))}coalesce(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())}reloadTile(t,e){const r=this.loaded;return r&&r[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(t,e){if(t.request)!function(t,e){ir(n(t,{type:"json"}),e)}(t.request,e);else{if("string"!=typeof t.data)return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return e(null,JSON.parse(t.data))}catch(r){return e(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class wh{constructor(t){this.self=t,this.actor=new hr(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Hu,geojson:bh},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=t=>{if(qn.isParsed())throw new Error("RTL text plugin already registered.");qn.applyArabicShaping=t.applyArabicShaping,qn.processBidirectionalText=t.processBidirectionalText,qn.processStyledBidirectionalText=t.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,r){this.availableImages[t]=e;for(const r in this.workerSources[t]){const n=this.workerSources[t][r];for(const t in n)n[t].availableImages=e}r()}setLayers(t,e,r){this.getLayerIndex(t).replace(e),r()}updateLayers(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()}loadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)}loadDEMTile(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)}reloadTile(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)}abortTile(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)}removeTile(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,r){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}loadWorkerSource(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}}syncRTLPluginState(t,e,r){try{qn.setState(e);const t=qn.getPluginURL();if(qn.isLoaded()&&!qn.isParsed()&&null!=t){this.self.importScripts(t);const e=qn.isParsed();r(e?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),e)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new Iu),e}getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const n={send:(e,r,n)=>{this.actor.send(e,r,n,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][r]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new tc),this.demWorkerSources[t][e]}enforceCacheSizeLimit(t,e){!function(t){Ye(),Ge&&Ge.then((e=>{e.keys().then((r=>{for(let n=0;n<r.length-t;n++)e.delete(r[n])}))}))}(e)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new wh(self)),wh}();
|
|
2
2
|
//# sourceMappingURL=maplibre-gl-csp-worker.js.map
|