playbook_ui_docs 12.26.0.pre.alpha.multiselectfixes821 → 12.26.0.pre.alpha.multiselectfixes825

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/dist/playbook-doc.js +1 -1
  3. metadata +1 -1
data/dist/playbook-doc.js CHANGED
@@ -18,7 +18,7 @@ r.version="2.29.4",t=xt,r.fn=gn,r.min=function(){var e=[].slice.call(arguments,0
18
18
  Copyright (c) 2015 Jed Watson.
19
19
  Based on code that is Copyright 2013-2015, Facebook, Inc.
20
20
  All rights reserved.
21
- */!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};void 0===(a=function(){return i}.call(t,n,t,e))||(e.exports=a)}()},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5);t.a=function(e){var t=e.size,n=void 0===t?"lg":t,a=e.widths,i=void 0===a?[1]:a,l=e.colors,c=void 0===l?[]:l,u=function(e){return e.map((function(e){return parseInt(e.toString().replace(/[^0-9.]/gi,""))}))}(i);return r.a.createElement("div",{className:o()("pb_distribution_bar_".concat(n),Object(s.c)(e))},function(e,t){var n=e.reduce((function(e,t){return e+t}),0);return e.map((function(e,a){return r.a.createElement("div",{className:o()("pb_distribution_width",t[a]?"color_".concat(t[a]):""),key:a,style:{width:"".concat(100*e/n,"%")}})}))}(u,c))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(53),l=n(2),c=n(5),u=n(13),d=n(17);t.a=function(e){e.date&&Object(c.a)("Time Stacked",["date"]);var t=e.align,n=void 0===t?"left":t,a=e.className,i=e.dark,p=e.data,m=void 0===p?{}:p,b=e.date,h=e.time,f=e.timeZone,g=o()(Object(l.b)("pb_time_stacked_kit",n),Object(c.c)(e),a),_=Object(l.c)(m),y=new s.a({value:b||new Date(h),zone:f});return r.a.createElement("div",Object.assign({className:g},_),r.a.createElement(u.a,{className:o()("pb_time_stacked","time-spacing"),color:"light",dark:i},r.a.createElement("time",null,y.toTimeWithMeridian(),r.a.createElement(d.a,{className:"pb_time_stacked",color:"light",dark:i,tag:"span",text:y.toTimezone()}))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,a=e.aria,i=void 0===a?{}:a,d=e.className,p=e.dark,m=e.data,b=void 0===m?{}:m,h=e.icon,f=e.id,g=e.text,_=Object(s.a)(i),y=Object(s.c)(b),M=o()(Object(s.b)("pb_icon_value_kit",n),Object(l.c)(e),d);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:f}),r.a.createElement(c.a,{color:"light",dark:p},r.a.createElement(u.a,{dark:p,fixedWidth:!0,icon:h}),g))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(106),u=n(17);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.data,d=void 0===i?{}:i,p=e.id,m=e.label,b=e.pillValue,h=e.variant,f=void 0===h?"neutral":h,g=Object(l.a)(n),_=Object(l.c)(d),y=o()("pb_label_pill_kit",Object(s.c)(e),a);return r.a.createElement("div",Object.assign({},g,_,{className:y,id:p}),r.a.createElement(u.a,{className:"pb_label_pill_label",text:m}),r.a.createElement(c.a,{className:"pb_label_pill_pill",text:b,variant:f}))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(33),u=n(13),d=n(11),p=n(30),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.avatarName,i=e.avatarStatus,b=void 0===i?null:i,h=e.avatarUrl,f=e.children,g=e.className,_=e.data,y=void 0===_?{}:_,M=e.id,v=e.label,z=e.message,O=e.timestamp,k=e.timestampObject,A=e.timezone,x=e.alignTimestamp,w=void 0===x?"right":x,N=Object(s.a)(n),q=Object(s.c)(y),E=h||a,j=E?"pb_message_kit_avatar":"pb_message_kit",W=o()(Object(s.b)(j),Object(l.c)(e),g);return r.a.createElement("div",Object.assign({},N,q,{className:W,id:M}),E&&r.a.createElement(c.a,{imageUrl:h,name:a,size:"xs",status:b}),r.a.createElement("div",{className:"content_wrapper"},r.a.createElement(d.a,{justify:"left"===w?"none":"between",orientation:"row"},v&&r.a.createElement(m.a,{className:"message_title",size:4,text:v}),r.a.createElement(p.a,{className:"pull-".concat(w," ").concat(k?"message_humanized_time":null),text:O,timestamp:"",timezone:A}),k&&r.a.createElement(p.a,{className:"pull-".concat(w," message_timestamp"),text:"",timestamp:k,timezone:A})),z&&r.a.createElement(u.a,{className:"pb_message_body",text:z}),f))}},function(e,t,n){"use strict";e.exports=n(388)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(r=a.key,i=void 0,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(r,"string"))?i:String(i)),a)}var r,i}function i(e,t){return(i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=l(e);if(t){var r=l(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return s(this,n)}}function s(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return c}));var c=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(c,e);var t,n,s,l=o(c);function c(){return a(this,c),l.apply(this,arguments)}return t=c,s=[{key:"selector",get:function(){return".table-responsive-collapse"}}],(n=[{key:"connect",value:function(){var e=document.querySelectorAll(".table-responsive-collapse");[].forEach.call(e,(function(e){var t=[];[].forEach.call(e.querySelectorAll("th"),(function(e){for(var n=e.colSpan,a=0;a<n;a++)t.push(e.textContent.replace(/\r?\n|\r/,""))})),[].forEach.call(e.querySelectorAll("tbody tr"),(function(e){[].forEach.call(e.cells,(function(e,n){e.setAttribute("data-title",t[n])}))}))}))}}])&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(r=a.key,i=void 0,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(r,"string"))?i:String(i)),a)}var r,i}function i(e,t){return(i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=l(e);if(t){var r=l(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return s(this,n)}}function s(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return c}));var c=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(c,e);var t,n,s,l=o(c);function c(){return a(this,c),l.apply(this,arguments)}return t=c,s=[{key:"selector",get:function(){return".resize_auto textarea"}}],(n=[{key:"onInput",value:function(){this.style.height="auto",this.style.height=this.scrollHeight+"px"}},{key:"connect",value:function(){this.element.setAttribute("style","height:"+this.element.scrollHeight+"px;overflow-y:hidden;"),this.element.addEventListener("input",this.onInput,!1)}}])&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";var a=n(0),r=n.n(a);function i(e){return e.split("-")[1]}function o(e){return"y"===e?"height":"width"}function s(e){return e.split("-")[0]}function l(e){return["top","bottom"].includes(s(e))?"x":"y"}function c(e,t,n){let{reference:a,floating:r}=e;const c=a.x+a.width/2-r.width/2,u=a.y+a.height/2-r.height/2,d=l(t),p=o(d),m=a[p]/2-r[p]/2,b="x"===d;let h;switch(s(t)){case"top":h={x:c,y:a.y-r.height};break;case"bottom":h={x:c,y:a.y+a.height};break;case"right":h={x:a.x+a.width,y:u};break;case"left":h={x:a.x-r.width,y:u};break;default:h={x:a.x,y:a.y}}switch(i(t)){case"start":h[d]-=m*(n&&b?-1:1);break;case"end":h[d]+=m*(n&&b?-1:1)}return h}function u(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function d(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function p(e,t){var n;void 0===t&&(t={});const{x:a,y:r,platform:i,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:b=!1,padding:h=0}=t,f=u(h),g=s[b?"floating"===m?"reference":"floating":m],_=d(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:p,strategy:l})),y="floating"===m?{...o.floating,x:a,y:r}:o.reference,M=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(M))&&await(null==i.getScale?void 0:i.getScale(M))||{x:1,y:1},z=d(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:M,strategy:l}):y);return{top:(_.top-z.top+f.top)/v.y,bottom:(z.bottom-_.bottom+f.bottom)/v.y,left:(_.left-z.left+f.left)/v.x,right:(z.right-_.right+f.right)/v.x}}const m=Math.min,b=Math.max;function h(e,t,n){return b(e,m(t,n))}const f=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:a=0}=e||{},{x:r,y:s,placement:c,rects:d,platform:p,elements:m}=t;if(null==n)return{};const b=u(a),f={x:r,y:s},g=l(c),_=o(g),y=await p.getDimensions(n),M="y"===g,v=M?"top":"left",z=M?"bottom":"right",O=M?"clientHeight":"clientWidth",k=d.reference[_]+d.reference[g]-f[g]-d.floating[_],A=f[g]-d.reference[g],x=await(null==p.getOffsetParent?void 0:p.getOffsetParent(n));let w=x?x[O]:0;w&&await(null==p.isElement?void 0:p.isElement(x))||(w=m.floating[O]||d.floating[_]);const N=k/2-A/2,q=b[v],E=w-y[_]-b[z],j=w/2-y[_]/2+N,W=h(q,j,E),L=null!=i(c)&&j!=W&&d.reference[_]/2-(j<q?b[v]:b[z])-y[_]/2<0;return{[g]:f[g]-(L?j<q?q-j:E-j:0),data:{[g]:W,centerOffset:j-W}}}}),g={left:"right",right:"left",bottom:"top",top:"bottom"};function _(e){return e.replace(/left|right|bottom|top/g,e=>g[e])}function y(e,t,n){void 0===n&&(n=!1);const a=i(e),r=l(e),s=o(r);let c="x"===r?a===(n?"end":"start")?"right":"left":"start"===a?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=_(c)),{main:c,cross:_(c)}}const M={start:"end",end:"start"};function v(e){return e.replace(/start|end/g,e=>M[e])}const z=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:a,middlewareData:r,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...M}=e,z=s(a),O=s(l)===l,k=await(null==c.isRTL?void 0:c.isRTL(u.floating)),A=b||(O||!g?[_(l)]:function(e){const t=_(e);return[v(e),t,v(t)]}(l));b||"none"===f||A.push(...function(e,t,n,a){const r=i(e);let o=function(e,t,n){const a=["left","right"],r=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:a:t?a:r;case"left":case"right":return t?i:o;default:return[]}}(s(e),"start"===n,a);return r&&(o=o.map(e=>e+"-"+r),t&&(o=o.concat(o.map(v)))),o}(l,g,f,k));const x=[l,...A],w=await p(t,M),N=[];let q=(null==(n=r.flip)?void 0:n.overflows)||[];if(d&&N.push(w[z]),m){const{main:e,cross:t}=y(a,o,k);N.push(w[e],w[t])}if(q=[...q,{placement:a,overflows:N}],!N.every(e=>e<=0)){var E,j;const e=((null==(E=r.flip)?void 0:E.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:q},reset:{placement:t}};let n=null==(j=q.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(h){case"bestFit":{var W;const e=null==(W=q.map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:W[0];e&&(n=e);break}case"initialPlacement":n=l}if(a!==n)return{reset:{placement:n}}}return{}}}};const O=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:a}=t,r=await async function(e,t){const{placement:n,platform:a,elements:r}=e,o=await(null==a.isRTL?void 0:a.isRTL(r.floating)),c=s(n),u=i(n),d="x"===l(n),p=["left","top"].includes(c)?-1:1,m=o&&d?-1:1,b="function"==typeof t?t(e):t;let{mainAxis:h,crossAxis:f,alignmentAxis:g}="number"==typeof b?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...b};return u&&"number"==typeof g&&(f="end"===u?-1*g:g),d?{x:f*m,y:h*p}:{x:h*p,y:f*m}}(t,e);return{x:n+r.x,y:a+r.y,data:r}}}};function k(e){return"x"===e?"y":"x"}function A(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function x(e){return A(e).getComputedStyle(e)}function w(e){return e instanceof A(e).Node}function N(e){return w(e)?(e.nodeName||"").toLowerCase():""}let q;function E(){if(q)return q;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(q=e.brands.map(e=>e.brand+"/"+e.version).join(" "),q):navigator.userAgent}function j(e){return e instanceof A(e).HTMLElement}function W(e){return e instanceof A(e).Element}function L(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof A(e).ShadowRoot||e instanceof ShadowRoot}function S(e){const{overflow:t,overflowX:n,overflowY:a,display:r}=x(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(r)}function T(e){return["table","td","th"].includes(N(e))}function C(e){const t=/firefox/i.test(E()),n=x(e),a=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!a&&"none"!==a||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some(e=>n.willChange.includes(e))||["paint","layout","strict","content"].some(e=>{const t=n.contain;return null!=t&&t.includes(e)})}function R(){return/^((?!chrome|android).)*safari/i.test(E())}function D(e){return["html","body","#document"].includes(N(e))}const P=Math.min,B=Math.max,I=Math.round;function $(e){const t=x(e);let n=parseFloat(t.width),a=parseFloat(t.height);const r=j(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:a,s=I(n)!==i||I(a)!==o;return s&&(n=i,a=o),{width:n,height:a,fallback:s}}function F(e){return W(e)?e:e.contextElement}const X={x:1,y:1};function Y(e){const t=F(e);if(!j(t))return X;const n=t.getBoundingClientRect(),{width:a,height:r,fallback:i}=$(t);let o=(i?I(n.width):n.width)/a,s=(i?I(n.height):n.height)/r;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}function H(e,t,n,a){var r,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=F(e);let l=X;t&&(a?W(a)&&(l=Y(a)):l=Y(e));const c=s?A(s):window,u=R()&&n;let p=(o.left+(u&&(null==(r=c.visualViewport)?void 0:r.offsetLeft)||0))/l.x,m=(o.top+(u&&(null==(i=c.visualViewport)?void 0:i.offsetTop)||0))/l.y,b=o.width/l.x,h=o.height/l.y;if(s){const e=A(s),t=a&&W(a)?A(a):a;let n=e.frameElement;for(;n&&a&&t!==e;){const e=Y(n),t=n.getBoundingClientRect(),a=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(a.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(a.paddingTop))*e.y,p*=e.x,m*=e.y,b*=e.x,h*=e.y,p+=t.x,m+=t.y,n=A(n).frameElement}}return d({width:b,height:h,x:p,y:m})}function U(e){return((w(e)?e.ownerDocument:e.document)||window.document).documentElement}function V(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function G(e){return H(U(e)).left+V(e).scrollLeft}function K(e){if("html"===N(e))return e;const t=e.assignedSlot||e.parentNode||L(e)&&e.host||U(e);return L(t)?t.host:t}function J(e,t){var n;void 0===t&&(t=[]);const a=function e(t){const n=K(t);return D(n)?n.ownerDocument.body:j(n)&&S(n)?n:e(n)}(e),r=a===(null==(n=e.ownerDocument)?void 0:n.body),i=A(a);return r?t.concat(i,i.visualViewport||[],S(a)?a:[]):t.concat(a,J(a))}function Z(e,t,n){let a;if("viewport"===t)a=function(e,t){const n=A(e),a=U(e),r=n.visualViewport;let i=a.clientWidth,o=a.clientHeight,s=0,l=0;if(r){i=r.width,o=r.height;const e=R();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}return{width:i,height:o,x:s,y:l}}(e,n);else if("document"===t)a=function(e){const t=U(e),n=V(e),a=e.ownerDocument.body,r=B(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),i=B(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let o=-n.scrollLeft+G(e);const s=-n.scrollTop;return"rtl"===x(a).direction&&(o+=B(t.clientWidth,a.clientWidth)-r),{width:r,height:i,x:o,y:s}}(U(e));else if(W(t))a=function(e,t){const n=H(e,!0,"fixed"===t),a=n.top+e.clientTop,r=n.left+e.clientLeft,i=j(e)?Y(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:a*i.y}}(t,n);else{const n={...t};if(R()){var r,i;const t=A(e);n.x-=(null==(r=t.visualViewport)?void 0:r.offsetLeft)||0,n.y-=(null==(i=t.visualViewport)?void 0:i.offsetTop)||0}a=n}return d(a)}function Q(e,t){return j(e)&&"fixed"!==x(e).position?t?t(e):e.offsetParent:null}function ee(e,t){const n=A(e);if(!j(e))return n;let a=Q(e,t);for(;a&&T(a)&&"static"===x(a).position;)a=Q(a,t);return a&&("html"===N(a)||"body"===N(a)&&"static"===x(a).position&&!C(a))?n:a||function(e){let t=K(e);for(;j(t)&&!D(t);){if(C(t))return t;t=K(t)}return null}(e)||n}function te(e,t,n){const a=j(t),r=U(t),i=H(e,!0,"fixed"===n,t);let o={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(a||!a&&"fixed"!==n)if(("body"!==N(t)||S(r))&&(o=V(t)),j(t)){const e=H(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else r&&(s.x=G(r));return{x:i.left+o.scrollLeft-s.x,y:i.top+o.scrollTop-s.y,width:i.width,height:i.height}}const ne={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let a=J(e).filter(e=>W(e)&&"body"!==N(e)),r=null;const i="fixed"===x(e).position;let o=i?K(e):e;for(;W(o)&&!D(o);){const e=x(o),t=C(o);if("fixed"===e.position)r=null;else{(i?!t&&!r:!t&&"static"===e.position&&!!r&&["absolute","fixed"].includes(r.position))?a=a.filter(e=>e!==o):r=e}o=K(o)}return t.set(e,a),a}(t,this._c):[].concat(n),a],o=i[0],s=i.reduce((e,n)=>{const a=Z(t,n,r);return e.top=B(a.top,e.top),e.right=P(a.right,e.right),e.bottom=P(a.bottom,e.bottom),e.left=B(a.left,e.left),e},Z(t,o,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:a}=e;const r=j(n),i=U(n);if(n===i)return t;let o={scrollLeft:0,scrollTop:0},s={x:1,y:1};const l={x:0,y:0};if((r||!r&&"fixed"!==a)&&(("body"!==N(n)||S(i))&&(o=V(n)),j(n))){const e=H(n);s=Y(n),l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-o.scrollLeft*s.x+l.x,y:t.y*s.y-o.scrollTop*s.y+l.y}},isElement:W,getDimensions:function(e){return $(e)},getOffsetParent:ee,getDocumentElement:U,getScale:Y,async getElementRects(e){let{reference:t,floating:n,strategy:a}=e;const r=this.getOffsetParent||ee,i=this.getDimensions;return{reference:te(t,await r(n),a),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===x(e).direction};const ae=(e,t,n)=>{const a=new Map,r={platform:ne,...n},i={...r.platform,_c:a};return(async(e,t,n)=>{const{placement:a="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,s=i.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:p}=c(u,a,l),m=a,b={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:f}=s[n],{x:g,y:_,data:y,reset:M}=await f({x:d,y:p,initialPlacement:a,placement:m,strategy:r,middlewareData:b,rects:u,platform:o,elements:{reference:e,floating:t}});d=null!=g?g:d,p=null!=_?_:p,b={...b,[i]:{...b[i],...y}},M&&h<=50&&(h++,"object"==typeof M&&(M.placement&&(m=M.placement),M.rects&&(u=!0===M.rects?await o.getElementRects({reference:e,floating:t,strategy:r}):M.rects),({x:d,y:p}=c(u,m,l))),n=-1)}return{x:d,y:p,placement:m,strategy:r,middlewareData:b}})(e,t,{...r,platform:i})};var re=n(28);const ie=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return a=t,Object.prototype.hasOwnProperty.call(a,"current")?null!=t.current?f({element:t.current,padding:n}).fn(e):{}:t?f({element:t,padding:n}).fn(e):{};var a}}};var oe="undefined"!=typeof document?a.useLayoutEffect:a.useEffect;function se(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,a,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!se(e[a],t[a]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,r[a]))return!1;for(a=n;0!=a--;){const n=r[a];if(("_owner"!==n||!e.$$typeof)&&!se(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function le(e){const t=a.useRef(e);return oe(()=>{t.current=e}),t}new WeakMap,new WeakMap;var ce="undefined"==typeof Element;ce||Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,!ce&&Element.prototype.getRootNode;var ue="undefined"!=typeof document?a.useLayoutEffect:a.useEffect;let de=!1,pe=0;const me=()=>"floating-ui-"+pe++;const be=a["useId".toString()]||function(){const[e,t]=a.useState(()=>de?me():void 0);return ue(()=>{null==e&&t(me())},[]),a.useEffect(()=>{de||(de=!0)},[]),e};function he(){const e=new Map;return{emit(t,n){var a;null==(a=e.get(t))||a.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var a;e.set(t,(null==(a=e.get(t))?void 0:a.filter(e=>e!==n))||[])}}}const fe=a.createContext(null),ge=a.createContext(null),_e=()=>{var e;return(null==(e=a.useContext(fe))?void 0:e.id)||null},ye=()=>a.useContext(ge);function Me(e){return(null==e?void 0:e.ownerDocument)||document}function ve(e){return Me(e).defaultView||window}function ze(e){return!!e&&e instanceof ve(e).Element}function Oe(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function ke(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(a=n,"undefined"!=typeof ShadowRoot&&(a instanceof ve(a).ShadowRoot||a instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var a;return!1}function Ae(e){const t=Object(a.useRef)(e);return ue(()=>{t.current=e}),t}function xe(e,t,n){return n&&!Oe(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const we=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:i,events:o,elements:{domReference:s,floating:l},refs:c}=e,{enabled:u=!0,delay:d=0,handleClose:p=null,mouseOnly:m=!1,restMs:b=0,move:h=!0}=t,f=ye(),g=_e(),_=Ae(p),y=Ae(d),M=a.useRef(),v=a.useRef(),z=a.useRef(),O=a.useRef(),k=a.useRef(!0),A=a.useRef(!1),x=a.useRef(()=>{}),w=a.useCallback(()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t},[i]);a.useEffect(()=>{if(u)return o.on("dismiss",e),()=>{o.off("dismiss",e)};function e(){clearTimeout(v.current),clearTimeout(O.current),k.current=!0}},[u,o]),a.useEffect(()=>{if(!u||!_.current||!n)return;function e(){w()&&r(!1)}const t=Me(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[l,n,r,u,_,i,w]);const N=a.useCallback((function(e){void 0===e&&(e=!0);const t=xe(y.current,"close",M.current);t&&!z.current?(clearTimeout(v.current),v.current=setTimeout(()=>r(!1),t)):e&&(clearTimeout(v.current),r(!1))}),[y,r]),q=a.useCallback(()=>{x.current(),z.current=void 0},[]),E=a.useCallback(()=>{if(A.current){const e=Me(c.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),A.current=!1}},[c]);return a.useEffect(()=>{if(u&&ze(s)){const e=s;return n&&e.addEventListener("mouseleave",c),null==l||l.addEventListener("mouseleave",c),h&&e.addEventListener("mousemove",a,{once:!0}),e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",o),()=>{n&&e.removeEventListener("mouseleave",c),null==l||l.removeEventListener("mouseleave",c),h&&e.removeEventListener("mousemove",a),e.removeEventListener("mouseenter",a),e.removeEventListener("mouseleave",o)}}function t(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function a(e){if(clearTimeout(v.current),k.current=!1,m&&!Oe(M.current)||b>0&&0===xe(y.current,"open"))return;i.current.openEvent=e;const t=xe(y.current,"open",M.current);t?v.current=setTimeout(()=>{r(!0)},t):r(!0)}function o(a){if(t())return;x.current();const r=Me(l);if(clearTimeout(O.current),_.current){n||clearTimeout(v.current),z.current=_.current({...e,tree:f,x:a.clientX,y:a.clientY,onClose(){E(),q(),N()}});const t=z.current;return r.addEventListener("mousemove",t),void(x.current=()=>{r.removeEventListener("mousemove",t)})}("touch"!==M.current||!ke(l,a.relatedTarget))&&N()}function c(n){t()||null==_.current||_.current({...e,tree:f,x:n.clientX,y:n.clientY,onClose(){E(),q(),N()}})(n)}},[s,l,u,e,m,b,h,N,q,E,r,n,f,y,_,i]),ue(()=>{var e;if(u&&n&&null!=(e=_.current)&&e.__options.blockPointerEvents&&w()){const e=Me(l).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",A.current=!0,ze(s)&&l){var t,a;const e=s,n=null==f||null==(t=f.nodesRef.current.find(e=>e.id===g))||null==(a=t.context)?void 0:a.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}},[u,n,g,l,s,f,_,i,w]),ue(()=>{n||(M.current=void 0,q(),E())},[n,q,E]),a.useEffect(()=>()=>{q(),clearTimeout(v.current),clearTimeout(O.current),E()},[u,q,E]),a.useMemo(()=>{if(!u)return{};function e(e){M.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===b||(clearTimeout(O.current),O.current=setTimeout(()=>{k.current||r(!0)},b))}},floating:{onMouseEnter(){clearTimeout(v.current)},onMouseLeave(){o.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),N(!1)}}}},[o,u,b,n,r,N])};function Ne(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),a=n;for(;a.length;)a=e.filter(e=>{var t;return null==(t=a)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(a);return n}function qe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Ee=a["useInsertionEffect".toString()]||(e=>e());function je(e){const t=a.useRef(()=>{0});return Ee(()=>{t.current=e}),a.useCallback((function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return null==t.current?void 0:t.current(...n)}),[])}function We(e){let t,{restMs:n=0,buffer:a=.5,blockPointerEvents:r=!1}=void 0===e?{}:e,i=!1,o=!1;const s=e=>{let{x:r,y:s,placement:l,elements:c,onClose:u,nodeId:d,tree:p}=e;return function(e){function m(){clearTimeout(t),u()}if(clearTimeout(t),!c.domReference||!c.floating||null==l||null==r||null==s)return;const{clientX:b,clientY:h}=e,f=[b,h],g=qe(e),_="mouseleave"===e.type,y=ke(c.floating,g),M=ke(c.domReference,g),v=c.domReference.getBoundingClientRect(),z=c.floating.getBoundingClientRect(),O=l.split("-")[0],k=r>z.right-z.width/2,A=s>z.bottom-z.height/2,x=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(f,v);if(y&&(o=!0,!_))return;if(M&&(o=!1),M&&!_)return void(o=!0);if(_&&ze(e.relatedTarget)&&ke(c.floating,e.relatedTarget))return;if(p&&Ne(p.nodesRef.current,d).some(e=>{let{context:t}=e;return null==t?void 0:t.open}))return;if("top"===O&&s>=v.bottom-1||"bottom"===O&&s<=v.top+1||"left"===O&&r>=v.right-1||"right"===O&&r<=v.left+1)return m();let w=[];switch(O){case"top":w=[[z.left,v.top+1],[z.left,z.bottom-1],[z.right,z.bottom-1],[z.right,v.top+1]],i=b>=z.left&&b<=z.right&&h>=z.top&&h<=v.top+1;break;case"bottom":w=[[z.left,z.top+1],[z.left,v.bottom-1],[z.right,v.bottom-1],[z.right,z.top+1]],i=b>=z.left&&b<=z.right&&h>=v.bottom-1&&h<=z.bottom;break;case"left":w=[[z.right-1,z.bottom],[z.right-1,z.top],[v.left+1,z.top],[v.left+1,z.bottom]],i=b>=z.left&&b<=v.left+1&&h>=z.top&&h<=z.bottom;break;case"right":w=[[v.right-1,z.bottom],[v.right-1,z.top],[z.left+1,z.top],[z.left+1,z.bottom]],i=b>=v.right-1&&b<=z.right&&h>=z.top&&h<=z.bottom}const N=i?w:function(e){let[t,n]=e;const r=z.width>v.width,i=z.height>v.height;switch(O){case"top":return[[r?t+a/2:k?t+4*a:t-4*a,n+a+1],[r?t-a/2:k?t+4*a:t-4*a,n+a+1],...[[z.left,k||r?z.bottom-a:z.top],[z.right,k?r?z.bottom-a:z.top:z.bottom-a]]];case"bottom":return[[r?t+a/2:k?t+4*a:t-4*a,n-a],[r?t-a/2:k?t+4*a:t-4*a,n-a],...[[z.left,k||r?z.top+a:z.bottom],[z.right,k?r?z.top+a:z.bottom:z.top+a]]];case"left":{const e=[t+a+1,i?n+a/2:A?n+4*a:n-4*a],r=[t+a+1,i?n-a/2:A?n+4*a:n-4*a];return[...[[A||i?z.right-a:z.left,z.top],[A?i?z.right-a:z.left:z.right-a,z.bottom]],e,r]}case"right":return[[t-a,i?n+a/2:A?n+4*a:n-4*a],[t-a,i?n-a/2:A?n+4*a:n-4*a],...[[A||i?z.left+a:z.right,z.top],[A?i?z.left+a:z.right:z.left+a,z.bottom]]]}}([r,s]);return i?void 0:o&&!x?m():void(!function(e,t){const[n,a]=e;let r=!1;const i=t.length;for(let e=0,o=i-1;e<i;o=e++){const[i,s]=t[e]||[0,0],[l,c]=t[o]||[0,0];s>=a!=c>=a&&n<=(l-i)*(a-s)/(c-s)+i&&(r=!r)}return r}([b,h],N)?m():n&&!o&&(t=setTimeout(m,n)))}};return s.__options={blockPointerEvents:r},s}function Le(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,i=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,whileElementsMounted:o,open:s}=e,[l,c]=a.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,d]=a.useState(r);se(u,r)||d(r);const p=a.useRef(null),m=a.useRef(null),b=a.useRef(l),h=le(o),f=le(i),[g,_]=a.useState(null),[y,M]=a.useState(null),v=a.useCallback(e=>{p.current!==e&&(p.current=e,_(e))},[]),z=a.useCallback(e=>{m.current!==e&&(m.current=e,M(e))},[]),O=a.useCallback(()=>{if(!p.current||!m.current)return;const e={placement:t,strategy:n,middleware:u};f.current&&(e.platform=f.current),ae(p.current,m.current,e).then(e=>{const t={...e,isPositioned:!0};k.current&&!se(b.current,t)&&(b.current=t,re.flushSync(()=>{c(t)}))})},[u,t,n,f]);oe(()=>{!1===s&&b.current.isPositioned&&(b.current.isPositioned=!1,c(e=>({...e,isPositioned:!1})))},[s]);const k=a.useRef(!1);oe(()=>(k.current=!0,()=>{k.current=!1}),[]),oe(()=>{if(g&&y){if(h.current)return h.current(g,y,O);O()}},[g,y,O,h]);const A=a.useMemo(()=>({reference:p,floating:m,setReference:v,setFloating:z}),[v,z]),x=a.useMemo(()=>({reference:g,floating:y}),[g,y]);return a.useMemo(()=>({...l,update:O,refs:A,elements:x,reference:v,floating:z}),[l,O,A,x,v,z])}(e),o=ye(),s=a.useRef(null),l=a.useRef({}),c=a.useState(()=>he())[0],u=be(),[d,p]=a.useState(null),m=a.useCallback(e=>{const t=ze(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)},[i.refs]),b=a.useCallback(e=>{(ze(e)||null===e)&&(s.current=e,p(e)),(ze(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!ze(e))&&i.refs.setReference(e)},[i.refs]),h=a.useMemo(()=>({...i.refs,setReference:b,setPositionReference:m,domReference:s}),[i.refs,b,m]),f=a.useMemo(()=>({...i.elements,domReference:d}),[i.elements,d]),g=je(n),_=a.useMemo(()=>({...i,refs:h,elements:f,dataRef:l,nodeId:r,floatingId:u,events:c,open:t,onOpenChange:g}),[i,r,u,c,t,g,h,f]);return ue(()=>{const e=null==o?void 0:o.nodesRef.current.find(e=>e.id===r);e&&(e.context=_)}),a.useMemo(()=>({...i,context:_,refs:h,elements:f,reference:b,positionReference:m}),[i,h,f,_,b,m])}function Se(e,t,n){const a=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map(e=>e?e[n]:null).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,r]=t;var i;0===n.indexOf("on")?(a.has(n)||a.set(n,[]),"function"==typeof r&&(null==(i=a.get(n))||i.push(r),e[n]=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==(e=a.get(n))?void 0:e.map(e=>e(...r)).find(e=>void 0!==e)})):e[n]=r}),e):e,{})}}var Te=n(3),Ce=n.n(Te),Re=n(5),De=n(2),Pe=n(11);function Be(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ie(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $e(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Fe=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n};t.a=function(e){var t,n=e.aria,i=void 0===n?{}:n,o=e.className,c=e.children,u=e.data,d=void 0===u?{}:u,m=e.delay,b=void 0===m?0:m,f=e.icon,g=void 0===f?null:f,_=e.interaction,y=void 0!==_&&_,M=e.placement,v=void 0===M?"top":M,A=e.position,x=void 0===A?"absolute":A,w=e.text,N=e.zIndex,q=Fe(e,["aria","className","children","data","delay","icon","interaction","placement","position","text","zIndex"]),E=Object(De.c)(d),j=Object(De.a)(i),W=Ce()(Object(Re.c)(Object.assign({},q)),o),L=Ie(Object(a.useState)(!1),2),S=L[0],T=L[1],C=Object(a.useRef)(null),R=Le({strategy:x,middleware:[ie({element:C}),z({fallbackPlacements:["top","right","bottom","left"],fallbackStrategy:"initialPlacement",flipAlignment:!1}),O(10),(void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:a,placement:r}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=t,d={x:n,y:a},m=await p(e,u),b=l(s(r)),f=k(b);let g=d[b],_=d[f];if(i){const e="y"===b?"bottom":"right";g=h(g+m["y"===b?"top":"left"],g,g-m[e])}if(o){const e="y"===f?"bottom":"right";_=h(_+m["y"===f?"top":"left"],_,_-m[e])}const y=c.fn({...e,[b]:g,[f]:_});return{...y,data:{x:y.x-n,y:y.y-a}}}})],open:S,onOpenChange:function(e){T(e)},placement:v}),D=R.context,P=R.floating,B=R.middlewareData.arrow,I=void 0===B?{}:B,$=I.x,F=I.y,X=R.placement,Y=R.reference,H=R.strategy,U=R.x,V=R.y,G=function(e){void 0===e&&(e=[]);const t=e,n=a.useCallback(t=>Se(t,e,"reference"),t),r=a.useCallback(t=>Se(t,e,"floating"),t),i=a.useCallback(t=>Se(t,e,"item"),e.map(e=>null==e?void 0:e.item));return a.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:i}),[n,r,i])}([we(D,{delay:b,handleClose:y?We({blockPointerEvents:!1}):null})]).getFloatingProps,K={bottom:"top",left:"right",right:"left",top:"bottom"}[X.split("-")[0]];return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",Object.assign({className:"pb_tooltip_kit ".concat(W),ref:Y,role:"tooltip_trigger",style:{display:"inline-flex"}},j,E),c),S&&r.a.createElement("div",Object.assign({},G({className:"tooltip_tooltip ".concat(X," visible"),ref:P,role:"tooltip",style:{position:H,top:null!=V?V:0,left:null!=U?U:0,zIndex:null!=N?N:0}})),r.a.createElement(Pe.a,{align:"center",gap:"xs"},g&&r.a.createElement("i",{className:"pb_icon_kit far fa-".concat(g," fa-fw")}),w),r.a.createElement("div",{className:"arrow_bg",ref:C,style:Be({position:"absolute",left:null!=$?"".concat($,"px"):"",top:null!=F?"".concat(F,"px"):""},K,"-5px")})))}},function(e,t,n){"use strict";var a=n(186),r=n(200),i=n.n(r),o=n(201),s=n.n(o);var l=function(e){return function(t){var n=function(e){var n=document.createElement("div");n.className="pb_selectable_card_kit_enabled";var a=document.createElement("input"),r="datePicker-".concat(t.element.id,"-").concat(e);a.className="datePicker-AMPM",a.id=r,a.name="datepicker-ampm",a.type="radio",a.value=e;var i=document.createElement("label"),o=document.createElement("div");return i.className="label-".concat(e.toLowerCase()),i.setAttribute("for",r),o.className="buffer",o.innerHTML=e,i.append(o),n.prepend(a),n.append(i),n},a=function(e){if(t.selectedDates.length){var n="pb_selectable_card_kit_checked_enabled",a=document.getElementById("datePicker-".concat(t.element.id,"-AM")),r=document.getElementById("datePicker-".concat(t.element.id,"-PM")),i=t.selectedDates[0].getHours()<12?"AM":"PM";e&&(a.checked=!1,r.checked=!1,r.checked="PM"===i,a.checked="AM"===i),"PM"===i?(r.parentElement.className=n,a.parentElement.className="pb_selectable_card_kit_enabled"):"AM"===i&&(a.parentElement.className=n,r.parentElement.className="pb_selectable_card_kit_enabled")}};return{onValueUpdate:function(){a(!0)},onOpen:function(){a(!0)},onReady:function(){if(t.input.id&&(null==t?void 0:t.timeContainer)){if(t.timeContainer.classList.add("pb_time_selection"),t.minuteElement.step="1",e.caption){var r=document.createElement("div");r.className="pb_caption_kit_md",r.innerHTML=null==e?void 0:e.caption,t.timeContainer.prepend(r)}if(function(){t.amPM.style.display="none";var e=document.createElement("div");e.className="pb_form_group_kit";var a=n("AM");a.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+0),t.setDate(t.selectedDates[0],!0)}));var r=n("PM");r.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+12),t.setDate(t.selectedDates[0],!0)})),e.prepend(a),e.append(r);var i=document.createElement("div");i.className="meridiem",i.append(e),t.timeContainer.append(i)}(),a(!0),e.showTimezone){var i=document.createElement("div");i.className="pb_caption_kit_xs",i.innerHTML=(o=t._initialDate,s=o.toLocaleDateString("en-US",{day:"2-digit",timeZoneName:"short"}).slice(4),l=o.toLocaleDateString("en-US",{day:"2-digit",timeZoneName:"long"}).slice(4),"".concat(s," (").concat(l,")")),t.timeContainer.append(i)}var o,s,l;t.loadedPlugins.push("timeSelectPlugin")}}}}};t.a=function(e,t){var n,r,o=e.allowInput,c=e.closeOnSelect,u=void 0===c||c,d=e.defaultDate,p=e.disableDate,m=e.disableRange,b=e.disableWeekdays,h=e.enableTime,f=e.format,g=e.maxDate,_=e.minDate,y=e.mode,M=e.onChange,v=void 0===M?function(){}:M,z=e.onClose,O=void 0===z?function(){}:z,k=e.pickerId,A=e.plugins,x=e.position,w=void 0===x?"auto":x,N=e.positionElement,q=e.required,E=e.selectionType,j=e.showTimezone,W=e.staticPosition,L=void 0===W||W,S=e.timeCaption,T=void 0===S?"Select Time":S,C=e.timeFormat,R=void 0===C?"at h:i K":C,D=e.yearRange,P=function(){var e=document.querySelector("#cal-".concat(k,".open")),t=e.parentElement;(null==e?void 0:e.getBoundingClientRect().right)>window.innerWidth&&(t.style.display="flex",t.style.justifyContent="center"),e.offsetWidth<=t.offsetWidth&&(t.style.display="",t.style.justifyContent="")};Object(a.a)("#".concat(k),{allowInput:o,closeOnSelect:u,disableMobile:!0,dateFormat:h?"".concat(f," ").concat(R):f,defaultDate:""===d?null:d,disable:b&&b.length>0?[function(e){var t={Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6};return e.getDay()===t[b[0]]||e.getDay()===t[b[1]]||e.getDay()===t[b[2]]||e.getDay()===t[b[3]]||e.getDay()===t[b[4]]||e.getDay()===t[b[5]]||e.getDay()===t[b[6]]}]:p&&p.length>0?p:m&&m.length>0?m:[],enableTime:h,maxDate:g,minDate:_,mode:y,nextArrow:'<i class="far fa-angle-right"></i>',onOpen:[function(){var e,n;P(),window.addEventListener("resize",P),!L&&t&&(e=t,null===(n=document.querySelectorAll(e)[0])||void 0===n||n.addEventListener("scroll",I,{passive:!0}))}],onClose:[function(e,n){window.removeEventListener("resize",P),!L&&t&&function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;null===(e=document.querySelectorAll(t)[0])||void 0===e||e.removeEventListener("scroll",I)}(t),O(e,n)}],onChange:[function(e,t){v(t,e)}],onYearChange:[function(){Y()}],plugins:(r=[],"month"===E||A.length>0?r.push(i()({shorthand:!0,dateFormat:"F Y",altFormat:"F Y"})):"week"===E&&r.push(s()()),h&&r.push(l({caption:T,showTimezone:j})),r),position:w,positionElement:(n=N,"string"==typeof n?document.querySelectorAll(n)[0]:n),prevArrow:'<i class="far fa-angle-left"></i>',static:L});var B=document.querySelector("#".concat(k))._flatpickr;B.innerContainer.parentElement.id="cal-".concat(k);var I=function(){B._positionCalendar()};B.yearElements[0].parentElement.innerHTML='<select class="numInput cur-year" type="number" tabIndex="-1" aria-label="Year" id="year-'.concat(k,'"></select>');for(var $="",F=D[1];F>=D[0];F--)$+='<option value="'.concat(F,'">').concat(F,"</option>");var X=document.querySelector("#year-".concat(k));X.innerHTML=$,X.value=B.currentYear,X.addEventListener("input",(function(e){B.changeYear(Number(e.target.value))})),B.input.form&&B.input.form.addEventListener("reset",(function(){setTimeout((function(){X.value=B.currentYear,B.monthsDropdownContainer.value=B.currentMonth,d&&(B.setDate(d),Y())}),0)}));var Y=function(){X.value=B.currentYear};if(X.insertAdjacentHTML("afterend",'<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>'),B.monthElements[0].parentElement)return B.monthElements[0].insertAdjacentHTML("afterend",'<i class="far fa-angle-down month-dropdown-icon"></i>');o&&B.input.removeAttribute("readonly"),q&&(B.input.removeAttribute("readonly"),B.input.addEventListener("keydown",(function(e){return e.preventDefault()})),B.input.style.caretColor="transparent",B.input.style.cursor="pointer"),document.querySelector("#".concat(k)).parentElement.addEventListener("click",(function(e){return e.stopPropagation()}))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(8),u=n(82),d=n(75),p=n(48),m=n(22);function b(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function f(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var _=function(e,t){var n=[];return function e(t,a){var r,i=h(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.id.toLowerCase()===a.toLowerCase())return void n.push(o);o.children&&o.children.length>0&&e(o.children,a)}}catch(e){i.e(e)}finally{i.f()}}(e,t),n},y=function e(t){var n=[];if(Array.isArray(t))return t.forEach((function(t){if(t.checked&&n.push(t),t.children&&t.children.length>0){var a=e(t.children);n.push.apply(n,b(a))}})),n},M=function(e){var t=[];return function e(n){n.forEach((function(a){if(a.checked)if(a.children&&a.children.length>0){if(0===a.children.filter((function(e){return!e.checked})).length)return void t.push(a)}else{var r=n.find((function(e){return e.id===a.parentId}));r&&r.checked||t.push(a)}a.children&&a.children.length>0&&e(a.children)}))}(e),t};function v(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,i=e.className,b=e.data,f=void 0===b?{}:b,g=e.id,O=e.returnAllSelected,k=void 0!==O&&O,A=e.treeData,x=e.onSelect,w=void 0===x?function(){}:x,N=Object(s.a)(n),q=Object(s.c)(f),E=o()(Object(s.b)("pb_multi_level_select"),Object(l.c)(e),i),j=Object(a.useRef)(null),W=z(Object(a.useState)([]),2),L=W[0],S=W[1],T=z(Object(a.useState)(!0),2),C=T[0],R=T[1],D=z(Object(a.useState)(""),2),P=D[0],B=D[1],I=z(Object(a.useState)([]),2),$=I[0],F=I[1],X=z(Object(a.useState)([]),2),Y=X[0],H=X[1],U=z(Object(a.useState)([]),2),V=U[0],G=U[1];Object(a.useEffect)((function(){H(te(A))}),[A]),Object(a.useEffect)((function(){k?F(y(Y)):G(M(Y))}),[Y]),Object(a.useEffect)((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&R(!0)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}),[]);var K=function e(t,n){if(Array.isArray(t))return t.map((function(t){return t.checked=n,t.children=e(t.children,n),t}))},J=function e(t,n,a){if(Array.isArray(n))return n.map((function(n){return n.id!=t?n.children=e(t,n.children,a):(n.checked=a,n.children=K(n.children,a)),n}))},Z=function(e){var t=Object(m.cloneDeep)(Y);return k?J(e.id,t,!0):function e(t,n){if(null!==t.parent_id){var a=_(n,t.parent_id);if(a[0].children.every((function(e){return e.checked})))a[0].checked=!0,null!==a[0].parent_id&&e(a[0],n)}return n}(e,J(e.id,t,!0))},Q=function(e){var t=Object(m.cloneDeep)(Y);return k?J(e.id,t,!1):function e(t,n){if(n.parent_id){var a=_(t,n.parent_id);a[0].checked=!1,a[0].parent_id&&e(t,a[0])}return t}(J(e.id,t,!1),e)},ee=function(e,t){var n=t?Z(e):Q(e);return H(n),n},te=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Array.isArray(t))return t.map((function(t){var r=Object.assign(Object.assign({},t),{parent_id:n,depth:a});if(r.children&&r.children.length>0){var i=t.checked&&!k?K(t.children,!0):t.children;r.children=e(i,r.id,a+1)}return r}))},ne=function(e,t){e.stopPropagation();var n=ee(t,!1);w(k?y(n):M(n))},ae=function(e){return L.indexOf(e.id)>-1};return r.a.createElement("div",Object.assign({},N,q,{className:E,id:g}),r.a.createElement("div",{ref:j,className:"wrapper"},r.a.createElement("div",{className:"input_wrapper",onClick:function(e){e.stopPropagation(),"multiselect_input"===e.target.id||e.target.classList.contains("pb_form_pill_tag")||R(!C)}},r.a.createElement("div",{className:"input_inner_container"},0!==$.length&&k?$.map((function(e,t){return r.a.createElement(d.a,{key:t,text:e.label,size:"small",onClick:function(t){return ne(t,e)}})})):null,!k&&0!==V.length&&V.map((function(e,t){return r.a.createElement(d.a,{key:t,text:e.label,size:"small",onClick:function(t){return ne(t,e)}})})),0!==$.length&&k&&r.a.createElement("br",null),0!==V.length&&!k&&r.a.createElement("br",null),r.a.createElement("input",{id:"multiselect_input",onChange:function(e){B(e.target.value)},placeholder:"Start typing...",value:P,onClick:function(){return R(!1)}})),C?r.a.createElement("div",{key:"chevron-down"},r.a.createElement(c.a,{icon:"chevron-down"})):r.a.createElement("div",{key:"chevron-up"},r.a.createElement(c.a,{icon:"chevron-up"}))),r.a.createElement("div",{className:"dropdown_menu ".concat(C?"close":"open")},function e(t){return r.a.createElement("ul",null,Array.isArray(t)&&t.map((function(t){return r.a.createElement(r.a.Fragment,null,r.a.createElement("li",{key:t.id,className:"dropdown_item","data-name":t.id},r.a.createElement("div",{className:"dropdown_item_checkbox_row"},r.a.createElement("div",{key:ae(t)?"chevron-down":"chevron-right"},r.a.createElement(p.a,{icon:ae(t)?"chevron-down":"chevron-right",className:t.children&&t.children.length>0?"":"toggle_icon",onClick:function(e){return function(e,t){t.stopPropagation();var n=_(Y,e);if(n){var a=v(L);ae(n[0])?a=a.filter((function(e){return e!=n[0].id})):a.push(n[0].id),S(a)}}(t.id,e)},variant:"link"})),r.a.createElement(u.a,{text:t.label,id:t.id},r.a.createElement("input",{checked:t.checked,type:"checkbox",name:t.label,value:t.label,onChange:function(e){!function(e,t){var n=e.target.parentNode.id;B("");var a=_(Y,n),r=ee(a[0],t);console.log(r),w(k?y(r):M(r))}(e,!t.checked)}}))),ae(t)&&t.children&&t.children.length>0&&!P&&r.a.createElement("div",null,e(t.children))))})))}(P?function(e,t){var n=[];return function e(t,a){var r,i=h(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.label.toLowerCase().includes(a.toLowerCase())&&n.push(o),o.children&&e(o.children,a)}}catch(e){i.e(e)}finally{i.f()}}(e,t),n}(Y,P):Y))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(8);function c(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.data,u=void 0===i?{}:i,d=e.hideRating,p=void 0!==d&&d,m=e.id,b=e.rating,h=void 0===b?0:b,f=Object(s.a)(n),g=Object(s.c)(u),_=o()(["pb_star_rating_kit",a]);return r.a.createElement("div",Object.assign({},f,g,{className:_,id:m}),!p&&r.a.createElement("div",{className:"pb_star_rating_number"},h),r.a.createElement("div",{className:"pb_star_rating_wrapper"},r.a.createElement("div",{className:"pb_star_rating_highlight"},c(Array(Math.floor(h))).map((function(e,t){return r.a.createElement(l.a,{fixedWidth:!1,icon:"star",key:t})})),h%1!=0&&r.a.createElement(l.a,{fixedWidth:!1,icon:"star-half"})),r.a.createElement("div",{className:"pb_star_rating_base"},r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=function(){return a.createElement("svg",{viewBox:"0 0 200 250",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},a.createElement("path",{d:"M198.4 71.5V71c-.2-1.2-1.4-2.1-1.4-2.1L103.2 2.7c-.7-.4-1-.6-1.6-.6-1.3 0-2.3 1-2.3 2.3v67.1h-.6v29.6h99.8l-.1-29.6z",fill:"#004876"}),a.createElement("path",{d:"M172.9 159.2c-31.4 23-33.2 24.3-33.2 24.3l-40.5 3.2v-29.4l73.7 1.9z",fill:"#FFF"}),a.createElement("path",{d:"M99.3 125.4V33.5L1.6 102.7l-.1.1c-1 .7-1.5 1.8-1.5 3v67.4c0 1.2.6 2.3 1.5 3l.1.1 93.5 66.3c1.7 1.2 4.1 0 4.1-2.1v-28.9l40.5-28-40.5.7v-25h73.7l25.4-16.9.2-16.8H99.3z",fill:"#BB2432"}),a.createElement("path",{d:"M99.3 101.1h99.3v24.3H99.3z",fill:"#FFF"}))},u=function(){return a.createElement("svg",{viewBox:"0 0 242.9 242.9",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},a.createElement("circle",{cx:121.5,cy:121.5,r:121.5}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"a",x1:42.483,x2:200.309,y1:35.645,y2:35.645},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M56.4 53.8c16.9-16.2 39.8-26.2 65-26.2 25.2 0 48.1 10 64.9 26.2h14c-19.1-22.2-47.4-36.3-78.9-36.3-31.5 0-59.8 14.1-78.9 36.3h13.9z",style:{fill:"url(#a)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"b",x1:17.407,x2:44.897,y1:132.179,y2:132.179},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M44.9 175.7c-10.9-15.3-17.3-34-17.3-54.2 0-14.1 3.1-27.5 8.8-39.5H25.3c-5 12.2-7.8 25.5-7.8 39.5 0 22.7 7.3 43.8 19.8 60.9l7.6-6.7z",style:{fill:"url(#b)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"c",x1:52.914,x2:189.715,y1:212.573,y2:212.573},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M173 199.8c-14.8 9.8-32.5 15.5-51.6 15.5s-37-5.8-51.8-15.6H52.9c18.3 16.1 42.3 25.8 68.5 25.8 26.1 0 50-9.7 68.3-25.7H173z",style:{fill:"url(#c)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"d",x1:31.123,x2:207.766,y1:136.159,y2:136.159},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M139.2 193v-1.8c5-.4 10.2-.5 13.4-5 3.8-5.2 3.2-15.4 3.2-21.5V78.5l-47.3 120.4L61.2 81.2v61.1c0 13.6.5 35.1 12.5 44.2 4.3 3.2 9 3.9 14.2 4.7v1.8H31.1v-1.8c1.6-.4 3.2-.7 4.8-1.1 22.6-5.7 22.9-32.4 22.9-51.1v-37.8c0-6.1.5-13.3-3.2-18.5-4.5-6.1-13.4-7.2-20.4-7.5v-1.8H96l29.6 75.4 29.9-75.4h52.3v1.8c-4.8.4-10.2.9-13.4 5-3.8 4.8-3.2 15.9-3.2 21.9v62.5c0 6.3-.7 16.1 3.2 21.5 3.2 4.3 6.2 4.7 11.2 5v1.8h-66.4z",style:{fill:"url(#d)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"e",x1:30.453,x2:213.794,y1:63.629,y2:63.629},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M30.5 60.6h183.3v6.1H30.5z",style:{fill:"url(#e)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"f",x1:196.676,x2:225.538,y1:132.923,y2:132.923},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M196.7 177.5c11.5-15.6 18.7-35.2 18.7-56 0-14.1-3.1-27.5-8.8-39.5h11.1c5 12.2 7.8 25.5 7.8 39.5 0 23.4-7.8 45-20.9 62.4l-7.9-6.4z",style:{fill:"url(#f)"}}))};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.badge,i=void 0===a?"million-dollar":a,d=e.className,p=e.data,m=void 0===p?{}:p,b=e.id,h=e.size,f=void 0===h?"md":h,g="million-dollar"===i?r.a.createElement(u,null):r.a.createElement(c,null),_=Object(s.a)(n),y=Object(s.c)(m),M=o()(Object(s.b)("pb_user_badge_kit",f),Object(l.c)(e),d);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),r.a.createElement("div",{className:"pb_user_badge_wrapper"},g))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(53),u=n(13),d=n(17),p=n(8),m=function(e,t){var n=new c.a({value:e});return t?"".concat(n.toMonth()," ").concat(n.toDay(),", ").concat(n.toYear()):"".concat(n.toMonth()," ").concat(n.toDay())};t.a=function(e){var t=e.icon,n=void 0!==t&&t,a=e.dark,i=void 0!==a&&a,b=e.size,h=void 0===b?"sm":b,f=e.align,g=void 0===f?"left":f,_=e.data,y=void 0===_?{}:_,M=e.startDate,v=e.endDate,z=e.className,O=function(){return r.a.createElement(r.a.Fragment,null,n&&r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,{color:"light",key:Math.random(),tag:"span"},r.a.createElement(p.a,{className:"pb_date_range_inline_icon",dark:i,fixedWidth:!0,icon:"calendar-alt",size:h,tag:"span"}))))},k=Object(l.b)("pb_date_range_inline_kit",g),A=Object(l.c)(y),x=function(e){return r.a.createElement("time",{dateTime:(n=e,new c.a({value:n}).toIso())},(t=new Date,M.getFullYear()==v.getFullYear()&&M.getFullYear()==t.getFullYear()?r.a.createElement(r.a.Fragment,null," ".concat(m(e,!1)," ")):r.a.createElement(r.a.Fragment,null," ".concat(m(e,!0)," "))));var t,n};return r.a.createElement("div",Object.assign({},A,{className:o()(k,Object(s.c)(e),z)}),r.a.createElement("div",{className:"pb_date_range_inline_wrapper"},"xs"==h&&r.a.createElement(r.a.Fragment,null,O(),r.a.createElement(d.a,{dark:i,tag:"span"},x(M)),r.a.createElement(d.a,{dark:i,tag:"span"},r.a.createElement(p.a,{className:"pb_date_range_inline_arrow",fixedWidth:!0,icon:"long-arrow-right"})),r.a.createElement(d.a,{dark:i,tag:"span"},x(v))),"sm"==h&&r.a.createElement(r.a.Fragment,null,O(),r.a.createElement(u.a,{dark:i,tag:"span"},x(M)),r.a.createElement(u.a,{color:"light",dark:i,tag:"span"},r.a.createElement(p.a,{className:"pb_date_range_inline_arrow",dark:i,fixedWidth:!0,icon:"long-arrow-right"})),r.a.createElement(u.a,{dark:i,tag:"span"},x(v)))))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var a,r=n(146);var i=((a=r)&&a.__esModule?a:{default:a}).default,o=i.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=i.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=i.canUseDOM?window.NodeList:{},t.canUseDOM=i.canUseDOM;t.default=o},function(e,t,n){"use strict";var a=function(){};e.exports=a},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(13),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.data,d=void 0===i?{}:i,p=e.firstName,m=e.id,b=e.lastName,h=Object(l.a)(n),f=Object(l.c)(d),g=o()(Object(l.b)("pb_person_kit"),Object(s.c)(e),a);return r.a.createElement("div",Object.assign({},h,f,{className:g,id:m}),r.a.createElement(c.a,{className:"pb_person_first",tag:"span"},p),b&&r.a.createElement(u.a,{className:"pb_person_first",size:4,text:" ".concat(b)}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n(99),r=n(132),i=n(133),o=n(135),s=n(136),l=[r.a,i.a,o.a,s.a],c=Object(a.a)({defaultModifiers:l})},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(17),d=n(8),p={cell:"mobile",email:"envelope",home:"phone",work:"phone-office","work-cell":"phone-laptop","wrong-phone":"phone-slash",extension:"phone-plus"};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.contactDetail,m=e.contactType,b=e.contactValue,h=e.data,f=void 0===h?{}:h,g=e.id,_=Object(s.a)(n),y=Object(s.c)(f),M=o()(Object(s.b)("pb_contact_kit"),Object(l.c)(e),a);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:g}),r.a.createElement(c.a,{className:"pb_contact_kit",color:"light",tag:"span"},r.a.createElement(d.a,{fixedWidth:!0,icon:p[m]||"phone"})," ".concat(function(e,t){if("email"==t)return e;var n=e.replace(/\D/g,""),a=n.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);return"extension"==t?n.match(/^\d{4}$/):a?[a[1]?"+1 ":"","(",a[2],") ",a[3],"-",a[4]].join(""):null}(b,m)," "),i&&r.a.createElement(u.a,{size:"xs",tag:"span",text:i})))}},function(e,t,n){"use strict";var a=n(43),r=n(12);t.a={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,i=e.name,o=n.offset,s=void 0===o?[0,0]:o,l=r.h.reduce((function(e,n){return e[n]=function(e,t,n){var i=Object(a.a)(e),o=[r.f,r.m].indexOf(i)>=0?-1:1,s="function"==typeof n?n(Object.assign({},t,{placement:e})):n,l=s[0],c=s[1];return l=l||0,c=(c||0)*o,[r.f,r.k].indexOf(i)>=0?{x:c,y:l}:{x:l,y:c}}(n,t.rects,s),e}),{}),c=l[t.placement],u=c.x,d=c.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=d),t.modifiersData[i]=l}}},function(e,t,n){"use strict";var a={left:"right",right:"left",bottom:"top",top:"bottom"};function r(e){return e.replace(/left|right|bottom|top/g,(function(e){return a[e]}))}var i=n(43),o={start:"end",end:"start"};function s(e){return e.replace(/start|end/g,(function(e){return o[e]}))}var l=n(63),c=n(72),u=n(12);t.a={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,a=e.name;if(!t.modifiersData[a]._skip){for(var o=n.mainAxis,d=void 0===o||o,p=n.altAxis,m=void 0===p||p,b=n.fallbackPlacements,h=n.padding,f=n.boundary,g=n.rootBoundary,_=n.altBoundary,y=n.flipVariations,M=void 0===y||y,v=n.allowedAutoPlacements,z=t.options.placement,O=Object(i.a)(z),k=b||(O===z||!M?[r(z)]:function(e){if(Object(i.a)(e)===u.a)return[];var t=r(e);return[s(e),t,s(t)]}(z)),A=[z].concat(k).reduce((function(e,n){return e.concat(Object(i.a)(n)===u.a?function(e,t){void 0===t&&(t={});var n=t,a=n.placement,r=n.boundary,o=n.rootBoundary,s=n.padding,d=n.flipVariations,p=n.allowedAutoPlacements,m=void 0===p?u.h:p,b=Object(c.a)(a),h=b?d?u.n:u.n.filter((function(e){return Object(c.a)(e)===b})):u.b,f=h.filter((function(e){return m.indexOf(e)>=0}));0===f.length&&(f=h);var g=f.reduce((function(t,n){return t[n]=Object(l.a)(e,{placement:n,boundary:r,rootBoundary:o,padding:s})[Object(i.a)(n)],t}),{});return Object.keys(g).sort((function(e,t){return g[e]-g[t]}))}(t,{placement:n,boundary:f,rootBoundary:g,padding:h,flipVariations:M,allowedAutoPlacements:v}):n)}),[]),x=t.rects.reference,w=t.rects.popper,N=new Map,q=!0,E=A[0],j=0;j<A.length;j++){var W=A[j],L=Object(i.a)(W),S=Object(c.a)(W)===u.l,T=[u.m,u.c].indexOf(L)>=0,C=T?"width":"height",R=Object(l.a)(t,{placement:W,boundary:f,rootBoundary:g,altBoundary:_,padding:h}),D=T?S?u.k:u.f:S?u.c:u.m;x[C]>w[C]&&(D=r(D));var P=r(D),B=[];if(d&&B.push(R[L]<=0),m&&B.push(R[D]<=0,R[P]<=0),B.every((function(e){return e}))){E=W,q=!1;break}N.set(W,B)}if(q)for(var I=function(e){var t=A.find((function(t){var n=N.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},$=M?3:1;$>0;$--){if("break"===I($))break}t.placement!==E&&(t.modifiersData[a]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}}},function(e,t,n){"use strict";var a=n(12),r=n(43),i=n(100);var o=n(92),s=n(104),l=n(79),c=n(63),u=n(72),d=n(138),p=n(32);t.a={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,m=e.name,b=n.mainAxis,h=void 0===b||b,f=n.altAxis,g=void 0!==f&&f,_=n.boundary,y=n.rootBoundary,M=n.altBoundary,v=n.padding,z=n.tether,O=void 0===z||z,k=n.tetherOffset,A=void 0===k?0:k,x=Object(c.a)(t,{boundary:_,rootBoundary:y,padding:v,altBoundary:M}),w=Object(r.a)(t.placement),N=Object(u.a)(t.placement),q=!N,E=Object(i.a)(w),j="x"===E?"y":"x",W=t.modifiersData.popperOffsets,L=t.rects.reference,S=t.rects.popper,T="function"==typeof A?A(Object.assign({},t.rects,{placement:t.placement})):A,C="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),R=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,D={x:0,y:0};if(W){if(h){var P,B="y"===E?a.m:a.f,I="y"===E?a.c:a.k,$="y"===E?"height":"width",F=W[E],X=F+x[B],Y=F-x[I],H=O?-S[$]/2:0,U=N===a.l?L[$]:S[$],V=N===a.l?-S[$]:-L[$],G=t.elements.arrow,K=O&&G?Object(s.a)(G):{width:0,height:0},J=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Object(d.a)(),Z=J[B],Q=J[I],ee=Object(o.a)(0,L[$],K[$]),te=q?L[$]/2-H-ee-Z-C.mainAxis:U-ee-Z-C.mainAxis,ne=q?-L[$]/2+H+ee+Q+C.mainAxis:V+ee+Q+C.mainAxis,ae=t.elements.arrow&&Object(l.a)(t.elements.arrow),re=ae?"y"===E?ae.clientTop||0:ae.clientLeft||0:0,ie=null!=(P=null==R?void 0:R[E])?P:0,oe=F+te-ie-re,se=F+ne-ie,le=Object(o.a)(O?Object(p.b)(X,oe):X,F,O?Object(p.a)(Y,se):Y);W[E]=le,D[E]=le-F}if(g){var ce,ue="x"===E?a.m:a.f,de="x"===E?a.c:a.k,pe=W[j],me="y"===j?"height":"width",be=pe+x[ue],he=pe-x[de],fe=-1!==[a.m,a.f].indexOf(w),ge=null!=(ce=null==R?void 0:R[j])?ce:0,_e=fe?be:pe-L[me]-S[me]-ge+C.altAxis,ye=fe?pe+L[me]+S[me]-ge-C.altAxis:he,Me=O&&fe?Object(o.b)(_e,pe,ye):Object(o.a)(O?_e:be,pe,O?ye:he);W[j]=Me,D[j]=Me-pe}t.modifiersData[m]=D}},requiresIfExists:["offset"]}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.color,d=void 0===i?"data_1":i,p=e.dark,m=void 0!==p&&p,b=e.data,h=void 0===b?{}:b,f=e.id,g=e.prefixText,_=e.text,y=Object(s.a)(n),M=Object(s.c)(h),v="#"===d.charAt(0)&&d,z={background:v},O=o()(Object(s.b)("pb_legend_kit",v?"":d),Object(l.c)(e),a);return r.a.createElement("div",Object.assign({},y,M,{className:O,id:f}),r.a.createElement(c.a,{color:m?"lighter":"light"},r.a.createElement("span",{className:"".concat(v?"pb_legend_indicator_circle_custom":"pb_legend_indicator_circle"),style:z}),g&&r.a.createElement(u.a,{dark:m,size:4,tag:"span",text:" ".concat(g," ")})," ".concat(_," ")))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(2),o=n(5),s=n(11),l=n(16),c=n(55),u=n(148),d=n(66);t.a=function(e){e.date&&Object(o.a)("Date Time Stacked",["date"]);var t=e.date,n=e.datetime,a=e.dark,p=e.timeZone,m=void 0===p?"America/New_York":p,b=Object(i.b)("pb_date_time_stacked_kit",Object(o.c)(e));return r.a.createElement(s.a,Object.assign({inline:!1,vertical:"stretch"},e),r.a.createElement(l.a,null,r.a.createElement(d.a,{align:"right",bold:!0,dark:a,date:t||n})),r.a.createElement(c.a,{className:"date-time-padding",orientation:"vertical"}),r.a.createElement(l.a,null,r.a.createElement(u.a,{className:b,dark:a,date:t||n,timeZone:m})))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(11),u=n(55);t.a=function(e){var t=e.children,n=e.padding,a=void 0===n?"sm":n,i=e.paddingBottom,d=void 0===i?"sm":i,p=e.paddingX,m=void 0===p?"sm":p,b=e.className,h=e.spacing,f=void 0===h?"between":h,g=e.separator,_=void 0!==g&&g,y=Object(s.b)("dialog_footer"),M=Object(l.c)(e,{padding:a,paddingBottom:d,paddingX:m});return r.a.createElement(r.a.Fragment,null,_&&r.a.createElement(u.a,null),r.a.createElement("div",{className:"dialog-pseudo-footer"}),r.a.createElement(c.a,{className:o()(y,M,b),spacing:f},t))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5);t.a=function(e){var t=e.children,n=e.padding,a=void 0===n?"sm":n,i=e.className,c=Object(s.b)("dialog_body"),u=Object(l.c)(e,{padding:a});return r.a.createElement("div",{className:o()(c,u,i)},t)}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(8),u=function(e){var t=e.onClose;return r.a.createElement("div",{className:"pb_dialog_close_icon",onClick:t},r.a.createElement(c.a,{fixedWidth:!0,icon:"times"}))},d=n(131),p=n(11),m=n(55);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,i=e.children,c=e.className,b=e.data,h=void 0===b?{}:b,f=e.padding,g=void 0===f?"sm":f,_=e.spacing,y=void 0===_?"between":_,M=e.closeable,v=void 0===M||M,z=e.separator,O=void 0===z||z,k=Object(s.a)(n),A=Object(s.c)(h),x=Object(a.useContext)(d.a),w=Object(s.b)("dialog_header"),N=Object(l.c)(e,{padding:g});return r.a.createElement("div",{className:"dialog_sticky_header"},r.a.createElement(p.a,Object.assign({},k,A,{className:o()(w,N,c),spacing:y}),i,v&&r.a.createElement(u,{onClose:x.onClose})),O&&r.a.createElement(m.a,null))}},function(e,t,n){e.exports=function(){"use strict";var e,t,n;function a(a,r){if(e)if(t){var i="var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk);",o={};e(o),n=r(o),"undefined"!=typeof window&&(n.workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"})))}else t=r;else e=r}return a(0,(function(e){var t=n;function n(e,t,n,a){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=a}function a(e,n,a,r){const i=new t(e,n,a,r);return function(e){return i.solve(e)}}n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,a=0;a<8;a++){var r=this.sampleCurveX(n)-e;if(Math.abs(r)<t)return n;var i=this.sampleCurveDerivativeX(n);if(Math.abs(i)<1e-6)break;n-=r/i}var o=0,s=1;for(n=e,a=0;a<20&&(r=this.sampleCurveX(n),!(Math.abs(r-e)<t));a++)e>r?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};const r=a(.25,.1,.25,1);function i(e,t,n){return Math.min(n,Math.max(t,e))}function o(e,t,n){const a=n-t,r=((e-t)%a+a)%a+t;return r===t?n:r}function s(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}let l=1;function c(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function u(e,t,n){const a={};for(const r in e)a[r]=t.call(n||this,e[r],r,e);return a}function d(e,t,n){const a={};for(const r in e)t.call(n||this,e[r],r,e)&&(a[r]=e[r]);return a}function p(e){return Array.isArray(e)?e.map(p):"object"==typeof e&&e?u(e,p):e}const m={};function b(e){m[e]||("undefined"!=typeof console&&console.warn(e),m[e]=!0)}function h(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function f(e){let t=0;for(let n,a,r=0,i=e.length,o=i-1;r<i;o=r++)n=e[r],a=e[o],t+=(a.x-n.x)*(n.y+a.y);return t}function g(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function _(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,n,a,r)=>{const i=a||r;return t[n]=!i||i.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let y,M,v=null;function z(e){if(null==v){const t=e.navigator?e.navigator.userAgent:null;v=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return v}function O(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const k={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const n=window.document.createElement("canvas"),a=n.getContext("2d");if(!a)throw new Error("failed to create canvas 2d context");return n.width=e.width,n.height=e.height,a.drawImage(e,0,0,e.width,e.height),a.getImageData(-t,-t,e.width+2*t,e.height+2*t)},resolveURL:e=>(y||(y=document.createElement("a")),y.href=e,y.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==M&&(M=matchMedia("(prefers-reduced-motion: reduce)")),M.matches)}};var A=x;function x(e,t){this.x=e,this.y=t}x.prototype={clone:function(){return new x(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),a=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=a,this},_rotateAround:function(e,t){var n=Math.cos(e),a=Math.sin(e),r=t.y+a*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-a*(this.y-t.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},x.convert=function(e){return e instanceof x?e:Array.isArray(e)?new x(e[0],e[1]):e};const w={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},N="mapbox-tiles";let q,E=500,j=50;function W(){"undefined"==typeof caches||q||(q=caches.open(N))}let L=1/0;const S={supported:!1,testSupport:function(e){!R&&C&&(D?P(e):T=e)}};let T,C,R=!1,D=!1;function P(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,C),e.isContextLost())return;S.supported=!0}catch(e){}e.deleteTexture(t),R=!0}"undefined"!=typeof document&&(C=document.createElement("img"),C.onload=function(){T&&P(T),T=null,D=!0},C.onerror=function(){R=!0,T=null},C.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const B={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(B);class I extends Error{constructor(e,t,n,a){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=a}}const $=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function F(e,t){const n=new AbortController,a=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:$(),signal:n.signal});let r=!1,i=!1;return"json"===e.type&&a.headers.set("Accept","application/json"),i||(Date.now(),fetch(a).then(n=>n.ok?((n,a,o)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then(e=>{i||(r=!0,t(null,e,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(e=>{i||t(new Error(e.message))})})(n):n.blob().then(a=>t(new I(n.status,n.statusText,e.url,a)))).catch(e=>{20!==e.code&&t(new Error(e.message))})),{cancel:()=>{i=!0,r||n.abort()}}}const X=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t);if(!g()){const n=e.url.substring(0,e.url.indexOf("://"));return(w.REGISTERED_PROTOCOLS[n]||F)(e,t)}}if(!(/^file:/.test(n=e.url)||/^file:/.test($())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return F(e,t);if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var n;return function(e,t){const n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{t(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let a=n.response;if("json"===e.type)try{a=JSON.parse(n.response)}catch(e){return t(e)}t(null,a,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else{const a=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});t(new I(n.status,n.statusText,e.url,a))}},n.send(e.body),{cancel:()=>n.abort()}}(e,t)},Y=function(e,t){return X(s(e,{type:"arrayBuffer"}),t)};function H(e){const t=window.document.createElement("a");return t.href=e,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}const U="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let V,G;V=[],G=0;const K=function(e,t){if(S.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),G>=w.MAX_PARALLEL_IMAGE_REQUESTS){const n={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return V.push(n),n}G++;let n=!1;const a=()=>{if(!n)for(n=!0,G--;V.length&&G<w.MAX_PARALLEL_IMAGE_REQUESTS;){const e=V.shift(),{requestParameters:t,callback:n,cancelled:a}=e;a||(e.cancel=K(t,n).cancel)}},r=Y(e,(e,n,r,i)=>{a(),e?t(e):n&&function(e,t){"function"==typeof createImageBitmap?function(e,t){const n=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(n).then(e=>{t(null,e)}).catch(e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(e,t):function(e,t){const n=new Image;n.onload=()=>{t(null,n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=U})},n.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const a=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?URL.createObjectURL(a):U}(e,t)}(n,(e,n)=>{null!=e?t(e):null!=n&&t(null,n,{cacheControl:r,expires:i})})});return{cancel:()=>{r.cancel(),a()}}};function J(e,t,n){n[e]&&-1!==n[e].indexOf(t)||(n[e]=n[e]||[],n[e].push(t))}function Z(e,t,n){if(n&&n[e]){const a=n[e].indexOf(t);-1!==a&&n[e].splice(a,1)}}class Q{constructor(e,t={}){s(this,t),this.type=e}}class ee extends Q{constructor(e,t={}){super("error",s({error:e},t))}}class te{on(e,t){return this._listeners=this._listeners||{},J(e,t,this._listeners),this}off(e,t){return Z(e,t,this._listeners),Z(e,t,this._oneTimeListeners),this}once(e,t){return this._oneTimeListeners=this._oneTimeListeners||{},J(e,t,this._oneTimeListeners),this}fire(e,t){"string"==typeof e&&(e=new Q(e,t||{}));const n=e.type;if(this.listens(n)){e.target=this;const t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of t)n.call(this,e);const a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of a)Z(n,t,this._oneTimeListeners),t.call(this,e);const r=this._eventedParent;r&&(s(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(e))}else e instanceof ee&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var ne={$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"},terrain:{type:"terrain"},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:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},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 ae{constructor(e,t,n,a){this.message=(e?e+": ":"")+n,a&&(this.identifier=a),null!=t&&t.__line__&&(this.line=t.__line__)}}function re(e){const t=e.value;return t?[new ae(e.key,t,"constants have been deprecated as of v8")]:[]}function ie(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}function oe(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function se(e){if(Array.isArray(e))return e.map(se);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const n in e)t[n]=se(e[n]);return t}return oe(e)}class le extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class ce{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,n]of t)this.bindings[e]=n}concat(e){return new ce(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(e+" not found in scope.")}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const ue={kind:"null"},de={kind:"number"},pe={kind:"string"},me={kind:"boolean"},be={kind:"color"},he={kind:"object"},fe={kind:"value"},ge={kind:"collator"},_e={kind:"formatted"},ye={kind:"padding"},Me={kind:"resolvedImage"};function ve(e,t){return{kind:"array",itemType:e,N:t}}function ze(e){if("array"===e.kind){const t=ze(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Oe=[ue,de,pe,me,be,_e,he,ve(fe),ye,Me];function ke(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!ke(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Oe)if(!ke(e,t))return null}return`Expected ${ze(e)} but found ${ze(t)} instead.`}function Ae(e,t){return t.some(t=>t.kind===e.kind)}function xe(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}var we,Ne={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 qe(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ee(e){return qe("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function je(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function We(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{we={}.parseCSSColor=function(e){var t,n=e.replace(/ /g,"").toLowerCase();if(n in Ne)return Ne[n].slice();if("#"===n[0])return 4===n.length?(t=parseInt(n.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===n.length&&(t=parseInt(n.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var a=n.indexOf("("),r=n.indexOf(")");if(-1!==a&&r+1===n.length){var i=n.substr(0,a),o=n.substr(a+1,r-(a+1)).split(","),s=1;switch(i){case"rgba":if(4!==o.length)return null;s=je(o.pop());case"rgb":return 3!==o.length?null:[Ee(o[0]),Ee(o[1]),Ee(o[2]),s];case"hsla":if(4!==o.length)return null;s=je(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,c=je(o[1]),u=je(o[2]),d=u<=.5?u*(c+1):u+c-u*c,p=2*u-d;return[qe(255*We(p,d,l+1/3)),qe(255*We(p,d,l)),qe(255*We(p,d,l-1/3)),s];default:return null}}return null}}catch(e){}class Le{constructor(e,t,n,a=1){this.r=e,this.g=t,this.b=n,this.a=a}static parse(e){if(!e)return;if(e instanceof Le)return e;if("string"!=typeof e)return;const t=we(e);return t?new Le(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,n,a]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(n)},${a})`}toArray(){const{r:e,g:t,b:n,a:a}=this;return 0===a?[0,0,0,0]:[255*e/a,255*t/a,255*n/a,a]}}Le.black=new Le(0,0,0,1),Le.white=new Le(1,1,1,1),Le.transparent=new Le(0,0,0,0),Le.red=new Le(1,0,0,1);class Se{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Te{constructor(e,t,n,a,r){this.text=e,this.image=t,this.scale=n,this.fontStack=a,this.textColor=r}}class Ce{constructor(e){this.sections=e}static fromString(e){return new Ce([new Te(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof Ce?e:Ce.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Re{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Re)return e;if("number"==typeof e)return new Re([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Re(e)}}toString(){return JSON.stringify(this.values)}}class De{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new De({name:e,available:!1}):null}}function Pe(e,t,n,a){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[e,t,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[e,t,n,a]:[e,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Be(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Le)return!0;if(e instanceof Se)return!0;if(e instanceof Ce)return!0;if(e instanceof Re)return!0;if(e instanceof De)return!0;if(Array.isArray(e)){for(const t of e)if(!Be(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Be(e[t]))return!1;return!0}return!1}function Ie(e){if(null===e)return ue;if("string"==typeof e)return pe;if("boolean"==typeof e)return me;if("number"==typeof e)return de;if(e instanceof Le)return be;if(e instanceof Se)return ge;if(e instanceof Ce)return _e;if(e instanceof Re)return ye;if(e instanceof De)return Me;if(Array.isArray(e)){const t=e.length;let n;for(const t of e){const e=Ie(t);if(n){if(n===e)continue;n=fe;break}n=e}return ve(n||fe,t)}return he}function $e(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Le||e instanceof Ce||e instanceof Re||e instanceof De?e.toString():JSON.stringify(e)}class Fe{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Be(e[1]))return t.error("invalid value");const n=e[1];let a=Ie(n);const r=t.expectedType;return"array"!==a.kind||0!==a.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(a=r),new Fe(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Xe{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ye={string:pe,number:de,boolean:me,object:he};class He{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n,a=1;const r=e[0];if("array"===r){let r,i;if(e.length>2){const n=e[1];if("string"!=typeof n||!(n in Ye)||"object"===n)return t.error('The item type argument of "array" must be one of string, number, boolean',1);r=Ye[n],a++}else r=fe;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);i=e[2],a++}n=ve(r,i)}else{if(!Ye[r])throw new Error("Types doesn't contain name = "+r);n=Ye[r]}const i=[];for(;a<e.length;a++){const n=t.parse(e[a],a,fe);if(!n)return null;i.push(n)}return new He(n,i)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(!ke(this.type,Ie(n)))return n;if(t===this.args.length-1)throw new Xe(`Expected value to be of type ${ze(this.type)}, but found ${ze(Ie(n))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ue={"to-boolean":me,"to-color":be,"to-number":de,"to-string":pe};class Ve{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!Ue[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==e.length)return t.error("Expected one argument.");const a=Ue[n],r=[];for(let n=1;n<e.length;n++){const a=t.parse(e[n],n,fe);if(!a)return null;r.push(a)}return new Ve(a,r)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,n;for(const a of this.args){if(t=a.evaluate(e),n=null,t instanceof Le)return t;if("string"==typeof t){const n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Pe(t[0],t[1],t[2],t[3]),!n))return new Le(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Xe(n||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}if("padding"===this.type.kind){let t;for(const n of this.args){t=n.evaluate(e);const a=Re.parse(t);if(a)return a}throw new Xe(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}if("number"===this.type.kind){let t=null;for(const n of this.args){if(t=n.evaluate(e),null===t)return 0;const a=Number(t);if(!isNaN(a))return a}throw new Xe(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Ce.fromString($e(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?De.fromString($e(this.args[0].evaluate(e))):$e(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ge=["Unknown","Point","LineString","Polygon"];class Ke{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?Ge[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Le.parse(e)),t}}class Je{constructor(e,t,n,a){this.name=e,this.type=t,this._evaluate=n,this.args=a}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],a=Je.definitions[n];if(!a)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(a)?a[0]:a.type,i=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=i.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[a,i]of o){s=new Mt(t.registry,t.path,null,t.scope);const o=[];let l=!1;for(let t=1;t<e.length;t++){const n=e[t],r=Array.isArray(a)?a[t-1]:a.type,i=s.parse(n,1+o.length,r);if(!i){l=!0;break}o.push(i)}if(!l)if(Array.isArray(a)&&a.length!==o.length)s.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(a)?a[e]:a.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(0===s.errors.length)return new Je(n,r,i,o)}}if(1===o.length)t.errors.push(...s.errors);else{const n=(o.length?o:i).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(ze).join(", ")})`:`(${ze(t.type)}...)`;var t}).join(" | "),a=[];for(let n=1;n<e.length;n++){const r=t.parse(e[n],1+a.length);if(!r)return null;a.push(ze(r.type))}t.error(`Expected arguments of type ${n}, but found (${a.join(", ")}) instead.`)}return null}static register(e,t){Je.definitions=t;for(const n in t)e[n]=Je}}class Ze{constructor(e,t,n){this.type=ge,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const n=e[1];if("object"!=typeof n||Array.isArray(n))return t.error("Collator options argument must be an object.");const a=t.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,me);if(!a)return null;const r=t.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,me);if(!r)return null;let i=null;return n.locale&&(i=t.parse(n.locale,1,pe),!i)?null:new Ze(a,r,i)}evaluate(e){return new Se(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Qe=8192;function et(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function tt(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function nt(e,t){const n=(180+e[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,r=Math.pow(2,t.z);return[Math.round(n*r*Qe),Math.round(a*r*Qe)]}function at(e,t,n){const a=e[0]-t[0],r=e[1]-t[1],i=e[0]-n[0],o=e[1]-n[1];return a*o-i*r==0&&a*i<=0&&r*o<=0}function rt(e,t){let n=!1;for(let o=0,s=t.length;o<s;o++){const s=t[o];for(let t=0,o=s.length;t<o-1;t++){if(at(e,s[t],s[t+1]))return!1;(r=s[t])[1]>(a=e)[1]!=(i=s[t+1])[1]>a[1]&&a[0]<(i[0]-r[0])*(a[1]-r[1])/(i[1]-r[1])+r[0]&&(n=!n)}}var a,r,i;return n}function it(e,t){for(let n=0;n<t.length;n++)if(rt(e,t[n]))return!0;return!1}function ot(e,t,n,a){const r=a[0]-n[0],i=a[1]-n[1],o=(e[0]-n[0])*i-r*(e[1]-n[1]),s=(t[0]-n[0])*i-r*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function st(e,t,n){for(const c of n)for(let n=0;n<c.length-1;++n)if(0!=(s=[(o=c[n+1])[0]-(i=c[n])[0],o[1]-i[1]])[0]*(l=[(r=t)[0]-(a=e)[0],r[1]-a[1]])[1]-s[1]*l[0]&&ot(a,r,i,o)&&ot(i,o,a,r))return!0;var a,r,i,o,s,l;return!1}function lt(e,t){for(let n=0;n<e.length;++n)if(!rt(e[n],t))return!1;for(let n=0;n<e.length-1;++n)if(st(e[n],e[n+1],t))return!1;return!0}function ct(e,t){for(let n=0;n<t.length;n++)if(lt(e,t[n]))return!0;return!1}function ut(e,t,n){const a=[];for(let r=0;r<e.length;r++){const i=[];for(let a=0;a<e[r].length;a++){const o=nt(e[r][a],n);et(t,o),i.push(o)}a.push(i)}return a}function dt(e,t,n){const a=[];for(let r=0;r<e.length;r++){const i=ut(e[r],t,n);a.push(i)}return a}function pt(e,t,n,a){if(e[0]<n[0]||e[0]>n[2]){const t=.5*a;let r=e[0]-n[0]>t?-a:n[0]-e[0]>t?a:0;0===r&&(r=e[0]-n[2]>t?-a:n[2]-e[0]>t?a:0),e[0]+=r}et(t,e)}function mt(e,t,n,a){const r=Math.pow(2,a.z)*Qe,i=[a.x*Qe,a.y*Qe],o=[];for(const a of e)for(const e of a){const a=[e.x+i[0],e.y+i[1]];pt(a,t,n,r),o.push(a)}return o}function bt(e,t,n,a){const r=Math.pow(2,a.z)*Qe,i=[a.x*Qe,a.y*Qe],o=[];for(const n of e){const e=[];for(const a of n){const n=[a.x+i[0],a.y+i[1]];et(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=r/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of o)for(const a of e)pt(a,t,n,r)}var s;return o}class ht{constructor(e,t){this.type=me,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Be(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const n=t.features[e].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new ht(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ht(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new ht(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],r=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,a,r),o=mt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!rt(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,a,r),o=mt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!it(e,i))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],r=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,a,r),o=bt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!lt(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,a,r),o=bt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!ct(e,i))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function ft(e){if(e instanceof Je){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof ht)return!1;let t=!0;return e.eachChild(e=>{t&&!ft(e)&&(t=!1)}),t}function gt(e){if(e instanceof Je&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!gt(e)&&(t=!1)}),t}function _t(e,t){if(e instanceof Je&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild(e=>{n&&!_t(e,t)&&(n=!1)}),n}class yt{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new yt(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Mt{constructor(e,t=[],n,a=new ce,r=[]){this.registry=e,this.path=t,this.key=t.map(e=>`[${e}]`).join(""),this.scope=a,this.errors=r,this.expectedType=n}parse(e,t,n,a,r={}){return t?this.concat(t,n,a)._parse(e,r):this._parse(e,r)}_parse(e,t){function n(e,t,n){return"assert"===n?new He(t,[e]):"coerce"===n?new Ve(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=e[0];if("string"!=typeof a)return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[a];if(r){let a=r.parse(e,this);if(!a)return null;if(this.expectedType){const e=this.expectedType,r=a.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind)if("padding"!==e.kind||"value"!==r.kind&&"number"!==r.kind&&"array"!==r.kind){if(this.checkSubtype(e,r))return null}else a=n(a,e,t.typeAnnotation||"coerce");else a=n(a,e,t.typeAnnotation||"coerce");else a=n(a,e,t.typeAnnotation||"assert")}if(!(a instanceof Fe)&&"resolvedImage"!==a.type.kind&&function e(t){if(t instanceof yt)return e(t.boundExpression);if(t instanceof Je&&"error"===t.name)return!1;if(t instanceof Ze)return!1;if(t instanceof ht)return!1;const n=t instanceof Ve||t instanceof He;let a=!0;return t.eachChild(t=>{a=n?a&&e(t):a&&t instanceof Fe}),!!a&&ft(t)&&_t(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(a)){const t=new Ke;try{a=new Fe(a.type,a.evaluate(t))}catch(e){return this.error(e.message),null}}return a}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const a="number"==typeof e?this.path.concat(e):this.path,r=n?this.scope.concat(n):this.scope;return new Mt(this.registry,a,t||null,r,this.errors)}error(e,...t){const n=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new le(n,e))}checkSubtype(e,t){const n=ke(e,t);return n&&this.error(n),n}}function vt(e,t){const n=e.length-1;let a,r,i=0,o=n,s=0;for(;i<=o;)if(s=Math.floor((i+o)/2),a=e[s],r=e[s+1],a<=t){if(s===n||t<r)return s;i=s+1}else{if(!(a>t))throw new Xe("Input is not a number.");o=s-1}return 0}class zt{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,de);if(!n)return null;const a=[];let r=null;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let n=1;n<e.length;n+=2){const i=1===n?-1/0:e[n],o=e[n+1],s=n,l=n+1;if("number"!=typeof i)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(a.length&&a[a.length-1][0]>=i)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(o,l,r);if(!c)return null;r=r||c.type,a.push([i,c])}return new zt(r,n,a)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=t[0])return n[0].evaluate(e);const r=t.length;return a>=t[r-1]?n[r-1].evaluate(e):n[vt(t,a)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ot(e,t,n){return e*(1-n)+t*n}var kt=Object.freeze({__proto__:null,number:Ot,color:function(e,t,n){return new Le(Ot(e.r,t.r,n),Ot(e.g,t.g,n),Ot(e.b,t.b,n),Ot(e.a,t.a,n))},array:function(e,t,n){return e.map((e,a)=>Ot(e,t[a],n))},padding:function(e,t,n){const a=e.values,r=t.values;return new Re([Ot(a[0],r[0],n),Ot(a[1],r[1],n),Ot(a[2],r[2],n),Ot(a[3],r[3],n)])}});const At=6/29*3*(6/29),xt=Math.PI/180,wt=180/Math.PI;function Nt(e){return e>.008856451679035631?Math.pow(e,1/3):e/At+4/29}function qt(e){return e>6/29?e*e*e:At*(e-4/29)}function Et(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function jt(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Wt(e){const t=jt(e.r),n=jt(e.g),a=jt(e.b),r=Nt((.4124564*t+.3575761*n+.1804375*a)/.95047),i=Nt((.2126729*t+.7151522*n+.072175*a)/1);return{l:116*i-16,a:500*(r-i),b:200*(i-Nt((.0193339*t+.119192*n+.9503041*a)/1.08883)),alpha:e.a}}function Lt(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,a=isNaN(e.b)?t:t-e.b/200;return t=1*qt(t),n=.95047*qt(n),a=1.08883*qt(a),new Le(Et(3.2404542*n-1.5371385*t-.4985314*a),Et(-.969266*n+1.8760108*t+.041556*a),Et(.0556434*n-.2040259*t+1.0572252*a),e.alpha)}function St(e,t,n){const a=t-e;return e+n*(a>180||a<-180?a-360*Math.round(a/360):a)}const Tt={forward:Wt,reverse:Lt,interpolate:function(e,t,n){return{l:Ot(e.l,t.l,n),a:Ot(e.a,t.a,n),b:Ot(e.b,t.b,n),alpha:Ot(e.alpha,t.alpha,n)}}},Ct={forward:function(e){const{l:t,a:n,b:a}=Wt(e),r=Math.atan2(a,n)*wt;return{h:r<0?r+360:r,c:Math.sqrt(n*n+a*a),l:t,alpha:e.a}},reverse:function(e){const t=e.h*xt,n=e.c;return Lt({l:e.l,a:Math.cos(t)*n,b:Math.sin(t)*n,alpha:e.alpha})},interpolate:function(e,t,n){return{h:St(e.h,t.h,n),c:Ot(e.c,t.c,n),l:Ot(e.l,t.l,n),alpha:Ot(e.alpha,t.alpha,n)}}};var Rt=Object.freeze({__proto__:null,lab:Tt,hcl:Ct});class Dt{constructor(e,t,n,a,r){this.type=e,this.operator=t,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,n,a,r){let i=0;if("exponential"===e.name)i=Pt(n,e.base,a,r);else if("linear"===e.name)i=Pt(n,1,a,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;i=new t(o[0],o[1],o[2],o[3]).solve(Pt(n,1,a,r))}return i}static parse(e,t){let[n,a,r,...i]=e;if(!Array.isArray(a)||0===a.length)return t.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){const e=a[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return t.error("Unknown interpolation type "+String(a[0]),1,0);{const e=a.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(r=t.parse(r,2,de),!r)return null;const o=[];let s=null;"interpolate-hcl"===n||"interpolate-lab"===n?s=be:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e<i.length;e+=2){const n=i[e],a=i[e+1],r=e+3,l=e+4;if("number"!=typeof n)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=n)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(a,l,s);if(!c)return null;s=s||c.type,o.push([n,c])}return"number"===s.kind||"color"===s.kind||"padding"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Dt(s,n,a,r,o):t.error(`Type ${ze(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=t[0])return n[0].evaluate(e);const r=t.length;if(a>=t[r-1])return n[r-1].evaluate(e);const i=vt(t,a),o=Dt.interpolationFactor(this.interpolation,a,t[i],t[i+1]),s=n[i].evaluate(e),l=n[i+1].evaluate(e);return"interpolate"===this.operator?kt[this.type.kind.toLowerCase()](s,l,o):"interpolate-hcl"===this.operator?Ct.reverse(Ct.interpolate(Ct.forward(s),Ct.forward(l),o)):Tt.reverse(Tt.interpolate(Tt.forward(s),Tt.forward(l),o))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Pt(e,t,n,a){const r=a-n,i=e-n;return 0===r?0:1===t?i/r:(Math.pow(t,i)-1)/(Math.pow(t,r)-1)}class Bt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument.");let n=null;const a=t.expectedType;a&&"value"!==a.kind&&(n=a);const r=[];for(const a of e.slice(1)){const e=t.parse(a,1+r.length,n,void 0,{typeAnnotation:"omit"});if(!e)return null;n=n||e.type,r.push(e)}if(!n)throw new Error("No output type");const i=a&&r.some(e=>ke(a,e.type));return new Bt(i?fe:n,r)}evaluate(e){let t,n=null,a=0;for(const r of this.args)if(a++,n=r.evaluate(e),n&&n instanceof De&&!n.available&&(t||(t=n.name),n=null,a===this.args.length&&(n=t)),null!==n)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class It{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let a=1;a<e.length-1;a+=2){const r=e[a];if("string"!=typeof r)return t.error(`Expected string, but found ${typeof r} instead.`,a);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",a);const i=t.parse(e[a+1],a+1);if(!i)return null;n.push([r,i])}const a=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return a?new It(n,a):null}outputDefined(){return this.result.outputDefined()}}class $t{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,de),a=t.parse(e[2],2,ve(t.expectedType||fe));return n&&a?new $t(a.type.itemType,n,a):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Xe(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Xe(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Xe(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ft{constructor(e,t){this.type=me,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,fe),a=t.parse(e[2],2,fe);return n&&a?Ae(n.type,[me,pe,de,ue,fe])?new Ft(n,a):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ze(n.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!xe(t,["boolean","string","number","null"]))throw new Xe(`Expected first argument to be of type boolean, string, number or null, but found ${ze(Ie(t))} instead.`);if(!xe(n,["string","array"]))throw new Xe(`Expected second argument to be of type array or string, but found ${ze(Ie(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Xt{constructor(e,t,n){this.type=de,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,fe),a=t.parse(e[2],2,fe);if(!n||!a)return null;if(!Ae(n.type,[me,pe,de,ue,fe]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ze(n.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,de);return r?new Xt(n,a,r):null}return new Xt(n,a)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!xe(t,["boolean","string","number","null"]))throw new Xe(`Expected first argument to be of type boolean, string, number or null, but found ${ze(Ie(t))} instead.`);if(!xe(n,["string","array"]))throw new Xe(`Expected second argument to be of type array or string, but found ${ze(Ie(n))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return n.indexOf(t,a)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Yt{constructor(e,t,n,a,r,i){this.inputType=e,this.type=t,this.input=n,this.cases=a,this.outputs=r,this.otherwise=i}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let n,a;t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);const r={},i=[];for(let o=2;o<e.length-1;o+=2){let s=e[o];const l=e[o+1];Array.isArray(s)||(s=[s]);const c=t.concat(o);if(0===s.length)return c.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,Ie(e)))return null}else n=Ie(e);if(void 0!==r[String(e)])return c.error("Branch labels must be unique.");r[String(e)]=i.length}const u=t.parse(l,o,a);if(!u)return null;a=a||u.type,i.push(u)}const o=t.parse(e[1],1,fe);if(!o)return null;const s=t.parse(e[e.length-1],e.length-1,a);return s?"value"!==o.type.kind&&t.concat(1).checkSubtype(n,o.type)?null:new Yt(n,a,o,r,i,s):null}evaluate(e){const t=this.input.evaluate(e);return(Ie(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ht{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const a=[];for(let r=1;r<e.length-1;r+=2){const i=t.parse(e[r],r,me);if(!i)return null;const o=t.parse(e[r+1],r+1,n);if(!o)return null;a.push([i,o]),n=n||o.type}const r=t.parse(e[e.length-1],e.length-1,n);if(!r)return null;if(!n)throw new Error("Can't infer output type");return new Ht(n,a,r)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ut{constructor(e,t,n,a){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=a}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,fe),a=t.parse(e[2],2,de);if(!n||!a)return null;if(!Ae(n.type,[ve(fe),pe,fe]))return t.error(`Expected first argument to be of type array or string, but found ${ze(n.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,de);return r?new Ut(n.type,n,a,r):null}return new Ut(n.type,n,a)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!xe(t,["string","array"]))throw new Xe(`Expected first argument to be of type array or string, but found ${ze(Ie(t))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return t.slice(n,a)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vt(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Gt(e,t,n,a){return 0===a.compare(t,n)}function Kt(e,t,n){const a="=="!==e&&"!="!==e;return class r{constructor(e,t,n){this.type=me,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const n=e[0];let i=t.parse(e[1],1,fe);if(!i)return null;if(!Vt(n,i.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${ze(i.type)}'.`);let o=t.parse(e[2],2,fe);if(!o)return null;if(!Vt(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${ze(o.type)}'.`);if(i.type.kind!==o.type.kind&&"value"!==i.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${ze(i.type)}' and '${ze(o.type)}'.`);a&&("value"===i.type.kind&&"value"!==o.type.kind?i=new He(o.type,[i]):"value"!==i.type.kind&&"value"===o.type.kind&&(o=new He(i.type,[o])));let s=null;if(4===e.length){if("string"!==i.type.kind&&"string"!==o.type.kind&&"value"!==i.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,ge),!s)return null}return new r(i,o,s)}evaluate(r){const i=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(a&&this.hasUntypedArgument){const t=Ie(i),n=Ie(o);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new Xe(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const e=Ie(i),n=Ie(o);if("string"!==e.kind||"string"!==n.kind)return t(r,i,o)}return this.collator?n(r,i,o,this.collator.evaluate(r)):t(r,i,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const Jt=Kt("==",(function(e,t,n){return t===n}),Gt),Zt=Kt("!=",(function(e,t,n){return t!==n}),(function(e,t,n,a){return!Gt(0,t,n,a)})),Qt=Kt("<",(function(e,t,n){return t<n}),(function(e,t,n,a){return a.compare(t,n)<0})),en=Kt(">",(function(e,t,n){return t>n}),(function(e,t,n,a){return a.compare(t,n)>0})),tn=Kt("<=",(function(e,t,n){return t<=n}),(function(e,t,n,a){return a.compare(t,n)<=0})),nn=Kt(">=",(function(e,t,n){return t>=n}),(function(e,t,n,a){return a.compare(t,n)>=0}));class an{constructor(e,t,n,a,r){this.type=pe,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=a,this.maxFractionDigits=r}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,de);if(!n)return null;const a=e[2];if("object"!=typeof a||Array.isArray(a))return t.error("NumberFormat options argument must be an object.");let r=null;if(a.locale&&(r=t.parse(a.locale,1,pe),!r))return null;let i=null;if(a.currency&&(i=t.parse(a.currency,1,pe),!i))return null;let o=null;if(a["min-fraction-digits"]&&(o=t.parse(a["min-fraction-digits"],1,de),!o))return null;let s=null;return a["max-fraction-digits"]&&(s=t.parse(a["max-fraction-digits"],1,de),!s)?null:new an(n,r,i,o,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class rn{constructor(e){this.type=_e,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&"object"==typeof n)return t.error("First argument must be an image or text section.");const a=[];let r=!1;for(let n=1;n<=e.length-1;++n){const i=e[n];if(r&&"object"==typeof i&&!Array.isArray(i)){r=!1;let e=null;if(i["font-scale"]&&(e=t.parse(i["font-scale"],1,de),!e))return null;let n=null;if(i["text-font"]&&(n=t.parse(i["text-font"],1,ve(pe)),!n))return null;let o=null;if(i["text-color"]&&(o=t.parse(i["text-color"],1,be),!o))return null;const s=a[a.length-1];s.scale=e,s.font=n,s.textColor=o}else{const i=t.parse(e[n],1,fe);if(!i)return null;const o=i.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,a.push({content:i,scale:null,font:null,textColor:null})}}return new rn(a)}evaluate(e){return new Ce(this.sections.map(t=>{const n=t.content.evaluate(e);return Ie(n)===Me?new Te("",n,null,null,null):new Te($e(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}}class on{constructor(e){this.type=Me,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,pe);return n?new on(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=De.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class sn{constructor(e){this.type=de,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?t.error(`Expected argument of type string or array, but found ${ze(n.type)} instead.`):new sn(n):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Xe(`Expected value to be of type string or array, but found ${ze(Ie(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ln={"==":Jt,"!=":Zt,">":en,"<":Qt,">=":nn,"<=":tn,array:He,at:$t,boolean:He,case:Ht,coalesce:Bt,collator:Ze,format:rn,image:on,in:Ft,"index-of":Xt,interpolate:Dt,"interpolate-hcl":Dt,"interpolate-lab":Dt,length:sn,let:It,literal:Fe,match:Yt,number:He,"number-format":an,object:He,slice:Ut,step:zt,string:He,"to-boolean":Ve,"to-color":Ve,"to-number":Ve,"to-string":Ve,var:yt,within:ht};function cn(e,[t,n,a,r]){t=t.evaluate(e),n=n.evaluate(e),a=a.evaluate(e);const i=r?r.evaluate(e):1,o=Pe(t,n,a,i);if(o)throw new Xe(o);return new Le(t/255*i,n/255*i,a/255*i,i)}function un(e,t){return e in t}function dn(e,t){const n=t[e];return void 0===n?null:n}function pn(e){return{type:e}}function mn(e){return{result:"success",value:e}}function bn(e){return{result:"error",value:e}}function hn(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function fn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function gn(e){return!!e.expression&&e.expression.interpolated}function _n(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function yn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Mn(e){return e}function vn(e,t,n){return void 0!==e?e:void 0!==t?t:void 0!==n?n:void 0}function zn(e,t,n,a,r){return vn(typeof n===r?a[n]:void 0,e.default,t.default)}function On(e,t,n){if("number"!==_n(n))return vn(e.default,t.default);const a=e.stops.length;if(1===a)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[a-1][0])return e.stops[a-1][1];const r=vt(e.stops.map(e=>e[0]),n);return e.stops[r][1]}function kn(e,t,n){const a=void 0!==e.base?e.base:1;if("number"!==_n(n))return vn(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];const i=vt(e.stops.map(e=>e[0]),n),o=function(e,t,n,a){const r=a-n,i=e-n;return 0===r?0:1===t?i/r:(Math.pow(t,i)-1)/(Math.pow(t,r)-1)}(n,a,e.stops[i][0],e.stops[i+1][0]),s=e.stops[i][1],l=e.stops[i+1][1];let c=kt[t.type]||Mn;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Rt[e.colorSpace];c=(e,n)=>t.reverse(t.interpolate(t.forward(e),t.forward(n),o))}return"function"==typeof s.evaluate?{evaluate(...e){const t=s.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==n)return c(t,n,o)}}:c(s,l,o)}function An(e,t,n){switch(t.type){case"color":n=Le.parse(n);break;case"formatted":n=Ce.fromString(n.toString());break;case"resolvedImage":n=De.fromString(n.toString());break;case"padding":n=Re.parse(n);break;default:_n(n)===t.type||"enum"===t.type&&t.values[n]||(n=void 0)}return vn(n,e.default,t.default)}Je.register(ln,{error:[{kind:"error"},[pe],(e,[t])=>{throw new Xe(t.evaluate(e))}],typeof:[pe,[fe],(e,[t])=>ze(Ie(t.evaluate(e)))],"to-rgba":[ve(de,4),[be],(e,[t])=>t.evaluate(e).toArray()],rgb:[be,[de,de,de],cn],rgba:[be,[de,de,de,de],cn],has:{type:me,overloads:[[[pe],(e,[t])=>un(t.evaluate(e),e.properties())],[[pe,he],(e,[t,n])=>un(t.evaluate(e),n.evaluate(e))]]},get:{type:fe,overloads:[[[pe],(e,[t])=>dn(t.evaluate(e),e.properties())],[[pe,he],(e,[t,n])=>dn(t.evaluate(e),n.evaluate(e))]]},"feature-state":[fe,[pe],(e,[t])=>dn(t.evaluate(e),e.featureState||{})],properties:[he,[],e=>e.properties()],"geometry-type":[pe,[],e=>e.geometryType()],id:[fe,[],e=>e.id()],zoom:[de,[],e=>e.globals.zoom],"heatmap-density":[de,[],e=>e.globals.heatmapDensity||0],"line-progress":[de,[],e=>e.globals.lineProgress||0],accumulated:[fe,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[de,pn(de),(e,t)=>{let n=0;for(const a of t)n+=a.evaluate(e);return n}],"*":[de,pn(de),(e,t)=>{let n=1;for(const a of t)n*=a.evaluate(e);return n}],"-":{type:de,overloads:[[[de,de],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[de],(e,[t])=>-t.evaluate(e)]]},"/":[de,[de,de],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[de,[de,de],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[de,[],()=>Math.LN2],pi:[de,[],()=>Math.PI],e:[de,[],()=>Math.E],"^":[de,[de,de],(e,[t,n])=>Math.pow(t.evaluate(e),n.evaluate(e))],sqrt:[de,[de],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[de,[de],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[de,[de],(e,[t])=>Math.log(t.evaluate(e))],log2:[de,[de],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[de,[de],(e,[t])=>Math.sin(t.evaluate(e))],cos:[de,[de],(e,[t])=>Math.cos(t.evaluate(e))],tan:[de,[de],(e,[t])=>Math.tan(t.evaluate(e))],asin:[de,[de],(e,[t])=>Math.asin(t.evaluate(e))],acos:[de,[de],(e,[t])=>Math.acos(t.evaluate(e))],atan:[de,[de],(e,[t])=>Math.atan(t.evaluate(e))],min:[de,pn(de),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[de,pn(de),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[de,[de],(e,[t])=>Math.abs(t.evaluate(e))],round:[de,[de],(e,[t])=>{const n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[de,[de],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[de,[de],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[me,[pe,fe],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[me,[fe],(e,[t])=>e.id()===t.value],"filter-type-==":[me,[pe],(e,[t])=>e.geometryType()===t.value],"filter-<":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a<r}],"filter-id-<":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a>r}],"filter-id->":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a<=r}],"filter-id-<=":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a>=r}],"filter-id->=":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[me,[fe],(e,[t])=>t.value in e.properties()],"filter-has-id":[me,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[me,[ve(pe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[me,[ve(fe)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[me,[pe,ve(fe)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[me,[pe,ve(fe)],(e,[t,n])=>function(e,t,n,a){for(;n<=a;){const r=n+a>>1;if(t[r]===e)return!0;t[r]>e?a=r-1:n=r+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:me,overloads:[[[me,me],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[pn(me),(e,t)=>{for(const n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:me,overloads:[[[me,me],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[pn(me),(e,t)=>{for(const n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[me,[me],(e,[t])=>!t.evaluate(e)],"is-supported-script":[me,[pe],(e,[t])=>{const n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[pe,[pe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[pe,[pe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[pe,pn(fe),(e,t)=>t.map(t=>$e(t.evaluate(e))).join("")],"resolved-locale":[pe,[ge],(e,[t])=>t.evaluate(e).resolvedLocale()]});class xn{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Ke,this._defaultValue=t?function(e){return"color"===e.type&&yn(e.default)?new Le(0,0,0,0):"color"===e.type?Le.parse(e.default)||null:"padding"===e.type?Re.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,n,a,r,i){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=a,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=i,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,a,r,i){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=i||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Xe(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function wn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in ln}function Nn(e,t){const n=new Mt(ln,[],t?function(e){const t={color:be,string:pe,number:de,enum:pe,boolean:me,formatted:_e,padding:ye,resolvedImage:Me};return"array"===e.type?ve(t[e.value]||fe,e.length):t[e.type]}(t):void 0),a=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return a?mn(new xn(a,t)):bn(n.errors)}class qn{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!gt(t.expression)}evaluateWithoutErrorHandling(e,t,n,a,r,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,a,r,i)}evaluate(e,t,n,a,r,i){return this._styleExpression.evaluate(e,t,n,a,r,i)}}class En{constructor(e,t,n,a){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!gt(t.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,t,n,a,r,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,a,r,i)}evaluate(e,t,n,a,r,i){return this._styleExpression.evaluate(e,t,n,a,r,i)}interpolationFactor(e,t,n){return this.interpolationType?Dt.interpolationFactor(this.interpolationType,e,t,n):0}}function jn(e,t){const n=Nn(e,t);if("error"===n.result)return n;const a=n.value.expression,r=ft(a);if(!r&&!hn(t))return bn([new le("","data expressions not supported")]);const i=_t(a,["zoom"]);if(!i&&!fn(t))return bn([new le("","zoom expressions not supported")]);const o=function e(t){let n=null;if(t instanceof It)n=e(t.result);else if(t instanceof Bt){for(const a of t.args)if(n=e(a),n)break}else(t instanceof zt||t instanceof Dt)&&t.input instanceof Je&&"zoom"===t.input.name&&(n=t);return n instanceof le||t.eachChild(t=>{const a=e(t);a instanceof le?n=a:!n&&a?n=new le("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&a&&n!==a&&(n=new le("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(a);return o||i?o instanceof le?bn([o]):o instanceof Dt&&!gn(t)?bn([new le("",'"interpolate" expressions cannot be used with this property')]):mn(o?new En(r?"camera":"composite",n.value,o.labels,o instanceof Dt?o.interpolation:void 0):new qn(r?"constant":"source",n.value)):bn([new le("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wn{constructor(e,t){this._parameters=e,this._specification=t,ie(this,function e(t,n){const a="color"===n.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),o=t.type||(gn(n)?"exponential":"interval");if(a||"padding"===n.type){const e=a?Le.parse:Re.parse;(t=ie({},t)).stops&&(t.stops=t.stops.map(t=>[t[0],e(t[1])])),t.default=e(t.default?t.default:n.default)}if(t.colorSpace&&"rgb"!==t.colorSpace&&!Rt[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);let s,l,c;if("exponential"===o)s=kn;else if("interval"===o)s=On;else if("categorical"===o){s=zn,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=An}if(r){const a={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],i=n[0].zoom;void 0===a[i]&&(a[i]={zoom:i,type:t.type,property:t.property,default:t.default,stops:[]},r.push(i)),a[i].stops.push([n[0].value,n[1]])}const i=[];for(const t of r)i.push([a[t].zoom,e(a[t],n)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Dt.interpolationFactor.bind(void 0,o),zoomStops:i.map(e=>e[0]),evaluate:({zoom:e},a)=>kn({stops:i,base:t.base},n,e).evaluate(e,a)}}if(i){const e="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:Dt.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map(e=>e[0]),evaluate:({zoom:e})=>s(t,n,e,l,c)}}return{kind:"source",evaluate(e,a){const r=a&&a.properties?a.properties[t.property]:void 0;return void 0===r?vn(t.default,n.default):s(t,n,r,l,c)}}}(this._parameters,this._specification))}static deserialize(e){return new Wn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ln(e){const t=e.key,n=e.value,a=e.valueSpec||{},r=e.objectElementValidators||{},i=e.style,o=e.styleSpec;let s=[];const l=_n(n);if("object"!==l)return[new ae(t,n,`object expected, ${l} found`)];for(const e in n){const l=e.split(".")[0],c=a[l]||a["*"];let u;if(r[l])u=r[l];else if(a[l])u=oa;else if(r["*"])u=r["*"];else{if(!a["*"]){s.push(new ae(t,n[e],`unknown property "${e}"`));continue}u=oa}s=s.concat(u({key:(t?t+".":t)+e,value:n[e],valueSpec:c,style:i,styleSpec:o,object:n,objectKey:e},n))}for(const e in a)r[e]||a[e].required&&void 0===a[e].default&&void 0===n[e]&&s.push(new ae(t,n,`missing required property "${e}"`));return s}function Sn(e){const t=e.value,n=e.valueSpec,a=e.style,r=e.styleSpec,i=e.key,o=e.arrayElementValidator||oa;if("array"!==_n(t))return[new ae(i,t,`array expected, ${_n(t)} found`)];if(n.length&&t.length!==n.length)return[new ae(i,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new ae(i,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};r.$version<7&&(s.function=n.function),"object"===_n(n.value)&&(s=n.value);let l=[];for(let e=0;e<t.length;e++)l=l.concat(o({array:t,arrayIndex:e,value:t[e],valueSpec:s,style:a,styleSpec:r,key:`${i}[${e}]`}));return l}function Tn(e){const t=e.key,n=e.value,a=e.valueSpec;let r=_n(n);return"number"===r&&n!=n&&(r="NaN"),"number"!==r?[new ae(t,n,`number expected, ${r} found`)]:"minimum"in a&&n<a.minimum?[new ae(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new ae(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Cn(e){const t=e.valueSpec,n=oe(e.value.type);let a,r,i,o={};const s="categorical"!==n&&void 0===e.value.property,l=!s,c="array"===_n(e.value.stops)&&"array"===_n(e.value.stops[0])&&"object"===_n(e.value.stops[0][0]),u=Ln({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===n)return[new ae(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const a=e.value;return t=t.concat(Sn({key:e.key,value:a,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),"array"===_n(a)&&0===a.length&&t.push(new ae(e.key,a,"array must have at least one stop")),t},default:function(e){return oa({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&s&&u.push(new ae(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||u.push(new ae(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!gn(e.valueSpec)&&u.push(new ae(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!hn(e.valueSpec)?u.push(new ae(e.key,e.value,"property functions not supported")):s&&!fn(e.valueSpec)&&u.push(new ae(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==e.value.property||u.push(new ae(e.key,e.value,'"property" property is required')),u;function d(e){let n=[];const a=e.value,s=e.key;if("array"!==_n(a))return[new ae(s,a,`array expected, ${_n(a)} found`)];if(2!==a.length)return[new ae(s,a,`array length 2 expected, length ${a.length} found`)];if(c){if("object"!==_n(a[0]))return[new ae(s,a,`object expected, ${_n(a[0])} found`)];if(void 0===a[0].zoom)return[new ae(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new ae(s,a,"object stop key must have value")];if(i&&i>oe(a[0].zoom))return[new ae(s,a[0].zoom,"stop zoom values must appear in ascending order")];oe(a[0].zoom)!==i&&(i=oe(a[0].zoom),r=void 0,o={}),n=n.concat(Ln({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Tn,value:p}}))}else n=n.concat(p({key:s+"[0]",value:a[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},a));return wn(se(a[1]))?n.concat([new ae(s+"[1]",a[1],"expressions are not allowed in function stops.")]):n.concat(oa({key:s+"[1]",value:a[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function p(e,i){const s=_n(e.value),l=oe(e.value),c=null!==e.value?e.value:i;if(a){if(s!==a)return[new ae(e.key,c,`${s} stop domain type must match previous stop domain type ${a}`)]}else a=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new ae(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let a=`number expected, ${s} found`;return hn(t)&&void 0===n&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ae(e.key,c,a)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==r&&l<r?[new ae(e.key,c,"stop domain values must appear in ascending order")]:(r=l,"categorical"===n&&l in o?[new ae(e.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new ae(e.key,c,"integer expected, found "+l)]}}function Rn(e){const t=("property"===e.expressionContext?jn:Nn)(se(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new ae(`${e.key}${t.key}`,e.value,t.message));const n=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!n.outputDefined())return[new ae(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!gt(n))return[new ae(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!gt(n))return[new ae(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!_t(n,["zoom","feature-state"]))return[new ae(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!ft(n))return[new ae(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Dn(e){const t=e.key,n=e.value,a=e.valueSpec,r=[];return Array.isArray(a.values)?-1===a.values.indexOf(oe(n))&&r.push(new ae(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(a.values).indexOf(oe(n))&&r.push(new ae(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),r}function Pn(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Pn(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const Bn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function In(e){if(null==e)return{filter:()=>!0,needGeometry:!1};Pn(e)||(e=Xn(e));const t=Nn(e,Bn);if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,n,a)=>t.value.evaluate(e,n,{},a),needGeometry:Fn(e)}}function $n(e,t){return e<t?-1:e>t?1:0}function Fn(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t<e.length;t++)if(Fn(e[t]))return!0;return!1}function Xn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Yn(e[1],e[2],"=="):"!="===t?Vn(Yn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Yn(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(Xn))):"all"===t?["all"].concat(e.slice(1).map(Xn)):"none"===t?["all"].concat(e.slice(1).map(Xn).map(Vn)):"in"===t?Hn(e[1],e.slice(2)):"!in"===t?Vn(Hn(e[1],e.slice(2))):"has"===t?Un(e[1]):"!has"===t?Vn(Un(e[1])):"within"!==t||e;var n}function Yn(e,t,n){switch(e){case"$type":return["filter-type-"+n,t];case"$id":return["filter-id-"+n,t];default:return["filter-"+n,e,t]}}function Hn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort($n)]]:["filter-in-small",e,["literal",t]]}}function Un(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Vn(e){return["!",e]}function Gn(e){return Pn(se(e.value))?Rn(ie({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function e(t){const n=t.value,a=t.key;if("array"!==_n(n))return[new ae(a,n,`array expected, ${_n(n)} found`)];const r=t.styleSpec;let i,o=[];if(n.length<1)return[new ae(a,n,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:a+"[0]",value:n[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),oe(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===oe(n[1])&&o.push(new ae(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&o.push(new ae(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(i=_n(n[1]),"string"!==i&&o.push(new ae(a+"[1]",n[1],`string expected, ${i} found`)));for(let e=2;e<n.length;e++)i=_n(n[e]),"$type"===oe(n[1])?o=o.concat(Dn({key:`${a}[${e}]`,value:n[e],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&o.push(new ae(`${a}[${e}]`,n[e],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let r=1;r<n.length;r++)o=o.concat(e({key:`${a}[${r}]`,value:n[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=_n(n[1]),2!==n.length?o.push(new ae(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"string"!==i&&o.push(new ae(a+"[1]",n[1],`string expected, ${i} found`));break;case"within":i=_n(n[1]),2!==n.length?o.push(new ae(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"object"!==i&&o.push(new ae(a+"[1]",n[1],`object expected, ${i} found`))}return o}(e)}function Kn(e,t){const n=e.key,a=e.style,r=e.styleSpec,i=e.value,o=e.objectKey,s=r[`${t}_${e.layerType}`];if(!s)return[];const l=o.match(/^(.*)-transition$/);if("paint"===t&&l&&s[l[1]]&&s[l[1]].transition)return oa({key:n,value:i,valueSpec:r.transition,style:a,styleSpec:r});const c=e.valueSpec||s[o];if(!c)return[new ae(n,i,`unknown property "${o}"`)];let u;if("string"===_n(i)&&hn(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(i)))return[new ae(n,i,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&("text-field"===o&&a&&!a.glyphs&&d.push(new ae(n,i,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&yn(se(i))&&"identity"===oe(i.type)&&d.push(new ae(n,i,'"text-font" does not support identity functions'))),d.concat(oa({key:e.key,value:i,valueSpec:c,style:a,styleSpec:r,expressionContext:"property",propertyType:t,propertyKey:o}))}function Jn(e){return Kn(e,"paint")}function Zn(e){return Kn(e,"layout")}function Qn(e){let t=[];const n=e.value,a=e.key,r=e.style,i=e.styleSpec;n.type||n.ref||t.push(new ae(a,n,'either "type" or "ref" is required'));let o=oe(n.type);const s=oe(n.ref);if(n.id){const i=oe(n.id);for(let o=0;o<e.arrayIndex;o++){const e=r.layers[o];oe(e.id)===i&&t.push(new ae(a,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if("ref"in n){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in n&&t.push(new ae(a,n[e],`"${e}" is prohibited for ref layers`))}),r.layers.forEach(t=>{oe(t.id)===s&&(e=t)}),e?e.ref?t.push(new ae(a,n.ref,"ref cannot reference another ref layer")):o=oe(e.type):t.push(new ae(a,n.ref,`ref layer "${s}" not found`))}else if("background"!==o)if(n.source){const e=r.sources&&r.sources[n.source],i=e&&oe(e.type);e?"vector"===i&&"raster"===o?t.push(new ae(a,n.source,`layer "${n.id}" requires a raster source`)):"raster"===i&&"raster"!==o?t.push(new ae(a,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==i||n["source-layer"]?"raster-dem"===i&&"hillshade"!==o?t.push(new ae(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!n.paint||!n.paint["line-gradient"]||"geojson"===i&&e.lineMetrics||t.push(new ae(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ae(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new ae(a,n.source,`source "${n.source}" not found`))}else t.push(new ae(a,n,'missing required property "source"'));return t=t.concat(Ln({key:a,value:n,valueSpec:i.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>oa({key:a+".type",value:n.type,valueSpec:i.layer.type,style:e.style,styleSpec:e.styleSpec,object:n,objectKey:"type"}),filter:Gn,layout:e=>Ln({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Zn(ie({layerType:o},e))}}),paint:e=>Ln({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Jn(ie({layerType:o},e))}})}})),t}function ea(e){const t=e.value,n=e.key,a=_n(t);return"string"!==a?[new ae(n,t,`string expected, ${a} found`)]:[]}const ta={promoteId:function({key:e,value:t}){if("string"===_n(t))return ea({key:e,value:t});{const n=[];for(const a in t)n.push(...ea({key:`${e}.${a}`,value:t[a]}));return n}}};function na(e){const t=e.value,n=e.key,a=e.styleSpec,r=e.style;if(!t.type)return[new ae(n,t,'"type" is required')];const i=oe(t.type);let o;switch(i){case"vector":case"raster":case"raster-dem":return o=Ln({key:n,value:t,valueSpec:a["source_"+i.replace("-","_")],style:e.style,styleSpec:a,objectElementValidators:ta}),o;case"geojson":if(o=Ln({key:n,value:t,valueSpec:a.source_geojson,style:r,styleSpec:a,objectElementValidators:ta}),t.cluster)for(const e in t.clusterProperties){const[a,r]=t.clusterProperties[e],i="string"==typeof a?[a,["accumulated"],["get",e]]:a;o.push(...Rn({key:`${n}.${e}.map`,value:r,expressionContext:"cluster-map"})),o.push(...Rn({key:`${n}.${e}.reduce`,value:i,expressionContext:"cluster-reduce"}))}return o;case"video":return Ln({key:n,value:t,valueSpec:a.source_video,style:r,styleSpec:a});case"image":return Ln({key:n,value:t,valueSpec:a.source_image,style:r,styleSpec:a});case"canvas":return[new ae(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:n+".type",value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:a})}}function aa(e){const t=e.value,n=e.styleSpec,a=n.light,r=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new ae("light",t,`object expected, ${o} found`)]),i;for(const e in t){const o=e.match(/^(.*)-transition$/);i=i.concat(o&&a[o[1]]&&a[o[1]].transition?oa({key:e,value:t[e],valueSpec:n.transition,style:r,styleSpec:n}):a[e]?oa({key:e,value:t[e],valueSpec:a[e],style:r,styleSpec:n}):[new ae(e,t[e],`unknown property "${e}"`)])}return i}function ra(e){const t=e.value,n=e.styleSpec,a=n.terrain,r=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new ae("terrain",t,`object expected, ${o} found`)]),i;for(const e in t)i=i.concat(a[e]?oa({key:e,value:t[e],valueSpec:a[e],style:r,styleSpec:n}):[new ae(e,t[e],`unknown property "${e}"`)]);return i}const ia={"*":()=>[],array:Sn,boolean:function(e){const t=e.value,n=e.key,a=_n(t);return"boolean"!==a?[new ae(n,t,`boolean expected, ${a} found`)]:[]},number:Tn,color:function(e){const t=e.key,n=e.value,a=_n(n);return"string"!==a?[new ae(t,n,`color expected, ${a} found`)]:null===we(n)?[new ae(t,n,`color expected, "${n}" found`)]:[]},constants:re,enum:Dn,filter:Gn,function:Cn,layer:Qn,object:Ln,source:na,light:aa,terrain:ra,string:ea,formatted:function(e){return 0===ea(e).length?[]:Rn(e)},resolvedImage:function(e){return 0===ea(e).length?[]:Rn(e)},padding:function(e){const t=e.key,n=e.value;if("array"===_n(n)){if(n.length<1||n.length>4)return[new ae(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const e={type:"number"};let a=[];for(let r=0;r<n.length;r++)a=a.concat(oa({key:`${t}[${r}]`,value:n[r],valueSpec:e}));return a}return Tn({key:t,value:n,valueSpec:{}})}};function oa(e){const t=e.value,n=e.valueSpec,a=e.styleSpec;return n.expression&&yn(oe(t))?Cn(e):n.expression&&wn(se(t))?Rn(e):n.type&&ia[n.type]?ia[n.type](e):Ln(ie({},e,{valueSpec:n.type?a[n.type]:n}))}function sa(e){const t=e.value,n=e.key,a=ea(e);return a.length||(-1===t.indexOf("{fontstack}")&&a.push(new ae(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&a.push(new ae(n,t,'"glyphs" url must include a "{range}" token'))),a}function la(e,t=ne){let n=[];return n=n.concat(oa({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:sa,"*":()=>[]}})),e.constants&&(n=n.concat(re({key:"constants",value:e.constants,style:e,styleSpec:t}))),ca(n)}function ca(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function ua(e){return function(...t){return ca(e.apply(this,t))}}la.source=ua(na),la.light=ua(aa),la.terrain=ua(ra),la.layer=ua(Qn),la.filter=ua(Gn),la.paintProperty=ua(Jn),la.layoutProperty=ua(Zn);const da=la,pa=da.light,ma=da.paintProperty,ba=da.layoutProperty;function ha(e,t){let n=!1;if(t&&t.length)for(const a of t)e.fire(new ee(new Error(a.message))),n=!0;return n}class fa{constructor(e,t,n){const a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const r=new Int32Array(this.arrayBuffer);e=r[0],this.d=(t=r[1])+2*(n=r[2]);for(let e=0;e<this.d*this.d;e++){const t=r[3+e],n=r[3+e+1];a.push(t===n?null:r.subarray(t,n))}const i=r[3+a.length+1];this.keys=r.subarray(r[3+a.length],i),this.bboxes=r.subarray(i),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)a.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const r=n/t*e;this.min=-r,this.max=e+r}insert(e,t,n,a,r){this._forEachCell(t,n,a,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,a,r,i){this.cells[r].push(i)}query(e,t,n,a,r){const i=this.min,o=this.max;if(e<=i&&t<=i&&o<=n&&o<=a&&!r)return Array.prototype.slice.call(this.keys);{const i=[];return this._forEachCell(e,t,n,a,this._queryCell,i,{},r),i}}_queryCell(e,t,n,a,r,i,o,s){const l=this.cells[r];if(null!==l){const r=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const d=l[u];if(void 0===o[d]){const l=4*d;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):e<=c[l+2]&&t<=c[l+3]&&n>=c[l+0]&&a>=c[l+1])?(o[d]=!0,i.push(r[d])):o[d]=!1}}}}_forEachCell(e,t,n,a,r,i,o,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(a);for(let p=l;p<=u;p++)for(let l=c;l<=d;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&r.call(this,e,t,n,a,c,i,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=3+this.cells.length+1+1;let n=0;for(let e=0;e<this.cells.length;e++)n+=this.cells[e].length;const a=new Int32Array(t+n+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let r=t;for(let t=0;t<e.length;t++){const n=e[t];a[3+t]=r,a.set(n,r),r+=n.length}return a[3+e.length]=r,a.set(this.keys,r),r+=this.keys.length,a[3+e.length+1]=r,a.set(this.bboxes,r),r+=this.bboxes.length,a.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new fa(e.buffer)}}const ga={};function _a(e,t,n={}){if(ga[e])throw new Error(e+" is already registered.");Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ga[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}_a("Object",Object),_a("TransferableGridIndex",fa),_a("Color",Le),_a("Error",Error),_a("AJAXError",I),_a("ResolvedImage",De),_a("StylePropertyFunction",Wn),_a("StyleExpression",xn,{omit:["_evaluator"]}),_a("ZoomDependentExpression",En),_a("ZoomConstantExpression",qn),_a("CompoundExpression",Je,{omit:["_evaluate"]});for(const e in ln)ln[e]._classRegistryKey||_a("Expression_"+e,ln[e]);function ya(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Ma(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob)return e;if(ya(e))return t&&t.push(e),e;if(O(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){const n=e;return t&&t.push(n.buffer),n}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){const n=[];for(const a of e)n.push(Ma(a,t));return n}if("object"==typeof e){const n=e.constructor,a=n._classRegistryKey;if(!a)throw new Error("can't serialize object of unregistered class");if(!ga[a])throw new Error(a+" is not registered.");const r=n.serialize?n.serialize(e,t):{};if(n.serialize){if(t&&r===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const n in e){if(!e.hasOwnProperty(n))continue;if(ga[a].omit.indexOf(n)>=0)continue;const i=e[n];r[n]=ga[a].shallow.indexOf(n)>=0?i:Ma(i,t)}e instanceof Error&&(r.message=e.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(r.$name=a),r}throw new Error("can't serialize object of type "+typeof e)}function va(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||ya(e)||O(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(va);if("object"==typeof e){const t=e.$name||"Object";if(!ga[t])throw new Error("can't deserialize unregistered class "+t);const{klass:n}=ga[t];if(!n)throw new Error("can't deserialize unregistered class "+t);if(n.deserialize)return n.deserialize(e);const a=Object.create(n.prototype);for(const n of Object.keys(e)){if("$name"===n)continue;const r=e[n];a[n]=ga[t].shallow.indexOf(n)>=0?r:va(r)}return a}throw new Error("can't deserialize object of type "+typeof e)}class za{constructor(){this.first=!0}update(e,t){const n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}const Oa={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function ka(e){for(const t of e)if(wa(t.charCodeAt(0)))return!0;return!1}function Aa(e){for(const t of e)if(!xa(t.charCodeAt(0)))return!1;return!0}function xa(e){return!(Oa.Arabic(e)||Oa["Arabic Supplement"](e)||Oa["Arabic Extended-A"](e)||Oa["Arabic Presentation Forms-A"](e)||Oa["Arabic Presentation Forms-B"](e))}function wa(e){return!(746!==e&&747!==e&&(e<4352||!(Oa["Bopomofo Extended"](e)||Oa.Bopomofo(e)||Oa["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Oa["CJK Compatibility Ideographs"](e)||Oa["CJK Compatibility"](e)||Oa["CJK Radicals Supplement"](e)||Oa["CJK Strokes"](e)||!(!Oa["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Oa["CJK Unified Ideographs Extension A"](e)||Oa["CJK Unified Ideographs"](e)||Oa["Enclosed CJK Letters and Months"](e)||Oa["Hangul Compatibility Jamo"](e)||Oa["Hangul Jamo Extended-A"](e)||Oa["Hangul Jamo Extended-B"](e)||Oa["Hangul Jamo"](e)||Oa["Hangul Syllables"](e)||Oa.Hiragana(e)||Oa["Ideographic Description Characters"](e)||Oa.Kanbun(e)||Oa["Kangxi Radicals"](e)||Oa["Katakana Phonetic Extensions"](e)||Oa.Katakana(e)&&12540!==e||!(!Oa["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Oa["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Oa["Unified Canadian Aboriginal Syllabics"](e)||Oa["Unified Canadian Aboriginal Syllabics Extended"](e)||Oa["Vertical Forms"](e)||Oa["Yijing Hexagram Symbols"](e)||Oa["Yi Syllables"](e)||Oa["Yi Radicals"](e))))}function Na(e){return!(wa(e)||function(e){return!!(Oa["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Oa["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||Oa["Letterlike Symbols"](e)||Oa["Number Forms"](e)||Oa["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||Oa["Control Pictures"](e)&&9251!==e||Oa["Optical Character Recognition"](e)||Oa["Enclosed Alphanumerics"](e)||Oa["Geometric Shapes"](e)||Oa["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Oa["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Oa["CJK Symbols and Punctuation"](e)||Oa.Katakana(e)||Oa["Private Use Area"](e)||Oa["CJK Compatibility Forms"](e)||Oa["Small Form Variants"](e)||Oa["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function qa(e){return e>=1424&&e<=2303||Oa["Arabic Presentation Forms-A"](e)||Oa["Arabic Presentation Forms-B"](e)}function Ea(e,t){return!(!t&&qa(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Oa.Khmer(e))}function ja(e){for(const t of e)if(qa(t.charCodeAt(0)))return!0;return!1}const Wa="deferred",La="loading",Sa="loaded";let Ta=null,Ca="unavailable",Ra=null;const Da=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Ca="error"),Ta&&Ta(e)};function Pa(){Ba.fire(new Q("pluginStateChange",{pluginStatus:Ca,pluginURL:Ra}))}const Ba=new te,Ia=function(){return Ca},$a=function(){if(Ca!==Wa||!Ra)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ca=La,Pa(),Ra&&Y({url:Ra},e=>{e?Da(e):(Ca=Sa,Pa())})},Fa={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ca===Sa||null!=Fa.applyArabicShaping,isLoading:()=>Ca===La,setState(e){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ca=e.pluginStatus,Ra=e.pluginURL},isParsed(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Fa.applyArabicShaping&&null!=Fa.processBidirectionalText&&null!=Fa.processStyledBidirectionalText},getPluginURL(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Ra}};class Xa{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new za,this.transition={})}isSupportedScript(e){return function(e,t){for(const n of e)if(!Ea(n.charCodeAt(0),t))return!1;return!0}(e,Fa.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}class Ya{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(yn(e))return new Wn(e,t);if(wn(e)){const n=jn(e,t);if("error"===n.result)throw new Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let n=e;return"color"===t.type&&"string"==typeof e?n=Le.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)||(n=Re.parse(e)),{kind:"constant",evaluate:()=>n}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ha{constructor(e){this.property=e,this.value=new Ya(e,void 0)}transitioned(e,t){return new Va(this.property,this.value,t,s({},e.transition,this.transition),e.now)}untransitioned(){return new Va(this.property,this.value,null,{},0)}}class Ua{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return p(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ha(this._values[e].property)),this._values[e].value=new Ya(this._values[e].property,null===t?void 0:p(t))}getTransition(e){return p(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ha(this._values[e].property)),this._values[e].transition=p(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);void 0!==n&&(e[t]=n);const a=this.getTransition(t);void 0!==a&&(e[t+"-transition"]=a)}return e}transitioned(e,t){const n=new Ga(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(e,t._values[a]);return n}untransitioned(){const e=new Ga(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Va{constructor(e,t,n,a,r){this.property=e,this.value=t,this.begin=r+a.delay||0,this.end=this.begin+a.duration||0,e.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const a=e.now||0,r=this.value.possiblyEvaluate(e,t,n),i=this.prior;if(i){if(a>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(a<this.begin)return i.possiblyEvaluate(e,t,n);{const o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(i.possiblyEvaluate(e,t,n),r,function(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}(o))}}return r}}class Ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){const a=new Za(this._properties);for(const r of Object.keys(this._values))a._values[r]=this._values[r].possiblyEvaluate(e,t,n);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Ka{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return p(this._values[e].value)}setValue(e,t){this._values[e]=new Ya(this._values[e].property,null===t?void 0:p(t))}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);void 0!==n&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){const a=new Za(this._properties);for(const r of Object.keys(this._values))a._values[r]=this._values[r].possiblyEvaluate(e,t,n);return a}}class Ja{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,n,a){return this.property.evaluate(this.value,this.parameters,e,t,n,a)}}class Za{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Qa{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,n){const a=kt[this.specification.type];return a?a(e,t,n):e}}class er{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,a){return new Ja(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},n,a)}:e.expression,t)}interpolate(e,t,n){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Ja(this,{kind:"constant",value:void 0},e.parameters);const a=kt[this.specification.type];return a?new Ja(this,{kind:"constant",value:a(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,a,r,i){return"constant"===e.kind?e.value:e.evaluate(t,n,a,r,i)}}class tr extends er{possiblyEvaluate(e,t,n,a){if(void 0===e.value)return new Ja(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},n,a),i="resolvedImage"===e.property.specification.type&&"string"!=typeof r?r.name:r,o=this._calculate(i,i,i,t);return new Ja(this,{kind:"constant",value:o},t)}if("camera"===e.expression.kind){const n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Ja(this,{kind:"constant",value:n},t)}return new Ja(this,e.expression,t)}evaluate(e,t,n,a,r,i){if("source"===e.kind){const o=e.evaluate(t,n,a,r,i);return this._calculate(o,o,o,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,a),e.evaluate({zoom:Math.floor(t.zoom)},n,a),e.evaluate({zoom:Math.floor(t.zoom)+1},n,a),t):e.value}_calculate(e,t,n,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class nr{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,a){if(void 0!==e.value){if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},n,a);return this._calculate(r,r,r,t)}return this._calculate(e.expression.evaluate(new Xa(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Xa(Math.floor(t.zoom),t)),e.expression.evaluate(new Xa(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ar{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,a){return!!e.expression.evaluate(t,null,{},n,a)}interpolate(){return!1}}class rr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const n=e[t];n.specification.overridable&&this.overridableProperties.push(t);const a=this.defaultPropertyValues[t]=new Ya(n,void 0),r=this.defaultTransitionablePropertyValues[t]=new Ha(n);this.defaultTransitioningPropertyValues[t]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=a.possiblyEvaluate({})}}}_a("DataDrivenProperty",er),_a("DataConstantProperty",Qa),_a("CrossFadedDataDrivenProperty",tr),_a("CrossFadedProperty",nr),_a("ColorRampProperty",ar);const ir="-transition";class or extends te{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Ka(t.layout)),t.paint)){this._transitionablePaint=new Ua(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Za(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,n={}){null!=t&&this._validate(ba,`layers.${this.id}.layout.${e}`,e,t,n)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(ir)?this._transitionablePaint.getTransition(e.slice(0,-ir.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(null!=t&&this._validate(ma,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(ir))return this._transitionablePaint.setTransition(e.slice(0,-ir.length),t||void 0),!1;{const n=this._transitionablePaint._values[e],a="cross-faded-data-driven"===n.property.specification["property-type"],r=n.value.isDataDriven(),i=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const o=this._transitionablePaint._values[e].value;return o.isDataDriven()||r||a||this._handleOverridablePaintPropertyUpdate(e,i,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),d(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,n,a,r={}){return(!r||!1!==r.validate)&&ha(this,e.call(da,{key:t,layerType:this.type,objectKey:n,value:a,styleSpec:ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Ja&&hn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const sr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class lr{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class cr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ur(e,t=1){let n=0,a=0;return{members:e.map(e=>{const r=sr[e.type].BYTES_PER_ELEMENT,i=n=dr(n,Math.max(t,r)),o=e.components||1;return a=Math.max(a,r),n+=r*o,{name:e.name,type:e.type,components:o,offset:i}}),size:dr(n,Math.max(a,t)),alignment:t}}function dr(e,t){return Math.ceil(e/t)*t}class pr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const a=2*e;return this.int16[a+0]=t,this.int16[a+1]=n,e}}pr.prototype.bytesPerElement=4,_a("StructArrayLayout2i4",pr);class mr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,a)}emplace(e,t,n,a,r){const i=4*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=a,this.int16[i+3]=r,e}}mr.prototype.bytesPerElement=8,_a("StructArrayLayout4i8",mr);class br extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,a,r,i)}emplace(e,t,n,a,r,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=a,this.int16[s+3]=r,this.int16[s+4]=i,this.int16[s+5]=o,e}}br.prototype.bytesPerElement=12,_a("StructArrayLayout2i4i12",br);class hr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,a,r,i)}emplace(e,t,n,a,r,i,o){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[l+4]=a,this.uint8[l+5]=r,this.uint8[l+6]=i,this.uint8[l+7]=o,e}}hr.prototype.bytesPerElement=8,_a("StructArrayLayout2i4ub8",hr);class fr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const a=2*e;return this.float32[a+0]=t,this.float32[a+1]=n,e}}fr.prototype.bytesPerElement=8,_a("StructArrayLayout2f8",fr);class gr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,a,r,i,o,s,l,c)}emplace(e,t,n,a,r,i,o,s,l,c,u){const d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=a,this.uint16[d+3]=r,this.uint16[d+4]=i,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.uint16[d+8]=c,this.uint16[d+9]=u,e}}gr.prototype.bytesPerElement=20,_a("StructArrayLayout10ui20",gr);class _r extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c,u,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,a,r,i,o,s,l,c,u,d)}emplace(e,t,n,a,r,i,o,s,l,c,u,d,p){const m=12*e;return this.int16[m+0]=t,this.int16[m+1]=n,this.int16[m+2]=a,this.int16[m+3]=r,this.uint16[m+4]=i,this.uint16[m+5]=o,this.uint16[m+6]=s,this.uint16[m+7]=l,this.int16[m+8]=c,this.int16[m+9]=u,this.int16[m+10]=d,this.int16[m+11]=p,e}}_r.prototype.bytesPerElement=24,_a("StructArrayLayout4i4ui4i24",_r);class yr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=3*e;return this.float32[r+0]=t,this.float32[r+1]=n,this.float32[r+2]=a,e}}yr.prototype.bytesPerElement=12,_a("StructArrayLayout3f12",yr);class Mr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Mr.prototype.bytesPerElement=4,_a("StructArrayLayout1ul4",Mr);class vr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,a,r,i,o,s,l)}emplace(e,t,n,a,r,i,o,s,l,c){const u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=a,this.int16[u+3]=r,this.int16[u+4]=i,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}vr.prototype.bytesPerElement=20,_a("StructArrayLayout6i1ul2ui20",vr);class zr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,a,r,i)}emplace(e,t,n,a,r,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=a,this.int16[s+3]=r,this.int16[s+4]=i,this.int16[s+5]=o,e}}zr.prototype.bytesPerElement=12,_a("StructArrayLayout2i2i2i12",zr);class Or extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,a,r)}emplace(e,t,n,a,r,i){const o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=a,this.int16[s+6]=r,this.int16[s+7]=i,e}}Or.prototype.bytesPerElement=16,_a("StructArrayLayout2f1f2i16",Or);class kr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,a)}emplace(e,t,n,a,r){const i=12*e,o=3*e;return this.uint8[i+0]=t,this.uint8[i+1]=n,this.float32[o+1]=a,this.float32[o+2]=r,e}}kr.prototype.bytesPerElement=12,_a("StructArrayLayout2ub2f12",kr);class Ar extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=3*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,this.uint16[r+2]=a,e}}Ar.prototype.bytesPerElement=6,_a("StructArrayLayout3ui6",Ar);class xr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f){const g=this.length;return this.resize(g+1),this.emplace(g,e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f)}emplace(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g){const _=24*e,y=12*e,M=48*e;return this.int16[_+0]=t,this.int16[_+1]=n,this.uint16[_+2]=a,this.uint16[_+3]=r,this.uint32[y+2]=i,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+12]=u,this.float32[y+7]=d,this.float32[y+8]=p,this.uint8[M+36]=m,this.uint8[M+37]=b,this.uint8[M+38]=h,this.uint32[y+10]=f,this.int16[_+22]=g,e}}xr.prototype.bytesPerElement=48,_a("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xr);class wr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g,_,y,M,v,z,O,k,A,x,w){const N=this.length;return this.resize(N+1),this.emplace(N,e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g,_,y,M,v,z,O,k,A,x,w)}emplace(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g,_,y,M,v,z,O,k,A,x,w,N){const q=34*e,E=17*e;return this.int16[q+0]=t,this.int16[q+1]=n,this.int16[q+2]=a,this.int16[q+3]=r,this.int16[q+4]=i,this.int16[q+5]=o,this.int16[q+6]=s,this.int16[q+7]=l,this.uint16[q+8]=c,this.uint16[q+9]=u,this.uint16[q+10]=d,this.uint16[q+11]=p,this.uint16[q+12]=m,this.uint16[q+13]=b,this.uint16[q+14]=h,this.uint16[q+15]=f,this.uint16[q+16]=g,this.uint16[q+17]=_,this.uint16[q+18]=y,this.uint16[q+19]=M,this.uint16[q+20]=v,this.uint16[q+21]=z,this.uint16[q+22]=O,this.uint32[E+12]=k,this.float32[E+13]=A,this.float32[E+14]=x,this.float32[E+15]=w,this.float32[E+16]=N,e}}wr.prototype.bytesPerElement=68,_a("StructArrayLayout8i15ui1ul4f68",wr);class Nr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Nr.prototype.bytesPerElement=4,_a("StructArrayLayout1f4",Nr);class qr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=3*e;return this.int16[r+0]=t,this.int16[r+1]=n,this.int16[r+2]=a,e}}qr.prototype.bytesPerElement=6,_a("StructArrayLayout3i6",qr);class Er extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=4*e;return this.uint32[2*e+0]=t,this.uint16[r+2]=n,this.uint16[r+3]=a,e}}Er.prototype.bytesPerElement=8,_a("StructArrayLayout1ul2ui8",Er);class jr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const a=2*e;return this.uint16[a+0]=t,this.uint16[a+1]=n,e}}jr.prototype.bytesPerElement=4,_a("StructArrayLayout2ui4",jr);class Wr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Wr.prototype.bytesPerElement=2,_a("StructArrayLayout1ui2",Wr);class Lr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,a)}emplace(e,t,n,a,r){const i=4*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=a,this.float32[i+3]=r,e}}Lr.prototype.bytesPerElement=16,_a("StructArrayLayout4f16",Lr);class Sr extends lr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new A(this.anchorPointX,this.anchorPointY)}}Sr.prototype.size=20;class Tr extends vr{get(e){return new Sr(this,e)}}_a("CollisionBoxArray",Tr);class Cr extends lr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Cr.prototype.size=48;class Rr extends xr{get(e){return new Cr(this,e)}}_a("PlacedSymbolArray",Rr);class Dr extends lr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get 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]}}Dr.prototype.size=68;class Pr extends wr{get(e){return new Dr(this,e)}}_a("SymbolInstanceArray",Pr);class Br extends Nr{getoffsetX(e){return this.float32[1*e+0]}}_a("GlyphOffsetArray",Br);class Ir extends qr{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}_a("SymbolLineVertexArray",Ir);class $r extends lr{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]}}$r.prototype.size=8;class Fr extends Er{get(e){return new $r(this,e)}}_a("FeatureIndexArray",Fr);class Xr extends pr{}class Yr extends pr{}class Hr extends pr{}class Ur extends br{}class Vr extends hr{}class Gr extends fr{}class Kr extends gr{}class Jr extends _r{}class Zr extends yr{}class Qr extends Mr{}class ei extends zr{}class ti extends kr{}class ni extends Ar{}class ai extends jr{}const ri=ur([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=ri;class oi{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,a){let r=this.segments[this.segments.length-1];return e>oi.MAX_VERTEX_ARRAY_LENGTH&&b(`Max vertices per segment is ${oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!r||r.vertexLength+e>oi.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==a)&&(r={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==a&&(r.sortKey=a),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,a){return new oi([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}function si(e,t){return 256*(e=i(Math.floor(e),0,255))+i(Math.floor(t),0,255)}oi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,_a("SegmentVector",oi);const li=ur([{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 ci={exports:{}},ui={exports:{}};ui.exports=function(e,t){var n,a,r,i,o,s,l,c;for(a=e.length-(n=3&e.length),r=t,o=3432918353,s=461845907,c=0;c<a;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,r=27492+(65535&(i=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var di={exports:{}};di.exports=function(e,t){for(var n,a=e.length,r=t^a,i=0;a>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(i)|(255&e.charCodeAt(++i))<<8|(255&e.charCodeAt(++i))<<16|(255&e.charCodeAt(++i))<<24))+((1540483477*(n>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),a-=4,++i;switch(a){case 3:r^=(255&e.charCodeAt(i+2))<<16;case 2:r^=(255&e.charCodeAt(i+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(i)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};var pi=ui.exports,mi=di.exports;ci.exports=pi,ci.exports.murmur3=pi,ci.exports.murmur2=mi;class bi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,a){this.ids.push(hi(e)),this.positions.push(t,n,a)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=hi(e);let n=0,a=this.ids.length-1;for(;n<a;){const e=n+a>>1;this.ids[e]>=t?a=e:n=e+1}const r=[];for(;this.ids[n]===t;)r.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return r}static serialize(e,t){const n=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(t,n,a,r){for(;a<r;){const i=t[a+r>>1];let o=a-1,s=r+1;for(;;){do{o++}while(t[o]<i);do{s--}while(t[s]>i);if(o>=s)break;fi(t,o,s),fi(n,3*o,3*s),fi(n,3*o+1,3*s+1),fi(n,3*o+2,3*s+2)}s-a<r-s?(e(t,n,a,s),a=s+1):(e(t,n,s+1,r),r=s)}}(n,a,0,n.length-1),t&&t.push(n.buffer,a.buffer),{ids:n,positions:a}}static deserialize(e){const t=new bi;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function hi(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:ci.exports(String(e))}function fi(e,t,n){const a=e[t];e[t]=e[n],e[n]=a}_a("FeaturePositionMap",bi);class gi{constructor(e,t){this.gl=e.gl,this.location=t}}class _i extends gi{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class yi extends gi{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Mi extends gi{constructor(e,t){super(e,t),this.current=Le.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const vi=new Float32Array(16);function zi(e){return[si(255*e.r,255*e.g),si(255*e.b,255*e.a)]}class Oi{constructor(e,t,n){this.value=e,this.uniformNames=t.map(e=>"u_"+e),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return"color"===this.type?new Mi(e,t):new _i(e,t)}}class ki{constructor(e,t){this.uniformNames=t.map(e=>"u_"+e),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,n,a){const r="u_pattern_to"===a?this.patternTo:"u_pattern_from"===a?this.patternFrom:"u_pixel_ratio_to"===a?this.pixelRatioTo:"u_pixel_ratio_from"===a?this.pixelRatioFrom:null;r&&e.set(r)}getBinding(e,t,n){return"u_pattern"===n.substr(0,9)?new yi(e,t):new _i(e,t)}}class Ai{constructor(e,t,n,a){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:"a_"+e,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,n,a,r){const i=this.paintVertexArray.length,o=this.expression.evaluate(new Xa(0),t,{},a,[],r);this.paintVertexArray.resize(e),this._setPaintValue(i,e,o)}updatePaintArray(e,t,n,a){const r=this.expression.evaluate({zoom:0},n,a);this._setPaintValue(e,t,r)}_setPaintValue(e,t,n){if("color"===this.type){const a=zi(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,a[0],a[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class xi{constructor(e,t,n,a,r,i){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=n,this.useIntegerZoom=a,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:"a_"+e,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,n,a,r){const i=this.expression.evaluate(new Xa(this.zoom),t,{},a,[],r),o=this.expression.evaluate(new Xa(this.zoom+1),t,{},a,[],r),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,i,o)}updatePaintArray(e,t,n,a){const r=this.expression.evaluate({zoom:this.zoom},n,a),i=this.expression.evaluate({zoom:this.zoom+1},n,a);this._setPaintValue(e,t,r,i)}_setPaintValue(e,t,n,a){if("color"===this.type){const r=zi(n),i=zi(a);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1],i[0],i[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n,a);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,a=i(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(a)}getBinding(e,t,n){return new _i(e,t)}}class wi{constructor(e,t,n,a,r,i){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=a,this.layerId=i,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(e,t,n){const a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(a,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,a,r){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],r)}_setPaintValues(e,t,n,a){if(!a||!n)return;const{min:r,mid:i,max:o}=n,s=a[r],l=a[i],c=a[o];if(s&&l&&c)for(let n=e;n<t;n++)this.zoomInPaintVertexArray.emplace(n,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(n,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,li.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,li.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ni{constructor(e,t,n){this.binders={},this._buffers=[];const a=[];for(const r in e.paint._values){if(!n(r))continue;const i=e.paint.get(r);if(!(i instanceof Ja&&hn(i.property.specification)))continue;const o=Ei(r,e.type),s=i.value,l=i.property.specification.type,c=i.property.useIntegerZoom,u=i.property.specification["property-type"],d="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[r]=d?new ki(s.value,o):new Oi(s.value,o,l),a.push("/u_"+r);else if("source"===s.kind||d){const n=ji(r,l,"source");this.binders[r]=d?new wi(s,l,c,t,n,e.id):new Ai(s,o,l,n),a.push("/a_"+r)}else{const e=ji(r,l,"composite");this.binders[r]=new xi(s,o,l,c,t,e),a.push("/z_"+r)}}this.cacheKey=a.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Ai||t instanceof xi?t.maxValue:0}populatePaintArrays(e,t,n,a,r){for(const i in this.binders){const o=this.binders[i];(o instanceof Ai||o instanceof xi||o instanceof wi)&&o.populatePaintArray(e,t,n,a,r)}}setConstantPatternPositions(e,t){for(const n in this.binders){const a=this.binders[n];a instanceof ki&&a.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,a,r){let i=!1;for(const o in e){const s=t.getPositions(o);for(const t of s){const s=n.feature(t.index);for(const n in this.binders){const l=this.binders[n];if((l instanceof Ai||l instanceof xi||l instanceof wi)&&!0===l.expression.isStateDependent){const c=a.paint.get(n);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[o],r),i=!0}}}}return i}defines(){const e=[];for(const t in this.binders){const n=this.binders[t];(n instanceof Oi||n instanceof ki)&&e.push(...n.uniformNames.map(e=>"#define HAS_UNIFORM_"+e))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const n=this.binders[t];if(n instanceof Ai||n instanceof xi)for(let t=0;t<n.paintVertexAttributes.length;t++)e.push(n.paintVertexAttributes[t].name);else if(n instanceof wi)for(let t=0;t<li.members.length;t++)e.push(li.members[t].name)}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const n=this.binders[t];if(n instanceof Oi||n instanceof ki||n instanceof xi)for(const t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const n=[];for(const a in this.binders){const r=this.binders[a];if(r instanceof Oi||r instanceof ki||r instanceof xi)for(const i of r.uniformNames)if(t[i]){const o=r.getBinding(e,t[i],i);n.push({name:i,property:a,binding:o})}}return n}setUniforms(e,t,n,a){for(const{name:e,property:r,binding:i}of t)this.binders[r].setUniform(i,a,n.get(r),e)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const n=this.binders[t];if(e&&n instanceof wi){const t=2===e.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(n instanceof Ai||n instanceof xi)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(const t in this.binders){const n=this.binders[t];(n instanceof Ai||n instanceof xi||n instanceof wi)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Ai||t instanceof xi||t instanceof wi)&&t.destroy()}}}class qi{constructor(e,t,n=(()=>!0)){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Ni(a,t,n);this.needsUpload=!1,this._featureMap=new bi,this._bufferOffset=0}populatePaintArrays(e,t,n,a,r,i){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,a,r,i);void 0!==t.id&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,a){for(const r of n)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(e,this._featureMap,t,r,a)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ei(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(t+"-","").replace(/-/g,"_")]}function ji(e,t,n){const a={color:{source:fr,composite:Lr},number:{source:Nr,composite:fr}},r=function(e){return{"line-pattern":{source:Kr,composite:Kr},"fill-pattern":{source:Kr,composite:Kr},"fill-extrusion-pattern":{source:Kr,composite:Kr}}[e]}(e);return r&&r[n]||a[t][n]}_a("ConstantBinder",Oi),_a("CrossFadedConstantBinder",ki),_a("SourceExpressionBinder",Ai),_a("CrossFadedCompositeBinder",wi),_a("CompositeExpressionBinder",xi),_a("ProgramConfiguration",Ni,{omit:["_buffers"]}),_a("ProgramConfigurationSet",qi);var Wi=8192;const Li=Math.pow(2,14)-1,Si=-Li-1;function Ti(e){const t=Wi/e.extent,n=e.loadGeometry();for(let e=0;e<n.length;e++){const a=n[e];for(let e=0;e<a.length;e++){const n=a[e],r=Math.round(n.x*t),o=Math.round(n.y*t);n.x=i(r,Si,Li),n.y=i(o,Si,Li),(r<n.x||r>n.x+1||o<n.y||o>n.y+1)&&b("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Ci(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ti(e):[]}}function Ri(e,t,n,a,r){e.emplaceBack(2*t+(a+1)/2,2*n+(r+1)/2)}class Di{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Yr,this.indexArray=new ni,this.segments=new oi,this.programConfigurations=new qi(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){const a=this.layers[0],r=[];let i=null,o=!1;"circle"===a.type&&(i=a.layout.get("circle-sort-key"),o=!i.isConstant());for(const{feature:t,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ci(t,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),c,n))continue;const u=o?i.evaluate(c,{},n):void 0,d={id:a,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Ti(t),patterns:{},sortKey:u};r.push(d)}o&&r.sort((e,t)=>e.sortKey-t.sortKey);for(const a of r){const{geometry:r,index:i,sourceLayerIndex:o}=a,s=e[i].feature;this.addFeature(a,r,i,n),t.featureIndex.insert(s,r,i,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ii),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,a){for(const n of t)for(const t of n){const n=t.x,a=t.y;if(n<0||n>=Wi||a<0||a>=Wi)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),i=r.vertexLength;Ri(this.layoutVertexArray,n,a,-1,-1),Ri(this.layoutVertexArray,n,a,1,-1),Ri(this.layoutVertexArray,n,a,1,1),Ri(this.layoutVertexArray,n,a,-1,1),this.indexArray.emplaceBack(i,i+1,i+2),this.indexArray.emplaceBack(i,i+3,i+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},a)}}function Pi(e,t){for(let n=0;n<e.length;n++)if(Vi(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Vi(e,t[n]))return!0;return!!Fi(e,t)}function Bi(e,t,n){return!!Vi(e,t)||!!Yi(t,e,n)}function Ii(e,t){if(1===e.length)return Ui(t,e[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let t=0;t<a.length;t++)if(Vi(e,a[t]))return!0}for(let n=0;n<e.length;n++)if(Ui(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Fi(e,t[n]))return!0;return!1}function $i(e,t,n){if(e.length>1){if(Fi(e,t))return!0;for(let a=0;a<t.length;a++)if(Yi(t[a],e,n))return!0}for(let a=0;a<e.length;a++)if(Yi(e[a],t,n))return!0;return!1}function Fi(e,t){if(0===e.length||0===t.length)return!1;for(let n=0;n<e.length-1;n++){const a=e[n],r=e[n+1];for(let e=0;e<t.length-1;e++)if(Xi(a,r,t[e],t[e+1]))return!0}return!1}function Xi(e,t,n,a){return h(e,n,a)!==h(t,n,a)&&h(e,t,n)!==h(e,t,a)}function Yi(e,t,n){const a=n*n;if(1===t.length)return e.distSqr(t[0])<a;for(let n=1;n<t.length;n++)if(Hi(e,t[n-1],t[n])<a)return!0;return!1}function Hi(e,t,n){const a=t.distSqr(n);if(0===a)return e.distSqr(t);const r=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/a;return e.distSqr(r<0?t:r>1?n:n.sub(t)._mult(r)._add(t))}function Ui(e,t){let n,a,r,i=!1;for(let o=0;o<e.length;o++){n=e[o];for(let e=0,o=n.length-1;e<n.length;o=e++)a=n[e],r=n[o],a.y>t.y!=r.y>t.y&&t.x<(r.x-a.x)*(t.y-a.y)/(r.y-a.y)+a.x&&(i=!i)}return i}function Vi(e,t){let n=!1;for(let a=0,r=e.length-1;a<e.length;r=a++){const i=e[a],o=e[r];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(n=!n)}return n}function Gi(e,t,n){const a=n[0],r=n[2];if(e.x<a.x&&t.x<a.x||e.x>r.x&&t.x>r.x||e.y<a.y&&t.y<a.y||e.y>r.y&&t.y>r.y)return!1;const i=h(e,t,n[0]);return i!==h(e,t,n[1])||i!==h(e,t,n[2])||i!==h(e,t,n[3])}function Ki(e,t,n){const a=t.paint.get(e).value;return"constant"===a.kind?a.value:n.programConfigurations.get(t.id).getMaxValue(e)}function Ji(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Zi(e,t,n,a,r){if(!t[0]&&!t[1])return e;const i=A.convert(t)._mult(r);"viewport"===n&&i._rotate(-a);const o=[];for(let t=0;t<e.length;t++)o.push(e[t].sub(i));return o}_a("CircleBucket",Di,{omit:["layers"]});const Qi=new rr({"circle-sort-key":new er(ne.layout_circle["circle-sort-key"])});var eo={paint:new rr({"circle-radius":new er(ne.paint_circle["circle-radius"]),"circle-color":new er(ne.paint_circle["circle-color"]),"circle-blur":new er(ne.paint_circle["circle-blur"]),"circle-opacity":new er(ne.paint_circle["circle-opacity"]),"circle-translate":new Qa(ne.paint_circle["circle-translate"]),"circle-translate-anchor":new Qa(ne.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Qa(ne.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Qa(ne.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new er(ne.paint_circle["circle-stroke-width"]),"circle-stroke-color":new er(ne.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new er(ne.paint_circle["circle-stroke-opacity"])}),layout:Qi},to=1e-6,no="undefined"!=typeof Float32Array?Float32Array:Array;function ao(){var e=new no(9);return no!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ro(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function io(e,t,n){var a=t[0],r=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],m=t[10],b=t[11],h=t[12],f=t[13],g=t[14],_=t[15],y=n[0],M=n[1],v=n[2],z=n[3];return e[0]=y*a+M*s+v*d+z*h,e[1]=y*r+M*l+v*p+z*f,e[2]=y*i+M*c+v*m+z*g,e[3]=y*o+M*u+v*b+z*_,e[4]=(y=n[4])*a+(M=n[5])*s+(v=n[6])*d+(z=n[7])*h,e[5]=y*r+M*l+v*p+z*f,e[6]=y*i+M*c+v*m+z*g,e[7]=y*o+M*u+v*b+z*_,e[8]=(y=n[8])*a+(M=n[9])*s+(v=n[10])*d+(z=n[11])*h,e[9]=y*r+M*l+v*p+z*f,e[10]=y*i+M*c+v*m+z*g,e[11]=y*o+M*u+v*b+z*_,e[12]=(y=n[12])*a+(M=n[13])*s+(v=n[14])*d+(z=n[15])*h,e[13]=y*r+M*l+v*p+z*f,e[14]=y*i+M*c+v*m+z*g,e[15]=y*o+M*u+v*b+z*_,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var oo,so=io;function lo(){var e=new no(3);return no!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function co(e,t,n){var a=new no(3);return a[0]=e,a[1]=t,a[2]=n,a}function uo(e,t,n){var a=t[0],r=t[1],i=t[2],o=t[3];return e[0]=n[0]*a+n[4]*r+n[8]*i+n[12]*o,e[1]=n[1]*a+n[5]*r+n[9]*i+n[13]*o,e[2]=n[2]*a+n[6]*r+n[10]*i+n[14]*o,e[3]=n[3]*a+n[7]*r+n[11]*i+n[15]*o,e}function po(){var e=new no(4);return no!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function mo(e,t){const n=uo([],[e.x,e.y,0,1],t);return new A(n[0]/n[3],n[1]/n[3])}lo(),oo=new no(4),no!=Float32Array&&(oo[0]=0,oo[1]=0,oo[2]=0,oo[3]=0),lo(),co(1,0,0),co(0,1,0),po(),po(),ao(),function(){var e;e=new no(2),no!=Float32Array&&(e[0]=0,e[1]=0)}();class bo extends Di{}_a("HeatmapBucket",bo,{omit:["layers"]});var ho={paint:new rr({"heatmap-radius":new er(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new er(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qa(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ar(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qa(ne.paint_heatmap["heatmap-opacity"])})};function fo(e,{width:t,height:n},a,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${t*n*a}`)}else r=new Uint8Array(t*n*a);return e.width=t,e.height=n,e.data=r,e}function go(e,{width:t,height:n},a){if(t===e.width&&n===e.height)return;const r=fo({},{width:t,height:n},a);_o(e,r,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},a),e.width=t,e.height=n,e.data=r.data}function _o(e,t,n,a,r,i){if(0===r.width||0===r.height)return t;if(r.width>e.width||r.height>e.height||n.x>e.width-r.width||n.y>e.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>t.width||r.height>t.height||a.x>t.width-r.width||a.y>t.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=e.data,s=t.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<r.height;l++){const c=((n.y+l)*e.width+n.x)*i,u=((a.y+l)*t.width+a.x)*i;for(let e=0;e<r.width*i;e++)s[u+e]=o[c+e]}return t}class yo{constructor(e,t){fo(this,e,1,t)}resize(e){go(this,e,1)}clone(){return new yo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,a,r){_o(e,t,n,a,r,1)}}class Mo{constructor(e,t){fo(this,e,4,t)}resize(e){go(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Mo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,a,r){_o(e,t,n,a,r,4)}}function vo(e){const t={},n=e.resolution||256,a=e.clips?e.clips.length:1,r=e.image||new Mo({width:n,height:a});if(Math.log(n)/Math.LN2%1!=0)throw new Error("width is not a power of 2 - "+n);const i=(n,a,i)=>{t[e.evaluationKey]=i;const o=e.expression.evaluate(t);r.data[n+a+0]=Math.floor(255*o.r/o.a),r.data[n+a+1]=Math.floor(255*o.g/o.a),r.data[n+a+2]=Math.floor(255*o.b/o.a),r.data[n+a+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,r=0;t<a;++t,r+=4*n)for(let a=0,o=0;a<n;a++,o+=4){const s=a/(n-1),{start:l,end:c}=e.clips[t];i(r,o,l*(1-s)+c*s)}else for(let e=0,t=0;e<n;e++,t+=4)i(0,t,e/(n-1));return r}_a("AlphaImage",yo),_a("RGBAImage",Mo);var zo={paint:new rr({"hillshade-illumination-direction":new Qa(ne.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Qa(ne.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Qa(ne.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Qa(ne.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Qa(ne.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Qa(ne.paint_hillshade["hillshade-accent-color"])})};const Oo=ur([{name:"a_pos",components:2,type:"Int16"}],4),{members:ko}=Oo;var Ao={exports:{}};function xo(e,t,n){n=n||2;var a,r,i,o,s,l,c,u=t&&t.length,d=u?t[0]*n:e.length,p=wo(e,0,d,n,!0),m=[];if(!p||p.next===p.prev)return m;if(u&&(p=function(e,t,n,a){var r,i,o,s=[];for(r=0,i=t.length;r<i;r++)(o=wo(e,t[r]*a,r<i-1?t[r+1]*a:e.length,a,!1))===o.next&&(o.steiner=!0),s.push(Do(o));for(s.sort(So),r=0;r<s.length;r++)n=To(s[r],n);return n}(e,t,p,n)),e.length>80*n){a=i=e[0],r=o=e[1];for(var b=n;b<d;b+=n)(s=e[b])<a&&(a=s),(l=e[b+1])<r&&(r=l),s>i&&(i=s),l>o&&(o=l);c=0!==(c=Math.max(i-a,o-r))?32767/c:0}return qo(p,m,n,a,r,c,0),m}function wo(e,t,n,a,r){var i,o;if(r===Jo(e,t,n,a)>0)for(i=t;i<n;i+=a)o=Vo(i,e[i],e[i+1],o);else for(i=n-a;i>=t;i-=a)o=Vo(i,e[i],e[i+1],o);return o&&$o(o,o.next)&&(Go(o),o=o.next),o}function No(e,t){if(!e)return e;t||(t=e);var n,a=e;do{if(n=!1,a.steiner||!$o(a,a.next)&&0!==Io(a.prev,a,a.next))a=a.next;else{if(Go(a),(a=t=a.prev)===a.next)break;n=!0}}while(n||a!==t);return t}function qo(e,t,n,a,r,i,o){if(e){!o&&i&&function(e,t,n,a){var r=e;do{0===r.z&&(r.z=Ro(r.x,r.y,t,n,a)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,a,r,i,o,s,l,c=1;do{for(n=e,e=null,i=null,o=0;n;){for(o++,a=n,s=0,t=0;t<c&&(s++,a=a.nextZ);t++);for(l=c;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(r=n,n=n.nextZ,s--):(r=a,a=a.nextZ,l--),i?i.nextZ=r:e=r,r.prevZ=i,i=r;n=a}i.nextZ=null,c*=2}while(o>1)}(r)}(e,a,r,i);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,i?jo(e,a,r,i):Eo(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),Go(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?qo(e=Wo(No(e),t,n),t,n,a,r,i,2):2===o&&Lo(e,t,n,a,r,i):qo(No(e),t,n,a,r,i,1);break}}}function Eo(e){var t=e.prev,n=e,a=e.next;if(Io(t,n,a)>=0)return!1;for(var r=t.x,i=n.x,o=a.x,s=t.y,l=n.y,c=a.y,u=r<i?r<o?r:o:i<o?i:o,d=s<l?s<c?s:c:l<c?l:c,p=r>i?r>o?r:o:i>o?i:o,m=s>l?s>c?s:c:l>c?l:c,b=a.next;b!==t;){if(b.x>=u&&b.x<=p&&b.y>=d&&b.y<=m&&Po(r,s,i,l,o,c,b.x,b.y)&&Io(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function jo(e,t,n,a){var r=e.prev,i=e,o=e.next;if(Io(r,i,o)>=0)return!1;for(var s=r.x,l=i.x,c=o.x,u=r.y,d=i.y,p=o.y,m=s<l?s<c?s:c:l<c?l:c,b=u<d?u<p?u:p:d<p?d:p,h=s>l?s>c?s:c:l>c?l:c,f=u>d?u>p?u:p:d>p?d:p,g=Ro(m,b,t,n,a),_=Ro(h,f,t,n,a),y=e.prevZ,M=e.nextZ;y&&y.z>=g&&M&&M.z<=_;){if(y.x>=m&&y.x<=h&&y.y>=b&&y.y<=f&&y!==r&&y!==o&&Po(s,u,l,d,c,p,y.x,y.y)&&Io(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,M.x>=m&&M.x<=h&&M.y>=b&&M.y<=f&&M!==r&&M!==o&&Po(s,u,l,d,c,p,M.x,M.y)&&Io(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;y&&y.z>=g;){if(y.x>=m&&y.x<=h&&y.y>=b&&y.y<=f&&y!==r&&y!==o&&Po(s,u,l,d,c,p,y.x,y.y)&&Io(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;M&&M.z<=_;){if(M.x>=m&&M.x<=h&&M.y>=b&&M.y<=f&&M!==r&&M!==o&&Po(s,u,l,d,c,p,M.x,M.y)&&Io(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Wo(e,t,n){var a=e;do{var r=a.prev,i=a.next.next;!$o(r,i)&&Fo(r,a,a.next,i)&&Ho(r,i)&&Ho(i,r)&&(t.push(r.i/n|0),t.push(a.i/n|0),t.push(i.i/n|0),Go(a),Go(a.next),a=e=i),a=a.next}while(a!==e);return No(a)}function Lo(e,t,n,a,r,i){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Bo(o,s)){var l=Uo(o,s);return o=No(o,o.next),l=No(l,l.next),qo(o,t,n,a,r,i,0),void qo(l,t,n,a,r,i,0)}s=s.next}o=o.next}while(o!==e)}function So(e,t){return e.x-t.x}function To(e,t){var n=function(e,t){var n,a=t,r=e.x,i=e.y,o=-1/0;do{if(i<=a.y&&i>=a.next.y&&a.next.y!==a.y){var s=a.x+(i-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(s<=r&&s>o&&(o=s,n=a.x<a.next.x?a:a.next,s===r))return n}a=a.next}while(a!==t);if(!n)return null;var l,c=n,u=n.x,d=n.y,p=1/0;a=n;do{r>=a.x&&a.x>=u&&r!==a.x&&Po(i<d?r:o,i,u,d,i<d?o:r,i,a.x,a.y)&&(l=Math.abs(i-a.y)/(r-a.x),Ho(a,e)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&Co(n,a)))&&(n=a,p=l)),a=a.next}while(a!==c);return n}(e,t);if(!n)return t;var a=Uo(n,e);return No(a,a.next),No(n,n.next)}function Co(e,t){return Io(e.prev,e,t.prev)<0&&Io(t.next,e,e.next)<0}function Ro(e,t,n,a,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Do(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Po(e,t,n,a,r,i,o,s){return(r-o)*(t-s)>=(e-o)*(i-s)&&(e-o)*(a-s)>=(n-o)*(t-s)&&(n-o)*(i-s)>=(r-o)*(a-s)}function Bo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Fo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ho(e,t)&&Ho(t,e)&&function(e,t){var n=e,a=!1,r=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(a=!a),n=n.next}while(n!==e);return a}(e,t)&&(Io(e.prev,e,t.prev)||Io(e,t.prev,t))||$o(e,t)&&Io(e.prev,e,e.next)>0&&Io(t.prev,t,t.next)>0)}function Io(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function $o(e,t){return e.x===t.x&&e.y===t.y}function Fo(e,t,n,a){var r=Yo(Io(e,t,n)),i=Yo(Io(e,t,a)),o=Yo(Io(n,a,e)),s=Yo(Io(n,a,t));return r!==i&&o!==s||!(0!==r||!Xo(e,n,t))||!(0!==i||!Xo(e,a,t))||!(0!==o||!Xo(n,e,a))||!(0!==s||!Xo(n,t,a))}function Xo(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Yo(e){return e>0?1:e<0?-1:0}function Ho(e,t){return Io(e.prev,e,e.next)<0?Io(e,t,e.next)>=0&&Io(e,e.prev,t)>=0:Io(e,t,e.prev)<0||Io(e,e.next,t)<0}function Uo(e,t){var n=new Ko(e.i,e.x,e.y),a=new Ko(t.i,t.x,t.y),r=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,a.next=n,n.prev=a,i.next=a,a.prev=i,a}function Vo(e,t,n,a){var r=new Ko(e,t,n);return a?(r.next=a.next,r.prev=a,a.next.prev=r,a.next=r):(r.prev=r,r.next=r),r}function Go(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ko(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Jo(e,t,n,a){for(var r=0,i=t,o=n-a;i<n;i+=a)r+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return r}function Zo(e,t,n,a,r){!function e(t,n,a,r,i){for(;r>a;){if(r-a>600){var o=r-a+1,s=n-a+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);e(t,n,Math.max(a,Math.floor(n-s*c/o+u)),Math.min(r,Math.floor(n+(o-s)*c/o+u)),i)}var d=t[n],p=a,m=r;for(Qo(t,a,n),i(t[r],d)>0&&Qo(t,a,r);p<m;){for(Qo(t,p,m),p++,m--;i(t[p],d)<0;)p++;for(;i(t[m],d)>0;)m--}0===i(t[a],d)?Qo(t,a,m):Qo(t,++m,r),m<=n&&(a=m+1),n<=m&&(r=m-1)}}(e,t,n||0,a||e.length-1,r||es)}function Qo(e,t,n){var a=e[t];e[t]=e[n],e[n]=a}function es(e,t){return e<t?-1:e>t?1:0}function ts(e,t){const n=e.length;if(n<=1)return[e];const a=[];let r,i;for(let t=0;t<n;t++){const n=f(e[t]);0!==n&&(e[t].area=Math.abs(n),void 0===i&&(i=n<0),i===n<0?(r&&a.push(r),r=[e[t]]):r.push(e[t]))}if(r&&a.push(r),t>1)for(let e=0;e<a.length;e++)a[e].length<=t||(Zo(a[e],t,1,a[e].length-1,ns),a[e]=a[e].slice(0,t));return a}function ns(e,t){return t.area-e.area}function as(e,t,n){const a=n.patternDependencies;let r=!1;for(const n of t){const t=n.paint.get(e+"-pattern");t.isConstant()||(r=!0);const i=t.constantOr(null);i&&(r=!0,a[i.to]=!0,a[i.from]=!0)}return r}function rs(e,t,n,a,r){const i=r.patternDependencies;for(const o of t){const t=o.paint.get(e+"-pattern").value;if("constant"!==t.kind){let e=t.evaluate({zoom:a-1},n,{},r.availableImages),s=t.evaluate({zoom:a},n,{},r.availableImages),l=t.evaluate({zoom:a+1},n,{},r.availableImages);e=e&&e.name?e.name:e,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,i[e]=!0,i[s]=!0,i[l]=!0,n.patterns[o.id]={min:e,mid:s,max:l}}}return n}Ao.exports=xo,Ao.exports.default=xo,xo.deviation=function(e,t,n,a){var r=t&&t.length,i=Math.abs(Jo(e,0,r?t[0]*n:e.length,n));if(r)for(var o=0,s=t.length;o<s;o++)i-=Math.abs(Jo(e,t[o]*n,o<s-1?t[o+1]*n:e.length,n));var l=0;for(o=0;o<a.length;o+=3){var c=a[o]*n,u=a[o+1]*n,d=a[o+2]*n;l+=Math.abs((e[c]-e[d])*(e[u+1]-e[c+1])-(e[c]-e[u])*(e[d+1]-e[c+1]))}return 0===i&&0===l?0:Math.abs((l-i)/i)},xo.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},a=0,r=0;r<e.length;r++){for(var i=0;i<e[r].length;i++)for(var o=0;o<t;o++)n.vertices.push(e[r][i][o]);r>0&&n.holes.push(a+=e[r-1].length)}return n};class is{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Hr,this.indexArray=new ni,this.indexArray2=new ai,this.programConfigurations=new qi(e.layers,e.zoom),this.segments=new oi,this.segments2=new oi,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.hasPattern=as("fill",this.layers,t);const a=this.layers[0].layout.get("fill-sort-key"),r=!a.isConstant(),i=[];for(const{feature:o,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Ci(o,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),u,n))continue;const d=r?a.evaluate(u,{},n,t.availableImages):void 0,p={id:s,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Ti(o),patterns:{},sortKey:d};i.push(p)}r&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const a of i){const{geometry:r,index:i,sourceLayerIndex:o}=a;if(this.hasPattern){const e=rs("fill",this.layers,a,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(a,r,i,n,{});t.featureIndex.insert(e[i].feature,r,i,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ko),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,a,r){for(const e of ts(t,500)){let t=0;for(const n of e)t+=n.length;const n=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),a=n.vertexLength,r=[],i=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&i.push(r.length/2);const n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),a=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(a+t.length-1,a),r.push(t[0].x),r.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(a+e-1,a+e),r.push(t[e].x),r.push(t[e].y);n.vertexLength+=t.length,n.primitiveLength+=t.length}const o=Ao.exports(r,i);for(let e=0;e<o.length;e+=3)this.indexArray.emplaceBack(a+o[e],a+o[e+1],a+o[e+2]);n.vertexLength+=t,n.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,r,a)}}_a("FillBucket",is,{omit:["layers","patternFeatures"]});const os=new rr({"fill-sort-key":new er(ne.layout_fill["fill-sort-key"])});var ss={paint:new rr({"fill-antialias":new Qa(ne.paint_fill["fill-antialias"]),"fill-opacity":new er(ne.paint_fill["fill-opacity"]),"fill-color":new er(ne.paint_fill["fill-color"]),"fill-outline-color":new er(ne.paint_fill["fill-outline-color"]),"fill-translate":new Qa(ne.paint_fill["fill-translate"]),"fill-translate-anchor":new Qa(ne.paint_fill["fill-translate-anchor"]),"fill-pattern":new tr(ne.paint_fill["fill-pattern"])}),layout:os};const ls=ur([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),cs=ur([{name:"a_centroid",components:2,type:"Int16"}],4),{members:us}=ls;var ds={},ps=A,ms=bs;function bs(e,t,n,a,r){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=r,e.readFields(hs,this,t)}function hs(e,t,n){1==e?t.id=n.readVarint():2==e?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var a=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[a]=r}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function fs(e){for(var t,n,a=0,r=0,i=e.length,o=i-1;r<i;o=r++)a+=((n=e[o]).x-(t=e[r]).x)*(t.y+n.y);return a}bs.types=["Unknown","Point","LineString","Polygon"],bs.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,n=e.readVarint()+e.pos,a=1,r=0,i=0,o=0,s=[];e.pos<n;){if(r<=0){var l=e.readVarint();a=7&l,r=l>>3}if(r--,1===a||2===a)i+=e.readSVarint(),o+=e.readSVarint(),1===a&&(t&&s.push(t),t=[]),t.push(new ps(i,o));else{if(7!==a)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&s.push(t),s},bs.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,a=0,r=0,i=0,o=1/0,s=-1/0,l=1/0,c=-1/0;e.pos<t;){if(a<=0){var u=e.readVarint();n=7&u,a=u>>3}if(a--,1===n||2===n)(r+=e.readSVarint())<o&&(o=r),r>s&&(s=r),(i+=e.readSVarint())<l&&(l=i),i>c&&(c=i);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,c]},bs.prototype.toGeoJSON=function(e,t,n){var a,r,i=this.extent*Math.pow(2,n),o=this.extent*e,s=this.extent*t,l=this.loadGeometry(),c=bs.types[this.type];function u(e){for(var t=0;t<e.length;t++){var n=e[t];e[t]=[360*(n.x+o)/i-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+s)/i)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(a=0;a<l.length;a++)d[a]=l[a][0];u(l=d);break;case 2:for(a=0;a<l.length;a++)u(l[a]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var n,a,r=[],i=0;i<t;i++){var o=fs(e[i]);0!==o&&(void 0===a&&(a=o<0),a===o<0?(n&&r.push(n),n=[e[i]]):n.push(e[i]))}return n&&r.push(n),r}(l),a=0;a<l.length;a++)for(r=0;r<l[a].length;r++)u(l[a][r])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var gs=ms,_s=ys;function ys(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Ms,this,t),this.length=this._features.length}function Ms(e,t,n){15===e?t.version=n.readVarint():1===e?t.name=n.readString():5===e?t.extent=n.readVarint():2===e?t._features.push(n.pos):3===e?t._keys.push(n.readString()):4===e&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var a=e.readVarint()>>3;t=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return t}(n))}ys.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new gs(this._pbf,t,this.extent,this._keys,this._values)};var vs=_s;function zs(e,t,n){if(3===e){var a=new vs(n,n.readVarint()+n.pos);a.length&&(t[a.name]=a)}}ds.VectorTile=function(e,t){this.layers=e.readFields(zs,{},t)},ds.VectorTileFeature=ms,ds.VectorTileLayer=_s;const Os=ds.VectorTileFeature.types,ks=Math.pow(2,13);function As(e,t,n,a,r,i,o,s){e.emplaceBack(t,n,2*Math.floor(a*ks)+o,r*ks*2,i*ks*2,Math.round(s))}class xs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ur,this.centroidVertexArray=new Xr,this.indexArray=new ni,this.programConfigurations=new qi(e.layers,e.zoom),this.segments=new oi,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.features=[],this.hasPattern=as("fill-extrusion",this.layers,t);for(const{feature:a,id:r,index:i,sourceLayerIndex:o}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Ci(a,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),s,n))continue;const l={id:r,sourceLayerIndex:o,index:i,geometry:e?s.geometry:Ti(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(rs("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,i,n,{}),t.featureIndex.insert(a,l.geometry,i,o,this.index,!0)}}addFeatures(e,t,n){for(const e of this.features){const{geometry:a}=e;this.addFeature(e,a,e.index,t,n)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,us),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,cs.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,a,r){const i={x:0,y:0,vertexCount:0};for(const n of ts(t,500)){let t=0;for(const e of n)t+=e.length;let a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const e of n){if(0===e.length)continue;if(Ns(e))continue;let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(n>=1){const o=e[n-1];if(!ws(r,o)){a.vertexLength+4>oi.MAX_VERTEX_ARRAY_LENGTH&&(a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const e=r.sub(o)._perp()._unit(),n=o.dist(r);t+n>32768&&(t=0),As(this.layoutVertexArray,r.x,r.y,e.x,e.y,0,0,t),As(this.layoutVertexArray,r.x,r.y,e.x,e.y,0,1,t),i.x+=2*r.x,i.y+=2*r.y,i.vertexCount+=2,t+=n,As(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,0,t),As(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,1,t),i.x+=2*o.x,i.y+=2*o.y,i.vertexCount+=2;const s=a.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),a.vertexLength+=4,a.primitiveLength+=2}}}}if(a.vertexLength+t>oi.MAX_VERTEX_ARRAY_LENGTH&&(a=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray)),"Polygon"!==Os[e.type])continue;const r=[],o=[],s=a.vertexLength;for(const e of n)if(0!==e.length){e!==n[0]&&o.push(r.length/2);for(let t=0;t<e.length;t++){const n=e[t];As(this.layoutVertexArray,n.x,n.y,0,0,1,1,0),i.x+=n.x,i.y+=n.y,i.vertexCount+=1,r.push(n.x),r.push(n.y)}}const l=Ao.exports(r,o);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(s+l[e],s+l[e+2],s+l[e+1]);a.primitiveLength+=l.length/3,a.vertexLength+=t}for(let e=0;e<i.vertexCount;e++)this.centroidVertexArray.emplaceBack(Math.floor(i.x/i.vertexCount),Math.floor(i.y/i.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,r,a)}}function ws(e,t){return e.x===t.x&&(e.x<0||e.x>Wi)||e.y===t.y&&(e.y<0||e.y>Wi)}function Ns(e){return e.every(e=>e.x<0)||e.every(e=>e.x>Wi)||e.every(e=>e.y<0)||e.every(e=>e.y>Wi)}_a("FillExtrusionBucket",xs,{omit:["layers","features"]});var qs={paint:new rr({"fill-extrusion-opacity":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new er(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new tr(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new er(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new er(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Es(e,t){return e.x*t.x+e.y*t.y}function js(e,t){if(1===e.length){let n=0;const a=t[n++];let r;for(;!r||a.equals(r);)if(r=t[n++],!r)return 1/0;for(;n<t.length;n++){const i=t[n],o=e[0],s=r.sub(a),l=i.sub(a),c=o.sub(a),u=Es(s,s),d=Es(s,l),p=Es(l,l),m=Es(c,s),b=Es(c,l),h=u*p-d*d,f=(p*m-d*b)/h,g=(u*b-d*m)/h,_=a.z*(1-f-g)+r.z*f+i.z*g;if(isFinite(_))return _}return 1/0}{let e=1/0;for(const n of t)e=Math.min(e,n.z);return e}}const Ws=ur([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ls}=Ws,Ss=ur([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ts}=Ss,Cs=ds.VectorTileFeature.types,Rs=Math.cos(Math.PI/180*37.5),Ds=Math.pow(2,14)/.5;class Ps{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Vr,this.layoutVertexArray2=new Gr,this.indexArray=new ni,this.programConfigurations=new qi(e.layers,e.zoom),this.segments=new oi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.hasPattern=as("line",this.layers,t);const a=this.layers[0].layout.get("line-sort-key"),r=!a.isConstant(),i=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ci(t,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),c,n))continue;const u=r?a.evaluate(c,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Ti(t),patterns:{},sortKey:u};i.push(d)}r&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const a of i){const{geometry:r,index:i,sourceLayerIndex:o}=a;if(this.hasPattern){const e=rs("line",this.layers,a,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(a,r,i,n,{});t.featureIndex.insert(e[i].feature,r,i,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Ts)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ls),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,a,r){const i=this.layers[0].layout,o=i.get("line-join").evaluate(e,{}),s=i.get("line-cap"),l=i.get("line-miter-limit"),c=i.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const n of t)this.addLine(n,e,o,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,r,a)}addLine(e,t,n,a,r,i){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const o="Polygon"===Cs[t.type];let s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;let l=0;for(;l<s-1&&e[l].equals(e[l+1]);)l++;if(s<(o?3:2))return;"bevel"===n&&(r=1.05);const c=this.overscaling<=16?122880/(512*this.overscaling):0,u=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray);let d,p,m,b,h;this.e1=this.e2=-1,o&&(d=e[s-2],h=e[l].sub(d)._unit()._perp());for(let t=l;t<s;t++){if(m=t===s-1?o?e[l+1]:void 0:e[t+1],m&&e[t].equals(m))continue;h&&(b=h),d&&(p=d),d=e[t],h=m?m.sub(d)._unit()._perp():b,b=b||h;let f=b.add(h);0===f.x&&0===f.y||f._unit();const g=b.x*h.x+b.y*h.y,_=f.x*h.x+f.y*h.y,y=0!==_?1/_:1/0,M=2*Math.sqrt(2-2*_),v=_<Rs&&p&&m,z=b.x*h.y-b.y*h.x>0;if(v&&t>l){const e=d.dist(p);if(e>2*c){const t=d.sub(d.sub(p)._mult(c/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,b,0,0,u),p=t}}const O=p&&m;let k=O?n:o?"butt":a;if(O&&"round"===k&&(y<i?k="miter":y<=2&&(k="fakeround")),"miter"===k&&y>r&&(k="bevel"),"bevel"===k&&(y>2&&(k="flipbevel"),y<r&&(k="miter")),p&&this.updateDistance(p,d),"miter"===k)f._mult(y),this.addCurrentVertex(d,f,0,0,u);else if("flipbevel"===k){if(y>100)f=h.mult(-1);else{const e=y*b.add(h).mag()/b.sub(h).mag();f._perp()._mult(e*(z?-1:1))}this.addCurrentVertex(d,f,0,0,u),this.addCurrentVertex(d,f.mult(-1),0,0,u)}else if("bevel"===k||"fakeround"===k){const e=-Math.sqrt(y*y-1),t=z?e:0,n=z?0:e;if(p&&this.addCurrentVertex(d,b,t,n,u),"fakeround"===k){const e=Math.round(180*M/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(.5!==n){const e=n-.5;n+=n*e*(n-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*e*e+(.848013+g*(.215638*g-1.06021)))}const a=h.sub(b)._mult(n)._add(b)._unit()._mult(z?-1:1);this.addHalfVertex(d,a.x,a.y,!1,z,0,u)}}m&&this.addCurrentVertex(d,h,-t,-n,u)}else if("butt"===k)this.addCurrentVertex(d,f,0,0,u);else if("square"===k){const e=p?1:-1;this.addCurrentVertex(d,f,e,e,u)}else"round"===k&&(p&&(this.addCurrentVertex(d,b,0,0,u),this.addCurrentVertex(d,b,1,1,u,!0)),m&&(this.addCurrentVertex(d,h,-1,-1,u,!0),this.addCurrentVertex(d,h,0,0,u)));if(v&&t<s-1){const e=d.dist(m);if(e>2*c){const t=d.add(m.sub(d)._mult(c/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,h,0,0,u),d=t}}}}addCurrentVertex(e,t,n,a,r,i=!1){const o=t.y*a-t.x,s=-t.y-t.x*a;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,i,!1,n,r),this.addHalfVertex(e,o,s,i,!0,-a,r),this.distance>Ds/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(e,t,n,a,r,i))}addHalfVertex({x:e,y:t},n,a,r,i,o,s){const l=.5*(this.lineClips?this.scaledDistance*(Ds-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(r?1:0),(t<<1)+(i?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),s.primitiveLength++),i?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}_a("LineBucket",Ps,{omit:["layers","patternFeatures"]});const Bs=new rr({"line-cap":new Qa(ne.layout_line["line-cap"]),"line-join":new er(ne.layout_line["line-join"]),"line-miter-limit":new Qa(ne.layout_line["line-miter-limit"]),"line-round-limit":new Qa(ne.layout_line["line-round-limit"]),"line-sort-key":new er(ne.layout_line["line-sort-key"])});var Is={paint:new rr({"line-opacity":new er(ne.paint_line["line-opacity"]),"line-color":new er(ne.paint_line["line-color"]),"line-translate":new Qa(ne.paint_line["line-translate"]),"line-translate-anchor":new Qa(ne.paint_line["line-translate-anchor"]),"line-width":new er(ne.paint_line["line-width"]),"line-gap-width":new er(ne.paint_line["line-gap-width"]),"line-offset":new er(ne.paint_line["line-offset"]),"line-blur":new er(ne.paint_line["line-blur"]),"line-dasharray":new nr(ne.paint_line["line-dasharray"]),"line-pattern":new tr(ne.paint_line["line-pattern"]),"line-gradient":new ar(ne.paint_line["line-gradient"])}),layout:Bs};const $s=new class extends er{possiblyEvaluate(e,t){return t=new Xa(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,a){return t=s({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,a)}}(Is.paint.properties["line-width"].specification);function Fs(e,t){return t>0?t+2*e:e}$s.useIntegerZoom=!0;const Xs=ur([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ys=ur([{name:"a_projected_pos",components:3,type:"Float32"}],4);ur([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hs=ur([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ur([{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 Us=ur([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Vs=ur([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Gs(e,t,n){return e.sections.forEach(e=>{e.text=function(e,t,n){const a=t.layout.get("text-transform").evaluate(n,{});return"uppercase"===a?e=e.toLocaleUpperCase():"lowercase"===a&&(e=e.toLocaleLowerCase()),Fa.applyArabicShaping&&(e=Fa.applyArabicShaping(e)),e}(e.text,t,n)}),e}ur([{name:"triangle",components:3,type:"Uint16"}]),ur([{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"}]),ur([{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"}]),ur([{type:"Float32",name:"offsetX"}]),ur([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ks={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Js=el,Zs=function(e,t,n,a,r){var i,o,s=8*r-a-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?r-1:0,p=n?-1:1,m=e[t+d];for(d+=p,i=m&(1<<-u)-1,m>>=-u,u+=s;u>0;i=256*i+e[t+d],d+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=p,u-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,a),i-=c}return(m?-1:1)*o*Math.pow(2,i-a)},Qs=function(e,t,n,a,r,i){var o,s,l,c=8*i-r-1,u=(1<<c)-1,d=u>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,m=a?0:i-1,b=a?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,r),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+m]=255&s,m+=b,s/=256,r-=8);for(o=o<<r|s,c+=r;c>0;e[n+m]=255&o,m+=b,o/=256,c-=8);e[n+m-b]|=128*h};function el(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}el.Varint=0,el.Fixed64=1,el.Bytes=2,el.Fixed32=5;var tl,nl=4294967296,al=1/nl,rl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function il(e){return e.type===el.Bytes?e.readVarint()+e.pos:e.pos+1}function ol(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function sl(e,t,n){var a=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(a);for(var r=n.pos-1;r>=e;r--)n.buf[r+a]=n.buf[r]}function ll(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function cl(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function ul(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function dl(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function pl(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function ml(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function bl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function hl(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function fl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function gl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function _l(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function yl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Ml(e,t,n){1===e&&n.readMessage(vl,t)}function vl(e,t,n){if(3===e){const{id:e,bitmap:a,width:r,height:i,left:o,top:s,advance:l}=n.readMessage(zl,{});t.push({id:e,bitmap:new yo({width:r+6,height:i+6},a),metrics:{width:r,height:i,left:o,top:s,advance:l}})}}function zl(e,t,n){1===e?t.id=n.readVarint():2===e?t.bitmap=n.readBytes():3===e?t.width=n.readVarint():4===e?t.height=n.readVarint():5===e?t.left=n.readSVarint():6===e?t.top=n.readSVarint():7===e&&(t.advance=n.readVarint())}function Ol(e){let t=0,n=0;for(const a of e)t+=a.w*a.h,n=Math.max(n,a.w);e.sort((e,t)=>t.h-e.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let r=0,i=0;for(const t of e)for(let e=a.length-1;e>=0;e--){const n=a[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,i=Math.max(i,t.y+t.h),r=Math.max(r,t.x+t.w),t.w===n.w&&t.h===n.h){const t=a.pop();e<a.length&&(a[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(a.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:r,h:i,fill:t/(r*i)||0}}el.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var a=this.readVarint(),r=a>>3,i=this.pos;this.type=7&a,e(r,t,this),this.pos===i&&this.skip(a)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=gl(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=yl(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=gl(this.buf,this.pos)+gl(this.buf,this.pos+4)*nl;return this.pos+=8,e},readSFixed64:function(){var e=gl(this.buf,this.pos)+yl(this.buf,this.pos+4)*nl;return this.pos+=8,e},readFloat:function(){var e=Zs(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Zs(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,a=this.buf;return t=127&(n=a[this.pos++]),n<128?t:(t|=(127&(n=a[this.pos++]))<<7,n<128?t:(t|=(127&(n=a[this.pos++]))<<14,n<128?t:(t|=(127&(n=a[this.pos++]))<<21,n<128?t:function(e,t,n){var a,r,i=n.buf;if(a=(112&(r=i[n.pos++]))>>4,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<3,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<10,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<17,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<24,r<128)return ol(e,a,t);if(a|=(1&(r=i[n.pos++]))<<31,r<128)return ol(e,a,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=a[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&rl?function(e,t,n){return rl.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var a="",r=t;r<n;){var i,o,s,l=e[r],c=null,u=l>239?4:l>223?3:l>191?2:1;if(r+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(i=e[r+1]))&&(c=(31&l)<<6|63&i)<=127&&(c=null):3===u?(o=e[r+2],128==(192&(i=e[r+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&i)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=e[r+2],s=e[r+3],128==(192&(i=e[r+1]))&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&i)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,a+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),a+=String.fromCharCode(c),r+=u}return a}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==el.Bytes)return e.push(this.readVarint(t));var n=il(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==el.Bytes)return e.push(this.readSVarint());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==el.Bytes)return e.push(this.readBoolean());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==el.Bytes)return e.push(this.readFloat());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==el.Bytes)return e.push(this.readDouble());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==el.Bytes)return e.push(this.readFixed32());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==el.Bytes)return e.push(this.readSFixed32());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==el.Bytes)return e.push(this.readFixed64());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==el.Bytes)return e.push(this.readSFixed64());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===el.Varint)for(;this.buf[this.pos++]>127;);else if(t===el.Bytes)this.pos=this.readVarint()+this.pos;else if(t===el.Fixed32)this.pos+=4;else{if(t!==el.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),_l(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),_l(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),_l(this.buf,-1&e,this.pos),_l(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),_l(this.buf,-1&e,this.pos),_l(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,a;if(e>=0?(n=e%4294967296|0,a=e/4294967296|0):(a=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,a=a+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(a,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var a,r,i=0;i<t.length;i++){if((a=t.charCodeAt(i))>55295&&a<57344){if(!r){a>56319||i+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):r=a;continue}if(a<56320){e[n++]=239,e[n++]=191,e[n++]=189,r=a;continue}a=r-55296<<10|a-56320|65536,r=null}else r&&(e[n++]=239,e[n++]=191,e[n++]=189,r=null);a<128?e[n++]=a:(a<2048?e[n++]=a>>6|192:(a<65536?e[n++]=a>>12|224:(e[n++]=a>>18|240,e[n++]=a>>12&63|128),e[n++]=a>>6&63|128),e[n++]=63&a|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&sl(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Qs(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Qs(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var a=this.pos-n;a>=128&&sl(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeMessage:function(e,t,n){this.writeTag(e,el.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ll,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,cl,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,pl,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,ul,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,dl,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ml,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,bl,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hl,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,fl,t)},writeBytesField:function(e,t){this.writeTag(e,el.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,el.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,el.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,el.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,el.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,el.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,el.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,el.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,el.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,el.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};class kl{constructor(e,{pixelRatio:t,version:n,stretchX:a,stretchY:r,content:i}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=a,this.stretchY=r,this.content=i,this.version=n}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 Al{constructor(e,t){const n={},a={};this.haveRenderCallbacks=[];const r=[];this.addImages(e,n,r),this.addImages(t,a,r);const{w:i,h:o}=Ol(r),s=new Mo({width:i||1,height:o||1});for(const t in e){const a=e[t],r=n[t].paddedRect;Mo.copy(a.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},a.data)}for(const e in t){const n=t[e],r=a[e].paddedRect,i=r.x+1,o=r.y+1,l=n.data.width,c=n.data.height;Mo.copy(n.data,s,{x:0,y:0},{x:i,y:o},n.data),Mo.copy(n.data,s,{x:0,y:c-1},{x:i,y:o-1},{width:l,height:1}),Mo.copy(n.data,s,{x:0,y:0},{x:i,y:o+c},{width:l,height:1}),Mo.copy(n.data,s,{x:l-1,y:0},{x:i-1,y:o},{width:1,height:c}),Mo.copy(n.data,s,{x:0,y:0},{x:i+l,y:o},{width:1,height:c})}this.image=s,this.iconPositions=n,this.patternPositions=a}addImages(e,t,n){for(const a in e){const r=e[a],i={x:0,y:0,w:r.data.width+2,h:r.data.height+2};n.push(i),t[a]=new kl(i,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[a,r]=e.tl;n.update(t.data,void 0,{x:a,y:r})}}_a("ImagePosition",kl),_a("ImageAtlas",Al),e.WritingMode=void 0,(tl=e.WritingMode||(e.WritingMode={}))[tl.none=0]="none",tl[tl.horizontal=1]="horizontal",tl[tl.vertical=2]="vertical",tl[tl.horizontalOnly=3]="horizontalOnly";class xl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const n=new xl;return n.scale=e||1,n.fontStack=t,n}static forImage(e){const t=new xl;return t.imageName=e,t}}class wl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const n=new wl;for(let a=0;a<e.sections.length;a++){const r=e.sections[a];r.image?n.addImageSection(r):n.addTextSection(r,t)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let t="";for(let n=0;n<e.length;n++){const a=e.charCodeAt(n+1)||null,r=e.charCodeAt(n-1)||null;t+=a&&Na(a)&&!Ks[e[n+1]]||r&&Na(r)&&!Ks[e[n-1]]||!Ks[e[n]]?e[n]:Ks[e[n]]}return t}(this.text)}trim(){let e=0;for(let t=0;t<this.text.length&&ql[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ql[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const n=new wl;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(xl.forText(e.scale,e.fontStack||t));const n=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(n)}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void b("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(xl.forImage(t)),this.sectionIndex.push(this.sections.length-1)):b("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Nl(t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f){const g=wl.fromFeature(t,i);let _;p===e.WritingMode.vertical&&g.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:M}=Fa;if(y&&1===g.sections.length){_=[];const e=y(g.toString(),Tl(g,u,o,n,r,b,h));for(const t of e){const e=new wl;e.text=t,e.sections=g.sections;for(let n=0;n<t.length;n++)e.sectionIndex.push(0);_.push(e)}}else if(M){_=[];const e=M(g.text,g.sectionIndex,Tl(g,u,o,n,r,b,h));for(const t of e){const e=new wl;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,_.push(e)}}else _=function(e,t){const n=[],a=e.text;let r=0;for(const a of t)n.push(e.substring(r,a)),r=a;return r<a.length&&n.push(e.substring(r,a.length)),n}(g,Tl(g,u,o,n,r,b,h));const v=[],z={positionedLines:v,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,n,a,r,i,o,s,l,c,u,d,p){let m=0,b=-17,h=0,f=0;const g="right"===l?1:"left"===l?0:.5;let _=0;for(const s of i){s.trim();const i=s.getMaxScale(),l=24*(i-1),M={positionedGlyphs:[],lineOffset:0};t.positionedLines[_]=M;const v=M.positionedGlyphs;let z=0;if(!s.length()){b+=o,++_;continue}for(let o=0;o<s.length();o++){const h=s.getSection(o),f=s.getSectionIndex(o),g=s.getCharCode(o);let _=0,M=null,O=null,k=null,A=24;const x=!(c===e.WritingMode.horizontal||!d&&!wa(g)||d&&(ql[g]||(y=g,Oa.Arabic(y)||Oa["Arabic Supplement"](y)||Oa["Arabic Extended-A"](y)||Oa["Arabic Presentation Forms-A"](y)||Oa["Arabic Presentation Forms-B"](y))));if(h.imageName){const e=r[h.imageName];if(!e)continue;k=h.imageName,t.iconsInText=t.iconsInText||!0,O=e.paddedRect;const n=e.displaySize;h.scale=24*h.scale/p,M={width:n[0],height:n[1],left:1,top:-3,advance:x?n[1]:n[0]},_=l+(24-n[1]*h.scale),A=M.advance;const a=x?n[0]*h.scale-24*i:n[1]*h.scale-24*i;a>0&&a>z&&(z=a)}else{const e=a[h.fontStack],t=e&&e[g];if(t&&t.rect)O=t.rect,M=t.metrics;else{const e=n[h.fontStack],t=e&&e[g];if(!t)continue;M=t.metrics}_=24*(i-h.scale)}x?(t.verticalizable=!0,v.push({glyph:g,imageName:k,x:m,y:b+_,vertical:x,scale:h.scale,fontStack:h.fontStack,sectionIndex:f,metrics:M,rect:O}),m+=A*h.scale+u):(v.push({glyph:g,imageName:k,x:m,y:b+_,vertical:x,scale:h.scale,fontStack:h.fontStack,sectionIndex:f,metrics:M,rect:O}),m+=M.advance*h.scale+u)}0!==v.length&&(h=Math.max(m-u,h),Rl(v,0,v.length-1,g,z)),m=0;const O=o*i+z;M.lineOffset=Math.max(z,l),b+=O,f=Math.max(O,f),++_}var y;const M=b- -17,{horizontalAlign:v,verticalAlign:z}=Cl(s);(function(e,t,n,a,r,i,o,s,l){const c=(t-n)*r;let u=0;u=i!==o?-s*a- -17:(-a*l+.5)*o;for(const t of e)for(const e of t.positionedGlyphs)e.x+=c,e.y+=u})(t.positionedLines,g,v,z,h,f,o,M,i.length),t.top+=-z*M,t.bottom=t.top+M,t.left+=-v*h,t.right=t.left+h}(z,n,a,r,_,s,l,c,p,u,m,f),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(v)&&z}const ql={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},El={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 jl(e,t,n,a,r,i){if(t.imageName){const e=a[t.imageName];return e?e.displaySize[0]*t.scale*24/i+r:0}{const a=n[t.fontStack],i=a&&a[e];return i?i.metrics.advance*t.scale+r:0}}function Wl(e,t,n,a){const r=Math.pow(e-t,2);return a?e<t?r/2:2*r:r+Math.abs(n)*n}function Ll(e,t,n){let a=0;return 10===e&&(a-=1e4),n&&(a+=150),40!==e&&65288!==e||(a+=50),41!==t&&65289!==t||(a+=50),a}function Sl(e,t,n,a,r,i){let o=null,s=Wl(t,n,r,i);for(const e of a){const a=Wl(t-e.x,n,r,i)+e.badness;a<=s&&(o=e,s=a)}return{index:e,x:t,priorBreak:o,badness:s}}function Tl(e,t,n,a,r,i,o){if("point"!==i)return[];if(!e)return[];const s=[],l=function(e,t,n,a,r,i){let o=0;for(let n=0;n<e.length();n++){const s=e.getSection(n);o+=jl(e.getCharCode(n),s,a,r,t,i)}return o/Math.max(1,Math.ceil(o/n))}(e,t,n,a,r,o),c=e.text.indexOf("​")>=0;let u=0;for(let n=0;n<e.length();n++){const i=e.getSection(n),p=e.getCharCode(n);if(ql[p]||(u+=jl(p,i,a,r,t,o)),n<e.length()-1){const t=!((d=p)<11904||!(Oa["Bopomofo Extended"](d)||Oa.Bopomofo(d)||Oa["CJK Compatibility Forms"](d)||Oa["CJK Compatibility Ideographs"](d)||Oa["CJK Compatibility"](d)||Oa["CJK Radicals Supplement"](d)||Oa["CJK Strokes"](d)||Oa["CJK Symbols and Punctuation"](d)||Oa["CJK Unified Ideographs Extension A"](d)||Oa["CJK Unified Ideographs"](d)||Oa["Enclosed CJK Letters and Months"](d)||Oa["Halfwidth and Fullwidth Forms"](d)||Oa.Hiragana(d)||Oa["Ideographic Description Characters"](d)||Oa["Kangxi Radicals"](d)||Oa["Katakana Phonetic Extensions"](d)||Oa.Katakana(d)||Oa["Vertical Forms"](d)||Oa["Yi Radicals"](d)||Oa["Yi Syllables"](d)));(El[p]||t||i.imageName)&&s.push(Sl(n+1,u,l,s,Ll(p,e.getCharCode(n+1),t&&c),!1))}}var d;return function e(t){return t?e(t.priorBreak).concat(t.index):[]}(Sl(e.length(),u,l,s,0,!0))}function Cl(e){let t=.5,n=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:t,verticalAlign:n}}function Rl(e,t,n,a,r){if(!a&&!r)return;const i=e[n],o=(e[n].x+i.metrics.advance*i.scale)*a;for(let a=t;a<=n;a++)e[a].x-=o,e[a].y+=r}function Dl(e,t,n){const{horizontalAlign:a,verticalAlign:r}=Cl(n),i=t[0]-e.displaySize[0]*a,o=t[1]-e.displaySize[1]*r;return{image:e,top:o,bottom:o+e.displaySize[1],left:i,right:i+e.displaySize[0]}}function Pl(e,t,n,a,r,i){const o=e.image;let s;if(o.content){const e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}const l=t.left*i,c=t.right*i;let u,d,p,m;"width"===n||"both"===n?(m=r[0]+l-a[3],d=r[0]+c+a[1]):(m=r[0]+(l+c-o.displaySize[0])/2,d=m+o.displaySize[0]);const b=t.top*i,h=t.bottom*i;return"height"===n||"both"===n?(u=r[1]+b-a[0],p=r[1]+h+a[2]):(u=r[1]+(b+h-o.displaySize[1])/2,p=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:p,left:m,collisionPadding:s}}const Bl=128;function Il(e,t){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new Xa(e+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:a}=n;let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let i=r;for(;i<t.length&&t[i]<e+1;)i++;i=Math.min(t.length-1,i);const o=t[r],s=t[i];return"composite"===n.kind?{kind:"composite",minZoom:o,maxZoom:s,interpolationType:a}:{kind:"camera",minZoom:o,maxZoom:s,minSize:n.evaluate(new Xa(o)),maxSize:n.evaluate(new Xa(s)),interpolationType:a}}}class $l extends A{constructor(e,t,n,a){super(e,t),this.angle=n,void 0!==a&&(this.segment=a)}clone(){return new $l(this.x,this.y,this.angle,this.segment)}}function Fl(e,t,n,a,r){if(void 0===t.segment)return!0;let i=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(i),i=e[o]}s+=e[o].dist(e[o+1]),o++;const l=[];let c=0;for(;s<n/2;){const t=e[o],n=e[o+1];if(!n)return!1;let i=e[o-1].angleTo(t)-t.angleTo(n);for(i=Math.abs((i+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:i}),c+=i;s-l[0].distance>a;)c-=l.shift().angleDelta;if(c>r)return!1;o++,s+=t.dist(n)}return!0}function Xl(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function Yl(e,t,n){return e?.6*t*n:0}function Hl(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Ul(e,t,n,a,r,i){const o=Yl(n,r,i),s=Hl(n,a)*i;let l=0;const c=Xl(e)/2;for(let n=0;n<e.length-1;n++){const a=e[n],r=e[n+1],i=a.dist(r);if(l+i>c){const u=(c-l)/i,d=Ot(a.x,r.x,u),p=Ot(a.y,r.y,u),m=new $l(d,p,r.angleTo(a),n);return m._round(),!o||Fl(e,m,s,o,t)?m:void 0}l+=i}}function Vl(e,t,n,a,r,i,o,s,l){const c=Yl(a,i,o),u=Hl(a,r),d=u*o,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-d<t/4&&(t=d+t/4),function e(t,n,a,r,i,o,s,l,c){const u=o/2,d=Xl(t);let p=0,m=n-a,b=[];for(let e=0;e<t.length-1;e++){const n=t[e],s=t[e+1],l=n.dist(s),h=s.angleTo(n);for(;m+a<p+l;){m+=a;const f=(m-p)/l,g=Ot(n.x,s.x,f),_=Ot(n.y,s.y,f);if(g>=0&&g<c&&_>=0&&_<c&&m-u>=0&&m+u<=d){const n=new $l(g,_,h,e);n._round(),r&&!Fl(t,n,o,r,i)||b.push(n)}}p+=l}return l||b.length||s||(b=e(t,p/2,a,r,i,o,s,!0,c)),b}(e,p?t/2*s%t:(u/2+2*i)*o*s%t,t,c,n,d,p,!1,l)}function Gl(e,t,n,a,r){const i=[];for(let o=0;o<e.length;o++){const s=e[o];let l;for(let e=0;e<s.length-1;e++){let o=s[e],c=s[e+1];o.x<t&&c.x<t||(o.x<t?o=new A(t,o.y+(t-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x<t&&(c=new A(t,o.y+(t-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y<n&&c.y<n||(o.y<n?o=new A(o.x+(n-o.y)/(c.y-o.y)*(c.x-o.x),n)._round():c.y<n&&(c=new A(o.x+(n-o.y)/(c.y-o.y)*(c.x-o.x),n)._round()),o.x>=a&&c.x>=a||(o.x>=a?o=new A(a,o.y+(a-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x>=a&&(c=new A(a,o.y+(a-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y>=r&&c.y>=r||(o.y>=r?o=new A(o.x+(r-o.y)/(c.y-o.y)*(c.x-o.x),r)._round():c.y>=r&&(c=new A(o.x+(r-o.y)/(c.y-o.y)*(c.x-o.x),r)._round()),l&&o.equals(l[l.length-1])||(l=[o],i.push(l)),l.push(c)))))}}return i}function Kl(e,t,n,a){const r=[],i=e.image,o=i.pixelRatio,s=i.paddedRect.w-2,l=i.paddedRect.h-2,c=e.right-e.left,u=e.bottom-e.top,d=i.stretchX||[[0,s]],p=i.stretchY||[[0,l]],m=(e,t)=>e+t[1]-t[0],b=d.reduce(m,0),h=p.reduce(m,0),f=s-b,g=l-h;let _=0,y=b,M=0,v=h,z=0,O=f,k=0,x=g;if(i.content&&a){const e=i.content;_=Jl(d,0,e[0]),M=Jl(p,0,e[1]),y=Jl(d,e[0],e[2]),v=Jl(p,e[1],e[3]),z=e[0]-_,k=e[1]-M,O=e[2]-e[0]-y,x=e[3]-e[1]-v}const w=(a,r,s,l)=>{const d=Ql(a.stretch-_,y,c,e.left),p=ec(a.fixed-z,O,a.stretch,b),m=Ql(r.stretch-M,v,u,e.top),f=ec(r.fixed-k,x,r.stretch,h),g=Ql(s.stretch-_,y,c,e.left),w=ec(s.fixed-z,O,s.stretch,b),N=Ql(l.stretch-M,v,u,e.top),q=ec(l.fixed-k,x,l.stretch,h),E=new A(d,m),j=new A(g,m),W=new A(g,N),L=new A(d,N),S=new A(p/o,f/o),T=new A(w/o,q/o),C=t*Math.PI/180;if(C){const e=Math.sin(C),t=Math.cos(C),n=[t,-e,e,t];E._matMult(n),j._matMult(n),L._matMult(n),W._matMult(n)}const R=a.stretch+a.fixed,D=r.stretch+r.fixed;return{tl:E,tr:j,bl:L,br:W,tex:{x:i.paddedRect.x+1+R,y:i.paddedRect.y+1+D,w:s.stretch+s.fixed-R,h:l.stretch+l.fixed-D},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:S,pixelOffsetBR:T,minFontScaleX:O/o/c,minFontScaleY:x/o/u,isSDF:n}};if(a&&(i.stretchX||i.stretchY)){const e=Zl(d,f,b),t=Zl(p,g,h);for(let n=0;n<e.length-1;n++){const a=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)r.push(w(a,t[e],i,t[e+1]))}}else r.push(w({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return r}function Jl(e,t,n){let a=0;for(const r of e)a+=Math.max(t,Math.min(n,r[1]))-Math.max(t,Math.min(n,r[0]));return a}function Zl(e,t,n){const a=[{fixed:-1,stretch:0}];for(const[t,n]of e){const e=a[a.length-1];a.push({fixed:t-e.stretch,stretch:e.stretch}),a.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return a.push({fixed:t+1,stretch:n}),a}function Ql(e,t,n,a){return e/t*n+a}function ec(e,t,n,a){return e-t*n/a}_a("Anchor",$l);class tc{constructor(e,t,n,a,r,i,o,s,l,c){if(this.boxStartIndex=e.length,l){let e=i.top,t=i.bottom;const n=i.collisionPadding;n&&(e-=n[1],t+=n[3]);let a=t-e;a>0&&(a=Math.max(10,a),this.circleDiameter=a)}else{let l=i.top*o-s[0],u=i.bottom*o+s[2],d=i.left*o-s[3],p=i.right*o+s[1];const m=i.collisionPadding;if(m&&(d-=m[0]*o,l-=m[1]*o,p+=m[2]*o,u+=m[3]*o),c){const e=new A(d,l),t=new A(p,l),n=new A(d,u),a=new A(p,u),r=c*Math.PI/180;e._rotate(r),t._rotate(r),n._rotate(r),a._rotate(r),d=Math.min(e.x,t.x,n.x,a.x),p=Math.max(e.x,t.x,n.x,a.x),l=Math.min(e.y,t.y,n.y,a.y),u=Math.max(e.y,t.y,n.y,a.y)}e.emplaceBack(t.x,t.y,d,l,p,u,n,a,r)}this.boxEndIndex=e.length}}class nc{constructor(e=[],t=ac){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,a=t[e];for(;e>0;){const r=e-1>>1,i=t[r];if(n(a,i)>=0)break;t[e]=i,e=r}t[e]=a}_down(e){const{data:t,compare:n}=this,a=this.length>>1,r=t[e];for(;e<a;){let a=1+(e<<1),i=t[a];const o=a+1;if(o<this.length&&n(t[o],i)<0&&(a=o,i=t[o]),n(i,r)>=0)break;t[e]=i,e=a}t[e]=r}}function ac(e,t){return e<t?-1:e>t?1:0}function rc(e,t=1,n=!1){let a=1/0,r=1/0,i=-1/0,o=-1/0;const s=e[0];for(let e=0;e<s.length;e++){const t=s[e];(!e||t.x<a)&&(a=t.x),(!e||t.y<r)&&(r=t.y),(!e||t.x>i)&&(i=t.x),(!e||t.y>o)&&(o=t.y)}const l=Math.min(i-a,o-r);let c=l/2;const u=new nc([],ic);if(0===l)return new A(a,r);for(let t=a;t<i;t+=l)for(let n=r;n<o;n+=l)u.push(new oc(t+c,n+c,c,e));let d=function(e){let t=0,n=0,a=0;const r=e[0];for(let e=0,i=r.length,o=i-1;e<i;o=e++){const i=r[e],s=r[o],l=i.x*s.y-s.x*i.y;n+=(i.x+s.x)*l,a+=(i.y+s.y)*l,t+=3*l}return new oc(n/t,a/t,0,e)}(e),p=u.length;for(;u.length;){const a=u.pop();(a.d>d.d||!d.d)&&(d=a,n&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d<=t||(c=a.h/2,u.push(new oc(a.p.x-c,a.p.y-c,c,e)),u.push(new oc(a.p.x+c,a.p.y-c,c,e)),u.push(new oc(a.p.x-c,a.p.y+c,c,e)),u.push(new oc(a.p.x+c,a.p.y+c,c,e)),p+=4)}return n&&(console.log("num probes: "+p),console.log("best distance: "+d.d)),d.p}function ic(e,t){return t.max-e.max}function oc(e,t,n,a){this.p=new A(e,t),this.h=n,this.d=function(e,t){let n=!1,a=1/0;for(let r=0;r<t.length;r++){const i=t[r];for(let t=0,r=i.length,o=r-1;t<r;o=t++){const r=i[t],s=i[o];r.y>e.y!=s.y>e.y&&e.x<(s.x-r.x)*(e.y-r.y)/(s.y-r.y)+r.x&&(n=!n),a=Math.min(a,Hi(e,r,s))}}return(n?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}const sc=Number.POSITIVE_INFINITY;function lc(e,t){return t[1]!==sc?function(e,t,n){let a=0,r=0;switch(t=Math.abs(t),n=Math.abs(n),e){case"top-right":case"top-left":case"top":r=n-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-n}switch(e){case"top-right":case"bottom-right":case"right":a=-t;break;case"top-left":case"bottom-left":case"left":a=t}return[a,r]}(e,t[0],t[1]):function(e,t){let n=0,a=0;t<0&&(t=0);const r=t/Math.sqrt(2);switch(e){case"top-right":case"top-left":a=r-7;break;case"bottom-right":case"bottom-left":a=7-r;break;case"bottom":a=7-t;break;case"top":a=t-7}switch(e){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=t;break;case"right":n=-t}return[n,a]}(e,t[0])}function cc(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uc(t,n,a,r,i,o,s,l,c,u,d){let p=o.textMaxSize.evaluate(n,{});void 0===p&&(p=s);const m=t.layers[0].layout,h=m.get("icon-offset").evaluate(n,{},d),f=mc(a.horizontal),g=s/24,_=t.tilePixelRatio*g,y=t.tilePixelRatio*p/24,M=t.tilePixelRatio*l,v=t.tilePixelRatio*m.get("symbol-spacing"),z=m.get("text-padding")*t.tilePixelRatio,O=function(e,t,n,a=1){const r=e.get("icon-padding").evaluate(t,{},n),i=r&&r.values;return[i[0]*a,i[1]*a,i[2]*a,i[3]*a]}(m,n,d,t.tilePixelRatio),k=m.get("text-max-angle")/180*Math.PI,A="viewport"!==m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),x="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),w=m.get("symbol-placement"),N=v/2,q=m.get("icon-text-fit");let E;r&&"none"!==q&&(t.allowVerticalPlacement&&a.vertical&&(E=Pl(r,a.vertical,q,m.get("icon-text-fit-padding"),h,g)),f&&(r=Pl(r,f,q,m.get("icon-text-fit-padding"),h,g)));const j=(l,p)=>{p.x<0||p.x>=Wi||p.y<0||p.y>=Wi||function(t,n,a,r,i,o,s,l,c,u,d,p,m,h,f,g,_,y,M,v,z,O,k,A,x){const w=t.addToLineVertexArray(n,a);let N,q,E,j,W=0,L=0,S=0,T=0,C=-1,R=-1;const D={};let P=ci.exports(""),B=0,I=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[B,I]=l.layout.get("text-offset").evaluate(z,{},A).map(e=>24*e):(B=24*l.layout.get("text-radial-offset").evaluate(z,{},A),I=sc),t.allowVerticalPlacement&&r.vertical){const e=l.layout.get("text-rotate").evaluate(z,{},A)+90;E=new tc(c,n,u,d,p,r.vertical,m,h,f,e),s&&(j=new tc(c,n,u,d,p,s,_,y,f,e))}if(i){const a=l.layout.get("icon-rotate").evaluate(z,{}),r="none"!==l.layout.get("icon-text-fit"),o=Kl(i,a,k,r),m=s?Kl(s,a,k,r):void 0;q=new tc(c,n,u,d,p,i,_,y,!1,a),W=4*o.length;const h=t.iconSizeData;let f=null;"source"===h.kind?(f=[Bl*l.layout.get("icon-size").evaluate(z,{})],f[0]>dc&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===h.kind&&(f=[Bl*O.compositeIconSizes[0].evaluate(z,{},A),Bl*O.compositeIconSizes[1].evaluate(z,{},A)],(f[0]>dc||f[1]>dc)&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')),t.addSymbols(t.icon,o,f,v,M,z,e.WritingMode.none,n,w.lineStartIndex,w.lineLength,-1,A),C=t.icon.placedSymbolArray.length-1,m&&(L=4*m.length,t.addSymbols(t.icon,m,f,v,M,z,e.WritingMode.vertical,n,w.lineStartIndex,w.lineLength,-1,A),R=t.icon.placedSymbolArray.length-1)}const $=Object.keys(r.horizontal);for(const a of $){const i=r.horizontal[a];if(!N){P=ci.exports(i.text);const e=l.layout.get("text-rotate").evaluate(z,{},A);N=new tc(c,n,u,d,p,i,m,h,f,e)}const s=1===i.positionedLines.length;if(S+=pc(t,n,i,o,l,f,z,g,w,r.vertical?e.WritingMode.horizontal:e.WritingMode.horizontalOnly,s?$:[a],D,C,O,A),s)break}r.vertical&&(T+=pc(t,n,r.vertical,o,l,f,z,g,w,e.WritingMode.vertical,["vertical"],D,R,O,A));const F=N?N.boxStartIndex:t.collisionBoxArray.length,X=N?N.boxEndIndex:t.collisionBoxArray.length,Y=E?E.boxStartIndex:t.collisionBoxArray.length,H=E?E.boxEndIndex:t.collisionBoxArray.length,U=q?q.boxStartIndex:t.collisionBoxArray.length,V=q?q.boxEndIndex:t.collisionBoxArray.length,G=j?j.boxStartIndex:t.collisionBoxArray.length,K=j?j.boxEndIndex:t.collisionBoxArray.length;let J=-1;const Z=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;J=Z(N,J),J=Z(E,J),J=Z(q,J),J=Z(j,J);const Q=J>-1?1:0;Q&&(J*=x/24),t.glyphOffsetArray.length>=zc.MAX_GLYPHS&&b("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==z.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,z.sortKey),t.symbolInstances.emplaceBack(n.x,n.y,D.right>=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,C,R,P,F,X,Y,H,U,V,G,K,u,S,T,W,L,Q,0,m,B,I,J)}(t,p,l,a,r,i,E,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,_,[z,z,z,z],A,c,M,O,x,h,n,o,u,d,s)};if("line"===w)for(const e of Gl(n.geometry,0,0,Wi,Wi)){const n=Vl(e,v,k,a.vertical||f,r,24,y,t.overscaling,Wi);for(const a of n){const n=f;n&&bc(t,n.text,N,a)||j(e,a)}}else if("line-center"===w){for(const e of n.geometry)if(e.length>1){const t=Ul(e,k,a.vertical||f,r,24,y);t&&j(e,t)}}else if("Polygon"===n.type)for(const e of ts(n.geometry,0)){const t=rc(e,16);j(e[0],new $l(t.x,t.y,0))}else if("LineString"===n.type)for(const e of n.geometry)j(e,new $l(e[0].x,e[0].y,0));else if("Point"===n.type)for(const e of n.geometry)for(const t of e)j([t],new $l(t.x,t.y,0))}const dc=32640;function pc(e,t,n,a,r,i,o,s,l,c,u,d,p,m,h){const f=function(e,t,n,a,r,i,o,s){const l=a.layout.get("text-rotate").evaluate(i,{})*Math.PI/180,c=[];for(const e of t.positionedLines)for(const a of e.positionedGlyphs){if(!a.rect)continue;const i=a.rect||{};let u=4,d=!0,p=1,m=0;const b=(r||s)&&a.vertical,h=a.metrics.advance*a.scale/2;if(s&&t.verticalizable){const t=24*(a.scale-1),n=(24-a.metrics.width*a.scale)/2;m=e.lineOffset/2-(a.imageName?-n:t)}if(a.imageName){const e=o[a.imageName];d=e.sdf,p=e.pixelRatio,u=1/p}const f=r?[a.x+h,a.y]:[0,0];let g=r?[0,0]:[a.x+h+n[0],a.y+n[1]-m],_=[0,0];b&&(_=g,g=[0,0]);const y=(a.metrics.left-u)*a.scale-h+g[0],M=(-a.metrics.top-u)*a.scale+g[1],v=y+i.w*a.scale/p,z=M+i.h*a.scale/p,O=new A(y,M),k=new A(v,M),x=new A(y,z),w=new A(v,z);if(b){const e=new A(-h,h- -17),t=-Math.PI/2,n=12-h,r=new A(22-n,-(a.imageName?n:0)),i=new A(..._);O._rotateAround(t,e)._add(r)._add(i),k._rotateAround(t,e)._add(r)._add(i),x._rotateAround(t,e)._add(r)._add(i),w._rotateAround(t,e)._add(r)._add(i)}if(l){const e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];O._matMult(n),k._matMult(n),x._matMult(n),w._matMult(n)}const N=new A(0,0),q=new A(0,0);c.push({tl:O,tr:k,bl:x,br:w,tex:i,writingMode:t.writingMode,glyphOffset:f,sectionIndex:a.sectionIndex,isSDF:d,pixelOffsetTL:N,pixelOffsetBR:q,minFontScaleX:0,minFontScaleY:0})}return c}(0,n,s,r,i,o,a,e.allowVerticalPlacement),g=e.textSizeData;let _=null;"source"===g.kind?(_=[Bl*r.layout.get("text-size").evaluate(o,{})],_[0]>dc&&b(e.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===g.kind&&(_=[Bl*m.compositeTextSizes[0].evaluate(o,{},h),Bl*m.compositeTextSizes[1].evaluate(o,{},h)],(_[0]>dc||_[1]>dc)&&b(e.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')),e.addSymbols(e.text,f,_,s,i,o,c,t,l.lineStartIndex,l.lineLength,p,h);for(const t of u)d[t]=e.text.placedSymbolArray.length-1;return 4*f.length}function mc(e){for(const t in e)return e[t];return null}function bc(e,t,n,a){const r=e.compareText;if(t in r){const e=r[t];for(let t=e.length-1;t>=0;t--)if(a.dist(e[t])<n)return!0}else r[t]=[];return r[t].push(a),!1}const hc=ds.VectorTileFeature.types,fc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function gc(e,t,n,a,r,i,o,s,l,c,u,d,p){const m=s?Math.min(dc,Math.round(s[0])):0,b=s?Math.min(dc,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*a),Math.round(32*r),i,o,(m<<1)+(l?1:0),b,16*c,16*u,256*d,256*p)}function _c(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function yc(e){for(const t of e.sections)if(ja(t.text))return!0;return!1}class Mc{constructor(e){this.layoutVertexArray=new Jr,this.indexArray=new ni,this.programConfigurations=e,this.segments=new oi,this.dynamicLayoutVertexArray=new Zr,this.opacityVertexArray=new Qr,this.placedSymbolArray=new Rr}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,n,a){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xs.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ys.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,fc,!0),this.opacityVertexBuffer.itemSize=1),(n||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}_a("SymbolBuffers",Mc);class vc{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new oi,this.collisionVertexArray=new ti}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Hs.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}_a("CollisionBuffers",vc);class zc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ro([]),this.placementViewportMatrix=ro([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);const a=this.layers[0].layout,r=a.get("symbol-sort-key"),i=a.get("symbol-z-order");this.canOverlap="never"!==wc(a,"text-overlap","text-allow-overlap")||"never"!==wc(a,"icon-overlap","icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===a.get("symbol-placement")&&(this.writingModes=a.get("text-writing-mode").map(t=>e.WritingMode[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new Mc(new qi(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Mc(new qi(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Br,this.lineVertexArray=new Ir,this.symbolInstances=new Pr}calculateGlyphDependencies(e,t,n,a,r){for(let i=0;i<e.length;i++)if(t[e.charCodeAt(i)]=!0,(n||a)&&r){const n=Ks[e.charAt(i)];n&&(t[n.charCodeAt(0)]=!0)}}populate(t,n,a){const r=this.layers[0],i=r.layout,o=i.get("text-font"),s=i.get("text-field"),l=i.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof Ce&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,d=i.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const p=n.iconDependencies,m=n.glyphDependencies,b=n.availableImages,h=new Xa(this.zoom);for(const{feature:n,id:s,index:l,sourceLayerIndex:f}of t){const t=r._featureFilter.needGeometry,g=Ci(n,t);if(!r._featureFilter.filter(h,g,a))continue;let _,y;if(t||(g.geometry=Ti(n)),c){const e=r.getValueAndResolveTokens("text-field",g,a,b),t=Ce.factory(e);yc(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Ia()||this.hasRTLText&&Fa.isParsed())&&(_=Gs(t,r,g))}if(u){const e=r.getValueAndResolveTokens("icon-image",g,a,b);y=e instanceof De?e:De.fromString(e)}if(!_&&!y)continue;const M=this.sortFeaturesByKey?d.evaluate(g,{},a):void 0;if(this.features.push({id:s,text:_,icon:y,index:l,sourceLayerIndex:f,geometry:g.geometry,properties:n.properties,type:hc[n.type],sortKey:M}),y&&(p[y.name]=!0),_){const t=o.evaluate(g,{},a).join(","),n="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.WritingMode.vertical)>=0;for(const e of _.sections)if(e.image)p[e.image.name]=!0;else{const a=ka(_.toString()),r=e.fontStack||t,i=m[r]=m[r]||{};this.calculateGlyphDependencies(e.text,i,n,this.allowVerticalPlacement,a)}}}"line"===i.get("symbol-placement")&&(this.features=function(e){const t={},n={},a=[];let r=0;function i(t){a.push(e[t]),r++}function o(e,t,r){const i=n[e];return delete n[e],n[t]=i,a[i].geometry[0].pop(),a[i].geometry[0]=a[i].geometry[0].concat(r[0]),i}function s(e,n,r){const i=t[n];return delete t[n],t[e]=i,a[i].geometry[0].shift(),a[i].geometry[0]=r[0].concat(a[i].geometry[0]),i}function l(e,t,n){const a=n?t[0][t[0].length-1]:t[0][0];return`${e}:${a.x}:${a.y}`}for(let c=0;c<e.length;c++){const u=e[c],d=u.geometry,p=u.text?u.text.toString():null;if(!p){i(c);continue}const m=l(p,d),b=l(p,d,!0);if(m in n&&b in t&&n[m]!==t[b]){const e=s(m,b,d),r=o(m,b,a[e].geometry);delete t[m],delete n[b],n[l(p,a[r].geometry,!0)]=r,a[e].geometry=null}else m in n?o(m,b,d):b in t?s(m,b,d):(i(c),t[m]=r-1,n[b]=r-1)}return a.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const n=this.lineVertexArray.length;if(void 0!==e.segment){let n=e.dist(t[e.segment+1]),a=e.dist(t[e.segment]);const r={};for(let a=e.segment+1;a<t.length;a++)r[a]={x:t[a].x,y:t[a].y,tileUnitDistanceFromAnchor:n},a<t.length-1&&(n+=t[a+1].dist(t[a]));for(let n=e.segment||0;n>=0;n--)r[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:a},n>0&&(a+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){const t=r[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,a,r,i,o,s,l,c,u,d,p){const m=t.indexArray,b=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,b,m,this.canOverlap?o.sortKey:void 0),f=this.glyphOffsetArray.length,g=h.vertexLength,_=this.allowVerticalPlacement&&s===e.WritingMode.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){const{tl:r,tr:i,bl:s,br:c,tex:u,pixelOffsetTL:d,pixelOffsetBR:f,minFontScaleX:g,minFontScaleY:M,glyphOffset:v,isSDF:z,sectionIndex:O}=n[e],k=h.vertexLength,A=v[1];gc(b,l.x,l.y,r.x,A+r.y,u.x,u.y,a,z,d.x,d.y,g,M),gc(b,l.x,l.y,i.x,A+i.y,u.x+u.w,u.y,a,z,f.x,d.y,g,M),gc(b,l.x,l.y,s.x,A+s.y,u.x,u.y+u.h,a,z,d.x,f.y,g,M),gc(b,l.x,l.y,c.x,A+c.y,u.x+u.w,u.y+u.h,a,z,f.x,f.y,g,M),_c(t.dynamicLayoutVertexArray,l,_),m.emplaceBack(k,k+1,k+2),m.emplaceBack(k+1,k+2,k+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(v[0]),e!==n.length-1&&O===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(b.length,o,o.index,{},p,y&&y[O])}t.placedSymbolArray.emplaceBack(l.x,l.y,f,this.glyphOffsetArray.length-f,g,c,u,l.segment,a?a[0]:0,a?a[1]:0,r[0],r[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,a,r,i){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,a,r,Math.round(i.x),Math.round(i.y))}addCollisionDebugVertices(e,t,n,a,r,i,o){const s=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=s.vertexLength,c=r.layoutVertexArray,u=r.collisionVertexArray,d=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(c,u,i,d,p,new A(e,t)),this._addCollisionDebugVertex(c,u,i,d,p,new A(n,t)),this._addCollisionDebugVertex(c,u,i,d,p,new A(n,a)),this._addCollisionDebugVertex(c,u,i,d,p,new A(e,a)),s.vertexLength+=4;const m=r.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,a){for(let r=e;r<t;r++){const e=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,a?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vc(ei,Us.members,ai),this.iconCollisionBox=new vc(ei,Us.members,ai);for(let e=0;e<this.symbolInstances.length;e++){const t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,a,r,i,o,s,l){const c={};for(let a=t;a<n;a++){const t=e.get(a);c.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.textFeatureIndex=t.featureIndex;break}for(let t=a;t<r;t++){const n=e.get(t);c.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},c.verticalTextFeatureIndex=n.featureIndex;break}for(let t=i;t<o;t++){const n=e.get(t);c.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},c.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<l;t++){const n=e.get(t);c.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},c.verticalIconFeatureIndex=n.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const n=e.placedSymbolArray.get(t),a=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<a;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),n=Math.cos(e),a=[],r=[],i=[];for(let e=0;e<this.symbolInstances.length;++e){i.push(e);const o=this.symbolInstances.get(e);a.push(0|Math.round(t*o.anchorX+n*o.anchorY)),r.push(o.featureIndex)}return i.sort((e,t)=>a[e]-a[t]||r[t]-r[e]),i}addToSortKeyRanges(e,t){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach((e,t,n)=>{e>=0&&n.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}_a("SymbolBucket",zc,{omit:["layers","collisionBoxArray","features","compareText"]}),zc.MAX_GLYPHS=65535,zc.addDynamicAttributes=_c;const Oc=new rr({"symbol-placement":new Qa(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Qa(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qa(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new er(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qa(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qa(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Qa(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Qa(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qa(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qa(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new er(ne.layout_symbol["icon-size"]),"icon-text-fit":new Qa(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qa(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new er(ne.layout_symbol["icon-image"]),"icon-rotate":new er(ne.layout_symbol["icon-rotate"]),"icon-padding":new er(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Qa(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new er(ne.layout_symbol["icon-offset"]),"icon-anchor":new er(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qa(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qa(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qa(ne.layout_symbol["text-rotation-alignment"]),"text-field":new er(ne.layout_symbol["text-field"]),"text-font":new er(ne.layout_symbol["text-font"]),"text-size":new er(ne.layout_symbol["text-size"]),"text-max-width":new er(ne.layout_symbol["text-max-width"]),"text-line-height":new Qa(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new er(ne.layout_symbol["text-letter-spacing"]),"text-justify":new er(ne.layout_symbol["text-justify"]),"text-radial-offset":new er(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qa(ne.layout_symbol["text-variable-anchor"]),"text-anchor":new er(ne.layout_symbol["text-anchor"]),"text-max-angle":new Qa(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Qa(ne.layout_symbol["text-writing-mode"]),"text-rotate":new er(ne.layout_symbol["text-rotate"]),"text-padding":new Qa(ne.layout_symbol["text-padding"]),"text-keep-upright":new Qa(ne.layout_symbol["text-keep-upright"]),"text-transform":new er(ne.layout_symbol["text-transform"]),"text-offset":new er(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Qa(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Qa(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Qa(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Qa(ne.layout_symbol["text-optional"])});var kc={paint:new rr({"icon-opacity":new er(ne.paint_symbol["icon-opacity"]),"icon-color":new er(ne.paint_symbol["icon-color"]),"icon-halo-color":new er(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new er(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new er(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Qa(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qa(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new er(ne.paint_symbol["text-opacity"]),"text-color":new er(ne.paint_symbol["text-color"],{runtimeType:be,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new er(ne.paint_symbol["text-halo-color"]),"text-halo-width":new er(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new er(ne.paint_symbol["text-halo-blur"]),"text-translate":new Qa(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Qa(ne.paint_symbol["text-translate-anchor"])}),layout:Oc};class Ac{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:ue,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}_a("FormatSectionOverride",Ac,{omit:["defaultValue"]});class xc extends or{constructor(e){super(e,kc)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const e=this.layout.get("text-writing-mode");if(e){const t=[];for(const n of e)t.indexOf(n)<0&&t.push(n);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,a){const r=this.layout.get(e).evaluate(t,{},n,a),i=this._unevaluatedLayout._values[e];return i.isDataDriven()||wn(i.value)||!r?r:function(e,t){return t.replace(/{([^{}]+)}/g,(t,n)=>n in e?String(e[n]):"")}(t.properties,r)}createBucket(e){return new zc(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of kc.paint.overridableProperties){if(!xc.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),n=new Ac(t),a=new xn(n,t.property.specification);let r=null;r="constant"===t.value.kind||"source"===t.value.kind?new qn("source",a):new En("composite",a,t.value.zoomStops),this.paint._values[e]=new Ja(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&xc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const n=e.get("text-field"),a=kc.paint.properties[t];let r=!1;const i=e=>{for(const t of e)if(a.overrides&&a.overrides.hasOverride(t))return void(r=!0)};if("constant"===n.value.kind&&n.value.value instanceof Ce)i(n.value.value.sections);else if("source"===n.value.kind){const e=t=>{r||(t instanceof Fe&&Ie(t.value)===_e?i(t.value.sections):t instanceof rn?i(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return r}}function wc(e,t,n){let a="never";const r=e.get(t);return r?a=r:e.get(n)&&(a="always"),a}var Nc={paint:new rr({"background-color":new Qa(ne.paint_background["background-color"]),"background-pattern":new nr(ne.paint_background["background-pattern"]),"background-opacity":new Qa(ne.paint_background["background-opacity"])})},qc={paint:new rr({"raster-opacity":new Qa(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qa(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qa(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qa(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Qa(ne.paint_raster["raster-saturation"]),"raster-contrast":new Qa(ne.paint_raster["raster-contrast"]),"raster-resampling":new Qa(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Qa(ne.paint_raster["raster-fade-duration"])})};class Ec extends or{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const jc={circle:class extends or{constructor(e){super(e,eo)}createBucket(e){return new Di(e)}queryRadius(e){const t=e;return Ki("circle-radius",this,t)+Ki("circle-stroke-width",this,t)+Ji(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,n,a,r,i,o,s){const l=Zi(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),i.angle,o),c=this.paint.get("circle-radius").evaluate(t,n)+this.paint.get("circle-stroke-width").evaluate(t,n),u="map"===this.paint.get("circle-pitch-alignment"),d=u?l:function(e,t){return e.map(e=>mo(e,t))}(l,s),p=u?c*o:c;for(const e of a)for(const t of e){const e=u?t:mo(t,s);let n=p;const a=uo([],[t.x,t.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?n*=a[3]/i.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(n*=i.cameraToCenterDistance/a[3]),Bi(d,e,n))return!0}return!1}},heatmap:class extends or{constructor(e){super(e,ho),this._updateColorRamp()}createBucket(e){return new bo(e)}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=vo({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 or{constructor(e){super(e,zo)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends or{constructor(e){super(e,ss)}recalculate(e,t){super.recalculate(e,t);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new is(e)}queryRadius(){return Ji(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,n,a,r,i,o){return Ii(Zi(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),i.angle,o),a)}isTileClipped(){return!0}},"fill-extrusion":class extends or{constructor(e){super(e,qs)}createBucket(e){return new xs(e)}queryRadius(){return Ji(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,n,a,r,i,o,s){const l=Zi(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),i.angle,o),c=this.paint.get("fill-extrusion-height").evaluate(t,n),u=this.paint.get("fill-extrusion-base").evaluate(t,n),d=function(e,t,n,a){const r=[];for(const n of e){const e=[n.x,n.y,0,1];uo(e,e,t),r.push(new A(e[0]/e[3],e[1]/e[3]))}return r}(l,s),p=function(e,t,n,a){const r=[],i=[],o=a[8]*t,s=a[9]*t,l=a[10]*t,c=a[11]*t,u=a[8]*n,d=a[9]*n,p=a[10]*n,m=a[11]*n;for(const t of e){const e=[],n=[];for(const r of t){const t=r.x,i=r.y,b=a[0]*t+a[4]*i+a[12],h=a[1]*t+a[5]*i+a[13],f=a[2]*t+a[6]*i+a[14],g=a[3]*t+a[7]*i+a[15],_=f+l,y=g+c,M=b+u,v=h+d,z=f+p,O=g+m,k=new A((b+o)/y,(h+s)/y);k.z=_/y,e.push(k);const x=new A(M/O,v/O);x.z=z/O,n.push(x)}r.push(e),i.push(n)}return[r,i]}(a,u,c,s);return function(e,t,n){let a=1/0;Ii(n,t)&&(a=js(n,t[0]));for(let r=0;r<t.length;r++){const i=t[r],o=e[r];for(let e=0;e<i.length-1;e++){const t=i[e],r=[t,i[e+1],o[e+1],o[e],t];Pi(n,r)&&(a=Math.min(a,js(n,r)))}}return a!==1/0&&a}(p[0],p[1],d)}},line:class extends or{constructor(e){super(e,Is),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){"line-gradient"===e&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof zt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=$s.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Ps(e)}queryRadius(e){const t=e,n=Fs(Ki("line-width",this,t),Ki("line-gap-width",this,t)),a=Ki("line-offset",this,t);return n/2+Math.abs(a)+Ji(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,n,a,r,i,o){const s=Zi(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),i.angle,o),l=o/2*Fs(this.paint.get("line-width").evaluate(t,n),this.paint.get("line-gap-width").evaluate(t,n)),c=this.paint.get("line-offset").evaluate(t,n);return c&&(a=function(e,t){const n=[];for(let a=0;a<e.length;a++){const r=e[a],i=[];for(let e=0;e<r.length;e++){const n=r[e-1],a=r[e],o=r[e+1],s=0===e?new A(0,0):a.sub(n)._unit()._perp(),l=e===r.length-1?new A(0,0):o.sub(a)._unit()._perp(),c=s._add(l)._unit(),u=c.x*l.x+c.y*l.y;0!==u&&c._mult(1/u),i.push(c._mult(t)._add(a))}n.push(i)}return n}(a,c*o)),function(e,t,n){for(let a=0;a<t.length;a++){const r=t[a];if(e.length>=3)for(let t=0;t<r.length;t++)if(Vi(e,r[t]))return!0;if($i(e,r,n))return!0}return!1}(s,a,l)}isTileClipped(){return!0}},symbol:xc,background:class extends or{constructor(e){super(e,Nc)}},raster:class extends or{constructor(e){super(e,qc)}}};class Wc{constructor(e){this._callback=e,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=()=>{}}}const Lc=6371008.8;class Sc{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Sc(o(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,n=this.lat*t,a=e.lat*t,r=Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((e.lng-this.lng)*t);return Lc*Math.acos(Math.min(r,1))}toBounds(e=0){const t=360*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return new Tc(new Sc(this.lng-n,this.lat-t),new Sc(this.lng+n,this.lat+t))}static convert(e){if(e instanceof Sc)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Sc(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Sc(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Tc{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Sc?new Sc(e.lng,e.lat):Sc.convert(e),this}setSouthWest(e){return this._sw=e instanceof Sc?new Sc(e.lng,e.lat):Sc.convert(e),this}extend(e){const t=this._sw,n=this._ne;let a,r;if(e instanceof Sc)a=e,r=e;else{if(!(e instanceof Tc))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Tc.convert(e)):this.extend(Sc.convert(e)):this;if(a=e._sw,r=e._ne,!a||!r)return this}return t||n?(t.lng=Math.min(a.lng,t.lng),t.lat=Math.min(a.lat,t.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new Sc(a.lng,a.lat),this._ne=new Sc(r.lng,r.lat)),this}getCenter(){return new Sc((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 Sc(this.getWest(),this.getNorth())}getSouthEast(){return new Sc(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:n}=Sc.convert(e);let a=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a}static convert(e){return e instanceof Tc?e:e?new Tc(e):e}}const Cc=2*Math.PI*Lc;function Rc(e){return Cc*Math.cos(e*Math.PI/180)}function Dc(e){return(180+e)/360}function Pc(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Bc(e,t){return e/Rc(t)}function Ic(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}class $c{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){const n=Sc.convert(e);return new $c(Dc(n.lng),Pc(n.lat),Bc(t,n.lat))}toLngLat(){return new Sc(360*this.x-180,Ic(this.y))}toAltitude(){return this.z*Rc(Ic(this.y))}meterInMercatorCoordinateUnits(){return 1/Cc*(e=Ic(this.y),1/Math.cos(e*Math.PI/180));var e}}function Fc(e,t,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[e*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Xc{constructor(e,t,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))throw new Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=Uc(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){const a=(i=this.y,o=this.z,s=Fc(256*(r=this.x),256*(i=Math.pow(2,o)-i-1),o),l=Fc(256*(r+1),256*(i+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]);var r,i,o,s,l;const c=function(e,t,n){let a,r="";for(let i=e;i>0;i--)a=1<<i-1,r+=(t&a?1:0)+(n&a?2:0);return r}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===n?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,a)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new A((e.x*t-this.x)*Wi,(e.y*t-this.y)*Wi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Yc{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Uc(e,t.z,t.z,t.x,t.y)}}class Hc{constructor(e,t,n,a,r){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Xc(n,+a,+r),this.key=Uc(t,e,n,a,r)}clone(){return new Hc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new Hc(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hc(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-e;return e>this.canonical.z?Uc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Uc(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Hc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new Hc(t,this.wrap,t,n,a),new Hc(t,this.wrap,t,n+1,a),new Hc(t,this.wrap,t,n,a+1),new Hc(t,this.wrap,t,n+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Hc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Hc(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new $c(e.x-this.wrap,e.y))}}function Uc(e,t,n,a,r){(e*=2)<0&&(e=-1*e-1);const i=1<<n;return(i*i*e+i*r+a).toString(36)+n.toString(36)+t.toString(36)}_a("CanonicalTileID",Xc),_a("OverscaledTileID",Hc,{omit:["posMatrix"]});class Vc{constructor(e,t,n){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return void b(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const a=this.dim=t.height-2;this.data=new Uint32Array(t.data.buffer),this.encoding=n||"mapbox";for(let e=0;e<a;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(a,e)]=this.data[this._idx(a-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,a)]=this.data[this._idx(e,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<a;e++)for(let t=0;t<a;t++){const n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){const n=new Uint8Array(this.data.buffer),a=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[a],n[a+1],n[a+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}_unpackMapbox(e,t,n){return(256*e*256+256*t+n)/10-1e4}_unpackTerrarium(e,t,n){return 256*e+t+n/256-32768}getPixels(){return new Mo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=t*this.dim,r=t*this.dim+this.dim,i=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:a=r-1;break;case 1:r=a+1}switch(n){case-1:i=o-1;break;case 1:o=i+1}const s=-t*this.dim,l=-n*this.dim;for(let t=i;t<o;t++)for(let n=a;n<r;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+l)]}}_a("DEMData",Vc);class Gc{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Kc{constructor(e,t,n,a,r){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=n,e._y=a,this.properties=e.properties,this.id=r}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&(e[t]=this[t]);return e}}class Jc{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new fa(Wi,16,0),this.grid3D=new fa(Wi,16,0),this.featureIndexArray=new Fr,this.promoteId=t}insert(e,t,n,a,r,i){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,r);const s=i?this.grid3D:this.grid;for(let e=0;e<t.length;e++){const n=t[e],a=[1/0,1/0,-1/0,-1/0];for(let e=0;e<n.length;e++){const t=n[e];a[0]=Math.min(a[0],t.x),a[1]=Math.min(a[1],t.y),a[2]=Math.max(a[2],t.x),a[3]=Math.max(a[3],t.y)}a[0]<Wi&&a[1]<Wi&&a[2]>=0&&a[3]>=0&&s.insert(o,a[0],a[1],a[2],a[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ds.VectorTile(new Js(this.rawTileData)).layers,this.sourceLayerCoder=new Gc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,n,a){this.loadVTLayers();const r=e.params||{},i=Wi/e.tileSize/e.scale,o=In(r.filter),s=e.queryGeometry,l=e.queryPadding*i,c=Qc(s),u=this.grid.query(c.minX-l,c.minY-l,c.maxX+l,c.maxY+l),d=Qc(e.cameraQueryGeometry),p=this.grid3D.query(d.minX-l,d.minY-l,d.maxX+l,d.maxY+l,(t,n,a,r)=>function(e,t,n,a,r){for(const i of e)if(t<=i.x&&n<=i.y&&a>=i.x&&r>=i.y)return!0;const i=[new A(t,n),new A(t,r),new A(a,r),new A(a,n)];if(e.length>2)for(const t of i)if(Vi(e,t))return!0;for(let t=0;t<e.length-1;t++)if(Gi(e[t],e[t+1],i))return!0;return!1}(e.cameraQueryGeometry,t-l,n-l,a+l,r+l));for(const e of p)u.push(e);u.sort(eu);const m={};let b;for(let l=0;l<u.length;l++){const c=u[l];if(c===b)continue;b=c;const d=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,d.bucketIndex,d.sourceLayerIndex,d.featureIndex,o,r.layers,r.availableImages,t,n,a,(t,n,a)=>(p||(p=Ti(t)),n.queryIntersectsFeature(s,t,a,p,this.z,e.transform,i,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,t,n,a,r,i,o,l,c,u,d){const p=this.bucketLayerIDs[t];if(i&&!function(e,t){for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>=0)return!0;return!1}(i,p))return;const m=this.sourceLayerCoder.decode(n),b=this.vtLayers[m].feature(a);if(r.needGeometry){const e=Ci(b,!0);if(!r.filter(new Xa(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new Xa(this.tileID.overscaledZ),b))return;const h=this.getId(b,m);for(let t=0;t<p.length;t++){const n=p[t];if(i&&i.indexOf(n)<0)continue;const r=l[n];if(!r)continue;let m={};h&&u&&(m=u.getState(r.sourceLayer||"_geojsonTileLayer",h));const f=s({},c[n]);f.paint=Zc(f.paint,r.paint,b,m,o),f.layout=Zc(f.layout,r.layout,b,m,o);const g=!d||d(b,r,m);if(!g)continue;const _=new Kc(b,this.z,this.x,this.y,h);_.layer=f;let y=e[n];void 0===y&&(y=e[n]=[]),y.push({featureIndex:a,feature:_,intersectionZ:g})}}lookupSymbolFeatures(e,t,n,a,r,i,o,s){const l={};this.loadVTLayers();const c=In(r);for(const r of e)this.loadMatchingFeature(l,n,a,r,c,i,o,s,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;return this.promoteId&&(n=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof n&&(n=Number(n))),n}}function Zc(e,t,n,a,r){return u(e,(e,i)=>{const o=t instanceof Za?t.get(i):null;return o&&o.evaluate?o.evaluate(n,a,r):o})}function Qc(e){let t=1/0,n=1/0,a=-1/0,r=-1/0;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),a=Math.max(a,i.x),r=Math.max(r,i.y);return{minX:t,minY:n,maxX:a,maxY:r}}function eu(e,t){return t-e}var tu;_a("FeatureIndex",Jc,{omit:["rawTileData","sourceLayerCoder"]}),e.PerformanceMarkers=void 0,(tu=e.PerformanceMarkers||(e.PerformanceMarkers={})).create="create",tu.load="load",tu.fullLoad="fullLoad";let nu=null,au=[];const ru=1e3/30,iu={mark(e){performance.mark(e)},frame(e){const t=e;null!=nu&&au.push(t-nu),nu=t},clearMetrics(){nu=null,au=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const t in e.PerformanceMarkers)performance.clearMarks(e.PerformanceMarkers[t])},getPerformanceMetrics(){performance.measure("loadTime",e.PerformanceMarkers.create,e.PerformanceMarkers.load),performance.measure("fullLoadTime",e.PerformanceMarkers.create,e.PerformanceMarkers.fullLoad);const t=performance.getEntriesByName("loadTime")[0].duration,n=performance.getEntriesByName("fullLoadTime")[0].duration,a=au.length,r=1/(au.reduce((e,t)=>e+t,0)/a/1e3),i=au.filter(e=>e>ru).reduce((e,t)=>e+(t-ru)/ru,0);return{loadTime:t,fullLoadTime:n,fps:r,percentDroppedFrames:i/(a+i)*100}}};e.AJAXError=I,e.ARRAY_TYPE=no,e.Actor=class{constructor(e,t,n){this.target=e,this.parent=t,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},c(["receive","process"],this),this.invoker=new Wc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=g()?e:window}send(e,t,n,a,r=!1){const i=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(this.callbacks[i]=n);const o=z(this.globalScope)?void 0:[];return this.target.postMessage({id:i,type:e,hasCallback:!!n,targetMapId:a,mustQueue:r,sourceMapId:this.mapId,data:Ma(t,o)},o),{cancel:()=>{n&&delete this.callbacks[i],this.target.postMessage({id:i,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const t=e.data,n=t.id;if(n&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){delete this.tasks[n];const e=this.cancelCallbacks[n];delete this.cancelCallbacks[n],e&&e()}else g()||t.mustQueue?(this.tasks[n]=t,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,t)}process(){if(!this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,t){if("<response>"===t.type){const n=this.callbacks[e];delete this.callbacks[e],n&&(t.error?n(va(t.error)):n(null,va(t.data)))}else{let n=!1;const a=z(this.globalScope)?void 0:[],r=t.hasCallback?(t,r)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Ma(t):null,data:Ma(r,a)},a)}:e=>{n=!0};let i=null;const o=va(t.data);if(this.parent[t.type])i=this.parent[t.type](t.sourceMapId,o,r);else if(this.parent.getWorkerSource){const e=t.type.split(".");i=this.parent.getWorkerSource(t.sourceMapId,e[0],o.source)[e[1]](o,r)}else r(new Error("Could not find function "+t.type));!n&&i&&i.cancel&&(this.cancelCallbacks[e]=i.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.AlphaImage=yo,e.CanonicalTileID=Xc,e.CollisionBoxArray=Tr,e.CollisionCircleLayoutArray=class extends Or{},e.Color=Le,e.DEMData=Vc,e.DataConstantProperty=Qa,e.DictionaryCoder=Gc,e.EXTENT=Wi,e.ErrorEvent=ee,e.EvaluationParameters=Xa,e.Event=Q,e.Evented=te,e.FeatureIndex=Jc,e.FillBucket=is,e.FillExtrusionBucket=xs,e.GeoJSONFeature=Kc,e.ImageAtlas=Al,e.ImagePosition=kl,e.LineBucket=Ps,e.LineStripIndexArray=class extends Wr{},e.LngLat=Sc,e.LngLatBounds=Tc,e.MercatorCoordinate=$c,e.ONE_EM=24,e.OverscaledTileID=Hc,e.PerformanceUtils=iu,e.PosArray=Xr,e.Properties=rr,e.QuadTriangleArray=class extends Ar{},e.RGBAImage=Mo,e.RasterBoundsArray=class extends mr{},e.RequestPerformance=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.ResourceType=B,e.SegmentVector=oi,e.SymbolBucket=zc,e.Transitionable=Ua,e.TriangleIndexArray=ni,e.Uniform1f=_i,e.Uniform1i=class extends gi{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.Uniform2f=class extends gi{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.Uniform3f=class extends gi{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.Uniform4f=yi,e.UniformColor=Mi,e.UniformMatrix4f=class extends gi{constructor(e,t){super(e,t),this.current=vi}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.UnwrappedTileID=Yc,e.ValidationError=ae,e.ZoomHistory=za,e.add=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e},e.addDynamicAttributes=_c,e.asyncAll=function(e,t,n){if(!e.length)return n(null,[]);let a=e.length;const r=new Array(e.length);let i=null;e.forEach((e,o)=>{t(e,(e,t)=>{e&&(i=e),r[o]=t,0==--a&&n(i,r)})})},e.bezier=a,e.bindAll=c,e.cacheEntryPossiblyAdded=function(e){L++,L>j&&(e.getActor().send("enforceCacheSizeLimit",E),L=0)},e.clamp=i,e.clearTileCache=function(e){const t=caches.delete(N);e&&t.catch(e).then(()=>e())},e.clipLine=Gl,e.clone=function(e){var t=new no(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=p,e.clone$2=function(e){var t=new no(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.collisionCircleLayout=Vs,e.config=w,e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.create=function(){var e=new no(16);return no!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=ao,e.createExpression=Nn,e.createFilter=In,e.createLayout=ur,e.createStyleLayer=function(e){return"custom"===e.type?new Ec(e):new jc[e.type](e)},e.cross=function(e,t,n){var a=t[0],r=t[1],i=t[2],o=n[0],s=n[1],l=n[2];return e[0]=r*l-i*s,e[1]=i*o-a*l,e[2]=a*s-r*o,e},e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.dot$1=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.ease=r,e.emitValidationErrors=ha,e.enforceCacheSizeLimit=function(e){W(),q&&q.then(t=>{t.keys().then(n=>{for(let a=0;a<n.length-e;a++)t.delete(n[a])})})},e.equals=function(e,t){var n=e[0],a=e[1],r=e[2],i=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],d=e[9],p=e[10],m=e[11],b=e[12],h=e[13],f=e[14],g=e[15],_=t[0],y=t[1],M=t[2],v=t[3],z=t[4],O=t[5],k=t[6],A=t[7],x=t[8],w=t[9],N=t[10],q=t[11],E=t[12],j=t[13],W=t[14],L=t[15];return Math.abs(n-_)<=to*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(a-y)<=to*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(r-M)<=to*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(i-v)<=to*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-z)<=to*Math.max(1,Math.abs(o),Math.abs(z))&&Math.abs(s-O)<=to*Math.max(1,Math.abs(s),Math.abs(O))&&Math.abs(l-k)<=to*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(c-A)<=to*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(u-x)<=to*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(d-w)<=to*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-N)<=to*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(m-q)<=to*Math.max(1,Math.abs(m),Math.abs(q))&&Math.abs(b-E)<=to*Math.max(1,Math.abs(b),Math.abs(E))&&Math.abs(h-j)<=to*Math.max(1,Math.abs(h),Math.abs(j))&&Math.abs(f-W)<=to*Math.max(1,Math.abs(f),Math.abs(W))&&Math.abs(g-L)<=to*Math.max(1,Math.abs(g),Math.abs(L))},e.evaluateSizeForFeature=function(e,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:r}){return"source"===e.kind?a/Bl:"composite"===e.kind?Ot(a/Bl,r/Bl,n):t},e.evaluateSizeForZoom=function(e,t){let n=0,a=0;if("constant"===e.kind)a=e.layoutSize;else if("source"!==e.kind){const{interpolationType:r,minZoom:o,maxZoom:s}=e,l=r?i(Dt.interpolationFactor(r,t,o,s),0,1):0;"camera"===e.kind?a=Ot(e.minSize,e.maxSize,l):n=l}return{uSizeT:n,uSize:a}},e.evaluateVariableOffset=lc,e.evented=Ba,e.exported=k,e.exported$1=S,e.extend=s,e.filterObject=d,e.fromRotation=function(e,t){var n=Math.sin(t),a=Math.cos(t);return e[0]=a,e[1]=n,e[2]=0,e[3]=-n,e[4]=a,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.getAnchorAlignment=Cl,e.getAnchorJustification=cc,e.getArrayBuffer=Y,e.getImage=K,e.getJSON=function(e,t){return X(s(e,{type:"json"}),t)},e.getOverlapMode=wc,e.getRTLTextPluginStatus=Ia,e.getReferrer=$,e.getVideo=function(e,t){const n=window.document.createElement("video");n.muted=!0,n.onloadstart=function(){t(null,n)};for(let t=0;t<e.length;t++){const a=window.document.createElement("source");H(e[t])||(n.crossOrigin="Anonymous"),a.src=e[t],n.appendChild(a)}return{cancel:()=>{}}},e.identity=ro,e.invert=function(e,t){var n=t[0],a=t[1],r=t[2],i=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],m=t[11],b=t[12],h=t[13],f=t[14],g=t[15],_=n*s-a*o,y=n*l-r*o,M=n*c-i*o,v=a*l-r*s,z=a*c-i*s,O=r*c-i*l,k=u*h-d*b,A=u*f-p*b,x=u*g-m*b,w=d*f-p*h,N=d*g-m*h,q=p*g-m*f,E=_*q-y*N+M*w+v*x-z*A+O*k;return E?(e[0]=(s*q-l*N+c*w)*(E=1/E),e[1]=(r*N-a*q-i*w)*E,e[2]=(h*O-f*z+g*v)*E,e[3]=(p*z-d*O-m*v)*E,e[4]=(l*x-o*q-c*A)*E,e[5]=(n*q-r*x+i*A)*E,e[6]=(f*M-b*O-g*y)*E,e[7]=(u*O-p*M+m*y)*E,e[8]=(o*N-s*x+c*k)*E,e[9]=(a*x-n*N-i*k)*E,e[10]=(b*z-h*M+g*_)*E,e[11]=(d*M-u*z-m*_)*E,e[12]=(s*A-o*w-l*k)*E,e[13]=(n*w-a*A+r*k)*E,e[14]=(h*y-b*v-f*_)*E,e[15]=(u*v-d*y+p*_)*E,e):null},e.isImageBitmap=O,e.isSafari=z,e.isWorker=g,e.keysDifference=function(e,t){const n=[];for(const a in e)a in t||n.push(a);return n},e.lazyLoadRTLTextPlugin=function(){Fa.isLoading()||Fa.isLoaded()||"deferred"!==Ia()||$a()},e.makeRequest=X,e.mapObject=u,e.mercatorXfromLng=Dc,e.mercatorYfromLat=Pc,e.mercatorZfromAltitude=Bc,e.mul=so,e.mul$1=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.multiply=io,e.nextPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.normalize=function(e,t){var n=t[0],a=t[1],r=t[2],i=n*n+a*a+r*r;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},e.number=Ot,e.ortho=function(e,t,n,a,r,i,o){var s=1/(t-n),l=1/(a-r),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(r+a)*l,e[14]=(o+i)*c,e[15]=1,e},e.parseCacheControl=_,e.parseGlyphPbf=function(e){return new Js(e).readFields(Ml,[])},e.pbf=Js,e.performSymbolLayout=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=Wi/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const n=t.bucket.layers[0].layout,a=t.bucket.layers[0]._unevaluatedLayout._values,r={layoutIconSize:a["icon-size"].possiblyEvaluate(new Xa(t.bucket.zoom+1),t.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Xa(t.bucket.zoom+1),t.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Xa(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.textSizeData;r.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Xa(e),t.canonical),a["text-size"].possiblyEvaluate(new Xa(n),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;r.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Xa(e),t.canonical),a["icon-size"].possiblyEvaluate(new Xa(n),t.canonical)]}const i=24*n.get("text-line-height"),o="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),s=n.get("text-keep-upright"),l=n.get("text-size");for(const a of t.bucket.features){const c=n.get("text-font").evaluate(a,{},t.canonical).join(","),u=l.evaluate(a,{},t.canonical),d=r.layoutTextSize.evaluate(a,{},t.canonical),p=r.layoutIconSize.evaluate(a,{},t.canonical),m={horizontal:{},vertical:void 0},h=a.text;let f,g=[0,0];if(h){const r=h.toString(),l=24*n.get("text-letter-spacing").evaluate(a,{},t.canonical),p=Aa(r)?l:0,b=n.get("text-anchor").evaluate(a,{},t.canonical),f=n.get("text-variable-anchor");if(!f){const e=n.get("text-radial-offset").evaluate(a,{},t.canonical);g=e?lc(b,[24*e,sc]):n.get("text-offset").evaluate(a,{},t.canonical).map(e=>24*e)}let _=o?"center":n.get("text-justify").evaluate(a,{},t.canonical);const y=n.get("symbol-placement"),M="point"===y?24*n.get("text-max-width").evaluate(a,{},t.canonical):0,v=()=>{t.bucket.allowVerticalPlacement&&ka(r)&&(m.vertical=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,b,"left",p,g,e.WritingMode.vertical,!0,y,d,u))};if(!o&&f){const n="auto"===_?f.map(e=>cc(e)):[_];let a=!1;for(let r=0;r<n.length;r++){const o=n[r];if(!m.horizontal[o])if(a)m.horizontal[o]=m.horizontal[0];else{const n=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,"center",o,p,g,e.WritingMode.horizontal,!1,y,d,u);n&&(m.horizontal[o]=n,a=1===n.positionedLines.length)}}v()}else{"auto"===_&&(_=cc(b));const n=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,b,_,p,g,e.WritingMode.horizontal,!1,y,d,u);n&&(m.horizontal[_]=n),v(),ka(r)&&o&&s&&(m.vertical=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,b,_,p,g,e.WritingMode.vertical,!1,y,d,u))}}let _=!1;if(a.icon&&a.icon.name){const e=t.imageMap[a.icon.name];e&&(f=Dl(t.imagePositions[a.icon.name],n.get("icon-offset").evaluate(a,{},t.canonical),n.get("icon-anchor").evaluate(a,{},t.canonical)),_=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=_:t.bucket.sdfIcons!==_&&b("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const y=mc(m.horizontal)||m.vertical;t.bucket.iconsInText=!!y&&y.iconsInText,(y||f)&&uc(t.bucket,a,m,f,t.imageMap,r,d,p,g,_,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.perspective=function(e,t,n,a,r){var i,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(e[10]=(r+a)*(i=1/(a-r)),e[14]=2*r*a*i):(e[10]=-1,e[14]=-2*a),e},e.pick=function(e,t){const n={};for(let a=0;a<t.length;a++){const r=t[a];r in e&&(n[r]=e[r])}return n},e.plugin=Fa,e.pointGeometry=A,e.polygonIntersectsPolygon=Pi,e.potpack=Ol,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.register=_a,e.registerForPluginStateChange=function(e){return e({pluginStatus:Ca,pluginURL:Ra}),Ba.on("pluginStateChange",e),e},e.renderColorRamp=vo,e.rotateX=function(e,t,n){var a=Math.sin(n),r=Math.cos(n),i=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],d=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*r+c*a,e[5]=o*r+u*a,e[6]=s*r+d*a,e[7]=l*r+p*a,e[8]=c*r-i*a,e[9]=u*r-o*a,e[10]=d*r-s*a,e[11]=p*r-l*a,e},e.rotateZ=function(e,t,n){var a=Math.sin(n),r=Math.cos(n),i=t[0],o=t[1],s=t[2],l=t[3],c=t[4],u=t[5],d=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*r+c*a,e[1]=o*r+u*a,e[2]=s*r+d*a,e[3]=l*r+p*a,e[4]=c*r-i*a,e[5]=u*r-o*a,e[6]=d*r-s*a,e[7]=p*r-l*a,e},e.scale=function(e,t,n){var a=n[0],r=n[1],i=n[2];return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.scale$1=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e},e.setCacheLimits=function(e,t){E=e,j=t},e.setRTLTextPlugin=function(e,t,n=!1){if(Ca===Wa||Ca===La||Ca===Sa)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ra=k.resolveURL(e),Ca=Wa,Ta=t,Pa(),n||$a()},e.spec=ne,e.sphericalToCartesian=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.sqrLen=function(e){var t=e[0],n=e[1];return t*t+n*n},e.sub=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e},e.toEvaluationFeature=Ci,e.transformMat3=function(e,t,n){var a=t[0],r=t[1],i=t[2];return e[0]=a*n[0]+r*n[3]+i*n[6],e[1]=a*n[1]+r*n[4]+i*n[7],e[2]=a*n[2]+r*n[5]+i*n[8],e},e.transformMat4=uo,e.transformMat4$1=function(e,t,n){var a=t[0],r=t[1];return e[0]=n[0]*a+n[4]*r+n[12],e[1]=n[1]*a+n[5]*r+n[13],e},e.translate=function(e,t,n){var a,r,i,o,s,l,c,u,d,p,m,b,h=n[0],f=n[1],g=n[2];return t===e?(e[12]=t[0]*h+t[4]*f+t[8]*g+t[12],e[13]=t[1]*h+t[5]*f+t[9]*g+t[13],e[14]=t[2]*h+t[6]*f+t[10]*g+t[14],e[15]=t[3]*h+t[7]*f+t[11]*g+t[15]):(r=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],m=t[10],b=t[11],e[0]=a=t[0],e[1]=r,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=p,e[10]=m,e[11]=b,e[12]=a*h+s*f+d*g+t[12],e[13]=r*h+l*f+p*g+t[13],e[14]=i*h+c*f+m*g+t[14],e[15]=o*h+u*f+b*g+t[15]),e},e.triggerPluginCompletionEvent=Da,e.unicodeBlockLookup=Oa,e.uniqueId=function(){return l++},e.validateCustomStyleLayer=function(e){const t=[],n=e.id;return void 0===n&&t.push({message:`layers.${n}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.validateLight=pa,e.validateStyle=da,e.vectorTile=ds,e.warnOnce=b,e.wrap=o})),a(0,(function(e){function t(e){const n=typeof e;if("number"===n||"boolean"===n||"string"===n||null==e)return JSON.stringify(e);if(Array.isArray(e)){let n="[";for(const a of e)n+=t(a)+",";return n+"]"}const a=Object.keys(e).sort();let r="{";for(let n=0;n<a.length;n++)r+=`${JSON.stringify(a[n])}:${t(e[a[n]])},`;return r+"}"}function n(n){let a="";for(const r of e.refProperties)a+="/"+t(n[r]);return a}class a{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,a){for(const n of t){this._layerConfigs[n.id]=n;const t=this._layers[n.id]=e.createStyleLayer(n);t._featureFilter=e.createFilter(t.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(const e of a)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=function(e,t){const a={};for(let r=0;r<e.length;r++){const i=t&&t[e[r].id]||n(e[r]);t&&(t[e[r].id]=i);let o=a[i];o||(o=a[i]=[]),o.push(e[r])}const r=[];for(const e in a)r.push(a[e]);return r}(Object.values(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map(e=>this._layers[e.id]),n=t[0];if("none"===n.visibility)continue;const a=n.source||"";let r=this.familiesBySource[a];r||(r=this.familiesBySource[a]={});const i=n.sourceLayer||"_geojsonTileLayer";let o=r[i];o||(o=r[i]=[]),o.push(t)}}}class r{constructor(t){const n={},a=[];for(const e in t){const r=t[e],i=n[e]={};for(const e in r){const t=r[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};a.push(n),i[e]={rect:n,metrics:t.metrics}}}const{w:r,h:i}=e.potpack(a),o=new e.AlphaImage({width:r||1,height:i||1});for(const a in t){const r=t[a];for(const t in r){const i=r[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const s=n[a][t].rect;e.AlphaImage.copy(i.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},i.bitmap)}}this.image=o,this.positions=n}}e.register("GlyphAtlas",r);class i{constructor(t){this.tileID=new e.OverscaledTileID(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,n,a,i,s){this.status="parsing",this.data=t,this.collisionBoxArray=new e.CollisionBoxArray;const l=new e.DictionaryCoder(Object.keys(t.layers).sort()),c=new e.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},d={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:a},p=n.familiesBySource[this.source];for(const n in p){const r=t.layers[n];if(!r)continue;1===r.version&&e.warnOnce(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const i=l.encode(n),s=[];for(let e=0;e<r.length;e++){const t=r.feature(e),a=c.getId(t,n);s.push({feature:t,id:a,index:e,sourceLayerIndex:i})}for(const t of p[n]){const n=t[0];n.source!==this.source&&e.warnOnce(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.minzoom&&this.zoom<Math.floor(n.minzoom)||n.maxzoom&&this.zoom>=n.maxzoom||"none"!==n.visibility&&(o(t,this.zoom,a),(u[n.id]=n.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:i,sourceID:this.source})).populate(s,d,this.tileID.canonical),c.bucketLayerIDs.push(t.map(e=>e.id)))}}let m,b,h,f;const g=e.mapObject(d.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(g).length?i.send("getGlyphs",{uid:this.uid,stacks:g},(e,t)=>{m||(m=e,b=t,M.call(this))}):b={};const _=Object.keys(d.iconDependencies);_.length?i.send("getImages",{icons:_,source:this.source,tileID:this.tileID,type:"icons"},(e,t)=>{m||(m=e,h=t,M.call(this))}):h={};const y=Object.keys(d.patternDependencies);function M(){if(m)return s(m);if(b&&h&&f){const t=new r(b),n=new e.ImageAtlas(h,f);for(const r in u){const i=u[r];i instanceof e.SymbolBucket?(o(i.layers,this.zoom,a),e.performSymbolLayout({bucket:i,glyphMap:b,glyphPositions:t.positions,imageMap:h,imagePositions:n.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):i.hasPattern&&(i instanceof e.LineBucket||i instanceof e.FillBucket||i instanceof e.FillExtrusionBucket)&&(o(i.layers,this.zoom,a),i.addFeatures(d,this.tileID.canonical,n.patternPositions))}this.status="done",s(null,{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:n,glyphMap:this.returnDependencies?b:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?t.positions:null})}}y.length?i.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"patterns"},(e,t)=>{m||(m=e,f=t,M.call(this))}):f={},M.call(this)}}function o(t,n,a){const r=new e.EvaluationParameters(n);for(const e of t)e.recalculate(r,a)}function s(t,n){const a=e.getArrayBuffer(t.request,(t,a,r,i)=>{t?n(t):a&&n(null,{vectorTile:new e.vectorTile.VectorTile(new e.pbf(a)),rawData:a,cacheControl:r,expires:i})});return()=>{a.cancel(),n()}}class l{constructor(e,t,n,a){this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=a||s,this.loading={},this.loaded={}}loadTile(t,n){const a=t.uid;this.loading||(this.loading={});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),o=this.loading[a]=new i(t);o.abort=this.loadVectorData(t,(t,i)=>{if(delete this.loading[a],t||!i)return o.status="done",this.loaded[a]=o,n(t);const s=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(r){const e=r.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=i.vectorTile,o.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,(t,a)=>{if(t||!a)return n(t);n(null,e.extend({rawTileData:s.slice(0)},a,l,c))}),this.loaded=this.loaded||{},this.loaded[a]=o})}reloadTile(e,t){const n=this.loaded,a=e.uid,r=this;if(n&&n[a]){const i=n[a];i.showCollisionBoxes=e.showCollisionBoxes;const o=(e,n)=>{const a=i.reloadCallback;a&&(delete i.reloadCallback,i.parse(i.vectorTile,r.layerIndex,this.availableImages,r.actor,a)),t(e,n)};"parsing"===i.status?i.reloadCallback=o:"done"===i.status&&(i.vectorTile?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,o):o())}}abortTile(e,t){const n=this.loading,a=e.uid;n&&n[a]&&n[a].abort&&(n[a].abort(),delete n[a]),t()}removeTile(e,t){const n=this.loaded,a=e.uid;n&&n[a]&&delete n[a],t()}}class c{constructor(){this.loaded={}}loadTile(t,n){const{uid:a,encoding:r,rawImageData:i}=t,o=e.isImageBitmap(i)?this.getImageData(i):i,s=new e.DEMData(a,o,r);this.loaded=this.loaded||{},this.loaded[a]=s,n(null,s)}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 n=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.RGBAImage({width:n.width,height:n.height},n.data)}removeTile(e){const t=this.loaded,n=e.uid;t&&t[n]&&delete t[n]}}function u(e,t){if(0!==e.length){d(e[0],t);for(var n=1;n<e.length;n++)d(e[n],!t)}}function d(e,t){for(var n=0,a=0,r=0,i=e.length,o=i-1;r<i;o=r++){var s=(e[r][0]-e[o][0])*(e[o][1]+e[r][1]),l=n+s;a+=Math.abs(n)>=Math.abs(s)?n-l+s:s-l+n,n=l}n+a>=0!=!!t&&e.reverse()}const p=e.vectorTile.VectorTileFeature.prototype.toGeoJSON;class m{constructor(t){this._feature=t,this.extent=e.EXTENT,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 n of this._feature.geometry)t.push([new e.pointGeometry(n[0],n[1])]);return t}{const t=[];for(const n of this._feature.geometry){const a=[];for(const t of n)a.push(new e.pointGeometry(t[0],t[1]));t.push(a)}return t}}toGeoJSON(e,t,n){return p.call(this,e,t,n)}}class b{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=t.length,this._features=t}feature(e){return new m(this._features[e])}}var h={exports:{}},f=e.pointGeometry,g=e.vectorTile.VectorTileFeature,_=y;function y(e,t){this.options=t||{},this.features=e,this.length=e.length}function M(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}y.prototype.feature=function(e){return new M(this.features[e],this.options.extent)},M.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var n=e[t],a=[],r=0;r<n.length;r++)a.push(new f(n[r][0],n[r][1]));this.geometry.push(a)}return this.geometry},M.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,n=-1/0,a=1/0,r=-1/0,i=0;i<e.length;i++)for(var o=e[i],s=0;s<o.length;s++){var l=o[s];t=Math.min(t,l.x),n=Math.max(n,l.x),a=Math.min(a,l.y),r=Math.max(r,l.y)}return[t,a,n,r]},M.prototype.toGeoJSON=g.prototype.toGeoJSON;var v=e.pbf,z=_;function O(e){var t=new v;return function(e,t){for(var n in e.layers)t.writeMessage(3,k,e.layers[n])}(e,t),t.finish()}function k(e,t){var n;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var a={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<e.length;n++)a.feature=e.feature(n),t.writeMessage(2,A,a);var r=a.keys;for(n=0;n<r.length;n++)t.writeStringField(3,r[n]);var i=a.values;for(n=0;n<i.length;n++)t.writeMessage(4,E,i[n])}function A(e,t){var n=e.feature;void 0!==n.id&&t.writeVarintField(1,n.id),t.writeMessage(2,x,e),t.writeVarintField(3,n.type),t.writeMessage(4,q,n)}function x(e,t){var n=e.feature,a=e.keys,r=e.values,i=e.keycache,o=e.valuecache;for(var s in n.properties){var l=n.properties[s],c=i[s];if(null!==l){void 0===c&&(a.push(s),i[s]=c=a.length-1),t.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var d=u+":"+l,p=o[d];void 0===p&&(r.push(l),o[d]=p=r.length-1),t.writeVarint(p)}}}function w(e,t){return(t<<3)+(7&e)}function N(e){return e<<1^e>>31}function q(e,t){for(var n=e.loadGeometry(),a=e.type,r=0,i=0,o=n.length,s=0;s<o;s++){var l=n[s],c=1;1===a&&(c=l.length),t.writeVarint(w(1,c));for(var u=3===a?l.length-1:l.length,d=0;d<u;d++){1===d&&1!==a&&t.writeVarint(w(2,u-1));var p=l[d].x-r,m=l[d].y-i;t.writeVarint(N(p)),t.writeVarint(N(m)),r+=p,i+=m}3===a&&t.writeVarint(w(7,1))}}function E(e,t){var n=typeof e;"string"===n?t.writeStringField(1,e):"boolean"===n?t.writeBooleanField(7,e):"number"===n&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}function j(e,t,n,a,r,i){if(r-a<=n)return;const o=a+r>>1;(function e(t,n,a,r,i,o){for(;i>r;){if(i-r>600){const s=i-r+1,l=a-r+1,c=Math.log(s),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);e(t,n,a,Math.max(r,Math.floor(a-l*u/s+d)),Math.min(i,Math.floor(a+(s-l)*u/s+d)),o)}const s=n[2*a+o];let l=r,c=i;for(W(t,n,r,a),n[2*i+o]>s&&W(t,n,r,i);l<c;){for(W(t,n,l,c),l++,c--;n[2*l+o]<s;)l++;for(;n[2*c+o]>s;)c--}n[2*r+o]===s?W(t,n,r,c):(c++,W(t,n,c,i)),c<=a&&(r=c+1),a<=c&&(i=c-1)}})(e,t,o,a,r,i%2),j(e,t,n,a,o-1,i+1),j(e,t,n,o+1,r,i+1)}function W(e,t,n,a){L(e,n,a),L(t,2*n,2*a),L(t,2*n+1,2*a+1)}function L(e,t,n){const a=e[t];e[t]=e[n],e[n]=a}function S(e,t,n,a){const r=e-n,i=t-a;return r*r+i*i}h.exports=O,h.exports.fromVectorTileJs=O,h.exports.fromGeojsonVt=function(e,t){t=t||{};var n={};for(var a in e)n[a]=new z(e[a].features,t),n[a].name=a,n[a].version=t.version,n[a].extent=t.extent;return O({layers:n})},h.exports.GeoJSONWrapper=z;const T=e=>e[0],C=e=>e[1];class R{constructor(e,t=T,n=C,a=64,r=Float64Array){this.nodeSize=a,this.points=e;const i=e.length<65536?Uint16Array:Uint32Array,o=this.ids=new i(e.length),s=this.coords=new r(2*e.length);for(let a=0;a<e.length;a++)o[a]=a,s[2*a]=t(e[a]),s[2*a+1]=n(e[a]);j(o,s,a,0,o.length-1,0)}range(e,t,n,a){return function(e,t,n,a,r,i,o){const s=[0,e.length-1,0],l=[];let c,u;for(;s.length;){const d=s.pop(),p=s.pop(),m=s.pop();if(p-m<=o){for(let o=m;o<=p;o++)c=t[2*o],u=t[2*o+1],c>=n&&c<=r&&u>=a&&u<=i&&l.push(e[o]);continue}const b=Math.floor((m+p)/2);c=t[2*b],u=t[2*b+1],c>=n&&c<=r&&u>=a&&u<=i&&l.push(e[b]);const h=(d+1)%2;(0===d?n<=c:a<=u)&&(s.push(m),s.push(b-1),s.push(h)),(0===d?r>=c:i>=u)&&(s.push(b+1),s.push(p),s.push(h))}return l}(this.ids,this.coords,e,t,n,a,this.nodeSize)}within(e,t,n){return function(e,t,n,a,r,i){const o=[0,e.length-1,0],s=[],l=r*r;for(;o.length;){const c=o.pop(),u=o.pop(),d=o.pop();if(u-d<=i){for(let r=d;r<=u;r++)S(t[2*r],t[2*r+1],n,a)<=l&&s.push(e[r]);continue}const p=Math.floor((d+u)/2),m=t[2*p],b=t[2*p+1];S(m,b,n,a)<=l&&s.push(e[p]);const h=(c+1)%2;(0===c?n-r<=m:a-r<=b)&&(o.push(d),o.push(p-1),o.push(h)),(0===c?n+r>=m:a+r>=b)&&(o.push(p+1),o.push(u),o.push(h))}return s}(this.ids,this.coords,e,t,n,this.nodeSize)}}const D={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},P=Math.fround||(B=new Float32Array(1),e=>(B[0]=+e,B[0]));var B;class I{constructor(e){this.options=G(Object.create(D),e),this.trees=new Array(this.options.maxZoom+1)}load(e){const{log:t,minZoom:n,maxZoom:a,nodeSize:r}=this.options;t&&console.time("total time");const i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let o=[];for(let t=0;t<e.length;t++)e[t].geometry&&o.push(F(e[t],t));this.trees[a+1]=new R(o,K,J,r,Float32Array),t&&console.timeEnd(i);for(let e=a;e>=n;e--){const n=+Date.now();o=this._cluster(o,e),this.trees[e]=new R(o,K,J,r,Float32Array),t&&console.log("z%d: %d clusters in %dms",e,o.length,+Date.now()-n)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,r=180;else if(n>r){const e=this.getClusters([n,a,180,i],t),o=this.getClusters([-180,a,r,i],t);return e.concat(o)}const o=this.trees[this._limitZoom(t)],s=o.range(H(n),U(i),H(r),U(a)),l=[];for(const e of s){const t=o.points[e];l.push(t.numPoints?X(t):this.points[t.index])}return l}getChildren(e){const t=this._getOriginId(e),n=this._getOriginZoom(e),a="No cluster with the specified id.",r=this.trees[n];if(!r)throw new Error(a);const i=r.points[t];if(!i)throw new Error(a);const o=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=r.within(i.x,i.y,o),l=[];for(const t of s){const n=r.points[t];n.parentId===e&&l.push(n.numPoints?X(n):this.points[n.index])}if(0===l.length)throw new Error(a);return l}getLeaves(e,t,n){const a=[];return this._appendLeaves(a,e,t=t||10,n=n||0,0),a}getTile(e,t,n){const a=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:i,radius:o}=this.options,s=o/i,l=(n-s)/r,c=(n+1+s)/r,u={features:[]};return this._addTileFeatures(a.range((t-s)/r,l,(t+1+s)/r,c),a.points,t,n,r,u),0===t&&this._addTileFeatures(a.range(1-s/r,l,1,c),a.points,r,n,r,u),t===r-1&&this._addTileFeatures(a.range(0,l,s/r,c),a.points,-1,n,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const n=this.getChildren(e);if(t++,1!==n.length)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,a,r){const i=this.getChildren(t);for(const t of i){const i=t.properties;if(i&&i.cluster?r+i.point_count<=a?r+=i.point_count:r=this._appendLeaves(e,i.cluster_id,n,a,r):r<a?r++:e.push(t),e.length===n)break}return r}_addTileFeatures(e,t,n,a,r,i){for(const o of e){const e=t[o],s=e.numPoints;let l,c,u;if(s)l=Y(e),c=e.x,u=e.y;else{const t=this.points[e.index];l=t.properties,c=H(t.geometry.coordinates[0]),u=U(t.geometry.coordinates[1])}const d={type:1,geometry:[[Math.round(this.options.extent*(c*r-n)),Math.round(this.options.extent*(u*r-a))]],tags:l};let p;s?p=e.id:this.options.generateId?p=e.index:this.points[e.index].id&&(p=this.points[e.index].id),void 0!==p&&(d.id=p),i.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const n=[],{radius:a,extent:r,reduce:i,minPoints:o}=this.options,s=a/(r*Math.pow(2,t));for(let a=0;a<e.length;a++){const r=e[a];if(r.zoom<=t)continue;r.zoom=t;const l=this.trees[t+1],c=l.within(r.x,r.y,s),u=r.numPoints||1;let d=u;for(const e of c){const n=l.points[e];n.zoom>t&&(d+=n.numPoints||1)}if(d>u&&d>=o){let e=r.x*u,o=r.y*u,s=i&&u>1?this._map(r,!0):null;const p=(a<<5)+(t+1)+this.points.length;for(const n of c){const a=l.points[n];if(a.zoom<=t)continue;a.zoom=t;const c=a.numPoints||1;e+=a.x*c,o+=a.y*c,a.parentId=p,i&&(s||(s=this._map(r,!0)),i(s,this._map(a)))}r.parentId=p,n.push($(e/d,o/d,p,d,s))}else if(n.push(r),d>1)for(const e of c){const a=l.points[e];a.zoom<=t||(a.zoom=t,n.push(a))}}return n}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t){if(e.numPoints)return t?G({},e.properties):e.properties;const n=this.points[e.index].properties,a=this.options.map(n);return t&&a===n?G({},a):a}}function $(e,t,n,a,r){return{x:P(e),y:P(t),zoom:1/0,id:n,parentId:-1,numPoints:a,properties:r}}function F(e,t){const[n,a]=e.geometry.coordinates;return{x:P(H(n)),y:P(U(a)),zoom:1/0,index:t,parentId:-1}}function X(e){return{type:"Feature",id:e.id,properties:Y(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),V(e.y)]}};var t}function Y(e){const t=e.numPoints,n=t>=1e4?Math.round(t/1e3)+"k":t>=1e3?Math.round(t/100)/10+"k":t;return G(G({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:n})}function H(e){return e/360+.5}function U(e){const t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function V(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function G(e,t){for(const n in t)e[n]=t[n];return e}function K(e){return e.x}function J(e){return e.y}function Z(e,t,n,a,r,i){var o=r-n,s=i-a;if(0!==o||0!==s){var l=((e-n)*o+(t-a)*s)/(o*o+s*s);l>1?(n=r,a=i):l>0&&(n+=o*l,a+=s*l)}return(o=e-n)*o+(s=t-a)*s}function Q(e,t,n,a){var r={id:void 0===e?null:e,type:t,geometry:n,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)ee(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var a=0;a<t.length;a++)ee(e,t[a]);else if("MultiPolygon"===n)for(a=0;a<t.length;a++)for(var r=0;r<t[a].length;r++)ee(e,t[a][r])}(r),r}function ee(e,t){for(var n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function te(e,t,n,a){if(t.geometry){var r=t.geometry.coordinates,i=t.geometry.type,o=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),s=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=a||0),"Point"===i)ne(r,s);else if("MultiPoint"===i)for(var c=0;c<r.length;c++)ne(r[c],s);else if("LineString"===i)ae(r,s,o,!1);else if("MultiLineString"===i){if(n.lineMetrics){for(c=0;c<r.length;c++)ae(r[c],s=[],o,!1),e.push(Q(l,"LineString",s,t.properties));return}re(r,s,o,!1)}else if("Polygon"===i)re(r,s,o,!0);else{if("MultiPolygon"!==i){if("GeometryCollection"===i){for(c=0;c<t.geometry.geometries.length;c++)te(e,{id:l,geometry:t.geometry.geometries[c],properties:t.properties},n,a);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<r.length;c++){var u=[];re(r[c],u,o,!0),s.push(u)}}e.push(Q(l,i,s,t.properties))}}function ne(e,t){t.push(ie(e[0])),t.push(oe(e[1])),t.push(0)}function ae(e,t,n,a){for(var r,i,o=0,s=0;s<e.length;s++){var l=ie(e[s][0]),c=oe(e[s][1]);t.push(l),t.push(c),t.push(0),s>0&&(o+=a?(r*c-l*i)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-i,2))),r=l,i=c}var u=t.length-3;t[2]=1,function e(t,n,a,r){for(var i,o=r,s=a-n>>1,l=a-n,c=t[n],u=t[n+1],d=t[a],p=t[a+1],m=n+3;m<a;m+=3){var b=Z(t[m],t[m+1],c,u,d,p);if(b>o)i=m,o=b;else if(b===o){var h=Math.abs(m-s);h<l&&(i=m,l=h)}}o>r&&(i-n>3&&e(t,n,i,r),t[i+2]=o,a-i>3&&e(t,i,a,r))}(t,0,u,n),t[u+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function re(e,t,n,a){for(var r=0;r<e.length;r++){var i=[];ae(e[r],i,n,a),t.push(i)}}function ie(e){return e/360+.5}function oe(e){var t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function se(e,t,n,a,r,i,o,s){if(a/=t,i>=(n/=t)&&o<a)return e;if(o<n||i>=a)return null;for(var l=[],c=0;c<e.length;c++){var u=e[c],d=u.geometry,p=u.type,m=0===r?u.minX:u.minY,b=0===r?u.maxX:u.maxY;if(m>=n&&b<a)l.push(u);else if(!(b<n||m>=a)){var h=[];if("Point"===p||"MultiPoint"===p)le(d,h,n,a,r);else if("LineString"===p)ce(d,h,n,a,r,!1,s.lineMetrics);else if("MultiLineString"===p)de(d,h,n,a,r,!1);else if("Polygon"===p)de(d,h,n,a,r,!0);else if("MultiPolygon"===p)for(var f=0;f<d.length;f++){var g=[];de(d[f],g,n,a,r,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&"LineString"===p){for(f=0;f<h.length;f++)l.push(Q(u.id,p,h[f],u.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===h.length?(p="LineString",h=h[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===h.length?"Point":"MultiPoint"),l.push(Q(u.id,p,h,u.tags))}}}return l.length?l:null}function le(e,t,n,a,r){for(var i=0;i<e.length;i+=3){var o=e[i+r];o>=n&&o<=a&&(t.push(e[i]),t.push(e[i+1]),t.push(e[i+2]))}}function ce(e,t,n,a,r,i,o){for(var s,l,c=ue(e),u=0===r?me:be,d=e.start,p=0;p<e.length-3;p+=3){var m=e[p],b=e[p+1],h=e[p+2],f=e[p+3],g=e[p+4],_=0===r?m:b,y=0===r?f:g,M=!1;o&&(s=Math.sqrt(Math.pow(m-f,2)+Math.pow(b-g,2))),_<n?y>n&&(l=u(c,m,b,f,g,n),o&&(c.start=d+s*l)):_>a?y<a&&(l=u(c,m,b,f,g,a),o&&(c.start=d+s*l)):pe(c,m,b,h),y<n&&_>=n&&(l=u(c,m,b,f,g,n),M=!0),y>a&&_<=a&&(l=u(c,m,b,f,g,a),M=!0),!i&&M&&(o&&(c.end=d+s*l),t.push(c),c=ue(e)),o&&(d+=s)}var v=e.length-3;m=e[v],b=e[v+1],h=e[v+2],(_=0===r?m:b)>=n&&_<=a&&pe(c,m,b,h),v=c.length-3,i&&v>=3&&(c[v]!==c[0]||c[v+1]!==c[1])&&pe(c,c[0],c[1],c[2]),c.length&&t.push(c)}function ue(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function de(e,t,n,a,r,i){for(var o=0;o<e.length;o++)ce(e[o],t,n,a,r,i,!1)}function pe(e,t,n,a){e.push(t),e.push(n),e.push(a)}function me(e,t,n,a,r,i){var o=(i-t)/(a-t);return e.push(i),e.push(n+(r-n)*o),e.push(1),o}function be(e,t,n,a,r,i){var o=(i-n)/(r-n);return e.push(t+(a-t)*o),e.push(i),e.push(1),o}function he(e,t){for(var n=[],a=0;a<e.length;a++){var r,i=e[a],o=i.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=fe(i.geometry,t);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var s=0;s<i.geometry.length;s++)r.push(fe(i.geometry[s],t))}else if("MultiPolygon"===o)for(r=[],s=0;s<i.geometry.length;s++){for(var l=[],c=0;c<i.geometry[s].length;c++)l.push(fe(i.geometry[s][c],t));r.push(l)}n.push(Q(i.id,o,r,i.tags))}return n}function fe(e,t){var n=[];n.size=e.size,void 0!==e.start&&(n.start=e.start,n.end=e.end);for(var a=0;a<e.length;a+=3)n.push(e[a]+t,e[a+1],e[a+2]);return n}function ge(e,t){if(e.transformed)return e;var n,a,r,i=1<<e.z,o=e.x,s=e.y;for(n=0;n<e.features.length;n++){var l=e.features[n],c=l.geometry,u=l.type;if(l.geometry=[],1===u)for(a=0;a<c.length;a+=2)l.geometry.push(_e(c[a],c[a+1],t,i,o,s));else for(a=0;a<c.length;a++){var d=[];for(r=0;r<c[a].length;r+=2)d.push(_e(c[a][r],c[a][r+1],t,i,o,s));l.geometry.push(d)}}return e.transformed=!0,e}function _e(e,t,n,a,r,i){return[Math.round(n*(e*a-r)),Math.round(n*(t*a-i))]}function ye(e,t,n,a,r){for(var i=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:a,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){o.numFeatures++,Me(o,e[s],i,r);var l=e[s].minX,c=e[s].minY,u=e[s].maxX,d=e[s].maxY;l<o.minX&&(o.minX=l),c<o.minY&&(o.minY=c),u>o.maxX&&(o.maxX=u),d>o.maxY&&(o.maxY=d)}return o}function Me(e,t,n,a){var r=t.geometry,i=t.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s<r.length;s+=3)o.push(r[s]),o.push(r[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===i)ve(o,r,e,n,!1,!1);else if("MultiLineString"===i||"Polygon"===i)for(s=0;s<r.length;s++)ve(o,r[s],e,n,"Polygon"===i,0===s);else if("MultiPolygon"===i)for(var l=0;l<r.length;l++){var c=r[l];for(s=0;s<c.length;s++)ve(o,c[s],e,n,!0,0===s)}if(o.length){var u=t.tags||null;if("LineString"===i&&a.lineMetrics){for(var d in u={},t.tags)u[d]=t.tags[d];u.mapbox_clip_start=r.start/r.size,u.mapbox_clip_end=r.end/r.size}var p={geometry:o,type:"Polygon"===i||"MultiPolygon"===i?3:"LineString"===i||"MultiLineString"===i?2:1,tags:u};null!==t.id&&(p.id=t.id),e.features.push(p)}}function ve(e,t,n,a,r,i){var o=a*a;if(a>0&&t.size<(r?o:a))n.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===a||t[l+2]>o)&&(n.numSimplified++,s.push(t[l]),s.push(t[l+1])),n.numPoints++;r&&function(e,t){for(var n=0,a=0,r=e.length,i=r-2;a<r;i=a,a+=2)n+=(e[a]-e[i])*(e[a+1]+e[i+1]);if(n>0===t)for(a=0,r=e.length;a<r/2;a+=2){var o=e[a],s=e[a+1];e[a]=e[r-2-a],e[a+1]=e[r-1-a],e[r-2-a]=o,e[r-1-a]=s}}(s,i),e.push(s)}}function ze(e,t){var n=(t=this.options=function(e,t){for(var n in t)e[n]=t[n];return e}(Object.create(this.options),t)).debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var a=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var a=0;a<e.features.length;a++)te(n,e.features[a],t,a);else te(n,"Feature"===e.type?e:{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=function(e,t){var n=t.buffer/t.extent,a=e,r=se(e,1,-1-n,n,0,-1,2,t),i=se(e,1,1-n,2+n,0,-1,2,t);return(r||i)&&(a=se(e,1,-n,1+n,0,-1,2,t)||[],r&&(a=he(r,1).concat(a)),i&&(a=a.concat(he(i,-1)))),a}(a,t)).length&&this.splitTile(a,0,0,0),n&&(a.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 Oe(e,t,n){return 32*((1<<e)*n+t)+e}function ke(e,t){const n=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);const a=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!a)return t(null,null);const r=new b(a.features);let i=h.exports(r);0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),t(null,{vectorTile:r,rawData:i.buffer})}ze.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ze.prototype.splitTile=function(e,t,n,a,r,i,o){for(var s=[e,t,n,a],l=this.options,c=l.debug;s.length;){a=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();var u=1<<t,d=Oe(t,n,a),p=this.tiles[d];if(!p&&(c>1&&console.time("creation"),p=this.tiles[d]=ye(e,t,n,a,l),this.tileCoords.push({z:t,x:n,y:a}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,a,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var m="z"+t;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(p.source=e,r){if(t===l.maxZoom||t===r)continue;var b=1<<r-t;if(n!==Math.floor(i/b)||a!==Math.floor(o/b))continue}else if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==e.length){c>1&&console.time("clipping");var h,f,g,_,y,M,v=.5*l.buffer/l.extent,z=.5-v,O=.5+v,k=1+v;h=f=g=_=null,y=se(e,u,n-v,n+O,0,p.minX,p.maxX,l),M=se(e,u,n+z,n+k,0,p.minX,p.maxX,l),e=null,y&&(h=se(y,u,a-v,a+O,1,p.minY,p.maxY,l),f=se(y,u,a+z,a+k,1,p.minY,p.maxY,l),y=null),M&&(g=se(M,u,a-v,a+O,1,p.minY,p.maxY,l),_=se(M,u,a+z,a+k,1,p.minY,p.maxY,l),M=null),c>1&&console.timeEnd("clipping"),s.push(h||[],t+1,2*n,2*a),s.push(f||[],t+1,2*n,2*a+1),s.push(g||[],t+1,2*n+1,2*a),s.push(_||[],t+1,2*n+1,2*a+1)}}},ze.prototype.getTile=function(e,t,n){var a=this.options,r=a.extent,i=a.debug;if(e<0||e>24)return null;var o=1<<e,s=Oe(e,t=(t%o+o)%o,n);if(this.tiles[s])return ge(this.tiles[s],r);i>1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,c=e,u=t,d=n;!l&&c>0;)c--,u=Math.floor(u/2),d=Math.floor(d/2),l=this.tiles[Oe(c,u,d)];return l&&l.source?(i>1&&console.log("found parent tile z%d-%d-%d",c,u,d),i>1&&console.time("drilling down"),this.splitTile(l.source,c,u,d,e,t,n),i>1&&console.timeEnd("drilling down"),this.tiles[s]?ge(this.tiles[s],r):null):null};class Ae extends l{constructor(e,t,n,a){super(e,t,n,ke),a&&(this.loadGeoJSON=a)}loadData(t,n){var a;null===(a=this._pendingRequest)||void 0===a||a.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(t,(a,i)=>{if(delete this._pendingCallback,delete this._pendingRequest,a||!i)return n(a);if("object"!=typeof i)return n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{!function e(t,n){var a,r=t&&t.type;if("FeatureCollection"===r)for(a=0;a<t.features.length;a++)e(t.features[a],n);else if("GeometryCollection"===r)for(a=0;a<t.geometries.length;a++)e(t.geometries[a],n);else if("Feature"===r)e(t.geometry,n);else if("Polygon"===r)u(t.coordinates,n);else if("MultiPolygon"===r)for(a=0;a<t.coordinates.length;a++)u(t.coordinates[a],n);return t}(i,!0);try{if(t.filter){const n=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));const a=i.features.filter(e=>n.value.evaluate({zoom:0},e));i={type:"FeatureCollection",features:a}}this._geoJSONIndex=t.cluster?new I(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;const a={},r={},i={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(const t of s){const[i,o]=n[t],s=e.createExpression(o),l=e.createExpression("string"==typeof i?[i,["accumulated"],["get",t]]:i);a[t]=s.value,r[t]=l.value}return t.map=e=>{o.properties=e;const t={};for(const e of s)t[e]=a[e].evaluate(i,o);return t},t.reduce=(e,t)=>{o.properties=t;for(const t of s)i.accumulated=e[t],e[t]=r[t].evaluate(i,o)},t}(t)).load(i.features):function(e,t){return new ze(e,t)}(i,t.geojsonVtOptions)}catch(a){return n(a)}this.loaded={};const o={};if(r){const e=r.finish();e&&(o.resourceTiming={},o.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}n(null,o)}})}reloadTile(e,t){const n=this.loaded;return n&&n[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,n){if(t.request)return e.getJSON(t.request,n);if("string"==typeof t.data)try{n(null,JSON.parse(t.data))}catch(e){n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}else n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t()}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class xe{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:Ae},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}setReferrer(e,t){this.referrer=t}setImages(e,t,n){this.availableImages[e]=t;for(const n in this.workerSources[e]){const a=this.workerSources[e][n];for(const e in a)a[e].availableImages=t}n()}setLayers(e,t,n){this.getLayerIndex(e).replace(t),n()}updateLayers(e,t,n){this.getLayerIndex(e).update(t.layers,t.removedIds),n()}loadTile(e,t,n){this.getWorkerSource(e,t.type,t.source).loadTile(t,n)}loadDEMTile(e,t,n){this.getDEMWorkerSource(e,t.source).loadTile(t,n)}reloadTile(e,t,n){this.getWorkerSource(e,t.type,t.source).reloadTile(t,n)}abortTile(e,t,n){this.getWorkerSource(e,t.type,t.source).abortTile(t,n)}removeTile(e,t,n){this.getWorkerSource(e,t.type,t.source).removeTile(t,n)}removeDEMTile(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t)}removeSource(e,t,n){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const a=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==a.removeSource?a.removeSource(t,n):n()}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,a){try{e.plugin.setState(n);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const n=e.plugin.isParsed();a(n?void 0:new Error("RTL Text Plugin failed to import scripts from "+t),n)}}catch(e){a(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new a),t}getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){const a={send:(t,n,a)=>{this.actor.send(t,n,a,e)}};this.workerSources[e][t][n]=new this.workerSourceTypes[t](a,this.getLayerIndex(e),this.getAvailableImages(e))}return this.workerSources[e][t][n]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new c),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,n){e.enforceCacheSizeLimit(n)}}return e.isWorker()&&(self.worker=new xe(self)),xe})),a(0,(function(e){var t=n;function n(e){return!function(e){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,n=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(n);try{t=new Worker(a),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(a),e}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var n=t.getImageData(0,0,1,1);return n&&n.width===e.width}()?(void 0===a[t=e&&e.failIfMajorPerformanceCaveat]&&(a[t]=function(e){var t,a=function(e){var t=document.createElement("canvas"),a=Object.create(n.webGLContextAttributes);return a.failIfMajorPerformanceCaveat=e,t.getContext("webgl",a)||t.getContext("experimental-webgl",a)}(e);if(!a)return!1;try{t=a.createShader(a.VERTEX_SHADER)}catch(e){return!1}return!(!t||a.isContextLost())&&(a.shaderSource(t,"void main() {}"),a.compileShader(t),!0===a.getShaderParameter(t,a.COMPILE_STATUS))}(t)),a[t]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var t}(e)}var a={};function r(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!r(e[n],t[n]))return!1;return!0}return e===t}n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class i{static testProp(e){if(!i.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in i.docStyle)return e[t];return e[0]}static create(e,t,n){const a=window.document.createElement(e);return void 0!==t&&(a.className=t),n&&n.appendChild(a),a}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]="none")}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect)}static setTransform(e,t){e.style[i.transformProp]=t}static addEventListener(e,t,n,a={}){e.addEventListener(t,n,"passive"in a?a:a.capture)}static removeEventListener(e,t,n,a={}){e.removeEventListener(t,n,"passive"in a?a:a.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",i.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",i.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",i.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new e.pointGeometry(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),r=[];for(let i=0;i<n.length;i++)r.push(new e.pointGeometry(n[i].clientX-a.left-t.clientLeft,n[i].clientY-a.top-t.clientTop));return r}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}i.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),i.transformProp=i.testProp(["transform","WebkitTransform"]);class o{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeSpriteURL(e,t,n){const a=function(e){const t=e.match(s);if(!t)throw new Error(`Unable to parse URL "${e}"`);return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}(e);return a.path+=`${t}${n}`,function(e){const t=e.params.length?"?"+e.params.join("&"):"";return`${e.protocol}://${e.authority}${e.path}${t}`}(a)}setTransformRequest(e){this._transformRequestFn=e}}const s=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class l{constructor(e,t,n,a){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,a)}update(t,n,a){const{width:r,height:i}=t,o=!(this.size&&this.size[0]===r&&this.size[1]===i||a),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(n&&n.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!n||!1!==n.premultiply)),o)this.size=[r,i],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.isImageBitmap(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,r,i,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:n,y:o}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.isImageBitmap(t)?l.texSubImage2D(l.TEXTURE_2D,0,n,o,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,n,o,r,i,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,n){const{context:a}=this,{gl:r}=a;r.bindTexture(r.TEXTURE_2D,this.texture),n!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=r.LINEAR),e!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function c(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class u extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}getImage(e){return this.images[e]}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(t,n){let a=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(e,t){if(!e)return!0;let n=0;for(const a of e){if(a[0]<n||a[1]<a[0]||t<a[1])return!1;n=a[1]}return!0}_validateContent(e,t){return!(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,t){const n=this.images[e];if(n.data.width!==t.data.width||n.data.height!==t.data.height)throw new Error(`size mismatch between old image (${n.data.width}x${n.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=n.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){const t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,t){let n=!0;if(!this.isLoaded())for(const t of e)this.images[t]||(n=!1);this.isLoaded()||n?this._notify(e,t):this.requestors.push({ids:e,callback:t})}_notify(t,n){const a={};for(const n of t){this.images[n]||this.fire(new e.Event("styleimagemissing",{id:n}));const t=this.images[n];t?a[n]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.warnOnce(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,a)}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const n={w:a.data.width+2,h:a.data.height+2,x:0,y:0},r=new e.ImagePosition(n,a);this.patterns[t]={bin:n,position:r}}return this._updatePatternAtlas(),this.patterns[t].position}bind(e){const t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new l(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:n,h:a}=e.potpack(t),r=this.atlasImage;r.resize({width:n||1,height:a||1});for(const t in this.patterns){const{bin:n}=this.patterns[t],a=n.x+1,i=n.y+1,o=this.images[t].data,s=o.width,l=o.height;e.RGBAImage.copy(o,r,{x:0,y:0},{x:a,y:i},{width:s,height:l}),e.RGBAImage.copy(o,r,{x:0,y:l-1},{x:a,y:i-1},{width:s,height:1}),e.RGBAImage.copy(o,r,{x:0,y:0},{x:a,y:i+l},{width:s,height:1}),e.RGBAImage.copy(o,r,{x:s-1,y:0},{x:a-1,y:i},{width:1,height:l}),e.RGBAImage.copy(o,r,{x:0,y:0},{x:a+s,y:i},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const t=this.images[n];t||e.warnOnce(`Image with ID: "${n}" was not found`),c(t)&&this.updateImage(n,t)}}}const d=1e20;function p(e,t,n,a,r,i,o,s,l){for(let c=t;c<t+a;c++)m(e,n*i+c,i,r,o,s,l);for(let c=n;c<n+r;c++)m(e,c*i+t,1,a,o,s,l)}function m(e,t,n,a,r,i,o){i[0]=0,o[0]=-d,o[1]=d,r[0]=e[t];for(let s=1,l=0,c=0;s<a;s++){r[s]=e[t+s*n];const a=s*s;do{const e=i[l];c=(r[s]-r[e]+a-e*e)/(s-e)/2}while(c<=o[l]&&--l>-1);l++,i[l]=s,o[l]=c,o[l+1]=d}for(let s=0,l=0;s<a;s++){for(;o[l+1]<s;)l++;const a=i[l],c=s-a;e[t+s*n]=r[a]+c*c}}class b{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(t,n){const a=[];for(const e in t)for(const n of t[e])a.push({stack:e,id:n});e.asyncAll(a,({stack:e,id:t},n)=>{let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}});let r=a.glyphs[t];if(void 0!==r)return void n(null,{stack:e,id:t,glyph:r});if(r=this._tinySDF(a,e,t),r)return a.glyphs[t]=r,void n(null,{stack:e,id:t,glyph:r});const i=Math.floor(t/256);if(256*i>65535)return void n(new Error("glyphs > 65535 not supported"));if(a.ranges[i])return void n(null,{stack:e,id:t,glyph:r});let o=a.requests[i];o||(o=a.requests[i]=[],b.loadGlyphRange(e,i,this.url,this.requestManager,(e,t)=>{if(t){for(const e in t)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=t[+e]);a.ranges[i]=!0}for(const n of o)n(e,t);delete a.requests[i]})),o.push((a,r)=>{a?n(a):r&&n(null,{stack:e,id:t,glyph:r[t]||null})})},(e,t)=>{if(e)n(e);else if(t){const e={};for(const{stack:n,id:a,glyph:r}of t)(e[n]||(e[n]={}))[a]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};n(null,e)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(e.unicodeBlockLookup["CJK Unified Ideographs"](t)||e.unicodeBlockLookup["Hangul Syllables"](t)||e.unicodeBlockLookup.Hiragana(t)||e.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(a))return;let i=t.tinySDF;if(!i){let e="400";/bold/i.test(n)?e="900":/medium/i.test(n)?e="500":/light/i.test(n)&&(e="200"),i=t.tinySDF=new b.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:e})}const o=i.draw(String.fromCharCode(a));return{id:a,bitmap:new e.AlphaImage({width:o.width||30,height:o.height||30},o.data),metrics:{width:o.glyphWidth||24,height:o.glyphHeight||24,left:o.glyphLeft||0,top:o.glyphTop-27||-8,advance:o.glyphAdvance||24}}}}b.loadGlyphRange=function(t,n,a,r,i){const o=256*n,s=o+255,l=r.transformRequest(a.replace("{fontstack}",t).replace("{range}",`${o}-${s}`),e.ResourceType.Glyphs);e.getArrayBuffer(l,(t,n)=>{if(t)i(t);else if(n){const t={};for(const a of e.parseGlyphPbf(n))t[a.id]=a;i(null,t)}})},b.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:r="sans-serif",fontWeight:i="normal",fontStyle:o="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const s=this.size=e+4*t,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${i} ${e}px ${r}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:r,actualBoundingBoxRight:i}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.min(this.size-this.buffer,Math.ceil(i-r)),l=Math.min(this.size-this.buffer,o+Math.ceil(a)),c=s+2*this.buffer,u=l+2*this.buffer,m=Math.max(c*u,0),b=new Uint8ClampedArray(m),h={data:b,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return h;const{ctx:f,buffer:g,gridInner:_,gridOuter:y}=this;f.clearRect(g,g,s,l),f.fillText(e,g,g+o);const M=f.getImageData(g,g,s,l);y.fill(d,0,m),_.fill(0,0,m);for(let e=0;e<l;e++)for(let t=0;t<s;t++){const n=M.data[4*(e*s+t)+3]/255;if(0===n)continue;const a=(e+g)*c+t+g;if(1===n)y[a]=0,_[a]=d;else{const e=.5-n;y[a]=e>0?e*e:0,_[a]=e<0?e*e:0}}p(y,0,0,c,u,c,this.f,this.v,this.z),p(_,g,g,s,l,c,this.f,this.v,this.z);for(let e=0;e<m;e++){const t=Math.sqrt(y[e])-Math.sqrt(_[e]);b[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return h}};const h=new e.Properties({anchor:new e.DataConstantProperty(e.spec.light.anchor),position:new class{constructor(){this.specification=e.spec.light.position}possiblyEvaluate(t,n){return e.sphericalToCartesian(t.expression.evaluate(n))}interpolate(t,n,a){return{x:e.number(t.x,n.x,a),y:e.number(t.y,n.y,a),z:e.number(t.z,n.z,a)}}},color:new e.DataConstantProperty(e.spec.light.color),intensity:new e.DataConstantProperty(e.spec.light.intensity)}),f="-transition";class g extends e.Evented{constructor(t){super(),this._transitionable=new e.Transitionable(h),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(e.validateLight,t,n))for(const e in t){const n=t[e];e.endsWith(f)?this._transitionable.setTransition(e.slice(0,-f.length),n):this._transitionable.setValue(e,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,n,a){return(!a||!1!==a.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}class _{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){const n=e.join(",")+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){const a=[];let r=e.length%2==1?-e[e.length-1]*n:0,i=e[0]*n,o=!0;a.push({left:r,right:i,isDash:o,zeroLength:0===e[0]});let s=e[0];for(let t=1;t<e.length;t++){o=!o;const l=e[t];r=s*n,s+=l,i=s*n,a.push({left:r,right:i,isDash:o,zeroLength:0===l})}return a}addRoundDash(e,t,n){const a=t/2;for(let t=-n;t<=n;t++){const r=this.width*(this.nextRow+n+t);let i=0,o=e[i];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++i]);const l=Math.abs(s-o.left),c=Math.abs(s-o.right),u=Math.min(l,c);let d;const p=t/n*(a+1);if(o.isDash){const e=a-Math.abs(p);d=Math.sqrt(u*u+e*e)}else d=a-Math.sqrt(u*u+p*p);this.data[r+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const n=e[t],a=e[t+1];n.zeroLength?e.splice(t,1):a&&a.isDash===n.isDash&&(a.left=n.left,e.splice(t,1))}const t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);const a=this.width*this.nextRow;let r=0,i=e[r];for(let t=0;t<this.width;t++){t/i.right>1&&(i=e[++r]);const n=Math.abs(t-i.left),o=Math.abs(t-i.right),s=Math.min(n,o);this.data[a+t]=Math.max(0,Math.min(255,(i.isDash?s:-s)+128))}}addDash(t,n){const a=n?7:0,r=2*a+1;if(this.nextRow+r>this.height)return e.warnOnce("LineAtlas out of space"),null;let i=0;for(let e=0;e<t.length;e++)i+=t[e];if(0!==i){const e=this.width/i,r=this.getDashRanges(t,this.width,e);n?this.addRoundDash(r,e,a):this.addRegularDash(r)}const o={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:i};return this.nextRow+=r,this.dirty=!0,o}bind(e){const t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}class y{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e.uniqueId();const a=this.workerPool.acquire(this.id);for(let e=0;e<a.length;e++){const t=new y.Actor(a[e],n,this.id);t.name="Worker "+e,this.actors.push(t)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,a){e.asyncAll(this.actors,(e,a)=>{e.send(t,n,a)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function M(t,n,a){const r=function(n,r){if(n)return a(n);if(r){const n=e.pick(e.extend(r,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(n.vectorLayers=r.vector_layers,n.vectorLayerIds=n.vectorLayers.map(e=>e.id)),a(null,n)}};return t.url?e.getJSON(n.transformRequest(t.url,e.ResourceType.Source),r):e.exported.frame(()=>r(null,t))}y.Actor=e.Actor;class v{constructor(t,n,a){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*n),r=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*n),i=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*n),o=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x<i&&t.y>=r&&t.y<o}}class z extends e.Evented{constructor(t,n,a,r){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.extend(this,e.pick(n,["url","scheme","tileSize","promoteId"])),this._options=e.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=M(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new e.ErrorEvent(t)):n&&(e.extend(this,n),n.bounds&&(this.tileBounds=new v(n.bounds,this.minzoom,this.maxzoom)),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(a,e.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function i(a,r){return delete t.request,t.aborted?n(null):a&&404!==a.status?n(a):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=n:t.request=t.actor.send("reloadTile",r,i.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,i.bind(this)))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class O extends e.Evented{constructor(t,n,a,r){super(),this.id=t,this.dispatcher=a,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.extend({type:"raster"},n),e.extend(this,e.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=M(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):n&&(e.extend(this,n),n.bounds&&(this.tileBounds=new v(n.bounds,this.minzoom,this.maxzoom)),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),(a,r,i)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(a)t.state="errored",n(a);else if(r){this.map._refreshExpiredTiles&&t.setExpiryData(i);const a=this.map.painter.context,o=a.gl;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new l(a,r,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),t.state="loaded",e.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}}let k;class A extends O{constructor(t,n,a,r){super(t,n,a,r),this.type="raster-dem",this.maxzoom=22,this._options=e.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function r(e,a){e&&(t.state="errored",n(e)),a&&(t.dem=a,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),function(a,i){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(a)t.state="errored",n(a);else if(i){this.map._refreshExpiredTiles&&t.setExpiryData(i),delete i.cacheControl,delete i.expires;const n=e.isImageBitmap(i)&&(null==k&&(k="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),k)?i:e.exported.getImageData(i,1),a={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:n,encoding:this.encoding};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",a,r.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),r=(n.x-1+a)%a,i=0===n.x?t.wrap-1:t.wrap,o=(n.x+1+a)%a,s=n.x+1===a?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,i,n.z,r,n.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,i,n.z,r,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<a&&(l[new e.OverscaledTileID(t.overscaledZ,i,n.z,r,n.y+1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),l}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}}class x extends e.Evented{constructor(t,n,a,r){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(r),this._data=n.data,this._options=e.extend({},n),this._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const i=e.EXTENT/this.tileSize;this.workerOptions=e.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*i,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*i,extent:e.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:e.EXTENT,radius:(n.clusterRadius||50)*i,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData("content"),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},t),this}getClusterLeaves(e,t,n,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:n},a),this}_updateWorkerData(t){const n=e.extend({},this.workerOptions),a=this._data;"string"==typeof a?(n.request=this.map._requestManager.transformRequest(e.exported.resolveURL(a),e.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(a),this._pendingLoads++,this.fire(new e.Event("dataloading",{dataType:"source"})),this.actor.send(this.type+".loadData",n,(n,a)=>{if(this._pendingLoads--,this._removed||a&&a.abandoned)return void this.fire(new e.Event("dataabort",{dataType:"source",sourceDataType:t}));let r=null;if(a&&a.resourceTiming&&a.resourceTiming[this.id]&&(r=a.resourceTiming[this.id].slice(0)),n)return void this.fire(new e.ErrorEvent(n));const i={dataType:"source",sourceDataType:t};this._collectResourceTiming&&r&&r.length>0&&e.extend(i,{resourceTiming:r}),this.fire(new e.Event("data",i))})}loaded(){return 0===this._pendingLoads}loadTile(e,t){const n=e.actor?"reloadTile":"loadTile";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(n,a,(a,r)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):a?t(a):(e.loadVectorData(r,this.map.painter,"reloadTile"===n),t(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return e.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var w=e.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class N extends e.Evented{constructor(e,t,n,a){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=t}load(t,n){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),(a,r)=>{this._loaded=!0,a?this.fire(new e.ErrorEvent(a)):r&&(this.image=r,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(e.MercatorCoordinate.fromLngLat);this.tileID=function(t){let n=1/0,a=1/0,r=-1/0,i=-1/0;for(const e of t)n=Math.min(n,e.x),a=Math.min(a,e.y),r=Math.max(r,e.x),i=Math.max(i,e.y);const o=Math.max(r-n,i-a),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,s);return new e.CanonicalTileID(s,Math.floor((n+r)/2*l),Math.floor((a+i)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(e=>this.tileID.getTilePoint(e)._round());return this._boundsArray=new e.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,e.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,e.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,e.EXTENT,e.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,w.members)),this.boundsSegments||(this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new l(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class q extends N{constructor(e,t,n,a){super(e,t,n,a),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,e.ResourceType.Source).url);e.getVideo(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):n&&(this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError("sources."+this.id,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,w.members)),this.boundsSegments||(this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new l(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class E extends N{constructor(t,n,a,r){super(t,n,a,r),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof HTMLCanvasElement||this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,w.members)),this.boundsSegments||(this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l(n,this.canvas,a.RGBA,{premultiply:!0});for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const j={vector:z,raster:O,"raster-dem":A,geojson:x,video:q,image:N,canvas:E};function W(t,n){const a=e.create();return e.translate(a,a,[1,1,0]),e.scale(a,a,[.5*t.width,.5*t.height,1]),e.multiply(a,a,t.calculatePosMatrix(n.toUnwrapped()))}function L(e,t,n,a,r,i){const o=function(e,t,n){if(e)for(const a of e){const e=t[a];if(e&&e.source===n&&"fill-extrusion"===e.type)return!0}else for(const e in t){const a=t[e];if(a.source===n&&"fill-extrusion"===a.type)return!0}return!1}(r&&r.layers,t,e.id),s=i.maxPitchScaleFactor(),l=e.tilesIn(a,s,o);l.sort(S);const c=[];for(const a of l)c.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(t,n,e._state,a.queryGeometry,a.cameraQueryGeometry,a.scale,r,i,s,W(e.transform,a.tileID))});const u=function(e){const t={},n={};for(const a of e){const e=a.queryResults,r=a.wrappedTileID,i=n[r]=n[r]||{};for(const n in e){const a=e[n],r=i[n]=i[n]||{},o=t[n]=t[n]||[];for(const e of a)r[e.featureIndex]||(r[e.featureIndex]=!0,o.push(e))}}return t}(c);for(const t in u)u[t].forEach(t=>{const n=t.feature,a=e.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a});return u}function S(e,t){const n=e.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class T{constructor(t,n){this.tileID=t,this.uid=e.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<e.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.textures.forEach(t=>e.saveTileTexture(t)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(e,t){const n={};if(!t)return n;for(const a of e){const e=a.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){a.layers=e,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)n[t.id]=a}}return n}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const n=this.buckets[t];if(n instanceof e.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const n=this.buckets[t];if(n instanceof e.SymbolBucket&&n.hasRTLText){this.hasRTLText=!0,e.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.CollisionBoxArray}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const n=this.buckets[t];n.uploadPending()&&n.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,a,r,i,o,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:r,scale:i,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:o,queryPadding:this.queryPadding*l},e,t,n):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const r=a.loadVTLayers(),i=n?n.sourceLayer:"",o=r._geojsonTileLayer||r[i];if(!o)return;const s=e.createFilter(n&&n.filter),{z:l,x:c,y:u}=this.tileID.canonical,d={z:l,x:c,y:u};for(let n=0;n<o.length;n++){const r=o.feature(n);if(s.needGeometry){const t=e.toEvaluationFeature(r,!0);if(!s.filter(new e.EvaluationParameters(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new e.EvaluationParameters(this.tileID.overscaledZ),r))continue;const p=a.getId(r,i),m=new e.GeoJSONFeature(r,l,c,u,p);m.tile=d,t.push(m)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const n=e.parseCacheControl(t.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{const a=this.expirationTime-n;a?this.expirationTime=e+Math.max(a,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;const n=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!t.style.hasLayer(a))continue;const r=this.buckets[a],i=r.layers[0].sourceLayer||"_geojsonTileLayer",o=n[i],s=e[i];if(!o||!s||0===Object.keys(s).length)continue;r.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=t&&t.style&&t.style.getLayer(a);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(r)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=e.exported.now()+t}setDependencies(e,t){const n={};for(const e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(const n of e){const e=this.dependencies[n];if(e)for(const n of t)if(e[n])return!0}return!1}}class C{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){const a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);const r={value:t,timeout:void 0};if(void 0!==n&&(r.timeout=setTimeout(()=>{this.remove(e,r)},n)),this.data[a].push(r),this.order.push(a),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const n=e.wrapped().key,a=void 0===t?0:this.data[n].indexOf(t),r=this.data[n][a];return this.data[n].splice(a,1),r.timeout&&clearTimeout(r.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(r.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const n in this.data)for(const a of this.data[n])e(a.value)||t.push(a);for(const e of t)this.remove(e.value.tileID,e)}}class R{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const r=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},e.extend(this.stateChanges[t][r],a),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==r&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][r]){this.deletedStates[t][r]={};for(const e in this.state[t][r])a[e]||(this.deletedStates[t][r][e]=null)}else for(const e in a)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][e]&&delete this.deletedStates[t][r][e]}removeFeatureState(e,t,n){if(null===this.deletedStates[e])return;const a=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&void 0!==t)null!==this.deletedStates[e][a]&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][n]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][a])for(n in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][n]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(t,n){const a=String(n),r=e.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][n];if(null===e)return{};for(const t in e)delete r[t]}return r}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(t,n){const a={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const n={};for(const a in this.stateChanges[t])this.state[t][a]||(this.state[t][a]={}),e.extend(this.state[t][a],this.stateChanges[t][a]),n[a]=this.state[t][a];a[t]=n}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const n={};if(null===this.deletedStates[t])for(const e in this.state[t])n[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const n of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][n];n[e]=this.state[t][e]}a[t]=a[t]||{},e.extend(a[t],n)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(const e in t)t[e].setFeatureState(a,n)}}class D extends e.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(t,n,a,r){const i=new j[n.type](t,n,a,r);if(i.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${i.id}`);return e.bindAll(["load","abort","unload","serialize","prepare"],i),i}(t,n,a,this),this._tiles={},this._cache=new C(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new R}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,t){return this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new e.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(P).map(e=>e.key)}getRenderableIds(t){const n=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&n.push(this._tiles[e]);return t?n.sort((t,n)=>{const a=t.tileID,r=n.tileID,i=new e.pointGeometry(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),o=new e.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-r.overscaledZ||o.y-i.y||o.x-i.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(P).map(e=>e.key)}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(e,"reloading")}}_reloadTile(e,t){const n=this._tiles[e];n&&("loading"!==n.state&&(n.state=t),this._loadTile(n,this._tileLoaded.bind(this,n,e,t)))}_tileLoaded(t,n,a,r){if(r)return t.state="errored",void(404!==r.status?this._source.fire(new e.ErrorEvent(r,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=e.exported.now(),"expired"===a&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(e){const t=this.getRenderableIds();for(let a=0;a<t.length;a++){const r=t[a];if(e.neighboringTiles&&e.neighboringTiles[r]){const t=this.getTileByID(r);n(e,t),n(t,e)}}function n(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x;const a=t.tileID.canonical.y-e.tileID.canonical.y,r=Math.pow(2,e.tileID.canonical.z),i=t.tileID.key;0===n&&0===a||Math.abs(a)>1||(Math.abs(n)>1&&(1===Math.abs(n+r)?n+=r:1===Math.abs(n-r)&&(n-=r)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,a),e.neighboringTiles&&e.neighboringTiles[i]&&(e.neighboringTiles[i].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,a){for(const r in this._tiles){let i=this._tiles[r];if(a[r]||!i.hasData()||i.tileID.overscaledZ<=t||i.tileID.overscaledZ>n)continue;let o=i.tileID;for(;i&&i.tileID.overscaledZ>t+1;){const e=i.tileID.scaledTo(i.tileID.overscaledZ-1);i=this._tiles[e.key],i&&i.hasData()&&(o=e)}let s=o;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){a[o.key]=o;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){const t=e.scaledTo(n),a=this._getLoadedTile(t);if(a)return a}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const t=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,a=Math.floor(t*n*5),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(r)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const n in this._tiles){const a=this._tiles[n];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),e[a.tileID.key]=a}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.OverscaledTileID(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(e=>this._source.hasTile(e)))):a=[];const r=t.coveringZoomLevel(this._source),i=Math.max(r-D.maxOverzooming,this._source.minzoom),o=Math.max(r+D.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of a)if(t.canonical.z>this._source.minzoom){const n=t.scaledTo(t.canonical.z-1);e[n.key]=n;const a=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[a.key]=a}a=a.concat(Object.values(e))}const s=this._updateRetainedTiles(a,r);if(B(this._source.type)){const t={},l={},c=Object.keys(s);for(const n of c){const a=s[n],r=this._tiles[n];if(!r||r.fadeEndTime&&r.fadeEndTime<=e.exported.now())continue;const o=this.findLoadedParent(a,i);o&&(this._addTile(o.tileID),t[o.tileID.key]=o.tileID),l[n]=a}this._retainLoadedChildren(l,r,o,s);for(const e in t)s[e]||(this._coveredTiles[e]=!0,s[e]=t[e]);if(n){const e={},t={};for(const n of a)this._tiles[n.key].hasData()?e[n.key]=n:t[n.key]=n;for(const n in t){const a=t[n].children(this._source.maxzoom);this._tiles[a[0].key]&&this._tiles[a[1].key]&&this._tiles[a[2].key]&&this._tiles[a[3].key]&&(e[a[0].key]=s[a[0].key]=a[0],e[a[1].key]=s[a[1].key]=a[1],e[a[2].key]=s[a[2].key]=a[2],e[a[3].key]=s[a[3].key]=a[3],delete t[n])}for(const n in t){const a=this.findLoadedParent(t[n],this._source.minzoom);if(a){e[a.tileID.key]=s[a.tileID.key]=a.tileID;for(const t in e)e[t].isChildOf(a.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}for(const e in s)this._tiles[e].clearFadeHold();const l=e.keysDifference(this._tiles,s);for(const e of l){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){const n={},a={},r=Math.max(t-D.maxOverzooming,this._source.minzoom),i=Math.max(t+D.maxUnderzooming,this._source.minzoom),o={};for(const a of e){const e=this._addTile(a);n[a.key]=a,e.hasData()||t<this._source.maxzoom&&(o[a.key]=a)}this._retainLoadedChildren(o,t,i,n);for(const i of e){let e=this._tiles[i.key];if(e.hasData())continue;if(t+1>this._source.maxzoom){const e=i.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){n[e.key]=e;continue}}else{const e=i.children(this._source.maxzoom);if(n[e[0].key]&&n[e[1].key]&&n[e[2].key]&&n[e[3].key])continue}let o=e.wasRequested();for(let t=i.overscaledZ-1;t>=r;--t){const r=i.scaledTo(t);if(a[r.key])break;if(a[r.key]=!0,e=this.getTile(r),!e&&o&&(e=this._addTile(r)),e&&(n[r.key]=r,o=e.wasRequested(),e.hasData()))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let n,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){n=this._loadedParentTiles[a.key];break}t.push(a.key);const e=a.scaledTo(a.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;a=e}for(const e of t)this._loadedParentTiles[e]=n}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new T(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new e.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(t,n,a){const r=[],i=this.transform;if(!i)return r;const o=a?i.getCameraQueryGeometry(t):t,s=t.map(e=>i.pointCoordinate(e,this.terrain)),l=o.map(e=>i.pointCoordinate(e,this.terrain)),c=this.getIds();let u=1/0,d=1/0,p=-1/0,m=-1/0;for(const e of l)u=Math.min(u,e.x),d=Math.min(d,e.y),p=Math.max(p,e.x),m=Math.max(m,e.y);for(let t=0;t<c.length;t++){const a=this._tiles[c[t]];if(a.holdingForFade())continue;const o=a.tileID,b=Math.pow(2,i.zoom-a.tileID.overscaledZ),h=n*a.queryPadding*e.EXTENT/a.tileSize/b,f=[o.getTilePoint(new e.MercatorCoordinate(u,d)),o.getTilePoint(new e.MercatorCoordinate(p,m))];if(f[0].x-h<e.EXTENT&&f[0].y-h<e.EXTENT&&f[1].x+h>=0&&f[1].y+h>=0){const e=s.map(e=>o.getTilePoint(e)),t=l.map(e=>o.getTilePoint(e));r.push({tile:a,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:b})}}return r}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map(e=>this._tiles[e].tileID);for(const e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(B(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(void 0!==n.fadeEndTime&&n.fadeEndTime>=e.exported.now())return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e=e||"_geojsonTileLayer",t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,n)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,n){const a=this._tiles[e];a&&a.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(const n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(e,t))}}function P(e,t){const n=Math.abs(2*e.wrap)-+(e.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||a-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function B(e){return"raster"===e||"image"===e||"video"===e}D.maxOverzooming=10,D.maxUnderzooming=3;const I="mapboxgl_preloaded_worker_pool";class ${constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<$.workerCount;)this.workers.push(new Worker(Mr.workerUrl));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[I]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(e.exported.hardwareConcurrency/2);let X;function Y(){return X||(X=new $),X}function H(t,n){const a={};for(const e in t)"ref"!==e&&(a[e]=t[e]);return e.refProperties.forEach(e=>{e in n&&(a[e]=n[e])}),a}function U(e){e=e.slice();const t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)"ref"in e[n]&&(e[n]=H(e[n],t[e[n].ref]));return e}$.workerCount=Math.max(Math.min(F,6),1);const V={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function G(e,t,n){n.push({command:V.addSource,args:[e,t[e]]})}function K(e,t,n){t.push({command:V.removeSource,args:[e]}),n[e]=!0}function J(e,t,n,a){K(e,n,a),G(e,t,n)}function Z(e,t,n){let a;for(a in e[n])if(Object.prototype.hasOwnProperty.call(e[n],a)&&"data"!==a&&!r(e[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&"data"!==a&&!r(e[n][a],t[n][a]))return!1;return!0}function Q(e,t,n,a,i,o){let s;for(s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(r(e[s],t[s])||n.push({command:o,args:[a,s,t[s],i]}));for(s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(r(e[s],t[s])||n.push({command:o,args:[a,s,t[s],i]}))}function ee(e){return e.id}function te(e,t){return e[t.id]=t,e}class ne{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.clamp(t,0,1);let n=1,a=this._distances[n];const r=t*this.paddedLength+this.padding;for(;a<r&&n<this._distances.length;)a=this._distances[++n];const i=n-1,o=this._distances[i],s=a-o,l=s>0?(r-o)/s:0;return this.points[i].mult(1-l).add(this.points[n].mult(l))}}function ae(e,t){let n=!0;return"always"===e||"never"!==e&&"never"!==t||(n=!1),n}class re{constructor(e,t,n){const a=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)a.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,a,r){this._forEachCell(t,n,a,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(r)}insertCircle(e,t,n,a){this._forEachCell(t-a,n-a,t+a,n+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(a)}_insertBoxCell(e,t,n,a,r,i){this.boxCells[r].push(i)}_insertCircleCell(e,t,n,a,r,i){this.circleCells[r].push(i)}_query(e,t,n,a,r,i,o){if(n<0||e>this.width||a<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=a){if(r)return[{key:null,x1:e,y1:t,x2:n,y2:a}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],n=this.circles[3*e+1],a=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-a,y1:n-a,x2:t+a,y2:n+a})}}else this._forEachCell(e,t,n,a,this._queryCell,s,{hitTest:r,overlapMode:i,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,a){return this._query(e,t,n,a,!1,null)}hitTest(e,t,n,a,r,i){return this._query(e,t,n,a,!0,r,i).length>0}hitTestCircle(e,t,n,a,r){const i=e-n,o=e+n,s=t-n,l=t+n;if(o<0||i>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(i,s,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:a,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},r),c.length>0}_queryCell(e,t,n,a,r,i,o,s){const{seenUids:l,hitTest:c,overlapMode:u}=o,d=this.boxCells[r];if(null!==d){const r=this.bboxes;for(const o of d)if(!l.box[o]){l.box[o]=!0;const d=4*o,p=this.boxKeys[o];if(e<=r[d+2]&&t<=r[d+3]&&n>=r[d+0]&&a>=r[d+1]&&(!s||s(p))&&(!c||!ae(u,p.overlapMode))&&(i.push({key:p,x1:r[d],y1:r[d+1],x2:r[d+2],y2:r[d+3]}),c))return!0}}const p=this.circleCells[r];if(null!==p){const r=this.circles;for(const o of p)if(!l.circle[o]){l.circle[o]=!0;const d=3*o,p=this.circleKeys[o];if(this._circleAndRectCollide(r[d],r[d+1],r[d+2],e,t,n,a)&&(!s||s(p))&&(!c||!ae(u,p.overlapMode))){const e=r[d],t=r[d+1],n=r[d+2];if(i.push({key:p,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),c)return!0}}}return!1}_queryCellCircle(e,t,n,a,r,i,o,s){const{circle:l,seenUids:c,overlapMode:u}=o,d=this.boxCells[r];if(null!==d){const e=this.bboxes;for(const t of d)if(!c.box[t]){c.box[t]=!0;const n=4*t,a=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(a))&&!ae(u,a.overlapMode))return i.push(!0),!0}}const p=this.circleCells[r];if(null!==p){const e=this.circles;for(const t of p)if(!c.circle[t]){c.circle[t]=!0;const n=3*t,a=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],l.x,l.y,l.radius)&&(!s||s(a))&&!ae(u,a.overlapMode))return i.push(!0),!0}}}_forEachCell(e,t,n,a,r,i,o,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(a);for(let p=l;p<=u;p++)for(let l=c;l<=d;l++)if(r.call(this,e,t,n,a,this.xCellCount*l+p,i,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,a,r,i){const o=a-e,s=r-t,l=n+i;return l*l>o*o+s*s}_circleAndRectCollide(e,t,n,a,r,i,o){const s=(i-a)/2,l=Math.abs(e-(a+s));if(l>s+n)return!1;const c=(o-r)/2,u=Math.abs(t-(r+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;const d=l-s,p=u-c;return d*d+p*p<=n*n}}function ie(t,n,a,r,i){const o=e.create();return n?(e.scale(o,o,[1/i,1/i,1]),a||e.rotateZ(o,o,r.angle)):e.multiply(o,r.labelPlaneMatrix,t),o}function oe(t,n,a,r,i){if(n){const n=e.clone(t);return e.scale(n,n,[i,i,1]),a||e.rotateZ(n,n,-r.angle),n}return r.glCoordMatrix}function se(t,n,a){let r;a?(r=[t.x,t.y,a(t.x,t.y),1],e.transformMat4(r,r,n)):(r=[t.x,t.y,0,1],_e(r,r,n));const i=r[3];return{point:new e.pointGeometry(r[0]/i,r[1]/i),signedDistanceFromCamera:i}}function le(e,t){return.5+e/t*.5}function ce(e,t){const n=e[0]/e[3],a=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function ue(t,n,a,r,i,o,s,l,c,u){const d=r?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,a.transform.zoom),m=[256/a.width*2+1,256/a.height*2+1],b=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;b.clear();const h=t.lineVertexArray,f=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=a.transform.width/a.transform.height;let _=!1;for(let r=0;r<f.length;r++){const y=f.get(r);if(y.hidden||y.writingMode===e.WritingMode.vertical&&!_){ge(y.numGlyphs,b);continue}let M;if(_=!1,u?(M=[y.anchorX,y.anchorY,u(y.anchorX,y.anchorY),1],e.transformMat4(M,M,n)):(M=[y.anchorX,y.anchorY,0,1],_e(M,M,n)),!ce(M,m)){ge(y.numGlyphs,b);continue}const v=le(a.transform.cameraToCenterDistance,M[3]),z=e.evaluateSizeForFeature(d,p,y),O=s?z/v:z*v,k=new e.pointGeometry(y.anchorX,y.anchorY),A=se(k,i,u).point,x={},w=me(y,O,!1,l,n,i,o,t.glyphOffsetArray,h,b,A,k,x,g,c,u);_=w.useVertical,(w.notEnoughRoom||_||w.needsFlipping&&me(y,O,!0,l,n,i,o,t.glyphOffsetArray,h,b,A,k,x,g,c,u).notEnoughRoom)&&ge(y.numGlyphs,b)}r?t.text.dynamicLayoutVertexBuffer.updateData(b):t.icon.dynamicLayoutVertexBuffer.updateData(b)}function de(e,t,n,a,r,i,o,s,l,c,u,d,p){const m=s.glyphStartIndex+s.numGlyphs,b=s.lineStartIndex,h=s.lineStartIndex+s.lineLength,f=t.getoffsetX(s.glyphStartIndex),g=t.getoffsetX(m-1),_=he(e*f,n,a,r,i,o,s.segment,b,h,l,c,u,d,p);if(!_)return null;const y=he(e*g,n,a,r,i,o,s.segment,b,h,l,c,u,d,p);return y?{first:_,last:y}:null}function pe(t,n,a,r){return t===e.WritingMode.horizontal&&Math.abs(a.y-n.y)>Math.abs(a.x-n.x)*r?{useVertical:!0}:(t===e.WritingMode.vertical?n.y<a.y:n.x>a.x)?{needsFlipping:!0}:null}function me(t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f){const g=n/24,_=t.lineOffsetX*g,y=t.lineOffsetY*g;let M;if(t.numGlyphs>1){const e=t.glyphStartIndex+t.numGlyphs,n=t.lineStartIndex,i=t.lineStartIndex+t.lineLength,u=de(g,l,_,y,a,d,p,t,c,o,m,h,f);if(!u)return{notEnoughRoom:!0};const v=se(u.first.point,s,f).point,z=se(u.last.point,s,f).point;if(r&&!a){const e=pe(t.writingMode,v,z,b);if(e)return e}M=[u.first];for(let r=t.glyphStartIndex+1;r<e-1;r++)M.push(he(g*l.getoffsetX(r),_,y,a,d,p,t.segment,n,i,c,o,m,h,f));M.push(u.last)}else{if(r&&!a){const n=se(p,i,f).point,a=t.lineStartIndex+t.segment+1,r=new e.pointGeometry(c.getx(a),c.gety(a)),o=se(r,i,f),s=o.signedDistanceFromCamera>0?o.point:be(p,r,n,1,i,f),l=pe(t.writingMode,n,s,b);if(l)return l}const n=he(g*l.getoffsetX(t.glyphStartIndex),_,y,a,d,p,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,c,o,m,h,f);if(!n)return{notEnoughRoom:!0};M=[n]}for(const t of M)e.addDynamicAttributes(u,t.point,t.angle);return{}}function be(e,t,n,a,r,i){const o=se(e.add(e.sub(t)._unit()),r,i).point,s=n.sub(o);return n.add(s._mult(a/s.mag()))}function he(t,n,a,r,i,o,s,l,c,u,d,p,m,b){const h=r?t-n:t+n;let f=h>0?1:-1,g=0;r&&(f*=-1,g=Math.PI),f<0&&(g+=Math.PI);let _=f>0?l+s:l+s+1,y=i,M=i,v=0,z=0;const O=Math.abs(h),k=[];for(;v+z<=O;){if(_+=f,_<l||_>=c)return null;if(M=y,k.push(y),y=p[_],void 0===y){const t=new e.pointGeometry(u.getx(_),u.gety(_)),n=se(t,d,b);if(n.signedDistanceFromCamera>0)y=p[_]=n.point;else{const n=_-f;y=be(0===v?o:new e.pointGeometry(u.getx(n),u.gety(n)),t,M,O-v+1,d,b)}}v+=z,z=M.dist(y)}const A=(O-v)/z,x=y.sub(M),w=x.mult(A)._add(M);w._add(x._unit()._perp()._mult(a*f));const N=g+Math.atan2(y.y-M.y,y.x-M.x);return k.push(w),{point:w,angle:m?N:0,path:k}}const fe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ge(e,t){for(let n=0;n<e;n++){const e=t.length;t.resize(e+4),t.float32.set(fe,3*e)}}function _e(e,t,n){const a=t[0],r=t[1];return e[0]=n[0]*a+n[4]*r+n[12],e[1]=n[1]*a+n[5]*r+n[13],e[3]=n[3]*a+n[7]*r+n[15],e}const ye=100;class Me{constructor(e,t=new re(e.width+200,e.height+200,25),n=new re(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+ye,this.screenBottomBoundary=e.height+ye,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,a,r,i){const o=this.projectAndGetPerspectiveRatio(a,e.anchorPointX,e.anchorPointY,i),s=n*o.perspectiveRatio,l=e.x1*s+o.point.x,c=e.y1*s+o.point.y,u=e.x2*s+o.point.x,d=e.y2*s+o.point.y;return!this.isInsideGrid(l,c,u,d)||"always"!==t&&this.grid.hitTest(l,c,u,d,t,r)||o.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,u,d],offscreen:this.isOffscreen(l,c,u,d)}}placeCollisionCircles(t,n,a,r,i,o,s,l,c,u,d,p,m,b){const h=[],f=new e.pointGeometry(n.anchorX,n.anchorY),g=se(f,o,b),_=le(this.transform.cameraToCenterDistance,g.signedDistanceFromCamera),y=(u?i/_:i*_)/e.ONE_EM,M=se(f,s,b).point,v=de(y,r,n.lineOffsetX*y,n.lineOffsetY*y,!1,M,f,n,a,s,{},!1,b);let z=!1,O=!1,k=!0;if(v){const n=.5*p*_+m,a=new e.pointGeometry(-100,-100),r=new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),i=new ne,o=v.first,s=v.last;let u=[];for(let e=o.path.length-1;e>=1;e--)u.push(o.path[e]);for(let e=1;e<s.path.length;e++)u.push(s.path[e]);const f=2.5*n;if(l){const e=u.map(e=>se(e,l,b));u=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(u.length>0){const t=u[0].clone(),n=u[0].clone();for(let e=1;e<u.length;e++)t.x=Math.min(t.x,u[e].x),t.y=Math.min(t.y,u[e].y),n.x=Math.max(n.x,u[e].x),n.y=Math.max(n.y,u[e].y);g=t.x>=a.x&&n.x<=r.x&&t.y>=a.y&&n.y<=r.y?[u]:n.x<a.x||t.x>r.x||n.y<a.y||t.y>r.y?[]:e.clipLine([u],a.x,a.y,r.x,r.y)}for(const e of g){i.reset(e,.25*n);let a=0;a=i.length<=.5*n?1:Math.ceil(i.paddedLength/f)+1;for(let e=0;e<a;e++){const r=e/Math.max(a-1,1),o=i.lerp(r),s=o.x+ye,l=o.y+ye;h.push(s,l,n,0);const u=s-n,p=l-n,m=s+n,b=l+n;if(k=k&&this.isOffscreen(u,p,m,b),O=O||this.isInsideGrid(u,p,m,b),"always"!==t&&this.grid.hitTestCircle(s,l,n,t,d)&&(z=!0,!c))return{circles:[],offscreen:!1,collisionDetected:z}}}}return{circles:!c&&z||!O||_<this.perspectiveRatioCutoff?[]:h,offscreen:k,collisionDetected:z}}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const n=[];let a=1/0,r=1/0,i=-1/0,o=-1/0;for(const s of t){const t=new e.pointGeometry(s.x+ye,s.y+ye);a=Math.min(a,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y),n.push(t)}const s=this.grid.query(a,r,i,o).concat(this.ignoredGrid.query(a,r,i,o)),l={},c={};for(const t of s){const a=t.key;if(void 0===l[a.bucketInstanceId]&&(l[a.bucketInstanceId]={}),l[a.bucketInstanceId][a.featureIndex])continue;const r=[new e.pointGeometry(t.x1,t.y1),new e.pointGeometry(t.x2,t.y1),new e.pointGeometry(t.x2,t.y2),new e.pointGeometry(t.x1,t.y2)];e.polygonIntersectsPolygon(n,r)&&(l[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(e,t,n,a,r,i){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:r,collisionGroupID:i,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,a,r,i){const o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:a,featureIndex:r,collisionGroupID:i,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(t,n,a,r){let i;return r?(i=[n,a,r(n,a),1],e.transformMat4(i,i,t)):(i=[n,a,0,1],_e(i,i,t)),{point:new e.pointGeometry((i[0]/i[3]+1)/2*this.transform.width+ye,(-i[1]/i[3]+1)/2*this.transform.height+ye),perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5}}isOffscreen(e,t,n,a){return n<ye||e>=this.screenRightBoundary||a<ye||t>this.screenBottomBoundary}isInsideGrid(e,t,n,a){return n>=0&&e<this.gridRightBoundary&&a>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.identity([]);return e.translate(t,t,[-100,-100,0]),t}}function ve(t,n,a){return n*(e.EXTENT/(t.tileSize*Math.pow(2,a-t.tileID.overscaledZ)))}class ze{constructor(e,t,n,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):a&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class Oe{constructor(e,t,n,a,r){this.text=new ze(e?e.text:null,t,n,r),this.icon=new ze(e?e.icon:null,t,a,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ke{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class Ae{constructor(){this.invProjMatrix=e.create(),this.viewportMatrix=e.create(),this.circles=[]}}class xe{constructor(e,t,n,a,r){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=a,this.tileID=r}}class we{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function Ne(t,n,a,r,i){const{horizontalAlign:o,verticalAlign:s}=e.getAnchorAlignment(t),l=-(o-.5)*n,c=-(s-.5)*a,u=e.evaluateVariableOffset(t,r);return new e.pointGeometry(l+u[0]*i,c+u[1]*i)}function qe(t,n,a,r,i,o){const{x1:s,x2:l,y1:c,y2:u,anchorPointX:d,anchorPointY:p}=t,m=new e.pointGeometry(n,a);return r&&m._rotate(i?o:-o),{x1:s+m.x,y1:c+m.y,x2:l+m.x,y2:u+m.y,anchorPointX:d,anchorPointY:p}}class Ee{constructor(e,t,n,a,r){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Me(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new we(a),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,r){const i=a.getBucket(n),o=a.latestFeatureIndex;if(!i||!o||n.id!==i.layerIds[0])return;const s=a.collisionBoxArray,l=i.layers[0].layout,c=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),u=a.tileSize/e.EXTENT,d=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),m="map"===l.get("text-rotation-alignment"),b=ve(a,1,this.transform.zoom),h=ie(d,p,m,this.transform,b);let f=null;if(p){const t=oe(d,p,m,this.transform,b);f=e.multiply([],this.transform.labelPlaneMatrix,t)}this.retainedQueryData[i.bucketInstanceId]=new xe(i.bucketInstanceId,o,i.sourceLayerIndex,i.index,a.tileID);const g={bucket:i,layout:l,posMatrix:d,textLabelPlaneMatrix:h,labelToScreenMatrix:f,scale:c,textPixelRatio:u,holdingForFade:a.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(i.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(i.sourceID)};if(r)for(const e of i.sortKeyRanges){const{sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:r}=e;t.push({sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:r,parameters:g})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:i.symbolInstances.length,parameters:g})}attemptAnchorPlacement(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h){const f=[d.textOffset0,d.textOffset1],g=Ne(e,n,a,f,r),_=this.collisionIndex.placeCollisionBox(qe(t,g.x,g.y,i,o,this.transform.angle),u,s,l,c.predicate,h);if((!b||0!==this.collisionIndex.placeCollisionBox(qe(b,g.x,g.y,i,o,this.transform.angle),u,s,l,c.predicate,h).box.length)&&_.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:f,width:n,height:a,anchor:e,textBoxScale:r,prevAnchor:t},this.markUsedJustification(p,e,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[d.crossTileID]=m),{shift:g,placedGlyphBoxes:_}}}placeLayerBucketPart(t,n,a){const{bucket:r,layout:i,posMatrix:o,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:m}=t.parameters,b=i.get("text-optional"),h=i.get("icon-optional"),f=e.getOverlapMode(i,"text-overlap","text-allow-overlap"),g="always"===f,_=e.getOverlapMode(i,"icon-overlap","icon-allow-overlap"),y="always"===_,M="map"===i.get("text-rotation-alignment"),v="map"===i.get("text-pitch-alignment"),z="none"!==i.get("icon-text-fit"),O="viewport-y"===i.get("symbol-z-order"),k=g&&(y||!r.hasIconData()||h),A=y&&(g||!r.hasTextData()||b);!r.collisionArrays&&d&&r.deserializeCollisionBoxes(d);const x=(t,d)=>{if(n[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new ke(!1,!1,!1));let y=!1,O=!1,x=!0,w=null,N={box:null,offscreen:null},q={box:null,offscreen:null},E=null,j=null,W=null,L=0,S=0,T=0;d.textFeatureIndex?L=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(L=t.featureIndex),d.verticalTextFeatureIndex&&(S=d.verticalTextFeatureIndex);const C=this.retainedQueryData[r.bucketInstanceId].tileID,R=this.terrain?(e,t)=>this.terrain.getElevation(C,e,t):null;for(const e of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const t=d[e];t&&(t.elevation=R?R(t.anchorPointX,t.anchorPointY):0)}const D=d.textBox;if(D){const n=n=>{let a=e.WritingMode.horizontal;if(r.allowVerticalPlacement&&!n&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,a=e,this.markUsedOrientation(r,a,t))}return a},a=(n,a)=>{if(r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of r.writingModes)if(t===e.WritingMode.vertical?(N=a(),q=N):N=n(),N&&N.box&&N.box.length)break}else N=n()};if(i.get("text-variable-anchor")){let s=i.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[t.crossTileID]){const e=this.prevPlacement.variableOffsets[t.crossTileID];s.indexOf(e.anchor)>0&&(s=s.filter(t=>t!==e.anchor),s.unshift(e.anchor))}const l=(e,n,a)=>{const i=e.x2-e.x1,l=e.y2-e.y1,u=t.textBoxScale,d=z&&"never"===_?n:null;let p={box:[],offscreen:!1};const b="never"!==f?2*s.length:s.length;for(let n=0;n<b;++n){const b=this.attemptAnchorPlacement(s[n%s.length],e,i,l,u,M,v,c,o,m,n>=s.length?f:"never",t,r,a,d,R);if(b&&(p=b.placedGlyphBoxes,p&&p.box&&p.box.length)){y=!0,w=b.shift;break}}return p};a(()=>l(D,d.iconBox,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return r.allowVerticalPlacement&&!(N&&N.box&&N.box.length)&&t.numVerticalGlyphVertices>0&&n?l(n,d.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null}}),N&&(y=N.box,x=N.offscreen);const u=n(N&&N.box);if(!y&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(r,e.anchor,t,u))}}else{const i=(e,n)=>{const a=this.collisionIndex.placeCollisionBox(e,f,c,o,m.predicate,R);return a&&a.box&&a.box.length&&(this.markUsedOrientation(r,n,t),this.placedOrientations[t.crossTileID]=n),a};a(()=>i(D,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&n?i(n,e.WritingMode.vertical):{box:null,offscreen:null}}),n(N&&N.box&&N.box.length)}}if(E=N,y=E&&E.box&&E.box.length>0,x=E&&E.offscreen,t.useRuntimeCollisionCircles){const n=r.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),c=e.evaluateSizeForFeature(r.textSizeData,p,n),u=i.get("text-padding");j=this.collisionIndex.placeCollisionCircles(f,n,r.lineVertexArray,r.glyphOffsetArray,c,o,s,l,a,v,m.predicate,t.collisionCircleDiameter,u,R),j.circles.length&&j.collisionDetected&&!a&&e.warnOnce("Collisions detected, but collision boxes are not shown"),y=g||j.circles.length>0&&!j.collisionDetected,x=x&&j.offscreen}if(d.iconFeatureIndex&&(T=d.iconFeatureIndex),d.iconBox){const e=e=>{const t=z&&w?qe(e,w.x,w.y,M,v,this.transform.angle):e;return this.collisionIndex.placeCollisionBox(t,_,c,o,m.predicate,R)};q&&q.box&&q.box.length&&d.verticalIconBox?(W=e(d.verticalIconBox),O=W.box.length>0):(W=e(d.iconBox),O=W.box.length>0),x=x&&W.offscreen}const P=b||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,B=h||0===t.numIconVertices;if(P||B?B?P||(O=O&&y):y=O&&y:O=y=O&&y,y&&E&&E.box&&this.collisionIndex.insertCollisionBox(E.box,f,i.get("text-ignore-placement"),r.bucketInstanceId,q&&q.box&&S?S:L,m.ID),O&&W&&this.collisionIndex.insertCollisionBox(W.box,_,i.get("icon-ignore-placement"),r.bucketInstanceId,T,m.ID),j&&(y&&this.collisionIndex.insertCollisionCircles(j.circles,f,i.get("text-ignore-placement"),r.bucketInstanceId,L,m.ID),a)){const e=r.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Ae);for(let e=0;e<j.circles.length;e+=4)t.circles.push(j.circles[e+0]),t.circles.push(j.circles[e+1]),t.circles.push(j.circles[e+2]),t.circles.push(j.collisionDetected?1:0)}if(0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===r.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new ke(y||k,O||A,x||r.justReloaded),n[t.crossTileID]=!0};if(O){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=r.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const n=e[t];x(r.symbolInstances.get(n),r.collisionArrays[n])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)x(r.symbolInstances.get(e),r.collisionArrays[e]);if(a&&r.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[r.bucketInstanceId];e.invert(t.invProjMatrix,o),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}r.justReloaded=!1}markUsedJustification(t,n,a,r){let i;i=r===e.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[e.getAnchorJustification(n)];const o=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const e of o)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=i>=0&&e!==i?0:a.crossTileID)}markUsedOrientation(t,n,a){const r=n===e.WritingMode.horizontal||n===e.WritingMode.horizontalOnly?n:0,i=n===e.WritingMode.vertical?n:0,o=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=r;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=i)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const a=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},i=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],i=r[e];i?(this.opacities[e]=new Oe(i,a,t.text,t.icon),n=n||t.text!==i.text.placed||t.icon!==i.icon.placed):(this.opacities[e]=new Oe(null,a,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(const e in r){const t=r[e];if(!this.opacities[e]){const r=new Oe(t,a,!1,!1);r.isHidden()||(this.opacities[e]=r,n=n||t.text.placed||t.icon.placed)}}for(const e in i)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=i[e]);for(const e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const n={};for(const a of t){const t=a.getBucket(e);t&&a.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n,a.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0].layout,i=new Oe(null,0,!1,!1,!0),o=r.get("text-allow-overlap"),s=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),c="map"===r.get("text-rotation-alignment"),u="map"===r.get("text-pitch-alignment"),d="none"!==r.get("icon-text-fit"),p=new Oe(null,0,o&&(s||!t.hasIconData()||r.get("icon-optional")),s&&(o||!t.hasTextData()||r.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const m=(e,t,n)=>{for(let a=0;a<t/4;a++)e.opacityVertexArray.emplaceBack(n)};for(let a=0;a<t.symbolInstances.length;a++){const r=t.symbolInstances.get(a),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:b}=r;let h=this.opacities[b];n[b]?h=i:h||(h=p,this.opacities[b]=h),n[b]=!0;const f=r.numIconVertices>0,g=this.placedOrientations[r.crossTileID],_=g===e.WritingMode.vertical,y=g===e.WritingMode.horizontal||g===e.WritingMode.horizontalOnly;if(o>0||s>0){const e=Pe(h.text);m(t.text,o,_?Be:e),m(t.text,s,y?Be:e);const n=h.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=n||_?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=n||y?1:0);const a=this.variableOffsets[r.crossTileID];a&&this.markUsedJustification(t,a.anchor,r,g);const i=this.placedOrientations[r.crossTileID];i&&(this.markUsedJustification(t,"left",r,i),this.markUsedOrientation(t,i,r))}if(f){const e=Pe(h.icon),n=!(d&&r.verticalPlacedIconSymbolIndex&&_);r.placedIconSymbolIndex>=0&&(m(t.icon,r.numIconVertices,n?e:Be),t.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=h.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,r.numVerticalIconVertices,n?Be:e),t.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const n=t.collisionArrays[a];if(n){let a=new e.pointGeometry(0,0);if(n.textBox||n.verticalTextBox){let e=!0;if(l){const t=this.variableOffsets[b];t?(a=Ne(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),c&&a._rotate(u?this.transform.angle:-this.transform.angle)):e=!1}n.textBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||_,a.x,a.y),n.verticalTextBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||y,a.x,a.y)}const r=Boolean(!y&&n.verticalIconBox);n.iconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,r,d?a.x:0,d?a.y:0),n.verticalIconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,!r,d?a.x:0,d?a.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function je(e,t,n,a,r){e.emplaceBack(t?1:0,n?1:0,a||0,r||0),e.emplaceBack(t?1:0,n?1:0,a||0,r||0),e.emplaceBack(t?1:0,n?1:0,a||0,r||0),e.emplaceBack(t?1:0,n?1:0,a||0,r||0)}const We=Math.pow(2,25),Le=Math.pow(2,24),Se=Math.pow(2,17),Te=Math.pow(2,16),Ce=Math.pow(2,9),Re=Math.pow(2,8),De=Math.pow(2,1);function Pe(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,n=Math.floor(127*e.opacity);return n*We+t*Le+n*Se+t*Te+n*Ce+t*Re+n*De+t}const Be=0;class Ie{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,a,r){const i=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(i,a,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,i.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<i.length;)if(t.placeLayerBucketPart(i[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,r())return!0;return!1}}class $e{constructor(e,t,n,a,r,i,o,s){this.placement=new Ee(e,t,i,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const r=e.exported.now(),i=()=>{const t=e.exported.now()-r;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=n[t[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=r)&&(!e.maxzoom||e.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Ie(e)),this._inProgressLayer.continuePlacement(a[e.source],this.placement,this._showCollisionBoxes,e,i))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Fe=512/e.EXTENT/2;class Xe{constructor(e,t,n){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;n<t.length;n++){const a=t.get(n),r=a.key;this.indexedSymbolInstances[r]||(this.indexedSymbolInstances[r]=[]),this.indexedSymbolInstances[r].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,e)})}}getScaledCoordinates(t,n){const a=Fe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*e.EXTENT+t.anchorX)*a),y:Math.floor((n.canonical.y*e.EXTENT+t.anchorY)*a)}}findMatches(e,t,n){const a=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let r=0;r<e.length;r++){const i=e.get(r);if(i.crossTileID)continue;const o=this.indexedSymbolInstances[i.key];if(!o)continue;const s=this.getScaledCoordinates(i,t);for(const e of o)if(Math.abs(e.coord.x-s.x)<=a&&Math.abs(e.coord.y-s.y)<=a&&!n[e.crossTileID]){n[e.crossTileID]=!0,i.crossTileID=e.crossTileID;break}}}}class Ye{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class He{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const n=this.indexes[e],a={};for(const e in n){const r=n[e];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),a[r.tileID.key]=r}this.indexes[e]=a}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const a=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const r=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in r){const i=r[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,a)}else{const i=r[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,a)}}for(let e=0;e<t.symbolInstances.length;e++){const r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=n.generate(),a[r.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Xe(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const n in t.indexedSymbolInstances)for(const a of t.indexedSymbolInstances[n])delete this.usedCrossTileIDs[e][a.crossTileID]}removeStaleBuckets(e){let t=!1;for(const n in this.indexes){const a=this.indexes[n];for(const r in a)e[a[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,a[r]),delete a[r],t=!0)}return t}}class Ue{constructor(){this.layerIndexes={},this.crossTileIDs=new Ye,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let a=this.layerIndexes[e.id];void 0===a&&(a=this.layerIndexes[e.id]=new He);let r=!1;const i={};a.handleWrapJump(n);for(const n of t){const t=n.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(n.tileID,t,this.crossTileIDs)&&(r=!0),i[t.bucketInstanceId]=!0)}return a.removeStaleBuckets(i)&&(r=!0),r}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Ve=e.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ge extends e.Evented{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=e._cache.max,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const e in this._tiles){const t=this._tiles[e];t.textures.forEach(e=>e.destroy()),t.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),e.ortho(a.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),this._tiles[a.key]=new T(a,this.tileSize))}removeOutdated(e){const t={};this.renderHistory=this.renderHistory.filter((e,t)=>this.renderHistory.indexOf(e)===t).slice(0,this.renderHistorySize);for(const e of this._renderableTilesKeys)t[e]=!0;for(const e of this.renderHistory)t[e]=!0;for(const n in this._tiles)t[n]||(this._tiles[n].clearTextures(e),delete this._tiles[n])}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const r=this._tiles[a].tileID;if(r.canonical.equals(t.canonical)){const r=t.clone();r.posMatrix=new Float64Array(16),e.ortho(r.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),n[a]=r}else if(r.canonical.isChildOf(t.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=r.canonical.z-t.canonical.z,s=r.canonical.x-(r.canonical.x>>o<<o),l=r.canonical.y-(r.canonical.y>>o<<o),c=e.EXTENT>>o;e.ortho(i.posMatrix,0,c,0,c,0,1),e.translate(i.posMatrix,i.posMatrix,[-s*c,-l*c,0]),n[a]=i}else if(t.canonical.isChildOf(r.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=t.canonical.z-r.canonical.z,s=t.canonical.x-(t.canonical.x>>o<<o),l=t.canonical.y-(t.canonical.y>>o<<o),c=e.EXTENT>>o;e.ortho(i.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),e.translate(i.posMatrix,i.posMatrix,[s*c,l*c,0]),e.scale(i.posMatrix,i.posMatrix,[1/2**o,1/2**o,0]),n[a]=i}}return n}getSourceTile(e,t){const n=this.sourceCache._source;let a=e.overscaledZ-this.deltaZoom;if(a>n.maxzoom&&(a=n.maxzoom),a<n.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(a).key);let r=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!r||!r.dem)&&t)for(;a>=n.minzoom&&(!r||!r.dem);)r=this.sourceCache.getTileByID(e.scaledTo(a--).key);return r}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(t=>t.timeLoaded>=e)}}class Ke{constructor(e,t,n){this.style=e,this.sourceCache=new Ge(t),this.options=n,this.exaggeration="number"==typeof n.exaggeration?n.exaggeration:1,this.elevationOffset="number"==typeof n.elevationOffset?n.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,a,r=e.EXTENT){if(!(n>=0&&n<r&&a>=0&&a<r))return this.elevationOffset;let i=0;const o=this.getTerrainData(t);if(o.tile&&o.tile.dem){const t=e.transformMat4$1([],[n/r*e.EXTENT,a/r*e.EXTENT],o.u_terrain_matrix),s=[t[0]*o.tile.dem.dim,t[1]*o.tile.dem.dim],l=[Math.floor(s[0]),Math.floor(s[1])],c=o.tile.dem.get(l[0],l[1]),u=o.tile.dem.get(l[0],l[1]+1),d=o.tile.dem.get(l[0]+1,l[1]),p=o.tile.dem.get(l[0]+1,l[1]+1);i=e.number(e.number(c,u,s[0]-l[0]),e.number(d,p,s[0]-l[0]),s[1]-l[1])}return i}rememberForRerender(e,t){for(const n in this.sourceCache._tiles){const a=this.sourceCache._tiles[n];(a.tileID.equals(t)||a.tileID.isChildOf(t))&&(e===this.sourceCache.sourceCache.id&&(a.timeLoaded=Date.now()),this._rerender[e]=this._rerender[e]||{},this._rerender[e][a.tileID.key]=!0)}}needsRerender(e,t){return this._rerender[e]&&this._rerender[e][t.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,a,r=e.EXTENT){return(this.getDEMElevation(t,n,a,r)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.style.map.painter.context,n=new e.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new l(t,n,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new l(t,new e.RGBAImage({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const e=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new l(e,n.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),n.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const a=this.sourceCache.sourceCache._source.maxzoom;let r=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?r=t.canonical.z-a:e.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const i=t.canonical.x-(t.canonical.x>>r<<r),o=t.canonical.y-(t.canonical.y>>r<<r),s=e.fromScaling(new Float64Array(16),[1/(e.EXTENT<<r),1/(e.EXTENT<<r),0]);e.translate(s,s,[i*e.EXTENT,o*e.EXTENT,0]),this._demMatrixCache[t.key]={matrix:s,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const e=this.style.map.painter;if(!this._rttFramebuffer){const t=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=e.context.createFramebuffer(t,t,!0),this._rttFramebuffer.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,t))}return this._rttFramebuffer}getFramebuffer(e){const t=this.style.map.painter,n=t.width/devicePixelRatio,a=t.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new l(t.context,{width:n,height:a,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new l(t.context,{width:n,height:a,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(n,a,!0),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,a))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let a=0;a<this._coordsTextureSize;a++,t+=4)n[t+0]=255&a,n[t+1]=255&e,n[t+2]=a>>8<<4|e>>8,n[t+3]=0;const a=new e.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),r=new l(t,a,t.gl.RGBA,{premultiply:!1});return r.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(t){const n=new Uint8Array(4),a=this.style.map.painter,r=a.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(t.x,a.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,n),r.bindFramebuffer.set(null);const o=n[0]+(n[2]>>4<<8),s=n[1]+((15&n[2])<<8),l=this.coordsIndex[255-n[3]],c=l&&this.sourceCache.getTileByID(l);if(!c)return null;const u=this._coordsTextureSize,d=(1<<c.tileID.canonical.z)*u;return new e.MercatorCoordinate((c.tileID.canonical.x*u+o)/d,(c.tileID.canonical.y*u+s)/d,this.getElevation(c.tileID,o,s,u))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new e.PosArray,a=new e.TriangleIndexArray,r=this.meshSize,i=e.EXTENT/r,o=r*r;for(let e=0;e<=r;e++)for(let t=0;t<=r;t++)n.emplaceBack(t*i,e*i);for(let e=0;e<o;e+=r+1)for(let t=0;t<r;t++)a.emplaceBack(t+e,r+t+e+1,r+t+e+2),a.emplaceBack(t+e,r+t+e+2,t+e+1);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,Ve.members),segments:e.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return t&&t.dem&&(n.minElevation=(t.dem.min+this.elevationOffset)*this.exaggeration,n.maxElevation=(t.dem.max+this.elevationOffset)*this.exaggeration),n}}const Je=(t,n)=>e.emitValidationErrors(t,n&&n.filter(e=>"source.canvas"!==e.identifier)),Ze=e.pick(V,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qe=e.pick(V,["setCenter","setZoom","setBearing","setPitch"]),et=function(){const t={},n=e.spec.$version;for(const a in e.spec.$root){const r=e.spec.$root[a];if(r.required){let e=null;e="version"===a?n:"array"===r.type?[]:{},null!=e&&(t[a]=e)}}return t}();class tt extends e.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new y(Y(),this),this.imageManager=new u,this.imageManager.setEventedParent(this),this.glyphManager=new b(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new _(256,512),this.crossTileSymbolIndex=new Ue,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",e.getReferrer());const a=this;this._rtlTextPluginCallback=tt.registerForPluginStateChange(t=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,n)=>{if(e.triggerPluginCompletionEvent(t),n&&n.every(e=>e))for(const e in a.sourceCaches)a.sourceCaches[e].reload()})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.sourceCaches[e.sourceId];if(!t)return;const n=t.getSource();if(n&&n.vectorLayerIds)for(const e in this._layers){const t=this._layers[e];t.source===n.id&&this._validateLayer(t)}})}loadURL(t,n={}){this.fire(new e.Event("dataloading",{dataType:"style"}));const a="boolean"!=typeof n.validate||n.validate,r=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(r,(t,n)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):n&&this._load(n,a)})}loadJSON(t,n={}){this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame(()=>{this._request=null,this._load(t,!1!==n.validate)})}loadEmpty(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(et,!1)}_load(t,n){if(n&&Je(this,e.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const a=U(this.stylesheet.layers);this._order=a.map(e=>e.id),this._layers={},this._serializedLayers={};for(let t of a)t=e.createStyleLayer(t),t.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=t,this._serializedLayers[t.id]=t.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new g(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(t,n,a,r){let i,o,s;const l=a>1?"@2x":"";let c=e.getJSON(n.transformRequest(n.normalizeSpriteURL(t,l,".json"),e.ResourceType.SpriteJSON),(e,t)=>{c=null,s||(s=e,i=t,d())}),u=e.getImage(n.transformRequest(n.normalizeSpriteURL(t,l,".png"),e.ResourceType.SpriteImage),(e,t)=>{u=null,s||(s=e,o=t,d())});function d(){if(s)r(s);else if(i&&o){const t=e.exported.getImageData(o),n={};for(const a in i){const{width:r,height:o,x:s,y:l,sdf:c,pixelRatio:u,stretchX:d,stretchY:p,content:m}=i[a],b=new e.RGBAImage({width:r,height:o});e.RGBAImage.copy(t,b,{x:s,y:l},{x:0,y:0},{width:r,height:o}),n[a]={data:b,pixelRatio:u,sdf:c,stretchX:d,stretchY:p,content:m}}r(null,n)}}return{cancel(){c&&(c.cancel(),c=null),u&&(u.cancel(),u=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(t,n)=>{if(this._spriteRequest=null,t)this.fire(new e.ErrorEvent(t));else if(n)for(const e in n)this.imageManager.addImage(e,n[e]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const r=n.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(a))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){const t=[];for(const n of e){const e=this._layers[n];"custom"!==e.type&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(e.length||n.length)&&this._updateWorkerLayers(e,n);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error("Invalid action "+t);this._clearSource(e)}}this._updateTilesForChangedImages();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];a[e]=t.used,t.used=!1}for(const e of this._order){const n=this._layers[e];n.recalculate(t,this._availableImages),!n.isHidden(t.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(const t in a){const n=this.sourceCaches[t];a[t]!==n.used&&n.fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new e.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const e=this.sourceCaches[t.source];if(!e)throw new Error("cannot load terrain, because there exists no source with ID: "+t.source);this.terrain=new Ke(this,e,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=e=>{e.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=e=>{e.tile&&(e.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(e.sourceId,e.tile.tileID)):"geojson"===e.source.type&&this.terrain.rememberForRerender(e.sourceId,e.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new e.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),Je(this,e.validateStyle(t)))return!1;(t=e.clone$1(t)).layers=U(t.layers);const n=function(e,t){if(!e)return[{command:V.setStyle,args:[t]}];let n=[];try{if(!r(e.version,t.version))return[{command:V.setStyle,args:[t]}];r(e.center,t.center)||n.push({command:V.setCenter,args:[t.center]}),r(e.zoom,t.zoom)||n.push({command:V.setZoom,args:[t.zoom]}),r(e.bearing,t.bearing)||n.push({command:V.setBearing,args:[t.bearing]}),r(e.pitch,t.pitch)||n.push({command:V.setPitch,args:[t.pitch]}),r(e.sprite,t.sprite)||n.push({command:V.setSprite,args:[t.sprite]}),r(e.glyphs,t.glyphs)||n.push({command:V.setGlyphs,args:[t.glyphs]}),r(e.transition,t.transition)||n.push({command:V.setTransition,args:[t.transition]}),r(e.light,t.light)||n.push({command:V.setLight,args:[t.light]});const a={},i=[];!function(e,t,n,a){let i;for(i in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||K(i,n,a));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?r(e[i],t[i])||("geojson"===e[i].type&&"geojson"===t[i].type&&Z(e,t,i)?n.push({command:V.setGeoJSONSourceData,args:[i,t[i].data]}):J(i,t,n,a)):G(i,t,n))}(e.sources,t.sources,i,a);const o=[];e.layers&&e.layers.forEach(e=>{a[e.source]?n.push({command:V.removeLayer,args:[e.id]}):o.push(e)}),n=n.concat(i),function(e,t,n){t=t||[];const a=(e=e||[]).map(ee),i=t.map(ee),o=e.reduce(te,{}),s=t.reduce(te,{}),l=a.slice(),c=Object.create(null);let u,d,p,m,b,h,f;for(u=0,d=0;u<a.length;u++)p=a[u],Object.prototype.hasOwnProperty.call(s,p)?d++:(n.push({command:V.removeLayer,args:[p]}),l.splice(l.indexOf(p,d),1));for(u=0,d=0;u<i.length;u++)p=i[i.length-1-u],l[l.length-1-u]!==p&&(Object.prototype.hasOwnProperty.call(o,p)?(n.push({command:V.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-d),1)):d++,h=l[l.length-u],n.push({command:V.addLayer,args:[s[p],h]}),l.splice(l.length-u,0,p),c[p]=!0);for(u=0;u<i.length;u++)if(p=i[u],m=o[p],b=s[p],!c[p]&&!r(m,b))if(r(m.source,b.source)&&r(m["source-layer"],b["source-layer"])&&r(m.type,b.type)){for(f in Q(m.layout,b.layout,n,p,null,V.setLayoutProperty),Q(m.paint,b.paint,n,p,null,V.setPaintProperty),r(m.filter,b.filter)||n.push({command:V.setFilter,args:[p,b.filter]}),r(m.minzoom,b.minzoom)&&r(m.maxzoom,b.maxzoom)||n.push({command:V.setLayerZoomRange,args:[p,b.minzoom,b.maxzoom]}),m)Object.prototype.hasOwnProperty.call(m,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Q(m[f],b[f],n,p,f.slice(6),V.setPaintProperty):r(m[f],b[f])||n.push({command:V.setLayerProperty,args:[p,f,b[f]]}));for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&!Object.prototype.hasOwnProperty.call(m,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Q(m[f],b[f],n,p,f.slice(6),V.setPaintProperty):r(m[f],b[f])||n.push({command:V.setLayerProperty,args:[p,f,b[f]]}))}else n.push({command:V.removeLayer,args:[p]}),h=l[l.lastIndexOf(p)+1],n.push({command:V.addLayer,args:[b,h]})}(o,t.layers,n)}catch(e){console.warn("Unable to compute style diff:",e),n=[{command:V.setStyle,args:[t]}]}return n}(this.serialize(),t).filter(e=>!(e.command in Qe));if(0===n.length)return!1;const a=n.filter(e=>!(e.command in Ze));if(a.length>0)throw new Error(`Unimplemented: ${a.map(e=>e.command).join(", ")}.`);return n.forEach(e=>{"setTransition"!==e.command&&this[e.command].apply(this,e.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new e.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){if(!this.getImage(t))return this.fire(new e.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(e.validateStyle.source,"sources."+t,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const r=this.sourceCaches[t]=new D(t,n,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:t})),r.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID="+e);const n=this.sourceCaches[e].getSource();if("geojson"!==n.type)throw new Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(t,n,a={}){this._checkLoaded();const r=t.id;if(this.getLayer(r))return void this.fire(new e.ErrorEvent(new Error(`Layer "${r}" already exists on this map.`)));let i;if("custom"===t.type){if(Je(this,e.validateCustomStyleLayer(t)))return;i=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(r,t.source),t=e.clone$1(t),t=e.extend(t,{source:r})),this._validate(e.validateStyle.layer,"layers."+r,t,{arrayIndex:-1},a))return;i=e.createStyleLayer(t),this._validateLayer(i),i.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[i.id]=i.serialize()}const o=n?this._order.indexOf(n):this._order.length;if(n&&-1===o)this.fire(new e.ErrorEvent(new Error(`Cannot add layer "${r}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._layers[r]=i,this._removedLayers[r]&&i.source&&"custom"!==i.type){const e=this._removedLayers[r];delete this._removedLayers[r],e.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const r=n?this._order.indexOf(n):this._order.length;n&&-1===r?this.fire(new e.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(r,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new e.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const r=this.getLayer(t);r?r.minzoom===n&&r.maxzoom===a||(null!=n&&(r.minzoom=n),null!=a&&(r.maxzoom=a),this._updateLayer(r)):this.fire(new e.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const i=this.getLayer(t);if(i){if(!r(i.filter,n))return null==n?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(e.validateStyle.filter,`layers.${i.id}.filter`,n,null,a)||(i.filter=e.clone$1(n),this._updateLayer(i)))}else this.fire(new e.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,i={}){this._checkLoaded();const o=this.getLayer(t);o?r(o.getLayoutProperty(n),a)||(o.setLayoutProperty(n,a,i),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new e.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,i={}){this._checkLoaded();const o=this.getLayer(t);o?r(o.getPaintProperty(n),a)||(o.setPaintProperty(n,a,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new e.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(t,n){this._checkLoaded();const a=t.source,r=t.sourceLayer,i=this.sourceCaches[a];if(void 0===i)return void this.fire(new e.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const o=i.getSource().type;"geojson"===o&&r?this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||r?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),i.setFeatureState(r,t.id,n)):this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,r=this.sourceCaches[a];if(void 0===r)return void this.fire(new e.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const i=r.getSource().type,o="vector"===i?t.sourceLayer:void 0;"vector"!==i||o?n&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(o,t.id,n):this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,r=this.sourceCaches[n];if(void 0!==r)return"vector"!==r.getSource().type||a?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(a,t.id)):void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:e.mapObject(this.sourceCaches,e=>e.serialize()),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,n={},a=[];for(let r=this._order.length-1;r>=0;r--){const i=this._order[r];if(t(i)){n[i]=r;for(const t of e){const e=t[i];if(e)for(const t of e)a.push(t)}}}a.sort((e,t)=>t.intersectionZ-e.intersectionZ);const r=[];for(let i=this._order.length-1;i>=0;i--){const o=this._order[i];if(t(o))for(let e=a.length-1;e>=0;e--){const t=a[e].feature;if(n[t.layer.id]<i)break;r.push(t),a.pop()}else for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t.feature)}}return r}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(e.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const r={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new e.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const t of n.layers){const n=this._layers[t];if(!n)return this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];r[n.source]=!0}}const i=[];n.availableImages=this._availableImages;for(const e in this.sourceCaches)n.layers&&!r[e]||i.push(L(this.sourceCaches[e],this._layers,this._serializedLayers,t,n,a));return this.placement&&i.push(function(e,t,n,a,r,i,o){const s={},l=i.queryRenderedSymbols(a),c=[];for(const e of Object.keys(l).map(Number))c.push(o[e]);c.sort(S);for(const n of c){const a=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,r.filter,r.layers,r.availableImages,e);for(const e in a){const t=s[e]=s[e]||[],r=a[e];r.sort((e,t)=>{const a=n.featureSortOrder;if(a){const n=a.indexOf(e.featureIndex);return a.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(const e of r)t.push(e)}}for(const t in s)s[t].forEach(a=>{const r=a.feature,i=n[e[t].source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i});return s}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(i)}querySourceFeatures(t,n){n&&n.filter&&this._validate(e.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(e,t){const n=e.getRenderableIds().map(t=>e.getTileByID(t)),a=[],r={};for(let e=0;e<n.length;e++){const i=n[e],o=i.tileID.canonical.key;r[o]||(r[o]=!0,i.querySourceFeatures(a,t))}return a}(a,n):[]}addSourceType(e,t,n){return tt.getSourceType(e)?n(new Error(`A source type called "${e}" already exists.`)):(tt.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let i=!1;for(const e in t)if(!r(t[e],a[e])){i=!0;break}if(!i)return;const o={now:e.exported.now(),transition:e.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(o)}_validate(t,n,a,r,i={}){return(!i||!1!==i.validate)&&Je(this,t.call(e.validateStyle,e.extend({key:n,style:this.serialize(),value:a,styleSpec:e.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this.sourceCaches){const t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const t in this.sourceCaches)this.sourceCaches[t].update(e,this.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(t,n,a,r,i=!1){let o=!1,s=!1;const l={};for(const e of this._order){const n=this._layers[e];if("symbol"!==n.type)continue;if(!l[n.source]){const e=this.sourceCaches[n.source];l[n.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const a=this.crossTileSymbolIndex.addLayer(n,l[n.source],t.center.lng);o=o||a}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((i=i||this._layerOrderChanged||0===a)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new $e(t,this.terrain,this._order,i,n,a,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,n){this.imageManager.getImages(t.icons,n),this._updateTilesForChangedImages();const a=this.sourceCaches[t.source];a&&a.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,n){this.glyphManager.getGlyphs(t.stacks,n)}getResource(t,n,a){return e.makeRequest(n,a)}}tt.getSourceType=function(e){return j[e]},tt.setSourceType=function(e,t){j[e]=t},tt.registerForPluginStateChange=e.registerForPluginStateChange;var nt="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const at={prelude:rt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:rt("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:rt("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:rt("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:rt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:rt("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:rt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:rt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:rt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:rt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:rt("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:rt("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:rt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:rt("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:rt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:rt("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:rt("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:rt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:rt("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:rt("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:rt("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:rt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",nt),terrainDepth:rt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",nt),terrainCoords:rt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",nt)};function rt(e,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=i?i.concat(r):r,s={};return{fragmentSource:e=e.replace(n,(e,t,n,a,r)=>(s[r]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${n} ${a} ${r};\n#else\nuniform ${n} ${a} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${n} ${a} ${r} = u_${r};\n#endif\n`)),vertexSource:t=t.replace(n,(e,t,n,a,r)=>{const i="float"===a?"vec2":"vec4",o=r.match(/color/)?"color":i;return s[r]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${i} a_${r};\nvarying ${n} ${a} ${r};\n#else\nuniform ${n} ${a} u_${r};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${o}(a_${r}, u_${r}_t);\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${i} a_${r};\n#else\nuniform ${n} ${a} u_${r};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${a} ${r} = a_${r};\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${a} ${r} = unpack_mix_${o}(a_${r}, u_${r}_t);\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`}),staticAttributes:a,staticUniforms:o}}class it{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,n,a,r,i,o,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==a.length;for(let e=0;!c&&e<a.length;e++)this.boundPaintVertexBuffers[e]!==a[e]&&(c=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===t&&this.boundLayoutVertexBuffer===n&&!c&&this.boundIndexBuffer===r&&this.boundVertexOffset===i&&this.boundDynamicVertexBuffer===o&&this.boundDynamicVertexBuffer2===s&&this.boundDynamicVertexBuffer3===l?(e.bindVertexArrayOES.set(this.vao),o&&o.bind(),r&&r.dynamicDraw&&r.bind(),s&&s.bind(),l&&l.bind()):this.freshBind(t,n,a,r,i,o,s,l)}freshBind(e,t,n,a,r,i,o,s){let l;const c=e.numAttributes,u=this.context,d=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),l=0,this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=a,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=i,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s;else{l=u.currentNumAttributes||0;for(let e=c;e<l;e++)d.disableVertexAttribArray(e)}t.enableAttributes(d,e);for(const t of n)t.enableAttributes(d,e);i&&i.enableAttributes(d,e),o&&o.enableAttributes(d,e),s&&s.enableAttributes(d,e),t.bind(),t.setVertexAttribPointers(d,e,r);for(const t of n)t.bind(),t.setVertexAttribPointers(d,e,r);i&&(i.bind(),i.setVertexAttribPointers(d,e,r)),a&&a.bind(),o&&(o.bind(),o.setVertexAttribPointers(d,e,r)),s&&(s.bind(),s.setVertexAttribPointers(d,e,r)),u.currentNumAttributes=c}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function ot(e){const t=[];for(let n=0;n<e.length;n++){if(null===e[n])continue;const a=e[n].split(" ");t.push(a.pop())}return t}class st{constructor(t,n,a,r,i,o,s){const l=t.gl;this.program=l.createProgram();const c=ot(a.staticAttributes),u=r?r.getBinderAttributes():[],d=c.concat(u),p=at.prelude.staticUniforms?ot(at.prelude.staticUniforms):[],m=a.staticUniforms?ot(a.staticUniforms):[],b=r?r.getBinderUniforms():[],h=p.concat(m).concat(b),f=[];for(const e of h)f.indexOf(e)<0&&f.push(e);const g=r?r.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),s&&g.push("#define TERRAIN3D;");const _=g.concat(at.prelude.fragmentSource,a.fragmentSource).join("\n"),y=g.concat(at.prelude.vertexSource,a.vertexSource).join("\n"),M=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(M,_),l.compileShader(M),l.attachShader(this.program,M);const v=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(v,y),l.compileShader(v),l.attachShader(this.program,v),this.attributes={};const z={};this.numAttributes=d.length;for(let e=0;e<this.numAttributes;e++)d[e]&&(l.bindAttribLocation(this.program,e,d[e]),this.attributes[d[e]]=e);l.linkProgram(this.program),l.deleteShader(v),l.deleteShader(M);for(let e=0;e<f.length;e++){const t=f[e];if(t&&!z[t]){const e=l.getUniformLocation(this.program,t);e&&(z[t]=e)}}this.fixedUniforms=i(t,z),this.terrainUniforms=((t,n)=>({u_depth:new e.Uniform1i(t,n.u_depth),u_terrain:new e.Uniform1i(t,n.u_terrain),u_terrain_dim:new e.Uniform1f(t,n.u_terrain_dim),u_terrain_matrix:new e.UniformMatrix4f(t,n.u_terrain_matrix),u_terrain_unpack:new e.Uniform4f(t,n.u_terrain_unpack),u_terrain_offset:new e.Uniform1f(t,n.u_terrain_offset),u_terrain_exaggeration:new e.Uniform1f(t,n.u_terrain_exaggeration)}))(t,z),this.binderUniforms=r?r.getUniforms(t,z):[]}draw(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g){const _=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(a),e.setColorMode(r),e.setCullFace(i),s){e.activeTexture.set(_.TEXTURE2),_.bindTexture(_.TEXTURE_2D,s.depthTexture),e.activeTexture.set(_.TEXTURE3),_.bindTexture(_.TEXTURE_2D,s.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}for(const e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);b&&b.setUniforms(e,this.binderUniforms,p,{zoom:m});let y=0;switch(t){case _.LINES:y=2;break;case _.TRIANGLES:y=3;break;case _.LINE_STRIP:y=1}for(const n of d.get()){const a=n.vaos||(n.vaos={});(a[l]||(a[l]=new it)).bind(e,this,c,b?b.getPaintVertexBuffers():[],u,n.vertexOffset,h,f,g),_.drawElements(t,n.primitiveLength*y,_.UNSIGNED_SHORT,n.primitiveOffset*y*2)}}}function lt(e,t,n){const a=1/ve(n,1,t.transform.tileZoom),r=Math.pow(2,n.tileID.overscaledZ),i=n.tileSize*Math.pow(2,t.transform.tileZoom)/r,o=i*(n.tileID.canonical.x+n.tileID.wrap*r),s=i*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const ct=(t,n,a,r)=>{const i=n.style.light,o=i.properties.get("position"),s=[o.x,o.y,o.z],l=e.create$1();"viewport"===i.properties.get("anchor")&&e.fromRotation(l,-n.transform.angle),e.transformMat3(s,s,l);const c=i.properties.get("color");return{u_matrix:t,u_lightpos:s,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+a,u_opacity:r}},ut=(t,n,a,r,i,o,s)=>e.extend(ct(t,n,a,r),lt(o,n,s),{u_height_factor:-Math.pow(2,i.overscaledZ)/s.tileSize/8}),dt=e=>({u_matrix:e}),pt=(t,n,a,r)=>e.extend(dt(t),lt(a,n,r)),mt=(e,t)=>({u_matrix:e,u_world:t}),bt=(t,n,a,r,i)=>e.extend(pt(t,n,a,r),{u_world:i}),ht=(e,t,n,a)=>{const r=e.transform;let i,o;if("map"===a.paint.get("circle-pitch-alignment")){const e=ve(n,1,r.zoom);i=!0,o=[e,e]}else i=!1,o=r.pixelsToGLUnits;return{u_camera_to_center_distance:r.cameraToCenterDistance,u_scale_with_map:+("map"===a.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+i,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:o}},ft=(e,t,n)=>{const a=ve(n,1,t.zoom),r=Math.pow(2,t.zoom-n.tileID.overscaledZ),i=n.tileID.overscaleFactor();return{u_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*r),t.pixelsToGLUnits[1]/(a*r)],u_overscale_factor:i}},gt=(e,t,n=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:n}),_t=e=>({u_matrix:e}),yt=(e,t,n,a)=>({u_matrix:e,u_extrude_scale:ve(t,1,n),u_intensity:a});function Mt(t,n){const a=Math.pow(2,n.canonical.z),r=n.canonical.y;return[new e.MercatorCoordinate(0,r/a).toLngLat().lat,new e.MercatorCoordinate(0,(r+1)/a).toLngLat().lat]}const vt=(e,t,n,a)=>{const r=e.transform;return{u_matrix:xt(e,t,n,a),u_ratio:1/ve(t,1,r.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},zt=(t,n,a,r,i)=>e.extend(vt(t,n,a,i),{u_image:0,u_image_height:r}),Ot=(e,t,n,a,r)=>{const i=e.transform,o=At(t,i);return{u_matrix:xt(e,t,n,r),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ve(t,1,i.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},kt=(t,n,a,r,i,o)=>{const s=t.lineAtlas,l=At(n,t.transform),c="round"===a.layout.get("line-cap"),u=s.getDash(r.from,c),d=s.getDash(r.to,c),p=u.width*i.fromScale,m=d.width*i.toScale;return e.extend(vt(t,n,a,o),{u_patternscale_a:[l/p,-u.height/2],u_patternscale_b:[l/m,-d.height/2],u_sdfgamma:s.width/(256*Math.min(p,m)*t.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:d.y,u_mix:i.t})};function At(e,t){return 1/ve(e,1,t.tileZoom)}function xt(e,t,n,a){return e.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const wt=(e,t,n,a,r)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(o=r.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(i=r.paint.get("raster-contrast"),i>0?1/(1-i):1+i),u_spin_weights:Nt(r.paint.get("raster-hue-rotate"))};var i,o};function Nt(e){e*=Math.PI/180;const t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const qt=(e,t,n,a,r,i,o,s,l,c)=>{const u=r.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:i,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+a,u_texsize:c,u_texture:0}},Et=(t,n,a,r,i,o,s,l,c,u,d)=>{const p=i.transform;return e.extend(qt(t,n,a,r,i,o,s,l,c,u),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+d})},jt=(t,n,a,r,i,o,s,l,c,u)=>e.extend(Et(t,n,a,r,i,o,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1}),Wt=(e,t,n)=>({u_matrix:e,u_opacity:t,u_color:n}),Lt=(t,n,a,r,i,o)=>e.extend(function(e,t,n,a){const r=n.imageManager.getPattern(e.from.toString()),i=n.imageManager.getPattern(e.to.toString()),{width:o,height:s}=n.imageManager.getPixelSize(),l=Math.pow(2,a.tileID.overscaledZ),c=a.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(a.tileID.canonical.x+a.tileID.wrap*l),d=c*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:i.tl,u_pattern_br_b:i.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:i.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/ve(a,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(r,o,a,i),{u_matrix:t,u_opacity:n}),St={fillExtrusion:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_lightpos:new e.Uniform3f(t,n.u_lightpos),u_lightintensity:new e.Uniform1f(t,n.u_lightintensity),u_lightcolor:new e.Uniform3f(t,n.u_lightcolor),u_vertical_gradient:new e.Uniform1f(t,n.u_vertical_gradient),u_opacity:new e.Uniform1f(t,n.u_opacity)}),fillExtrusionPattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_lightpos:new e.Uniform3f(t,n.u_lightpos),u_lightintensity:new e.Uniform1f(t,n.u_lightintensity),u_lightcolor:new e.Uniform3f(t,n.u_lightcolor),u_vertical_gradient:new e.Uniform1f(t,n.u_vertical_gradient),u_height_factor:new e.Uniform1f(t,n.u_height_factor),u_image:new e.Uniform1i(t,n.u_image),u_texsize:new e.Uniform2f(t,n.u_texsize),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade),u_opacity:new e.Uniform1f(t,n.u_opacity)}),fill:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),fillPattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_image:new e.Uniform1i(t,n.u_image),u_texsize:new e.Uniform2f(t,n.u_texsize),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade)}),fillOutline:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_world:new e.Uniform2f(t,n.u_world)}),fillOutlinePattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_world:new e.Uniform2f(t,n.u_world),u_image:new e.Uniform1i(t,n.u_image),u_texsize:new e.Uniform2f(t,n.u_texsize),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade)}),circle:(t,n)=>({u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_scale_with_map:new e.Uniform1i(t,n.u_scale_with_map),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_extrude_scale:new e.Uniform2f(t,n.u_extrude_scale),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),collisionBox:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pixels_to_tile_units:new e.Uniform1f(t,n.u_pixels_to_tile_units),u_extrude_scale:new e.Uniform2f(t,n.u_extrude_scale),u_overscale_factor:new e.Uniform1f(t,n.u_overscale_factor)}),collisionCircle:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_inv_matrix:new e.UniformMatrix4f(t,n.u_inv_matrix),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_viewport_size:new e.Uniform2f(t,n.u_viewport_size)}),debug:(t,n)=>({u_color:new e.UniformColor(t,n.u_color),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_overlay:new e.Uniform1i(t,n.u_overlay),u_overlay_scale:new e.Uniform1f(t,n.u_overlay_scale)}),clippingMask:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),heatmap:(t,n)=>({u_extrude_scale:new e.Uniform1f(t,n.u_extrude_scale),u_intensity:new e.Uniform1f(t,n.u_intensity),u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),heatmapTexture:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_world:new e.Uniform2f(t,n.u_world),u_image:new e.Uniform1i(t,n.u_image),u_color_ramp:new e.Uniform1i(t,n.u_color_ramp),u_opacity:new e.Uniform1f(t,n.u_opacity)}),hillshade:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_image:new e.Uniform1i(t,n.u_image),u_latrange:new e.Uniform2f(t,n.u_latrange),u_light:new e.Uniform2f(t,n.u_light),u_shadow:new e.UniformColor(t,n.u_shadow),u_highlight:new e.UniformColor(t,n.u_highlight),u_accent:new e.UniformColor(t,n.u_accent)}),hillshadePrepare:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_image:new e.Uniform1i(t,n.u_image),u_dimension:new e.Uniform2f(t,n.u_dimension),u_zoom:new e.Uniform1f(t,n.u_zoom),u_unpack:new e.Uniform4f(t,n.u_unpack)}),line:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels)}),lineGradient:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels),u_image:new e.Uniform1i(t,n.u_image),u_image_height:new e.Uniform1f(t,n.u_image_height)}),linePattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_texsize:new e.Uniform2f(t,n.u_texsize),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_image:new e.Uniform1i(t,n.u_image),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade)}),lineSDF:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels),u_patternscale_a:new e.Uniform2f(t,n.u_patternscale_a),u_patternscale_b:new e.Uniform2f(t,n.u_patternscale_b),u_sdfgamma:new e.Uniform1f(t,n.u_sdfgamma),u_image:new e.Uniform1i(t,n.u_image),u_tex_y_a:new e.Uniform1f(t,n.u_tex_y_a),u_tex_y_b:new e.Uniform1f(t,n.u_tex_y_b),u_mix:new e.Uniform1f(t,n.u_mix)}),raster:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_tl_parent:new e.Uniform2f(t,n.u_tl_parent),u_scale_parent:new e.Uniform1f(t,n.u_scale_parent),u_buffer_scale:new e.Uniform1f(t,n.u_buffer_scale),u_fade_t:new e.Uniform1f(t,n.u_fade_t),u_opacity:new e.Uniform1f(t,n.u_opacity),u_image0:new e.Uniform1i(t,n.u_image0),u_image1:new e.Uniform1i(t,n.u_image1),u_brightness_low:new e.Uniform1f(t,n.u_brightness_low),u_brightness_high:new e.Uniform1f(t,n.u_brightness_high),u_saturation_factor:new e.Uniform1f(t,n.u_saturation_factor),u_contrast_factor:new e.Uniform1f(t,n.u_contrast_factor),u_spin_weights:new e.Uniform3f(t,n.u_spin_weights)}),symbolIcon:(t,n)=>({u_is_size_zoom_constant:new e.Uniform1i(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.Uniform1i(t,n.u_is_size_feature_constant),u_size_t:new e.Uniform1f(t,n.u_size_t),u_size:new e.Uniform1f(t,n.u_size),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pitch:new e.Uniform1f(t,n.u_pitch),u_rotate_symbol:new e.Uniform1i(t,n.u_rotate_symbol),u_aspect_ratio:new e.Uniform1f(t,n.u_aspect_ratio),u_fade_change:new e.Uniform1f(t,n.u_fade_change),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_label_plane_matrix:new e.UniformMatrix4f(t,n.u_label_plane_matrix),u_coord_matrix:new e.UniformMatrix4f(t,n.u_coord_matrix),u_is_text:new e.Uniform1i(t,n.u_is_text),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_texsize:new e.Uniform2f(t,n.u_texsize),u_texture:new e.Uniform1i(t,n.u_texture)}),symbolSDF:(t,n)=>({u_is_size_zoom_constant:new e.Uniform1i(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.Uniform1i(t,n.u_is_size_feature_constant),u_size_t:new e.Uniform1f(t,n.u_size_t),u_size:new e.Uniform1f(t,n.u_size),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pitch:new e.Uniform1f(t,n.u_pitch),u_rotate_symbol:new e.Uniform1i(t,n.u_rotate_symbol),u_aspect_ratio:new e.Uniform1f(t,n.u_aspect_ratio),u_fade_change:new e.Uniform1f(t,n.u_fade_change),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_label_plane_matrix:new e.UniformMatrix4f(t,n.u_label_plane_matrix),u_coord_matrix:new e.UniformMatrix4f(t,n.u_coord_matrix),u_is_text:new e.Uniform1i(t,n.u_is_text),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_texsize:new e.Uniform2f(t,n.u_texsize),u_texture:new e.Uniform1i(t,n.u_texture),u_gamma_scale:new e.Uniform1f(t,n.u_gamma_scale),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_is_halo:new e.Uniform1i(t,n.u_is_halo)}),symbolTextAndIcon:(t,n)=>({u_is_size_zoom_constant:new e.Uniform1i(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.Uniform1i(t,n.u_is_size_feature_constant),u_size_t:new e.Uniform1f(t,n.u_size_t),u_size:new e.Uniform1f(t,n.u_size),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pitch:new e.Uniform1f(t,n.u_pitch),u_rotate_symbol:new e.Uniform1i(t,n.u_rotate_symbol),u_aspect_ratio:new e.Uniform1f(t,n.u_aspect_ratio),u_fade_change:new e.Uniform1f(t,n.u_fade_change),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_label_plane_matrix:new e.UniformMatrix4f(t,n.u_label_plane_matrix),u_coord_matrix:new e.UniformMatrix4f(t,n.u_coord_matrix),u_is_text:new e.Uniform1i(t,n.u_is_text),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_texsize:new e.Uniform2f(t,n.u_texsize),u_texsize_icon:new e.Uniform2f(t,n.u_texsize_icon),u_texture:new e.Uniform1i(t,n.u_texture),u_texture_icon:new e.Uniform1i(t,n.u_texture_icon),u_gamma_scale:new e.Uniform1f(t,n.u_gamma_scale),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_is_halo:new e.Uniform1i(t,n.u_is_halo)}),background:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_opacity:new e.Uniform1f(t,n.u_opacity),u_color:new e.UniformColor(t,n.u_color)}),backgroundPattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_opacity:new e.Uniform1f(t,n.u_opacity),u_image:new e.Uniform1i(t,n.u_image),u_pattern_tl_a:new e.Uniform2f(t,n.u_pattern_tl_a),u_pattern_br_a:new e.Uniform2f(t,n.u_pattern_br_a),u_pattern_tl_b:new e.Uniform2f(t,n.u_pattern_tl_b),u_pattern_br_b:new e.Uniform2f(t,n.u_pattern_br_b),u_texsize:new e.Uniform2f(t,n.u_texsize),u_mix:new e.Uniform1f(t,n.u_mix),u_pattern_size_a:new e.Uniform2f(t,n.u_pattern_size_a),u_pattern_size_b:new e.Uniform2f(t,n.u_pattern_size_b),u_scale_a:new e.Uniform1f(t,n.u_scale_a),u_scale_b:new e.Uniform1f(t,n.u_scale_b),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_tile_units_to_pixels:new e.Uniform1f(t,n.u_tile_units_to_pixels)}),terrain:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_texture:new e.Uniform1i(t,n.u_texture)}),terrainDepth:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),terrainCoords:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_texture:new e.Uniform1i(t,n.u_texture),u_terrain_coords_id:new e.Uniform1f(t,n.u_terrain_coords_id)})};class Tt{constructor(e,t,n){this.context=e;const a=e.gl;this.buffer=a.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ct={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Rt{constructor(e,t,n,a){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=a,this.context=e;const r=e.gl;this.buffer=r.createBuffer(),e.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n=0;n<this.attributes.length;n++){const a=t.attributes[this.attributes[n].name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,t,n){for(let a=0;a<this.attributes.length;a++){const r=this.attributes[a],i=t.attributes[r.name];void 0!==i&&e.vertexAttribPointer(i,r.components,e[Ct[r.type]],!1,this.itemSize,r.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Dt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Pt extends Dt{getDefault(){return e.Color.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Bt extends Dt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class It extends Dt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class $t extends Dt{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ft extends Dt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Xt extends Dt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Yt extends Dt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Ht extends Dt{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Ut extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class Vt extends Dt{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Gt extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Kt extends Dt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Jt extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Zt extends Dt{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Qt extends Dt{getDefault(){return e.Color.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class en extends Dt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class tn extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class nn extends Dt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class an extends Dt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class rn extends Dt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class on extends Dt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class sn extends Dt{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ln extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class cn extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class un extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class dn extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class pn extends Dt{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class mn extends Dt{constructor(e){super(e),this.vao=e.extVertexArrayObject}getDefault(){return null}set(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}class bn extends Dt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class hn extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class fn extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class gn extends Dt{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class _n extends gn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class yn extends gn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Mn{constructor(e,t,n,a){this.context=e,this.width=t,this.height=n;const r=e.gl,i=this.framebuffer=r.createFramebuffer();if(this.colorAttachment=new _n(e,i),a&&(this.depthAttachment=new yn(e,i)),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class vn{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}}vn.Replace=[1,0],vn.disabled=new vn(vn.Replace,e.Color.transparent,[!1,!1,!1,!1]),vn.unblended=new vn(vn.Replace,e.Color.transparent,[!0,!0,!0,!0]),vn.alphaBlended=new vn([1,771],e.Color.transparent,[!0,!0,!0,!0]);class zn{constructor(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Pt(this),this.clearDepth=new Bt(this),this.clearStencil=new It(this),this.colorMask=new $t(this),this.depthMask=new Ft(this),this.stencilMask=new Xt(this),this.stencilFunc=new Yt(this),this.stencilOp=new Ht(this),this.stencilTest=new Ut(this),this.depthRange=new Vt(this),this.depthTest=new Gt(this),this.depthFunc=new Kt(this),this.blend=new Jt(this),this.blendFunc=new Zt(this),this.blendColor=new Qt(this),this.blendEquation=new en(this),this.cullFace=new tn(this),this.cullFaceSide=new nn(this),this.frontFace=new an(this),this.program=new rn(this),this.activeTexture=new on(this),this.viewport=new sn(this),this.bindFramebuffer=new ln(this),this.bindRenderbuffer=new cn(this),this.bindTexture=new un(this),this.bindVertexBuffer=new dn(this),this.bindElementBuffer=new pn(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new mn(this),this.pixelStoreUnpack=new bn(this),this.pixelStoreUnpackPremultiplyAlpha=new hn(this),this.pixelStoreUnpackFlipY=new fn(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(e.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new Tt(this,e,t)}createVertexBuffer(e,t,n){return new Rt(this,e,t,n)}createRenderbuffer(e,t,n){const a=this.gl,r=a.createRenderbuffer();return this.bindRenderbuffer.set(r),a.renderbufferStorage(a.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),r}createFramebuffer(e,t,n){return new Mn(this,e,t,n)}clear({color:e,depth:t}){const n=this.gl;let a=0;e&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n.clear(a)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){r(e.blendFunction,vn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class On{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}}On.ReadOnly=!1,On.ReadWrite=!0,On.disabled=new On(519,On.ReadOnly,[0,1]);class kn{constructor(e,t,n,a,r,i){this.test=e,this.ref=t,this.mask=n,this.fail=a,this.depthFail=r,this.pass=i}}kn.disabled=new kn({func:519,mask:0},0,0,7680,7680,7680);class An{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}}let xn;function wn(t,n,a,r,i,o,s){const l=t.context,c=l.gl,u=t.useProgram("collisionBox"),d=[];let p=0,m=0;for(let b=0;b<r.length;b++){const h=r[b],f=n.getTile(h),g=f.getBucket(a);if(!g)continue;let _=h.posMatrix;0===i[0]&&0===i[1]||(_=t.translatePosMatrix(h.posMatrix,f,i,o));const y=s?g.textCollisionBox:g.iconCollisionBox,M=g.collisionCircleArray;if(M.length>0){const n=e.create(),a=_;e.mul(n,g.placementInvProjMatrix,t.transform.glCoordMatrix),e.mul(n,n,g.placementViewportMatrix),d.push({circleArray:M,circleOffset:m,transform:a,invTransform:n,coord:h}),p+=M.length/4,m=p}y&&u.draw(l,c.LINES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,ft(_,t.transform,f),t.style.terrain&&t.style.terrain.getTerrainData(h),a.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,t.transform.zoom,null,null,y.collisionVertexBuffer)}if(!s||!d.length)return;const b=t.useProgram("collisionCircle"),h=new e.CollisionCircleLayoutArray;h.resize(4*p),h._trim();let f=0;for(const e of d)for(let t=0;t<e.circleArray.length/4;t++){const n=4*t,a=e.circleArray[n+0],r=e.circleArray[n+1],i=e.circleArray[n+2],o=e.circleArray[n+3];h.emplace(f++,a,r,i,o,0),h.emplace(f++,a,r,i,o,1),h.emplace(f++,a,r,i,o,2),h.emplace(f++,a,r,i,o,3)}(!xn||xn.length<2*p)&&(xn=function(t){const n=2*t,a=new e.QuadTriangleArray;a.resize(n),a._trim();for(let e=0;e<n;e++){const t=6*e;a.uint16[t+0]=4*e+0,a.uint16[t+1]=4*e+1,a.uint16[t+2]=4*e+2,a.uint16[t+3]=4*e+2,a.uint16[t+4]=4*e+3,a.uint16[t+5]=4*e+0}return a}(p));const g=l.createIndexBuffer(xn,!0),_=l.createVertexBuffer(h,e.collisionCircleLayout.members,!0);for(const n of d){const r={u_matrix:n.transform,u_inv_matrix:n.invTransform,u_camera_to_center_distance:(y=t.transform).cameraToCenterDistance,u_viewport_size:[y.width,y.height]};b.draw(l,c.TRIANGLES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,r,t.style.terrain&&t.style.terrain.getTerrainData(n.coord),a.id,_,g,e.SegmentVector.simpleSegment(0,2*n.circleOffset,n.circleArray.length,n.circleArray.length/2),null,t.transform.zoom,null,null,null)}var y;_.destroy(),g.destroy()}An.disabled=new An(!1,1029,2305),An.backCCW=new An(!0,1029,2305);const Nn=e.identity(new Float32Array(16));function qn(t,n,a,r,i,o){const{horizontalAlign:s,verticalAlign:l}=e.getAnchorAlignment(t),c=-(s-.5)*n,u=-(l-.5)*a,d=e.evaluateVariableOffset(t,r);return new e.pointGeometry((c/i+d[0])*o,(u/i+d[1])*o)}function En(t,n,a,r,i,o,s,l,c,u,d){const p=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,b=t.icon.dynamicLayoutVertexArray,h={};m.clear();for(let b=0;b<p.length;b++){const f=p.get(b),g=t.allowVerticalPlacement&&!f.placedOrientation,_=f.hidden||!f.crossTileID||g?null:r[f.crossTileID];if(_){const r=new e.pointGeometry(f.anchorX,f.anchorY),p=se(r,a?s:o,d),b=le(i.cameraToCenterDistance,p.signedDistanceFromCamera);let g=e.evaluateSizeForFeature(t.textSizeData,c,f)*b/e.ONE_EM;a&&(g*=t.tilePixelRatio/l);const{width:y,height:M,anchor:v,textOffset:z,textBoxScale:O}=_,k=qn(v,y,M,z,O,g),A=a?se(r.add(k),o,d).point:p.point.add(n?k.rotate(-i.angle):k),x=t.allowVerticalPlacement&&f.placedOrientation===e.WritingMode.vertical?Math.PI/2:0;for(let t=0;t<f.numGlyphs;t++)e.addDynamicAttributes(m,A,x);u&&f.associatedIconIndex>=0&&(h[f.associatedIconIndex]={shiftedAnchor:A,angle:x})}else ge(f.numGlyphs,m)}if(u){b.clear();const n=t.icon.placedSymbolArray;for(let t=0;t<n.length;t++){const a=n.get(t);if(a.hidden)ge(a.numGlyphs,b);else{const n=h[t];if(n)for(let t=0;t<a.numGlyphs;t++)e.addDynamicAttributes(b,n.shiftedAnchor,n.angle);else ge(a.numGlyphs,b)}}t.icon.dynamicLayoutVertexBuffer.updateData(b)}t.text.dynamicLayoutVertexBuffer.updateData(m)}function jn(e,t,n){return n.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Wn(t,n,a,r,i,o,s,l,c,u,d,p){const m=t.context,b=m.gl,h=t.transform,f="map"===l,g="map"===c,_="viewport"!==l&&"point"!==a.layout.get("symbol-placement"),y=f&&!g&&!_,M=!a.layout.get("symbol-sort-key").isConstant();let v=!1;const z=t.depthModeForSublayer(0,On.ReadOnly),O=a.layout.get("text-variable-anchor"),k=[];for(const l of r){const r=n.getTile(l),c=r.getBucket(a);if(!c)continue;const d=i?c.text:c.icon;if(!d||!d.segments.get().length)continue;const p=d.programConfigurations.get(a.id),m=i||c.sdfIcons,z=i?c.textSizeData:c.iconSizeData,A=g||0!==h.pitch,x=t.useProgram(jn(m,i,c),p),w=e.evaluateSizeForZoom(z,h.zoom),N=t.style.terrain&&t.style.terrain.getTerrainData(l);let q,E,j,W,L=[0,0],S=null;if(i){if(E=r.glyphAtlasTexture,j=b.LINEAR,q=r.glyphAtlasTexture.size,c.iconsInText){L=r.imageAtlasTexture.size,S=r.imageAtlasTexture;const e="composite"===z.kind||"camera"===z.kind;W=A||t.options.rotating||t.options.zooming||e?b.LINEAR:b.NEAREST}}else{const e=1!==a.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;E=r.imageAtlasTexture,j=m||t.options.rotating||t.options.zooming||e||A?b.LINEAR:b.NEAREST,q=r.imageAtlasTexture.size}const T=ve(r,1,t.transform.zoom),C=ie(l.posMatrix,g,f,t.transform,T),R=oe(l.posMatrix,g,f,t.transform,T),D=O&&c.hasTextData(),P="none"!==a.layout.get("icon-text-fit")&&D&&c.hasIconData();if(_){const e=t.style.terrain?(e,n)=>t.style.terrain.getElevation(l,e,n):null,n="map"===a.layout.get("text-rotation-alignment");ue(c,l.posMatrix,t,i,C,R,g,u,n,e)}const B=t.translatePosMatrix(l.posMatrix,r,o,s),I=_||i&&O||P?Nn:C,$=t.translatePosMatrix(R,r,o,s,!0),F=m&&0!==a.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1);let X;X=m?c.iconsInText?jt(z.kind,w,y,g,t,B,I,$,q,L):Et(z.kind,w,y,g,t,B,I,$,i,q,!0):qt(z.kind,w,y,g,t,B,I,$,i,q);const Y={program:x,buffers:d,uniformValues:X,atlasTexture:E,atlasTextureIcon:S,atlasInterpolation:j,atlasInterpolationIcon:W,isSDF:m,hasHalo:F};if(M&&c.canOverlap){v=!0;const t=d.segments.get();for(const n of t)k.push({segments:new e.SegmentVector([n]),sortKey:n.sortKey,state:Y,terrainData:N})}else k.push({segments:d.segments,sortKey:0,state:Y,terrainData:N})}v&&k.sort((e,t)=>e.sortKey-t.sortKey);for(const e of k){const n=e.state;if(m.activeTexture.set(b.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,b.CLAMP_TO_EDGE),n.atlasTextureIcon&&(m.activeTexture.set(b.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,b.CLAMP_TO_EDGE)),n.isSDF){const r=n.uniformValues;n.hasHalo&&(r.u_is_halo=1,Ln(n.buffers,e.segments,a,t,n.program,z,d,p,r,e.terrainData)),r.u_is_halo=0}Ln(n.buffers,e.segments,a,t,n.program,z,d,p,n.uniformValues,e.terrainData)}}function Ln(e,t,n,a,r,i,o,s,l,c){const u=a.context;r.draw(u,u.gl.TRIANGLES,i,o,s,An.disabled,l,c,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,a.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Sn(e,t,n,a,r,i,o){const s=e.context.gl,l=n.paint.get("fill-pattern"),c=l&&l.constantOr(1),u=n.getCrossfadeParameters();let d,p,m,b,h;o?(p=c&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=s.LINES):(p=c?"fillPattern":"fill",d=s.TRIANGLES);for(const f of a){const a=t.getTile(f);if(c&&!a.patternsLoaded())continue;const g=a.getBucket(n);if(!g)continue;const _=g.programConfigurations.get(n.id),y=e.useProgram(p,_),M=e.style.terrain&&e.style.terrain.getTerrainData(f);c&&(e.context.activeTexture.set(s.TEXTURE0),a.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),_.updatePaintBuffers(u));const v=l.constantOr(null);if(v&&a.imageAtlas){const e=a.imageAtlas,t=e.patternPositions[v.to.toString()],n=e.patternPositions[v.from.toString()];t&&n&&_.setConstantPatternPositions(t,n)}const z=M?f:null,O=e.translatePosMatrix(z?z.posMatrix:f.posMatrix,a,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(o){b=g.indexBuffer2,h=g.segments2;const t=[s.drawingBufferWidth,s.drawingBufferHeight];m="fillOutlinePattern"===p&&c?bt(O,e,u,a,t):mt(O,t)}else b=g.indexBuffer,h=g.segments,m=c?pt(O,e,u,a):dt(O);y.draw(e.context,d,r,e.stencilModeForClipping(f),i,An.disabled,m,M,n.id,g.layoutVertexBuffer,b,h,n.paint,e.transform.zoom,_)}}function Tn(e,t,n,a,r,i,o){const s=e.context,l=s.gl,c=n.paint.get("fill-extrusion-pattern"),u=c.constantOr(1),d=n.getCrossfadeParameters(),p=n.paint.get("fill-extrusion-opacity");for(const m of a){const a=t.getTile(m),b=a.getBucket(n);if(!b)continue;const h=e.style.terrain&&e.style.terrain.getTerrainData(m),f=b.programConfigurations.get(n.id),g=e.useProgram(u?"fillExtrusionPattern":"fillExtrusion",f);u&&(e.context.activeTexture.set(l.TEXTURE0),a.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),f.updatePaintBuffers(d));const _=c.constantOr(null);if(_&&a.imageAtlas){const e=a.imageAtlas,t=e.patternPositions[_.to.toString()],n=e.patternPositions[_.from.toString()];t&&n&&f.setConstantPatternPositions(t,n)}const y=e.translatePosMatrix(m.posMatrix,a,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),M=n.paint.get("fill-extrusion-vertical-gradient"),v=u?ut(y,e,M,p,m,d,a):ct(y,e,M,p);g.draw(s,s.gl.TRIANGLES,r,i,o,An.backCCW,v,h,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,e.transform.zoom,f,e.style.terrain&&b.centroidVertexBuffer)}}function Cn(e,t,n,a,r,i,o){const s=e.context,l=s.gl,c=n.fbo;if(!c)return;const u=e.useProgram("hillshade"),d=e.style.terrain&&e.style.terrain.getTerrainData(t);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),u.draw(s,l.TRIANGLES,r,i,o,An.disabled,((e,t,n,a)=>{const r=n.paint.get("hillshade-shadow-color"),i=n.paint.get("hillshade-highlight-color"),o=n.paint.get("hillshade-accent-color");let s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);const l=!e.options.moving;return{u_matrix:a?a.posMatrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:Mt(0,t.tileID),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:i,u_accent:o}})(e,n,a,d?t:null),d,a.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function Rn(t,n,a,r,i,o){const s=t.context,c=s.gl,u=n.dem;if(u&&u.data){const d=u.dim,p=u.stride,m=u.getPixels();if(s.activeTexture.set(c.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(p),n.demTexture){const e=n.demTexture;e.update(m,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else n.demTexture=new l(s,m,c.RGBA,{premultiply:!1}),n.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);s.activeTexture.set(c.TEXTURE0);let b=n.fbo;if(!b){const e=new l(s,{width:d,height:d,data:null},c.RGBA);e.bind(c.LINEAR,c.CLAMP_TO_EDGE),b=n.fbo=s.createFramebuffer(d,d,!0),b.colorAttachment.set(e.texture)}s.bindFramebuffer.set(b.framebuffer),s.viewport.set([0,0,d,d]),t.useProgram("hillshadePrepare").draw(s,c.TRIANGLES,r,i,o,An.disabled,((t,n)=>{const a=n.stride,r=e.create();return e.ortho(r,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(r,r,[0,-e.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[a,a],u_zoom:t.overscaledZ,u_unpack:n.getUnpackVector()}})(n.tileID,u),null,a.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Dn(t,n,a,r,i,o){const s=r.paint.get("raster-fade-duration");if(!o&&s>0){const r=e.exported.now(),o=(r-t.timeAdded)/s,l=n?(r-n.timeAdded)/s:-1,c=a.getSource(),u=i.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),d=!n||Math.abs(n.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),p=d&&t.refreshedUponExpiration?1:e.clamp(d?o:1-l,0,1);return t.refreshedUponExpiration&&o>=1&&(t.refreshedUponExpiration=!1),n?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Pn=new e.Color(1,0,0,1),Bn=new e.Color(0,1,0,1),In=new e.Color(0,0,1,1),$n=new e.Color(1,0,1,1),Fn=new e.Color(0,1,1,1);function Xn(e,t,n,a){Hn(e,0,t+n/2,e.transform.width,n,a)}function Yn(e,t,n,a){Hn(e,t-n/2,0,n,e.transform.height,a)}function Hn(e,t,n,a,r,i){const o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,a*e.pixelRatio,r*e.pixelRatio),o.clear({color:i}),s.disable(s.SCISSOR_TEST)}function Un(t,n,a){const r=t.context,i=r.gl,o=a.posMatrix,s=t.useProgram("debug"),l=On.disabled,c=kn.disabled,u=t.colorModeForRenderPass(),d="$debug",p=t.style.terrain&&t.style.terrain.getTerrainData(a);r.activeTexture.set(i.TEXTURE0),t.emptyTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE);const m=n.getTileByID(a.key).latestRawTileData,b=Math.floor((m&&m.byteLength||0)/1024),h=n.getTile(a).tileSize,f=512/Math.min(h,512)*(a.overscaledZ/t.transform.zoom)*.5;let g=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(g+=" => "+a.overscaledZ),function(e,t){e.initDebugOverlayCanvas();const n=e.debugOverlayCanvas,a=e.context.gl,r=e.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,n.width,n.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(t,`${g} ${b}kB`),s.draw(r,i.TRIANGLES,l,c,vn.alphaBlended,An.disabled,gt(o,e.Color.transparent,f),null,d,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(r,i.LINE_STRIP,l,c,u,An.disabled,gt(o,e.Color.red),p,d,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Vn(e,t,n){const a=e.context,r=a.gl,i=e.colorModeForRenderPass(),o=new On(r.LEQUAL,On.ReadWrite,e.depthRangeFor3D),s=e.useProgram("terrain"),l=t.getTerrainMesh(),c=t.getTerrainData(n.tileID);a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]),a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const u=e.transform.calculatePosMatrix(n.tileID.toUnwrapped());s.draw(a,r.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:u,u_texture:0},c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}function Gn(e,t,n,a){const r=e.context,i=n.tileSize*t.qualityFactor;n.textures[a]||(n.textures[a]=e.getTileTexture(i)||new l(r,{width:i,height:i,data:null},r.gl.RGBA),n.textures[a].bind(r.gl.LINEAR,r.gl.CLAMP_TO_EDGE),0===a&&t.sourceCache.renderHistory.unshift(n.tileID.key));const o=t.getRTTFramebuffer();o.colorAttachment.set(n.textures[a].texture),r.bindFramebuffer.set(o.framebuffer),r.viewport.set([0,0,i,i])}class Kn{constructor(e){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=e,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=e.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const e=this.painter.style,t=e.terrain;for(const n in e.sourceCaches){this._coordsDescendingInv[n]={};const a=e.sourceCaches[n].getVisibleCoordinates();for(const e of a){const a=t.sourceCache.getTerrainCoords(e);for(const e in a)this._coordsDescendingInv[n][e]||(this._coordsDescendingInv[n][e]=[]),this._coordsDescendingInv[n][e].push(a[e])}}for(const t of e._order){const n=e._layers[t],a=n.source;if(this._renderToTexture[n.type]&&!this._coordsDescendingInvStr[a]){this._coordsDescendingInvStr[a]={};for(const e in this._coordsDescendingInv[a])this._coordsDescendingInvStr[a][e]=this._coordsDescendingInv[a][e].map(e=>e.key).sort().join()}}return this._renderableTiles.forEach(e=>{for(const n in this._coordsDescendingInvStr){const a=this._coordsDescendingInvStr[n][e.tileID.key];a&&a!==e.textureCoords[n]&&e.clearTextures(this.painter),t.needsRerender(n,e.tileID)&&e.clearTextures(this.painter)}this._rerender[e.tileID.key]=!e.textures.length}),t.clearRerenderCache(),t.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,a=this.painter,r=a.style._order,i=a.currentLayer,o=i+1===r.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(r[i]),!o))return!0;if(this._renderToTexture[this._prevType]||"hillshade"===n||this._renderToTexture[n]&&o){this._prevType=n;const o=this._stacks.length-1,s=this._stacks[o]||[];for(const t of this._renderableTiles){if(Gn(a,a.style.terrain,t,o),this._rerender[t.tileID.key]){a.context.clear({color:e.Color.transparent});for(let e=0;e<s.length;e++){const n=a.style._layers[s[e]],r=n.source?this._coordsDescendingInv[n.source][t.tileID.key]:[t.tileID];a._renderTileClippingMasks(n,r),a.renderLayer(a,a.style.sourceCaches[n.source],n,r),n.source&&(t.textureCoords[n.source]=this._coordsDescendingInvStr[n.source][t.tileID.key])}}Vn(a,a.style.terrain,t)}if("hillshade"===n){this._stacks.push([r[i]]);for(const n of this._renderableTiles){const r=this._coordsDescendingInv[t.source][n.tileID.key];Gn(a,a.style.terrain,n,this._stacks.length-1),a.context.clear({color:e.Color.transparent}),a._renderTileClippingMasks(t,r),a.renderLayer(a,a.style.sourceCaches[t.source],t,r),Vn(a,a.style.terrain,n)}return!0}return this._renderToTexture[n]}return!1}}const Jn={symbol:function(t,n,a,r,i){if("translucent"!==t.renderPass)return;const o=kn.disabled,s=t.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(t,n,a,r,i,o,s){const l=n.transform,c="map"===i,u="map"===o;for(const i of t){const t=r.getTile(i),o=t.getBucket(a);if(!o||!o.text||!o.text.segments.get().length)continue;const d=e.evaluateSizeForZoom(o.textSizeData,l.zoom),p=ve(t,1,n.transform.zoom),m=ie(i.posMatrix,u,c,n.transform,p),b="none"!==a.layout.get("icon-text-fit")&&o.hasIconData();if(d){const e=Math.pow(2,l.zoom-t.tileID.overscaledZ);En(o,c,u,s,l,m,i.posMatrix,e,d,b,n.style.terrain?(e,t)=>n.style.terrain.getElevation(i,e,t):null)}}}(r,t,a,n,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),i),0!==a.paint.get("icon-opacity").constantOr(1)&&Wn(t,n,a,r,!1,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),a.layout.get("icon-rotation-alignment"),a.layout.get("icon-pitch-alignment"),a.layout.get("icon-keep-upright"),o,s),0!==a.paint.get("text-opacity").constantOr(1)&&Wn(t,n,a,r,!0,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.layout.get("text-keep-upright"),o,s),n.map.showCollisionBoxes&&(wn(t,n,a,r,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),wn(t,n,a,r,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(t,n,a,r){if("translucent"!==t.renderPass)return;const i=a.paint.get("circle-opacity"),o=a.paint.get("circle-stroke-width"),s=a.paint.get("circle-stroke-opacity"),l=!a.layout.get("circle-sort-key").isConstant();if(0===i.constantOr(1)&&(0===o.constantOr(1)||0===s.constantOr(1)))return;const c=t.context,u=c.gl,d=t.depthModeForSublayer(0,On.ReadOnly),p=kn.disabled,m=t.colorModeForRenderPass(),b=[];for(let i=0;i<r.length;i++){const o=r[i],s=n.getTile(o),c=s.getBucket(a);if(!c)continue;const u=c.programConfigurations.get(a.id),d=t.useProgram("circle",u),p=c.layoutVertexBuffer,m=c.indexBuffer,h=t.style.terrain&&t.style.terrain.getTerrainData(o),f={programConfiguration:u,program:d,layoutVertexBuffer:p,indexBuffer:m,uniformValues:ht(t,o,s,a),terrainData:h};if(l){const t=c.segments.get();for(const n of t)b.push({segments:new e.SegmentVector([n]),sortKey:n.sortKey,state:f})}else b.push({segments:c.segments,sortKey:0,state:f})}l&&b.sort((e,t)=>e.sortKey-t.sortKey);for(const e of b){const{programConfiguration:n,program:r,layoutVertexBuffer:i,indexBuffer:o,uniformValues:s,terrainData:l}=e.state;r.draw(c,u.TRIANGLES,d,p,m,An.disabled,s,l,a.id,i,o,e.segments,a.paint,t.transform.zoom,n)}},heatmap:function(t,n,a,r){if(0!==a.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const i=t.context,o=i.gl,s=kn.disabled,l=new vn([o.ONE,o.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,n){const a=e.gl;e.activeTexture.set(a.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let r=n.heatmapFbo;if(r)a.bindTexture(a.TEXTURE_2D,r.colorAttachment.get()),e.bindFramebuffer.set(r.framebuffer);else{const i=a.createTexture();a.bindTexture(a.TEXTURE_2D,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),r=n.heatmapFbo=e.createFramebuffer(t.width/4,t.height/4,!1),function(e,t,n,a){const r=e.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t.width/4,t.height/4,0,r.RGBA,e.extRenderToTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),a.colorAttachment.set(n)}(e,t,i,r)}}(i,t,a),i.clear({color:e.Color.transparent});for(let e=0;e<r.length;e++){const c=r[e];if(n.hasRenderableParent(c))continue;const u=n.getTile(c),d=u.getBucket(a);if(!d)continue;const p=d.programConfigurations.get(a.id),m=t.useProgram("heatmap",p),{zoom:b}=t.transform;m.draw(i,o.TRIANGLES,On.disabled,s,l,An.disabled,yt(c.posMatrix,u,b,a.paint.get("heatmap-intensity")),null,a.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,a.paint,t.transform.zoom,p)}i.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,n){const a=t.context,r=a.gl,i=n.heatmapFbo;if(!i)return;a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),a.activeTexture.set(r.TEXTURE1);let o=n.colorRampTexture;o||(o=n.colorRampTexture=new l(a,n.colorRamp,r.RGBA)),o.bind(r.LINEAR,r.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(a,r.TRIANGLES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,((t,n,a,r)=>{const i=e.create();e.ortho(i,0,t.width,t.height,0,0,1);const o=t.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")}})(t,n),null,n.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,n.paint,t.transform.zoom)}(t,a))},line:function(t,n,a,r){if("translucent"!==t.renderPass)return;const i=a.paint.get("line-opacity"),o=a.paint.get("line-width");if(0===i.constantOr(1)||0===o.constantOr(1))return;const s=t.depthModeForSublayer(0,On.ReadOnly),c=t.colorModeForRenderPass(),u=a.paint.get("line-dasharray"),d=a.paint.get("line-pattern"),p=d.constantOr(1),m=a.paint.get("line-gradient"),b=a.getCrossfadeParameters(),h=p?"linePattern":u?"lineSDF":m?"lineGradient":"line",f=t.context,g=f.gl;let _=!0;for(const i of r){const r=n.getTile(i);if(p&&!r.patternsLoaded())continue;const o=r.getBucket(a);if(!o)continue;const y=o.programConfigurations.get(a.id),M=t.context.program.get(),v=t.useProgram(h,y),z=_||v.program!==M,O=t.style.terrain&&t.style.terrain.getTerrainData(i),k=d.constantOr(null);if(k&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[k.to.toString()],n=e.patternPositions[k.from.toString()];t&&n&&y.setConstantPatternPositions(t,n)}const A=O?i:null,x=p?Ot(t,r,a,b,A):u?kt(t,r,a,u,b,A):m?zt(t,r,a,o.lineClipsArray.length,A):vt(t,r,a,A);if(p)f.activeTexture.set(g.TEXTURE0),r.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),y.updatePaintBuffers(b);else if(u&&(z||t.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),t.lineAtlas.bind(f);else if(m){const r=o.gradients[a.id];let s=r.texture;if(a.gradientVersion!==r.version){let c=256;if(a.stepInterpolant){const a=n.getSource().maxzoom,r=i.canonical.z===a?Math.ceil(1<<t.transform.maxZoom-i.canonical.z):1;c=e.clamp(e.nextPowerOfTwo(o.maxLineLength/e.EXTENT*1024*r),256,f.maxTextureSize)}r.gradient=e.renderColorRamp({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:r.gradient||void 0,clips:o.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new l(f,r.gradient,g.RGBA),r.version=a.gradientVersion,s=r.texture}f.activeTexture.set(g.TEXTURE0),s.bind(a.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}v.draw(f,g.TRIANGLES,s,t.stencilModeForClipping(i),c,An.disabled,x,O,a.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,a.paint,t.transform.zoom,y,o.layoutVertexBuffer2),_=!1}},fill:function(t,n,a,r){const i=a.paint.get("fill-color"),o=a.paint.get("fill-opacity");if(0===o.constantOr(1))return;const s=t.colorModeForRenderPass(),l=a.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===i.constantOr(e.Color.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const e=t.depthModeForSublayer(1,"opaque"===t.renderPass?On.ReadWrite:On.ReadOnly);Sn(t,n,a,r,e,s,!1)}if("translucent"===t.renderPass&&a.paint.get("fill-antialias")){const e=t.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,On.ReadOnly);Sn(t,n,a,r,e,s,!0)}},"fill-extrusion":function(e,t,n,a){const r=n.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===e.renderPass){const i=new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D);if(1!==r||n.paint.get("fill-extrusion-pattern").constantOr(1))Tn(e,t,n,a,i,kn.disabled,vn.disabled),Tn(e,t,n,a,i,e.stencilModeFor3D(),e.colorModeForRenderPass());else{const r=e.colorModeForRenderPass();Tn(e,t,n,a,i,kn.disabled,r)}}},hillshade:function(e,t,n,a){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const r=e.context,i=e.depthModeForSublayer(0,On.ReadOnly),o=e.colorModeForRenderPass(),[s,l]="translucent"===e.renderPass?e.stencilConfigForOverlap(a):[{},a];for(const a of l){const r=t.getTile(a);void 0!==r.needsHillshadePrepare&&r.needsHillshadePrepare&&"offscreen"===e.renderPass?Rn(e,r,n,i,kn.disabled,o):"translucent"===e.renderPass&&Cn(e,a,r,n,i,s[a.overscaledZ],o)}r.viewport.set([0,0,e.width,e.height])},raster:function(e,t,n,a){if("translucent"!==e.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!a.length)return;const r=e.context,i=r.gl,o=t.getSource(),s=e.useProgram("raster"),l=e.colorModeForRenderPass(),[c,u]=o instanceof N?[{},a]:e.stencilConfigForOverlap(a),d=u[u.length-1].overscaledZ,p=!e.options.moving;for(const a of u){const u=e.depthModeForSublayer(a.overscaledZ-d,1===n.paint.get("raster-opacity")?On.ReadWrite:On.ReadOnly,i.LESS),m=t.getTile(a);m.registerFadeDuration(n.paint.get("raster-fade-duration"));const b=t.findLoadedParent(a,0),h=Dn(m,b,t,n,e.transform,e.style.terrain);let f,g;const _="nearest"===n.paint.get("raster-resampling")?i.NEAREST:i.LINEAR;r.activeTexture.set(i.TEXTURE0),m.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(i.TEXTURE1),b?(b.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST),f=Math.pow(2,b.tileID.overscaledZ-m.tileID.overscaledZ),g=[m.tileID.canonical.x*f%1,m.tileID.canonical.y*f%1]):m.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST);const y=e.style.terrain&&e.style.terrain.getTerrainData(a),M=y?a:null,v=M?M.posMatrix:e.transform.calculatePosMatrix(a.toUnwrapped(),p),z=wt(v,g||[0,0],f||1,h,n);o instanceof N?s.draw(r,i.TRIANGLES,u,kn.disabled,l,An.disabled,z,y,n.id,o.boundsBuffer,e.quadTriangleIndexBuffer,o.boundsSegments):s.draw(r,i.TRIANGLES,u,c[a.overscaledZ],l,An.disabled,z,y,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}},background:function(e,t,n,a){const r=n.paint.get("background-color"),i=n.paint.get("background-opacity");if(0===i)return;const o=e.context,s=o.gl,l=e.transform,c=l.tileSize,u=n.paint.get("background-pattern");if(e.isPatternMissing(u))return;const d=!u&&1===r.a&&1===i&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==d)return;const p=kn.disabled,m=e.depthModeForSublayer(0,"opaque"===d?On.ReadWrite:On.ReadOnly),b=e.colorModeForRenderPass(),h=e.useProgram(u?"backgroundPattern":"background"),f=a||l.coveringTiles({tileSize:c,terrain:e.style.terrain});u&&(o.activeTexture.set(s.TEXTURE0),e.imageManager.bind(e.context));const g=n.getCrossfadeParameters();for(const t of f){const l=a?t.posMatrix:e.transform.calculatePosMatrix(t.toUnwrapped()),d=u?Lt(l,i,e,u,{tileID:t,tileSize:c},g):Wt(l,i,r),f=e.style.terrain&&e.style.terrain.getTerrainData(t);h.draw(o,s.TRIANGLES,m,p,b,An.disabled,d,f,n.id,e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments)}},debug:function(e,t,n){for(let a=0;a<n.length;a++)Un(e,t,n[a])},custom:function(e,t,n){const a=e.context,r=n.implementation;if("offscreen"===e.renderPass){const t=r.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(r,a.gl,e.transform.customLayerMatrix()),a.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(kn.disabled);const t="3d"===r.renderingMode?new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,On.ReadOnly);a.setDepthMode(t),r.render(a.gl,e.transform.customLayerMatrix()),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}};class Zn{constructor(t,n){this.context=new zn(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.create(),renderTime:0},this.setup(),this.numSublayers=D.maxUnderzooming+D.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ue,this.gpuTimers={}}resize(e,t,n){if(this.width=e*n,this.height=t*n,this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style._order)this.style._layers[e].resize()}setup(){const t=this.context,n=new e.PosArray;n.emplaceBack(0,0),n.emplaceBack(e.EXTENT,0),n.emplaceBack(0,e.EXTENT),n.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Ve.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const a=new e.PosArray;a.emplaceBack(0,0),a.emplaceBack(e.EXTENT,0),a.emplaceBack(0,e.EXTENT),a.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Ve.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const r=new e.RasterBoundsArray;r.emplaceBack(0,0,0,0),r.emplaceBack(e.EXTENT,0,e.EXTENT,0),r.emplaceBack(0,e.EXTENT,0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(r,w.members),this.rasterBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);const i=new e.PosArray;i.emplaceBack(0,0),i.emplaceBack(1,0),i.emplaceBack(0,1),i.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(i,Ve.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);const o=new e.LineStripIndexArray;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);const s=new e.TriangleIndexArray;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s),this.emptyTexture=new l(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const c=this.context.gl;this.stencilClearMode=new kn({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=e.create();e.ortho(a,0,this.width,this.height,0,0,1),e.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,On.disabled,this.stencilClearMode,vn.disabled,An.disabled,_t(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source;const n=this.context,a=n.gl;this.nextStencilID+t.length>256&&this.clearStencil(),n.setColorMode(vn.disabled),n.setDepthMode(On.disabled);const r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of t){const t=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,i=this.style.terrain&&this.style.terrain.getTerrainData(e);r.draw(n,a.TRIANGLES,On.disabled,new kn({func:a.ALWAYS,mask:0},t,255,a.KEEP,a.KEEP,a.REPLACE),vn.disabled,An.disabled,_t(e.posMatrix),i,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new kn({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new kn({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),a=n[n.length-1].overscaledZ,r=n[0].overscaledZ-a+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const e={};for(let n=0;n<r;n++)e[n+a]=new kn({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=r,[e,n]}return[{[a]:kn.disabled},n]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const n=1/8;return new vn([t.CONSTANT_COLOR,t.ONE],new e.Color(n,n,n,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?vn.unblended:vn.alphaBlended}depthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return On.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new On(n||this.context.gl.LEQUAL,t,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.exported.now()),this.imageManager.beginFrame();const a=this.style._order,r=this.style.sourceCaches,i=this.style.terrain&&new Kn(this);for(const e in r){const t=r[e];t.used&&t.prepare(this.context)}const o={},s={},l={};for(const e in r){const t=r[e];o[e]=t.getVisibleCoordinates(),s[e]=o[e].slice().reverse(),l[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<a.length;e++)if(this.style._layers[a[e]].is3D()){this.opaquePassCutoff=e;break}if(i){this.opaquePassCutoff=0;const t=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!e.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||t.length)&&(e.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,n){const a=t.context,r=a.gl,i=vn.unblended,o=new On(r.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");a.bindFramebuffer.set(n.getFramebuffer("depth").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:e.Color.transparent,depth:1});for(const e of l){const l=n.getTerrainData(e.tileID),u=t.transform.calculatePosMatrix(e.tileID.toUnwrapped());c.draw(a,r.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:u},l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain),function(t,n){const a=t.context,r=a.gl,i=vn.unblended,o=new On(r.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.getCoordsTexture(),c=n.sourceCache.getRenderableTiles(),u=t.useProgram("terrainCoords");a.bindFramebuffer.set(n.getFramebuffer("coords").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:e.Color.transparent,depth:1}),n.coordsIndex=[];for(const e of c){const c=n.getTerrainData(e.tileID);a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,l.texture);const d=t.transform.calculatePosMatrix(e.tileID.toUnwrapped());u.draw(a,r.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:d,u_terrain_coords_id:(255-n.coordsIndex.length)/255,u_texture:0},c,"terrain",s.vertexBuffer,s.indexBuffer,s.segments),n.coordsIndex.push(e.tileID.key)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const e of a){const t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;const n=s[t.source];("custom"===t.type||n.length)&&this.renderLayer(this,r[t.source],t,n)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?e.Color.black:e.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!i)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[a[this.currentLayer]],t=r[e.source],n=o[e.source];this._renderTileClippingMasks(e,n),this.renderLayer(this,t,e,n)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const e=this.style._layers[a[this.currentLayer]],t=r[e.source];if(i&&i.renderLayer(e))continue;const n=("symbol"===e.type?l:s)[e.source];this._renderTileClippingMasks(e,o[e.source]),this.renderLayer(this,t,e,n)}if(this.options.showTileBoundaries){let e,t;Object.values(this.style._layers).forEach(n=>{n.source&&!n.isHidden(this.transform.zoom)&&(n.source!==(t&&t.id)&&(t=this.style.sourceCaches[n.source]),(!e||e.getSource().maxzoom<t.getSource().maxzoom)&&(e=t))}),e&&Jn.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&function(e){const t=e.transform.padding;Xn(e,e.transform.height-(t.top||0),3,Pn),Xn(e,t.bottom||0,3,Bn),Yn(e,t.left||0,3,In),Yn(e,e.transform.width-(t.right||0),3,$n);const n=e.transform.centerPoint;!function(e,t,n,a){Hn(e,t-1,n-10,2,20,a),Hn(e,t-10,n-1,20,2,a)}(e,n.x,e.transform.height-n.y,Fn)}(this),this.context.setDefault()}renderLayer(e,t,n,a){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||(a||[]).length)&&(this.id=n.id,this.gpuTimingStart(n),Jn[n.type](e,t,n,a,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;let n=this.gpuTimers[e.id];n||(n=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:t.createQueryEXT()}),n.calls++,t.beginQueryEXT(t.TIME_ELAPSED_EXT,n.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}queryGpuTimers(e){const t={};for(const n in e){const a=e[n],r=this.context.extTimerQuery,i=r.getQueryObjectEXT(a.query,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(a.query),t[n]=i}return t}translatePosMatrix(t,n,a,r,i){if(!a[0]&&!a[1])return t;const o=i?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(o){const e=Math.sin(o),t=Math.cos(o);a=[a[0]*t-a[1]*e,a[0]*e+a[1]*t]}const s=[i?a[0]:ve(n,a[0],this.transform.zoom),i?a[1]:ve(n,a[1],this.transform.zoom),0],l=new Float32Array(16);return e.translate(l,t,s),l}saveTileTexture(e){const t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!t||!n}useProgram(e,t){this.cache=this.cache||{};const n=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[n]||(this.cache[n]=new st(this.context,e,at[e],t,St[e],this._showOverdrawInspector,this.style.terrain)),this.cache[n]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Qn{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(t,n,a){const r=Math.pow(2,a),i=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(a=>{const i=1/(a=e.transformMat4([],a,t))[3]/n*r;return e.mul$1(a,a,[i,i,1/a[3],i])}),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(t=>{const n=e.sub([],i[t[0]],i[t[1]]),a=e.sub([],i[t[2]],i[t[1]]),r=e.normalize([],e.cross([],n,a)),o=-e.dot(r,i[t[1]]);return r.concat(o)});return new Qn(i,o)}}class ea{constructor(t,n){this.min=t,this.max=n,this.center=e.scale$1([],e.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=e.clone$2(this.min),r=e.clone$2(this.max);for(let e=0;e<n.length;e++)a[e]=n[e]?this.min[e]:this.center[e],r[e]=n[e]?this.center[e]:this.max[e];return r[2]=this.max[2],new ea(a,r)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let a=!0;for(let r=0;r<t.planes.length;r++){const i=t.planes[r];let o=0;for(let t=0;t<n.length;t++)e.dot$1(i,n[t])>=0&&o++;if(0===o)return 0;o!==n.length&&(a=!1)}if(a)return 2;for(let e=0;e<3;e++){let n=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let r=0;r<t.points.length;r++){const i=t.points[r][e]-this.min[e];n=Math.min(n,i),a=Math.max(a,i)}if(a<0||n>this.max[e]-this.min[e])return 0}return 1}}class ta{constructor(e=0,t=0,n=0,a=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=n,this.right=a}interpolate(t,n,a){return null!=n.top&&null!=t.top&&(this.top=e.number(t.top,n.top,a)),null!=n.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,n.bottom,a)),null!=n.left&&null!=t.left&&(this.left=e.number(t.left,n.left,a)),null!=n.right&&null!=t.right&&(this.right=e.number(t.right,n.right,a)),this}getCenter(t,n){const a=e.clamp((this.left+t-this.right)/2,0,t),r=e.clamp((this.top+n-this.bottom)/2,0,n);return new e.pointGeometry(a,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class na{constructor(t,n,a,r,i){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===i||!!i,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=null==a?0:a,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ta,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const e=new na(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.tileSize=this.tileSize,e.latRange=this.latRange,e.width=this.width,e.height=this.height,e._center=this._center,e._elevation=this._elevation,e.zoom=this.zoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._calcMatrices(),e}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-e.wrap(t,-180,180)*Math.PI/180;var a;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(a=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a),function(e,t,n){var a=t[0],r=t[1],i=t[2],o=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=a*l+i*s,e[1]=r*l+o*s,e[2]=a*-s+i*l,e[3]=r*-s+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){const n=[new e.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new e.pointGeometry(0,0)),r=this.pointCoordinate(new e.pointGeometry(this.width,0)),i=this.pointCoordinate(new e.pointGeometry(this.width,this.height)),o=this.pointCoordinate(new e.pointGeometry(0,this.height)),s=Math.floor(Math.min(a.x,r.x,i.x,o.x)),l=Math.floor(Math.max(a.x,r.x,i.x,o.x)),c=1;for(let a=s-c;a<=l+c;a++)0!==a&&n.push(new e.UnwrappedTileID(a,t))}return n}coveringTiles(t){var n,a;let r=this.coveringZoomLevel(t);const i=r;if(void 0!==t.minzoom&&r<t.minzoom)return[];void 0!==t.maxzoom&&r>t.maxzoom&&(r=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),s=e.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,r),c=[l*o.x,l*o.y,0],u=[l*s.x,l*s.y,0],d=Qn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r);let p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=r);const m=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,b=e=>({aabb:new ea([e*l,0,0],[(e+1)*l,l,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),h=[],f=[],g=r,_=t.reparseOverscaled?i:r;if(this._renderWorldCopies)for(let e=1;e<=3;e++)h.push(b(-e)),h.push(b(e));for(h.push(b(0));h.length>0;){const r=h.pop(),i=r.x,o=r.y;let s=r.fullyVisible;if(!s){const e=r.aabb.intersects(d);if(0===e)continue;s=2===e}const l=t.terrain?c:u,b=r.aabb.distanceX(l),y=r.aabb.distanceY(l),M=Math.max(Math.abs(b),Math.abs(y)),v=m+(1<<g-r.zoom)-2;if(r.zoom===g||M>v&&r.zoom>=p){const t=g-r.zoom,n=c[0]-.5-(i<<t),a=c[1]-.5-(o<<t);f.push({tileID:new e.OverscaledTileID(r.zoom===g?_:r.zoom,r.wrap,r.zoom,i,o),distanceSq:e.sqrLen([u[0]-.5-i,u[1]-.5-o]),tileDistanceToCamera:Math.sqrt(n*n+a*a)})}else for(let l=0;l<4;l++){const c=(i<<1)+l%2,u=(o<<1)+(l>>1),d=r.zoom+1;let p=r.aabb.quadrant(l);if(t.terrain){const i=new e.OverscaledTileID(d,r.wrap,d,c,u),o=t.terrain.getMinMaxElevation(i),s=null!==(n=o.minElevation)&&void 0!==n?n:this.elevation,l=null!==(a=o.maxElevation)&&void 0!==a?a:this.elevation;p=new ea([p.min[0],p.min[1],s],[p.max[0],p.max[1],l])}h.push({aabb:p,zoom:d,x:c,y:u,wrap:r.wrap,fullyVisible:s})}}return f.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const n=e.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new e.pointGeometry(e.mercatorXfromLng(t.lng)*this.worldSize,e.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new e.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(e){this.freezeElevation||(this.elevation=e?this.getElevation(this._center,e):0)}getElevation(t,n){const a=e.MercatorCoordinate.fromLngLat(t),r=(1<<this.tileZoom)*e.EXTENT,i=a.x*r,o=a.y*r,s=Math.floor(i/e.EXTENT),l=Math.floor(o/e.EXTENT),c=new e.OverscaledTileID(this.tileZoom,0,this.tileZoom,s,l);return n.getElevation(c,i%e.EXTENT,o%e.EXTENT,e.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=this.getElevation(n,t);if(!(this.elevation-a))return;const r=this.getCameraPosition(),i=e.MercatorCoordinate.fromLngLat(r.lngLat,r.altitude),o=e.MercatorCoordinate.fromLngLat(n,a),s=i.x-o.x,l=i.y-o.y,c=i.z-o.z,u=Math.sqrt(s*s+l*l+c*c),d=this.scaleZoom(this.cameraToCenterDistance/u/this.tileSize);this._elevation=a,this._center=n,this.zoom=d}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),r=this.pointCoordinate(this.centerPoint),i=this.locationCoordinate(t),o=new e.MercatorCoordinate(i.x-(a.x-r.x),i.y-(a.y-r.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),this.getElevation(e,t),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(t){return e.MercatorCoordinate.fromLngLat(t)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(t,n){if(n){const e=n.pointCoordinate(t);if(null!=e)return e}const a=[t.x,t.y,0,1],r=[t.x,t.y,1,1];e.transformMat4(a,a,this.pixelMatrixInverse),e.transformMat4(r,r,this.pixelMatrixInverse);const i=a[3],o=r[3],s=a[1]/i,l=r[1]/o,c=a[2]/i,u=r[2]/o,d=c===u?0:(0-c)/(u-c);return new e.MercatorCoordinate(e.number(a[0]/i,r[0]/o,d)/this.worldSize,e.number(s,l,d)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const r=[t.x*this.worldSize,t.y*this.worldSize,n,1];return e.transformMat4(r,r,a),new e.pointGeometry(r[0]/r[3],r[1]/r[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return(new e.LngLatBounds).extend(this.pointLocation(new e.pointGeometry(0,t))).extend(this.pointLocation(new e.pointGeometry(this.width,t))).extend(this.pointLocation(new e.pointGeometry(this.width,this.height))).extend(this.pointLocation(new e.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new e.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,r=n?this._alignedPosMatrixCache:this._posMatrixCache;if(r[a])return r[a];const i=t.canonical,o=this.worldSize/this.zoomScale(i.z),s=i.x+Math.pow(2,i.z)*t.wrap,l=e.identity(new Float64Array(16));return e.translate(l,l,[s*o,i.y*o,0]),e.scale(l,l,[o/e.EXTENT,o/e.EXTENT,1]),e.multiply(l,n?this.alignedProjMatrix:this.projMatrix,l),r[a]=new Float32Array(l),r[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,r,i=-90,o=90,s=-180,l=180;const c=this.size,u=this._unmodified;if(this.latRange){const n=this.latRange;i=e.mercatorYfromLat(n[1])*this.worldSize,o=e.mercatorYfromLat(n[0])*this.worldSize,t=o-i<c.y?c.y/(o-i):0}if(this.lngRange){const t=this.lngRange;s=e.wrap(e.mercatorXfromLng(t[0])*this.worldSize,0,this.worldSize),l=e.wrap(e.mercatorXfromLng(t[1])*this.worldSize,0,this.worldSize),l<s&&(l+=this.worldSize),n=l-s<c.x?c.x/(l-s):0}const d=this.point,p=Math.max(n||0,t||0);if(p)return this.center=this.unproject(new e.pointGeometry(n?(l+s)/2:d.x,t?(o+i)/2:d.y)),this.zoom+=this.scaleZoom(p),this._unmodified=u,void(this._constraining=!1);if(this.latRange){const e=d.y,t=c.y/2;e-t<i&&(r=i+t),e+t>o&&(r=o-t)}if(this.lngRange){const t=(s+l)/2,n=e.wrap(d.x,t-this.worldSize/2,t+this.worldSize/2),r=c.x/2;n-r<s&&(a=s+r),n+r>l&&(a=l-r)}void 0===a&&void 0===r||(this.center=this.unproject(new e.pointGeometry(void 0!==a?a:d.x,void 0!==r?r:d.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let r=e.identity(new Float64Array(16));e.scale(r,r,[this.width/2,-this.height/2,1]),e.translate(r,r,[1,-1,0]),this.labelPlaneMatrix=r,r=e.identity(new Float64Array(16)),e.scale(r,r,[1,-1,1]),e.translate(r,r,[-1,-1,0]),e.scale(r,r,[2/this.width,2/this.height,1]),this.glCoordMatrix=r,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const i=Math.PI/2+this._pitch,o=this._fov*(.5+t.y/this.height),s=Math.sin(o)*this.cameraToSeaLevelDistance/Math.sin(e.clamp(Math.PI-i-o,.01,Math.PI-.01)),l=this.getHorizon(),c=2*Math.atan(l/this.cameraToCenterDistance)*(.5+t.y/(2*l)),u=Math.sin(c)*this.cameraToSeaLevelDistance/Math.sin(e.clamp(Math.PI-i-c,.01,Math.PI-.01)),d=Math.cos(Math.PI/2-this._pitch)*s+this.cameraToSeaLevelDistance,p=Math.cos(Math.PI/2-this._pitch)*u+this.cameraToSeaLevelDistance,m=1.01*Math.min(d,p),b=this.height/50;r=new Float64Array(16),e.perspective(r,this._fov,this.width/this.height,b,m),r[8]=2*-t.x/this.width,r[9]=2*t.y/this.height,e.scale(r,r,[1,-1,1]),e.translate(r,r,[0,0,-this.cameraToCenterDistance]),e.rotateX(r,r,this._pitch),e.rotateZ(r,r,this.angle),e.translate(r,r,[-n,-a,0]),this.mercatorMatrix=e.scale([],r,[this.worldSize,this.worldSize,this.worldSize]),e.scale(r,r,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,r),e.translate(r,r,[0,0,-this.elevation]),this.projMatrix=r,this.invProjMatrix=e.invert([],r),this.pixelMatrix3D=e.multiply(new Float64Array(16),this.labelPlaneMatrix,r);const h=this.width%2/2,f=this.height%2/2,g=Math.cos(this.angle),_=Math.sin(this.angle),y=n-Math.round(n)+g*h+_*f,M=a-Math.round(a)+g*f+_*h,v=new Float64Array(r);if(e.translate(v,v,[y>.5?y-1:y,M>.5?M-1:M,0]),this.alignedProjMatrix=v,r=e.invert(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new e.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(1===t.length)return[t[0],n];{let a=n.x,r=n.y,i=n.x,o=n.y;for(const e of t)a=Math.min(a,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x),o=Math.max(o,e.y);return[new e.pointGeometry(a,r),new e.pointGeometry(i,r),new e.pointGeometry(i,o),new e.pointGeometry(a,o),new e.pointGeometry(a,r)]}}}class aa{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(e,t){let n=!1,a=null;const r=()=>{a=null,n&&(e(),a=setTimeout(r,300),n=!1)};return()=>(n=!0,a||r(),a)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){const t=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,a=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,a),i=Math.round(t.lng*r)/r,o=Math.round(t.lat*r)/r,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${i}/${o}/${n}`:`${n}/${o}/${i}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+="/"+Math.round(l)),this._hashName){const e=this._hashName;let t=!1;const n=window.location.hash.slice(1).split("&").map(n=>{const a=n.split("=")[0];return a===e?(t=!0,`${a}=${c}`):n}).filter(e=>e);return t||n.push(`${e}=${c}`),"#"+n.join("&")}return"#"+c}_getCurrentHash(){const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._getCurrentHash();if(e.length>=3&&!e.some(e=>isNaN(e))){const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){const e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch(e){}}}const ra={linearity:.3,easing:e.bezier(0,0,.3,1)},ia=e.extend({deceleration:2500,maxSpeed:1400},ra),oa=e.extend({deceleration:20,maxSpeed:1400},ra),sa=e.extend({deceleration:1e3,maxSpeed:360},ra),la=e.extend({deceleration:1e3,maxSpeed:90},ra);class ca{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=e.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new e.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,e.panDelta&&n.pan._add(e.panDelta),e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(n.pan.mag()){const i=da(n.pan.mag(),a,e.extend({},ia,t||{}));r.offset=n.pan.mult(i.amount/n.pan.mag()),r.center=this._map.transform.center,ua(r,i)}if(n.zoom){const e=da(n.zoom,a,oa);r.zoom=this._map.transform.zoom+e.amount,ua(r,e)}if(n.bearing){const t=da(n.bearing,a,sa);r.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),ua(r,t)}if(n.pitch){const e=da(n.pitch,a,la);r.pitch=this._map.transform.pitch+e.amount,ua(r,e)}if(r.zoom||r.bearing){const e=void 0===n.pinchAround?n.around:n.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),e.extend(r,{noMoveStart:!0})}}function ua(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function da(t,n,a){const{maxSpeed:r,linearity:i,deceleration:o}=a,s=e.clamp(t*i/(n/1e3),-r,r),l=Math.abs(s)/(o*i);return{easing:a.easing,duration:1e3*l,amount:s*(l/2)}}class pa extends e.Event{constructor(t,n,a,r={}){const o=i.mousePos(n.getCanvasContainer(),a),s=n.unproject(o);super(t,e.extend({point:o,lngLat:s,originalEvent:a},r)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ma extends e.Event{constructor(t,n,a){const r="touchend"===t?a.changedTouches:a.touches,o=i.touchPos(n.getCanvasContainer(),r),s=o.map(e=>n.unproject(e)),l=o.reduce((e,t,n,a)=>e.add(t.div(a.length)),new e.pointGeometry(0,0));super(t,{points:o,point:l,lngLats:s,lngLat:n.unproject(l),originalEvent:a}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ba extends e.Event{constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ha{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ba(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new pa(e.type,this._map,e))}mouseup(e){this._map.fire(new pa(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new pa(e.type,this._map,e))}dblclick(e){return this._firePreventable(new pa(e.type,this._map,e))}mouseover(e){this._map.fire(new pa(e.type,this._map,e))}mouseout(e){this._map.fire(new pa(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ma(e.type,this._map,e))}touchmove(e){this._map.fire(new ma(e.type,this._map,e))}touchend(e){this._map.fire(new ma(e.type,this._map,e))}touchcancel(e){this._map.fire(new ma(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fa{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new pa(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new pa("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new pa(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ga{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(i.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=n,this._box||(this._box=i.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));const r=Math.min(a.x,n.x),o=Math.max(a.x,n.x),s=Math.min(a.y,n.y),l=Math.max(a.y,n.y);i.setTransform(this._box,`translate(${r}px,${s}px)`),this._box.style.width=o-r+"px",this._box.style.height=l-s+"px"}mouseupWindow(t,n){if(!this._active)return;if(0!==t.button)return;const a=this._startPos,r=n;if(this.reset(),i.suppressClick(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(a,r,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new e.Event(t,{originalEvent:n}))}}function _a(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const n={};for(let a=0;a<e.length;a++)n[e[a].identifier]=t[a];return n}class ya{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(t){const n=new e.pointGeometry(0,0);for(const e of t)n._add(e);return n.div(t.length)}(n),this.touches=_a(a,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;const a=_a(n,t);for(const e in this.touches){const t=this.touches[e],n=a[e];(!n||n.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Ma{constructor(e){this.singleTap=new ya(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){const a=this.singleTap.touchend(e,t,n);if(a){const t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(a)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class va{constructor(){this._zoomIn=new Ma({numTouches:1,numTaps:2}),this._zoomOut=new Ma({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){const a=this._zoomIn.touchend(e,t,n),r=this._zoomOut.touchend(e,t,n);return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(a)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const za={0:1,2:2};class Oa{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const n=i.mouseButton(e);this._correctButton(e,n)&&(this._lastPoint=t,this._eventButton=n)}mousemoveWindow(e,t){const n=this._lastPoint;if(n)if(e.preventDefault(),function(e,t){const n=za[t];return void 0===e.buttons||(e.buttons&n)!==n}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(n,t)}mouseupWindow(e){this._lastPoint&&i.mouseButton(e)===this._eventButton&&(this._moved&&i.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ka extends Oa{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0)}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return{around:t,panDelta:t.sub(e)}}}class Aa extends Oa{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const n=.8*(t.x-e.x);if(n)return this._active=!0,{bearingDelta:n}}contextmenu(e){e.preventDefault()}}class xa extends Oa{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const n=-.5*(t.y-e.y);if(n)return this._active=!0,{pitchDelta:n}}contextmenu(e){e.preventDefault()}}class wa{constructor(e,t){this._minTouches=e.cooperativeGestures?2:1,this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._map._cooperativeGestures&&(2===this._minTouches&&n.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(e,!1,n.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(n.length<this._minTouches))return e.preventDefault(),this._calculateTransform(e,t,n)}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&n.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const r=_a(a,n),i=new e.pointGeometry(0,0),o=new e.pointGeometry(0,0);let s=0;for(const e in r){const t=r[e],n=this._touches[e];n&&(i._add(t),o._add(t.sub(n)),s++,r[e]=t)}if(this._touches=r,s<this._minTouches||!o.mag())return;const l=o.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:i.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Na{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(e){}_move(e,t,n){return{}}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();const[a,r]=this._firstTwoTouches,i=qa(n,t,a),o=qa(n,t,r);if(!i||!o)return;const s=this._aroundCenter?null:i.add(o).div(2);return this._move([i,o],s,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;const[a,r]=this._firstTwoTouches,o=qa(n,t,a),s=qa(n,t,r);o&&s||(this._active&&i.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function qa(e,t,n){for(let a=0;a<e.length;a++)if(e[a].identifier===n)return t[a]}function Ea(e,t){return Math.log(e/t)/Math.LN2}class ja extends Na{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const n=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Ea(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ea(this._distance,n),pinchAround:t}}}function Wa(e,t){return 180*e.angleWith(t)/Math.PI}class La extends Na{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t){const n=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Wa(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,n=Wa(e,this._startVector);return Math.abs(n)<t}}function Sa(e){return Math.abs(e.y)>Math.abs(e.x)}class Ta extends Na{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,n){super.touchstart(e,t,n),this._currentTouchCount=n.length}_start(e){this._lastPoints=e,Sa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const a=e[0].sub(this._lastPoints[0]),r=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,r,n.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(a.y+r.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,n){if(void 0!==this._valid)return this._valid;const a=e.mag()>=2,r=t.mag()>=2;if(!a&&!r)return;if(!a||!r)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const i=e.y>0==t.y>0;return Sa(e)&&Sa(t)&&i}}const Ca={panStep:100,bearingStep:15,pitchStep:10};class Ra{constructor(){const e=Ca;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,a=0,r=0,i=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),i=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),i=1);break;default:return}return this._rotationDisabled&&(n=0,a=0),{cameraAnimation:o=>{const s=o.getZoom();o.easeTo({duration:300,easeId:"keyboardHandler",easing:Da,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:o.getBearing()+n*this._bearingStep,pitch:o.getPitch()+a*this._pitchStep,offset:[-r*this._panStep,-i*this._panStep],center:o.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Da(e){return e*(2-e)}const Pa=4.000244140625;class Ba{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=e.exported.now(),r=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==n&&n%Pa==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=i.mousePos(this._el,t);this._around=e.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Pa?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const a="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(a*n))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:t.zoom,a=this._startZoom,r=this._easing;let i,o=!1;if("wheel"===this._type&&a&&r){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),s=r(t);i=e.number(a,n,s),t<1?this._frameId||(this._frameId=!0):o=!0}else i=n,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:i-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=e.ease;if(this._prevEase){const t=this._prevEase,a=(e.exported.now()-t.start)/t.duration,r=t.easing(a+.01)-t.easing(a),i=.27/Math.sqrt(r*r+1e-4)*.01,o=Math.sqrt(.0729-i*i);n=e.bezier(i,o,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ia{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class $a{constructor(){this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(e.shiftKey?-1:1),around:n.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fa{constructor(){this._tap=new Ma({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,t,n){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=t[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(e,t,n))}touchmove(e,t,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const a=t[0],r=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,n)}touchend(e,t,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(e,t,n)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xa{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ya{constructor(e,t,n){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ha{constructor(e,t,n,a){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ua=e=>e.zoom||e.drag||e.pitch||e.rotate;class Va extends e.Event{}function Ga(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ka{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ca(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),e.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,n]of this._listeners)i.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[e,t,n]of this._listeners)i.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){const t=this._map,n=t.getCanvasContainer();this._add("mapEvent",new ha(t,e));const a=t.boxZoom=new ga(t,e);this._add("boxZoom",a);const r=new va,i=new $a;t.doubleClickZoom=new Ia(i,r),this._add("tapZoom",r),this._add("clickZoom",i);const o=new Fa;this._add("tapDragZoom",o);const s=t.touchPitch=new Ta(t);this._add("touchPitch",s);const l=new Aa(e),c=new xa(e);t.dragRotate=new Ya(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new ka(e),d=new wa(e,t);t.dragPan=new Xa(n,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]);const p=new La,m=new ja;t.touchZoomRotate=new Ha(n,m,p,o),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]);const b=t.scrollZoom=new Ba(t,this);this._add("scrollZoom",b,["mousePan"]);const h=t.keyboard=new Ra;this._add("keyboard",h),this._add("blockableMapEvent",new fa(t));for(const n of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[n]&&t[n].enable(e[n])}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ua(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,n){for(const a in e)if(a!==n&&(!t||t.indexOf(a)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,e.type+"Window")}_getMapTouches(e){const t=[];for(const n of e)this._el.contains(n.target)&&t.push(n);return t}handleEvent(e,t){if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===e.type?void 0:e,a={needsRenderFrame:!1},r={},o={},s=e.touches,l=s?this._getMapTouches(s):void 0,c=l?i.touchPos(this._el,l):i.mousePos(this._el,e);for(const{handlerName:i,handler:s,allowed:u}of this._handlers){if(!s.isEnabled())continue;let d;this._blockedByActive(o,u,i)?s.reset():s[t||e.type]&&(d=s[t||e.type](e,c,l),this.mergeHandlerResult(a,r,d,i,n),d&&d.needsRenderFrame&&this._triggerRenderFrame()),(d||s.isActive())&&(o[i]=s)}const u={};for(const e in this._previousActiveHandlers)o[e]||(u[e]=n);this._previousActiveHandlers=o,(Object.keys(u).length||Ga(a))&&(this._changes.push([a,r,u]),this._triggerRenderFrame()),(Object.keys(o).length||Ga(a))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:d}=a;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(t,n,a,r,i){if(!a)return;e.extend(t,a);const o={handlerName:r,originalEvent:a.originalEvent||i};void 0!==a.zoomDelta&&(n.zoom=o),void 0!==a.panDelta&&(n.drag=o),void 0!==a.pitchDelta&&(n.pitch=o),void 0!==a.bearingDelta&&(n.rotate=o)}_applyChanges(){const t={},n={},a={};for(const[r,i,o]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new e.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),e.extend(n,i),e.extend(a,o);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const r=this._map,i=r.transform,o=r.style&&r.style.terrain;if(!(Ga(t)||o&&this._drag))return this._fireEvents(n,a,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:d,pinchAround:p}=t;void 0!==p&&(d=p),r._stop(!0),d=d||r.transform.centerPoint;const m=i.pointLocation(s?d.sub(s):d);c&&(i.bearing+=c),u&&(i.pitch+=u),l&&(i.zoom+=l),o?n.drag&&!this._drag?(this._drag={center:i.centerPoint,lngLat:i.pointLocation(d),point:d,handlerName:n.drag.handlerName},r.fire(new e.Event("freezeElevation",{freeze:!0}))):this._drag&&a[this._drag.handlerName]?(r.fire(new e.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(i.center=i.pointLocation(i.centerPoint.sub(s))):i.setLocationAtPoint(m,d),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const r=Ua(this._eventsInProgress),i=Ua(t),o={};for(const e in t){const{originalEvent:n}=t[e];this._eventsInProgress[e]||(o[e+"start"]=n),this._eventsInProgress[e]=t[e]}!r&&i&&this._fireEvent("movestart",i.originalEvent);for(const e in o)this._fireEvent(e,o[e]);i&&this._fireEvent("move",i.originalEvent);for(const e in t){const{originalEvent:n}=t[e];this._fireEvent(e,n)}const s={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:a}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=n[t]||a,s[e+"end"]=l)}for(const e in s)this._fireEvent(e,s[e]);const c=Ua(this._eventsInProgress);if(a&&(r||i)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;t?(n(t.bearing||this._map.getBearing())&&(t.bearing=0),this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new e.Event("moveend",{originalEvent:l})),n(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new e.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Va("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Ja={extend:(t,...n)=>e.extend(t,...n),run(e){e()},logToElement(e,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+="<br>"+e)}};class Za extends e.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,e.bindAll(["_renderFrameCallback"],this)}getCenter(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,n,a){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(e.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,n,a){return this.easeTo(e.extend({zoom:t},n),a)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,n,a){return this.easeTo(e.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,e.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(t,n){t=e.LngLatBounds.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,r){const i={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=e.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const e=r.padding;r.padding={top:e,bottom:e,right:e,left:e}}r.padding=e.extend(i,r.padding);const o=this.transform,s=o.padding,l=o.project(e.LngLat.convert(t)),c=o.project(e.LngLat.convert(n)),u=l.rotate(-a*Math.PI/180),d=c.rotate(-a*Math.PI/180),p=new e.pointGeometry(Math.max(u.x,d.x),Math.max(u.y,d.y)),m=new e.pointGeometry(Math.min(u.x,d.x),Math.min(u.y,d.y)),b=p.sub(m),h=(o.width-(s.left+s.right+r.padding.left+r.padding.right))/b.x,f=(o.height-(s.top+s.bottom+r.padding.top+r.padding.bottom))/b.y;if(f<0||h<0)return void e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const g=Math.min(o.scaleZoom(o.scale*Math.min(h,f)),r.maxZoom),_=e.pointGeometry.convert(r.offset),y=new e.pointGeometry((r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2).rotate(a*Math.PI/180),M=_.add(y).mult(o.scale/o.zoomScale(g));return{center:o.unproject(l.add(c).div(2).sub(M)),zoom:g,bearing:a}}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(t,n,a,r,i){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(e.pointGeometry.convert(t)),this.transform.pointLocation(e.pointGeometry.convert(n)),a,r),r,i)}_fitInternal(t,n,a){return t?(delete(n=e.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this.transform;let r=!1,i=!1,o=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(r=!0,a.zoom=+t.zoom),void 0!==t.center&&(a.center=e.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(i=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(o=!0,a.pitch=+t.pitch),null==t.padding||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this.fire(new e.Event("movestart",n)).fire(new e.Event("move",n)),r&&this.fire(new e.Event("zoomstart",n)).fire(new e.Event("zoom",n)).fire(new e.Event("zoomend",n)),i&&this.fire(new e.Event("rotatestart",n)).fire(new e.Event("rotate",n)).fire(new e.Event("rotateend",n)),o&&this.fire(new e.Event("pitchstart",n)).fire(new e.Event("pitch",n)).fire(new e.Event("pitchend",n)),this.fire(new e.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,r=0){const i=e.MercatorCoordinate.fromLngLat(t,n),o=e.MercatorCoordinate.fromLngLat(a,r),s=o.x-i.x,l=o.y-i.y,c=o.z-i.z,u=Math.hypot(s,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const d=Math.hypot(s,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/u/this.transform.tileSize),m=180*Math.atan2(s,-l)/Math.PI;let b=180*Math.acos(d/u)/Math.PI;return b=c<0?90-b:90+b,{center:o.toLngLat(),zoom:p,pitch:b,bearing:m}}easeTo(t,n){this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||!t.essential&&e.exported.prefersReducedMotion)&&(t.duration=0);const a=this.transform,r=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?+t.zoom:r,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:a.padding,p=e.pointGeometry.convert(t.offset);let m=a.centerPoint.add(p);const b=a.pointLocation(m),h=e.LngLat.convert(t.center||b);this._normalizeCenter(h);const f=a.project(b),g=a.project(h).sub(f),_=a.zoomScale(l-r);let y,M;t.around&&(y=e.LngLat.convert(t.around),M=a.locationPoint(y));const v={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==r,this._rotating=this._rotating||i!==c,this._pitching=this._pitching||u!==o,this._padding=!a.isPaddingEqual(d),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,v),this._ease(t=>{if(this._zooming&&(a.zoom=e.number(r,l,t)),this._rotating&&(a.bearing=e.number(i,c,t)),this._pitching&&(a.pitch=e.number(o,u,t)),this._padding&&(a.interpolatePadding(s,d,t),m=a.centerPoint.add(p)),y)a.setLocationAtPoint(y,M);else{const e=a.zoomScale(a.zoom-r),n=l>r?Math.min(2,_):Math.max(.5,_),i=Math.pow(n,1-t),o=a.unproject(f.add(g.mult(t*i)).mult(e));a.setLocationAtPoint(a.renderWorldCopies?o.wrap():o,m)}this._fireMoveEvents(n)},e=>{this._afterEase(n,e)},t),this}_prepareEase(t,n,a={}){this._moving=!0,this.fire(new e.Event("freezeElevation",{freeze:!0})),n||a.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new e.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new e.Event("freezeElevation",{freeze:!1}));const a=this._zooming,r=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new e.Event("zoomend",t)),r&&this.fire(new e.Event("rotateend",t)),i&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}flyTo(t,n){if(!t.essential&&e.exported.prefersReducedMotion){const a=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(a,n)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const a=this.transform,r=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,a.minZoom,a.maxZoom):r,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:a.padding,p=a.zoomScale(l-r),m=e.pointGeometry.convert(t.offset);let b=a.centerPoint.add(m);const h=a.pointLocation(b),f=e.LngLat.convert(t.center||h);this._normalizeCenter(f);const g=a.project(h),_=a.project(f).sub(g);let y=t.curve;const M=Math.max(a.width,a.height),v=M/p,z=_.mag();if("minZoom"in t){const n=e.clamp(Math.min(t.minZoom,r,l),a.minZoom,a.maxZoom),i=M/a.zoomScale(n-r);y=Math.sqrt(i/z*2)}const O=y*y;function k(e){const t=(v*v-M*M+(e?-1:1)*O*O*z*z)/(2*(e?v:M)*O*z);return Math.log(Math.sqrt(t*t+1)-t)}function A(e){return(Math.exp(e)-Math.exp(-e))/2}function x(e){return(Math.exp(e)+Math.exp(-e))/2}const w=k(0);let N=function(e){return x(w)/x(w+y*e)},q=function(e){return M*((x(w)*(A(t=w+y*e)/x(t))-A(w))/O)/z;var t},E=(k(1)-w)/y;if(Math.abs(z)<1e-6||!isFinite(E)){if(Math.abs(M-v)<1e-6)return this.easeTo(t,n);const e=v<M?-1:1;E=Math.abs(Math.log(v/M))/y,q=function(){return 0},N=function(t){return Math.exp(e*y*t)}}return t.duration="duration"in t?+t.duration:1e3*E/("screenSpeed"in t?+t.screenSpeed/y:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=i!==c,this._pitching=u!==o,this._padding=!a.isPaddingEqual(d),this._prepareEase(n,!1),this._ease(t=>{const p=t*E,h=1/N(p);a.zoom=1===t?l:r+a.scaleZoom(h),this._rotating&&(a.bearing=e.number(i,c,t)),this._pitching&&(a.pitch=e.number(o,u,t)),this._padding&&(a.interpolatePadding(s,d,t),b=a.centerPoint.add(m));const y=1===t?f:a.unproject(g.add(_.mult(q(p))).mult(h));a.setLocationAtPoint(a.renderWorldCopies?y.wrap():y,b),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,n,a){!1===a.animate||0===a.duration?(t(1),n()):(this._easeStart=e.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=e.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(e){const t=this.transform;if(!t.renderWorldCopies||t.lngRange)return;const n=e.lng-t.center.lng;e.lng+=n>180?-360:n<-180?360:0}}class Qa{constructor(t={}){this.options=t,e.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=i.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=i.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){const n=this._map._getUIString("AttributionControl."+t);e.title=n,e.setAttribute("aria-label",n)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(e){!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"!=typeof e?"":e)):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.sourceCaches;for(const n in t){const a=t[n];if(a.used||a.usedForTerrain){const t=a.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let a=n+1;a<e.length;a++)if(e[a].indexOf(t)>=0)return!1;return!0});const n=e.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class er{constructor(t={}){this.options=t,e.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=i.create("div","maplibregl-ctrl mapboxgl-ctrl");const t=i.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact","mapboxgl-compact"):t.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(const t of n)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const nr={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},ar={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},rr={showCompass:!0,showZoom:!0,visualizePitch:!1};class ir{constructor(t,n,a=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Aa({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,a&&(this.mousePitch=new xa({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener(n,"mousedown",this.mousedown),i.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(n,"touchmove",this.touchmove),i.addEventListener(n,"touchend",this.touchend),i.addEventListener(n,"touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),i.disableDrag()}move(e,t){const n=this.map,a=this.mouseRotate.mousemoveWindow(e,t);if(a&&a.bearingDelta&&n.setBearing(n.getBearing()+a.bearingDelta),this.mousePitch){const a=this.mousePitch.mousemoveWindow(e,t);a&&a.pitchDelta&&n.setPitch(n.getPitch()+a.pitchDelta)}}off(){const e=this.element;i.removeEventListener(e,"mousedown",this.mousedown),i.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(e,"touchmove",this.touchmove),i.removeEventListener(e,"touchend",this.touchend),i.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){i.enableDrag(),i.removeEventListener(window,"mousemove",this.mousemove),i.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),i.mousePos(this.element,t)),i.addEventListener(window,"mousemove",this.mousemove),i.addEventListener(window,"mouseup",this.mouseup)}mousemove(e){this.move(e,i.mousePos(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function or(t,n,a){if(t=new e.LngLat(t.lng,t.lat),n){const r=new e.LngLat(t.lng-360,t.lat),i=new e.LngLat(t.lng+360,t.lat),o=a.locationPoint(t).distSqr(n);a.locationPoint(r).distSqr(n)<o?t=r:a.locationPoint(i).distSqr(n)<o&&(t=i)}for(;Math.abs(t.lng-a.center.lng)>180;){const e=a.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;t.lng>a.center.lng?t.lng-=360:t.lng+=360}return t}const sr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function lr(e,t,n){const a=e.classList;for(const e in sr)a.remove(`maplibregl-${n}-anchor-${e}`,`mapboxgl-${n}-anchor-${e}`);a.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class cr extends e.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=e.extend({element:t},n)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=e.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");const n=i.createNS("http://www.w3.org/2000/svg","svg"),a=41,r=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",a+"px"),n.setAttributeNS(null,"width",r+"px"),n.setAttributeNS(null,"viewBox",`0 0 ${r} ${a}`);const o=i.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const s=i.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const e of c){const t=i.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),l.appendChild(t)}const u=i.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const d=i.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(d);const p=i.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const m=i.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),p.appendChild(m);const b=i.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"transform","translate(6.0, 7.0)"),b.setAttributeNS(null,"fill","#FFFFFF");const h=i.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"transform","translate(8.0, 8.0)");const f=i.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");const g=i.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),h.appendChild(f),h.appendChild(g),s.appendChild(l),s.appendChild(u),s.appendChild(p),s.appendChild(b),s.appendChild(h),n.appendChild(s),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(n),this._offset=e.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),lr(this._element,this._anchor,"marker"),this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,n=13.5,a=Math.sqrt(Math.pow(n,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[a,-1*(t-n+a)],"bottom-right":[-a,-1*(t-n+a)],left:[n,-1*(t-n)],right:[-n,-1*(t-n)]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(e){const t=e.code,n=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==n&&13!==n||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}_update(e){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=or(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let t="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?t=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(t=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),e&&"moveend"!==e.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${sr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${t}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const e=this._map.unproject(this._pos),t=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=e.distanceTo(this._lngLat)>20*t?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=e.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.Event("dragstart"))),this.fire(new e.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new e.Event("dragend")),this._state="inactive"}_addDragHandler(e){this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ur={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let dr,pr=0,mr=!1;const br={maxWidth:100,unit:"metric"};function hr(e,t,n){const a=n&&n.maxWidth||100,r=e._container.clientHeight/2,i=e.unproject([0,r]),o=e.unproject([a,r]),s=i.distanceTo(o);if(n&&"imperial"===n.unit){const n=3.2808*s;n>5280?fr(t,a,n/5280,e._getUIString("ScaleControl.Miles")):fr(t,a,n,e._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?fr(t,a,s/1852,e._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fr(t,a,s/1e3,e._getUIString("ScaleControl.Kilometers")):fr(t,a,s,e._getUIString("ScaleControl.Meters"))}function fr(e,t,n,a){const r=function(e){const t=Math.pow(10,(""+Math.floor(e)).length-1);let n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(n),t*n}(n);e.style.width=t*(r/n)+"px",e.innerHTML=`${r}&nbsp;${a}`}const gr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},_r=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function yr(t){if(t){if("number"==typeof t){const n=Math.round(Math.sqrt(.5*Math.pow(t,2)));return{center:new e.pointGeometry(0,0),top:new e.pointGeometry(0,t),"top-left":new e.pointGeometry(n,n),"top-right":new e.pointGeometry(-n,n),bottom:new e.pointGeometry(0,-t),"bottom-left":new e.pointGeometry(n,-n),"bottom-right":new e.pointGeometry(-n,-n),left:new e.pointGeometry(t,0),right:new e.pointGeometry(-t,0)}}if(t instanceof e.pointGeometry||Array.isArray(t)){const n=e.pointGeometry.convert(t);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:e.pointGeometry.convert(t.center||[0,0]),top:e.pointGeometry.convert(t.top||[0,0]),"top-left":e.pointGeometry.convert(t["top-left"]||[0,0]),"top-right":e.pointGeometry.convert(t["top-right"]||[0,0]),bottom:e.pointGeometry.convert(t.bottom||[0,0]),"bottom-left":e.pointGeometry.convert(t["bottom-left"]||[0,0]),"bottom-right":e.pointGeometry.convert(t["bottom-right"]||[0,0]),left:e.pointGeometry.convert(t.left||[0,0]),right:e.pointGeometry.convert(t.right||[0,0])}}return yr(new e.pointGeometry(0,0))}const Mr={supported:t,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:class extends Za{constructor(t){var n;if(e.PerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},ar,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new na(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._interactive=t.interactive,this._cooperativeGestures=t.cooperativeGestures,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new tr,this._controls=[],this._mapId=e.uniqueId(),this._locale=e.extend({},nr,t.locale),this._clickTolerance=t.clickTolerance,this._pixelRatio=null!==(n=t.pixelRatio)&&void 0!==n?n:devicePixelRatio,this._requestManager=new o(t.transformRequest),"string"==typeof t.container){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Ka(this,t),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=t.hash&&new aa("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Qa({customAttribution:t.customAttribution})),t.maplibreLogo&&this.addControl(new er,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.Event(t.dataType+"data",t))}),this.on("dataloading",t=>{this.fire(new e.Event(t.dataType+"dataloading",t))}),this.on("dataabort",t=>{this.fire(new e.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(t,n){if(void 0===n&&(n=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[n];return-1!==n.indexOf("bottom")?r.insertBefore(a,r.firstChild):r.appendChild(a),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(t);return n>-1&&this._controls.splice(n,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,n,a){return null==a&&this.style.terrain&&(a=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(e,t,n,a)}resize(t){const n=this._containerDimensions(),a=n[0],r=n[1];this._resizeCanvas(a,r,this.getPixelRatio()),this.transform.resize(a,r),this.painter.resize(a,r,this.getPixelRatio());const i=!this._moving;return i&&(this.stop(),this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t))),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(e){const[t,n]=this._containerDimensions();this._pixelRatio=e,this._resizeCanvas(t,n,e),this.painter.resize(t,n,e)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>85)throw new Error("maxPitch must be less than or equal to 85");if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}project(t){return this.transform.locationPoint(e.LngLat.convert(t),this.style&&this.style.terrain)}unproject(t){return this.transform.pointLocation(e.pointGeometry.convert(t),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(e,t,n){if("mouseenter"===e||"mouseover"===e){let a=!1;const r=r=>{const i=this.getLayer(t)?this.queryRenderedFeatures(r.point,{layers:[t]}):[];i.length?a||(a=!0,n.call(this,new pa(e,this,r.originalEvent,{features:i}))):a=!1};return{layer:t,listener:n,delegates:{mousemove:r,mouseout:()=>{a=!1}}}}if("mouseleave"===e||"mouseout"===e){let a=!1;const r=r=>{(this.getLayer(t)?this.queryRenderedFeatures(r.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new pa(e,this,r.originalEvent)))},i=t=>{a&&(a=!1,n.call(this,new pa(e,this,t.originalEvent)))};return{layer:t,listener:n,delegates:{mousemove:r,mouseout:i}}}{const a=e=>{const a=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];a.length&&(e.features=a,n.call(this,e),delete e.features)};return{layer:t,listener:n,delegates:{[e]:a}}}}on(e,t,n){if(void 0===n)return super.on(e,t);const a=this._createDelegatedListener(e,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(a);for(const e in a.delegates)this.on(e,a.delegates[e]);return this}once(e,t,n){if(void 0===n)return super.once(e,t);const a=this._createDelegatedListener(e,t,n);for(const e in a.delegates)this.once(e,a.delegates[e]);return this}off(e,t,n){return void 0===n?super.off(e,t):(this._delegatedListeners&&this._delegatedListeners[e]&&(a=>{const r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){const a=r[e];if(a.layer===t&&a.listener===n){for(const e in a.delegates)this.off(e,a.delegates[e]);return r.splice(e,1),this}}})(),this)}queryRenderedFeatures(t,n){if(!this.style)return[];let a;if(void 0!==n||void 0===t||t instanceof e.pointGeometry||Array.isArray(t)||(n=t,t=void 0),n=n||{},(t=t||[[0,0],[this.transform.width,this.transform.height]])instanceof e.pointGeometry||"number"==typeof t[0])a=[e.pointGeometry.convert(t)];else{const n=e.pointGeometry.convert(t[0]),r=e.pointGeometry.convert(t[1]);a=[n,new e.pointGeometry(r.x,n.y),r,new e.pointGeometry(n.x,r.y),n]}return this.style.queryRenderedFeatures(a,n,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(t,n){return!1!==(n=e.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(t,n))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),e?(this.style=new tt(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e):this.style.loadJSON(e),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tt(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,n){if("string"==typeof t){const a=this._requestManager.transformRequest(t,e.ResourceType.Style);e.getJSON(a,(t,a)=>{t?this.fire(new e.ErrorEvent(t)):a&&this._updateDiff(a,n)})}else"object"==typeof t&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t)&&this._update(!0)}catch(a){e.warnOnce(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(t,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.warnOnce("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(t){const n=this.style&&this.style.sourceCaches[t];if(void 0!==n)return n.loaded();this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`)))}setTerrain(e){return this.style.setTerrain(e),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const e=this.style&&this.style.sourceCaches;for(const t in e){const n=e[t]._tiles;for(const e in n){const t=n[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,n)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,n,{pixelRatio:a=1,sdf:r=!1,stretchX:i,stretchY:o,content:s}={}){if(this._lazyInitEmptyStyle(),n instanceof HTMLImageElement||e.isImageBitmap(n)){const{width:l,height:c,data:u}=e.exported.getImageData(n);this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},u),pixelRatio:a,stretchX:i,stretchY:o,content:s,sdf:r,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:l,height:c,data:u}=n,d=n;this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},new Uint8Array(u)),pixelRatio:a,stretchX:i,stretchY:o,content:s,sdf:r,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t)}}}updateImage(t,n){const a=this.style.getImage(t);if(!a)return this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=n instanceof HTMLImageElement||e.isImageBitmap(n)?e.exported.getImageData(n):n,{width:i,height:o,data:s}=r;if(void 0===i||void 0===o)return this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(i!==a.data.width||o!==a.data.height)return this.fire(new e.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(n instanceof HTMLImageElement||e.isImageBitmap(n));a.data.replace(s,l),this.style.updateImage(t,a)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,n){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),n)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,a={}){return this.style.setPaintProperty(e,t,n,a),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,a={}){return this.style.setLayoutProperty(e,t,n,a),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=i.create("div","maplibregl-canvas-container mapboxgl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=i.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=i.create("div","maplibregl-control-container mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{r[e]=i.create("div",`maplibregl-ctrl-${e} mapboxgl-ctrl-${e}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const e=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=i.create("div","maplibregl-cooperative-gesture-screen",e);let t="Control",n="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(n="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${n}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,document.addEventListener("keydown",e=>{e.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",e=>{e.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",e=>{this._onCooperativeGesture(e,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(e,t,n){this._canvas.width=n*e,this._canvas.height=n*t,this._canvas.style.width=e+"px",this._canvas.style.height=t+"px"}_setupPainter(){const n=e.extend({},t.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);a?(this.painter=new Zn(a,this.transform),e.exported$1.testSupport(a)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(e,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(t){let n,a=0;const r=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(n=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,n),a=e.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,n=e.exported.now();this.style.zoomHistory.update(t,n);const a=new e.EvaluationParameters(t,{now:n,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=a.crossFadingFactor();1===r&&r===this._crossFadingFactor||(i=!0,this._crossFadingFactor=r),this.style.update(a)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.PerformanceUtils.mark(e.PerformanceMarkers.load),this.fire(new e.Event("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const t=e.exported.now()-a;r.endQueryEXT(r.TIME_ELAPSED_EXT,n),setTimeout(()=>{const a=r.getQueryObjectEXT(n,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:a}))},50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout(()=>{const n=this.painter.queryGpuTimers(t);this.fire(new e.Event("gpu-timing-layer",{layerTimes:n}))},50)}const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.Event("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,e.PerformanceUtils.mark(e.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&i.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),e.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new e.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=e.exported.frame(t=>{e.PerformanceUtils.frame(t),this._frame=null,this._render(t)}))}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}_setCacheLimits(t,n){e.setCacheLimits(t,n)}get version(){return"2.4.0"}},NavigationControl:class{constructor(t){this.options=e.extend({},rr,t),this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ir(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){const n=i.create("button",e,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(e,t){const n=this._map._getUIString("NavigationControl."+t);e.title=n,e.setAttribute("aria-label",n)}},GeolocateControl:class extends e.Evented{constructor(t){super(),this.options=e.extend({},ur,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(e){var t;return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,void 0!==dr?t(dr):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(e=>{dr="denied"!==e.state,t(dr)}):(dr=!!window.navigator.geolocation,t(dr)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,pr=0,mr=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),n=e.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState "+this._watchState)}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState "+this._watchState)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}_updateCamera(t){const n=new e.LngLat(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,r=this._map.getBearing(),i=e.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(a),i,{geolocateSource:!0})}_updateMarker(t){if(t){const n=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const e=this._map._container.clientHeight/2,t=this._map.unproject([0,e]),n=this._map.unproject([1,e]),a=t.distanceTo(n),r=Math.ceil(2*this._accuracy/a);this._circleElement.style.width=r+"px",this._circleElement.style.height=r+"px"}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&mr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new cr(this._dotElement),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new cr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new e.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return e.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":pr--,mr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.Event("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState "+this._watchState)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState "+this._watchState)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),pr++,pr>1?(e={maximumAge:6e5,timeout:0},mr=!0):(e=this.options.positionOptions,mr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Qa,LogoControl:er,ScaleControl:class{constructor(t){this.options=e.extend({},br,t),e.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){hr(this._map,this._container,this.options)}onAdd(e){return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(e){this.options.unit=e,hr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(t){this.options=t,e.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=i.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends e.Evented{constructor(t){super(),this.options=e.extend(Object.create(gr),t),e.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new e.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&i.remove(this._content),this._container&&(i.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new e.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=e;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(e){this._update(e.point)}_onMouseMove(e){this._update(e.point)}_onDrag(e){this._update(e.point)}_update(e){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=i.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(e=>this._container.classList.add(e)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=or(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;const t=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);let n=this.options.anchor;const a=yr(this.options.offset);if(!n){const e=this._container.offsetWidth,r=this._container.offsetHeight;let i;i=t.y+a.bottom.y<r?["top"]:t.y>this._map.transform.height-r?["bottom"]:[],t.x<e/2?i.push("left"):t.x>this._map.transform.width-e/2&&i.push("right"),n=0===i.length?"bottom":i.join("-")}const r=t.add(a[n]).round();i.setTransform(this._container,`${sr[n]} translate(${r.x}px,${r.y}px)`),lr(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(_r);e&&e.focus()}_onClose(){this.remove()}},Marker:cr,Style:tt,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.pointGeometry,MercatorCoordinate:e.MercatorCoordinate,Evented:e.Evented,AJAXError:e.AJAXError,config:e.config,CanvasSource:E,GeoJSONSource:x,ImageSource:N,RasterDEMTileSource:A,RasterTileSource:O,VectorTileSource:z,VideoSource:q,prewarm:function(){Y().acquire(I)},clearPrewarmedResources:function(){const e=X;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(I),X=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return $.workerCount},set workerCount(e){$.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.clearTileCache(t)},workerUrl:"",addProtocol(t,n){e.config.REGISTERED_PROTOCOLS[t]=n},removeProtocol(t){delete e.config.REGISTERED_PROTOCOLS[t]}};return Ja.extend(Mr,{isSafari:e.isSafari,getPerformanceMetrics:e.PerformanceUtils.getPerformanceMetrics}),Mr})),n}()},,function(e,t,n){!function(t,n){var a=function(e,t,n){"use strict";var a,r;if(function(){var t,n={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(t in r=e.lazySizesConfig||e.lazysizesConfig||{},n)t in r||(r[t]=n[t])}(),!t||!t.getElementsByClassName)return{init:function(){},cfg:r,noSupport:!0};var i=t.documentElement,o=e.HTMLPictureElement,s=e.addEventListener.bind(e),l=e.setTimeout,c=e.requestAnimationFrame||l,u=e.requestIdleCallback,d=/^picture$/i,p=["load","error","lazyincluded","_lazyloaded"],m={},b=Array.prototype.forEach,h=function(e,t){return m[t]||(m[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),m[t].test(e.getAttribute("class")||"")&&m[t]},f=function(e,t){h(e,t)||e.setAttribute("class",(e.getAttribute("class")||"").trim()+" "+t)},g=function(e,t){var n;(n=h(e,t))&&e.setAttribute("class",(e.getAttribute("class")||"").replace(n," "))},_=function(e,t,n){var a=n?"addEventListener":"removeEventListener";n&&_(e,t),p.forEach((function(n){e[a](n,t)}))},y=function(e,n,r,i,o){var s=t.createEvent("Event");return r||(r={}),r.instance=a,s.initEvent(n,!i,!o),s.detail=r,e.dispatchEvent(s),s},M=function(t,n){var a;!o&&(a=e.picturefill||r.pf)?(n&&n.src&&!t.getAttribute("srcset")&&t.setAttribute("srcset",n.src),a({reevaluate:!0,elements:[t]})):n&&n.src&&(t.src=n.src)},v=function(e,t){return(getComputedStyle(e,null)||{})[t]},z=function(e,t,n){for(n=n||e.offsetWidth;n<r.minSize&&t&&!e._lazysizesWidth;)n=t.offsetWidth,t=t.parentNode;return n},O=(me=[],be=[],he=me,fe=function(){var e=he;for(he=me.length?be:me,de=!0,pe=!1;e.length;)e.shift()();de=!1},ge=function(e,n){de&&!n?e.apply(this,arguments):(he.push(e),pe||(pe=!0,(t.hidden?l:c)(fe)))},ge._lsFlush=fe,ge),k=function(e,t){return t?function(){O(e)}:function(){var t=this,n=arguments;O((function(){e.apply(t,n)}))}},A=function(e){var t,a,r=function(){t=null,e()},i=function(){var e=n.now()-a;e<99?l(i,99-e):(u||r)(r)};return function(){a=n.now(),t||(t=l(i,99))}},x=(Y=/^img$/i,H=/^iframe$/i,U="onscroll"in e&&!/(gle|ing)bot/.test(navigator.userAgent),V=0,G=0,K=-1,J=function(e){G--,(!e||G<0||!e.target)&&(G=0)},Z=function(e){return null==X&&(X="hidden"==v(t.body,"visibility")),X||!("hidden"==v(e.parentNode,"visibility")&&"hidden"==v(e,"visibility"))},Q=function(e,n){var a,r=e,o=Z(e);for(B-=n,F+=n,I-=n,$+=n;o&&(r=r.offsetParent)&&r!=t.body&&r!=i;)(o=(v(r,"opacity")||1)>0)&&"visible"!=v(r,"overflow")&&(a=r.getBoundingClientRect(),o=$>a.left&&I<a.right&&F>a.top-1&&B<a.bottom+1);return o},ee=function(){var e,n,o,s,l,c,u,d,p,m,b,h,f=a.elements;if((C=r.loadMode)&&G<8&&(e=f.length)){for(n=0,K++;n<e;n++)if(f[n]&&!f[n]._lazyRace)if(!U||a.prematureUnveil&&a.prematureUnveil(f[n]))se(f[n]);else if((d=f[n].getAttribute("data-expand"))&&(c=1*d)||(c=V),m||(m=!r.expand||r.expand<1?i.clientHeight>500&&i.clientWidth>500?500:370:r.expand,a._defEx=m,b=m*r.expFactor,h=r.hFac,X=null,V<b&&G<1&&K>2&&C>2&&!t.hidden?(V=b,K=0):V=C>1&&K>1&&G<6?m:0),p!==c&&(D=innerWidth+c*h,P=innerHeight+c,u=-1*c,p=c),o=f[n].getBoundingClientRect(),(F=o.bottom)>=u&&(B=o.top)<=P&&($=o.right)>=u*h&&(I=o.left)<=D&&(F||$||I||B)&&(r.loadHidden||Z(f[n]))&&(S&&G<3&&!d&&(C<3||K<4)||Q(f[n],c))){if(se(f[n]),l=!0,G>9)break}else!l&&S&&!s&&G<4&&K<4&&C>2&&(L[0]||r.preloadAfterLoad)&&(L[0]||!d&&(F||$||I||B||"auto"!=f[n].getAttribute(r.sizesAttr)))&&(s=L[0]||f[n]);s&&!l&&se(s)}},te=function(e){var t,a=0,i=r.throttleDelay,o=r.ricTimeout,s=function(){t=!1,a=n.now(),e()},c=u&&o>49?function(){u(s,{timeout:o}),o!==r.ricTimeout&&(o=r.ricTimeout)}:k((function(){l(s)}),!0);return function(e){var r;(e=!0===e)&&(o=33),t||(t=!0,(r=i-(n.now()-a))<0&&(r=0),e||r<9?c():l(c,r))}}(ee),ne=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(J(e),f(t,r.loadedClass),g(t,r.loadingClass),_(t,re),y(t,"lazyloaded"))},ae=k(ne),re=function(e){ae({target:e.target})},ie=function(e){var t,n=e.getAttribute(r.srcsetAttr);(t=r.customMedia[e.getAttribute("data-media")||e.getAttribute("media")])&&e.setAttribute("media",t),n&&e.setAttribute("srcset",n)},oe=k((function(e,t,n,a,i){var o,s,c,u,p,m;(p=y(e,"lazybeforeunveil",t)).defaultPrevented||(a&&(n?f(e,r.autosizesClass):e.setAttribute("sizes",a)),s=e.getAttribute(r.srcsetAttr),o=e.getAttribute(r.srcAttr),i&&(u=(c=e.parentNode)&&d.test(c.nodeName||"")),m=t.firesLoad||"src"in e&&(s||o||u),p={target:e},f(e,r.loadingClass),m&&(clearTimeout(T),T=l(J,2500),_(e,re,!0)),u&&b.call(c.getElementsByTagName("source"),ie),s?e.setAttribute("srcset",s):o&&!u&&(H.test(e.nodeName)?function(e,t){var n=e.getAttribute("data-load-mode")||r.iframeLoadMode;0==n?e.contentWindow.location.replace(t):1==n&&(e.src=t)}(e,o):e.src=o),i&&(s||u)&&M(e,{src:o})),e._lazyRace&&delete e._lazyRace,g(e,r.lazyClass),O((function(){var t=e.complete&&e.naturalWidth>1;m&&!t||(t&&f(e,r.fastLoadedClass),ne(p),e._lazyCache=!0,l((function(){"_lazyCache"in e&&delete e._lazyCache}),9)),"lazy"==e.loading&&G--}),!0)})),se=function(e){if(!e._lazyRace){var t,n=Y.test(e.nodeName),a=n&&(e.getAttribute(r.sizesAttr)||e.getAttribute("sizes")),i="auto"==a;(!i&&S||!n||!e.getAttribute("src")&&!e.srcset||e.complete||h(e,r.errorClass)||!h(e,r.lazyClass))&&(t=y(e,"lazyunveilread").detail,i&&w.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,G++,oe(e,t,i,a,n))}},le=A((function(){r.loadMode=3,te()})),ce=function(){3==r.loadMode&&(r.loadMode=2),le()},ue=function(){S||(n.now()-R<999?l(ue,999):(S=!0,r.loadMode=3,te(),s("scroll",ce,!0)))},{_:function(){R=n.now(),a.elements=t.getElementsByClassName(r.lazyClass),L=t.getElementsByClassName(r.lazyClass+" "+r.preloadClass),s("scroll",te,!0),s("resize",te,!0),s("pageshow",(function(e){if(e.persisted){var n=t.querySelectorAll("."+r.loadingClass);n.length&&n.forEach&&c((function(){n.forEach((function(e){e.complete&&se(e)}))}))}})),e.MutationObserver?new MutationObserver(te).observe(i,{childList:!0,subtree:!0,attributes:!0}):(i.addEventListener("DOMNodeInserted",te,!0),i.addEventListener("DOMAttrModified",te,!0),setInterval(te,999)),s("hashchange",te,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach((function(e){t.addEventListener(e,te,!0)})),/d$|^c/.test(t.readyState)?ue():(s("load",ue),t.addEventListener("DOMContentLoaded",te),l(ue,2e4)),a.elements.length?(ee(),O._lsFlush()):te()},checkElems:te,unveil:se,_aLSL:ce}),w=(E=k((function(e,t,n,a){var r,i,o;if(e._lazysizesWidth=a,a+="px",e.setAttribute("sizes",a),d.test(t.nodeName||""))for(i=0,o=(r=t.getElementsByTagName("source")).length;i<o;i++)r[i].setAttribute("sizes",a);n.detail.dataAttr||M(e,n.detail)})),j=function(e,t,n){var a,r=e.parentNode;r&&(n=z(e,r,n),(a=y(e,"lazybeforesizes",{width:n,dataAttr:!!t})).defaultPrevented||(n=a.detail.width)&&n!==e._lazysizesWidth&&E(e,r,a,n))},W=A((function(){var e,t=q.length;if(t)for(e=0;e<t;e++)j(q[e])})),{_:function(){q=t.getElementsByClassName(r.autosizesClass),s("resize",W)},checkElems:W,updateElem:j}),N=function(){!N.i&&t.getElementsByClassName&&(N.i=!0,w._(),x._())};var q,E,j,W;var L,S,T,C,R,D,P,B,I,$,F,X,Y,H,U,V,G,K,J,Z,Q,ee,te,ne,ae,re,ie,oe,se,le,ce,ue;var de,pe,me,be,he,fe,ge;return l((function(){r.init&&N()})),a={cfg:r,autoSizer:w,loader:x,init:N,uP:M,aC:f,rC:g,hC:h,fire:y,gW:z,rAF:O}}(t,t.document,Date);t.lazySizes=a,e.exports&&(e.exports=a)}("undefined"!=typeof window?window:{})},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(8),d={increase:"positive",decrease:"negative",neutral:"neutral"},p={increase:"arrow-up",decrease:"arrow-down"};t.a=function(e){var t=e.change,n=void 0===t?"neutral":t,a=e.className,i=e.icon,m=e.id,b=e.value,h=d[n],f=p[n];return i&&(f=i),r.a.createElement(r.a.Fragment,null,b&&r.a.createElement("div",{className:o()(Object(s.b)("pb_stat_change_kit",h),Object(l.c)(e),a),id:m},r.a.createElement(c.a,{status:h},f&&r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,{fixed_width:!0,icon:f})," "),"".concat(b,"%"))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(53),l=n(2),c=n(5),u=n(13),d=n(17),p=n(8),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.alignment,i=void 0===a?"left":a,b=e.className,h=e.data,f=void 0===h?{}:h,g=e.id,_=e.showDayOfWeek,y=void 0!==_&&_,M=e.showIcon,v=void 0!==M&&M,z=e.size,O=void 0===z?"md":z,k=e.unstyled,A=void 0!==k&&k,x=e.value,w=new s.a({value:x}),N=w.toWeekday(),q=w.toMonth(),E=w.toDay(),j=w.toYear(),W=(new Date).getFullYear().toString(),L=Object(l.a)(n),S=Object(l.c)(f),T=o()(Object(l.b)("pb_date_kit",i),Object(c.c)(e),b);return r.a.createElement("div",Object.assign({},L,S,{className:T,id:g}),A?r.a.createElement(r.a.Fragment,null,v&&r.a.createElement("div",null,r.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt"})),y&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",null,N),r.a.createElement("div",null,"•")),r.a.createElement("span",null,r.a.createElement("span",null,q," ",E),W!=j&&r.a.createElement("span",null,", ".concat(j)))):"md"==O||"lg"==O?r.a.createElement(m.a,{size:4,tag:"h4"},v&&r.a.createElement(u.a,{className:"pb_icon_kit_container",color:"light",tag:"span"},r.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt"})),y&&r.a.createElement(r.a.Fragment,null,N,r.a.createElement(u.a,{color:"light",tag:"span",text:" • "})),r.a.createElement("span",null,q," ",E),W!=j&&r.a.createElement("span",null,", ".concat(j))):r.a.createElement(r.a.Fragment,null,v&&r.a.createElement(d.a,{className:"pb_icon_kit_container",tag:"span"},r.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt",size:"sm"})),y&&r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,{tag:"div"},N),r.a.createElement(d.a,{color:"light",tag:"div",text:" • "})),r.a.createElement(d.a,{tag:"span"},q," ",E,W!=j&&r.a.createElement(r.a.Fragment,null,", ".concat(j)))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(58),u={home:"H#",project:"P#",appointment:"A#",default:"#"};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.dark,d=void 0!==i&&i,p=e.data,m=void 0===p?{}:p,b=e.id,h=e.newWindow,f=e.rel,g=e.text,_=e.type,y=void 0===_?"default":_,M=e.url,v=Object(s.a)(n),z=Object(s.c)(m),O=o()(Object(s.b)("pb_hashtag_kit"),Object(l.c)(e),a);return r.a.createElement("span",Object.assign({},v,z,{className:O,id:b}),r.a.createElement("a",{href:M,rel:h?"noreferrer":f,target:h?"_blank":"_self"},r.a.createElement(c.a,{dark:d,text:u[y]+g,variant:"primary"})))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(15),d=function(e){var t=e.active,n=e.dark,a=e.steps;return r.a.createElement("div",{className:"pb_progress_pill".concat(a<=t?"_active":"_inactive").concat(n?" dark":""),key:a})};t.a=function(e){var t=e.active,n=void 0===t?0:t,a=e.aria,i=void 0===a?{hidden:"true"}:a,p=e.className,m=e.data,b=void 0===m?{}:m,h=e.id,f=e.steps,g=void 0===f?3:f,_=e.title,y=e.value,M=e.dark,v=void 0!==M&&M,z=Object(s.a)(i),O=Object(s.c)(b),k=o()(Object(s.b)("pb_progress_pills_kit"),Object(l.c)(e),p);return r.a.createElement("div",Object.assign({},z,O,{className:k,id:h}),_&&r.a.createElement("div",{className:"progress_pills_status"},r.a.createElement(u.a,{dark:v,size:4,tag:"h4",text:_}),r.a.createElement(c.a,{color:"light",dark:v,text:y})),r.a.createElement("div",{className:"progress_pills"},function(e,t,n){for(var a=[],r=1;r<=e;r++)a.push(d({steps:r,active:t,dark:n}));return a}(g,n,v)))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return B}));var a=n(0),r=n.n(a),i=n(22),o=n(11),s=n(13),l=n(17),c=n(15),u=function(e){return Object(i.isEmpty)(e)&&!0!==e},d=function(e){var t=e.dark,n=e.filters,a=Object(i.omitBy)(n,u);return r.a.createElement("div",{className:"maskContainer"},Object(i.isEmpty)(n)&&r.a.createElement("div",{className:"filters"},r.a.createElement(s.a,{color:"light",paddingLeft:"xs",size:4,tag:"span",text:"No Filter Selected"})),!Object(i.isEmpty)(n)&&r.a.createElement("div",{className:"filters"},r.a.createElement("div",{className:"left_gradient"}),Object(i.map)(a,(function(e,n){return r.a.createElement("div",{className:"filter",key:"filter-".concat(n)},!0===e?r.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:n}):r.a.createElement("div",null,r.a.createElement(l.a,{dark:t,text:n}),r.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:e})))})),r.a.createElement("div",{className:"right_gradient"})))},p=n(3),m=n.n(p),b=n(5),h=n(18),f=function(e){var t=e.background,n=void 0===t||t,a=e.className,i=e.children,o=e.dark;return r.a.createElement("div",{className:m()("pb_filter_kit ".concat(a),Object(b.c)(e))},n?r.a.createElement(h.a,{dark:o,padding:"none"},i):r.a.createElement(r.a.Fragment,null,i))},g=n(48),_=n(77);function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var v=function(e){var t=e.children,n=e.dark,i=e.minWidth,o=e.placement,s=void 0===o?"bottom-start":o,l=y(Object(a.useState)(!0),2),c=l[0],u=l[1],d=r.a.createElement(g.a,{dark:n,icon:"filter",id:"filter",onClick:function(){return u(!c)},variant:"secondary"});return r.a.createElement(_.a,{closeOnClick:"outside",minWidth:i,placement:s,reference:d,shouldClosePopover:u,show:!c},r.a.createElement("div",{className:"pb-form"},"function"==typeof t?t({closePopover:function(){return u(!0)}}):t))},z=n(117),O=function(e){return 1==e?"Result":"Results"},k=function(e){var t=e.dark,n=e.results,a=e.title;return r.a.createElement(r.a.Fragment,null,n&&a?r.a.createElement(r.a.Fragment,null,r.a.createElement(z.a,{align:"center",count:n,dark:t,title:"".concat(O(n),":")})):n?r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{className:"filter-results",dark:t,size:"xs",text:"".concat(n," ").concat(O(n))})):r.a.createElement("div",null))},A=n(25),x=n(8),w=n(81),N=n(47);function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var j=function(e){return"asc"==e?"sort-amount-up":"sort-amount-down"},W=function(e,t,n){return Object(i.map)(e,(function(e,a){var o=function(e,t){var n=Object(i.find)(e,{name:t});return{name:t,dir:n&&"asc"==n.dir?"desc":"asc"}}(t,a);return r.a.createElement(N.a,{key:"option-".concat(o.name,"-").concat(o.dir)},r.a.createElement(A.a,{htmlType:void 0,onClick:Object(i.partial)(n,o),text:" ".concat(e),variant:"link"}))}))},L=function(e){var t=e.dark,n=e.options,o=e.value,s=e.onChange,l=q(Object(a.useState)(!0),2),c=l[0],u=l[1],d=r.a.createElement(A.a,{dark:t,htmlType:void 0,id:"sort-button",onClick:function(){return u(!c)},paddingRight:"none",variant:"link"},Object(i.map)(o,(function(e){var a=e.dir,i=e.name;return r.a.createElement("span",{key:"current-sort-".concat(i,"-").concat(a)}," ".concat(n[i]),r.a.createElement(x.a,{dark:t,icon:j(a)}))})));return r.a.createElement(_.a,{className:"pb_filter_sort_menu",closeOnClick:"outside",padding:"none",placement:"bottom",reference:d,shouldClosePopover:u,show:!c},r.a.createElement(w.a,null,W(n,o,(function(e){u(!0),s([e])}))))},S=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n},T=function(e){var t=e.onSortChange,n=e.sortOptions,a=e.sortValue,s=e.filters,l=e.results,c=e.children,u=e.dark,p=e.minWidth,m=e.placement,b=S(e,["onSortChange","sortOptions","sortValue","filters","results","children","dark","minWidth","placement"]);return r.a.createElement(f,Object.assign({dark:u},b),r.a.createElement(o.a,{orientation:"row",paddingRight:"lg",vertical:"center"},c&&r.a.createElement(r.a.Fragment,null,r.a.createElement(v,{dark:u,minWidth:p,placement:m},c),r.a.createElement(d,{dark:u,filters:s})),r.a.createElement(k,{dark:u,results:l}),!Object(i.isEmpty)(n)&&r.a.createElement(L,{dark:u,onChange:t,options:n,value:a})))},C=n(55),R=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n},D=function(e){var t=e.onSortChange,n=e.sortOptions,a=e.sortValue,i=e.filters,s=e.results,c=e.children,u=e.dark,p=e.minWidth,m=e.placement,b=R(e,["onSortChange","sortOptions","sortValue","filters","results","children","dark","minWidth","placement"]);return r.a.createElement(f,Object.assign({dark:u},b),r.a.createElement(o.a,{orientation:"row",vertical:"center"},r.a.createElement(v,{dark:u,minWidth:p,placement:m},c),r.a.createElement(d,{dark:u,filters:i})),r.a.createElement(C.a,{dark:u}),r.a.createElement(o.a,{className:"filter-bottom",orientation:"row",spacing:"between",vertical:"center"},r.a.createElement(k,{dark:u,results:s,title:!0}),r.a.createElement(o.a,{orientation:"row",vertical:"center"},r.a.createElement(l.a,{dark:u,text:"sort by:"}),r.a.createElement(L,{dark:u,onChange:t,options:n,value:a}))))},P=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n},B=function(e){var t=e.double,n=void 0!==t&&t,a=P(e,["double"]);return r.a.createElement(r.a.Fragment,null,!0===n?r.a.createElement(D,Object.assign({},a)):r.a.createElement(T,Object.assign({},a)))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,a=e.aria,i=void 0===a?{}:a,d=e.className,p=e.data,m=void 0===p?{}:p,b=e.id,h=Object(s.a)(i),f=Object(s.c)(m),g=o()(Object(s.b)("pb_loading_inline_kit_".concat(n)),Object(l.c)(e),d);return r.a.createElement("div",Object.assign({},h,f,{className:g,id:b}),r.a.createElement(c.a,{color:"light"},r.a.createElement(u.a,{aria:{label:"loading icon"},fixedWidth:!0,icon:"spinner",pulse:!0})," Loading"))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(33),u=n(58);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.dark,d=void 0!==i&&i,p=e.data,m=void 0===p?{}:p,b=e.id,h=e.users,f=h.length>2,g=1==h.length,_=Object(l.a)(n),y=Object(l.c)(m),M=o()(Object(l.b)("pb_multiple_users_stacked_kit",{single:g}),Object(s.c)(e),a);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),h.slice(0,1).map((function(e,t){return r.a.createElement(c.a,Object.assign({},e,{className:"pb_multiple_users_stacked_item",dark:d,key:t,size:"xs"}))})),function(){if(!1===f)return h.slice(1,2).map((function(e,t){return r.a.createElement(c.a,Object.assign({},e,{className:"pb_multiple_users_stacked_item second_item",dark:d,key:t,size:"xs"}))}))}(),function(){if(!0===f)return r.a.createElement(u.a,{className:"pb_multiple_users_stacked_item second_item",dark:d,rounded:!0,text:"+".concat(h.length-(f?1:h.length)),variant:"primary"})}())}},function(e,t,n){"use strict";var a=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],r={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=i,s=function(e,t){return void 0===t&&(t=2),("000"+e).slice(-1*t)},l=function(e){return!0===e?1:0};function c(e,t){var n;return function(){var a=this,r=arguments;clearTimeout(n),n=setTimeout((function(){return e.apply(a,r)}),t)}}var u=function(e){return e instanceof Array?e:[e]};function d(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function p(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function m(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function b(e,t){var n=p("div","numInputWrapper"),a=p("input","numInput "+e),r=p("span","arrowUp"),i=p("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==t)for(var o in t)a.setAttribute(o,t[o]);return n.appendChild(a),n.appendChild(r),n.appendChild(i),n}function h(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(t){return e.target}}var f=function(){},g=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},_={D:f,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*l(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t,n){var a=parseInt(t),r=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return r.setDate(r.getDate()-r.getDay()+n.firstDayOfWeek),r},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:f,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:f,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},y={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},M={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[M.w(e,t,n)]},F:function(e,t,n){return g(M.n(e,t,n)-1,!1,t)},G:function(e,t,n){return s(M.h(e,t,n))},H:function(e){return s(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[l(e.getHours()>11)]},M:function(e,t){return g(e.getMonth(),!0,t)},S:function(e){return s(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return s(e.getFullYear(),4)},d:function(e){return s(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return s(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return s(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},v=function(e){var t=e.config,n=void 0===t?r:t,a=e.l10n,o=void 0===a?i:a,s=e.isMobile,l=void 0!==s&&s;return function(e,t,a){var r=a||o;return void 0===n.formatDate||l?t.split("").map((function(t,a,i){return M[t]&&"\\"!==i[a-1]?M[t](e,r,n):"\\"!==t?t:""})).join(""):n.formatDate(e,t,r)}},z=function(e){var t=e.config,n=void 0===t?r:t,a=e.l10n,o=void 0===a?i:a;return function(e,t,a,i){if(0===e||e){var s,l=i||o,c=e;if(e instanceof Date)s=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)s=new Date(e);else if("string"==typeof e){var u=t||(n||r).dateFormat,d=String(e).trim();if("today"===d)s=new Date,a=!0;else if(n&&n.parseDate)s=n.parseDate(e,u);else if(/Z$/.test(d)||/GMT$/.test(d))s=new Date(e);else{for(var p=void 0,m=[],b=0,h=0,f="";b<u.length;b++){var g=u[b],M="\\"===g,v="\\"===u[b-1]||M;if(y[g]&&!v){f+=y[g];var z=new RegExp(f).exec(e);z&&(p=!0)&&m["Y"!==g?"push":"unshift"]({fn:_[g],val:z[++h]})}else M||(f+=".")}s=n&&n.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),m.forEach((function(e){var t=e.fn,n=e.val;return s=t(s,n,l)||s})),s=p?s:void 0}}if(s instanceof Date&&!isNaN(s.getTime()))return!0===a&&s.setHours(0,0,0,0),s;n.errorHandler(new Error("Invalid date provided: "+c))}}};function O(e,t,n){return void 0===n&&(n=!0),!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}var k=function(e,t,n){return 3600*e+60*t+n},A=864e5;function x(e){var t=e.defaultHour,n=e.defaultMinute,a=e.defaultSeconds;if(void 0!==e.minDate){var r=e.minDate.getHours(),i=e.minDate.getMinutes(),o=e.minDate.getSeconds();t<r&&(t=r),t===r&&n<i&&(n=i),t===r&&n===i&&a<o&&(a=e.minDate.getSeconds())}if(void 0!==e.maxDate){var s=e.maxDate.getHours(),l=e.maxDate.getMinutes();(t=Math.min(t,s))===s&&(n=Math.min(l,n)),t===s&&n===l&&(a=e.maxDate.getSeconds())}return{hours:t,minutes:n,seconds:a}}n(353);var w=function(){return(w=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},N=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var a=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,r++)a[r]=i[o];return a};function q(e,t){var n={config:w(w({},r),j.defaultConfig),l10n:o};function i(){var e;return(null===(e=n.calendarContainer)||void 0===e?void 0:e.getRootNode()).activeElement||document.activeElement}function f(e){return e.bind(n)}function _(){var e=n.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame((function(){if(void 0!==n.calendarContainer&&(n.calendarContainer.style.visibility="hidden",n.calendarContainer.style.display="block"),void 0!==n.daysContainer){var t=(n.days.offsetWidth+1)*e.showMonths;n.daysContainer.style.width=t+"px",n.calendarContainer.style.width=t+(void 0!==n.weekWrapper?n.weekWrapper.offsetWidth:0)+"px",n.calendarContainer.style.removeProperty("visibility"),n.calendarContainer.style.removeProperty("display")}}))}function M(e){if(0===n.selectedDates.length){var t=void 0===n.config.minDate||O(new Date,n.config.minDate)>=0?new Date:new Date(n.config.minDate.getTime()),a=x(n.config);t.setHours(a.hours,a.minutes,a.seconds,t.getMilliseconds()),n.selectedDates=[t],n.latestSelectedDateObj=t}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var t="keydown"===e.type,a=h(e),r=a;void 0!==n.amPM&&a===n.amPM&&(n.amPM.textContent=n.l10n.amPM[l(n.amPM.textContent===n.l10n.amPM[0])]);var i=parseFloat(r.getAttribute("min")),o=parseFloat(r.getAttribute("max")),c=parseFloat(r.getAttribute("step")),u=parseInt(r.value,10),d=e.delta||(t?38===e.which?1:-1:0),p=u+c*d;if(void 0!==r.value&&2===r.value.length){var m=r===n.hourElement,b=r===n.minuteElement;p<i?(p=o+p+l(!m)+(l(m)&&l(!n.amPM)),b&&D(void 0,-1,n.hourElement)):p>o&&(p=r===n.hourElement?p-o-l(!n.amPM):i,b&&D(void 0,1,n.hourElement)),n.amPM&&m&&(1===c?p+u===23:Math.abs(p-u)>c)&&(n.amPM.textContent=n.l10n.amPM[l(n.amPM.textContent===n.l10n.amPM[0])]),r.value=s(p)}}(e);var r=n._input.value;q(),ze(),n._input.value!==r&&n._debouncedChange()}function q(){if(void 0!==n.hourElement&&void 0!==n.minuteElement){var e,t,a=(parseInt(n.hourElement.value.slice(-2),10)||0)%24,r=(parseInt(n.minuteElement.value,10)||0)%60,i=void 0!==n.secondElement?(parseInt(n.secondElement.value,10)||0)%60:0;void 0!==n.amPM&&(e=a,t=n.amPM.textContent,a=e%12+12*l(t===n.l10n.amPM[1]));var o=void 0!==n.config.minTime||n.config.minDate&&n.minDateHasTime&&n.latestSelectedDateObj&&0===O(n.latestSelectedDateObj,n.config.minDate,!0),s=void 0!==n.config.maxTime||n.config.maxDate&&n.maxDateHasTime&&n.latestSelectedDateObj&&0===O(n.latestSelectedDateObj,n.config.maxDate,!0);if(void 0!==n.config.maxTime&&void 0!==n.config.minTime&&n.config.minTime>n.config.maxTime){var c=k(n.config.minTime.getHours(),n.config.minTime.getMinutes(),n.config.minTime.getSeconds()),u=k(n.config.maxTime.getHours(),n.config.maxTime.getMinutes(),n.config.maxTime.getSeconds()),d=k(a,r,i);if(d>u&&d<c){var p=function(e){var t=Math.floor(e/3600),n=(e-3600*t)/60;return[t,n,e-3600*t-60*n]}(c);a=p[0],r=p[1],i=p[2]}}else{if(s){var m=void 0!==n.config.maxTime?n.config.maxTime:n.config.maxDate;(a=Math.min(a,m.getHours()))===m.getHours()&&(r=Math.min(r,m.getMinutes())),r===m.getMinutes()&&(i=Math.min(i,m.getSeconds()))}if(o){var b=void 0!==n.config.minTime?n.config.minTime:n.config.minDate;(a=Math.max(a,b.getHours()))===b.getHours()&&r<b.getMinutes()&&(r=b.getMinutes()),r===b.getMinutes()&&(i=Math.max(i,b.getSeconds()))}}W(a,r,i)}}function E(e){var t=e||n.latestSelectedDateObj;t&&t instanceof Date&&W(t.getHours(),t.getMinutes(),t.getSeconds())}function W(e,t,a){void 0!==n.latestSelectedDateObj&&n.latestSelectedDateObj.setHours(e%24,t,a||0,0),n.hourElement&&n.minuteElement&&!n.isMobile&&(n.hourElement.value=s(n.config.time_24hr?e:(12+e)%12+12*l(e%12==0)),n.minuteElement.value=s(t),void 0!==n.amPM&&(n.amPM.textContent=n.l10n.amPM[l(e>=12)]),void 0!==n.secondElement&&(n.secondElement.value=s(a)))}function L(e){var t=h(e),n=parseInt(t.value)+(e.delta||0);(n/1e3>1||"Enter"===e.key&&!/[^\d]/.test(n.toString()))&&Q(n)}function S(e,t,a,r){return t instanceof Array?t.forEach((function(t){return S(e,t,a,r)})):e instanceof Array?e.forEach((function(e){return S(e,t,a,r)})):(e.addEventListener(t,a,r),void n._handlers.push({remove:function(){return e.removeEventListener(t,a,r)}}))}function T(){ge("onChange")}function C(e,t){var a=void 0!==e?n.parseDate(e):n.latestSelectedDateObj||(n.config.minDate&&n.config.minDate>n.now?n.config.minDate:n.config.maxDate&&n.config.maxDate<n.now?n.config.maxDate:n.now),r=n.currentYear,i=n.currentMonth;try{void 0!==a&&(n.currentYear=a.getFullYear(),n.currentMonth=a.getMonth())}catch(e){e.message="Invalid date supplied: "+a,n.config.errorHandler(e)}t&&n.currentYear!==r&&(ge("onYearChange"),Y()),!t||n.currentYear===r&&n.currentMonth===i||ge("onMonthChange"),n.redraw()}function R(e){var t=h(e);~t.className.indexOf("arrow")&&D(e,t.classList.contains("arrowUp")?1:-1)}function D(e,t,n){var a=e&&h(e),r=n||a&&a.parentNode&&a.parentNode.firstChild,i=_e("increment");i.delta=t,r&&r.dispatchEvent(i)}function P(e,t,a,r){var i=ee(t,!0),o=p("span",e,t.getDate().toString());return o.dateObj=t,o.$i=r,o.setAttribute("aria-label",n.formatDate(t,n.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===O(t,n.now)&&(n.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,ye(t)&&(o.classList.add("selected"),n.selectedDateElem=o,"range"===n.config.mode&&(d(o,"startRange",n.selectedDates[0]&&0===O(t,n.selectedDates[0],!0)),d(o,"endRange",n.selectedDates[1]&&0===O(t,n.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===n.config.mode&&function(e){return!("range"!==n.config.mode||n.selectedDates.length<2)&&(O(e,n.selectedDates[0])>=0&&O(e,n.selectedDates[1])<=0)}(t)&&!ye(t)&&o.classList.add("inRange"),n.weekNumbers&&1===n.config.showMonths&&"prevMonthDay"!==e&&r%7==6&&n.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+n.config.getWeek(t)+"</span>"),ge("onDayCreate",o),o}function B(e){e.focus(),"range"===n.config.mode&&re(e)}function I(e){for(var t=e>0?0:n.config.showMonths-1,a=e>0?n.config.showMonths:-1,r=t;r!=a;r+=e)for(var i=n.daysContainer.children[r],o=e>0?0:i.children.length-1,s=e>0?i.children.length:-1,l=o;l!=s;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&ee(c.dateObj))return c}}function $(e,t){var a=i(),r=te(a||document.body),o=void 0!==e?e:r?a:void 0!==n.selectedDateElem&&te(n.selectedDateElem)?n.selectedDateElem:void 0!==n.todayDateElem&&te(n.todayDateElem)?n.todayDateElem:I(t>0?1:-1);void 0===o?n._input.focus():r?function(e,t){for(var a=-1===e.className.indexOf("Month")?e.dateObj.getMonth():n.currentMonth,r=t>0?n.config.showMonths:-1,i=t>0?1:-1,o=a-n.currentMonth;o!=r;o+=i)for(var s=n.daysContainer.children[o],l=a-n.currentMonth===o?e.$i+t:t<0?s.children.length-1:0,c=s.children.length,u=l;u>=0&&u<c&&u!=(t>0?c:-1);u+=i){var d=s.children[u];if(-1===d.className.indexOf("hidden")&&ee(d.dateObj)&&Math.abs(e.$i-u)>=Math.abs(t))return B(d)}n.changeMonth(i),$(I(i),0)}(o,t):B(o)}function F(e,t){for(var a=(new Date(e,t,1).getDay()-n.l10n.firstDayOfWeek+7)%7,r=n.utils.getDaysInMonth((t-1+12)%12,e),i=n.utils.getDaysInMonth(t,e),o=window.document.createDocumentFragment(),s=n.config.showMonths>1,l=s?"prevMonthDay hidden":"prevMonthDay",c=s?"nextMonthDay hidden":"nextMonthDay",u=r+1-a,d=0;u<=r;u++,d++)o.appendChild(P("flatpickr-day "+l,new Date(e,t-1,u),0,d));for(u=1;u<=i;u++,d++)o.appendChild(P("flatpickr-day",new Date(e,t,u),0,d));for(var m=i+1;m<=42-a&&(1===n.config.showMonths||d%7!=0);m++,d++)o.appendChild(P("flatpickr-day "+c,new Date(e,t+1,m%i),0,d));var b=p("div","dayContainer");return b.appendChild(o),b}function X(){if(void 0!==n.daysContainer){m(n.daysContainer),n.weekNumbers&&m(n.weekNumbers);for(var e=document.createDocumentFragment(),t=0;t<n.config.showMonths;t++){var a=new Date(n.currentYear,n.currentMonth,1);a.setMonth(n.currentMonth+t),e.appendChild(F(a.getFullYear(),a.getMonth()))}n.daysContainer.appendChild(e),n.days=n.daysContainer.firstChild,"range"===n.config.mode&&1===n.selectedDates.length&&re()}}function Y(){if(!(n.config.showMonths>1||"dropdown"!==n.config.monthSelectorType)){var e=function(e){return!(void 0!==n.config.minDate&&n.currentYear===n.config.minDate.getFullYear()&&e<n.config.minDate.getMonth())&&!(void 0!==n.config.maxDate&&n.currentYear===n.config.maxDate.getFullYear()&&e>n.config.maxDate.getMonth())};n.monthsDropdownContainer.tabIndex=-1,n.monthsDropdownContainer.innerHTML="";for(var t=0;t<12;t++)if(e(t)){var a=p("option","flatpickr-monthDropdown-month");a.value=new Date(n.currentYear,t).getMonth().toString(),a.textContent=g(t,n.config.shorthandCurrentMonth,n.l10n),a.tabIndex=-1,n.currentMonth===t&&(a.selected=!0),n.monthsDropdownContainer.appendChild(a)}}}function H(){var e,t=p("div","flatpickr-month"),a=window.document.createDocumentFragment();n.config.showMonths>1||"static"===n.config.monthSelectorType?e=p("span","cur-month"):(n.monthsDropdownContainer=p("select","flatpickr-monthDropdown-months"),n.monthsDropdownContainer.setAttribute("aria-label",n.l10n.monthAriaLabel),S(n.monthsDropdownContainer,"change",(function(e){var t=h(e),a=parseInt(t.value,10);n.changeMonth(a-n.currentMonth),ge("onMonthChange")})),Y(),e=n.monthsDropdownContainer);var r=b("cur-year",{tabindex:"-1"}),i=r.getElementsByTagName("input")[0];i.setAttribute("aria-label",n.l10n.yearAriaLabel),n.config.minDate&&i.setAttribute("min",n.config.minDate.getFullYear().toString()),n.config.maxDate&&(i.setAttribute("max",n.config.maxDate.getFullYear().toString()),i.disabled=!!n.config.minDate&&n.config.minDate.getFullYear()===n.config.maxDate.getFullYear());var o=p("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(r),a.appendChild(o),t.appendChild(a),{container:t,yearElement:i,monthElement:e}}function U(){m(n.monthNav),n.monthNav.appendChild(n.prevMonthNav),n.config.showMonths&&(n.yearElements=[],n.monthElements=[]);for(var e=n.config.showMonths;e--;){var t=H();n.yearElements.push(t.yearElement),n.monthElements.push(t.monthElement),n.monthNav.appendChild(t.container)}n.monthNav.appendChild(n.nextMonthNav)}function V(){n.weekdayContainer?m(n.weekdayContainer):n.weekdayContainer=p("div","flatpickr-weekdays");for(var e=n.config.showMonths;e--;){var t=p("div","flatpickr-weekdaycontainer");n.weekdayContainer.appendChild(t)}return G(),n.weekdayContainer}function G(){if(n.weekdayContainer){var e=n.l10n.firstDayOfWeek,t=N(n.l10n.weekdays.shorthand);e>0&&e<t.length&&(t=N(t.splice(e,t.length),t.splice(0,e)));for(var a=n.config.showMonths;a--;)n.weekdayContainer.children[a].innerHTML="\n <span class='flatpickr-weekday'>\n "+t.join("</span><span class='flatpickr-weekday'>")+"\n </span>\n "}}function K(e,t){void 0===t&&(t=!0);var a=t?e:e-n.currentMonth;a<0&&!0===n._hidePrevMonthArrow||a>0&&!0===n._hideNextMonthArrow||(n.currentMonth+=a,(n.currentMonth<0||n.currentMonth>11)&&(n.currentYear+=n.currentMonth>11?1:-1,n.currentMonth=(n.currentMonth+12)%12,ge("onYearChange"),Y()),X(),ge("onMonthChange"),Me())}function J(e){return n.calendarContainer.contains(e)}function Z(e){if(n.isOpen&&!n.config.inline){var t=h(e),a=J(t),r=!(t===n.input||t===n.altInput||n.element.contains(t)||e.path&&e.path.indexOf&&(~e.path.indexOf(n.input)||~e.path.indexOf(n.altInput)))&&!a&&!J(e.relatedTarget),i=!n.config.ignoredFocusElements.some((function(e){return e.contains(t)}));r&&i&&(n.config.allowInput&&n.setDate(n._input.value,!1,n.config.altInput?n.config.altFormat:n.config.dateFormat),void 0!==n.timeContainer&&void 0!==n.minuteElement&&void 0!==n.hourElement&&""!==n.input.value&&void 0!==n.input.value&&M(),n.close(),n.config&&"range"===n.config.mode&&1===n.selectedDates.length&&n.clear(!1))}}function Q(e){if(!(!e||n.config.minDate&&e<n.config.minDate.getFullYear()||n.config.maxDate&&e>n.config.maxDate.getFullYear())){var t=e,a=n.currentYear!==t;n.currentYear=t||n.currentYear,n.config.maxDate&&n.currentYear===n.config.maxDate.getFullYear()?n.currentMonth=Math.min(n.config.maxDate.getMonth(),n.currentMonth):n.config.minDate&&n.currentYear===n.config.minDate.getFullYear()&&(n.currentMonth=Math.max(n.config.minDate.getMonth(),n.currentMonth)),a&&(n.redraw(),ge("onYearChange"),Y())}}function ee(e,t){var a;void 0===t&&(t=!0);var r=n.parseDate(e,void 0,t);if(n.config.minDate&&r&&O(r,n.config.minDate,void 0!==t?t:!n.minDateHasTime)<0||n.config.maxDate&&r&&O(r,n.config.maxDate,void 0!==t?t:!n.maxDateHasTime)>0)return!1;if(!n.config.enable&&0===n.config.disable.length)return!0;if(void 0===r)return!1;for(var i=!!n.config.enable,o=null!==(a=n.config.enable)&&void 0!==a?a:n.config.disable,s=0,l=void 0;s<o.length;s++){if("function"==typeof(l=o[s])&&l(r))return i;if(l instanceof Date&&void 0!==r&&l.getTime()===r.getTime())return i;if("string"==typeof l){var c=n.parseDate(l,void 0,!0);return c&&c.getTime()===r.getTime()?i:!i}if("object"==typeof l&&void 0!==r&&l.from&&l.to&&r.getTime()>=l.from.getTime()&&r.getTime()<=l.to.getTime())return i}return!i}function te(e){return void 0!==n.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&n.daysContainer.contains(e))}function ne(e){var t=e.target===n._input,a=n._input.value.trimEnd()!==ve();!t||!a||e.relatedTarget&&J(e.relatedTarget)||n.setDate(n._input.value,!0,e.target===n.altInput?n.config.altFormat:n.config.dateFormat)}function ae(t){var a=h(t),r=n.config.wrap?e.contains(a):a===n._input,o=n.config.allowInput,s=n.isOpen&&(!o||!r),l=n.config.inline&&r&&!o;if(13===t.keyCode&&r){if(o)return n.setDate(n._input.value,!0,a===n.altInput?n.config.altFormat:n.config.dateFormat),n.close(),a.blur();n.open()}else if(J(a)||s||l){var c=!!n.timeContainer&&n.timeContainer.contains(a);switch(t.keyCode){case 13:c?(t.preventDefault(),M(),de()):pe(t);break;case 27:t.preventDefault(),de();break;case 8:case 46:r&&!n.config.allowInput&&(t.preventDefault(),n.clear());break;case 37:case 39:if(c||r)n.hourElement&&n.hourElement.focus();else{t.preventDefault();var u=i();if(void 0!==n.daysContainer&&(!1===o||u&&te(u))){var d=39===t.keyCode?1:-1;t.ctrlKey?(t.stopPropagation(),K(d),$(I(1),0)):$(void 0,d)}}break;case 38:case 40:t.preventDefault();var p=40===t.keyCode?1:-1;n.daysContainer&&void 0!==a.$i||a===n.input||a===n.altInput?t.ctrlKey?(t.stopPropagation(),Q(n.currentYear-p),$(I(1),0)):c||$(void 0,7*p):a===n.currentYearElement?Q(n.currentYear-p):n.config.enableTime&&(!c&&n.hourElement&&n.hourElement.focus(),M(t),n._debouncedChange());break;case 9:if(c){var m=[n.hourElement,n.minuteElement,n.secondElement,n.amPM].concat(n.pluginElements).filter((function(e){return e})),b=m.indexOf(a);if(-1!==b){var f=m[b+(t.shiftKey?-1:1)];t.preventDefault(),(f||n._input).focus()}}else!n.config.noCalendar&&n.daysContainer&&n.daysContainer.contains(a)&&t.shiftKey&&(t.preventDefault(),n._input.focus())}}if(void 0!==n.amPM&&a===n.amPM)switch(t.key){case n.l10n.amPM[0].charAt(0):case n.l10n.amPM[0].charAt(0).toLowerCase():n.amPM.textContent=n.l10n.amPM[0],q(),ze();break;case n.l10n.amPM[1].charAt(0):case n.l10n.amPM[1].charAt(0).toLowerCase():n.amPM.textContent=n.l10n.amPM[1],q(),ze()}(r||J(a))&&ge("onKeyDown",t)}function re(e,t){if(void 0===t&&(t="flatpickr-day"),1===n.selectedDates.length&&(!e||e.classList.contains(t)&&!e.classList.contains("flatpickr-disabled"))){for(var a=e?e.dateObj.getTime():n.days.firstElementChild.dateObj.getTime(),r=n.parseDate(n.selectedDates[0],void 0,!0).getTime(),i=Math.min(a,n.selectedDates[0].getTime()),o=Math.max(a,n.selectedDates[0].getTime()),s=!1,l=0,c=0,u=i;u<o;u+=A)ee(new Date(u),!0)||(s=s||u>i&&u<o,u<r&&(!l||u>l)?l=u:u>r&&(!c||u<c)&&(c=u));Array.from(n.rContainer.querySelectorAll("*:nth-child(-n+"+n.config.showMonths+") > ."+t)).forEach((function(t){var i,o,u,d=t.dateObj.getTime(),p=l>0&&d<l||c>0&&d>c;if(p)return t.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(e){t.classList.remove(e)}));s&&!p||(["startRange","inRange","endRange","notAllowed"].forEach((function(e){t.classList.remove(e)})),void 0!==e&&(e.classList.add(a<=n.selectedDates[0].getTime()?"startRange":"endRange"),r<a&&d===r?t.classList.add("startRange"):r>a&&d===r&&t.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=r,u=a,(i=d)>Math.min(o,u)&&i<Math.max(o,u))&&t.classList.add("inRange")))}))}}function ie(){!n.isOpen||n.config.static||n.config.inline||ce()}function oe(e){return function(t){var a=n.config["_"+e+"Date"]=n.parseDate(t,n.config.dateFormat),r=n.config["_"+("min"===e?"max":"min")+"Date"];void 0!==a&&(n["min"===e?"minDateHasTime":"maxDateHasTime"]=a.getHours()>0||a.getMinutes()>0||a.getSeconds()>0),n.selectedDates&&(n.selectedDates=n.selectedDates.filter((function(e){return ee(e)})),n.selectedDates.length||"min"!==e||E(a),ze()),n.daysContainer&&(ue(),void 0!==a?n.currentYearElement[e]=a.getFullYear().toString():n.currentYearElement.removeAttribute(e),n.currentYearElement.disabled=!!r&&void 0!==a&&r.getFullYear()===a.getFullYear())}}function se(){return n.config.wrap?e.querySelector("[data-input]"):e}function le(){"object"!=typeof n.config.locale&&void 0===j.l10ns[n.config.locale]&&n.config.errorHandler(new Error("flatpickr: invalid locale "+n.config.locale)),n.l10n=w(w({},j.l10ns.default),"object"==typeof n.config.locale?n.config.locale:"default"!==n.config.locale?j.l10ns[n.config.locale]:void 0),y.D="("+n.l10n.weekdays.shorthand.join("|")+")",y.l="("+n.l10n.weekdays.longhand.join("|")+")",y.M="("+n.l10n.months.shorthand.join("|")+")",y.F="("+n.l10n.months.longhand.join("|")+")",y.K="("+n.l10n.amPM[0]+"|"+n.l10n.amPM[1]+"|"+n.l10n.amPM[0].toLowerCase()+"|"+n.l10n.amPM[1].toLowerCase()+")",void 0===w(w({},t),JSON.parse(JSON.stringify(e.dataset||{}))).time_24hr&&void 0===j.defaultConfig.time_24hr&&(n.config.time_24hr=n.l10n.time_24hr),n.formatDate=v(n),n.parseDate=z({config:n.config,l10n:n.l10n})}function ce(e){if("function"!=typeof n.config.position){if(void 0!==n.calendarContainer){ge("onPreCalendarPosition");var t=e||n._positionElement,a=Array.prototype.reduce.call(n.calendarContainer.children,(function(e,t){return e+t.offsetHeight}),0),r=n.calendarContainer.offsetWidth,i=n.config.position.split(" "),o=i[0],s=i.length>1?i[1]:null,l=t.getBoundingClientRect(),c=window.innerHeight-l.bottom,u="above"===o||"below"!==o&&c<a&&l.top>a,p=window.pageYOffset+l.top+(u?-a-2:t.offsetHeight+2);if(d(n.calendarContainer,"arrowTop",!u),d(n.calendarContainer,"arrowBottom",u),!n.config.inline){var m=window.pageXOffset+l.left,b=!1,h=!1;"center"===s?(m-=(r-l.width)/2,b=!0):"right"===s&&(m-=r-l.width,h=!0),d(n.calendarContainer,"arrowLeft",!b&&!h),d(n.calendarContainer,"arrowCenter",b),d(n.calendarContainer,"arrowRight",h);var f=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=m+r>window.document.body.offsetWidth,_=f+r>window.document.body.offsetWidth;if(d(n.calendarContainer,"rightMost",g),!n.config.static)if(n.calendarContainer.style.top=p+"px",g)if(_){var y=function(){for(var e=null,t=0;t<document.styleSheets.length;t++){var n=document.styleSheets[t];if(n.cssRules){try{n.cssRules}catch(e){continue}e=n;break}}return null!=e?e:(a=document.createElement("style"),document.head.appendChild(a),a.sheet);var a}();if(void 0===y)return;var M=window.document.body.offsetWidth,v=Math.max(0,M/2-r/2),z=y.cssRules.length,O="{left:"+l.left+"px;right:auto;}";d(n.calendarContainer,"rightMost",!1),d(n.calendarContainer,"centerMost",!0),y.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+O,z),n.calendarContainer.style.left=v+"px",n.calendarContainer.style.right="auto"}else n.calendarContainer.style.left="auto",n.calendarContainer.style.right=f+"px";else n.calendarContainer.style.left=m+"px",n.calendarContainer.style.right="auto"}}}else n.config.position(n,e)}function ue(){n.config.noCalendar||n.isMobile||(Y(),Me(),X())}function de(){n._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(n.close,0):n.close()}function pe(e){e.preventDefault(),e.stopPropagation();var t=function e(t,n){return n(t)?t:t.parentNode?e(t.parentNode,n):void 0}(h(e),(function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")}));if(void 0!==t){var a=t,r=n.latestSelectedDateObj=new Date(a.dateObj.getTime()),i=(r.getMonth()<n.currentMonth||r.getMonth()>n.currentMonth+n.config.showMonths-1)&&"range"!==n.config.mode;if(n.selectedDateElem=a,"single"===n.config.mode)n.selectedDates=[r];else if("multiple"===n.config.mode){var o=ye(r);o?n.selectedDates.splice(parseInt(o),1):n.selectedDates.push(r)}else"range"===n.config.mode&&(2===n.selectedDates.length&&n.clear(!1,!1),n.latestSelectedDateObj=r,n.selectedDates.push(r),0!==O(r,n.selectedDates[0],!0)&&n.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()})));if(q(),i){var s=n.currentYear!==r.getFullYear();n.currentYear=r.getFullYear(),n.currentMonth=r.getMonth(),s&&(ge("onYearChange"),Y()),ge("onMonthChange")}if(Me(),X(),ze(),i||"range"===n.config.mode||1!==n.config.showMonths?void 0!==n.selectedDateElem&&void 0===n.hourElement&&n.selectedDateElem&&n.selectedDateElem.focus():B(a),void 0!==n.hourElement&&void 0!==n.hourElement&&n.hourElement.focus(),n.config.closeOnSelect){var l="single"===n.config.mode&&!n.config.enableTime,c="range"===n.config.mode&&2===n.selectedDates.length&&!n.config.enableTime;(l||c)&&de()}T()}}n.parseDate=z({config:n.config,l10n:n.l10n}),n._handlers=[],n.pluginElements=[],n.loadedPlugins=[],n._bind=S,n._setHoursFromDate=E,n._positionCalendar=ce,n.changeMonth=K,n.changeYear=Q,n.clear=function(e,t){void 0===e&&(e=!0);void 0===t&&(t=!0);n.input.value="",void 0!==n.altInput&&(n.altInput.value="");void 0!==n.mobileInput&&(n.mobileInput.value="");n.selectedDates=[],n.latestSelectedDateObj=void 0,!0===t&&(n.currentYear=n._initialDate.getFullYear(),n.currentMonth=n._initialDate.getMonth());if(!0===n.config.enableTime){var a=x(n.config),r=a.hours,i=a.minutes,o=a.seconds;W(r,i,o)}n.redraw(),e&&ge("onChange")},n.close=function(){n.isOpen=!1,n.isMobile||(void 0!==n.calendarContainer&&n.calendarContainer.classList.remove("open"),void 0!==n._input&&n._input.classList.remove("active"));ge("onClose")},n.onMouseOver=re,n._createElement=p,n.createDay=P,n.destroy=function(){void 0!==n.config&&ge("onDestroy");for(var e=n._handlers.length;e--;)n._handlers[e].remove();if(n._handlers=[],n.mobileInput)n.mobileInput.parentNode&&n.mobileInput.parentNode.removeChild(n.mobileInput),n.mobileInput=void 0;else if(n.calendarContainer&&n.calendarContainer.parentNode)if(n.config.static&&n.calendarContainer.parentNode){var t=n.calendarContainer.parentNode;if(t.lastChild&&t.removeChild(t.lastChild),t.parentNode){for(;t.firstChild;)t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t)}}else n.calendarContainer.parentNode.removeChild(n.calendarContainer);n.altInput&&(n.input.type="text",n.altInput.parentNode&&n.altInput.parentNode.removeChild(n.altInput),delete n.altInput);n.input&&(n.input.type=n.input._type,n.input.classList.remove("flatpickr-input"),n.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete n[e]}catch(e){}}))},n.isEnabled=ee,n.jumpToDate=C,n.updateValue=ze,n.open=function(e,t){void 0===t&&(t=n._positionElement);if(!0===n.isMobile){if(e){e.preventDefault();var a=h(e);a&&a.blur()}return void 0!==n.mobileInput&&(n.mobileInput.focus(),n.mobileInput.click()),void ge("onOpen")}if(n._input.disabled||n.config.inline)return;var r=n.isOpen;n.isOpen=!0,r||(n.calendarContainer.classList.add("open"),n._input.classList.add("active"),ge("onOpen"),ce(t));!0===n.config.enableTime&&!0===n.config.noCalendar&&(!1!==n.config.allowInput||void 0!==e&&n.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return n.hourElement.select()}),50))},n.redraw=ue,n.set=function(e,t){if(null!==e&&"object"==typeof e)for(var r in Object.assign(n.config,e),e)void 0!==me[r]&&me[r].forEach((function(e){return e()}));else n.config[e]=t,void 0!==me[e]?me[e].forEach((function(e){return e()})):a.indexOf(e)>-1&&(n.config[e]=u(t));n.redraw(),ze(!0)},n.setDate=function(e,t,a){void 0===t&&(t=!1);void 0===a&&(a=n.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return n.clear(t);be(e,a),n.latestSelectedDateObj=n.selectedDates[n.selectedDates.length-1],n.redraw(),C(void 0,t),E(),0===n.selectedDates.length&&n.clear(!1);ze(t),t&&ge("onChange")},n.toggle=function(e){if(!0===n.isOpen)return n.close();n.open(e)};var me={locale:[le,G],showMonths:[U,_,V],minDate:[C],maxDate:[C],positionElement:[fe],clickOpens:[function(){!0===n.config.clickOpens?(S(n._input,"focus",n.open),S(n._input,"click",n.open)):(n._input.removeEventListener("focus",n.open),n._input.removeEventListener("click",n.open))}]};function be(e,t){var a=[];if(e instanceof Array)a=e.map((function(e){return n.parseDate(e,t)}));else if(e instanceof Date||"number"==typeof e)a=[n.parseDate(e,t)];else if("string"==typeof e)switch(n.config.mode){case"single":case"time":a=[n.parseDate(e,t)];break;case"multiple":a=e.split(n.config.conjunction).map((function(e){return n.parseDate(e,t)}));break;case"range":a=e.split(n.l10n.rangeSeparator).map((function(e){return n.parseDate(e,t)}))}else n.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));n.selectedDates=n.config.allowInvalidPreload?a:a.filter((function(e){return e instanceof Date&&ee(e,!1)})),"range"===n.config.mode&&n.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()}))}function he(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?n.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:n.parseDate(e.from,void 0),to:n.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function fe(){n._positionElement=n.config.positionElement||n._input}function ge(e,t){if(void 0!==n.config){var a=n.config[e];if(void 0!==a&&a.length>0)for(var r=0;a[r]&&r<a.length;r++)a[r](n.selectedDates,n.input.value,n,t);"onChange"===e&&(n.input.dispatchEvent(_e("change")),n.input.dispatchEvent(_e("input")))}}function _e(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}function ye(e){for(var t=0;t<n.selectedDates.length;t++){var a=n.selectedDates[t];if(a instanceof Date&&0===O(a,e))return""+t}return!1}function Me(){n.config.noCalendar||n.isMobile||!n.monthNav||(n.yearElements.forEach((function(e,t){var a=new Date(n.currentYear,n.currentMonth,1);a.setMonth(n.currentMonth+t),n.config.showMonths>1||"static"===n.config.monthSelectorType?n.monthElements[t].textContent=g(a.getMonth(),n.config.shorthandCurrentMonth,n.l10n)+" ":n.monthsDropdownContainer.value=a.getMonth().toString(),e.value=a.getFullYear().toString()})),n._hidePrevMonthArrow=void 0!==n.config.minDate&&(n.currentYear===n.config.minDate.getFullYear()?n.currentMonth<=n.config.minDate.getMonth():n.currentYear<n.config.minDate.getFullYear()),n._hideNextMonthArrow=void 0!==n.config.maxDate&&(n.currentYear===n.config.maxDate.getFullYear()?n.currentMonth+1>n.config.maxDate.getMonth():n.currentYear>n.config.maxDate.getFullYear()))}function ve(e){var t=e||(n.config.altInput?n.config.altFormat:n.config.dateFormat);return n.selectedDates.map((function(e){return n.formatDate(e,t)})).filter((function(e,t,a){return"range"!==n.config.mode||n.config.enableTime||a.indexOf(e)===t})).join("range"!==n.config.mode?n.config.conjunction:n.l10n.rangeSeparator)}function ze(e){void 0===e&&(e=!0),void 0!==n.mobileInput&&n.mobileFormatStr&&(n.mobileInput.value=void 0!==n.latestSelectedDateObj?n.formatDate(n.latestSelectedDateObj,n.mobileFormatStr):""),n.input.value=ve(n.config.dateFormat),void 0!==n.altInput&&(n.altInput.value=ve(n.config.altFormat)),!1!==e&&ge("onValueUpdate")}function Oe(e){var t=h(e),a=n.prevMonthNav.contains(t),r=n.nextMonthNav.contains(t);a||r?K(a?-1:1):n.yearElements.indexOf(t)>=0?t.select():t.classList.contains("arrowUp")?n.changeYear(n.currentYear+1):t.classList.contains("arrowDown")&&n.changeYear(n.currentYear-1)}return function(){n.element=n.input=e,n.isOpen=!1,function(){var i=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],o=w(w({},JSON.parse(JSON.stringify(e.dataset||{}))),t),s={};n.config.parseDate=o.parseDate,n.config.formatDate=o.formatDate,Object.defineProperty(n.config,"enable",{get:function(){return n.config._enable},set:function(e){n.config._enable=he(e)}}),Object.defineProperty(n.config,"disable",{get:function(){return n.config._disable},set:function(e){n.config._disable=he(e)}});var l="time"===o.mode;if(!o.dateFormat&&(o.enableTime||l)){var c=j.defaultConfig.dateFormat||r.dateFormat;s.dateFormat=o.noCalendar||l?"H:i"+(o.enableSeconds?":S":""):c+" H:i"+(o.enableSeconds?":S":"")}if(o.altInput&&(o.enableTime||l)&&!o.altFormat){var d=j.defaultConfig.altFormat||r.altFormat;s.altFormat=o.noCalendar||l?"h:i"+(o.enableSeconds?":S K":" K"):d+" h:i"+(o.enableSeconds?":S":"")+" K"}Object.defineProperty(n.config,"minDate",{get:function(){return n.config._minDate},set:oe("min")}),Object.defineProperty(n.config,"maxDate",{get:function(){return n.config._maxDate},set:oe("max")});var p=function(e){return function(t){n.config["min"===e?"_minTime":"_maxTime"]=n.parseDate(t,"H:i:S")}};Object.defineProperty(n.config,"minTime",{get:function(){return n.config._minTime},set:p("min")}),Object.defineProperty(n.config,"maxTime",{get:function(){return n.config._maxTime},set:p("max")}),"time"===o.mode&&(n.config.noCalendar=!0,n.config.enableTime=!0);Object.assign(n.config,s,o);for(var m=0;m<i.length;m++)n.config[i[m]]=!0===n.config[i[m]]||"true"===n.config[i[m]];a.filter((function(e){return void 0!==n.config[e]})).forEach((function(e){n.config[e]=u(n.config[e]||[]).map(f)})),n.isMobile=!n.config.disableMobile&&!n.config.inline&&"single"===n.config.mode&&!n.config.disable.length&&!n.config.enable&&!n.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(m=0;m<n.config.plugins.length;m++){var b=n.config.plugins[m](n)||{};for(var h in b)a.indexOf(h)>-1?n.config[h]=u(b[h]).map(f).concat(n.config[h]):void 0===o[h]&&(n.config[h]=b[h])}o.altInputClass||(n.config.altInputClass=se().className+" "+n.config.altInputClass);ge("onParseConfig")}(),le(),function(){if(n.input=se(),!n.input)return void n.config.errorHandler(new Error("Invalid input element specified"));n.input._type=n.input.type,n.input.type="text",n.input.classList.add("flatpickr-input"),n._input=n.input,n.config.altInput&&(n.altInput=p(n.input.nodeName,n.config.altInputClass),n._input=n.altInput,n.altInput.placeholder=n.input.placeholder,n.altInput.disabled=n.input.disabled,n.altInput.required=n.input.required,n.altInput.tabIndex=n.input.tabIndex,n.altInput.type="text",n.input.setAttribute("type","hidden"),!n.config.static&&n.input.parentNode&&n.input.parentNode.insertBefore(n.altInput,n.input.nextSibling));n.config.allowInput||n._input.setAttribute("readonly","readonly");fe()}(),function(){n.selectedDates=[],n.now=n.parseDate(n.config.now)||new Date;var e=n.config.defaultDate||("INPUT"!==n.input.nodeName&&"TEXTAREA"!==n.input.nodeName||!n.input.placeholder||n.input.value!==n.input.placeholder?n.input.value:null);e&&be(e,n.config.dateFormat);n._initialDate=n.selectedDates.length>0?n.selectedDates[0]:n.config.minDate&&n.config.minDate.getTime()>n.now.getTime()?n.config.minDate:n.config.maxDate&&n.config.maxDate.getTime()<n.now.getTime()?n.config.maxDate:n.now,n.currentYear=n._initialDate.getFullYear(),n.currentMonth=n._initialDate.getMonth(),n.selectedDates.length>0&&(n.latestSelectedDateObj=n.selectedDates[0]);void 0!==n.config.minTime&&(n.config.minTime=n.parseDate(n.config.minTime,"H:i"));void 0!==n.config.maxTime&&(n.config.maxTime=n.parseDate(n.config.maxTime,"H:i"));n.minDateHasTime=!!n.config.minDate&&(n.config.minDate.getHours()>0||n.config.minDate.getMinutes()>0||n.config.minDate.getSeconds()>0),n.maxDateHasTime=!!n.config.maxDate&&(n.config.maxDate.getHours()>0||n.config.maxDate.getMinutes()>0||n.config.maxDate.getSeconds()>0)}(),n.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=n.currentMonth),void 0===t&&(t=n.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:n.l10n.daysInMonth[e]}},n.isMobile||function(){var e=window.document.createDocumentFragment();if(n.calendarContainer=p("div","flatpickr-calendar"),n.calendarContainer.tabIndex=-1,!n.config.noCalendar){if(e.appendChild((n.monthNav=p("div","flatpickr-months"),n.yearElements=[],n.monthElements=[],n.prevMonthNav=p("span","flatpickr-prev-month"),n.prevMonthNav.innerHTML=n.config.prevArrow,n.nextMonthNav=p("span","flatpickr-next-month"),n.nextMonthNav.innerHTML=n.config.nextArrow,U(),Object.defineProperty(n,"_hidePrevMonthArrow",{get:function(){return n.__hidePrevMonthArrow},set:function(e){n.__hidePrevMonthArrow!==e&&(d(n.prevMonthNav,"flatpickr-disabled",e),n.__hidePrevMonthArrow=e)}}),Object.defineProperty(n,"_hideNextMonthArrow",{get:function(){return n.__hideNextMonthArrow},set:function(e){n.__hideNextMonthArrow!==e&&(d(n.nextMonthNav,"flatpickr-disabled",e),n.__hideNextMonthArrow=e)}}),n.currentYearElement=n.yearElements[0],Me(),n.monthNav)),n.innerContainer=p("div","flatpickr-innerContainer"),n.config.weekNumbers){var t=function(){n.calendarContainer.classList.add("hasWeeks");var e=p("div","flatpickr-weekwrapper");e.appendChild(p("span","flatpickr-weekday",n.l10n.weekAbbreviation));var t=p("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}(),a=t.weekWrapper,r=t.weekNumbers;n.innerContainer.appendChild(a),n.weekNumbers=r,n.weekWrapper=a}n.rContainer=p("div","flatpickr-rContainer"),n.rContainer.appendChild(V()),n.daysContainer||(n.daysContainer=p("div","flatpickr-days"),n.daysContainer.tabIndex=-1),X(),n.rContainer.appendChild(n.daysContainer),n.innerContainer.appendChild(n.rContainer),e.appendChild(n.innerContainer)}n.config.enableTime&&e.appendChild(function(){n.calendarContainer.classList.add("hasTime"),n.config.noCalendar&&n.calendarContainer.classList.add("noCalendar");var e=x(n.config);n.timeContainer=p("div","flatpickr-time"),n.timeContainer.tabIndex=-1;var t=p("span","flatpickr-time-separator",":"),a=b("flatpickr-hour",{"aria-label":n.l10n.hourAriaLabel});n.hourElement=a.getElementsByTagName("input")[0];var r=b("flatpickr-minute",{"aria-label":n.l10n.minuteAriaLabel});n.minuteElement=r.getElementsByTagName("input")[0],n.hourElement.tabIndex=n.minuteElement.tabIndex=-1,n.hourElement.value=s(n.latestSelectedDateObj?n.latestSelectedDateObj.getHours():n.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),n.minuteElement.value=s(n.latestSelectedDateObj?n.latestSelectedDateObj.getMinutes():e.minutes),n.hourElement.setAttribute("step",n.config.hourIncrement.toString()),n.minuteElement.setAttribute("step",n.config.minuteIncrement.toString()),n.hourElement.setAttribute("min",n.config.time_24hr?"0":"1"),n.hourElement.setAttribute("max",n.config.time_24hr?"23":"12"),n.hourElement.setAttribute("maxlength","2"),n.minuteElement.setAttribute("min","0"),n.minuteElement.setAttribute("max","59"),n.minuteElement.setAttribute("maxlength","2"),n.timeContainer.appendChild(a),n.timeContainer.appendChild(t),n.timeContainer.appendChild(r),n.config.time_24hr&&n.timeContainer.classList.add("time24hr");if(n.config.enableSeconds){n.timeContainer.classList.add("hasSeconds");var i=b("flatpickr-second");n.secondElement=i.getElementsByTagName("input")[0],n.secondElement.value=s(n.latestSelectedDateObj?n.latestSelectedDateObj.getSeconds():e.seconds),n.secondElement.setAttribute("step",n.minuteElement.getAttribute("step")),n.secondElement.setAttribute("min","0"),n.secondElement.setAttribute("max","59"),n.secondElement.setAttribute("maxlength","2"),n.timeContainer.appendChild(p("span","flatpickr-time-separator",":")),n.timeContainer.appendChild(i)}n.config.time_24hr||(n.amPM=p("span","flatpickr-am-pm",n.l10n.amPM[l((n.latestSelectedDateObj?n.hourElement.value:n.config.defaultHour)>11)]),n.amPM.title=n.l10n.toggleTitle,n.amPM.tabIndex=-1,n.timeContainer.appendChild(n.amPM));return n.timeContainer}());d(n.calendarContainer,"rangeMode","range"===n.config.mode),d(n.calendarContainer,"animate",!0===n.config.animate),d(n.calendarContainer,"multiMonth",n.config.showMonths>1),n.calendarContainer.appendChild(e);var i=void 0!==n.config.appendTo&&void 0!==n.config.appendTo.nodeType;if((n.config.inline||n.config.static)&&(n.calendarContainer.classList.add(n.config.inline?"inline":"static"),n.config.inline&&(!i&&n.element.parentNode?n.element.parentNode.insertBefore(n.calendarContainer,n._input.nextSibling):void 0!==n.config.appendTo&&n.config.appendTo.appendChild(n.calendarContainer)),n.config.static)){var o=p("div","flatpickr-wrapper");n.element.parentNode&&n.element.parentNode.insertBefore(o,n.element),o.appendChild(n.element),n.altInput&&o.appendChild(n.altInput),o.appendChild(n.calendarContainer)}n.config.static||n.config.inline||(void 0!==n.config.appendTo?n.config.appendTo:window.document.body).appendChild(n.calendarContainer)}(),function(){n.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(n.element.querySelectorAll("[data-"+e+"]"),(function(t){return S(t,"click",n[e])}))}));if(n.isMobile)return void function(){var e=n.config.enableTime?n.config.noCalendar?"time":"datetime-local":"date";n.mobileInput=p("input",n.input.className+" flatpickr-mobile"),n.mobileInput.tabIndex=1,n.mobileInput.type=e,n.mobileInput.disabled=n.input.disabled,n.mobileInput.required=n.input.required,n.mobileInput.placeholder=n.input.placeholder,n.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",n.selectedDates.length>0&&(n.mobileInput.defaultValue=n.mobileInput.value=n.formatDate(n.selectedDates[0],n.mobileFormatStr));n.config.minDate&&(n.mobileInput.min=n.formatDate(n.config.minDate,"Y-m-d"));n.config.maxDate&&(n.mobileInput.max=n.formatDate(n.config.maxDate,"Y-m-d"));n.input.getAttribute("step")&&(n.mobileInput.step=String(n.input.getAttribute("step")));n.input.type="hidden",void 0!==n.altInput&&(n.altInput.type="hidden");try{n.input.parentNode&&n.input.parentNode.insertBefore(n.mobileInput,n.input.nextSibling)}catch(e){}S(n.mobileInput,"change",(function(e){n.setDate(h(e).value,!1,n.mobileFormatStr),ge("onChange"),ge("onClose")}))}();var e=c(ie,50);n._debouncedChange=c(T,300),n.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&S(n.daysContainer,"mouseover",(function(e){"range"===n.config.mode&&re(h(e))}));S(n._input,"keydown",ae),void 0!==n.calendarContainer&&S(n.calendarContainer,"keydown",ae);n.config.inline||n.config.static||S(window,"resize",e);void 0!==window.ontouchstart?S(window.document,"touchstart",Z):S(window.document,"mousedown",Z);S(window.document,"focus",Z,{capture:!0}),!0===n.config.clickOpens&&(S(n._input,"focus",n.open),S(n._input,"click",n.open));void 0!==n.daysContainer&&(S(n.monthNav,"click",Oe),S(n.monthNav,["keyup","increment"],L),S(n.daysContainer,"click",pe));if(void 0!==n.timeContainer&&void 0!==n.minuteElement&&void 0!==n.hourElement){S(n.timeContainer,["increment"],M),S(n.timeContainer,"blur",M,{capture:!0}),S(n.timeContainer,"click",R),S([n.hourElement,n.minuteElement],["focus","click"],(function(e){return h(e).select()})),void 0!==n.secondElement&&S(n.secondElement,"focus",(function(){return n.secondElement&&n.secondElement.select()})),void 0!==n.amPM&&S(n.amPM,"click",(function(e){M(e)}))}n.config.allowInput&&S(n._input,"blur",ne)}(),(n.selectedDates.length||n.config.noCalendar)&&(n.config.enableTime&&E(n.config.noCalendar?n.latestSelectedDateObj:void 0),ze(!1)),_();var i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!n.isMobile&&i&&ce(),ge("onReady")}(),n}function E(e,t){for(var n=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],r=0;r<n.length;r++){var i=n[r];try{if(null!==i.getAttribute("data-fp-omit"))continue;void 0!==i._flatpickr&&(i._flatpickr.destroy(),i._flatpickr=void 0),i._flatpickr=q(i,t||{}),a.push(i._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return E(this,e)},HTMLElement.prototype.flatpickr=function(e){return E([this],e)});var j=function(e,t){return"string"==typeof e?E(window.document.querySelectorAll(e),t):e instanceof Node?E([e],t):E(e,t)};j.defaultConfig={},j.l10ns={en:w({},o),default:w({},o)},j.localize=function(e){j.l10ns.default=w(w({},j.l10ns.default),e)},j.setDefaults=function(e){j.defaultConfig=w(w({},j.defaultConfig),e)},j.parseDate=z({}),j.formatDate=v({}),j.compareDates=O,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return E(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=j);t.a=j},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){return[].slice.call(t.querySelectorAll("*"),0).reduce((function(t,n){return t.concat(n.shadowRoot?e(n.shadowRoot):[n])}),[]).filter(o)};
21
+ */!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};void 0===(a=function(){return i}.call(t,n,t,e))||(e.exports=a)}()},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5);t.a=function(e){var t=e.size,n=void 0===t?"lg":t,a=e.widths,i=void 0===a?[1]:a,l=e.colors,c=void 0===l?[]:l,u=function(e){return e.map((function(e){return parseInt(e.toString().replace(/[^0-9.]/gi,""))}))}(i);return r.a.createElement("div",{className:o()("pb_distribution_bar_".concat(n),Object(s.c)(e))},function(e,t){var n=e.reduce((function(e,t){return e+t}),0);return e.map((function(e,a){return r.a.createElement("div",{className:o()("pb_distribution_width",t[a]?"color_".concat(t[a]):""),key:a,style:{width:"".concat(100*e/n,"%")}})}))}(u,c))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(53),l=n(2),c=n(5),u=n(13),d=n(17);t.a=function(e){e.date&&Object(c.a)("Time Stacked",["date"]);var t=e.align,n=void 0===t?"left":t,a=e.className,i=e.dark,p=e.data,m=void 0===p?{}:p,b=e.date,h=e.time,f=e.timeZone,g=o()(Object(l.b)("pb_time_stacked_kit",n),Object(c.c)(e),a),_=Object(l.c)(m),y=new s.a({value:b||new Date(h),zone:f});return r.a.createElement("div",Object.assign({className:g},_),r.a.createElement(u.a,{className:o()("pb_time_stacked","time-spacing"),color:"light",dark:i},r.a.createElement("time",null,y.toTimeWithMeridian(),r.a.createElement(d.a,{className:"pb_time_stacked",color:"light",dark:i,tag:"span",text:y.toTimezone()}))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,a=e.aria,i=void 0===a?{}:a,d=e.className,p=e.dark,m=e.data,b=void 0===m?{}:m,h=e.icon,f=e.id,g=e.text,_=Object(s.a)(i),y=Object(s.c)(b),M=o()(Object(s.b)("pb_icon_value_kit",n),Object(l.c)(e),d);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:f}),r.a.createElement(c.a,{color:"light",dark:p},r.a.createElement(u.a,{dark:p,fixedWidth:!0,icon:h}),g))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(106),u=n(17);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.data,d=void 0===i?{}:i,p=e.id,m=e.label,b=e.pillValue,h=e.variant,f=void 0===h?"neutral":h,g=Object(l.a)(n),_=Object(l.c)(d),y=o()("pb_label_pill_kit",Object(s.c)(e),a);return r.a.createElement("div",Object.assign({},g,_,{className:y,id:p}),r.a.createElement(u.a,{className:"pb_label_pill_label",text:m}),r.a.createElement(c.a,{className:"pb_label_pill_pill",text:b,variant:f}))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(33),u=n(13),d=n(11),p=n(30),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.avatarName,i=e.avatarStatus,b=void 0===i?null:i,h=e.avatarUrl,f=e.children,g=e.className,_=e.data,y=void 0===_?{}:_,M=e.id,v=e.label,z=e.message,O=e.timestamp,k=e.timestampObject,A=e.timezone,x=e.alignTimestamp,w=void 0===x?"right":x,N=Object(s.a)(n),q=Object(s.c)(y),E=h||a,j=E?"pb_message_kit_avatar":"pb_message_kit",W=o()(Object(s.b)(j),Object(l.c)(e),g);return r.a.createElement("div",Object.assign({},N,q,{className:W,id:M}),E&&r.a.createElement(c.a,{imageUrl:h,name:a,size:"xs",status:b}),r.a.createElement("div",{className:"content_wrapper"},r.a.createElement(d.a,{justify:"left"===w?"none":"between",orientation:"row"},v&&r.a.createElement(m.a,{className:"message_title",size:4,text:v}),r.a.createElement(p.a,{className:"pull-".concat(w," ").concat(k?"message_humanized_time":null),text:O,timestamp:"",timezone:A}),k&&r.a.createElement(p.a,{className:"pull-".concat(w," message_timestamp"),text:"",timestamp:k,timezone:A})),z&&r.a.createElement(u.a,{className:"pb_message_body",text:z}),f))}},function(e,t,n){"use strict";e.exports=n(388)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(r=a.key,i=void 0,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(r,"string"))?i:String(i)),a)}var r,i}function i(e,t){return(i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=l(e);if(t){var r=l(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return s(this,n)}}function s(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return c}));var c=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(c,e);var t,n,s,l=o(c);function c(){return a(this,c),l.apply(this,arguments)}return t=c,s=[{key:"selector",get:function(){return".table-responsive-collapse"}}],(n=[{key:"connect",value:function(){var e=document.querySelectorAll(".table-responsive-collapse");[].forEach.call(e,(function(e){var t=[];[].forEach.call(e.querySelectorAll("th"),(function(e){for(var n=e.colSpan,a=0;a<n;a++)t.push(e.textContent.replace(/\r?\n|\r/,""))})),[].forEach.call(e.querySelectorAll("tbody tr"),(function(e){[].forEach.call(e.cells,(function(e,n){e.setAttribute("data-title",t[n])}))}))}))}}])&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(r=a.key,i=void 0,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(r,"string"))?i:String(i)),a)}var r,i}function i(e,t){return(i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=l(e);if(t){var r=l(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return s(this,n)}}function s(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return c}));var c=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(c,e);var t,n,s,l=o(c);function c(){return a(this,c),l.apply(this,arguments)}return t=c,s=[{key:"selector",get:function(){return".resize_auto textarea"}}],(n=[{key:"onInput",value:function(){this.style.height="auto",this.style.height=this.scrollHeight+"px"}},{key:"connect",value:function(){this.element.setAttribute("style","height:"+this.element.scrollHeight+"px;overflow-y:hidden;"),this.element.addEventListener("input",this.onInput,!1)}}])&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";var a=n(0),r=n.n(a);function i(e){return e.split("-")[1]}function o(e){return"y"===e?"height":"width"}function s(e){return e.split("-")[0]}function l(e){return["top","bottom"].includes(s(e))?"x":"y"}function c(e,t,n){let{reference:a,floating:r}=e;const c=a.x+a.width/2-r.width/2,u=a.y+a.height/2-r.height/2,d=l(t),p=o(d),m=a[p]/2-r[p]/2,b="x"===d;let h;switch(s(t)){case"top":h={x:c,y:a.y-r.height};break;case"bottom":h={x:c,y:a.y+a.height};break;case"right":h={x:a.x+a.width,y:u};break;case"left":h={x:a.x-r.width,y:u};break;default:h={x:a.x,y:a.y}}switch(i(t)){case"start":h[d]-=m*(n&&b?-1:1);break;case"end":h[d]+=m*(n&&b?-1:1)}return h}function u(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function d(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function p(e,t){var n;void 0===t&&(t={});const{x:a,y:r,platform:i,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:b=!1,padding:h=0}=t,f=u(h),g=s[b?"floating"===m?"reference":"floating":m],_=d(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:p,strategy:l})),y="floating"===m?{...o.floating,x:a,y:r}:o.reference,M=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(M))&&await(null==i.getScale?void 0:i.getScale(M))||{x:1,y:1},z=d(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:M,strategy:l}):y);return{top:(_.top-z.top+f.top)/v.y,bottom:(z.bottom-_.bottom+f.bottom)/v.y,left:(_.left-z.left+f.left)/v.x,right:(z.right-_.right+f.right)/v.x}}const m=Math.min,b=Math.max;function h(e,t,n){return b(e,m(t,n))}const f=e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:a=0}=e||{},{x:r,y:s,placement:c,rects:d,platform:p,elements:m}=t;if(null==n)return{};const b=u(a),f={x:r,y:s},g=l(c),_=o(g),y=await p.getDimensions(n),M="y"===g,v=M?"top":"left",z=M?"bottom":"right",O=M?"clientHeight":"clientWidth",k=d.reference[_]+d.reference[g]-f[g]-d.floating[_],A=f[g]-d.reference[g],x=await(null==p.getOffsetParent?void 0:p.getOffsetParent(n));let w=x?x[O]:0;w&&await(null==p.isElement?void 0:p.isElement(x))||(w=m.floating[O]||d.floating[_]);const N=k/2-A/2,q=b[v],E=w-y[_]-b[z],j=w/2-y[_]/2+N,W=h(q,j,E),L=null!=i(c)&&j!=W&&d.reference[_]/2-(j<q?b[v]:b[z])-y[_]/2<0;return{[g]:f[g]-(L?j<q?q-j:E-j:0),data:{[g]:W,centerOffset:j-W}}}}),g={left:"right",right:"left",bottom:"top",top:"bottom"};function _(e){return e.replace(/left|right|bottom|top/g,e=>g[e])}function y(e,t,n){void 0===n&&(n=!1);const a=i(e),r=l(e),s=o(r);let c="x"===r?a===(n?"end":"start")?"right":"left":"start"===a?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=_(c)),{main:c,cross:_(c)}}const M={start:"end",end:"start"};function v(e){return e.replace(/start|end/g,e=>M[e])}const z=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:a,middlewareData:r,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...M}=e,z=s(a),O=s(l)===l,k=await(null==c.isRTL?void 0:c.isRTL(u.floating)),A=b||(O||!g?[_(l)]:function(e){const t=_(e);return[v(e),t,v(t)]}(l));b||"none"===f||A.push(...function(e,t,n,a){const r=i(e);let o=function(e,t,n){const a=["left","right"],r=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:a:t?a:r;case"left":case"right":return t?i:o;default:return[]}}(s(e),"start"===n,a);return r&&(o=o.map(e=>e+"-"+r),t&&(o=o.concat(o.map(v)))),o}(l,g,f,k));const x=[l,...A],w=await p(t,M),N=[];let q=(null==(n=r.flip)?void 0:n.overflows)||[];if(d&&N.push(w[z]),m){const{main:e,cross:t}=y(a,o,k);N.push(w[e],w[t])}if(q=[...q,{placement:a,overflows:N}],!N.every(e=>e<=0)){var E,j;const e=((null==(E=r.flip)?void 0:E.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:q},reset:{placement:t}};let n=null==(j=q.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(h){case"bestFit":{var W;const e=null==(W=q.map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:W[0];e&&(n=e);break}case"initialPlacement":n=l}if(a!==n)return{reset:{placement:n}}}return{}}}};const O=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:a}=t,r=await async function(e,t){const{placement:n,platform:a,elements:r}=e,o=await(null==a.isRTL?void 0:a.isRTL(r.floating)),c=s(n),u=i(n),d="x"===l(n),p=["left","top"].includes(c)?-1:1,m=o&&d?-1:1,b="function"==typeof t?t(e):t;let{mainAxis:h,crossAxis:f,alignmentAxis:g}="number"==typeof b?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...b};return u&&"number"==typeof g&&(f="end"===u?-1*g:g),d?{x:f*m,y:h*p}:{x:h*p,y:f*m}}(t,e);return{x:n+r.x,y:a+r.y,data:r}}}};function k(e){return"x"===e?"y":"x"}function A(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function x(e){return A(e).getComputedStyle(e)}function w(e){return e instanceof A(e).Node}function N(e){return w(e)?(e.nodeName||"").toLowerCase():""}let q;function E(){if(q)return q;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(q=e.brands.map(e=>e.brand+"/"+e.version).join(" "),q):navigator.userAgent}function j(e){return e instanceof A(e).HTMLElement}function W(e){return e instanceof A(e).Element}function L(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof A(e).ShadowRoot||e instanceof ShadowRoot}function S(e){const{overflow:t,overflowX:n,overflowY:a,display:r}=x(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(r)}function T(e){return["table","td","th"].includes(N(e))}function C(e){const t=/firefox/i.test(E()),n=x(e),a=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!a&&"none"!==a||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some(e=>n.willChange.includes(e))||["paint","layout","strict","content"].some(e=>{const t=n.contain;return null!=t&&t.includes(e)})}function R(){return/^((?!chrome|android).)*safari/i.test(E())}function D(e){return["html","body","#document"].includes(N(e))}const P=Math.min,B=Math.max,I=Math.round;function $(e){const t=x(e);let n=parseFloat(t.width),a=parseFloat(t.height);const r=j(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:a,s=I(n)!==i||I(a)!==o;return s&&(n=i,a=o),{width:n,height:a,fallback:s}}function F(e){return W(e)?e:e.contextElement}const X={x:1,y:1};function Y(e){const t=F(e);if(!j(t))return X;const n=t.getBoundingClientRect(),{width:a,height:r,fallback:i}=$(t);let o=(i?I(n.width):n.width)/a,s=(i?I(n.height):n.height)/r;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}function H(e,t,n,a){var r,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=F(e);let l=X;t&&(a?W(a)&&(l=Y(a)):l=Y(e));const c=s?A(s):window,u=R()&&n;let p=(o.left+(u&&(null==(r=c.visualViewport)?void 0:r.offsetLeft)||0))/l.x,m=(o.top+(u&&(null==(i=c.visualViewport)?void 0:i.offsetTop)||0))/l.y,b=o.width/l.x,h=o.height/l.y;if(s){const e=A(s),t=a&&W(a)?A(a):a;let n=e.frameElement;for(;n&&a&&t!==e;){const e=Y(n),t=n.getBoundingClientRect(),a=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(a.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(a.paddingTop))*e.y,p*=e.x,m*=e.y,b*=e.x,h*=e.y,p+=t.x,m+=t.y,n=A(n).frameElement}}return d({width:b,height:h,x:p,y:m})}function U(e){return((w(e)?e.ownerDocument:e.document)||window.document).documentElement}function V(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function G(e){return H(U(e)).left+V(e).scrollLeft}function K(e){if("html"===N(e))return e;const t=e.assignedSlot||e.parentNode||L(e)&&e.host||U(e);return L(t)?t.host:t}function J(e,t){var n;void 0===t&&(t=[]);const a=function e(t){const n=K(t);return D(n)?n.ownerDocument.body:j(n)&&S(n)?n:e(n)}(e),r=a===(null==(n=e.ownerDocument)?void 0:n.body),i=A(a);return r?t.concat(i,i.visualViewport||[],S(a)?a:[]):t.concat(a,J(a))}function Z(e,t,n){let a;if("viewport"===t)a=function(e,t){const n=A(e),a=U(e),r=n.visualViewport;let i=a.clientWidth,o=a.clientHeight,s=0,l=0;if(r){i=r.width,o=r.height;const e=R();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}return{width:i,height:o,x:s,y:l}}(e,n);else if("document"===t)a=function(e){const t=U(e),n=V(e),a=e.ownerDocument.body,r=B(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),i=B(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let o=-n.scrollLeft+G(e);const s=-n.scrollTop;return"rtl"===x(a).direction&&(o+=B(t.clientWidth,a.clientWidth)-r),{width:r,height:i,x:o,y:s}}(U(e));else if(W(t))a=function(e,t){const n=H(e,!0,"fixed"===t),a=n.top+e.clientTop,r=n.left+e.clientLeft,i=j(e)?Y(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:a*i.y}}(t,n);else{const n={...t};if(R()){var r,i;const t=A(e);n.x-=(null==(r=t.visualViewport)?void 0:r.offsetLeft)||0,n.y-=(null==(i=t.visualViewport)?void 0:i.offsetTop)||0}a=n}return d(a)}function Q(e,t){return j(e)&&"fixed"!==x(e).position?t?t(e):e.offsetParent:null}function ee(e,t){const n=A(e);if(!j(e))return n;let a=Q(e,t);for(;a&&T(a)&&"static"===x(a).position;)a=Q(a,t);return a&&("html"===N(a)||"body"===N(a)&&"static"===x(a).position&&!C(a))?n:a||function(e){let t=K(e);for(;j(t)&&!D(t);){if(C(t))return t;t=K(t)}return null}(e)||n}function te(e,t,n){const a=j(t),r=U(t),i=H(e,!0,"fixed"===n,t);let o={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(a||!a&&"fixed"!==n)if(("body"!==N(t)||S(r))&&(o=V(t)),j(t)){const e=H(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else r&&(s.x=G(r));return{x:i.left+o.scrollLeft-s.x,y:i.top+o.scrollTop-s.y,width:i.width,height:i.height}}const ne={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let a=J(e).filter(e=>W(e)&&"body"!==N(e)),r=null;const i="fixed"===x(e).position;let o=i?K(e):e;for(;W(o)&&!D(o);){const e=x(o),t=C(o);if("fixed"===e.position)r=null;else{(i?!t&&!r:!t&&"static"===e.position&&!!r&&["absolute","fixed"].includes(r.position))?a=a.filter(e=>e!==o):r=e}o=K(o)}return t.set(e,a),a}(t,this._c):[].concat(n),a],o=i[0],s=i.reduce((e,n)=>{const a=Z(t,n,r);return e.top=B(a.top,e.top),e.right=P(a.right,e.right),e.bottom=P(a.bottom,e.bottom),e.left=B(a.left,e.left),e},Z(t,o,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:a}=e;const r=j(n),i=U(n);if(n===i)return t;let o={scrollLeft:0,scrollTop:0},s={x:1,y:1};const l={x:0,y:0};if((r||!r&&"fixed"!==a)&&(("body"!==N(n)||S(i))&&(o=V(n)),j(n))){const e=H(n);s=Y(n),l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-o.scrollLeft*s.x+l.x,y:t.y*s.y-o.scrollTop*s.y+l.y}},isElement:W,getDimensions:function(e){return $(e)},getOffsetParent:ee,getDocumentElement:U,getScale:Y,async getElementRects(e){let{reference:t,floating:n,strategy:a}=e;const r=this.getOffsetParent||ee,i=this.getDimensions;return{reference:te(t,await r(n),a),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===x(e).direction};const ae=(e,t,n)=>{const a=new Map,r={platform:ne,...n},i={...r.platform,_c:a};return(async(e,t,n)=>{const{placement:a="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,s=i.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:p}=c(u,a,l),m=a,b={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:f}=s[n],{x:g,y:_,data:y,reset:M}=await f({x:d,y:p,initialPlacement:a,placement:m,strategy:r,middlewareData:b,rects:u,platform:o,elements:{reference:e,floating:t}});d=null!=g?g:d,p=null!=_?_:p,b={...b,[i]:{...b[i],...y}},M&&h<=50&&(h++,"object"==typeof M&&(M.placement&&(m=M.placement),M.rects&&(u=!0===M.rects?await o.getElementRects({reference:e,floating:t,strategy:r}):M.rects),({x:d,y:p}=c(u,m,l))),n=-1)}return{x:d,y:p,placement:m,strategy:r,middlewareData:b}})(e,t,{...r,platform:i})};var re=n(28);const ie=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return a=t,Object.prototype.hasOwnProperty.call(a,"current")?null!=t.current?f({element:t.current,padding:n}).fn(e):{}:t?f({element:t,padding:n}).fn(e):{};var a}}};var oe="undefined"!=typeof document?a.useLayoutEffect:a.useEffect;function se(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,a,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!se(e[a],t[a]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,r[a]))return!1;for(a=n;0!=a--;){const n=r[a];if(("_owner"!==n||!e.$$typeof)&&!se(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function le(e){const t=a.useRef(e);return oe(()=>{t.current=e}),t}new WeakMap,new WeakMap;var ce="undefined"==typeof Element;ce||Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,!ce&&Element.prototype.getRootNode;var ue="undefined"!=typeof document?a.useLayoutEffect:a.useEffect;let de=!1,pe=0;const me=()=>"floating-ui-"+pe++;const be=a["useId".toString()]||function(){const[e,t]=a.useState(()=>de?me():void 0);return ue(()=>{null==e&&t(me())},[]),a.useEffect(()=>{de||(de=!0)},[]),e};function he(){const e=new Map;return{emit(t,n){var a;null==(a=e.get(t))||a.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var a;e.set(t,(null==(a=e.get(t))?void 0:a.filter(e=>e!==n))||[])}}}const fe=a.createContext(null),ge=a.createContext(null),_e=()=>{var e;return(null==(e=a.useContext(fe))?void 0:e.id)||null},ye=()=>a.useContext(ge);function Me(e){return(null==e?void 0:e.ownerDocument)||document}function ve(e){return Me(e).defaultView||window}function ze(e){return!!e&&e instanceof ve(e).Element}function Oe(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function ke(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(a=n,"undefined"!=typeof ShadowRoot&&(a instanceof ve(a).ShadowRoot||a instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var a;return!1}function Ae(e){const t=Object(a.useRef)(e);return ue(()=>{t.current=e}),t}function xe(e,t,n){return n&&!Oe(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const we=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:i,events:o,elements:{domReference:s,floating:l},refs:c}=e,{enabled:u=!0,delay:d=0,handleClose:p=null,mouseOnly:m=!1,restMs:b=0,move:h=!0}=t,f=ye(),g=_e(),_=Ae(p),y=Ae(d),M=a.useRef(),v=a.useRef(),z=a.useRef(),O=a.useRef(),k=a.useRef(!0),A=a.useRef(!1),x=a.useRef(()=>{}),w=a.useCallback(()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t},[i]);a.useEffect(()=>{if(u)return o.on("dismiss",e),()=>{o.off("dismiss",e)};function e(){clearTimeout(v.current),clearTimeout(O.current),k.current=!0}},[u,o]),a.useEffect(()=>{if(!u||!_.current||!n)return;function e(){w()&&r(!1)}const t=Me(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[l,n,r,u,_,i,w]);const N=a.useCallback((function(e){void 0===e&&(e=!0);const t=xe(y.current,"close",M.current);t&&!z.current?(clearTimeout(v.current),v.current=setTimeout(()=>r(!1),t)):e&&(clearTimeout(v.current),r(!1))}),[y,r]),q=a.useCallback(()=>{x.current(),z.current=void 0},[]),E=a.useCallback(()=>{if(A.current){const e=Me(c.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),A.current=!1}},[c]);return a.useEffect(()=>{if(u&&ze(s)){const e=s;return n&&e.addEventListener("mouseleave",c),null==l||l.addEventListener("mouseleave",c),h&&e.addEventListener("mousemove",a,{once:!0}),e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",o),()=>{n&&e.removeEventListener("mouseleave",c),null==l||l.removeEventListener("mouseleave",c),h&&e.removeEventListener("mousemove",a),e.removeEventListener("mouseenter",a),e.removeEventListener("mouseleave",o)}}function t(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function a(e){if(clearTimeout(v.current),k.current=!1,m&&!Oe(M.current)||b>0&&0===xe(y.current,"open"))return;i.current.openEvent=e;const t=xe(y.current,"open",M.current);t?v.current=setTimeout(()=>{r(!0)},t):r(!0)}function o(a){if(t())return;x.current();const r=Me(l);if(clearTimeout(O.current),_.current){n||clearTimeout(v.current),z.current=_.current({...e,tree:f,x:a.clientX,y:a.clientY,onClose(){E(),q(),N()}});const t=z.current;return r.addEventListener("mousemove",t),void(x.current=()=>{r.removeEventListener("mousemove",t)})}("touch"!==M.current||!ke(l,a.relatedTarget))&&N()}function c(n){t()||null==_.current||_.current({...e,tree:f,x:n.clientX,y:n.clientY,onClose(){E(),q(),N()}})(n)}},[s,l,u,e,m,b,h,N,q,E,r,n,f,y,_,i]),ue(()=>{var e;if(u&&n&&null!=(e=_.current)&&e.__options.blockPointerEvents&&w()){const e=Me(l).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",A.current=!0,ze(s)&&l){var t,a;const e=s,n=null==f||null==(t=f.nodesRef.current.find(e=>e.id===g))||null==(a=t.context)?void 0:a.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}},[u,n,g,l,s,f,_,i,w]),ue(()=>{n||(M.current=void 0,q(),E())},[n,q,E]),a.useEffect(()=>()=>{q(),clearTimeout(v.current),clearTimeout(O.current),E()},[u,q,E]),a.useMemo(()=>{if(!u)return{};function e(e){M.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===b||(clearTimeout(O.current),O.current=setTimeout(()=>{k.current||r(!0)},b))}},floating:{onMouseEnter(){clearTimeout(v.current)},onMouseLeave(){o.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),N(!1)}}}},[o,u,b,n,r,N])};function Ne(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),a=n;for(;a.length;)a=e.filter(e=>{var t;return null==(t=a)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(a);return n}function qe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Ee=a["useInsertionEffect".toString()]||(e=>e());function je(e){const t=a.useRef(()=>{0});return Ee(()=>{t.current=e}),a.useCallback((function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return null==t.current?void 0:t.current(...n)}),[])}function We(e){let t,{restMs:n=0,buffer:a=.5,blockPointerEvents:r=!1}=void 0===e?{}:e,i=!1,o=!1;const s=e=>{let{x:r,y:s,placement:l,elements:c,onClose:u,nodeId:d,tree:p}=e;return function(e){function m(){clearTimeout(t),u()}if(clearTimeout(t),!c.domReference||!c.floating||null==l||null==r||null==s)return;const{clientX:b,clientY:h}=e,f=[b,h],g=qe(e),_="mouseleave"===e.type,y=ke(c.floating,g),M=ke(c.domReference,g),v=c.domReference.getBoundingClientRect(),z=c.floating.getBoundingClientRect(),O=l.split("-")[0],k=r>z.right-z.width/2,A=s>z.bottom-z.height/2,x=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(f,v);if(y&&(o=!0,!_))return;if(M&&(o=!1),M&&!_)return void(o=!0);if(_&&ze(e.relatedTarget)&&ke(c.floating,e.relatedTarget))return;if(p&&Ne(p.nodesRef.current,d).some(e=>{let{context:t}=e;return null==t?void 0:t.open}))return;if("top"===O&&s>=v.bottom-1||"bottom"===O&&s<=v.top+1||"left"===O&&r>=v.right-1||"right"===O&&r<=v.left+1)return m();let w=[];switch(O){case"top":w=[[z.left,v.top+1],[z.left,z.bottom-1],[z.right,z.bottom-1],[z.right,v.top+1]],i=b>=z.left&&b<=z.right&&h>=z.top&&h<=v.top+1;break;case"bottom":w=[[z.left,z.top+1],[z.left,v.bottom-1],[z.right,v.bottom-1],[z.right,z.top+1]],i=b>=z.left&&b<=z.right&&h>=v.bottom-1&&h<=z.bottom;break;case"left":w=[[z.right-1,z.bottom],[z.right-1,z.top],[v.left+1,z.top],[v.left+1,z.bottom]],i=b>=z.left&&b<=v.left+1&&h>=z.top&&h<=z.bottom;break;case"right":w=[[v.right-1,z.bottom],[v.right-1,z.top],[z.left+1,z.top],[z.left+1,z.bottom]],i=b>=v.right-1&&b<=z.right&&h>=z.top&&h<=z.bottom}const N=i?w:function(e){let[t,n]=e;const r=z.width>v.width,i=z.height>v.height;switch(O){case"top":return[[r?t+a/2:k?t+4*a:t-4*a,n+a+1],[r?t-a/2:k?t+4*a:t-4*a,n+a+1],...[[z.left,k||r?z.bottom-a:z.top],[z.right,k?r?z.bottom-a:z.top:z.bottom-a]]];case"bottom":return[[r?t+a/2:k?t+4*a:t-4*a,n-a],[r?t-a/2:k?t+4*a:t-4*a,n-a],...[[z.left,k||r?z.top+a:z.bottom],[z.right,k?r?z.top+a:z.bottom:z.top+a]]];case"left":{const e=[t+a+1,i?n+a/2:A?n+4*a:n-4*a],r=[t+a+1,i?n-a/2:A?n+4*a:n-4*a];return[...[[A||i?z.right-a:z.left,z.top],[A?i?z.right-a:z.left:z.right-a,z.bottom]],e,r]}case"right":return[[t-a,i?n+a/2:A?n+4*a:n-4*a],[t-a,i?n-a/2:A?n+4*a:n-4*a],...[[A||i?z.left+a:z.right,z.top],[A?i?z.left+a:z.right:z.left+a,z.bottom]]]}}([r,s]);return i?void 0:o&&!x?m():void(!function(e,t){const[n,a]=e;let r=!1;const i=t.length;for(let e=0,o=i-1;e<i;o=e++){const[i,s]=t[e]||[0,0],[l,c]=t[o]||[0,0];s>=a!=c>=a&&n<=(l-i)*(a-s)/(c-s)+i&&(r=!r)}return r}([b,h],N)?m():n&&!o&&(t=setTimeout(m,n)))}};return s.__options={blockPointerEvents:r},s}function Le(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,i=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,whileElementsMounted:o,open:s}=e,[l,c]=a.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,d]=a.useState(r);se(u,r)||d(r);const p=a.useRef(null),m=a.useRef(null),b=a.useRef(l),h=le(o),f=le(i),[g,_]=a.useState(null),[y,M]=a.useState(null),v=a.useCallback(e=>{p.current!==e&&(p.current=e,_(e))},[]),z=a.useCallback(e=>{m.current!==e&&(m.current=e,M(e))},[]),O=a.useCallback(()=>{if(!p.current||!m.current)return;const e={placement:t,strategy:n,middleware:u};f.current&&(e.platform=f.current),ae(p.current,m.current,e).then(e=>{const t={...e,isPositioned:!0};k.current&&!se(b.current,t)&&(b.current=t,re.flushSync(()=>{c(t)}))})},[u,t,n,f]);oe(()=>{!1===s&&b.current.isPositioned&&(b.current.isPositioned=!1,c(e=>({...e,isPositioned:!1})))},[s]);const k=a.useRef(!1);oe(()=>(k.current=!0,()=>{k.current=!1}),[]),oe(()=>{if(g&&y){if(h.current)return h.current(g,y,O);O()}},[g,y,O,h]);const A=a.useMemo(()=>({reference:p,floating:m,setReference:v,setFloating:z}),[v,z]),x=a.useMemo(()=>({reference:g,floating:y}),[g,y]);return a.useMemo(()=>({...l,update:O,refs:A,elements:x,reference:v,floating:z}),[l,O,A,x,v,z])}(e),o=ye(),s=a.useRef(null),l=a.useRef({}),c=a.useState(()=>he())[0],u=be(),[d,p]=a.useState(null),m=a.useCallback(e=>{const t=ze(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)},[i.refs]),b=a.useCallback(e=>{(ze(e)||null===e)&&(s.current=e,p(e)),(ze(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!ze(e))&&i.refs.setReference(e)},[i.refs]),h=a.useMemo(()=>({...i.refs,setReference:b,setPositionReference:m,domReference:s}),[i.refs,b,m]),f=a.useMemo(()=>({...i.elements,domReference:d}),[i.elements,d]),g=je(n),_=a.useMemo(()=>({...i,refs:h,elements:f,dataRef:l,nodeId:r,floatingId:u,events:c,open:t,onOpenChange:g}),[i,r,u,c,t,g,h,f]);return ue(()=>{const e=null==o?void 0:o.nodesRef.current.find(e=>e.id===r);e&&(e.context=_)}),a.useMemo(()=>({...i,context:_,refs:h,elements:f,reference:b,positionReference:m}),[i,h,f,_,b,m])}function Se(e,t,n){const a=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map(e=>e?e[n]:null).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,r]=t;var i;0===n.indexOf("on")?(a.has(n)||a.set(n,[]),"function"==typeof r&&(null==(i=a.get(n))||i.push(r),e[n]=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==(e=a.get(n))?void 0:e.map(e=>e(...r)).find(e=>void 0!==e)})):e[n]=r}),e):e,{})}}var Te=n(3),Ce=n.n(Te),Re=n(5),De=n(2),Pe=n(11);function Be(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ie(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $e(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Fe=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n};t.a=function(e){var t,n=e.aria,i=void 0===n?{}:n,o=e.className,c=e.children,u=e.data,d=void 0===u?{}:u,m=e.delay,b=void 0===m?0:m,f=e.icon,g=void 0===f?null:f,_=e.interaction,y=void 0!==_&&_,M=e.placement,v=void 0===M?"top":M,A=e.position,x=void 0===A?"absolute":A,w=e.text,N=e.zIndex,q=Fe(e,["aria","className","children","data","delay","icon","interaction","placement","position","text","zIndex"]),E=Object(De.c)(d),j=Object(De.a)(i),W=Ce()(Object(Re.c)(Object.assign({},q)),o),L=Ie(Object(a.useState)(!1),2),S=L[0],T=L[1],C=Object(a.useRef)(null),R=Le({strategy:x,middleware:[ie({element:C}),z({fallbackPlacements:["top","right","bottom","left"],fallbackStrategy:"initialPlacement",flipAlignment:!1}),O(10),(void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:a,placement:r}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=t,d={x:n,y:a},m=await p(e,u),b=l(s(r)),f=k(b);let g=d[b],_=d[f];if(i){const e="y"===b?"bottom":"right";g=h(g+m["y"===b?"top":"left"],g,g-m[e])}if(o){const e="y"===f?"bottom":"right";_=h(_+m["y"===f?"top":"left"],_,_-m[e])}const y=c.fn({...e,[b]:g,[f]:_});return{...y,data:{x:y.x-n,y:y.y-a}}}})],open:S,onOpenChange:function(e){T(e)},placement:v}),D=R.context,P=R.floating,B=R.middlewareData.arrow,I=void 0===B?{}:B,$=I.x,F=I.y,X=R.placement,Y=R.reference,H=R.strategy,U=R.x,V=R.y,G=function(e){void 0===e&&(e=[]);const t=e,n=a.useCallback(t=>Se(t,e,"reference"),t),r=a.useCallback(t=>Se(t,e,"floating"),t),i=a.useCallback(t=>Se(t,e,"item"),e.map(e=>null==e?void 0:e.item));return a.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:i}),[n,r,i])}([we(D,{delay:b,handleClose:y?We({blockPointerEvents:!1}):null})]).getFloatingProps,K={bottom:"top",left:"right",right:"left",top:"bottom"}[X.split("-")[0]];return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",Object.assign({className:"pb_tooltip_kit ".concat(W),ref:Y,role:"tooltip_trigger",style:{display:"inline-flex"}},j,E),c),S&&r.a.createElement("div",Object.assign({},G({className:"tooltip_tooltip ".concat(X," visible"),ref:P,role:"tooltip",style:{position:H,top:null!=V?V:0,left:null!=U?U:0,zIndex:null!=N?N:0}})),r.a.createElement(Pe.a,{align:"center",gap:"xs"},g&&r.a.createElement("i",{className:"pb_icon_kit far fa-".concat(g," fa-fw")}),w),r.a.createElement("div",{className:"arrow_bg",ref:C,style:Be({position:"absolute",left:null!=$?"".concat($,"px"):"",top:null!=F?"".concat(F,"px"):""},K,"-5px")})))}},function(e,t,n){"use strict";var a=n(186),r=n(200),i=n.n(r),o=n(201),s=n.n(o);var l=function(e){return function(t){var n=function(e){var n=document.createElement("div");n.className="pb_selectable_card_kit_enabled";var a=document.createElement("input"),r="datePicker-".concat(t.element.id,"-").concat(e);a.className="datePicker-AMPM",a.id=r,a.name="datepicker-ampm",a.type="radio",a.value=e;var i=document.createElement("label"),o=document.createElement("div");return i.className="label-".concat(e.toLowerCase()),i.setAttribute("for",r),o.className="buffer",o.innerHTML=e,i.append(o),n.prepend(a),n.append(i),n},a=function(e){if(t.selectedDates.length){var n="pb_selectable_card_kit_checked_enabled",a=document.getElementById("datePicker-".concat(t.element.id,"-AM")),r=document.getElementById("datePicker-".concat(t.element.id,"-PM")),i=t.selectedDates[0].getHours()<12?"AM":"PM";e&&(a.checked=!1,r.checked=!1,r.checked="PM"===i,a.checked="AM"===i),"PM"===i?(r.parentElement.className=n,a.parentElement.className="pb_selectable_card_kit_enabled"):"AM"===i&&(a.parentElement.className=n,r.parentElement.className="pb_selectable_card_kit_enabled")}};return{onValueUpdate:function(){a(!0)},onOpen:function(){a(!0)},onReady:function(){if(t.input.id&&(null==t?void 0:t.timeContainer)){if(t.timeContainer.classList.add("pb_time_selection"),t.minuteElement.step="1",e.caption){var r=document.createElement("div");r.className="pb_caption_kit_md",r.innerHTML=null==e?void 0:e.caption,t.timeContainer.prepend(r)}if(function(){t.amPM.style.display="none";var e=document.createElement("div");e.className="pb_form_group_kit";var a=n("AM");a.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+0),t.setDate(t.selectedDates[0],!0)}));var r=n("PM");r.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+12),t.setDate(t.selectedDates[0],!0)})),e.prepend(a),e.append(r);var i=document.createElement("div");i.className="meridiem",i.append(e),t.timeContainer.append(i)}(),a(!0),e.showTimezone){var i=document.createElement("div");i.className="pb_caption_kit_xs",i.innerHTML=(o=t._initialDate,s=o.toLocaleDateString("en-US",{day:"2-digit",timeZoneName:"short"}).slice(4),l=o.toLocaleDateString("en-US",{day:"2-digit",timeZoneName:"long"}).slice(4),"".concat(s," (").concat(l,")")),t.timeContainer.append(i)}var o,s,l;t.loadedPlugins.push("timeSelectPlugin")}}}}};t.a=function(e,t){var n,r,o=e.allowInput,c=e.closeOnSelect,u=void 0===c||c,d=e.defaultDate,p=e.disableDate,m=e.disableRange,b=e.disableWeekdays,h=e.enableTime,f=e.format,g=e.maxDate,_=e.minDate,y=e.mode,M=e.onChange,v=void 0===M?function(){}:M,z=e.onClose,O=void 0===z?function(){}:z,k=e.pickerId,A=e.plugins,x=e.position,w=void 0===x?"auto":x,N=e.positionElement,q=e.required,E=e.selectionType,j=e.showTimezone,W=e.staticPosition,L=void 0===W||W,S=e.timeCaption,T=void 0===S?"Select Time":S,C=e.timeFormat,R=void 0===C?"at h:i K":C,D=e.yearRange,P=function(){var e=document.querySelector("#cal-".concat(k,".open")),t=e.parentElement;(null==e?void 0:e.getBoundingClientRect().right)>window.innerWidth&&(t.style.display="flex",t.style.justifyContent="center"),e.offsetWidth<=t.offsetWidth&&(t.style.display="",t.style.justifyContent="")};Object(a.a)("#".concat(k),{allowInput:o,closeOnSelect:u,disableMobile:!0,dateFormat:h?"".concat(f," ").concat(R):f,defaultDate:""===d?null:d,disable:b&&b.length>0?[function(e){var t={Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6};return e.getDay()===t[b[0]]||e.getDay()===t[b[1]]||e.getDay()===t[b[2]]||e.getDay()===t[b[3]]||e.getDay()===t[b[4]]||e.getDay()===t[b[5]]||e.getDay()===t[b[6]]}]:p&&p.length>0?p:m&&m.length>0?m:[],enableTime:h,maxDate:g,minDate:_,mode:y,nextArrow:'<i class="far fa-angle-right"></i>',onOpen:[function(){var e,n;P(),window.addEventListener("resize",P),!L&&t&&(e=t,null===(n=document.querySelectorAll(e)[0])||void 0===n||n.addEventListener("scroll",I,{passive:!0}))}],onClose:[function(e,n){window.removeEventListener("resize",P),!L&&t&&function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;null===(e=document.querySelectorAll(t)[0])||void 0===e||e.removeEventListener("scroll",I)}(t),O(e,n)}],onChange:[function(e,t){v(t,e)}],onYearChange:[function(){Y()}],plugins:(r=[],"month"===E||A.length>0?r.push(i()({shorthand:!0,dateFormat:"F Y",altFormat:"F Y"})):"week"===E&&r.push(s()()),h&&r.push(l({caption:T,showTimezone:j})),r),position:w,positionElement:(n=N,"string"==typeof n?document.querySelectorAll(n)[0]:n),prevArrow:'<i class="far fa-angle-left"></i>',static:L});var B=document.querySelector("#".concat(k))._flatpickr;B.innerContainer.parentElement.id="cal-".concat(k);var I=function(){B._positionCalendar()};B.yearElements[0].parentElement.innerHTML='<select class="numInput cur-year" type="number" tabIndex="-1" aria-label="Year" id="year-'.concat(k,'"></select>');for(var $="",F=D[1];F>=D[0];F--)$+='<option value="'.concat(F,'">').concat(F,"</option>");var X=document.querySelector("#year-".concat(k));X.innerHTML=$,X.value=B.currentYear,X.addEventListener("input",(function(e){B.changeYear(Number(e.target.value))})),B.input.form&&B.input.form.addEventListener("reset",(function(){setTimeout((function(){X.value=B.currentYear,B.monthsDropdownContainer.value=B.currentMonth,d&&(B.setDate(d),Y())}),0)}));var Y=function(){X.value=B.currentYear};if(X.insertAdjacentHTML("afterend",'<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>'),B.monthElements[0].parentElement)return B.monthElements[0].insertAdjacentHTML("afterend",'<i class="far fa-angle-down month-dropdown-icon"></i>');o&&B.input.removeAttribute("readonly"),q&&(B.input.removeAttribute("readonly"),B.input.addEventListener("keydown",(function(e){return e.preventDefault()})),B.input.style.caretColor="transparent",B.input.style.cursor="pointer"),document.querySelector("#".concat(k)).parentElement.addEventListener("click",(function(e){return e.stopPropagation()}))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(8),u=n(82),d=n(75),p=n(48),m=n(22);function b(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function f(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var _=function(e,t){var n=[];return function e(t,a){var r,i=h(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.id.toLowerCase()===a.toLowerCase())return void n.push(o);o.children&&o.children.length>0&&e(o.children,a)}}catch(e){i.e(e)}finally{i.f()}}(e,t),n},y=function e(t){var n=[];if(Array.isArray(t))return t.forEach((function(t){if(t.checked&&n.push(t),t.children&&t.children.length>0){var a=e(t.children);n.push.apply(n,b(a))}})),n},M=function(e){var t=[];return function e(n){Array.isArray(n)&&n.forEach((function(a){if(a.checked)if(a.children&&a.children.length>0){if(0===a.children.filter((function(e){return!e.checked})).length)return void t.push(a)}else{var r=n.find((function(e){return e.id===a.parentId}));r&&r.checked||t.push(a)}a.children&&a.children.length>0&&e(a.children)}))}(e),t};function v(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,i=e.className,b=e.data,f=void 0===b?{}:b,g=e.id,O=e.returnAllSelected,k=void 0!==O&&O,A=e.treeData,x=e.onSelect,w=void 0===x?function(){}:x,N=Object(s.a)(n),q=Object(s.c)(f),E=o()(Object(s.b)("pb_multi_level_select"),Object(l.c)(e),i),j=Object(a.useRef)(null),W=z(Object(a.useState)([]),2),L=W[0],S=W[1],T=z(Object(a.useState)(!0),2),C=T[0],R=T[1],D=z(Object(a.useState)(""),2),P=D[0],B=D[1],I=z(Object(a.useState)([]),2),$=I[0],F=I[1],X=z(Object(a.useState)([]),2),Y=X[0],H=X[1],U=z(Object(a.useState)([]),2),V=U[0],G=U[1];Object(a.useEffect)((function(){H(te(A))}),[A]),Object(a.useEffect)((function(){k?F(y(Y)):G(M(Y))}),[Y]),Object(a.useEffect)((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&R(!0)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}),[]);var K=function e(t,n){if(Array.isArray(t))return t.map((function(t){return t.checked=n,t.children=e(t.children,n),t}))},J=function e(t,n,a){if(Array.isArray(n))return n.map((function(n){return n.id!=t?n.children=e(t,n.children,a):(n.checked=a,n.children=K(n.children,a)),n}))},Z=function(e){var t=Object(m.cloneDeep)(Y);return k?J(e.id,t,!0):function e(t,n){if(null!==t.parent_id){var a=_(n,t.parent_id);if(a[0].children.every((function(e){return e.checked})))a[0].checked=!0,null!==a[0].parent_id&&e(a[0],n)}return n}(e,J(e.id,t,!0))},Q=function(e){var t=Object(m.cloneDeep)(Y);return k?J(e.id,t,!1):function e(t,n){if(n.parent_id){var a=_(t,n.parent_id);a[0].checked=!1,a[0].parent_id&&e(t,a[0])}return t}(J(e.id,t,!1),e)},ee=function(e,t){var n=t?Z(e):Q(e);return H(n),n},te=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Array.isArray(t))return t.map((function(t){var r=Object.assign(Object.assign({},t),{parent_id:n,depth:a});if(r.children&&r.children.length>0){var i=t.checked&&!k?K(t.children,!0):t.children;r.children=e(i,r.id,a+1)}return r}))},ne=function(e,t){e.stopPropagation();var n=ee(t,!1);w(k?y(n):M(n))},ae=function(e){return L.indexOf(e.id)>-1};return r.a.createElement("div",Object.assign({},N,q,{className:E,id:g}),r.a.createElement("div",{ref:j,className:"wrapper"},r.a.createElement("div",{className:"input_wrapper",onClick:function(e){e.stopPropagation(),"multiselect_input"===e.target.id||e.target.classList.contains("pb_form_pill_tag")||R(!C)}},r.a.createElement("div",{className:"input_inner_container"},0!==$.length&&k?$.map((function(e,t){return r.a.createElement(d.a,{key:t,text:e.label,size:"small",onClick:function(t){return ne(t,e)}})})):null,!k&&0!==V.length&&V.map((function(e,t){return r.a.createElement(d.a,{key:t,text:e.label,size:"small",onClick:function(t){return ne(t,e)}})})),0!==$.length&&k&&r.a.createElement("br",null),0!==V.length&&!k&&r.a.createElement("br",null),r.a.createElement("input",{id:"multiselect_input",onChange:function(e){B(e.target.value)},placeholder:"Start typing...",value:P,onClick:function(){return R(!1)}})),C?r.a.createElement("div",{key:"chevron-down"},r.a.createElement(c.a,{icon:"chevron-down"})):r.a.createElement("div",{key:"chevron-up"},r.a.createElement(c.a,{icon:"chevron-up"}))),r.a.createElement("div",{className:"dropdown_menu ".concat(C?"close":"open")},function e(t){return r.a.createElement("ul",null,Array.isArray(t)&&t.map((function(t){return r.a.createElement(r.a.Fragment,null,r.a.createElement("li",{key:t.id,className:"dropdown_item","data-name":t.id},r.a.createElement("div",{className:"dropdown_item_checkbox_row"},r.a.createElement("div",{key:ae(t)?"chevron-down":"chevron-right"},r.a.createElement(p.a,{icon:ae(t)?"chevron-down":"chevron-right",className:t.children&&t.children.length>0?"":"toggle_icon",onClick:function(e){return function(e,t){t.stopPropagation();var n=_(Y,e);if(n){var a=v(L);ae(n[0])?a=a.filter((function(e){return e!=n[0].id})):a.push(n[0].id),S(a)}}(t.id,e)},variant:"link"})),r.a.createElement(u.a,{text:t.label,id:t.id},r.a.createElement("input",{checked:t.checked,type:"checkbox",name:t.label,value:t.label,onChange:function(e){!function(e,t){var n=e.target.parentNode.id;B("");var a=_(Y,n),r=ee(a[0],t);console.log(r),w(k?y(r):M(r))}(e,!t.checked)}}))),ae(t)&&t.children&&t.children.length>0&&!P&&r.a.createElement("div",null,e(t.children))))})))}(P?function(e,t){var n=[];return function e(t,a){var r,i=h(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.label.toLowerCase().includes(a.toLowerCase())&&n.push(o),o.children&&e(o.children,a)}}catch(e){i.e(e)}finally{i.f()}}(e,t),n}(Y,P):Y))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(8);function c(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.data,u=void 0===i?{}:i,d=e.hideRating,p=void 0!==d&&d,m=e.id,b=e.rating,h=void 0===b?0:b,f=Object(s.a)(n),g=Object(s.c)(u),_=o()(["pb_star_rating_kit",a]);return r.a.createElement("div",Object.assign({},f,g,{className:_,id:m}),!p&&r.a.createElement("div",{className:"pb_star_rating_number"},h),r.a.createElement("div",{className:"pb_star_rating_wrapper"},r.a.createElement("div",{className:"pb_star_rating_highlight"},c(Array(Math.floor(h))).map((function(e,t){return r.a.createElement(l.a,{fixedWidth:!1,icon:"star",key:t})})),h%1!=0&&r.a.createElement(l.a,{fixedWidth:!1,icon:"star-half"})),r.a.createElement("div",{className:"pb_star_rating_base"},r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),r.a.createElement(l.a,{fixedWidth:!1,icon:"star"}))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=function(){return a.createElement("svg",{viewBox:"0 0 200 250",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},a.createElement("path",{d:"M198.4 71.5V71c-.2-1.2-1.4-2.1-1.4-2.1L103.2 2.7c-.7-.4-1-.6-1.6-.6-1.3 0-2.3 1-2.3 2.3v67.1h-.6v29.6h99.8l-.1-29.6z",fill:"#004876"}),a.createElement("path",{d:"M172.9 159.2c-31.4 23-33.2 24.3-33.2 24.3l-40.5 3.2v-29.4l73.7 1.9z",fill:"#FFF"}),a.createElement("path",{d:"M99.3 125.4V33.5L1.6 102.7l-.1.1c-1 .7-1.5 1.8-1.5 3v67.4c0 1.2.6 2.3 1.5 3l.1.1 93.5 66.3c1.7 1.2 4.1 0 4.1-2.1v-28.9l40.5-28-40.5.7v-25h73.7l25.4-16.9.2-16.8H99.3z",fill:"#BB2432"}),a.createElement("path",{d:"M99.3 101.1h99.3v24.3H99.3z",fill:"#FFF"}))},u=function(){return a.createElement("svg",{viewBox:"0 0 242.9 242.9",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},a.createElement("circle",{cx:121.5,cy:121.5,r:121.5}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"a",x1:42.483,x2:200.309,y1:35.645,y2:35.645},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M56.4 53.8c16.9-16.2 39.8-26.2 65-26.2 25.2 0 48.1 10 64.9 26.2h14c-19.1-22.2-47.4-36.3-78.9-36.3-31.5 0-59.8 14.1-78.9 36.3h13.9z",style:{fill:"url(#a)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"b",x1:17.407,x2:44.897,y1:132.179,y2:132.179},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M44.9 175.7c-10.9-15.3-17.3-34-17.3-54.2 0-14.1 3.1-27.5 8.8-39.5H25.3c-5 12.2-7.8 25.5-7.8 39.5 0 22.7 7.3 43.8 19.8 60.9l7.6-6.7z",style:{fill:"url(#b)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"c",x1:52.914,x2:189.715,y1:212.573,y2:212.573},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M173 199.8c-14.8 9.8-32.5 15.5-51.6 15.5s-37-5.8-51.8-15.6H52.9c18.3 16.1 42.3 25.8 68.5 25.8 26.1 0 50-9.7 68.3-25.7H173z",style:{fill:"url(#c)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"d",x1:31.123,x2:207.766,y1:136.159,y2:136.159},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M139.2 193v-1.8c5-.4 10.2-.5 13.4-5 3.8-5.2 3.2-15.4 3.2-21.5V78.5l-47.3 120.4L61.2 81.2v61.1c0 13.6.5 35.1 12.5 44.2 4.3 3.2 9 3.9 14.2 4.7v1.8H31.1v-1.8c1.6-.4 3.2-.7 4.8-1.1 22.6-5.7 22.9-32.4 22.9-51.1v-37.8c0-6.1.5-13.3-3.2-18.5-4.5-6.1-13.4-7.2-20.4-7.5v-1.8H96l29.6 75.4 29.9-75.4h52.3v1.8c-4.8.4-10.2.9-13.4 5-3.8 4.8-3.2 15.9-3.2 21.9v62.5c0 6.3-.7 16.1 3.2 21.5 3.2 4.3 6.2 4.7 11.2 5v1.8h-66.4z",style:{fill:"url(#d)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"e",x1:30.453,x2:213.794,y1:63.629,y2:63.629},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M30.5 60.6h183.3v6.1H30.5z",style:{fill:"url(#e)"}}),a.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"f",x1:196.676,x2:225.538,y1:132.923,y2:132.923},a.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),a.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),a.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),a.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),a.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),a.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),a.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),a.createElement("path",{d:"M196.7 177.5c11.5-15.6 18.7-35.2 18.7-56 0-14.1-3.1-27.5-8.8-39.5h11.1c5 12.2 7.8 25.5 7.8 39.5 0 23.4-7.8 45-20.9 62.4l-7.9-6.4z",style:{fill:"url(#f)"}}))};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.badge,i=void 0===a?"million-dollar":a,d=e.className,p=e.data,m=void 0===p?{}:p,b=e.id,h=e.size,f=void 0===h?"md":h,g="million-dollar"===i?r.a.createElement(u,null):r.a.createElement(c,null),_=Object(s.a)(n),y=Object(s.c)(m),M=o()(Object(s.b)("pb_user_badge_kit",f),Object(l.c)(e),d);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),r.a.createElement("div",{className:"pb_user_badge_wrapper"},g))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(53),u=n(13),d=n(17),p=n(8),m=function(e,t){var n=new c.a({value:e});return t?"".concat(n.toMonth()," ").concat(n.toDay(),", ").concat(n.toYear()):"".concat(n.toMonth()," ").concat(n.toDay())};t.a=function(e){var t=e.icon,n=void 0!==t&&t,a=e.dark,i=void 0!==a&&a,b=e.size,h=void 0===b?"sm":b,f=e.align,g=void 0===f?"left":f,_=e.data,y=void 0===_?{}:_,M=e.startDate,v=e.endDate,z=e.className,O=function(){return r.a.createElement(r.a.Fragment,null,n&&r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,{color:"light",key:Math.random(),tag:"span"},r.a.createElement(p.a,{className:"pb_date_range_inline_icon",dark:i,fixedWidth:!0,icon:"calendar-alt",size:h,tag:"span"}))))},k=Object(l.b)("pb_date_range_inline_kit",g),A=Object(l.c)(y),x=function(e){return r.a.createElement("time",{dateTime:(n=e,new c.a({value:n}).toIso())},(t=new Date,M.getFullYear()==v.getFullYear()&&M.getFullYear()==t.getFullYear()?r.a.createElement(r.a.Fragment,null," ".concat(m(e,!1)," ")):r.a.createElement(r.a.Fragment,null," ".concat(m(e,!0)," "))));var t,n};return r.a.createElement("div",Object.assign({},A,{className:o()(k,Object(s.c)(e),z)}),r.a.createElement("div",{className:"pb_date_range_inline_wrapper"},"xs"==h&&r.a.createElement(r.a.Fragment,null,O(),r.a.createElement(d.a,{dark:i,tag:"span"},x(M)),r.a.createElement(d.a,{dark:i,tag:"span"},r.a.createElement(p.a,{className:"pb_date_range_inline_arrow",fixedWidth:!0,icon:"long-arrow-right"})),r.a.createElement(d.a,{dark:i,tag:"span"},x(v))),"sm"==h&&r.a.createElement(r.a.Fragment,null,O(),r.a.createElement(u.a,{dark:i,tag:"span"},x(M)),r.a.createElement(u.a,{color:"light",dark:i,tag:"span"},r.a.createElement(p.a,{className:"pb_date_range_inline_arrow",dark:i,fixedWidth:!0,icon:"long-arrow-right"})),r.a.createElement(u.a,{dark:i,tag:"span"},x(v)))))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var a,r=n(146);var i=((a=r)&&a.__esModule?a:{default:a}).default,o=i.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=i.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=i.canUseDOM?window.NodeList:{},t.canUseDOM=i.canUseDOM;t.default=o},function(e,t,n){"use strict";var a=function(){};e.exports=a},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(13),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.data,d=void 0===i?{}:i,p=e.firstName,m=e.id,b=e.lastName,h=Object(l.a)(n),f=Object(l.c)(d),g=o()(Object(l.b)("pb_person_kit"),Object(s.c)(e),a);return r.a.createElement("div",Object.assign({},h,f,{className:g,id:m}),r.a.createElement(c.a,{className:"pb_person_first",tag:"span"},p),b&&r.a.createElement(u.a,{className:"pb_person_first",size:4,text:" ".concat(b)}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n(99),r=n(132),i=n(133),o=n(135),s=n(136),l=[r.a,i.a,o.a,s.a],c=Object(a.a)({defaultModifiers:l})},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(17),d=n(8),p={cell:"mobile",email:"envelope",home:"phone",work:"phone-office","work-cell":"phone-laptop","wrong-phone":"phone-slash",extension:"phone-plus"};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.contactDetail,m=e.contactType,b=e.contactValue,h=e.data,f=void 0===h?{}:h,g=e.id,_=Object(s.a)(n),y=Object(s.c)(f),M=o()(Object(s.b)("pb_contact_kit"),Object(l.c)(e),a);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:g}),r.a.createElement(c.a,{className:"pb_contact_kit",color:"light",tag:"span"},r.a.createElement(d.a,{fixedWidth:!0,icon:p[m]||"phone"})," ".concat(function(e,t){if("email"==t)return e;var n=e.replace(/\D/g,""),a=n.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);return"extension"==t?n.match(/^\d{4}$/):a?[a[1]?"+1 ":"","(",a[2],") ",a[3],"-",a[4]].join(""):null}(b,m)," "),i&&r.a.createElement(u.a,{size:"xs",tag:"span",text:i})))}},function(e,t,n){"use strict";var a=n(43),r=n(12);t.a={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,i=e.name,o=n.offset,s=void 0===o?[0,0]:o,l=r.h.reduce((function(e,n){return e[n]=function(e,t,n){var i=Object(a.a)(e),o=[r.f,r.m].indexOf(i)>=0?-1:1,s="function"==typeof n?n(Object.assign({},t,{placement:e})):n,l=s[0],c=s[1];return l=l||0,c=(c||0)*o,[r.f,r.k].indexOf(i)>=0?{x:c,y:l}:{x:l,y:c}}(n,t.rects,s),e}),{}),c=l[t.placement],u=c.x,d=c.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=d),t.modifiersData[i]=l}}},function(e,t,n){"use strict";var a={left:"right",right:"left",bottom:"top",top:"bottom"};function r(e){return e.replace(/left|right|bottom|top/g,(function(e){return a[e]}))}var i=n(43),o={start:"end",end:"start"};function s(e){return e.replace(/start|end/g,(function(e){return o[e]}))}var l=n(63),c=n(72),u=n(12);t.a={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,a=e.name;if(!t.modifiersData[a]._skip){for(var o=n.mainAxis,d=void 0===o||o,p=n.altAxis,m=void 0===p||p,b=n.fallbackPlacements,h=n.padding,f=n.boundary,g=n.rootBoundary,_=n.altBoundary,y=n.flipVariations,M=void 0===y||y,v=n.allowedAutoPlacements,z=t.options.placement,O=Object(i.a)(z),k=b||(O===z||!M?[r(z)]:function(e){if(Object(i.a)(e)===u.a)return[];var t=r(e);return[s(e),t,s(t)]}(z)),A=[z].concat(k).reduce((function(e,n){return e.concat(Object(i.a)(n)===u.a?function(e,t){void 0===t&&(t={});var n=t,a=n.placement,r=n.boundary,o=n.rootBoundary,s=n.padding,d=n.flipVariations,p=n.allowedAutoPlacements,m=void 0===p?u.h:p,b=Object(c.a)(a),h=b?d?u.n:u.n.filter((function(e){return Object(c.a)(e)===b})):u.b,f=h.filter((function(e){return m.indexOf(e)>=0}));0===f.length&&(f=h);var g=f.reduce((function(t,n){return t[n]=Object(l.a)(e,{placement:n,boundary:r,rootBoundary:o,padding:s})[Object(i.a)(n)],t}),{});return Object.keys(g).sort((function(e,t){return g[e]-g[t]}))}(t,{placement:n,boundary:f,rootBoundary:g,padding:h,flipVariations:M,allowedAutoPlacements:v}):n)}),[]),x=t.rects.reference,w=t.rects.popper,N=new Map,q=!0,E=A[0],j=0;j<A.length;j++){var W=A[j],L=Object(i.a)(W),S=Object(c.a)(W)===u.l,T=[u.m,u.c].indexOf(L)>=0,C=T?"width":"height",R=Object(l.a)(t,{placement:W,boundary:f,rootBoundary:g,altBoundary:_,padding:h}),D=T?S?u.k:u.f:S?u.c:u.m;x[C]>w[C]&&(D=r(D));var P=r(D),B=[];if(d&&B.push(R[L]<=0),m&&B.push(R[D]<=0,R[P]<=0),B.every((function(e){return e}))){E=W,q=!1;break}N.set(W,B)}if(q)for(var I=function(e){var t=A.find((function(t){var n=N.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},$=M?3:1;$>0;$--){if("break"===I($))break}t.placement!==E&&(t.modifiersData[a]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}}},function(e,t,n){"use strict";var a=n(12),r=n(43),i=n(100);var o=n(92),s=n(104),l=n(79),c=n(63),u=n(72),d=n(138),p=n(32);t.a={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,m=e.name,b=n.mainAxis,h=void 0===b||b,f=n.altAxis,g=void 0!==f&&f,_=n.boundary,y=n.rootBoundary,M=n.altBoundary,v=n.padding,z=n.tether,O=void 0===z||z,k=n.tetherOffset,A=void 0===k?0:k,x=Object(c.a)(t,{boundary:_,rootBoundary:y,padding:v,altBoundary:M}),w=Object(r.a)(t.placement),N=Object(u.a)(t.placement),q=!N,E=Object(i.a)(w),j="x"===E?"y":"x",W=t.modifiersData.popperOffsets,L=t.rects.reference,S=t.rects.popper,T="function"==typeof A?A(Object.assign({},t.rects,{placement:t.placement})):A,C="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),R=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,D={x:0,y:0};if(W){if(h){var P,B="y"===E?a.m:a.f,I="y"===E?a.c:a.k,$="y"===E?"height":"width",F=W[E],X=F+x[B],Y=F-x[I],H=O?-S[$]/2:0,U=N===a.l?L[$]:S[$],V=N===a.l?-S[$]:-L[$],G=t.elements.arrow,K=O&&G?Object(s.a)(G):{width:0,height:0},J=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Object(d.a)(),Z=J[B],Q=J[I],ee=Object(o.a)(0,L[$],K[$]),te=q?L[$]/2-H-ee-Z-C.mainAxis:U-ee-Z-C.mainAxis,ne=q?-L[$]/2+H+ee+Q+C.mainAxis:V+ee+Q+C.mainAxis,ae=t.elements.arrow&&Object(l.a)(t.elements.arrow),re=ae?"y"===E?ae.clientTop||0:ae.clientLeft||0:0,ie=null!=(P=null==R?void 0:R[E])?P:0,oe=F+te-ie-re,se=F+ne-ie,le=Object(o.a)(O?Object(p.b)(X,oe):X,F,O?Object(p.a)(Y,se):Y);W[E]=le,D[E]=le-F}if(g){var ce,ue="x"===E?a.m:a.f,de="x"===E?a.c:a.k,pe=W[j],me="y"===j?"height":"width",be=pe+x[ue],he=pe-x[de],fe=-1!==[a.m,a.f].indexOf(w),ge=null!=(ce=null==R?void 0:R[j])?ce:0,_e=fe?be:pe-L[me]-S[me]-ge+C.altAxis,ye=fe?pe+L[me]+S[me]-ge-C.altAxis:he,Me=O&&fe?Object(o.b)(_e,pe,ye):Object(o.a)(O?_e:be,pe,O?ye:he);W[j]=Me,D[j]=Me-pe}t.modifiersData[m]=D}},requiresIfExists:["offset"]}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.color,d=void 0===i?"data_1":i,p=e.dark,m=void 0!==p&&p,b=e.data,h=void 0===b?{}:b,f=e.id,g=e.prefixText,_=e.text,y=Object(s.a)(n),M=Object(s.c)(h),v="#"===d.charAt(0)&&d,z={background:v},O=o()(Object(s.b)("pb_legend_kit",v?"":d),Object(l.c)(e),a);return r.a.createElement("div",Object.assign({},y,M,{className:O,id:f}),r.a.createElement(c.a,{color:m?"lighter":"light"},r.a.createElement("span",{className:"".concat(v?"pb_legend_indicator_circle_custom":"pb_legend_indicator_circle"),style:z}),g&&r.a.createElement(u.a,{dark:m,size:4,tag:"span",text:" ".concat(g," ")})," ".concat(_," ")))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(2),o=n(5),s=n(11),l=n(16),c=n(55),u=n(148),d=n(66);t.a=function(e){e.date&&Object(o.a)("Date Time Stacked",["date"]);var t=e.date,n=e.datetime,a=e.dark,p=e.timeZone,m=void 0===p?"America/New_York":p,b=Object(i.b)("pb_date_time_stacked_kit",Object(o.c)(e));return r.a.createElement(s.a,Object.assign({inline:!1,vertical:"stretch"},e),r.a.createElement(l.a,null,r.a.createElement(d.a,{align:"right",bold:!0,dark:a,date:t||n})),r.a.createElement(c.a,{className:"date-time-padding",orientation:"vertical"}),r.a.createElement(l.a,null,r.a.createElement(u.a,{className:b,dark:a,date:t||n,timeZone:m})))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(11),u=n(55);t.a=function(e){var t=e.children,n=e.padding,a=void 0===n?"sm":n,i=e.paddingBottom,d=void 0===i?"sm":i,p=e.paddingX,m=void 0===p?"sm":p,b=e.className,h=e.spacing,f=void 0===h?"between":h,g=e.separator,_=void 0!==g&&g,y=Object(s.b)("dialog_footer"),M=Object(l.c)(e,{padding:a,paddingBottom:d,paddingX:m});return r.a.createElement(r.a.Fragment,null,_&&r.a.createElement(u.a,null),r.a.createElement("div",{className:"dialog-pseudo-footer"}),r.a.createElement(c.a,{className:o()(y,M,b),spacing:f},t))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5);t.a=function(e){var t=e.children,n=e.padding,a=void 0===n?"sm":n,i=e.className,c=Object(s.b)("dialog_body"),u=Object(l.c)(e,{padding:a});return r.a.createElement("div",{className:o()(c,u,i)},t)}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(8),u=function(e){var t=e.onClose;return r.a.createElement("div",{className:"pb_dialog_close_icon",onClick:t},r.a.createElement(c.a,{fixedWidth:!0,icon:"times"}))},d=n(131),p=n(11),m=n(55);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,i=e.children,c=e.className,b=e.data,h=void 0===b?{}:b,f=e.padding,g=void 0===f?"sm":f,_=e.spacing,y=void 0===_?"between":_,M=e.closeable,v=void 0===M||M,z=e.separator,O=void 0===z||z,k=Object(s.a)(n),A=Object(s.c)(h),x=Object(a.useContext)(d.a),w=Object(s.b)("dialog_header"),N=Object(l.c)(e,{padding:g});return r.a.createElement("div",{className:"dialog_sticky_header"},r.a.createElement(p.a,Object.assign({},k,A,{className:o()(w,N,c),spacing:y}),i,v&&r.a.createElement(u,{onClose:x.onClose})),O&&r.a.createElement(m.a,null))}},function(e,t,n){e.exports=function(){"use strict";var e,t,n;function a(a,r){if(e)if(t){var i="var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk);",o={};e(o),n=r(o),"undefined"!=typeof window&&(n.workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"})))}else t=r;else e=r}return a(0,(function(e){var t=n;function n(e,t,n,a){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=a}function a(e,n,a,r){const i=new t(e,n,a,r);return function(e){return i.solve(e)}}n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,a=0;a<8;a++){var r=this.sampleCurveX(n)-e;if(Math.abs(r)<t)return n;var i=this.sampleCurveDerivativeX(n);if(Math.abs(i)<1e-6)break;n-=r/i}var o=0,s=1;for(n=e,a=0;a<20&&(r=this.sampleCurveX(n),!(Math.abs(r-e)<t));a++)e>r?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};const r=a(.25,.1,.25,1);function i(e,t,n){return Math.min(n,Math.max(t,e))}function o(e,t,n){const a=n-t,r=((e-t)%a+a)%a+t;return r===t?n:r}function s(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}let l=1;function c(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function u(e,t,n){const a={};for(const r in e)a[r]=t.call(n||this,e[r],r,e);return a}function d(e,t,n){const a={};for(const r in e)t.call(n||this,e[r],r,e)&&(a[r]=e[r]);return a}function p(e){return Array.isArray(e)?e.map(p):"object"==typeof e&&e?u(e,p):e}const m={};function b(e){m[e]||("undefined"!=typeof console&&console.warn(e),m[e]=!0)}function h(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function f(e){let t=0;for(let n,a,r=0,i=e.length,o=i-1;r<i;o=r++)n=e[r],a=e[o],t+=(a.x-n.x)*(n.y+a.y);return t}function g(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function _(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,n,a,r)=>{const i=a||r;return t[n]=!i||i.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let y,M,v=null;function z(e){if(null==v){const t=e.navigator?e.navigator.userAgent:null;v=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return v}function O(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const k={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const n=window.document.createElement("canvas"),a=n.getContext("2d");if(!a)throw new Error("failed to create canvas 2d context");return n.width=e.width,n.height=e.height,a.drawImage(e,0,0,e.width,e.height),a.getImageData(-t,-t,e.width+2*t,e.height+2*t)},resolveURL:e=>(y||(y=document.createElement("a")),y.href=e,y.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==M&&(M=matchMedia("(prefers-reduced-motion: reduce)")),M.matches)}};var A=x;function x(e,t){this.x=e,this.y=t}x.prototype={clone:function(){return new x(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),a=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=a,this},_rotateAround:function(e,t){var n=Math.cos(e),a=Math.sin(e),r=t.y+a*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-a*(this.y-t.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},x.convert=function(e){return e instanceof x?e:Array.isArray(e)?new x(e[0],e[1]):e};const w={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},N="mapbox-tiles";let q,E=500,j=50;function W(){"undefined"==typeof caches||q||(q=caches.open(N))}let L=1/0;const S={supported:!1,testSupport:function(e){!R&&C&&(D?P(e):T=e)}};let T,C,R=!1,D=!1;function P(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,C),e.isContextLost())return;S.supported=!0}catch(e){}e.deleteTexture(t),R=!0}"undefined"!=typeof document&&(C=document.createElement("img"),C.onload=function(){T&&P(T),T=null,D=!0},C.onerror=function(){R=!0,T=null},C.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const B={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(B);class I extends Error{constructor(e,t,n,a){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=a}}const $=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function F(e,t){const n=new AbortController,a=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:$(),signal:n.signal});let r=!1,i=!1;return"json"===e.type&&a.headers.set("Accept","application/json"),i||(Date.now(),fetch(a).then(n=>n.ok?((n,a,o)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then(e=>{i||(r=!0,t(null,e,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(e=>{i||t(new Error(e.message))})})(n):n.blob().then(a=>t(new I(n.status,n.statusText,e.url,a)))).catch(e=>{20!==e.code&&t(new Error(e.message))})),{cancel:()=>{i=!0,r||n.abort()}}}const X=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t);if(!g()){const n=e.url.substring(0,e.url.indexOf("://"));return(w.REGISTERED_PROTOCOLS[n]||F)(e,t)}}if(!(/^file:/.test(n=e.url)||/^file:/.test($())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return F(e,t);if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var n;return function(e,t){const n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{t(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let a=n.response;if("json"===e.type)try{a=JSON.parse(n.response)}catch(e){return t(e)}t(null,a,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else{const a=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});t(new I(n.status,n.statusText,e.url,a))}},n.send(e.body),{cancel:()=>n.abort()}}(e,t)},Y=function(e,t){return X(s(e,{type:"arrayBuffer"}),t)};function H(e){const t=window.document.createElement("a");return t.href=e,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}const U="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let V,G;V=[],G=0;const K=function(e,t){if(S.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),G>=w.MAX_PARALLEL_IMAGE_REQUESTS){const n={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return V.push(n),n}G++;let n=!1;const a=()=>{if(!n)for(n=!0,G--;V.length&&G<w.MAX_PARALLEL_IMAGE_REQUESTS;){const e=V.shift(),{requestParameters:t,callback:n,cancelled:a}=e;a||(e.cancel=K(t,n).cancel)}},r=Y(e,(e,n,r,i)=>{a(),e?t(e):n&&function(e,t){"function"==typeof createImageBitmap?function(e,t){const n=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(n).then(e=>{t(null,e)}).catch(e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(e,t):function(e,t){const n=new Image;n.onload=()=>{t(null,n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=U})},n.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const a=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?URL.createObjectURL(a):U}(e,t)}(n,(e,n)=>{null!=e?t(e):null!=n&&t(null,n,{cacheControl:r,expires:i})})});return{cancel:()=>{r.cancel(),a()}}};function J(e,t,n){n[e]&&-1!==n[e].indexOf(t)||(n[e]=n[e]||[],n[e].push(t))}function Z(e,t,n){if(n&&n[e]){const a=n[e].indexOf(t);-1!==a&&n[e].splice(a,1)}}class Q{constructor(e,t={}){s(this,t),this.type=e}}class ee extends Q{constructor(e,t={}){super("error",s({error:e},t))}}class te{on(e,t){return this._listeners=this._listeners||{},J(e,t,this._listeners),this}off(e,t){return Z(e,t,this._listeners),Z(e,t,this._oneTimeListeners),this}once(e,t){return this._oneTimeListeners=this._oneTimeListeners||{},J(e,t,this._oneTimeListeners),this}fire(e,t){"string"==typeof e&&(e=new Q(e,t||{}));const n=e.type;if(this.listens(n)){e.target=this;const t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of t)n.call(this,e);const a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of a)Z(n,t,this._oneTimeListeners),t.call(this,e);const r=this._eventedParent;r&&(s(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(e))}else e instanceof ee&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var ne={$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"},terrain:{type:"terrain"},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:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},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 ae{constructor(e,t,n,a){this.message=(e?e+": ":"")+n,a&&(this.identifier=a),null!=t&&t.__line__&&(this.line=t.__line__)}}function re(e){const t=e.value;return t?[new ae(e.key,t,"constants have been deprecated as of v8")]:[]}function ie(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}function oe(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function se(e){if(Array.isArray(e))return e.map(se);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const n in e)t[n]=se(e[n]);return t}return oe(e)}class le extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class ce{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,n]of t)this.bindings[e]=n}concat(e){return new ce(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(e+" not found in scope.")}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const ue={kind:"null"},de={kind:"number"},pe={kind:"string"},me={kind:"boolean"},be={kind:"color"},he={kind:"object"},fe={kind:"value"},ge={kind:"collator"},_e={kind:"formatted"},ye={kind:"padding"},Me={kind:"resolvedImage"};function ve(e,t){return{kind:"array",itemType:e,N:t}}function ze(e){if("array"===e.kind){const t=ze(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Oe=[ue,de,pe,me,be,_e,he,ve(fe),ye,Me];function ke(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!ke(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Oe)if(!ke(e,t))return null}return`Expected ${ze(e)} but found ${ze(t)} instead.`}function Ae(e,t){return t.some(t=>t.kind===e.kind)}function xe(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}var we,Ne={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 qe(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ee(e){return qe("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function je(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function We(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{we={}.parseCSSColor=function(e){var t,n=e.replace(/ /g,"").toLowerCase();if(n in Ne)return Ne[n].slice();if("#"===n[0])return 4===n.length?(t=parseInt(n.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===n.length&&(t=parseInt(n.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var a=n.indexOf("("),r=n.indexOf(")");if(-1!==a&&r+1===n.length){var i=n.substr(0,a),o=n.substr(a+1,r-(a+1)).split(","),s=1;switch(i){case"rgba":if(4!==o.length)return null;s=je(o.pop());case"rgb":return 3!==o.length?null:[Ee(o[0]),Ee(o[1]),Ee(o[2]),s];case"hsla":if(4!==o.length)return null;s=je(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,c=je(o[1]),u=je(o[2]),d=u<=.5?u*(c+1):u+c-u*c,p=2*u-d;return[qe(255*We(p,d,l+1/3)),qe(255*We(p,d,l)),qe(255*We(p,d,l-1/3)),s];default:return null}}return null}}catch(e){}class Le{constructor(e,t,n,a=1){this.r=e,this.g=t,this.b=n,this.a=a}static parse(e){if(!e)return;if(e instanceof Le)return e;if("string"!=typeof e)return;const t=we(e);return t?new Le(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,n,a]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(n)},${a})`}toArray(){const{r:e,g:t,b:n,a:a}=this;return 0===a?[0,0,0,0]:[255*e/a,255*t/a,255*n/a,a]}}Le.black=new Le(0,0,0,1),Le.white=new Le(1,1,1,1),Le.transparent=new Le(0,0,0,0),Le.red=new Le(1,0,0,1);class Se{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Te{constructor(e,t,n,a,r){this.text=e,this.image=t,this.scale=n,this.fontStack=a,this.textColor=r}}class Ce{constructor(e){this.sections=e}static fromString(e){return new Ce([new Te(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof Ce?e:Ce.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Re{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Re)return e;if("number"==typeof e)return new Re([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Re(e)}}toString(){return JSON.stringify(this.values)}}class De{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new De({name:e,available:!1}):null}}function Pe(e,t,n,a){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[e,t,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[e,t,n,a]:[e,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Be(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Le)return!0;if(e instanceof Se)return!0;if(e instanceof Ce)return!0;if(e instanceof Re)return!0;if(e instanceof De)return!0;if(Array.isArray(e)){for(const t of e)if(!Be(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Be(e[t]))return!1;return!0}return!1}function Ie(e){if(null===e)return ue;if("string"==typeof e)return pe;if("boolean"==typeof e)return me;if("number"==typeof e)return de;if(e instanceof Le)return be;if(e instanceof Se)return ge;if(e instanceof Ce)return _e;if(e instanceof Re)return ye;if(e instanceof De)return Me;if(Array.isArray(e)){const t=e.length;let n;for(const t of e){const e=Ie(t);if(n){if(n===e)continue;n=fe;break}n=e}return ve(n||fe,t)}return he}function $e(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Le||e instanceof Ce||e instanceof Re||e instanceof De?e.toString():JSON.stringify(e)}class Fe{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Be(e[1]))return t.error("invalid value");const n=e[1];let a=Ie(n);const r=t.expectedType;return"array"!==a.kind||0!==a.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(a=r),new Fe(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Xe{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ye={string:pe,number:de,boolean:me,object:he};class He{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n,a=1;const r=e[0];if("array"===r){let r,i;if(e.length>2){const n=e[1];if("string"!=typeof n||!(n in Ye)||"object"===n)return t.error('The item type argument of "array" must be one of string, number, boolean',1);r=Ye[n],a++}else r=fe;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);i=e[2],a++}n=ve(r,i)}else{if(!Ye[r])throw new Error("Types doesn't contain name = "+r);n=Ye[r]}const i=[];for(;a<e.length;a++){const n=t.parse(e[a],a,fe);if(!n)return null;i.push(n)}return new He(n,i)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(!ke(this.type,Ie(n)))return n;if(t===this.args.length-1)throw new Xe(`Expected value to be of type ${ze(this.type)}, but found ${ze(Ie(n))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ue={"to-boolean":me,"to-color":be,"to-number":de,"to-string":pe};class Ve{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!Ue[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==e.length)return t.error("Expected one argument.");const a=Ue[n],r=[];for(let n=1;n<e.length;n++){const a=t.parse(e[n],n,fe);if(!a)return null;r.push(a)}return new Ve(a,r)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,n;for(const a of this.args){if(t=a.evaluate(e),n=null,t instanceof Le)return t;if("string"==typeof t){const n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Pe(t[0],t[1],t[2],t[3]),!n))return new Le(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Xe(n||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}if("padding"===this.type.kind){let t;for(const n of this.args){t=n.evaluate(e);const a=Re.parse(t);if(a)return a}throw new Xe(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}if("number"===this.type.kind){let t=null;for(const n of this.args){if(t=n.evaluate(e),null===t)return 0;const a=Number(t);if(!isNaN(a))return a}throw new Xe(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Ce.fromString($e(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?De.fromString($e(this.args[0].evaluate(e))):$e(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ge=["Unknown","Point","LineString","Polygon"];class Ke{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?Ge[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Le.parse(e)),t}}class Je{constructor(e,t,n,a){this.name=e,this.type=t,this._evaluate=n,this.args=a}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],a=Je.definitions[n];if(!a)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(a)?a[0]:a.type,i=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=i.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[a,i]of o){s=new Mt(t.registry,t.path,null,t.scope);const o=[];let l=!1;for(let t=1;t<e.length;t++){const n=e[t],r=Array.isArray(a)?a[t-1]:a.type,i=s.parse(n,1+o.length,r);if(!i){l=!0;break}o.push(i)}if(!l)if(Array.isArray(a)&&a.length!==o.length)s.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(a)?a[e]:a.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(0===s.errors.length)return new Je(n,r,i,o)}}if(1===o.length)t.errors.push(...s.errors);else{const n=(o.length?o:i).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(ze).join(", ")})`:`(${ze(t.type)}...)`;var t}).join(" | "),a=[];for(let n=1;n<e.length;n++){const r=t.parse(e[n],1+a.length);if(!r)return null;a.push(ze(r.type))}t.error(`Expected arguments of type ${n}, but found (${a.join(", ")}) instead.`)}return null}static register(e,t){Je.definitions=t;for(const n in t)e[n]=Je}}class Ze{constructor(e,t,n){this.type=ge,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const n=e[1];if("object"!=typeof n||Array.isArray(n))return t.error("Collator options argument must be an object.");const a=t.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,me);if(!a)return null;const r=t.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,me);if(!r)return null;let i=null;return n.locale&&(i=t.parse(n.locale,1,pe),!i)?null:new Ze(a,r,i)}evaluate(e){return new Se(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Qe=8192;function et(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function tt(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function nt(e,t){const n=(180+e[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,r=Math.pow(2,t.z);return[Math.round(n*r*Qe),Math.round(a*r*Qe)]}function at(e,t,n){const a=e[0]-t[0],r=e[1]-t[1],i=e[0]-n[0],o=e[1]-n[1];return a*o-i*r==0&&a*i<=0&&r*o<=0}function rt(e,t){let n=!1;for(let o=0,s=t.length;o<s;o++){const s=t[o];for(let t=0,o=s.length;t<o-1;t++){if(at(e,s[t],s[t+1]))return!1;(r=s[t])[1]>(a=e)[1]!=(i=s[t+1])[1]>a[1]&&a[0]<(i[0]-r[0])*(a[1]-r[1])/(i[1]-r[1])+r[0]&&(n=!n)}}var a,r,i;return n}function it(e,t){for(let n=0;n<t.length;n++)if(rt(e,t[n]))return!0;return!1}function ot(e,t,n,a){const r=a[0]-n[0],i=a[1]-n[1],o=(e[0]-n[0])*i-r*(e[1]-n[1]),s=(t[0]-n[0])*i-r*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function st(e,t,n){for(const c of n)for(let n=0;n<c.length-1;++n)if(0!=(s=[(o=c[n+1])[0]-(i=c[n])[0],o[1]-i[1]])[0]*(l=[(r=t)[0]-(a=e)[0],r[1]-a[1]])[1]-s[1]*l[0]&&ot(a,r,i,o)&&ot(i,o,a,r))return!0;var a,r,i,o,s,l;return!1}function lt(e,t){for(let n=0;n<e.length;++n)if(!rt(e[n],t))return!1;for(let n=0;n<e.length-1;++n)if(st(e[n],e[n+1],t))return!1;return!0}function ct(e,t){for(let n=0;n<t.length;n++)if(lt(e,t[n]))return!0;return!1}function ut(e,t,n){const a=[];for(let r=0;r<e.length;r++){const i=[];for(let a=0;a<e[r].length;a++){const o=nt(e[r][a],n);et(t,o),i.push(o)}a.push(i)}return a}function dt(e,t,n){const a=[];for(let r=0;r<e.length;r++){const i=ut(e[r],t,n);a.push(i)}return a}function pt(e,t,n,a){if(e[0]<n[0]||e[0]>n[2]){const t=.5*a;let r=e[0]-n[0]>t?-a:n[0]-e[0]>t?a:0;0===r&&(r=e[0]-n[2]>t?-a:n[2]-e[0]>t?a:0),e[0]+=r}et(t,e)}function mt(e,t,n,a){const r=Math.pow(2,a.z)*Qe,i=[a.x*Qe,a.y*Qe],o=[];for(const a of e)for(const e of a){const a=[e.x+i[0],e.y+i[1]];pt(a,t,n,r),o.push(a)}return o}function bt(e,t,n,a){const r=Math.pow(2,a.z)*Qe,i=[a.x*Qe,a.y*Qe],o=[];for(const n of e){const e=[];for(const a of n){const n=[a.x+i[0],a.y+i[1]];et(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=r/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of o)for(const a of e)pt(a,t,n,r)}var s;return o}class ht{constructor(e,t){this.type=me,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Be(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const n=t.features[e].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new ht(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ht(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new ht(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],r=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,a,r),o=mt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!rt(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,a,r),o=mt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!it(e,i))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],r=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,a,r),o=bt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!lt(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,a,r),o=bt(e.geometry(),n,a,r);if(!tt(n,a))return!1;for(const e of o)if(!ct(e,i))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function ft(e){if(e instanceof Je){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof ht)return!1;let t=!0;return e.eachChild(e=>{t&&!ft(e)&&(t=!1)}),t}function gt(e){if(e instanceof Je&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!gt(e)&&(t=!1)}),t}function _t(e,t){if(e instanceof Je&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild(e=>{n&&!_t(e,t)&&(n=!1)}),n}class yt{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new yt(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Mt{constructor(e,t=[],n,a=new ce,r=[]){this.registry=e,this.path=t,this.key=t.map(e=>`[${e}]`).join(""),this.scope=a,this.errors=r,this.expectedType=n}parse(e,t,n,a,r={}){return t?this.concat(t,n,a)._parse(e,r):this._parse(e,r)}_parse(e,t){function n(e,t,n){return"assert"===n?new He(t,[e]):"coerce"===n?new Ve(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=e[0];if("string"!=typeof a)return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[a];if(r){let a=r.parse(e,this);if(!a)return null;if(this.expectedType){const e=this.expectedType,r=a.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind)if("padding"!==e.kind||"value"!==r.kind&&"number"!==r.kind&&"array"!==r.kind){if(this.checkSubtype(e,r))return null}else a=n(a,e,t.typeAnnotation||"coerce");else a=n(a,e,t.typeAnnotation||"coerce");else a=n(a,e,t.typeAnnotation||"assert")}if(!(a instanceof Fe)&&"resolvedImage"!==a.type.kind&&function e(t){if(t instanceof yt)return e(t.boundExpression);if(t instanceof Je&&"error"===t.name)return!1;if(t instanceof Ze)return!1;if(t instanceof ht)return!1;const n=t instanceof Ve||t instanceof He;let a=!0;return t.eachChild(t=>{a=n?a&&e(t):a&&t instanceof Fe}),!!a&&ft(t)&&_t(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(a)){const t=new Ke;try{a=new Fe(a.type,a.evaluate(t))}catch(e){return this.error(e.message),null}}return a}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const a="number"==typeof e?this.path.concat(e):this.path,r=n?this.scope.concat(n):this.scope;return new Mt(this.registry,a,t||null,r,this.errors)}error(e,...t){const n=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new le(n,e))}checkSubtype(e,t){const n=ke(e,t);return n&&this.error(n),n}}function vt(e,t){const n=e.length-1;let a,r,i=0,o=n,s=0;for(;i<=o;)if(s=Math.floor((i+o)/2),a=e[s],r=e[s+1],a<=t){if(s===n||t<r)return s;i=s+1}else{if(!(a>t))throw new Xe("Input is not a number.");o=s-1}return 0}class zt{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,de);if(!n)return null;const a=[];let r=null;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let n=1;n<e.length;n+=2){const i=1===n?-1/0:e[n],o=e[n+1],s=n,l=n+1;if("number"!=typeof i)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(a.length&&a[a.length-1][0]>=i)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(o,l,r);if(!c)return null;r=r||c.type,a.push([i,c])}return new zt(r,n,a)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=t[0])return n[0].evaluate(e);const r=t.length;return a>=t[r-1]?n[r-1].evaluate(e):n[vt(t,a)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ot(e,t,n){return e*(1-n)+t*n}var kt=Object.freeze({__proto__:null,number:Ot,color:function(e,t,n){return new Le(Ot(e.r,t.r,n),Ot(e.g,t.g,n),Ot(e.b,t.b,n),Ot(e.a,t.a,n))},array:function(e,t,n){return e.map((e,a)=>Ot(e,t[a],n))},padding:function(e,t,n){const a=e.values,r=t.values;return new Re([Ot(a[0],r[0],n),Ot(a[1],r[1],n),Ot(a[2],r[2],n),Ot(a[3],r[3],n)])}});const At=6/29*3*(6/29),xt=Math.PI/180,wt=180/Math.PI;function Nt(e){return e>.008856451679035631?Math.pow(e,1/3):e/At+4/29}function qt(e){return e>6/29?e*e*e:At*(e-4/29)}function Et(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function jt(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Wt(e){const t=jt(e.r),n=jt(e.g),a=jt(e.b),r=Nt((.4124564*t+.3575761*n+.1804375*a)/.95047),i=Nt((.2126729*t+.7151522*n+.072175*a)/1);return{l:116*i-16,a:500*(r-i),b:200*(i-Nt((.0193339*t+.119192*n+.9503041*a)/1.08883)),alpha:e.a}}function Lt(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,a=isNaN(e.b)?t:t-e.b/200;return t=1*qt(t),n=.95047*qt(n),a=1.08883*qt(a),new Le(Et(3.2404542*n-1.5371385*t-.4985314*a),Et(-.969266*n+1.8760108*t+.041556*a),Et(.0556434*n-.2040259*t+1.0572252*a),e.alpha)}function St(e,t,n){const a=t-e;return e+n*(a>180||a<-180?a-360*Math.round(a/360):a)}const Tt={forward:Wt,reverse:Lt,interpolate:function(e,t,n){return{l:Ot(e.l,t.l,n),a:Ot(e.a,t.a,n),b:Ot(e.b,t.b,n),alpha:Ot(e.alpha,t.alpha,n)}}},Ct={forward:function(e){const{l:t,a:n,b:a}=Wt(e),r=Math.atan2(a,n)*wt;return{h:r<0?r+360:r,c:Math.sqrt(n*n+a*a),l:t,alpha:e.a}},reverse:function(e){const t=e.h*xt,n=e.c;return Lt({l:e.l,a:Math.cos(t)*n,b:Math.sin(t)*n,alpha:e.alpha})},interpolate:function(e,t,n){return{h:St(e.h,t.h,n),c:Ot(e.c,t.c,n),l:Ot(e.l,t.l,n),alpha:Ot(e.alpha,t.alpha,n)}}};var Rt=Object.freeze({__proto__:null,lab:Tt,hcl:Ct});class Dt{constructor(e,t,n,a,r){this.type=e,this.operator=t,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,n,a,r){let i=0;if("exponential"===e.name)i=Pt(n,e.base,a,r);else if("linear"===e.name)i=Pt(n,1,a,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;i=new t(o[0],o[1],o[2],o[3]).solve(Pt(n,1,a,r))}return i}static parse(e,t){let[n,a,r,...i]=e;if(!Array.isArray(a)||0===a.length)return t.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){const e=a[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return t.error("Unknown interpolation type "+String(a[0]),1,0);{const e=a.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(r=t.parse(r,2,de),!r)return null;const o=[];let s=null;"interpolate-hcl"===n||"interpolate-lab"===n?s=be:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e<i.length;e+=2){const n=i[e],a=i[e+1],r=e+3,l=e+4;if("number"!=typeof n)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=n)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(a,l,s);if(!c)return null;s=s||c.type,o.push([n,c])}return"number"===s.kind||"color"===s.kind||"padding"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Dt(s,n,a,r,o):t.error(`Type ${ze(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=t[0])return n[0].evaluate(e);const r=t.length;if(a>=t[r-1])return n[r-1].evaluate(e);const i=vt(t,a),o=Dt.interpolationFactor(this.interpolation,a,t[i],t[i+1]),s=n[i].evaluate(e),l=n[i+1].evaluate(e);return"interpolate"===this.operator?kt[this.type.kind.toLowerCase()](s,l,o):"interpolate-hcl"===this.operator?Ct.reverse(Ct.interpolate(Ct.forward(s),Ct.forward(l),o)):Tt.reverse(Tt.interpolate(Tt.forward(s),Tt.forward(l),o))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Pt(e,t,n,a){const r=a-n,i=e-n;return 0===r?0:1===t?i/r:(Math.pow(t,i)-1)/(Math.pow(t,r)-1)}class Bt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument.");let n=null;const a=t.expectedType;a&&"value"!==a.kind&&(n=a);const r=[];for(const a of e.slice(1)){const e=t.parse(a,1+r.length,n,void 0,{typeAnnotation:"omit"});if(!e)return null;n=n||e.type,r.push(e)}if(!n)throw new Error("No output type");const i=a&&r.some(e=>ke(a,e.type));return new Bt(i?fe:n,r)}evaluate(e){let t,n=null,a=0;for(const r of this.args)if(a++,n=r.evaluate(e),n&&n instanceof De&&!n.available&&(t||(t=n.name),n=null,a===this.args.length&&(n=t)),null!==n)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class It{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let a=1;a<e.length-1;a+=2){const r=e[a];if("string"!=typeof r)return t.error(`Expected string, but found ${typeof r} instead.`,a);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",a);const i=t.parse(e[a+1],a+1);if(!i)return null;n.push([r,i])}const a=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return a?new It(n,a):null}outputDefined(){return this.result.outputDefined()}}class $t{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,de),a=t.parse(e[2],2,ve(t.expectedType||fe));return n&&a?new $t(a.type.itemType,n,a):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Xe(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Xe(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Xe(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ft{constructor(e,t){this.type=me,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,fe),a=t.parse(e[2],2,fe);return n&&a?Ae(n.type,[me,pe,de,ue,fe])?new Ft(n,a):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ze(n.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!xe(t,["boolean","string","number","null"]))throw new Xe(`Expected first argument to be of type boolean, string, number or null, but found ${ze(Ie(t))} instead.`);if(!xe(n,["string","array"]))throw new Xe(`Expected second argument to be of type array or string, but found ${ze(Ie(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Xt{constructor(e,t,n){this.type=de,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,fe),a=t.parse(e[2],2,fe);if(!n||!a)return null;if(!Ae(n.type,[me,pe,de,ue,fe]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ze(n.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,de);return r?new Xt(n,a,r):null}return new Xt(n,a)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!xe(t,["boolean","string","number","null"]))throw new Xe(`Expected first argument to be of type boolean, string, number or null, but found ${ze(Ie(t))} instead.`);if(!xe(n,["string","array"]))throw new Xe(`Expected second argument to be of type array or string, but found ${ze(Ie(n))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return n.indexOf(t,a)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Yt{constructor(e,t,n,a,r,i){this.inputType=e,this.type=t,this.input=n,this.cases=a,this.outputs=r,this.otherwise=i}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let n,a;t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);const r={},i=[];for(let o=2;o<e.length-1;o+=2){let s=e[o];const l=e[o+1];Array.isArray(s)||(s=[s]);const c=t.concat(o);if(0===s.length)return c.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,Ie(e)))return null}else n=Ie(e);if(void 0!==r[String(e)])return c.error("Branch labels must be unique.");r[String(e)]=i.length}const u=t.parse(l,o,a);if(!u)return null;a=a||u.type,i.push(u)}const o=t.parse(e[1],1,fe);if(!o)return null;const s=t.parse(e[e.length-1],e.length-1,a);return s?"value"!==o.type.kind&&t.concat(1).checkSubtype(n,o.type)?null:new Yt(n,a,o,r,i,s):null}evaluate(e){const t=this.input.evaluate(e);return(Ie(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ht{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const a=[];for(let r=1;r<e.length-1;r+=2){const i=t.parse(e[r],r,me);if(!i)return null;const o=t.parse(e[r+1],r+1,n);if(!o)return null;a.push([i,o]),n=n||o.type}const r=t.parse(e[e.length-1],e.length-1,n);if(!r)return null;if(!n)throw new Error("Can't infer output type");return new Ht(n,a,r)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ut{constructor(e,t,n,a){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=a}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,fe),a=t.parse(e[2],2,de);if(!n||!a)return null;if(!Ae(n.type,[ve(fe),pe,fe]))return t.error(`Expected first argument to be of type array or string, but found ${ze(n.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,de);return r?new Ut(n.type,n,a,r):null}return new Ut(n.type,n,a)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!xe(t,["string","array"]))throw new Xe(`Expected first argument to be of type array or string, but found ${ze(Ie(t))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return t.slice(n,a)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vt(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Gt(e,t,n,a){return 0===a.compare(t,n)}function Kt(e,t,n){const a="=="!==e&&"!="!==e;return class r{constructor(e,t,n){this.type=me,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const n=e[0];let i=t.parse(e[1],1,fe);if(!i)return null;if(!Vt(n,i.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${ze(i.type)}'.`);let o=t.parse(e[2],2,fe);if(!o)return null;if(!Vt(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${ze(o.type)}'.`);if(i.type.kind!==o.type.kind&&"value"!==i.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${ze(i.type)}' and '${ze(o.type)}'.`);a&&("value"===i.type.kind&&"value"!==o.type.kind?i=new He(o.type,[i]):"value"!==i.type.kind&&"value"===o.type.kind&&(o=new He(i.type,[o])));let s=null;if(4===e.length){if("string"!==i.type.kind&&"string"!==o.type.kind&&"value"!==i.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,ge),!s)return null}return new r(i,o,s)}evaluate(r){const i=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(a&&this.hasUntypedArgument){const t=Ie(i),n=Ie(o);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new Xe(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const e=Ie(i),n=Ie(o);if("string"!==e.kind||"string"!==n.kind)return t(r,i,o)}return this.collator?n(r,i,o,this.collator.evaluate(r)):t(r,i,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const Jt=Kt("==",(function(e,t,n){return t===n}),Gt),Zt=Kt("!=",(function(e,t,n){return t!==n}),(function(e,t,n,a){return!Gt(0,t,n,a)})),Qt=Kt("<",(function(e,t,n){return t<n}),(function(e,t,n,a){return a.compare(t,n)<0})),en=Kt(">",(function(e,t,n){return t>n}),(function(e,t,n,a){return a.compare(t,n)>0})),tn=Kt("<=",(function(e,t,n){return t<=n}),(function(e,t,n,a){return a.compare(t,n)<=0})),nn=Kt(">=",(function(e,t,n){return t>=n}),(function(e,t,n,a){return a.compare(t,n)>=0}));class an{constructor(e,t,n,a,r){this.type=pe,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=a,this.maxFractionDigits=r}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,de);if(!n)return null;const a=e[2];if("object"!=typeof a||Array.isArray(a))return t.error("NumberFormat options argument must be an object.");let r=null;if(a.locale&&(r=t.parse(a.locale,1,pe),!r))return null;let i=null;if(a.currency&&(i=t.parse(a.currency,1,pe),!i))return null;let o=null;if(a["min-fraction-digits"]&&(o=t.parse(a["min-fraction-digits"],1,de),!o))return null;let s=null;return a["max-fraction-digits"]&&(s=t.parse(a["max-fraction-digits"],1,de),!s)?null:new an(n,r,i,o,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class rn{constructor(e){this.type=_e,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&"object"==typeof n)return t.error("First argument must be an image or text section.");const a=[];let r=!1;for(let n=1;n<=e.length-1;++n){const i=e[n];if(r&&"object"==typeof i&&!Array.isArray(i)){r=!1;let e=null;if(i["font-scale"]&&(e=t.parse(i["font-scale"],1,de),!e))return null;let n=null;if(i["text-font"]&&(n=t.parse(i["text-font"],1,ve(pe)),!n))return null;let o=null;if(i["text-color"]&&(o=t.parse(i["text-color"],1,be),!o))return null;const s=a[a.length-1];s.scale=e,s.font=n,s.textColor=o}else{const i=t.parse(e[n],1,fe);if(!i)return null;const o=i.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,a.push({content:i,scale:null,font:null,textColor:null})}}return new rn(a)}evaluate(e){return new Ce(this.sections.map(t=>{const n=t.content.evaluate(e);return Ie(n)===Me?new Te("",n,null,null,null):new Te($e(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}}class on{constructor(e){this.type=Me,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const n=t.parse(e[1],1,pe);return n?new on(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=De.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class sn{constructor(e){this.type=de,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?t.error(`Expected argument of type string or array, but found ${ze(n.type)} instead.`):new sn(n):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Xe(`Expected value to be of type string or array, but found ${ze(Ie(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ln={"==":Jt,"!=":Zt,">":en,"<":Qt,">=":nn,"<=":tn,array:He,at:$t,boolean:He,case:Ht,coalesce:Bt,collator:Ze,format:rn,image:on,in:Ft,"index-of":Xt,interpolate:Dt,"interpolate-hcl":Dt,"interpolate-lab":Dt,length:sn,let:It,literal:Fe,match:Yt,number:He,"number-format":an,object:He,slice:Ut,step:zt,string:He,"to-boolean":Ve,"to-color":Ve,"to-number":Ve,"to-string":Ve,var:yt,within:ht};function cn(e,[t,n,a,r]){t=t.evaluate(e),n=n.evaluate(e),a=a.evaluate(e);const i=r?r.evaluate(e):1,o=Pe(t,n,a,i);if(o)throw new Xe(o);return new Le(t/255*i,n/255*i,a/255*i,i)}function un(e,t){return e in t}function dn(e,t){const n=t[e];return void 0===n?null:n}function pn(e){return{type:e}}function mn(e){return{result:"success",value:e}}function bn(e){return{result:"error",value:e}}function hn(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function fn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function gn(e){return!!e.expression&&e.expression.interpolated}function _n(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function yn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Mn(e){return e}function vn(e,t,n){return void 0!==e?e:void 0!==t?t:void 0!==n?n:void 0}function zn(e,t,n,a,r){return vn(typeof n===r?a[n]:void 0,e.default,t.default)}function On(e,t,n){if("number"!==_n(n))return vn(e.default,t.default);const a=e.stops.length;if(1===a)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[a-1][0])return e.stops[a-1][1];const r=vt(e.stops.map(e=>e[0]),n);return e.stops[r][1]}function kn(e,t,n){const a=void 0!==e.base?e.base:1;if("number"!==_n(n))return vn(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];const i=vt(e.stops.map(e=>e[0]),n),o=function(e,t,n,a){const r=a-n,i=e-n;return 0===r?0:1===t?i/r:(Math.pow(t,i)-1)/(Math.pow(t,r)-1)}(n,a,e.stops[i][0],e.stops[i+1][0]),s=e.stops[i][1],l=e.stops[i+1][1];let c=kt[t.type]||Mn;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Rt[e.colorSpace];c=(e,n)=>t.reverse(t.interpolate(t.forward(e),t.forward(n),o))}return"function"==typeof s.evaluate?{evaluate(...e){const t=s.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==n)return c(t,n,o)}}:c(s,l,o)}function An(e,t,n){switch(t.type){case"color":n=Le.parse(n);break;case"formatted":n=Ce.fromString(n.toString());break;case"resolvedImage":n=De.fromString(n.toString());break;case"padding":n=Re.parse(n);break;default:_n(n)===t.type||"enum"===t.type&&t.values[n]||(n=void 0)}return vn(n,e.default,t.default)}Je.register(ln,{error:[{kind:"error"},[pe],(e,[t])=>{throw new Xe(t.evaluate(e))}],typeof:[pe,[fe],(e,[t])=>ze(Ie(t.evaluate(e)))],"to-rgba":[ve(de,4),[be],(e,[t])=>t.evaluate(e).toArray()],rgb:[be,[de,de,de],cn],rgba:[be,[de,de,de,de],cn],has:{type:me,overloads:[[[pe],(e,[t])=>un(t.evaluate(e),e.properties())],[[pe,he],(e,[t,n])=>un(t.evaluate(e),n.evaluate(e))]]},get:{type:fe,overloads:[[[pe],(e,[t])=>dn(t.evaluate(e),e.properties())],[[pe,he],(e,[t,n])=>dn(t.evaluate(e),n.evaluate(e))]]},"feature-state":[fe,[pe],(e,[t])=>dn(t.evaluate(e),e.featureState||{})],properties:[he,[],e=>e.properties()],"geometry-type":[pe,[],e=>e.geometryType()],id:[fe,[],e=>e.id()],zoom:[de,[],e=>e.globals.zoom],"heatmap-density":[de,[],e=>e.globals.heatmapDensity||0],"line-progress":[de,[],e=>e.globals.lineProgress||0],accumulated:[fe,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[de,pn(de),(e,t)=>{let n=0;for(const a of t)n+=a.evaluate(e);return n}],"*":[de,pn(de),(e,t)=>{let n=1;for(const a of t)n*=a.evaluate(e);return n}],"-":{type:de,overloads:[[[de,de],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[de],(e,[t])=>-t.evaluate(e)]]},"/":[de,[de,de],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[de,[de,de],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[de,[],()=>Math.LN2],pi:[de,[],()=>Math.PI],e:[de,[],()=>Math.E],"^":[de,[de,de],(e,[t,n])=>Math.pow(t.evaluate(e),n.evaluate(e))],sqrt:[de,[de],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[de,[de],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[de,[de],(e,[t])=>Math.log(t.evaluate(e))],log2:[de,[de],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[de,[de],(e,[t])=>Math.sin(t.evaluate(e))],cos:[de,[de],(e,[t])=>Math.cos(t.evaluate(e))],tan:[de,[de],(e,[t])=>Math.tan(t.evaluate(e))],asin:[de,[de],(e,[t])=>Math.asin(t.evaluate(e))],acos:[de,[de],(e,[t])=>Math.acos(t.evaluate(e))],atan:[de,[de],(e,[t])=>Math.atan(t.evaluate(e))],min:[de,pn(de),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[de,pn(de),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[de,[de],(e,[t])=>Math.abs(t.evaluate(e))],round:[de,[de],(e,[t])=>{const n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[de,[de],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[de,[de],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[me,[pe,fe],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[me,[fe],(e,[t])=>e.id()===t.value],"filter-type-==":[me,[pe],(e,[t])=>e.geometryType()===t.value],"filter-<":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a<r}],"filter-id-<":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a>r}],"filter-id->":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a<=r}],"filter-id-<=":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[me,[pe,fe],(e,[t,n])=>{const a=e.properties()[t.value],r=n.value;return typeof a==typeof r&&a>=r}],"filter-id->=":[me,[fe],(e,[t])=>{const n=e.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[me,[fe],(e,[t])=>t.value in e.properties()],"filter-has-id":[me,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[me,[ve(pe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[me,[ve(fe)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[me,[pe,ve(fe)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[me,[pe,ve(fe)],(e,[t,n])=>function(e,t,n,a){for(;n<=a;){const r=n+a>>1;if(t[r]===e)return!0;t[r]>e?a=r-1:n=r+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:me,overloads:[[[me,me],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[pn(me),(e,t)=>{for(const n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:me,overloads:[[[me,me],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[pn(me),(e,t)=>{for(const n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[me,[me],(e,[t])=>!t.evaluate(e)],"is-supported-script":[me,[pe],(e,[t])=>{const n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[pe,[pe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[pe,[pe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[pe,pn(fe),(e,t)=>t.map(t=>$e(t.evaluate(e))).join("")],"resolved-locale":[pe,[ge],(e,[t])=>t.evaluate(e).resolvedLocale()]});class xn{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Ke,this._defaultValue=t?function(e){return"color"===e.type&&yn(e.default)?new Le(0,0,0,0):"color"===e.type?Le.parse(e.default)||null:"padding"===e.type?Re.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,n,a,r,i){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=a,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=i,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,a,r,i){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=i||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Xe(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function wn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in ln}function Nn(e,t){const n=new Mt(ln,[],t?function(e){const t={color:be,string:pe,number:de,enum:pe,boolean:me,formatted:_e,padding:ye,resolvedImage:Me};return"array"===e.type?ve(t[e.value]||fe,e.length):t[e.type]}(t):void 0),a=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return a?mn(new xn(a,t)):bn(n.errors)}class qn{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!gt(t.expression)}evaluateWithoutErrorHandling(e,t,n,a,r,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,a,r,i)}evaluate(e,t,n,a,r,i){return this._styleExpression.evaluate(e,t,n,a,r,i)}}class En{constructor(e,t,n,a){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!gt(t.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,t,n,a,r,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,a,r,i)}evaluate(e,t,n,a,r,i){return this._styleExpression.evaluate(e,t,n,a,r,i)}interpolationFactor(e,t,n){return this.interpolationType?Dt.interpolationFactor(this.interpolationType,e,t,n):0}}function jn(e,t){const n=Nn(e,t);if("error"===n.result)return n;const a=n.value.expression,r=ft(a);if(!r&&!hn(t))return bn([new le("","data expressions not supported")]);const i=_t(a,["zoom"]);if(!i&&!fn(t))return bn([new le("","zoom expressions not supported")]);const o=function e(t){let n=null;if(t instanceof It)n=e(t.result);else if(t instanceof Bt){for(const a of t.args)if(n=e(a),n)break}else(t instanceof zt||t instanceof Dt)&&t.input instanceof Je&&"zoom"===t.input.name&&(n=t);return n instanceof le||t.eachChild(t=>{const a=e(t);a instanceof le?n=a:!n&&a?n=new le("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&a&&n!==a&&(n=new le("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(a);return o||i?o instanceof le?bn([o]):o instanceof Dt&&!gn(t)?bn([new le("",'"interpolate" expressions cannot be used with this property')]):mn(o?new En(r?"camera":"composite",n.value,o.labels,o instanceof Dt?o.interpolation:void 0):new qn(r?"constant":"source",n.value)):bn([new le("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wn{constructor(e,t){this._parameters=e,this._specification=t,ie(this,function e(t,n){const a="color"===n.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),o=t.type||(gn(n)?"exponential":"interval");if(a||"padding"===n.type){const e=a?Le.parse:Re.parse;(t=ie({},t)).stops&&(t.stops=t.stops.map(t=>[t[0],e(t[1])])),t.default=e(t.default?t.default:n.default)}if(t.colorSpace&&"rgb"!==t.colorSpace&&!Rt[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);let s,l,c;if("exponential"===o)s=kn;else if("interval"===o)s=On;else if("categorical"===o){s=zn,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=An}if(r){const a={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],i=n[0].zoom;void 0===a[i]&&(a[i]={zoom:i,type:t.type,property:t.property,default:t.default,stops:[]},r.push(i)),a[i].stops.push([n[0].value,n[1]])}const i=[];for(const t of r)i.push([a[t].zoom,e(a[t],n)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Dt.interpolationFactor.bind(void 0,o),zoomStops:i.map(e=>e[0]),evaluate:({zoom:e},a)=>kn({stops:i,base:t.base},n,e).evaluate(e,a)}}if(i){const e="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:Dt.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map(e=>e[0]),evaluate:({zoom:e})=>s(t,n,e,l,c)}}return{kind:"source",evaluate(e,a){const r=a&&a.properties?a.properties[t.property]:void 0;return void 0===r?vn(t.default,n.default):s(t,n,r,l,c)}}}(this._parameters,this._specification))}static deserialize(e){return new Wn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ln(e){const t=e.key,n=e.value,a=e.valueSpec||{},r=e.objectElementValidators||{},i=e.style,o=e.styleSpec;let s=[];const l=_n(n);if("object"!==l)return[new ae(t,n,`object expected, ${l} found`)];for(const e in n){const l=e.split(".")[0],c=a[l]||a["*"];let u;if(r[l])u=r[l];else if(a[l])u=oa;else if(r["*"])u=r["*"];else{if(!a["*"]){s.push(new ae(t,n[e],`unknown property "${e}"`));continue}u=oa}s=s.concat(u({key:(t?t+".":t)+e,value:n[e],valueSpec:c,style:i,styleSpec:o,object:n,objectKey:e},n))}for(const e in a)r[e]||a[e].required&&void 0===a[e].default&&void 0===n[e]&&s.push(new ae(t,n,`missing required property "${e}"`));return s}function Sn(e){const t=e.value,n=e.valueSpec,a=e.style,r=e.styleSpec,i=e.key,o=e.arrayElementValidator||oa;if("array"!==_n(t))return[new ae(i,t,`array expected, ${_n(t)} found`)];if(n.length&&t.length!==n.length)return[new ae(i,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new ae(i,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};r.$version<7&&(s.function=n.function),"object"===_n(n.value)&&(s=n.value);let l=[];for(let e=0;e<t.length;e++)l=l.concat(o({array:t,arrayIndex:e,value:t[e],valueSpec:s,style:a,styleSpec:r,key:`${i}[${e}]`}));return l}function Tn(e){const t=e.key,n=e.value,a=e.valueSpec;let r=_n(n);return"number"===r&&n!=n&&(r="NaN"),"number"!==r?[new ae(t,n,`number expected, ${r} found`)]:"minimum"in a&&n<a.minimum?[new ae(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new ae(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Cn(e){const t=e.valueSpec,n=oe(e.value.type);let a,r,i,o={};const s="categorical"!==n&&void 0===e.value.property,l=!s,c="array"===_n(e.value.stops)&&"array"===_n(e.value.stops[0])&&"object"===_n(e.value.stops[0][0]),u=Ln({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===n)return[new ae(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const a=e.value;return t=t.concat(Sn({key:e.key,value:a,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),"array"===_n(a)&&0===a.length&&t.push(new ae(e.key,a,"array must have at least one stop")),t},default:function(e){return oa({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&s&&u.push(new ae(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||u.push(new ae(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!gn(e.valueSpec)&&u.push(new ae(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!hn(e.valueSpec)?u.push(new ae(e.key,e.value,"property functions not supported")):s&&!fn(e.valueSpec)&&u.push(new ae(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==e.value.property||u.push(new ae(e.key,e.value,'"property" property is required')),u;function d(e){let n=[];const a=e.value,s=e.key;if("array"!==_n(a))return[new ae(s,a,`array expected, ${_n(a)} found`)];if(2!==a.length)return[new ae(s,a,`array length 2 expected, length ${a.length} found`)];if(c){if("object"!==_n(a[0]))return[new ae(s,a,`object expected, ${_n(a[0])} found`)];if(void 0===a[0].zoom)return[new ae(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new ae(s,a,"object stop key must have value")];if(i&&i>oe(a[0].zoom))return[new ae(s,a[0].zoom,"stop zoom values must appear in ascending order")];oe(a[0].zoom)!==i&&(i=oe(a[0].zoom),r=void 0,o={}),n=n.concat(Ln({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Tn,value:p}}))}else n=n.concat(p({key:s+"[0]",value:a[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},a));return wn(se(a[1]))?n.concat([new ae(s+"[1]",a[1],"expressions are not allowed in function stops.")]):n.concat(oa({key:s+"[1]",value:a[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function p(e,i){const s=_n(e.value),l=oe(e.value),c=null!==e.value?e.value:i;if(a){if(s!==a)return[new ae(e.key,c,`${s} stop domain type must match previous stop domain type ${a}`)]}else a=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new ae(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let a=`number expected, ${s} found`;return hn(t)&&void 0===n&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ae(e.key,c,a)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==r&&l<r?[new ae(e.key,c,"stop domain values must appear in ascending order")]:(r=l,"categorical"===n&&l in o?[new ae(e.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new ae(e.key,c,"integer expected, found "+l)]}}function Rn(e){const t=("property"===e.expressionContext?jn:Nn)(se(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new ae(`${e.key}${t.key}`,e.value,t.message));const n=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!n.outputDefined())return[new ae(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!gt(n))return[new ae(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!gt(n))return[new ae(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!_t(n,["zoom","feature-state"]))return[new ae(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!ft(n))return[new ae(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Dn(e){const t=e.key,n=e.value,a=e.valueSpec,r=[];return Array.isArray(a.values)?-1===a.values.indexOf(oe(n))&&r.push(new ae(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(a.values).indexOf(oe(n))&&r.push(new ae(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),r}function Pn(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Pn(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const Bn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function In(e){if(null==e)return{filter:()=>!0,needGeometry:!1};Pn(e)||(e=Xn(e));const t=Nn(e,Bn);if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,n,a)=>t.value.evaluate(e,n,{},a),needGeometry:Fn(e)}}function $n(e,t){return e<t?-1:e>t?1:0}function Fn(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t<e.length;t++)if(Fn(e[t]))return!0;return!1}function Xn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Yn(e[1],e[2],"=="):"!="===t?Vn(Yn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Yn(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(Xn))):"all"===t?["all"].concat(e.slice(1).map(Xn)):"none"===t?["all"].concat(e.slice(1).map(Xn).map(Vn)):"in"===t?Hn(e[1],e.slice(2)):"!in"===t?Vn(Hn(e[1],e.slice(2))):"has"===t?Un(e[1]):"!has"===t?Vn(Un(e[1])):"within"!==t||e;var n}function Yn(e,t,n){switch(e){case"$type":return["filter-type-"+n,t];case"$id":return["filter-id-"+n,t];default:return["filter-"+n,e,t]}}function Hn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort($n)]]:["filter-in-small",e,["literal",t]]}}function Un(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Vn(e){return["!",e]}function Gn(e){return Pn(se(e.value))?Rn(ie({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function e(t){const n=t.value,a=t.key;if("array"!==_n(n))return[new ae(a,n,`array expected, ${_n(n)} found`)];const r=t.styleSpec;let i,o=[];if(n.length<1)return[new ae(a,n,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:a+"[0]",value:n[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),oe(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===oe(n[1])&&o.push(new ae(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&o.push(new ae(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(i=_n(n[1]),"string"!==i&&o.push(new ae(a+"[1]",n[1],`string expected, ${i} found`)));for(let e=2;e<n.length;e++)i=_n(n[e]),"$type"===oe(n[1])?o=o.concat(Dn({key:`${a}[${e}]`,value:n[e],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&o.push(new ae(`${a}[${e}]`,n[e],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let r=1;r<n.length;r++)o=o.concat(e({key:`${a}[${r}]`,value:n[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=_n(n[1]),2!==n.length?o.push(new ae(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"string"!==i&&o.push(new ae(a+"[1]",n[1],`string expected, ${i} found`));break;case"within":i=_n(n[1]),2!==n.length?o.push(new ae(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"object"!==i&&o.push(new ae(a+"[1]",n[1],`object expected, ${i} found`))}return o}(e)}function Kn(e,t){const n=e.key,a=e.style,r=e.styleSpec,i=e.value,o=e.objectKey,s=r[`${t}_${e.layerType}`];if(!s)return[];const l=o.match(/^(.*)-transition$/);if("paint"===t&&l&&s[l[1]]&&s[l[1]].transition)return oa({key:n,value:i,valueSpec:r.transition,style:a,styleSpec:r});const c=e.valueSpec||s[o];if(!c)return[new ae(n,i,`unknown property "${o}"`)];let u;if("string"===_n(i)&&hn(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(i)))return[new ae(n,i,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&("text-field"===o&&a&&!a.glyphs&&d.push(new ae(n,i,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&yn(se(i))&&"identity"===oe(i.type)&&d.push(new ae(n,i,'"text-font" does not support identity functions'))),d.concat(oa({key:e.key,value:i,valueSpec:c,style:a,styleSpec:r,expressionContext:"property",propertyType:t,propertyKey:o}))}function Jn(e){return Kn(e,"paint")}function Zn(e){return Kn(e,"layout")}function Qn(e){let t=[];const n=e.value,a=e.key,r=e.style,i=e.styleSpec;n.type||n.ref||t.push(new ae(a,n,'either "type" or "ref" is required'));let o=oe(n.type);const s=oe(n.ref);if(n.id){const i=oe(n.id);for(let o=0;o<e.arrayIndex;o++){const e=r.layers[o];oe(e.id)===i&&t.push(new ae(a,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if("ref"in n){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in n&&t.push(new ae(a,n[e],`"${e}" is prohibited for ref layers`))}),r.layers.forEach(t=>{oe(t.id)===s&&(e=t)}),e?e.ref?t.push(new ae(a,n.ref,"ref cannot reference another ref layer")):o=oe(e.type):t.push(new ae(a,n.ref,`ref layer "${s}" not found`))}else if("background"!==o)if(n.source){const e=r.sources&&r.sources[n.source],i=e&&oe(e.type);e?"vector"===i&&"raster"===o?t.push(new ae(a,n.source,`layer "${n.id}" requires a raster source`)):"raster"===i&&"raster"!==o?t.push(new ae(a,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==i||n["source-layer"]?"raster-dem"===i&&"hillshade"!==o?t.push(new ae(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!n.paint||!n.paint["line-gradient"]||"geojson"===i&&e.lineMetrics||t.push(new ae(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ae(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new ae(a,n.source,`source "${n.source}" not found`))}else t.push(new ae(a,n,'missing required property "source"'));return t=t.concat(Ln({key:a,value:n,valueSpec:i.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>oa({key:a+".type",value:n.type,valueSpec:i.layer.type,style:e.style,styleSpec:e.styleSpec,object:n,objectKey:"type"}),filter:Gn,layout:e=>Ln({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Zn(ie({layerType:o},e))}}),paint:e=>Ln({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Jn(ie({layerType:o},e))}})}})),t}function ea(e){const t=e.value,n=e.key,a=_n(t);return"string"!==a?[new ae(n,t,`string expected, ${a} found`)]:[]}const ta={promoteId:function({key:e,value:t}){if("string"===_n(t))return ea({key:e,value:t});{const n=[];for(const a in t)n.push(...ea({key:`${e}.${a}`,value:t[a]}));return n}}};function na(e){const t=e.value,n=e.key,a=e.styleSpec,r=e.style;if(!t.type)return[new ae(n,t,'"type" is required')];const i=oe(t.type);let o;switch(i){case"vector":case"raster":case"raster-dem":return o=Ln({key:n,value:t,valueSpec:a["source_"+i.replace("-","_")],style:e.style,styleSpec:a,objectElementValidators:ta}),o;case"geojson":if(o=Ln({key:n,value:t,valueSpec:a.source_geojson,style:r,styleSpec:a,objectElementValidators:ta}),t.cluster)for(const e in t.clusterProperties){const[a,r]=t.clusterProperties[e],i="string"==typeof a?[a,["accumulated"],["get",e]]:a;o.push(...Rn({key:`${n}.${e}.map`,value:r,expressionContext:"cluster-map"})),o.push(...Rn({key:`${n}.${e}.reduce`,value:i,expressionContext:"cluster-reduce"}))}return o;case"video":return Ln({key:n,value:t,valueSpec:a.source_video,style:r,styleSpec:a});case"image":return Ln({key:n,value:t,valueSpec:a.source_image,style:r,styleSpec:a});case"canvas":return[new ae(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:n+".type",value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:a})}}function aa(e){const t=e.value,n=e.styleSpec,a=n.light,r=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new ae("light",t,`object expected, ${o} found`)]),i;for(const e in t){const o=e.match(/^(.*)-transition$/);i=i.concat(o&&a[o[1]]&&a[o[1]].transition?oa({key:e,value:t[e],valueSpec:n.transition,style:r,styleSpec:n}):a[e]?oa({key:e,value:t[e],valueSpec:a[e],style:r,styleSpec:n}):[new ae(e,t[e],`unknown property "${e}"`)])}return i}function ra(e){const t=e.value,n=e.styleSpec,a=n.terrain,r=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new ae("terrain",t,`object expected, ${o} found`)]),i;for(const e in t)i=i.concat(a[e]?oa({key:e,value:t[e],valueSpec:a[e],style:r,styleSpec:n}):[new ae(e,t[e],`unknown property "${e}"`)]);return i}const ia={"*":()=>[],array:Sn,boolean:function(e){const t=e.value,n=e.key,a=_n(t);return"boolean"!==a?[new ae(n,t,`boolean expected, ${a} found`)]:[]},number:Tn,color:function(e){const t=e.key,n=e.value,a=_n(n);return"string"!==a?[new ae(t,n,`color expected, ${a} found`)]:null===we(n)?[new ae(t,n,`color expected, "${n}" found`)]:[]},constants:re,enum:Dn,filter:Gn,function:Cn,layer:Qn,object:Ln,source:na,light:aa,terrain:ra,string:ea,formatted:function(e){return 0===ea(e).length?[]:Rn(e)},resolvedImage:function(e){return 0===ea(e).length?[]:Rn(e)},padding:function(e){const t=e.key,n=e.value;if("array"===_n(n)){if(n.length<1||n.length>4)return[new ae(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const e={type:"number"};let a=[];for(let r=0;r<n.length;r++)a=a.concat(oa({key:`${t}[${r}]`,value:n[r],valueSpec:e}));return a}return Tn({key:t,value:n,valueSpec:{}})}};function oa(e){const t=e.value,n=e.valueSpec,a=e.styleSpec;return n.expression&&yn(oe(t))?Cn(e):n.expression&&wn(se(t))?Rn(e):n.type&&ia[n.type]?ia[n.type](e):Ln(ie({},e,{valueSpec:n.type?a[n.type]:n}))}function sa(e){const t=e.value,n=e.key,a=ea(e);return a.length||(-1===t.indexOf("{fontstack}")&&a.push(new ae(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&a.push(new ae(n,t,'"glyphs" url must include a "{range}" token'))),a}function la(e,t=ne){let n=[];return n=n.concat(oa({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:sa,"*":()=>[]}})),e.constants&&(n=n.concat(re({key:"constants",value:e.constants,style:e,styleSpec:t}))),ca(n)}function ca(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function ua(e){return function(...t){return ca(e.apply(this,t))}}la.source=ua(na),la.light=ua(aa),la.terrain=ua(ra),la.layer=ua(Qn),la.filter=ua(Gn),la.paintProperty=ua(Jn),la.layoutProperty=ua(Zn);const da=la,pa=da.light,ma=da.paintProperty,ba=da.layoutProperty;function ha(e,t){let n=!1;if(t&&t.length)for(const a of t)e.fire(new ee(new Error(a.message))),n=!0;return n}class fa{constructor(e,t,n){const a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const r=new Int32Array(this.arrayBuffer);e=r[0],this.d=(t=r[1])+2*(n=r[2]);for(let e=0;e<this.d*this.d;e++){const t=r[3+e],n=r[3+e+1];a.push(t===n?null:r.subarray(t,n))}const i=r[3+a.length+1];this.keys=r.subarray(r[3+a.length],i),this.bboxes=r.subarray(i),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)a.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const r=n/t*e;this.min=-r,this.max=e+r}insert(e,t,n,a,r){this._forEachCell(t,n,a,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,a,r,i){this.cells[r].push(i)}query(e,t,n,a,r){const i=this.min,o=this.max;if(e<=i&&t<=i&&o<=n&&o<=a&&!r)return Array.prototype.slice.call(this.keys);{const i=[];return this._forEachCell(e,t,n,a,this._queryCell,i,{},r),i}}_queryCell(e,t,n,a,r,i,o,s){const l=this.cells[r];if(null!==l){const r=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const d=l[u];if(void 0===o[d]){const l=4*d;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):e<=c[l+2]&&t<=c[l+3]&&n>=c[l+0]&&a>=c[l+1])?(o[d]=!0,i.push(r[d])):o[d]=!1}}}}_forEachCell(e,t,n,a,r,i,o,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(a);for(let p=l;p<=u;p++)for(let l=c;l<=d;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&r.call(this,e,t,n,a,c,i,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=3+this.cells.length+1+1;let n=0;for(let e=0;e<this.cells.length;e++)n+=this.cells[e].length;const a=new Int32Array(t+n+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let r=t;for(let t=0;t<e.length;t++){const n=e[t];a[3+t]=r,a.set(n,r),r+=n.length}return a[3+e.length]=r,a.set(this.keys,r),r+=this.keys.length,a[3+e.length+1]=r,a.set(this.bboxes,r),r+=this.bboxes.length,a.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new fa(e.buffer)}}const ga={};function _a(e,t,n={}){if(ga[e])throw new Error(e+" is already registered.");Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ga[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}_a("Object",Object),_a("TransferableGridIndex",fa),_a("Color",Le),_a("Error",Error),_a("AJAXError",I),_a("ResolvedImage",De),_a("StylePropertyFunction",Wn),_a("StyleExpression",xn,{omit:["_evaluator"]}),_a("ZoomDependentExpression",En),_a("ZoomConstantExpression",qn),_a("CompoundExpression",Je,{omit:["_evaluate"]});for(const e in ln)ln[e]._classRegistryKey||_a("Expression_"+e,ln[e]);function ya(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Ma(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob)return e;if(ya(e))return t&&t.push(e),e;if(O(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){const n=e;return t&&t.push(n.buffer),n}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){const n=[];for(const a of e)n.push(Ma(a,t));return n}if("object"==typeof e){const n=e.constructor,a=n._classRegistryKey;if(!a)throw new Error("can't serialize object of unregistered class");if(!ga[a])throw new Error(a+" is not registered.");const r=n.serialize?n.serialize(e,t):{};if(n.serialize){if(t&&r===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const n in e){if(!e.hasOwnProperty(n))continue;if(ga[a].omit.indexOf(n)>=0)continue;const i=e[n];r[n]=ga[a].shallow.indexOf(n)>=0?i:Ma(i,t)}e instanceof Error&&(r.message=e.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(r.$name=a),r}throw new Error("can't serialize object of type "+typeof e)}function va(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||ya(e)||O(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(va);if("object"==typeof e){const t=e.$name||"Object";if(!ga[t])throw new Error("can't deserialize unregistered class "+t);const{klass:n}=ga[t];if(!n)throw new Error("can't deserialize unregistered class "+t);if(n.deserialize)return n.deserialize(e);const a=Object.create(n.prototype);for(const n of Object.keys(e)){if("$name"===n)continue;const r=e[n];a[n]=ga[t].shallow.indexOf(n)>=0?r:va(r)}return a}throw new Error("can't deserialize object of type "+typeof e)}class za{constructor(){this.first=!0}update(e,t){const n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}const Oa={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function ka(e){for(const t of e)if(wa(t.charCodeAt(0)))return!0;return!1}function Aa(e){for(const t of e)if(!xa(t.charCodeAt(0)))return!1;return!0}function xa(e){return!(Oa.Arabic(e)||Oa["Arabic Supplement"](e)||Oa["Arabic Extended-A"](e)||Oa["Arabic Presentation Forms-A"](e)||Oa["Arabic Presentation Forms-B"](e))}function wa(e){return!(746!==e&&747!==e&&(e<4352||!(Oa["Bopomofo Extended"](e)||Oa.Bopomofo(e)||Oa["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Oa["CJK Compatibility Ideographs"](e)||Oa["CJK Compatibility"](e)||Oa["CJK Radicals Supplement"](e)||Oa["CJK Strokes"](e)||!(!Oa["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Oa["CJK Unified Ideographs Extension A"](e)||Oa["CJK Unified Ideographs"](e)||Oa["Enclosed CJK Letters and Months"](e)||Oa["Hangul Compatibility Jamo"](e)||Oa["Hangul Jamo Extended-A"](e)||Oa["Hangul Jamo Extended-B"](e)||Oa["Hangul Jamo"](e)||Oa["Hangul Syllables"](e)||Oa.Hiragana(e)||Oa["Ideographic Description Characters"](e)||Oa.Kanbun(e)||Oa["Kangxi Radicals"](e)||Oa["Katakana Phonetic Extensions"](e)||Oa.Katakana(e)&&12540!==e||!(!Oa["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Oa["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Oa["Unified Canadian Aboriginal Syllabics"](e)||Oa["Unified Canadian Aboriginal Syllabics Extended"](e)||Oa["Vertical Forms"](e)||Oa["Yijing Hexagram Symbols"](e)||Oa["Yi Syllables"](e)||Oa["Yi Radicals"](e))))}function Na(e){return!(wa(e)||function(e){return!!(Oa["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Oa["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||Oa["Letterlike Symbols"](e)||Oa["Number Forms"](e)||Oa["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||Oa["Control Pictures"](e)&&9251!==e||Oa["Optical Character Recognition"](e)||Oa["Enclosed Alphanumerics"](e)||Oa["Geometric Shapes"](e)||Oa["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Oa["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Oa["CJK Symbols and Punctuation"](e)||Oa.Katakana(e)||Oa["Private Use Area"](e)||Oa["CJK Compatibility Forms"](e)||Oa["Small Form Variants"](e)||Oa["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function qa(e){return e>=1424&&e<=2303||Oa["Arabic Presentation Forms-A"](e)||Oa["Arabic Presentation Forms-B"](e)}function Ea(e,t){return!(!t&&qa(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Oa.Khmer(e))}function ja(e){for(const t of e)if(qa(t.charCodeAt(0)))return!0;return!1}const Wa="deferred",La="loading",Sa="loaded";let Ta=null,Ca="unavailable",Ra=null;const Da=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Ca="error"),Ta&&Ta(e)};function Pa(){Ba.fire(new Q("pluginStateChange",{pluginStatus:Ca,pluginURL:Ra}))}const Ba=new te,Ia=function(){return Ca},$a=function(){if(Ca!==Wa||!Ra)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ca=La,Pa(),Ra&&Y({url:Ra},e=>{e?Da(e):(Ca=Sa,Pa())})},Fa={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ca===Sa||null!=Fa.applyArabicShaping,isLoading:()=>Ca===La,setState(e){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ca=e.pluginStatus,Ra=e.pluginURL},isParsed(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Fa.applyArabicShaping&&null!=Fa.processBidirectionalText&&null!=Fa.processStyledBidirectionalText},getPluginURL(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Ra}};class Xa{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new za,this.transition={})}isSupportedScript(e){return function(e,t){for(const n of e)if(!Ea(n.charCodeAt(0),t))return!1;return!0}(e,Fa.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}class Ya{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(yn(e))return new Wn(e,t);if(wn(e)){const n=jn(e,t);if("error"===n.result)throw new Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let n=e;return"color"===t.type&&"string"==typeof e?n=Le.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)||(n=Re.parse(e)),{kind:"constant",evaluate:()=>n}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ha{constructor(e){this.property=e,this.value=new Ya(e,void 0)}transitioned(e,t){return new Va(this.property,this.value,t,s({},e.transition,this.transition),e.now)}untransitioned(){return new Va(this.property,this.value,null,{},0)}}class Ua{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return p(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ha(this._values[e].property)),this._values[e].value=new Ya(this._values[e].property,null===t?void 0:p(t))}getTransition(e){return p(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ha(this._values[e].property)),this._values[e].transition=p(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);void 0!==n&&(e[t]=n);const a=this.getTransition(t);void 0!==a&&(e[t+"-transition"]=a)}return e}transitioned(e,t){const n=new Ga(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(e,t._values[a]);return n}untransitioned(){const e=new Ga(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Va{constructor(e,t,n,a,r){this.property=e,this.value=t,this.begin=r+a.delay||0,this.end=this.begin+a.duration||0,e.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const a=e.now||0,r=this.value.possiblyEvaluate(e,t,n),i=this.prior;if(i){if(a>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(a<this.begin)return i.possiblyEvaluate(e,t,n);{const o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(i.possiblyEvaluate(e,t,n),r,function(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}(o))}}return r}}class Ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){const a=new Za(this._properties);for(const r of Object.keys(this._values))a._values[r]=this._values[r].possiblyEvaluate(e,t,n);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Ka{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return p(this._values[e].value)}setValue(e,t){this._values[e]=new Ya(this._values[e].property,null===t?void 0:p(t))}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);void 0!==n&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){const a=new Za(this._properties);for(const r of Object.keys(this._values))a._values[r]=this._values[r].possiblyEvaluate(e,t,n);return a}}class Ja{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,n,a){return this.property.evaluate(this.value,this.parameters,e,t,n,a)}}class Za{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Qa{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,n){const a=kt[this.specification.type];return a?a(e,t,n):e}}class er{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,a){return new Ja(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},n,a)}:e.expression,t)}interpolate(e,t,n){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Ja(this,{kind:"constant",value:void 0},e.parameters);const a=kt[this.specification.type];return a?new Ja(this,{kind:"constant",value:a(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,a,r,i){return"constant"===e.kind?e.value:e.evaluate(t,n,a,r,i)}}class tr extends er{possiblyEvaluate(e,t,n,a){if(void 0===e.value)return new Ja(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},n,a),i="resolvedImage"===e.property.specification.type&&"string"!=typeof r?r.name:r,o=this._calculate(i,i,i,t);return new Ja(this,{kind:"constant",value:o},t)}if("camera"===e.expression.kind){const n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Ja(this,{kind:"constant",value:n},t)}return new Ja(this,e.expression,t)}evaluate(e,t,n,a,r,i){if("source"===e.kind){const o=e.evaluate(t,n,a,r,i);return this._calculate(o,o,o,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,a),e.evaluate({zoom:Math.floor(t.zoom)},n,a),e.evaluate({zoom:Math.floor(t.zoom)+1},n,a),t):e.value}_calculate(e,t,n,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class nr{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,a){if(void 0!==e.value){if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},n,a);return this._calculate(r,r,r,t)}return this._calculate(e.expression.evaluate(new Xa(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Xa(Math.floor(t.zoom),t)),e.expression.evaluate(new Xa(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ar{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,a){return!!e.expression.evaluate(t,null,{},n,a)}interpolate(){return!1}}class rr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const n=e[t];n.specification.overridable&&this.overridableProperties.push(t);const a=this.defaultPropertyValues[t]=new Ya(n,void 0),r=this.defaultTransitionablePropertyValues[t]=new Ha(n);this.defaultTransitioningPropertyValues[t]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=a.possiblyEvaluate({})}}}_a("DataDrivenProperty",er),_a("DataConstantProperty",Qa),_a("CrossFadedDataDrivenProperty",tr),_a("CrossFadedProperty",nr),_a("ColorRampProperty",ar);const ir="-transition";class or extends te{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Ka(t.layout)),t.paint)){this._transitionablePaint=new Ua(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Za(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,n={}){null!=t&&this._validate(ba,`layers.${this.id}.layout.${e}`,e,t,n)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(ir)?this._transitionablePaint.getTransition(e.slice(0,-ir.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(null!=t&&this._validate(ma,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(ir))return this._transitionablePaint.setTransition(e.slice(0,-ir.length),t||void 0),!1;{const n=this._transitionablePaint._values[e],a="cross-faded-data-driven"===n.property.specification["property-type"],r=n.value.isDataDriven(),i=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const o=this._transitionablePaint._values[e].value;return o.isDataDriven()||r||a||this._handleOverridablePaintPropertyUpdate(e,i,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),d(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,n,a,r={}){return(!r||!1!==r.validate)&&ha(this,e.call(da,{key:t,layerType:this.type,objectKey:n,value:a,styleSpec:ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Ja&&hn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const sr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class lr{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class cr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ur(e,t=1){let n=0,a=0;return{members:e.map(e=>{const r=sr[e.type].BYTES_PER_ELEMENT,i=n=dr(n,Math.max(t,r)),o=e.components||1;return a=Math.max(a,r),n+=r*o,{name:e.name,type:e.type,components:o,offset:i}}),size:dr(n,Math.max(a,t)),alignment:t}}function dr(e,t){return Math.ceil(e/t)*t}class pr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const a=2*e;return this.int16[a+0]=t,this.int16[a+1]=n,e}}pr.prototype.bytesPerElement=4,_a("StructArrayLayout2i4",pr);class mr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,a)}emplace(e,t,n,a,r){const i=4*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=a,this.int16[i+3]=r,e}}mr.prototype.bytesPerElement=8,_a("StructArrayLayout4i8",mr);class br extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,a,r,i)}emplace(e,t,n,a,r,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=a,this.int16[s+3]=r,this.int16[s+4]=i,this.int16[s+5]=o,e}}br.prototype.bytesPerElement=12,_a("StructArrayLayout2i4i12",br);class hr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,a,r,i)}emplace(e,t,n,a,r,i,o){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[l+4]=a,this.uint8[l+5]=r,this.uint8[l+6]=i,this.uint8[l+7]=o,e}}hr.prototype.bytesPerElement=8,_a("StructArrayLayout2i4ub8",hr);class fr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const a=2*e;return this.float32[a+0]=t,this.float32[a+1]=n,e}}fr.prototype.bytesPerElement=8,_a("StructArrayLayout2f8",fr);class gr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,a,r,i,o,s,l,c)}emplace(e,t,n,a,r,i,o,s,l,c,u){const d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=a,this.uint16[d+3]=r,this.uint16[d+4]=i,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.uint16[d+8]=c,this.uint16[d+9]=u,e}}gr.prototype.bytesPerElement=20,_a("StructArrayLayout10ui20",gr);class _r extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c,u,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,a,r,i,o,s,l,c,u,d)}emplace(e,t,n,a,r,i,o,s,l,c,u,d,p){const m=12*e;return this.int16[m+0]=t,this.int16[m+1]=n,this.int16[m+2]=a,this.int16[m+3]=r,this.uint16[m+4]=i,this.uint16[m+5]=o,this.uint16[m+6]=s,this.uint16[m+7]=l,this.int16[m+8]=c,this.int16[m+9]=u,this.int16[m+10]=d,this.int16[m+11]=p,e}}_r.prototype.bytesPerElement=24,_a("StructArrayLayout4i4ui4i24",_r);class yr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=3*e;return this.float32[r+0]=t,this.float32[r+1]=n,this.float32[r+2]=a,e}}yr.prototype.bytesPerElement=12,_a("StructArrayLayout3f12",yr);class Mr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Mr.prototype.bytesPerElement=4,_a("StructArrayLayout1ul4",Mr);class vr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,a,r,i,o,s,l)}emplace(e,t,n,a,r,i,o,s,l,c){const u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=a,this.int16[u+3]=r,this.int16[u+4]=i,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}vr.prototype.bytesPerElement=20,_a("StructArrayLayout6i1ul2ui20",vr);class zr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,a,r,i)}emplace(e,t,n,a,r,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=a,this.int16[s+3]=r,this.int16[s+4]=i,this.int16[s+5]=o,e}}zr.prototype.bytesPerElement=12,_a("StructArrayLayout2i2i2i12",zr);class Or extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,a,r)}emplace(e,t,n,a,r,i){const o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=a,this.int16[s+6]=r,this.int16[s+7]=i,e}}Or.prototype.bytesPerElement=16,_a("StructArrayLayout2f1f2i16",Or);class kr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,a)}emplace(e,t,n,a,r){const i=12*e,o=3*e;return this.uint8[i+0]=t,this.uint8[i+1]=n,this.float32[o+1]=a,this.float32[o+2]=r,e}}kr.prototype.bytesPerElement=12,_a("StructArrayLayout2ub2f12",kr);class Ar extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=3*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,this.uint16[r+2]=a,e}}Ar.prototype.bytesPerElement=6,_a("StructArrayLayout3ui6",Ar);class xr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f){const g=this.length;return this.resize(g+1),this.emplace(g,e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f)}emplace(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g){const _=24*e,y=12*e,M=48*e;return this.int16[_+0]=t,this.int16[_+1]=n,this.uint16[_+2]=a,this.uint16[_+3]=r,this.uint32[y+2]=i,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+12]=u,this.float32[y+7]=d,this.float32[y+8]=p,this.uint8[M+36]=m,this.uint8[M+37]=b,this.uint8[M+38]=h,this.uint32[y+10]=f,this.int16[_+22]=g,e}}xr.prototype.bytesPerElement=48,_a("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xr);class wr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g,_,y,M,v,z,O,k,A,x,w){const N=this.length;return this.resize(N+1),this.emplace(N,e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g,_,y,M,v,z,O,k,A,x,w)}emplace(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g,_,y,M,v,z,O,k,A,x,w,N){const q=34*e,E=17*e;return this.int16[q+0]=t,this.int16[q+1]=n,this.int16[q+2]=a,this.int16[q+3]=r,this.int16[q+4]=i,this.int16[q+5]=o,this.int16[q+6]=s,this.int16[q+7]=l,this.uint16[q+8]=c,this.uint16[q+9]=u,this.uint16[q+10]=d,this.uint16[q+11]=p,this.uint16[q+12]=m,this.uint16[q+13]=b,this.uint16[q+14]=h,this.uint16[q+15]=f,this.uint16[q+16]=g,this.uint16[q+17]=_,this.uint16[q+18]=y,this.uint16[q+19]=M,this.uint16[q+20]=v,this.uint16[q+21]=z,this.uint16[q+22]=O,this.uint32[E+12]=k,this.float32[E+13]=A,this.float32[E+14]=x,this.float32[E+15]=w,this.float32[E+16]=N,e}}wr.prototype.bytesPerElement=68,_a("StructArrayLayout8i15ui1ul4f68",wr);class Nr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Nr.prototype.bytesPerElement=4,_a("StructArrayLayout1f4",Nr);class qr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=3*e;return this.int16[r+0]=t,this.int16[r+1]=n,this.int16[r+2]=a,e}}qr.prototype.bytesPerElement=6,_a("StructArrayLayout3i6",qr);class Er extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n)}emplace(e,t,n,a){const r=4*e;return this.uint32[2*e+0]=t,this.uint16[r+2]=n,this.uint16[r+3]=a,e}}Er.prototype.bytesPerElement=8,_a("StructArrayLayout1ul2ui8",Er);class jr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const a=2*e;return this.uint16[a+0]=t,this.uint16[a+1]=n,e}}jr.prototype.bytesPerElement=4,_a("StructArrayLayout2ui4",jr);class Wr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Wr.prototype.bytesPerElement=2,_a("StructArrayLayout1ui2",Wr);class Lr extends cr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,a){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n,a)}emplace(e,t,n,a,r){const i=4*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=a,this.float32[i+3]=r,e}}Lr.prototype.bytesPerElement=16,_a("StructArrayLayout4f16",Lr);class Sr extends lr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new A(this.anchorPointX,this.anchorPointY)}}Sr.prototype.size=20;class Tr extends vr{get(e){return new Sr(this,e)}}_a("CollisionBoxArray",Tr);class Cr extends lr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Cr.prototype.size=48;class Rr extends xr{get(e){return new Cr(this,e)}}_a("PlacedSymbolArray",Rr);class Dr extends lr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get 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]}}Dr.prototype.size=68;class Pr extends wr{get(e){return new Dr(this,e)}}_a("SymbolInstanceArray",Pr);class Br extends Nr{getoffsetX(e){return this.float32[1*e+0]}}_a("GlyphOffsetArray",Br);class Ir extends qr{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}_a("SymbolLineVertexArray",Ir);class $r extends lr{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]}}$r.prototype.size=8;class Fr extends Er{get(e){return new $r(this,e)}}_a("FeatureIndexArray",Fr);class Xr extends pr{}class Yr extends pr{}class Hr extends pr{}class Ur extends br{}class Vr extends hr{}class Gr extends fr{}class Kr extends gr{}class Jr extends _r{}class Zr extends yr{}class Qr extends Mr{}class ei extends zr{}class ti extends kr{}class ni extends Ar{}class ai extends jr{}const ri=ur([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=ri;class oi{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,a){let r=this.segments[this.segments.length-1];return e>oi.MAX_VERTEX_ARRAY_LENGTH&&b(`Max vertices per segment is ${oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!r||r.vertexLength+e>oi.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==a)&&(r={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==a&&(r.sortKey=a),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,a){return new oi([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}function si(e,t){return 256*(e=i(Math.floor(e),0,255))+i(Math.floor(t),0,255)}oi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,_a("SegmentVector",oi);const li=ur([{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 ci={exports:{}},ui={exports:{}};ui.exports=function(e,t){var n,a,r,i,o,s,l,c;for(a=e.length-(n=3&e.length),r=t,o=3432918353,s=461845907,c=0;c<a;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,r=27492+(65535&(i=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var di={exports:{}};di.exports=function(e,t){for(var n,a=e.length,r=t^a,i=0;a>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(i)|(255&e.charCodeAt(++i))<<8|(255&e.charCodeAt(++i))<<16|(255&e.charCodeAt(++i))<<24))+((1540483477*(n>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),a-=4,++i;switch(a){case 3:r^=(255&e.charCodeAt(i+2))<<16;case 2:r^=(255&e.charCodeAt(i+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(i)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};var pi=ui.exports,mi=di.exports;ci.exports=pi,ci.exports.murmur3=pi,ci.exports.murmur2=mi;class bi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,a){this.ids.push(hi(e)),this.positions.push(t,n,a)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=hi(e);let n=0,a=this.ids.length-1;for(;n<a;){const e=n+a>>1;this.ids[e]>=t?a=e:n=e+1}const r=[];for(;this.ids[n]===t;)r.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return r}static serialize(e,t){const n=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(t,n,a,r){for(;a<r;){const i=t[a+r>>1];let o=a-1,s=r+1;for(;;){do{o++}while(t[o]<i);do{s--}while(t[s]>i);if(o>=s)break;fi(t,o,s),fi(n,3*o,3*s),fi(n,3*o+1,3*s+1),fi(n,3*o+2,3*s+2)}s-a<r-s?(e(t,n,a,s),a=s+1):(e(t,n,s+1,r),r=s)}}(n,a,0,n.length-1),t&&t.push(n.buffer,a.buffer),{ids:n,positions:a}}static deserialize(e){const t=new bi;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function hi(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:ci.exports(String(e))}function fi(e,t,n){const a=e[t];e[t]=e[n],e[n]=a}_a("FeaturePositionMap",bi);class gi{constructor(e,t){this.gl=e.gl,this.location=t}}class _i extends gi{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class yi extends gi{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Mi extends gi{constructor(e,t){super(e,t),this.current=Le.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const vi=new Float32Array(16);function zi(e){return[si(255*e.r,255*e.g),si(255*e.b,255*e.a)]}class Oi{constructor(e,t,n){this.value=e,this.uniformNames=t.map(e=>"u_"+e),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return"color"===this.type?new Mi(e,t):new _i(e,t)}}class ki{constructor(e,t){this.uniformNames=t.map(e=>"u_"+e),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,n,a){const r="u_pattern_to"===a?this.patternTo:"u_pattern_from"===a?this.patternFrom:"u_pixel_ratio_to"===a?this.pixelRatioTo:"u_pixel_ratio_from"===a?this.pixelRatioFrom:null;r&&e.set(r)}getBinding(e,t,n){return"u_pattern"===n.substr(0,9)?new yi(e,t):new _i(e,t)}}class Ai{constructor(e,t,n,a){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:"a_"+e,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,n,a,r){const i=this.paintVertexArray.length,o=this.expression.evaluate(new Xa(0),t,{},a,[],r);this.paintVertexArray.resize(e),this._setPaintValue(i,e,o)}updatePaintArray(e,t,n,a){const r=this.expression.evaluate({zoom:0},n,a);this._setPaintValue(e,t,r)}_setPaintValue(e,t,n){if("color"===this.type){const a=zi(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,a[0],a[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class xi{constructor(e,t,n,a,r,i){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=n,this.useIntegerZoom=a,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:"a_"+e,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,n,a,r){const i=this.expression.evaluate(new Xa(this.zoom),t,{},a,[],r),o=this.expression.evaluate(new Xa(this.zoom+1),t,{},a,[],r),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,i,o)}updatePaintArray(e,t,n,a){const r=this.expression.evaluate({zoom:this.zoom},n,a),i=this.expression.evaluate({zoom:this.zoom+1},n,a);this._setPaintValue(e,t,r,i)}_setPaintValue(e,t,n,a){if("color"===this.type){const r=zi(n),i=zi(a);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1],i[0],i[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n,a);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,a=i(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(a)}getBinding(e,t,n){return new _i(e,t)}}class wi{constructor(e,t,n,a,r,i){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=a,this.layerId=i,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(e,t,n){const a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(a,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,a,r){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],r)}_setPaintValues(e,t,n,a){if(!a||!n)return;const{min:r,mid:i,max:o}=n,s=a[r],l=a[i],c=a[o];if(s&&l&&c)for(let n=e;n<t;n++)this.zoomInPaintVertexArray.emplace(n,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(n,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,li.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,li.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ni{constructor(e,t,n){this.binders={},this._buffers=[];const a=[];for(const r in e.paint._values){if(!n(r))continue;const i=e.paint.get(r);if(!(i instanceof Ja&&hn(i.property.specification)))continue;const o=Ei(r,e.type),s=i.value,l=i.property.specification.type,c=i.property.useIntegerZoom,u=i.property.specification["property-type"],d="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[r]=d?new ki(s.value,o):new Oi(s.value,o,l),a.push("/u_"+r);else if("source"===s.kind||d){const n=ji(r,l,"source");this.binders[r]=d?new wi(s,l,c,t,n,e.id):new Ai(s,o,l,n),a.push("/a_"+r)}else{const e=ji(r,l,"composite");this.binders[r]=new xi(s,o,l,c,t,e),a.push("/z_"+r)}}this.cacheKey=a.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Ai||t instanceof xi?t.maxValue:0}populatePaintArrays(e,t,n,a,r){for(const i in this.binders){const o=this.binders[i];(o instanceof Ai||o instanceof xi||o instanceof wi)&&o.populatePaintArray(e,t,n,a,r)}}setConstantPatternPositions(e,t){for(const n in this.binders){const a=this.binders[n];a instanceof ki&&a.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,a,r){let i=!1;for(const o in e){const s=t.getPositions(o);for(const t of s){const s=n.feature(t.index);for(const n in this.binders){const l=this.binders[n];if((l instanceof Ai||l instanceof xi||l instanceof wi)&&!0===l.expression.isStateDependent){const c=a.paint.get(n);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[o],r),i=!0}}}}return i}defines(){const e=[];for(const t in this.binders){const n=this.binders[t];(n instanceof Oi||n instanceof ki)&&e.push(...n.uniformNames.map(e=>"#define HAS_UNIFORM_"+e))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const n=this.binders[t];if(n instanceof Ai||n instanceof xi)for(let t=0;t<n.paintVertexAttributes.length;t++)e.push(n.paintVertexAttributes[t].name);else if(n instanceof wi)for(let t=0;t<li.members.length;t++)e.push(li.members[t].name)}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const n=this.binders[t];if(n instanceof Oi||n instanceof ki||n instanceof xi)for(const t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const n=[];for(const a in this.binders){const r=this.binders[a];if(r instanceof Oi||r instanceof ki||r instanceof xi)for(const i of r.uniformNames)if(t[i]){const o=r.getBinding(e,t[i],i);n.push({name:i,property:a,binding:o})}}return n}setUniforms(e,t,n,a){for(const{name:e,property:r,binding:i}of t)this.binders[r].setUniform(i,a,n.get(r),e)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const n=this.binders[t];if(e&&n instanceof wi){const t=2===e.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(n instanceof Ai||n instanceof xi)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(const t in this.binders){const n=this.binders[t];(n instanceof Ai||n instanceof xi||n instanceof wi)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Ai||t instanceof xi||t instanceof wi)&&t.destroy()}}}class qi{constructor(e,t,n=(()=>!0)){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Ni(a,t,n);this.needsUpload=!1,this._featureMap=new bi,this._bufferOffset=0}populatePaintArrays(e,t,n,a,r,i){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,a,r,i);void 0!==t.id&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,a){for(const r of n)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(e,this._featureMap,t,r,a)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ei(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(t+"-","").replace(/-/g,"_")]}function ji(e,t,n){const a={color:{source:fr,composite:Lr},number:{source:Nr,composite:fr}},r=function(e){return{"line-pattern":{source:Kr,composite:Kr},"fill-pattern":{source:Kr,composite:Kr},"fill-extrusion-pattern":{source:Kr,composite:Kr}}[e]}(e);return r&&r[n]||a[t][n]}_a("ConstantBinder",Oi),_a("CrossFadedConstantBinder",ki),_a("SourceExpressionBinder",Ai),_a("CrossFadedCompositeBinder",wi),_a("CompositeExpressionBinder",xi),_a("ProgramConfiguration",Ni,{omit:["_buffers"]}),_a("ProgramConfigurationSet",qi);var Wi=8192;const Li=Math.pow(2,14)-1,Si=-Li-1;function Ti(e){const t=Wi/e.extent,n=e.loadGeometry();for(let e=0;e<n.length;e++){const a=n[e];for(let e=0;e<a.length;e++){const n=a[e],r=Math.round(n.x*t),o=Math.round(n.y*t);n.x=i(r,Si,Li),n.y=i(o,Si,Li),(r<n.x||r>n.x+1||o<n.y||o>n.y+1)&&b("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Ci(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ti(e):[]}}function Ri(e,t,n,a,r){e.emplaceBack(2*t+(a+1)/2,2*n+(r+1)/2)}class Di{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Yr,this.indexArray=new ni,this.segments=new oi,this.programConfigurations=new qi(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){const a=this.layers[0],r=[];let i=null,o=!1;"circle"===a.type&&(i=a.layout.get("circle-sort-key"),o=!i.isConstant());for(const{feature:t,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ci(t,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),c,n))continue;const u=o?i.evaluate(c,{},n):void 0,d={id:a,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Ti(t),patterns:{},sortKey:u};r.push(d)}o&&r.sort((e,t)=>e.sortKey-t.sortKey);for(const a of r){const{geometry:r,index:i,sourceLayerIndex:o}=a,s=e[i].feature;this.addFeature(a,r,i,n),t.featureIndex.insert(s,r,i,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ii),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,a){for(const n of t)for(const t of n){const n=t.x,a=t.y;if(n<0||n>=Wi||a<0||a>=Wi)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),i=r.vertexLength;Ri(this.layoutVertexArray,n,a,-1,-1),Ri(this.layoutVertexArray,n,a,1,-1),Ri(this.layoutVertexArray,n,a,1,1),Ri(this.layoutVertexArray,n,a,-1,1),this.indexArray.emplaceBack(i,i+1,i+2),this.indexArray.emplaceBack(i,i+3,i+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},a)}}function Pi(e,t){for(let n=0;n<e.length;n++)if(Vi(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Vi(e,t[n]))return!0;return!!Fi(e,t)}function Bi(e,t,n){return!!Vi(e,t)||!!Yi(t,e,n)}function Ii(e,t){if(1===e.length)return Ui(t,e[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let t=0;t<a.length;t++)if(Vi(e,a[t]))return!0}for(let n=0;n<e.length;n++)if(Ui(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Fi(e,t[n]))return!0;return!1}function $i(e,t,n){if(e.length>1){if(Fi(e,t))return!0;for(let a=0;a<t.length;a++)if(Yi(t[a],e,n))return!0}for(let a=0;a<e.length;a++)if(Yi(e[a],t,n))return!0;return!1}function Fi(e,t){if(0===e.length||0===t.length)return!1;for(let n=0;n<e.length-1;n++){const a=e[n],r=e[n+1];for(let e=0;e<t.length-1;e++)if(Xi(a,r,t[e],t[e+1]))return!0}return!1}function Xi(e,t,n,a){return h(e,n,a)!==h(t,n,a)&&h(e,t,n)!==h(e,t,a)}function Yi(e,t,n){const a=n*n;if(1===t.length)return e.distSqr(t[0])<a;for(let n=1;n<t.length;n++)if(Hi(e,t[n-1],t[n])<a)return!0;return!1}function Hi(e,t,n){const a=t.distSqr(n);if(0===a)return e.distSqr(t);const r=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/a;return e.distSqr(r<0?t:r>1?n:n.sub(t)._mult(r)._add(t))}function Ui(e,t){let n,a,r,i=!1;for(let o=0;o<e.length;o++){n=e[o];for(let e=0,o=n.length-1;e<n.length;o=e++)a=n[e],r=n[o],a.y>t.y!=r.y>t.y&&t.x<(r.x-a.x)*(t.y-a.y)/(r.y-a.y)+a.x&&(i=!i)}return i}function Vi(e,t){let n=!1;for(let a=0,r=e.length-1;a<e.length;r=a++){const i=e[a],o=e[r];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(n=!n)}return n}function Gi(e,t,n){const a=n[0],r=n[2];if(e.x<a.x&&t.x<a.x||e.x>r.x&&t.x>r.x||e.y<a.y&&t.y<a.y||e.y>r.y&&t.y>r.y)return!1;const i=h(e,t,n[0]);return i!==h(e,t,n[1])||i!==h(e,t,n[2])||i!==h(e,t,n[3])}function Ki(e,t,n){const a=t.paint.get(e).value;return"constant"===a.kind?a.value:n.programConfigurations.get(t.id).getMaxValue(e)}function Ji(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Zi(e,t,n,a,r){if(!t[0]&&!t[1])return e;const i=A.convert(t)._mult(r);"viewport"===n&&i._rotate(-a);const o=[];for(let t=0;t<e.length;t++)o.push(e[t].sub(i));return o}_a("CircleBucket",Di,{omit:["layers"]});const Qi=new rr({"circle-sort-key":new er(ne.layout_circle["circle-sort-key"])});var eo={paint:new rr({"circle-radius":new er(ne.paint_circle["circle-radius"]),"circle-color":new er(ne.paint_circle["circle-color"]),"circle-blur":new er(ne.paint_circle["circle-blur"]),"circle-opacity":new er(ne.paint_circle["circle-opacity"]),"circle-translate":new Qa(ne.paint_circle["circle-translate"]),"circle-translate-anchor":new Qa(ne.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Qa(ne.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Qa(ne.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new er(ne.paint_circle["circle-stroke-width"]),"circle-stroke-color":new er(ne.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new er(ne.paint_circle["circle-stroke-opacity"])}),layout:Qi},to=1e-6,no="undefined"!=typeof Float32Array?Float32Array:Array;function ao(){var e=new no(9);return no!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ro(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function io(e,t,n){var a=t[0],r=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],m=t[10],b=t[11],h=t[12],f=t[13],g=t[14],_=t[15],y=n[0],M=n[1],v=n[2],z=n[3];return e[0]=y*a+M*s+v*d+z*h,e[1]=y*r+M*l+v*p+z*f,e[2]=y*i+M*c+v*m+z*g,e[3]=y*o+M*u+v*b+z*_,e[4]=(y=n[4])*a+(M=n[5])*s+(v=n[6])*d+(z=n[7])*h,e[5]=y*r+M*l+v*p+z*f,e[6]=y*i+M*c+v*m+z*g,e[7]=y*o+M*u+v*b+z*_,e[8]=(y=n[8])*a+(M=n[9])*s+(v=n[10])*d+(z=n[11])*h,e[9]=y*r+M*l+v*p+z*f,e[10]=y*i+M*c+v*m+z*g,e[11]=y*o+M*u+v*b+z*_,e[12]=(y=n[12])*a+(M=n[13])*s+(v=n[14])*d+(z=n[15])*h,e[13]=y*r+M*l+v*p+z*f,e[14]=y*i+M*c+v*m+z*g,e[15]=y*o+M*u+v*b+z*_,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var oo,so=io;function lo(){var e=new no(3);return no!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function co(e,t,n){var a=new no(3);return a[0]=e,a[1]=t,a[2]=n,a}function uo(e,t,n){var a=t[0],r=t[1],i=t[2],o=t[3];return e[0]=n[0]*a+n[4]*r+n[8]*i+n[12]*o,e[1]=n[1]*a+n[5]*r+n[9]*i+n[13]*o,e[2]=n[2]*a+n[6]*r+n[10]*i+n[14]*o,e[3]=n[3]*a+n[7]*r+n[11]*i+n[15]*o,e}function po(){var e=new no(4);return no!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function mo(e,t){const n=uo([],[e.x,e.y,0,1],t);return new A(n[0]/n[3],n[1]/n[3])}lo(),oo=new no(4),no!=Float32Array&&(oo[0]=0,oo[1]=0,oo[2]=0,oo[3]=0),lo(),co(1,0,0),co(0,1,0),po(),po(),ao(),function(){var e;e=new no(2),no!=Float32Array&&(e[0]=0,e[1]=0)}();class bo extends Di{}_a("HeatmapBucket",bo,{omit:["layers"]});var ho={paint:new rr({"heatmap-radius":new er(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new er(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qa(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ar(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qa(ne.paint_heatmap["heatmap-opacity"])})};function fo(e,{width:t,height:n},a,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${t*n*a}`)}else r=new Uint8Array(t*n*a);return e.width=t,e.height=n,e.data=r,e}function go(e,{width:t,height:n},a){if(t===e.width&&n===e.height)return;const r=fo({},{width:t,height:n},a);_o(e,r,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},a),e.width=t,e.height=n,e.data=r.data}function _o(e,t,n,a,r,i){if(0===r.width||0===r.height)return t;if(r.width>e.width||r.height>e.height||n.x>e.width-r.width||n.y>e.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>t.width||r.height>t.height||a.x>t.width-r.width||a.y>t.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=e.data,s=t.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<r.height;l++){const c=((n.y+l)*e.width+n.x)*i,u=((a.y+l)*t.width+a.x)*i;for(let e=0;e<r.width*i;e++)s[u+e]=o[c+e]}return t}class yo{constructor(e,t){fo(this,e,1,t)}resize(e){go(this,e,1)}clone(){return new yo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,a,r){_o(e,t,n,a,r,1)}}class Mo{constructor(e,t){fo(this,e,4,t)}resize(e){go(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Mo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,a,r){_o(e,t,n,a,r,4)}}function vo(e){const t={},n=e.resolution||256,a=e.clips?e.clips.length:1,r=e.image||new Mo({width:n,height:a});if(Math.log(n)/Math.LN2%1!=0)throw new Error("width is not a power of 2 - "+n);const i=(n,a,i)=>{t[e.evaluationKey]=i;const o=e.expression.evaluate(t);r.data[n+a+0]=Math.floor(255*o.r/o.a),r.data[n+a+1]=Math.floor(255*o.g/o.a),r.data[n+a+2]=Math.floor(255*o.b/o.a),r.data[n+a+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,r=0;t<a;++t,r+=4*n)for(let a=0,o=0;a<n;a++,o+=4){const s=a/(n-1),{start:l,end:c}=e.clips[t];i(r,o,l*(1-s)+c*s)}else for(let e=0,t=0;e<n;e++,t+=4)i(0,t,e/(n-1));return r}_a("AlphaImage",yo),_a("RGBAImage",Mo);var zo={paint:new rr({"hillshade-illumination-direction":new Qa(ne.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Qa(ne.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Qa(ne.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Qa(ne.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Qa(ne.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Qa(ne.paint_hillshade["hillshade-accent-color"])})};const Oo=ur([{name:"a_pos",components:2,type:"Int16"}],4),{members:ko}=Oo;var Ao={exports:{}};function xo(e,t,n){n=n||2;var a,r,i,o,s,l,c,u=t&&t.length,d=u?t[0]*n:e.length,p=wo(e,0,d,n,!0),m=[];if(!p||p.next===p.prev)return m;if(u&&(p=function(e,t,n,a){var r,i,o,s=[];for(r=0,i=t.length;r<i;r++)(o=wo(e,t[r]*a,r<i-1?t[r+1]*a:e.length,a,!1))===o.next&&(o.steiner=!0),s.push(Do(o));for(s.sort(So),r=0;r<s.length;r++)n=To(s[r],n);return n}(e,t,p,n)),e.length>80*n){a=i=e[0],r=o=e[1];for(var b=n;b<d;b+=n)(s=e[b])<a&&(a=s),(l=e[b+1])<r&&(r=l),s>i&&(i=s),l>o&&(o=l);c=0!==(c=Math.max(i-a,o-r))?32767/c:0}return qo(p,m,n,a,r,c,0),m}function wo(e,t,n,a,r){var i,o;if(r===Jo(e,t,n,a)>0)for(i=t;i<n;i+=a)o=Vo(i,e[i],e[i+1],o);else for(i=n-a;i>=t;i-=a)o=Vo(i,e[i],e[i+1],o);return o&&$o(o,o.next)&&(Go(o),o=o.next),o}function No(e,t){if(!e)return e;t||(t=e);var n,a=e;do{if(n=!1,a.steiner||!$o(a,a.next)&&0!==Io(a.prev,a,a.next))a=a.next;else{if(Go(a),(a=t=a.prev)===a.next)break;n=!0}}while(n||a!==t);return t}function qo(e,t,n,a,r,i,o){if(e){!o&&i&&function(e,t,n,a){var r=e;do{0===r.z&&(r.z=Ro(r.x,r.y,t,n,a)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,a,r,i,o,s,l,c=1;do{for(n=e,e=null,i=null,o=0;n;){for(o++,a=n,s=0,t=0;t<c&&(s++,a=a.nextZ);t++);for(l=c;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(r=n,n=n.nextZ,s--):(r=a,a=a.nextZ,l--),i?i.nextZ=r:e=r,r.prevZ=i,i=r;n=a}i.nextZ=null,c*=2}while(o>1)}(r)}(e,a,r,i);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,i?jo(e,a,r,i):Eo(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),Go(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?qo(e=Wo(No(e),t,n),t,n,a,r,i,2):2===o&&Lo(e,t,n,a,r,i):qo(No(e),t,n,a,r,i,1);break}}}function Eo(e){var t=e.prev,n=e,a=e.next;if(Io(t,n,a)>=0)return!1;for(var r=t.x,i=n.x,o=a.x,s=t.y,l=n.y,c=a.y,u=r<i?r<o?r:o:i<o?i:o,d=s<l?s<c?s:c:l<c?l:c,p=r>i?r>o?r:o:i>o?i:o,m=s>l?s>c?s:c:l>c?l:c,b=a.next;b!==t;){if(b.x>=u&&b.x<=p&&b.y>=d&&b.y<=m&&Po(r,s,i,l,o,c,b.x,b.y)&&Io(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function jo(e,t,n,a){var r=e.prev,i=e,o=e.next;if(Io(r,i,o)>=0)return!1;for(var s=r.x,l=i.x,c=o.x,u=r.y,d=i.y,p=o.y,m=s<l?s<c?s:c:l<c?l:c,b=u<d?u<p?u:p:d<p?d:p,h=s>l?s>c?s:c:l>c?l:c,f=u>d?u>p?u:p:d>p?d:p,g=Ro(m,b,t,n,a),_=Ro(h,f,t,n,a),y=e.prevZ,M=e.nextZ;y&&y.z>=g&&M&&M.z<=_;){if(y.x>=m&&y.x<=h&&y.y>=b&&y.y<=f&&y!==r&&y!==o&&Po(s,u,l,d,c,p,y.x,y.y)&&Io(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,M.x>=m&&M.x<=h&&M.y>=b&&M.y<=f&&M!==r&&M!==o&&Po(s,u,l,d,c,p,M.x,M.y)&&Io(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;y&&y.z>=g;){if(y.x>=m&&y.x<=h&&y.y>=b&&y.y<=f&&y!==r&&y!==o&&Po(s,u,l,d,c,p,y.x,y.y)&&Io(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;M&&M.z<=_;){if(M.x>=m&&M.x<=h&&M.y>=b&&M.y<=f&&M!==r&&M!==o&&Po(s,u,l,d,c,p,M.x,M.y)&&Io(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Wo(e,t,n){var a=e;do{var r=a.prev,i=a.next.next;!$o(r,i)&&Fo(r,a,a.next,i)&&Ho(r,i)&&Ho(i,r)&&(t.push(r.i/n|0),t.push(a.i/n|0),t.push(i.i/n|0),Go(a),Go(a.next),a=e=i),a=a.next}while(a!==e);return No(a)}function Lo(e,t,n,a,r,i){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Bo(o,s)){var l=Uo(o,s);return o=No(o,o.next),l=No(l,l.next),qo(o,t,n,a,r,i,0),void qo(l,t,n,a,r,i,0)}s=s.next}o=o.next}while(o!==e)}function So(e,t){return e.x-t.x}function To(e,t){var n=function(e,t){var n,a=t,r=e.x,i=e.y,o=-1/0;do{if(i<=a.y&&i>=a.next.y&&a.next.y!==a.y){var s=a.x+(i-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(s<=r&&s>o&&(o=s,n=a.x<a.next.x?a:a.next,s===r))return n}a=a.next}while(a!==t);if(!n)return null;var l,c=n,u=n.x,d=n.y,p=1/0;a=n;do{r>=a.x&&a.x>=u&&r!==a.x&&Po(i<d?r:o,i,u,d,i<d?o:r,i,a.x,a.y)&&(l=Math.abs(i-a.y)/(r-a.x),Ho(a,e)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&Co(n,a)))&&(n=a,p=l)),a=a.next}while(a!==c);return n}(e,t);if(!n)return t;var a=Uo(n,e);return No(a,a.next),No(n,n.next)}function Co(e,t){return Io(e.prev,e,t.prev)<0&&Io(t.next,e,e.next)<0}function Ro(e,t,n,a,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Do(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Po(e,t,n,a,r,i,o,s){return(r-o)*(t-s)>=(e-o)*(i-s)&&(e-o)*(a-s)>=(n-o)*(t-s)&&(n-o)*(i-s)>=(r-o)*(a-s)}function Bo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Fo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ho(e,t)&&Ho(t,e)&&function(e,t){var n=e,a=!1,r=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(a=!a),n=n.next}while(n!==e);return a}(e,t)&&(Io(e.prev,e,t.prev)||Io(e,t.prev,t))||$o(e,t)&&Io(e.prev,e,e.next)>0&&Io(t.prev,t,t.next)>0)}function Io(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function $o(e,t){return e.x===t.x&&e.y===t.y}function Fo(e,t,n,a){var r=Yo(Io(e,t,n)),i=Yo(Io(e,t,a)),o=Yo(Io(n,a,e)),s=Yo(Io(n,a,t));return r!==i&&o!==s||!(0!==r||!Xo(e,n,t))||!(0!==i||!Xo(e,a,t))||!(0!==o||!Xo(n,e,a))||!(0!==s||!Xo(n,t,a))}function Xo(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Yo(e){return e>0?1:e<0?-1:0}function Ho(e,t){return Io(e.prev,e,e.next)<0?Io(e,t,e.next)>=0&&Io(e,e.prev,t)>=0:Io(e,t,e.prev)<0||Io(e,e.next,t)<0}function Uo(e,t){var n=new Ko(e.i,e.x,e.y),a=new Ko(t.i,t.x,t.y),r=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,a.next=n,n.prev=a,i.next=a,a.prev=i,a}function Vo(e,t,n,a){var r=new Ko(e,t,n);return a?(r.next=a.next,r.prev=a,a.next.prev=r,a.next=r):(r.prev=r,r.next=r),r}function Go(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ko(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Jo(e,t,n,a){for(var r=0,i=t,o=n-a;i<n;i+=a)r+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return r}function Zo(e,t,n,a,r){!function e(t,n,a,r,i){for(;r>a;){if(r-a>600){var o=r-a+1,s=n-a+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);e(t,n,Math.max(a,Math.floor(n-s*c/o+u)),Math.min(r,Math.floor(n+(o-s)*c/o+u)),i)}var d=t[n],p=a,m=r;for(Qo(t,a,n),i(t[r],d)>0&&Qo(t,a,r);p<m;){for(Qo(t,p,m),p++,m--;i(t[p],d)<0;)p++;for(;i(t[m],d)>0;)m--}0===i(t[a],d)?Qo(t,a,m):Qo(t,++m,r),m<=n&&(a=m+1),n<=m&&(r=m-1)}}(e,t,n||0,a||e.length-1,r||es)}function Qo(e,t,n){var a=e[t];e[t]=e[n],e[n]=a}function es(e,t){return e<t?-1:e>t?1:0}function ts(e,t){const n=e.length;if(n<=1)return[e];const a=[];let r,i;for(let t=0;t<n;t++){const n=f(e[t]);0!==n&&(e[t].area=Math.abs(n),void 0===i&&(i=n<0),i===n<0?(r&&a.push(r),r=[e[t]]):r.push(e[t]))}if(r&&a.push(r),t>1)for(let e=0;e<a.length;e++)a[e].length<=t||(Zo(a[e],t,1,a[e].length-1,ns),a[e]=a[e].slice(0,t));return a}function ns(e,t){return t.area-e.area}function as(e,t,n){const a=n.patternDependencies;let r=!1;for(const n of t){const t=n.paint.get(e+"-pattern");t.isConstant()||(r=!0);const i=t.constantOr(null);i&&(r=!0,a[i.to]=!0,a[i.from]=!0)}return r}function rs(e,t,n,a,r){const i=r.patternDependencies;for(const o of t){const t=o.paint.get(e+"-pattern").value;if("constant"!==t.kind){let e=t.evaluate({zoom:a-1},n,{},r.availableImages),s=t.evaluate({zoom:a},n,{},r.availableImages),l=t.evaluate({zoom:a+1},n,{},r.availableImages);e=e&&e.name?e.name:e,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,i[e]=!0,i[s]=!0,i[l]=!0,n.patterns[o.id]={min:e,mid:s,max:l}}}return n}Ao.exports=xo,Ao.exports.default=xo,xo.deviation=function(e,t,n,a){var r=t&&t.length,i=Math.abs(Jo(e,0,r?t[0]*n:e.length,n));if(r)for(var o=0,s=t.length;o<s;o++)i-=Math.abs(Jo(e,t[o]*n,o<s-1?t[o+1]*n:e.length,n));var l=0;for(o=0;o<a.length;o+=3){var c=a[o]*n,u=a[o+1]*n,d=a[o+2]*n;l+=Math.abs((e[c]-e[d])*(e[u+1]-e[c+1])-(e[c]-e[u])*(e[d+1]-e[c+1]))}return 0===i&&0===l?0:Math.abs((l-i)/i)},xo.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},a=0,r=0;r<e.length;r++){for(var i=0;i<e[r].length;i++)for(var o=0;o<t;o++)n.vertices.push(e[r][i][o]);r>0&&n.holes.push(a+=e[r-1].length)}return n};class is{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Hr,this.indexArray=new ni,this.indexArray2=new ai,this.programConfigurations=new qi(e.layers,e.zoom),this.segments=new oi,this.segments2=new oi,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.hasPattern=as("fill",this.layers,t);const a=this.layers[0].layout.get("fill-sort-key"),r=!a.isConstant(),i=[];for(const{feature:o,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Ci(o,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),u,n))continue;const d=r?a.evaluate(u,{},n,t.availableImages):void 0,p={id:s,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Ti(o),patterns:{},sortKey:d};i.push(p)}r&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const a of i){const{geometry:r,index:i,sourceLayerIndex:o}=a;if(this.hasPattern){const e=rs("fill",this.layers,a,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(a,r,i,n,{});t.featureIndex.insert(e[i].feature,r,i,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ko),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,a,r){for(const e of ts(t,500)){let t=0;for(const n of e)t+=n.length;const n=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),a=n.vertexLength,r=[],i=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&i.push(r.length/2);const n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),a=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(a+t.length-1,a),r.push(t[0].x),r.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(a+e-1,a+e),r.push(t[e].x),r.push(t[e].y);n.vertexLength+=t.length,n.primitiveLength+=t.length}const o=Ao.exports(r,i);for(let e=0;e<o.length;e+=3)this.indexArray.emplaceBack(a+o[e],a+o[e+1],a+o[e+2]);n.vertexLength+=t,n.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,r,a)}}_a("FillBucket",is,{omit:["layers","patternFeatures"]});const os=new rr({"fill-sort-key":new er(ne.layout_fill["fill-sort-key"])});var ss={paint:new rr({"fill-antialias":new Qa(ne.paint_fill["fill-antialias"]),"fill-opacity":new er(ne.paint_fill["fill-opacity"]),"fill-color":new er(ne.paint_fill["fill-color"]),"fill-outline-color":new er(ne.paint_fill["fill-outline-color"]),"fill-translate":new Qa(ne.paint_fill["fill-translate"]),"fill-translate-anchor":new Qa(ne.paint_fill["fill-translate-anchor"]),"fill-pattern":new tr(ne.paint_fill["fill-pattern"])}),layout:os};const ls=ur([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),cs=ur([{name:"a_centroid",components:2,type:"Int16"}],4),{members:us}=ls;var ds={},ps=A,ms=bs;function bs(e,t,n,a,r){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=r,e.readFields(hs,this,t)}function hs(e,t,n){1==e?t.id=n.readVarint():2==e?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var a=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[a]=r}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function fs(e){for(var t,n,a=0,r=0,i=e.length,o=i-1;r<i;o=r++)a+=((n=e[o]).x-(t=e[r]).x)*(t.y+n.y);return a}bs.types=["Unknown","Point","LineString","Polygon"],bs.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,n=e.readVarint()+e.pos,a=1,r=0,i=0,o=0,s=[];e.pos<n;){if(r<=0){var l=e.readVarint();a=7&l,r=l>>3}if(r--,1===a||2===a)i+=e.readSVarint(),o+=e.readSVarint(),1===a&&(t&&s.push(t),t=[]),t.push(new ps(i,o));else{if(7!==a)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&s.push(t),s},bs.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,a=0,r=0,i=0,o=1/0,s=-1/0,l=1/0,c=-1/0;e.pos<t;){if(a<=0){var u=e.readVarint();n=7&u,a=u>>3}if(a--,1===n||2===n)(r+=e.readSVarint())<o&&(o=r),r>s&&(s=r),(i+=e.readSVarint())<l&&(l=i),i>c&&(c=i);else if(7!==n)throw new Error("unknown command "+n)}return[o,l,s,c]},bs.prototype.toGeoJSON=function(e,t,n){var a,r,i=this.extent*Math.pow(2,n),o=this.extent*e,s=this.extent*t,l=this.loadGeometry(),c=bs.types[this.type];function u(e){for(var t=0;t<e.length;t++){var n=e[t];e[t]=[360*(n.x+o)/i-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+s)/i)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(a=0;a<l.length;a++)d[a]=l[a][0];u(l=d);break;case 2:for(a=0;a<l.length;a++)u(l[a]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var n,a,r=[],i=0;i<t;i++){var o=fs(e[i]);0!==o&&(void 0===a&&(a=o<0),a===o<0?(n&&r.push(n),n=[e[i]]):n.push(e[i]))}return n&&r.push(n),r}(l),a=0;a<l.length;a++)for(r=0;r<l[a].length;r++)u(l[a][r])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var gs=ms,_s=ys;function ys(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Ms,this,t),this.length=this._features.length}function Ms(e,t,n){15===e?t.version=n.readVarint():1===e?t.name=n.readString():5===e?t.extent=n.readVarint():2===e?t._features.push(n.pos):3===e?t._keys.push(n.readString()):4===e&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var a=e.readVarint()>>3;t=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return t}(n))}ys.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new gs(this._pbf,t,this.extent,this._keys,this._values)};var vs=_s;function zs(e,t,n){if(3===e){var a=new vs(n,n.readVarint()+n.pos);a.length&&(t[a.name]=a)}}ds.VectorTile=function(e,t){this.layers=e.readFields(zs,{},t)},ds.VectorTileFeature=ms,ds.VectorTileLayer=_s;const Os=ds.VectorTileFeature.types,ks=Math.pow(2,13);function As(e,t,n,a,r,i,o,s){e.emplaceBack(t,n,2*Math.floor(a*ks)+o,r*ks*2,i*ks*2,Math.round(s))}class xs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ur,this.centroidVertexArray=new Xr,this.indexArray=new ni,this.programConfigurations=new qi(e.layers,e.zoom),this.segments=new oi,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.features=[],this.hasPattern=as("fill-extrusion",this.layers,t);for(const{feature:a,id:r,index:i,sourceLayerIndex:o}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Ci(a,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),s,n))continue;const l={id:r,sourceLayerIndex:o,index:i,geometry:e?s.geometry:Ti(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(rs("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,i,n,{}),t.featureIndex.insert(a,l.geometry,i,o,this.index,!0)}}addFeatures(e,t,n){for(const e of this.features){const{geometry:a}=e;this.addFeature(e,a,e.index,t,n)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,us),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,cs.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,a,r){const i={x:0,y:0,vertexCount:0};for(const n of ts(t,500)){let t=0;for(const e of n)t+=e.length;let a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const e of n){if(0===e.length)continue;if(Ns(e))continue;let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(n>=1){const o=e[n-1];if(!ws(r,o)){a.vertexLength+4>oi.MAX_VERTEX_ARRAY_LENGTH&&(a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const e=r.sub(o)._perp()._unit(),n=o.dist(r);t+n>32768&&(t=0),As(this.layoutVertexArray,r.x,r.y,e.x,e.y,0,0,t),As(this.layoutVertexArray,r.x,r.y,e.x,e.y,0,1,t),i.x+=2*r.x,i.y+=2*r.y,i.vertexCount+=2,t+=n,As(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,0,t),As(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,1,t),i.x+=2*o.x,i.y+=2*o.y,i.vertexCount+=2;const s=a.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),a.vertexLength+=4,a.primitiveLength+=2}}}}if(a.vertexLength+t>oi.MAX_VERTEX_ARRAY_LENGTH&&(a=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray)),"Polygon"!==Os[e.type])continue;const r=[],o=[],s=a.vertexLength;for(const e of n)if(0!==e.length){e!==n[0]&&o.push(r.length/2);for(let t=0;t<e.length;t++){const n=e[t];As(this.layoutVertexArray,n.x,n.y,0,0,1,1,0),i.x+=n.x,i.y+=n.y,i.vertexCount+=1,r.push(n.x),r.push(n.y)}}const l=Ao.exports(r,o);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(s+l[e],s+l[e+2],s+l[e+1]);a.primitiveLength+=l.length/3,a.vertexLength+=t}for(let e=0;e<i.vertexCount;e++)this.centroidVertexArray.emplaceBack(Math.floor(i.x/i.vertexCount),Math.floor(i.y/i.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,r,a)}}function ws(e,t){return e.x===t.x&&(e.x<0||e.x>Wi)||e.y===t.y&&(e.y<0||e.y>Wi)}function Ns(e){return e.every(e=>e.x<0)||e.every(e=>e.x>Wi)||e.every(e=>e.y<0)||e.every(e=>e.y>Wi)}_a("FillExtrusionBucket",xs,{omit:["layers","features"]});var qs={paint:new rr({"fill-extrusion-opacity":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new er(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new tr(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new er(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new er(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qa(ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Es(e,t){return e.x*t.x+e.y*t.y}function js(e,t){if(1===e.length){let n=0;const a=t[n++];let r;for(;!r||a.equals(r);)if(r=t[n++],!r)return 1/0;for(;n<t.length;n++){const i=t[n],o=e[0],s=r.sub(a),l=i.sub(a),c=o.sub(a),u=Es(s,s),d=Es(s,l),p=Es(l,l),m=Es(c,s),b=Es(c,l),h=u*p-d*d,f=(p*m-d*b)/h,g=(u*b-d*m)/h,_=a.z*(1-f-g)+r.z*f+i.z*g;if(isFinite(_))return _}return 1/0}{let e=1/0;for(const n of t)e=Math.min(e,n.z);return e}}const Ws=ur([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ls}=Ws,Ss=ur([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ts}=Ss,Cs=ds.VectorTileFeature.types,Rs=Math.cos(Math.PI/180*37.5),Ds=Math.pow(2,14)/.5;class Ps{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Vr,this.layoutVertexArray2=new Gr,this.indexArray=new ni,this.programConfigurations=new qi(e.layers,e.zoom),this.segments=new oi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.hasPattern=as("line",this.layers,t);const a=this.layers[0].layout.get("line-sort-key"),r=!a.isConstant(),i=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ci(t,e);if(!this.layers[0]._featureFilter.filter(new Xa(this.zoom),c,n))continue;const u=r?a.evaluate(c,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Ti(t),patterns:{},sortKey:u};i.push(d)}r&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const a of i){const{geometry:r,index:i,sourceLayerIndex:o}=a;if(this.hasPattern){const e=rs("line",this.layers,a,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(a,r,i,n,{});t.featureIndex.insert(e[i].feature,r,i,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Ts)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ls),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,a,r){const i=this.layers[0].layout,o=i.get("line-join").evaluate(e,{}),s=i.get("line-cap"),l=i.get("line-miter-limit"),c=i.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const n of t)this.addLine(n,e,o,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,r,a)}addLine(e,t,n,a,r,i){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const o="Polygon"===Cs[t.type];let s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;let l=0;for(;l<s-1&&e[l].equals(e[l+1]);)l++;if(s<(o?3:2))return;"bevel"===n&&(r=1.05);const c=this.overscaling<=16?122880/(512*this.overscaling):0,u=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray);let d,p,m,b,h;this.e1=this.e2=-1,o&&(d=e[s-2],h=e[l].sub(d)._unit()._perp());for(let t=l;t<s;t++){if(m=t===s-1?o?e[l+1]:void 0:e[t+1],m&&e[t].equals(m))continue;h&&(b=h),d&&(p=d),d=e[t],h=m?m.sub(d)._unit()._perp():b,b=b||h;let f=b.add(h);0===f.x&&0===f.y||f._unit();const g=b.x*h.x+b.y*h.y,_=f.x*h.x+f.y*h.y,y=0!==_?1/_:1/0,M=2*Math.sqrt(2-2*_),v=_<Rs&&p&&m,z=b.x*h.y-b.y*h.x>0;if(v&&t>l){const e=d.dist(p);if(e>2*c){const t=d.sub(d.sub(p)._mult(c/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,b,0,0,u),p=t}}const O=p&&m;let k=O?n:o?"butt":a;if(O&&"round"===k&&(y<i?k="miter":y<=2&&(k="fakeround")),"miter"===k&&y>r&&(k="bevel"),"bevel"===k&&(y>2&&(k="flipbevel"),y<r&&(k="miter")),p&&this.updateDistance(p,d),"miter"===k)f._mult(y),this.addCurrentVertex(d,f,0,0,u);else if("flipbevel"===k){if(y>100)f=h.mult(-1);else{const e=y*b.add(h).mag()/b.sub(h).mag();f._perp()._mult(e*(z?-1:1))}this.addCurrentVertex(d,f,0,0,u),this.addCurrentVertex(d,f.mult(-1),0,0,u)}else if("bevel"===k||"fakeround"===k){const e=-Math.sqrt(y*y-1),t=z?e:0,n=z?0:e;if(p&&this.addCurrentVertex(d,b,t,n,u),"fakeround"===k){const e=Math.round(180*M/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(.5!==n){const e=n-.5;n+=n*e*(n-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*e*e+(.848013+g*(.215638*g-1.06021)))}const a=h.sub(b)._mult(n)._add(b)._unit()._mult(z?-1:1);this.addHalfVertex(d,a.x,a.y,!1,z,0,u)}}m&&this.addCurrentVertex(d,h,-t,-n,u)}else if("butt"===k)this.addCurrentVertex(d,f,0,0,u);else if("square"===k){const e=p?1:-1;this.addCurrentVertex(d,f,e,e,u)}else"round"===k&&(p&&(this.addCurrentVertex(d,b,0,0,u),this.addCurrentVertex(d,b,1,1,u,!0)),m&&(this.addCurrentVertex(d,h,-1,-1,u,!0),this.addCurrentVertex(d,h,0,0,u)));if(v&&t<s-1){const e=d.dist(m);if(e>2*c){const t=d.add(m.sub(d)._mult(c/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,h,0,0,u),d=t}}}}addCurrentVertex(e,t,n,a,r,i=!1){const o=t.y*a-t.x,s=-t.y-t.x*a;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,i,!1,n,r),this.addHalfVertex(e,o,s,i,!0,-a,r),this.distance>Ds/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(e,t,n,a,r,i))}addHalfVertex({x:e,y:t},n,a,r,i,o,s){const l=.5*(this.lineClips?this.scaledDistance*(Ds-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(r?1:0),(t<<1)+(i?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),s.primitiveLength++),i?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}_a("LineBucket",Ps,{omit:["layers","patternFeatures"]});const Bs=new rr({"line-cap":new Qa(ne.layout_line["line-cap"]),"line-join":new er(ne.layout_line["line-join"]),"line-miter-limit":new Qa(ne.layout_line["line-miter-limit"]),"line-round-limit":new Qa(ne.layout_line["line-round-limit"]),"line-sort-key":new er(ne.layout_line["line-sort-key"])});var Is={paint:new rr({"line-opacity":new er(ne.paint_line["line-opacity"]),"line-color":new er(ne.paint_line["line-color"]),"line-translate":new Qa(ne.paint_line["line-translate"]),"line-translate-anchor":new Qa(ne.paint_line["line-translate-anchor"]),"line-width":new er(ne.paint_line["line-width"]),"line-gap-width":new er(ne.paint_line["line-gap-width"]),"line-offset":new er(ne.paint_line["line-offset"]),"line-blur":new er(ne.paint_line["line-blur"]),"line-dasharray":new nr(ne.paint_line["line-dasharray"]),"line-pattern":new tr(ne.paint_line["line-pattern"]),"line-gradient":new ar(ne.paint_line["line-gradient"])}),layout:Bs};const $s=new class extends er{possiblyEvaluate(e,t){return t=new Xa(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,a){return t=s({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,a)}}(Is.paint.properties["line-width"].specification);function Fs(e,t){return t>0?t+2*e:e}$s.useIntegerZoom=!0;const Xs=ur([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ys=ur([{name:"a_projected_pos",components:3,type:"Float32"}],4);ur([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hs=ur([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ur([{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 Us=ur([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Vs=ur([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Gs(e,t,n){return e.sections.forEach(e=>{e.text=function(e,t,n){const a=t.layout.get("text-transform").evaluate(n,{});return"uppercase"===a?e=e.toLocaleUpperCase():"lowercase"===a&&(e=e.toLocaleLowerCase()),Fa.applyArabicShaping&&(e=Fa.applyArabicShaping(e)),e}(e.text,t,n)}),e}ur([{name:"triangle",components:3,type:"Uint16"}]),ur([{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"}]),ur([{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"}]),ur([{type:"Float32",name:"offsetX"}]),ur([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ks={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Js=el,Zs=function(e,t,n,a,r){var i,o,s=8*r-a-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?r-1:0,p=n?-1:1,m=e[t+d];for(d+=p,i=m&(1<<-u)-1,m>>=-u,u+=s;u>0;i=256*i+e[t+d],d+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=p,u-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,a),i-=c}return(m?-1:1)*o*Math.pow(2,i-a)},Qs=function(e,t,n,a,r,i){var o,s,l,c=8*i-r-1,u=(1<<c)-1,d=u>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,m=a?0:i-1,b=a?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,r),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+m]=255&s,m+=b,s/=256,r-=8);for(o=o<<r|s,c+=r;c>0;e[n+m]=255&o,m+=b,o/=256,c-=8);e[n+m-b]|=128*h};function el(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}el.Varint=0,el.Fixed64=1,el.Bytes=2,el.Fixed32=5;var tl,nl=4294967296,al=1/nl,rl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function il(e){return e.type===el.Bytes?e.readVarint()+e.pos:e.pos+1}function ol(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function sl(e,t,n){var a=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(a);for(var r=n.pos-1;r>=e;r--)n.buf[r+a]=n.buf[r]}function ll(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function cl(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function ul(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function dl(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function pl(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function ml(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function bl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function hl(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function fl(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function gl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function _l(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function yl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Ml(e,t,n){1===e&&n.readMessage(vl,t)}function vl(e,t,n){if(3===e){const{id:e,bitmap:a,width:r,height:i,left:o,top:s,advance:l}=n.readMessage(zl,{});t.push({id:e,bitmap:new yo({width:r+6,height:i+6},a),metrics:{width:r,height:i,left:o,top:s,advance:l}})}}function zl(e,t,n){1===e?t.id=n.readVarint():2===e?t.bitmap=n.readBytes():3===e?t.width=n.readVarint():4===e?t.height=n.readVarint():5===e?t.left=n.readSVarint():6===e?t.top=n.readSVarint():7===e&&(t.advance=n.readVarint())}function Ol(e){let t=0,n=0;for(const a of e)t+=a.w*a.h,n=Math.max(n,a.w);e.sort((e,t)=>t.h-e.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let r=0,i=0;for(const t of e)for(let e=a.length-1;e>=0;e--){const n=a[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,i=Math.max(i,t.y+t.h),r=Math.max(r,t.x+t.w),t.w===n.w&&t.h===n.h){const t=a.pop();e<a.length&&(a[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(a.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:r,h:i,fill:t/(r*i)||0}}el.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var a=this.readVarint(),r=a>>3,i=this.pos;this.type=7&a,e(r,t,this),this.pos===i&&this.skip(a)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=gl(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=yl(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=gl(this.buf,this.pos)+gl(this.buf,this.pos+4)*nl;return this.pos+=8,e},readSFixed64:function(){var e=gl(this.buf,this.pos)+yl(this.buf,this.pos+4)*nl;return this.pos+=8,e},readFloat:function(){var e=Zs(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Zs(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,n,a=this.buf;return t=127&(n=a[this.pos++]),n<128?t:(t|=(127&(n=a[this.pos++]))<<7,n<128?t:(t|=(127&(n=a[this.pos++]))<<14,n<128?t:(t|=(127&(n=a[this.pos++]))<<21,n<128?t:function(e,t,n){var a,r,i=n.buf;if(a=(112&(r=i[n.pos++]))>>4,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<3,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<10,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<17,r<128)return ol(e,a,t);if(a|=(127&(r=i[n.pos++]))<<24,r<128)return ol(e,a,t);if(a|=(1&(r=i[n.pos++]))<<31,r<128)return ol(e,a,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=a[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&rl?function(e,t,n){return rl.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var a="",r=t;r<n;){var i,o,s,l=e[r],c=null,u=l>239?4:l>223?3:l>191?2:1;if(r+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(i=e[r+1]))&&(c=(31&l)<<6|63&i)<=127&&(c=null):3===u?(o=e[r+2],128==(192&(i=e[r+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&i)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=e[r+2],s=e[r+3],128==(192&(i=e[r+1]))&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&i)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,a+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),a+=String.fromCharCode(c),r+=u}return a}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==el.Bytes)return e.push(this.readVarint(t));var n=il(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==el.Bytes)return e.push(this.readSVarint());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==el.Bytes)return e.push(this.readBoolean());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==el.Bytes)return e.push(this.readFloat());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==el.Bytes)return e.push(this.readDouble());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==el.Bytes)return e.push(this.readFixed32());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==el.Bytes)return e.push(this.readSFixed32());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==el.Bytes)return e.push(this.readFixed64());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==el.Bytes)return e.push(this.readSFixed64());var t=il(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===el.Varint)for(;this.buf[this.pos++]>127;);else if(t===el.Bytes)this.pos=this.readVarint()+this.pos;else if(t===el.Fixed32)this.pos+=4;else{if(t!==el.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),_l(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),_l(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),_l(this.buf,-1&e,this.pos),_l(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),_l(this.buf,-1&e,this.pos),_l(this.buf,Math.floor(e*al),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,a;if(e>=0?(n=e%4294967296|0,a=e/4294967296|0):(a=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,a=a+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(a,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var a,r,i=0;i<t.length;i++){if((a=t.charCodeAt(i))>55295&&a<57344){if(!r){a>56319||i+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):r=a;continue}if(a<56320){e[n++]=239,e[n++]=191,e[n++]=189,r=a;continue}a=r-55296<<10|a-56320|65536,r=null}else r&&(e[n++]=239,e[n++]=191,e[n++]=189,r=null);a<128?e[n++]=a:(a<2048?e[n++]=a>>6|192:(a<65536?e[n++]=a>>12|224:(e[n++]=a>>18|240,e[n++]=a>>12&63|128),e[n++]=a>>6&63|128),e[n++]=63&a|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&sl(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Qs(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Qs(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var a=this.pos-n;a>=128&&sl(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeMessage:function(e,t,n){this.writeTag(e,el.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ll,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,cl,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,pl,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,ul,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,dl,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ml,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,bl,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hl,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,fl,t)},writeBytesField:function(e,t){this.writeTag(e,el.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,el.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,el.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,el.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,el.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,el.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,el.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,el.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,el.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,el.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};class kl{constructor(e,{pixelRatio:t,version:n,stretchX:a,stretchY:r,content:i}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=a,this.stretchY=r,this.content=i,this.version=n}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 Al{constructor(e,t){const n={},a={};this.haveRenderCallbacks=[];const r=[];this.addImages(e,n,r),this.addImages(t,a,r);const{w:i,h:o}=Ol(r),s=new Mo({width:i||1,height:o||1});for(const t in e){const a=e[t],r=n[t].paddedRect;Mo.copy(a.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},a.data)}for(const e in t){const n=t[e],r=a[e].paddedRect,i=r.x+1,o=r.y+1,l=n.data.width,c=n.data.height;Mo.copy(n.data,s,{x:0,y:0},{x:i,y:o},n.data),Mo.copy(n.data,s,{x:0,y:c-1},{x:i,y:o-1},{width:l,height:1}),Mo.copy(n.data,s,{x:0,y:0},{x:i,y:o+c},{width:l,height:1}),Mo.copy(n.data,s,{x:l-1,y:0},{x:i-1,y:o},{width:1,height:c}),Mo.copy(n.data,s,{x:0,y:0},{x:i+l,y:o},{width:1,height:c})}this.image=s,this.iconPositions=n,this.patternPositions=a}addImages(e,t,n){for(const a in e){const r=e[a],i={x:0,y:0,w:r.data.width+2,h:r.data.height+2};n.push(i),t[a]=new kl(i,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[a,r]=e.tl;n.update(t.data,void 0,{x:a,y:r})}}_a("ImagePosition",kl),_a("ImageAtlas",Al),e.WritingMode=void 0,(tl=e.WritingMode||(e.WritingMode={}))[tl.none=0]="none",tl[tl.horizontal=1]="horizontal",tl[tl.vertical=2]="vertical",tl[tl.horizontalOnly=3]="horizontalOnly";class xl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const n=new xl;return n.scale=e||1,n.fontStack=t,n}static forImage(e){const t=new xl;return t.imageName=e,t}}class wl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const n=new wl;for(let a=0;a<e.sections.length;a++){const r=e.sections[a];r.image?n.addImageSection(r):n.addTextSection(r,t)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let t="";for(let n=0;n<e.length;n++){const a=e.charCodeAt(n+1)||null,r=e.charCodeAt(n-1)||null;t+=a&&Na(a)&&!Ks[e[n+1]]||r&&Na(r)&&!Ks[e[n-1]]||!Ks[e[n]]?e[n]:Ks[e[n]]}return t}(this.text)}trim(){let e=0;for(let t=0;t<this.text.length&&ql[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ql[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const n=new wl;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(xl.forText(e.scale,e.fontStack||t));const n=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(n)}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void b("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(xl.forImage(t)),this.sectionIndex.push(this.sections.length-1)):b("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Nl(t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f){const g=wl.fromFeature(t,i);let _;p===e.WritingMode.vertical&&g.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:M}=Fa;if(y&&1===g.sections.length){_=[];const e=y(g.toString(),Tl(g,u,o,n,r,b,h));for(const t of e){const e=new wl;e.text=t,e.sections=g.sections;for(let n=0;n<t.length;n++)e.sectionIndex.push(0);_.push(e)}}else if(M){_=[];const e=M(g.text,g.sectionIndex,Tl(g,u,o,n,r,b,h));for(const t of e){const e=new wl;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,_.push(e)}}else _=function(e,t){const n=[],a=e.text;let r=0;for(const a of t)n.push(e.substring(r,a)),r=a;return r<a.length&&n.push(e.substring(r,a.length)),n}(g,Tl(g,u,o,n,r,b,h));const v=[],z={positionedLines:v,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,n,a,r,i,o,s,l,c,u,d,p){let m=0,b=-17,h=0,f=0;const g="right"===l?1:"left"===l?0:.5;let _=0;for(const s of i){s.trim();const i=s.getMaxScale(),l=24*(i-1),M={positionedGlyphs:[],lineOffset:0};t.positionedLines[_]=M;const v=M.positionedGlyphs;let z=0;if(!s.length()){b+=o,++_;continue}for(let o=0;o<s.length();o++){const h=s.getSection(o),f=s.getSectionIndex(o),g=s.getCharCode(o);let _=0,M=null,O=null,k=null,A=24;const x=!(c===e.WritingMode.horizontal||!d&&!wa(g)||d&&(ql[g]||(y=g,Oa.Arabic(y)||Oa["Arabic Supplement"](y)||Oa["Arabic Extended-A"](y)||Oa["Arabic Presentation Forms-A"](y)||Oa["Arabic Presentation Forms-B"](y))));if(h.imageName){const e=r[h.imageName];if(!e)continue;k=h.imageName,t.iconsInText=t.iconsInText||!0,O=e.paddedRect;const n=e.displaySize;h.scale=24*h.scale/p,M={width:n[0],height:n[1],left:1,top:-3,advance:x?n[1]:n[0]},_=l+(24-n[1]*h.scale),A=M.advance;const a=x?n[0]*h.scale-24*i:n[1]*h.scale-24*i;a>0&&a>z&&(z=a)}else{const e=a[h.fontStack],t=e&&e[g];if(t&&t.rect)O=t.rect,M=t.metrics;else{const e=n[h.fontStack],t=e&&e[g];if(!t)continue;M=t.metrics}_=24*(i-h.scale)}x?(t.verticalizable=!0,v.push({glyph:g,imageName:k,x:m,y:b+_,vertical:x,scale:h.scale,fontStack:h.fontStack,sectionIndex:f,metrics:M,rect:O}),m+=A*h.scale+u):(v.push({glyph:g,imageName:k,x:m,y:b+_,vertical:x,scale:h.scale,fontStack:h.fontStack,sectionIndex:f,metrics:M,rect:O}),m+=M.advance*h.scale+u)}0!==v.length&&(h=Math.max(m-u,h),Rl(v,0,v.length-1,g,z)),m=0;const O=o*i+z;M.lineOffset=Math.max(z,l),b+=O,f=Math.max(O,f),++_}var y;const M=b- -17,{horizontalAlign:v,verticalAlign:z}=Cl(s);(function(e,t,n,a,r,i,o,s,l){const c=(t-n)*r;let u=0;u=i!==o?-s*a- -17:(-a*l+.5)*o;for(const t of e)for(const e of t.positionedGlyphs)e.x+=c,e.y+=u})(t.positionedLines,g,v,z,h,f,o,M,i.length),t.top+=-z*M,t.bottom=t.top+M,t.left+=-v*h,t.right=t.left+h}(z,n,a,r,_,s,l,c,p,u,m,f),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(v)&&z}const ql={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},El={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 jl(e,t,n,a,r,i){if(t.imageName){const e=a[t.imageName];return e?e.displaySize[0]*t.scale*24/i+r:0}{const a=n[t.fontStack],i=a&&a[e];return i?i.metrics.advance*t.scale+r:0}}function Wl(e,t,n,a){const r=Math.pow(e-t,2);return a?e<t?r/2:2*r:r+Math.abs(n)*n}function Ll(e,t,n){let a=0;return 10===e&&(a-=1e4),n&&(a+=150),40!==e&&65288!==e||(a+=50),41!==t&&65289!==t||(a+=50),a}function Sl(e,t,n,a,r,i){let o=null,s=Wl(t,n,r,i);for(const e of a){const a=Wl(t-e.x,n,r,i)+e.badness;a<=s&&(o=e,s=a)}return{index:e,x:t,priorBreak:o,badness:s}}function Tl(e,t,n,a,r,i,o){if("point"!==i)return[];if(!e)return[];const s=[],l=function(e,t,n,a,r,i){let o=0;for(let n=0;n<e.length();n++){const s=e.getSection(n);o+=jl(e.getCharCode(n),s,a,r,t,i)}return o/Math.max(1,Math.ceil(o/n))}(e,t,n,a,r,o),c=e.text.indexOf("​")>=0;let u=0;for(let n=0;n<e.length();n++){const i=e.getSection(n),p=e.getCharCode(n);if(ql[p]||(u+=jl(p,i,a,r,t,o)),n<e.length()-1){const t=!((d=p)<11904||!(Oa["Bopomofo Extended"](d)||Oa.Bopomofo(d)||Oa["CJK Compatibility Forms"](d)||Oa["CJK Compatibility Ideographs"](d)||Oa["CJK Compatibility"](d)||Oa["CJK Radicals Supplement"](d)||Oa["CJK Strokes"](d)||Oa["CJK Symbols and Punctuation"](d)||Oa["CJK Unified Ideographs Extension A"](d)||Oa["CJK Unified Ideographs"](d)||Oa["Enclosed CJK Letters and Months"](d)||Oa["Halfwidth and Fullwidth Forms"](d)||Oa.Hiragana(d)||Oa["Ideographic Description Characters"](d)||Oa["Kangxi Radicals"](d)||Oa["Katakana Phonetic Extensions"](d)||Oa.Katakana(d)||Oa["Vertical Forms"](d)||Oa["Yi Radicals"](d)||Oa["Yi Syllables"](d)));(El[p]||t||i.imageName)&&s.push(Sl(n+1,u,l,s,Ll(p,e.getCharCode(n+1),t&&c),!1))}}var d;return function e(t){return t?e(t.priorBreak).concat(t.index):[]}(Sl(e.length(),u,l,s,0,!0))}function Cl(e){let t=.5,n=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:t,verticalAlign:n}}function Rl(e,t,n,a,r){if(!a&&!r)return;const i=e[n],o=(e[n].x+i.metrics.advance*i.scale)*a;for(let a=t;a<=n;a++)e[a].x-=o,e[a].y+=r}function Dl(e,t,n){const{horizontalAlign:a,verticalAlign:r}=Cl(n),i=t[0]-e.displaySize[0]*a,o=t[1]-e.displaySize[1]*r;return{image:e,top:o,bottom:o+e.displaySize[1],left:i,right:i+e.displaySize[0]}}function Pl(e,t,n,a,r,i){const o=e.image;let s;if(o.content){const e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}const l=t.left*i,c=t.right*i;let u,d,p,m;"width"===n||"both"===n?(m=r[0]+l-a[3],d=r[0]+c+a[1]):(m=r[0]+(l+c-o.displaySize[0])/2,d=m+o.displaySize[0]);const b=t.top*i,h=t.bottom*i;return"height"===n||"both"===n?(u=r[1]+b-a[0],p=r[1]+h+a[2]):(u=r[1]+(b+h-o.displaySize[1])/2,p=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:p,left:m,collisionPadding:s}}const Bl=128;function Il(e,t){const{expression:n}=t;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new Xa(e+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:a}=n;let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let i=r;for(;i<t.length&&t[i]<e+1;)i++;i=Math.min(t.length-1,i);const o=t[r],s=t[i];return"composite"===n.kind?{kind:"composite",minZoom:o,maxZoom:s,interpolationType:a}:{kind:"camera",minZoom:o,maxZoom:s,minSize:n.evaluate(new Xa(o)),maxSize:n.evaluate(new Xa(s)),interpolationType:a}}}class $l extends A{constructor(e,t,n,a){super(e,t),this.angle=n,void 0!==a&&(this.segment=a)}clone(){return new $l(this.x,this.y,this.angle,this.segment)}}function Fl(e,t,n,a,r){if(void 0===t.segment)return!0;let i=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(i),i=e[o]}s+=e[o].dist(e[o+1]),o++;const l=[];let c=0;for(;s<n/2;){const t=e[o],n=e[o+1];if(!n)return!1;let i=e[o-1].angleTo(t)-t.angleTo(n);for(i=Math.abs((i+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:i}),c+=i;s-l[0].distance>a;)c-=l.shift().angleDelta;if(c>r)return!1;o++,s+=t.dist(n)}return!0}function Xl(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function Yl(e,t,n){return e?.6*t*n:0}function Hl(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Ul(e,t,n,a,r,i){const o=Yl(n,r,i),s=Hl(n,a)*i;let l=0;const c=Xl(e)/2;for(let n=0;n<e.length-1;n++){const a=e[n],r=e[n+1],i=a.dist(r);if(l+i>c){const u=(c-l)/i,d=Ot(a.x,r.x,u),p=Ot(a.y,r.y,u),m=new $l(d,p,r.angleTo(a),n);return m._round(),!o||Fl(e,m,s,o,t)?m:void 0}l+=i}}function Vl(e,t,n,a,r,i,o,s,l){const c=Yl(a,i,o),u=Hl(a,r),d=u*o,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-d<t/4&&(t=d+t/4),function e(t,n,a,r,i,o,s,l,c){const u=o/2,d=Xl(t);let p=0,m=n-a,b=[];for(let e=0;e<t.length-1;e++){const n=t[e],s=t[e+1],l=n.dist(s),h=s.angleTo(n);for(;m+a<p+l;){m+=a;const f=(m-p)/l,g=Ot(n.x,s.x,f),_=Ot(n.y,s.y,f);if(g>=0&&g<c&&_>=0&&_<c&&m-u>=0&&m+u<=d){const n=new $l(g,_,h,e);n._round(),r&&!Fl(t,n,o,r,i)||b.push(n)}}p+=l}return l||b.length||s||(b=e(t,p/2,a,r,i,o,s,!0,c)),b}(e,p?t/2*s%t:(u/2+2*i)*o*s%t,t,c,n,d,p,!1,l)}function Gl(e,t,n,a,r){const i=[];for(let o=0;o<e.length;o++){const s=e[o];let l;for(let e=0;e<s.length-1;e++){let o=s[e],c=s[e+1];o.x<t&&c.x<t||(o.x<t?o=new A(t,o.y+(t-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x<t&&(c=new A(t,o.y+(t-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y<n&&c.y<n||(o.y<n?o=new A(o.x+(n-o.y)/(c.y-o.y)*(c.x-o.x),n)._round():c.y<n&&(c=new A(o.x+(n-o.y)/(c.y-o.y)*(c.x-o.x),n)._round()),o.x>=a&&c.x>=a||(o.x>=a?o=new A(a,o.y+(a-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x>=a&&(c=new A(a,o.y+(a-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y>=r&&c.y>=r||(o.y>=r?o=new A(o.x+(r-o.y)/(c.y-o.y)*(c.x-o.x),r)._round():c.y>=r&&(c=new A(o.x+(r-o.y)/(c.y-o.y)*(c.x-o.x),r)._round()),l&&o.equals(l[l.length-1])||(l=[o],i.push(l)),l.push(c)))))}}return i}function Kl(e,t,n,a){const r=[],i=e.image,o=i.pixelRatio,s=i.paddedRect.w-2,l=i.paddedRect.h-2,c=e.right-e.left,u=e.bottom-e.top,d=i.stretchX||[[0,s]],p=i.stretchY||[[0,l]],m=(e,t)=>e+t[1]-t[0],b=d.reduce(m,0),h=p.reduce(m,0),f=s-b,g=l-h;let _=0,y=b,M=0,v=h,z=0,O=f,k=0,x=g;if(i.content&&a){const e=i.content;_=Jl(d,0,e[0]),M=Jl(p,0,e[1]),y=Jl(d,e[0],e[2]),v=Jl(p,e[1],e[3]),z=e[0]-_,k=e[1]-M,O=e[2]-e[0]-y,x=e[3]-e[1]-v}const w=(a,r,s,l)=>{const d=Ql(a.stretch-_,y,c,e.left),p=ec(a.fixed-z,O,a.stretch,b),m=Ql(r.stretch-M,v,u,e.top),f=ec(r.fixed-k,x,r.stretch,h),g=Ql(s.stretch-_,y,c,e.left),w=ec(s.fixed-z,O,s.stretch,b),N=Ql(l.stretch-M,v,u,e.top),q=ec(l.fixed-k,x,l.stretch,h),E=new A(d,m),j=new A(g,m),W=new A(g,N),L=new A(d,N),S=new A(p/o,f/o),T=new A(w/o,q/o),C=t*Math.PI/180;if(C){const e=Math.sin(C),t=Math.cos(C),n=[t,-e,e,t];E._matMult(n),j._matMult(n),L._matMult(n),W._matMult(n)}const R=a.stretch+a.fixed,D=r.stretch+r.fixed;return{tl:E,tr:j,bl:L,br:W,tex:{x:i.paddedRect.x+1+R,y:i.paddedRect.y+1+D,w:s.stretch+s.fixed-R,h:l.stretch+l.fixed-D},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:S,pixelOffsetBR:T,minFontScaleX:O/o/c,minFontScaleY:x/o/u,isSDF:n}};if(a&&(i.stretchX||i.stretchY)){const e=Zl(d,f,b),t=Zl(p,g,h);for(let n=0;n<e.length-1;n++){const a=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)r.push(w(a,t[e],i,t[e+1]))}}else r.push(w({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return r}function Jl(e,t,n){let a=0;for(const r of e)a+=Math.max(t,Math.min(n,r[1]))-Math.max(t,Math.min(n,r[0]));return a}function Zl(e,t,n){const a=[{fixed:-1,stretch:0}];for(const[t,n]of e){const e=a[a.length-1];a.push({fixed:t-e.stretch,stretch:e.stretch}),a.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return a.push({fixed:t+1,stretch:n}),a}function Ql(e,t,n,a){return e/t*n+a}function ec(e,t,n,a){return e-t*n/a}_a("Anchor",$l);class tc{constructor(e,t,n,a,r,i,o,s,l,c){if(this.boxStartIndex=e.length,l){let e=i.top,t=i.bottom;const n=i.collisionPadding;n&&(e-=n[1],t+=n[3]);let a=t-e;a>0&&(a=Math.max(10,a),this.circleDiameter=a)}else{let l=i.top*o-s[0],u=i.bottom*o+s[2],d=i.left*o-s[3],p=i.right*o+s[1];const m=i.collisionPadding;if(m&&(d-=m[0]*o,l-=m[1]*o,p+=m[2]*o,u+=m[3]*o),c){const e=new A(d,l),t=new A(p,l),n=new A(d,u),a=new A(p,u),r=c*Math.PI/180;e._rotate(r),t._rotate(r),n._rotate(r),a._rotate(r),d=Math.min(e.x,t.x,n.x,a.x),p=Math.max(e.x,t.x,n.x,a.x),l=Math.min(e.y,t.y,n.y,a.y),u=Math.max(e.y,t.y,n.y,a.y)}e.emplaceBack(t.x,t.y,d,l,p,u,n,a,r)}this.boxEndIndex=e.length}}class nc{constructor(e=[],t=ac){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,a=t[e];for(;e>0;){const r=e-1>>1,i=t[r];if(n(a,i)>=0)break;t[e]=i,e=r}t[e]=a}_down(e){const{data:t,compare:n}=this,a=this.length>>1,r=t[e];for(;e<a;){let a=1+(e<<1),i=t[a];const o=a+1;if(o<this.length&&n(t[o],i)<0&&(a=o,i=t[o]),n(i,r)>=0)break;t[e]=i,e=a}t[e]=r}}function ac(e,t){return e<t?-1:e>t?1:0}function rc(e,t=1,n=!1){let a=1/0,r=1/0,i=-1/0,o=-1/0;const s=e[0];for(let e=0;e<s.length;e++){const t=s[e];(!e||t.x<a)&&(a=t.x),(!e||t.y<r)&&(r=t.y),(!e||t.x>i)&&(i=t.x),(!e||t.y>o)&&(o=t.y)}const l=Math.min(i-a,o-r);let c=l/2;const u=new nc([],ic);if(0===l)return new A(a,r);for(let t=a;t<i;t+=l)for(let n=r;n<o;n+=l)u.push(new oc(t+c,n+c,c,e));let d=function(e){let t=0,n=0,a=0;const r=e[0];for(let e=0,i=r.length,o=i-1;e<i;o=e++){const i=r[e],s=r[o],l=i.x*s.y-s.x*i.y;n+=(i.x+s.x)*l,a+=(i.y+s.y)*l,t+=3*l}return new oc(n/t,a/t,0,e)}(e),p=u.length;for(;u.length;){const a=u.pop();(a.d>d.d||!d.d)&&(d=a,n&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d<=t||(c=a.h/2,u.push(new oc(a.p.x-c,a.p.y-c,c,e)),u.push(new oc(a.p.x+c,a.p.y-c,c,e)),u.push(new oc(a.p.x-c,a.p.y+c,c,e)),u.push(new oc(a.p.x+c,a.p.y+c,c,e)),p+=4)}return n&&(console.log("num probes: "+p),console.log("best distance: "+d.d)),d.p}function ic(e,t){return t.max-e.max}function oc(e,t,n,a){this.p=new A(e,t),this.h=n,this.d=function(e,t){let n=!1,a=1/0;for(let r=0;r<t.length;r++){const i=t[r];for(let t=0,r=i.length,o=r-1;t<r;o=t++){const r=i[t],s=i[o];r.y>e.y!=s.y>e.y&&e.x<(s.x-r.x)*(e.y-r.y)/(s.y-r.y)+r.x&&(n=!n),a=Math.min(a,Hi(e,r,s))}}return(n?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}const sc=Number.POSITIVE_INFINITY;function lc(e,t){return t[1]!==sc?function(e,t,n){let a=0,r=0;switch(t=Math.abs(t),n=Math.abs(n),e){case"top-right":case"top-left":case"top":r=n-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-n}switch(e){case"top-right":case"bottom-right":case"right":a=-t;break;case"top-left":case"bottom-left":case"left":a=t}return[a,r]}(e,t[0],t[1]):function(e,t){let n=0,a=0;t<0&&(t=0);const r=t/Math.sqrt(2);switch(e){case"top-right":case"top-left":a=r-7;break;case"bottom-right":case"bottom-left":a=7-r;break;case"bottom":a=7-t;break;case"top":a=t-7}switch(e){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=t;break;case"right":n=-t}return[n,a]}(e,t[0])}function cc(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uc(t,n,a,r,i,o,s,l,c,u,d){let p=o.textMaxSize.evaluate(n,{});void 0===p&&(p=s);const m=t.layers[0].layout,h=m.get("icon-offset").evaluate(n,{},d),f=mc(a.horizontal),g=s/24,_=t.tilePixelRatio*g,y=t.tilePixelRatio*p/24,M=t.tilePixelRatio*l,v=t.tilePixelRatio*m.get("symbol-spacing"),z=m.get("text-padding")*t.tilePixelRatio,O=function(e,t,n,a=1){const r=e.get("icon-padding").evaluate(t,{},n),i=r&&r.values;return[i[0]*a,i[1]*a,i[2]*a,i[3]*a]}(m,n,d,t.tilePixelRatio),k=m.get("text-max-angle")/180*Math.PI,A="viewport"!==m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),x="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),w=m.get("symbol-placement"),N=v/2,q=m.get("icon-text-fit");let E;r&&"none"!==q&&(t.allowVerticalPlacement&&a.vertical&&(E=Pl(r,a.vertical,q,m.get("icon-text-fit-padding"),h,g)),f&&(r=Pl(r,f,q,m.get("icon-text-fit-padding"),h,g)));const j=(l,p)=>{p.x<0||p.x>=Wi||p.y<0||p.y>=Wi||function(t,n,a,r,i,o,s,l,c,u,d,p,m,h,f,g,_,y,M,v,z,O,k,A,x){const w=t.addToLineVertexArray(n,a);let N,q,E,j,W=0,L=0,S=0,T=0,C=-1,R=-1;const D={};let P=ci.exports(""),B=0,I=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[B,I]=l.layout.get("text-offset").evaluate(z,{},A).map(e=>24*e):(B=24*l.layout.get("text-radial-offset").evaluate(z,{},A),I=sc),t.allowVerticalPlacement&&r.vertical){const e=l.layout.get("text-rotate").evaluate(z,{},A)+90;E=new tc(c,n,u,d,p,r.vertical,m,h,f,e),s&&(j=new tc(c,n,u,d,p,s,_,y,f,e))}if(i){const a=l.layout.get("icon-rotate").evaluate(z,{}),r="none"!==l.layout.get("icon-text-fit"),o=Kl(i,a,k,r),m=s?Kl(s,a,k,r):void 0;q=new tc(c,n,u,d,p,i,_,y,!1,a),W=4*o.length;const h=t.iconSizeData;let f=null;"source"===h.kind?(f=[Bl*l.layout.get("icon-size").evaluate(z,{})],f[0]>dc&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===h.kind&&(f=[Bl*O.compositeIconSizes[0].evaluate(z,{},A),Bl*O.compositeIconSizes[1].evaluate(z,{},A)],(f[0]>dc||f[1]>dc)&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')),t.addSymbols(t.icon,o,f,v,M,z,e.WritingMode.none,n,w.lineStartIndex,w.lineLength,-1,A),C=t.icon.placedSymbolArray.length-1,m&&(L=4*m.length,t.addSymbols(t.icon,m,f,v,M,z,e.WritingMode.vertical,n,w.lineStartIndex,w.lineLength,-1,A),R=t.icon.placedSymbolArray.length-1)}const $=Object.keys(r.horizontal);for(const a of $){const i=r.horizontal[a];if(!N){P=ci.exports(i.text);const e=l.layout.get("text-rotate").evaluate(z,{},A);N=new tc(c,n,u,d,p,i,m,h,f,e)}const s=1===i.positionedLines.length;if(S+=pc(t,n,i,o,l,f,z,g,w,r.vertical?e.WritingMode.horizontal:e.WritingMode.horizontalOnly,s?$:[a],D,C,O,A),s)break}r.vertical&&(T+=pc(t,n,r.vertical,o,l,f,z,g,w,e.WritingMode.vertical,["vertical"],D,R,O,A));const F=N?N.boxStartIndex:t.collisionBoxArray.length,X=N?N.boxEndIndex:t.collisionBoxArray.length,Y=E?E.boxStartIndex:t.collisionBoxArray.length,H=E?E.boxEndIndex:t.collisionBoxArray.length,U=q?q.boxStartIndex:t.collisionBoxArray.length,V=q?q.boxEndIndex:t.collisionBoxArray.length,G=j?j.boxStartIndex:t.collisionBoxArray.length,K=j?j.boxEndIndex:t.collisionBoxArray.length;let J=-1;const Z=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;J=Z(N,J),J=Z(E,J),J=Z(q,J),J=Z(j,J);const Q=J>-1?1:0;Q&&(J*=x/24),t.glyphOffsetArray.length>=zc.MAX_GLYPHS&&b("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==z.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,z.sortKey),t.symbolInstances.emplaceBack(n.x,n.y,D.right>=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,C,R,P,F,X,Y,H,U,V,G,K,u,S,T,W,L,Q,0,m,B,I,J)}(t,p,l,a,r,i,E,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,_,[z,z,z,z],A,c,M,O,x,h,n,o,u,d,s)};if("line"===w)for(const e of Gl(n.geometry,0,0,Wi,Wi)){const n=Vl(e,v,k,a.vertical||f,r,24,y,t.overscaling,Wi);for(const a of n){const n=f;n&&bc(t,n.text,N,a)||j(e,a)}}else if("line-center"===w){for(const e of n.geometry)if(e.length>1){const t=Ul(e,k,a.vertical||f,r,24,y);t&&j(e,t)}}else if("Polygon"===n.type)for(const e of ts(n.geometry,0)){const t=rc(e,16);j(e[0],new $l(t.x,t.y,0))}else if("LineString"===n.type)for(const e of n.geometry)j(e,new $l(e[0].x,e[0].y,0));else if("Point"===n.type)for(const e of n.geometry)for(const t of e)j([t],new $l(t.x,t.y,0))}const dc=32640;function pc(e,t,n,a,r,i,o,s,l,c,u,d,p,m,h){const f=function(e,t,n,a,r,i,o,s){const l=a.layout.get("text-rotate").evaluate(i,{})*Math.PI/180,c=[];for(const e of t.positionedLines)for(const a of e.positionedGlyphs){if(!a.rect)continue;const i=a.rect||{};let u=4,d=!0,p=1,m=0;const b=(r||s)&&a.vertical,h=a.metrics.advance*a.scale/2;if(s&&t.verticalizable){const t=24*(a.scale-1),n=(24-a.metrics.width*a.scale)/2;m=e.lineOffset/2-(a.imageName?-n:t)}if(a.imageName){const e=o[a.imageName];d=e.sdf,p=e.pixelRatio,u=1/p}const f=r?[a.x+h,a.y]:[0,0];let g=r?[0,0]:[a.x+h+n[0],a.y+n[1]-m],_=[0,0];b&&(_=g,g=[0,0]);const y=(a.metrics.left-u)*a.scale-h+g[0],M=(-a.metrics.top-u)*a.scale+g[1],v=y+i.w*a.scale/p,z=M+i.h*a.scale/p,O=new A(y,M),k=new A(v,M),x=new A(y,z),w=new A(v,z);if(b){const e=new A(-h,h- -17),t=-Math.PI/2,n=12-h,r=new A(22-n,-(a.imageName?n:0)),i=new A(..._);O._rotateAround(t,e)._add(r)._add(i),k._rotateAround(t,e)._add(r)._add(i),x._rotateAround(t,e)._add(r)._add(i),w._rotateAround(t,e)._add(r)._add(i)}if(l){const e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];O._matMult(n),k._matMult(n),x._matMult(n),w._matMult(n)}const N=new A(0,0),q=new A(0,0);c.push({tl:O,tr:k,bl:x,br:w,tex:i,writingMode:t.writingMode,glyphOffset:f,sectionIndex:a.sectionIndex,isSDF:d,pixelOffsetTL:N,pixelOffsetBR:q,minFontScaleX:0,minFontScaleY:0})}return c}(0,n,s,r,i,o,a,e.allowVerticalPlacement),g=e.textSizeData;let _=null;"source"===g.kind?(_=[Bl*r.layout.get("text-size").evaluate(o,{})],_[0]>dc&&b(e.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===g.kind&&(_=[Bl*m.compositeTextSizes[0].evaluate(o,{},h),Bl*m.compositeTextSizes[1].evaluate(o,{},h)],(_[0]>dc||_[1]>dc)&&b(e.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')),e.addSymbols(e.text,f,_,s,i,o,c,t,l.lineStartIndex,l.lineLength,p,h);for(const t of u)d[t]=e.text.placedSymbolArray.length-1;return 4*f.length}function mc(e){for(const t in e)return e[t];return null}function bc(e,t,n,a){const r=e.compareText;if(t in r){const e=r[t];for(let t=e.length-1;t>=0;t--)if(a.dist(e[t])<n)return!0}else r[t]=[];return r[t].push(a),!1}const hc=ds.VectorTileFeature.types,fc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function gc(e,t,n,a,r,i,o,s,l,c,u,d,p){const m=s?Math.min(dc,Math.round(s[0])):0,b=s?Math.min(dc,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*a),Math.round(32*r),i,o,(m<<1)+(l?1:0),b,16*c,16*u,256*d,256*p)}function _c(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function yc(e){for(const t of e.sections)if(ja(t.text))return!0;return!1}class Mc{constructor(e){this.layoutVertexArray=new Jr,this.indexArray=new ni,this.programConfigurations=e,this.segments=new oi,this.dynamicLayoutVertexArray=new Zr,this.opacityVertexArray=new Qr,this.placedSymbolArray=new Rr}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,n,a){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xs.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ys.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,fc,!0),this.opacityVertexBuffer.itemSize=1),(n||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}_a("SymbolBuffers",Mc);class vc{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new oi,this.collisionVertexArray=new ti}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Hs.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}_a("CollisionBuffers",vc);class zc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ro([]),this.placementViewportMatrix=ro([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);const a=this.layers[0].layout,r=a.get("symbol-sort-key"),i=a.get("symbol-z-order");this.canOverlap="never"!==wc(a,"text-overlap","text-allow-overlap")||"never"!==wc(a,"icon-overlap","icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===a.get("symbol-placement")&&(this.writingModes=a.get("text-writing-mode").map(t=>e.WritingMode[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new Mc(new qi(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Mc(new qi(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Br,this.lineVertexArray=new Ir,this.symbolInstances=new Pr}calculateGlyphDependencies(e,t,n,a,r){for(let i=0;i<e.length;i++)if(t[e.charCodeAt(i)]=!0,(n||a)&&r){const n=Ks[e.charAt(i)];n&&(t[n.charCodeAt(0)]=!0)}}populate(t,n,a){const r=this.layers[0],i=r.layout,o=i.get("text-font"),s=i.get("text-field"),l=i.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof Ce&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,d=i.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const p=n.iconDependencies,m=n.glyphDependencies,b=n.availableImages,h=new Xa(this.zoom);for(const{feature:n,id:s,index:l,sourceLayerIndex:f}of t){const t=r._featureFilter.needGeometry,g=Ci(n,t);if(!r._featureFilter.filter(h,g,a))continue;let _,y;if(t||(g.geometry=Ti(n)),c){const e=r.getValueAndResolveTokens("text-field",g,a,b),t=Ce.factory(e);yc(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Ia()||this.hasRTLText&&Fa.isParsed())&&(_=Gs(t,r,g))}if(u){const e=r.getValueAndResolveTokens("icon-image",g,a,b);y=e instanceof De?e:De.fromString(e)}if(!_&&!y)continue;const M=this.sortFeaturesByKey?d.evaluate(g,{},a):void 0;if(this.features.push({id:s,text:_,icon:y,index:l,sourceLayerIndex:f,geometry:g.geometry,properties:n.properties,type:hc[n.type],sortKey:M}),y&&(p[y.name]=!0),_){const t=o.evaluate(g,{},a).join(","),n="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.WritingMode.vertical)>=0;for(const e of _.sections)if(e.image)p[e.image.name]=!0;else{const a=ka(_.toString()),r=e.fontStack||t,i=m[r]=m[r]||{};this.calculateGlyphDependencies(e.text,i,n,this.allowVerticalPlacement,a)}}}"line"===i.get("symbol-placement")&&(this.features=function(e){const t={},n={},a=[];let r=0;function i(t){a.push(e[t]),r++}function o(e,t,r){const i=n[e];return delete n[e],n[t]=i,a[i].geometry[0].pop(),a[i].geometry[0]=a[i].geometry[0].concat(r[0]),i}function s(e,n,r){const i=t[n];return delete t[n],t[e]=i,a[i].geometry[0].shift(),a[i].geometry[0]=r[0].concat(a[i].geometry[0]),i}function l(e,t,n){const a=n?t[0][t[0].length-1]:t[0][0];return`${e}:${a.x}:${a.y}`}for(let c=0;c<e.length;c++){const u=e[c],d=u.geometry,p=u.text?u.text.toString():null;if(!p){i(c);continue}const m=l(p,d),b=l(p,d,!0);if(m in n&&b in t&&n[m]!==t[b]){const e=s(m,b,d),r=o(m,b,a[e].geometry);delete t[m],delete n[b],n[l(p,a[r].geometry,!0)]=r,a[e].geometry=null}else m in n?o(m,b,d):b in t?s(m,b,d):(i(c),t[m]=r-1,n[b]=r-1)}return a.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const n=this.lineVertexArray.length;if(void 0!==e.segment){let n=e.dist(t[e.segment+1]),a=e.dist(t[e.segment]);const r={};for(let a=e.segment+1;a<t.length;a++)r[a]={x:t[a].x,y:t[a].y,tileUnitDistanceFromAnchor:n},a<t.length-1&&(n+=t[a+1].dist(t[a]));for(let n=e.segment||0;n>=0;n--)r[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:a},n>0&&(a+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){const t=r[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,a,r,i,o,s,l,c,u,d,p){const m=t.indexArray,b=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,b,m,this.canOverlap?o.sortKey:void 0),f=this.glyphOffsetArray.length,g=h.vertexLength,_=this.allowVerticalPlacement&&s===e.WritingMode.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){const{tl:r,tr:i,bl:s,br:c,tex:u,pixelOffsetTL:d,pixelOffsetBR:f,minFontScaleX:g,minFontScaleY:M,glyphOffset:v,isSDF:z,sectionIndex:O}=n[e],k=h.vertexLength,A=v[1];gc(b,l.x,l.y,r.x,A+r.y,u.x,u.y,a,z,d.x,d.y,g,M),gc(b,l.x,l.y,i.x,A+i.y,u.x+u.w,u.y,a,z,f.x,d.y,g,M),gc(b,l.x,l.y,s.x,A+s.y,u.x,u.y+u.h,a,z,d.x,f.y,g,M),gc(b,l.x,l.y,c.x,A+c.y,u.x+u.w,u.y+u.h,a,z,f.x,f.y,g,M),_c(t.dynamicLayoutVertexArray,l,_),m.emplaceBack(k,k+1,k+2),m.emplaceBack(k+1,k+2,k+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(v[0]),e!==n.length-1&&O===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(b.length,o,o.index,{},p,y&&y[O])}t.placedSymbolArray.emplaceBack(l.x,l.y,f,this.glyphOffsetArray.length-f,g,c,u,l.segment,a?a[0]:0,a?a[1]:0,r[0],r[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,a,r,i){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,a,r,Math.round(i.x),Math.round(i.y))}addCollisionDebugVertices(e,t,n,a,r,i,o){const s=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=s.vertexLength,c=r.layoutVertexArray,u=r.collisionVertexArray,d=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(c,u,i,d,p,new A(e,t)),this._addCollisionDebugVertex(c,u,i,d,p,new A(n,t)),this._addCollisionDebugVertex(c,u,i,d,p,new A(n,a)),this._addCollisionDebugVertex(c,u,i,d,p,new A(e,a)),s.vertexLength+=4;const m=r.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,a){for(let r=e;r<t;r++){const e=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,a?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vc(ei,Us.members,ai),this.iconCollisionBox=new vc(ei,Us.members,ai);for(let e=0;e<this.symbolInstances.length;e++){const t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,a,r,i,o,s,l){const c={};for(let a=t;a<n;a++){const t=e.get(a);c.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.textFeatureIndex=t.featureIndex;break}for(let t=a;t<r;t++){const n=e.get(t);c.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},c.verticalTextFeatureIndex=n.featureIndex;break}for(let t=i;t<o;t++){const n=e.get(t);c.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},c.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<l;t++){const n=e.get(t);c.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},c.verticalIconFeatureIndex=n.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const n=e.placedSymbolArray.get(t),a=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<a;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),n=Math.cos(e),a=[],r=[],i=[];for(let e=0;e<this.symbolInstances.length;++e){i.push(e);const o=this.symbolInstances.get(e);a.push(0|Math.round(t*o.anchorX+n*o.anchorY)),r.push(o.featureIndex)}return i.sort((e,t)=>a[e]-a[t]||r[t]-r[e]),i}addToSortKeyRanges(e,t){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach((e,t,n)=>{e>=0&&n.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}_a("SymbolBucket",zc,{omit:["layers","collisionBoxArray","features","compareText"]}),zc.MAX_GLYPHS=65535,zc.addDynamicAttributes=_c;const Oc=new rr({"symbol-placement":new Qa(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Qa(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qa(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new er(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qa(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qa(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Qa(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Qa(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qa(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qa(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new er(ne.layout_symbol["icon-size"]),"icon-text-fit":new Qa(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qa(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new er(ne.layout_symbol["icon-image"]),"icon-rotate":new er(ne.layout_symbol["icon-rotate"]),"icon-padding":new er(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Qa(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new er(ne.layout_symbol["icon-offset"]),"icon-anchor":new er(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qa(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qa(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qa(ne.layout_symbol["text-rotation-alignment"]),"text-field":new er(ne.layout_symbol["text-field"]),"text-font":new er(ne.layout_symbol["text-font"]),"text-size":new er(ne.layout_symbol["text-size"]),"text-max-width":new er(ne.layout_symbol["text-max-width"]),"text-line-height":new Qa(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new er(ne.layout_symbol["text-letter-spacing"]),"text-justify":new er(ne.layout_symbol["text-justify"]),"text-radial-offset":new er(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qa(ne.layout_symbol["text-variable-anchor"]),"text-anchor":new er(ne.layout_symbol["text-anchor"]),"text-max-angle":new Qa(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Qa(ne.layout_symbol["text-writing-mode"]),"text-rotate":new er(ne.layout_symbol["text-rotate"]),"text-padding":new Qa(ne.layout_symbol["text-padding"]),"text-keep-upright":new Qa(ne.layout_symbol["text-keep-upright"]),"text-transform":new er(ne.layout_symbol["text-transform"]),"text-offset":new er(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Qa(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Qa(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Qa(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Qa(ne.layout_symbol["text-optional"])});var kc={paint:new rr({"icon-opacity":new er(ne.paint_symbol["icon-opacity"]),"icon-color":new er(ne.paint_symbol["icon-color"]),"icon-halo-color":new er(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new er(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new er(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Qa(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qa(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new er(ne.paint_symbol["text-opacity"]),"text-color":new er(ne.paint_symbol["text-color"],{runtimeType:be,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new er(ne.paint_symbol["text-halo-color"]),"text-halo-width":new er(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new er(ne.paint_symbol["text-halo-blur"]),"text-translate":new Qa(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Qa(ne.paint_symbol["text-translate-anchor"])}),layout:Oc};class Ac{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:ue,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}_a("FormatSectionOverride",Ac,{omit:["defaultValue"]});class xc extends or{constructor(e){super(e,kc)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const e=this.layout.get("text-writing-mode");if(e){const t=[];for(const n of e)t.indexOf(n)<0&&t.push(n);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,a){const r=this.layout.get(e).evaluate(t,{},n,a),i=this._unevaluatedLayout._values[e];return i.isDataDriven()||wn(i.value)||!r?r:function(e,t){return t.replace(/{([^{}]+)}/g,(t,n)=>n in e?String(e[n]):"")}(t.properties,r)}createBucket(e){return new zc(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of kc.paint.overridableProperties){if(!xc.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),n=new Ac(t),a=new xn(n,t.property.specification);let r=null;r="constant"===t.value.kind||"source"===t.value.kind?new qn("source",a):new En("composite",a,t.value.zoomStops),this.paint._values[e]=new Ja(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&xc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const n=e.get("text-field"),a=kc.paint.properties[t];let r=!1;const i=e=>{for(const t of e)if(a.overrides&&a.overrides.hasOverride(t))return void(r=!0)};if("constant"===n.value.kind&&n.value.value instanceof Ce)i(n.value.value.sections);else if("source"===n.value.kind){const e=t=>{r||(t instanceof Fe&&Ie(t.value)===_e?i(t.value.sections):t instanceof rn?i(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return r}}function wc(e,t,n){let a="never";const r=e.get(t);return r?a=r:e.get(n)&&(a="always"),a}var Nc={paint:new rr({"background-color":new Qa(ne.paint_background["background-color"]),"background-pattern":new nr(ne.paint_background["background-pattern"]),"background-opacity":new Qa(ne.paint_background["background-opacity"])})},qc={paint:new rr({"raster-opacity":new Qa(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qa(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qa(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qa(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Qa(ne.paint_raster["raster-saturation"]),"raster-contrast":new Qa(ne.paint_raster["raster-contrast"]),"raster-resampling":new Qa(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Qa(ne.paint_raster["raster-fade-duration"])})};class Ec extends or{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const jc={circle:class extends or{constructor(e){super(e,eo)}createBucket(e){return new Di(e)}queryRadius(e){const t=e;return Ki("circle-radius",this,t)+Ki("circle-stroke-width",this,t)+Ji(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,n,a,r,i,o,s){const l=Zi(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),i.angle,o),c=this.paint.get("circle-radius").evaluate(t,n)+this.paint.get("circle-stroke-width").evaluate(t,n),u="map"===this.paint.get("circle-pitch-alignment"),d=u?l:function(e,t){return e.map(e=>mo(e,t))}(l,s),p=u?c*o:c;for(const e of a)for(const t of e){const e=u?t:mo(t,s);let n=p;const a=uo([],[t.x,t.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?n*=a[3]/i.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(n*=i.cameraToCenterDistance/a[3]),Bi(d,e,n))return!0}return!1}},heatmap:class extends or{constructor(e){super(e,ho),this._updateColorRamp()}createBucket(e){return new bo(e)}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=vo({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 or{constructor(e){super(e,zo)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends or{constructor(e){super(e,ss)}recalculate(e,t){super.recalculate(e,t);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new is(e)}queryRadius(){return Ji(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,n,a,r,i,o){return Ii(Zi(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),i.angle,o),a)}isTileClipped(){return!0}},"fill-extrusion":class extends or{constructor(e){super(e,qs)}createBucket(e){return new xs(e)}queryRadius(){return Ji(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,n,a,r,i,o,s){const l=Zi(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),i.angle,o),c=this.paint.get("fill-extrusion-height").evaluate(t,n),u=this.paint.get("fill-extrusion-base").evaluate(t,n),d=function(e,t,n,a){const r=[];for(const n of e){const e=[n.x,n.y,0,1];uo(e,e,t),r.push(new A(e[0]/e[3],e[1]/e[3]))}return r}(l,s),p=function(e,t,n,a){const r=[],i=[],o=a[8]*t,s=a[9]*t,l=a[10]*t,c=a[11]*t,u=a[8]*n,d=a[9]*n,p=a[10]*n,m=a[11]*n;for(const t of e){const e=[],n=[];for(const r of t){const t=r.x,i=r.y,b=a[0]*t+a[4]*i+a[12],h=a[1]*t+a[5]*i+a[13],f=a[2]*t+a[6]*i+a[14],g=a[3]*t+a[7]*i+a[15],_=f+l,y=g+c,M=b+u,v=h+d,z=f+p,O=g+m,k=new A((b+o)/y,(h+s)/y);k.z=_/y,e.push(k);const x=new A(M/O,v/O);x.z=z/O,n.push(x)}r.push(e),i.push(n)}return[r,i]}(a,u,c,s);return function(e,t,n){let a=1/0;Ii(n,t)&&(a=js(n,t[0]));for(let r=0;r<t.length;r++){const i=t[r],o=e[r];for(let e=0;e<i.length-1;e++){const t=i[e],r=[t,i[e+1],o[e+1],o[e],t];Pi(n,r)&&(a=Math.min(a,js(n,r)))}}return a!==1/0&&a}(p[0],p[1],d)}},line:class extends or{constructor(e){super(e,Is),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){"line-gradient"===e&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof zt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=$s.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Ps(e)}queryRadius(e){const t=e,n=Fs(Ki("line-width",this,t),Ki("line-gap-width",this,t)),a=Ki("line-offset",this,t);return n/2+Math.abs(a)+Ji(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,n,a,r,i,o){const s=Zi(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),i.angle,o),l=o/2*Fs(this.paint.get("line-width").evaluate(t,n),this.paint.get("line-gap-width").evaluate(t,n)),c=this.paint.get("line-offset").evaluate(t,n);return c&&(a=function(e,t){const n=[];for(let a=0;a<e.length;a++){const r=e[a],i=[];for(let e=0;e<r.length;e++){const n=r[e-1],a=r[e],o=r[e+1],s=0===e?new A(0,0):a.sub(n)._unit()._perp(),l=e===r.length-1?new A(0,0):o.sub(a)._unit()._perp(),c=s._add(l)._unit(),u=c.x*l.x+c.y*l.y;0!==u&&c._mult(1/u),i.push(c._mult(t)._add(a))}n.push(i)}return n}(a,c*o)),function(e,t,n){for(let a=0;a<t.length;a++){const r=t[a];if(e.length>=3)for(let t=0;t<r.length;t++)if(Vi(e,r[t]))return!0;if($i(e,r,n))return!0}return!1}(s,a,l)}isTileClipped(){return!0}},symbol:xc,background:class extends or{constructor(e){super(e,Nc)}},raster:class extends or{constructor(e){super(e,qc)}}};class Wc{constructor(e){this._callback=e,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=()=>{}}}const Lc=6371008.8;class Sc{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Sc(o(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,n=this.lat*t,a=e.lat*t,r=Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((e.lng-this.lng)*t);return Lc*Math.acos(Math.min(r,1))}toBounds(e=0){const t=360*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return new Tc(new Sc(this.lng-n,this.lat-t),new Sc(this.lng+n,this.lat+t))}static convert(e){if(e instanceof Sc)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Sc(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Sc(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Tc{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Sc?new Sc(e.lng,e.lat):Sc.convert(e),this}setSouthWest(e){return this._sw=e instanceof Sc?new Sc(e.lng,e.lat):Sc.convert(e),this}extend(e){const t=this._sw,n=this._ne;let a,r;if(e instanceof Sc)a=e,r=e;else{if(!(e instanceof Tc))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Tc.convert(e)):this.extend(Sc.convert(e)):this;if(a=e._sw,r=e._ne,!a||!r)return this}return t||n?(t.lng=Math.min(a.lng,t.lng),t.lat=Math.min(a.lat,t.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new Sc(a.lng,a.lat),this._ne=new Sc(r.lng,r.lat)),this}getCenter(){return new Sc((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 Sc(this.getWest(),this.getNorth())}getSouthEast(){return new Sc(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:n}=Sc.convert(e);let a=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a}static convert(e){return e instanceof Tc?e:e?new Tc(e):e}}const Cc=2*Math.PI*Lc;function Rc(e){return Cc*Math.cos(e*Math.PI/180)}function Dc(e){return(180+e)/360}function Pc(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Bc(e,t){return e/Rc(t)}function Ic(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}class $c{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){const n=Sc.convert(e);return new $c(Dc(n.lng),Pc(n.lat),Bc(t,n.lat))}toLngLat(){return new Sc(360*this.x-180,Ic(this.y))}toAltitude(){return this.z*Rc(Ic(this.y))}meterInMercatorCoordinateUnits(){return 1/Cc*(e=Ic(this.y),1/Math.cos(e*Math.PI/180));var e}}function Fc(e,t,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[e*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Xc{constructor(e,t,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))throw new Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=Uc(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){const a=(i=this.y,o=this.z,s=Fc(256*(r=this.x),256*(i=Math.pow(2,o)-i-1),o),l=Fc(256*(r+1),256*(i+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]);var r,i,o,s,l;const c=function(e,t,n){let a,r="";for(let i=e;i>0;i--)a=1<<i-1,r+=(t&a?1:0)+(n&a?2:0);return r}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===n?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,a)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new A((e.x*t-this.x)*Wi,(e.y*t-this.y)*Wi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Yc{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Uc(e,t.z,t.z,t.x,t.y)}}class Hc{constructor(e,t,n,a,r){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Xc(n,+a,+r),this.key=Uc(t,e,n,a,r)}clone(){return new Hc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new Hc(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hc(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-e;return e>this.canonical.z?Uc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Uc(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Hc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new Hc(t,this.wrap,t,n,a),new Hc(t,this.wrap,t,n+1,a),new Hc(t,this.wrap,t,n,a+1),new Hc(t,this.wrap,t,n+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Hc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Hc(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new $c(e.x-this.wrap,e.y))}}function Uc(e,t,n,a,r){(e*=2)<0&&(e=-1*e-1);const i=1<<n;return(i*i*e+i*r+a).toString(36)+n.toString(36)+t.toString(36)}_a("CanonicalTileID",Xc),_a("OverscaledTileID",Hc,{omit:["posMatrix"]});class Vc{constructor(e,t,n){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return void b(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const a=this.dim=t.height-2;this.data=new Uint32Array(t.data.buffer),this.encoding=n||"mapbox";for(let e=0;e<a;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(a,e)]=this.data[this._idx(a-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,a)]=this.data[this._idx(e,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<a;e++)for(let t=0;t<a;t++){const n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){const n=new Uint8Array(this.data.buffer),a=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[a],n[a+1],n[a+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}_unpackMapbox(e,t,n){return(256*e*256+256*t+n)/10-1e4}_unpackTerrarium(e,t,n){return 256*e+t+n/256-32768}getPixels(){return new Mo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=t*this.dim,r=t*this.dim+this.dim,i=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:a=r-1;break;case 1:r=a+1}switch(n){case-1:i=o-1;break;case 1:o=i+1}const s=-t*this.dim,l=-n*this.dim;for(let t=i;t<o;t++)for(let n=a;n<r;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+l)]}}_a("DEMData",Vc);class Gc{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Kc{constructor(e,t,n,a,r){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=n,e._y=a,this.properties=e.properties,this.id=r}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&(e[t]=this[t]);return e}}class Jc{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new fa(Wi,16,0),this.grid3D=new fa(Wi,16,0),this.featureIndexArray=new Fr,this.promoteId=t}insert(e,t,n,a,r,i){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,r);const s=i?this.grid3D:this.grid;for(let e=0;e<t.length;e++){const n=t[e],a=[1/0,1/0,-1/0,-1/0];for(let e=0;e<n.length;e++){const t=n[e];a[0]=Math.min(a[0],t.x),a[1]=Math.min(a[1],t.y),a[2]=Math.max(a[2],t.x),a[3]=Math.max(a[3],t.y)}a[0]<Wi&&a[1]<Wi&&a[2]>=0&&a[3]>=0&&s.insert(o,a[0],a[1],a[2],a[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ds.VectorTile(new Js(this.rawTileData)).layers,this.sourceLayerCoder=new Gc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,n,a){this.loadVTLayers();const r=e.params||{},i=Wi/e.tileSize/e.scale,o=In(r.filter),s=e.queryGeometry,l=e.queryPadding*i,c=Qc(s),u=this.grid.query(c.minX-l,c.minY-l,c.maxX+l,c.maxY+l),d=Qc(e.cameraQueryGeometry),p=this.grid3D.query(d.minX-l,d.minY-l,d.maxX+l,d.maxY+l,(t,n,a,r)=>function(e,t,n,a,r){for(const i of e)if(t<=i.x&&n<=i.y&&a>=i.x&&r>=i.y)return!0;const i=[new A(t,n),new A(t,r),new A(a,r),new A(a,n)];if(e.length>2)for(const t of i)if(Vi(e,t))return!0;for(let t=0;t<e.length-1;t++)if(Gi(e[t],e[t+1],i))return!0;return!1}(e.cameraQueryGeometry,t-l,n-l,a+l,r+l));for(const e of p)u.push(e);u.sort(eu);const m={};let b;for(let l=0;l<u.length;l++){const c=u[l];if(c===b)continue;b=c;const d=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,d.bucketIndex,d.sourceLayerIndex,d.featureIndex,o,r.layers,r.availableImages,t,n,a,(t,n,a)=>(p||(p=Ti(t)),n.queryIntersectsFeature(s,t,a,p,this.z,e.transform,i,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,t,n,a,r,i,o,l,c,u,d){const p=this.bucketLayerIDs[t];if(i&&!function(e,t){for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>=0)return!0;return!1}(i,p))return;const m=this.sourceLayerCoder.decode(n),b=this.vtLayers[m].feature(a);if(r.needGeometry){const e=Ci(b,!0);if(!r.filter(new Xa(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new Xa(this.tileID.overscaledZ),b))return;const h=this.getId(b,m);for(let t=0;t<p.length;t++){const n=p[t];if(i&&i.indexOf(n)<0)continue;const r=l[n];if(!r)continue;let m={};h&&u&&(m=u.getState(r.sourceLayer||"_geojsonTileLayer",h));const f=s({},c[n]);f.paint=Zc(f.paint,r.paint,b,m,o),f.layout=Zc(f.layout,r.layout,b,m,o);const g=!d||d(b,r,m);if(!g)continue;const _=new Kc(b,this.z,this.x,this.y,h);_.layer=f;let y=e[n];void 0===y&&(y=e[n]=[]),y.push({featureIndex:a,feature:_,intersectionZ:g})}}lookupSymbolFeatures(e,t,n,a,r,i,o,s){const l={};this.loadVTLayers();const c=In(r);for(const r of e)this.loadMatchingFeature(l,n,a,r,c,i,o,s,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;return this.promoteId&&(n=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof n&&(n=Number(n))),n}}function Zc(e,t,n,a,r){return u(e,(e,i)=>{const o=t instanceof Za?t.get(i):null;return o&&o.evaluate?o.evaluate(n,a,r):o})}function Qc(e){let t=1/0,n=1/0,a=-1/0,r=-1/0;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),a=Math.max(a,i.x),r=Math.max(r,i.y);return{minX:t,minY:n,maxX:a,maxY:r}}function eu(e,t){return t-e}var tu;_a("FeatureIndex",Jc,{omit:["rawTileData","sourceLayerCoder"]}),e.PerformanceMarkers=void 0,(tu=e.PerformanceMarkers||(e.PerformanceMarkers={})).create="create",tu.load="load",tu.fullLoad="fullLoad";let nu=null,au=[];const ru=1e3/30,iu={mark(e){performance.mark(e)},frame(e){const t=e;null!=nu&&au.push(t-nu),nu=t},clearMetrics(){nu=null,au=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const t in e.PerformanceMarkers)performance.clearMarks(e.PerformanceMarkers[t])},getPerformanceMetrics(){performance.measure("loadTime",e.PerformanceMarkers.create,e.PerformanceMarkers.load),performance.measure("fullLoadTime",e.PerformanceMarkers.create,e.PerformanceMarkers.fullLoad);const t=performance.getEntriesByName("loadTime")[0].duration,n=performance.getEntriesByName("fullLoadTime")[0].duration,a=au.length,r=1/(au.reduce((e,t)=>e+t,0)/a/1e3),i=au.filter(e=>e>ru).reduce((e,t)=>e+(t-ru)/ru,0);return{loadTime:t,fullLoadTime:n,fps:r,percentDroppedFrames:i/(a+i)*100}}};e.AJAXError=I,e.ARRAY_TYPE=no,e.Actor=class{constructor(e,t,n){this.target=e,this.parent=t,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},c(["receive","process"],this),this.invoker=new Wc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=g()?e:window}send(e,t,n,a,r=!1){const i=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(this.callbacks[i]=n);const o=z(this.globalScope)?void 0:[];return this.target.postMessage({id:i,type:e,hasCallback:!!n,targetMapId:a,mustQueue:r,sourceMapId:this.mapId,data:Ma(t,o)},o),{cancel:()=>{n&&delete this.callbacks[i],this.target.postMessage({id:i,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const t=e.data,n=t.id;if(n&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){delete this.tasks[n];const e=this.cancelCallbacks[n];delete this.cancelCallbacks[n],e&&e()}else g()||t.mustQueue?(this.tasks[n]=t,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,t)}process(){if(!this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,t){if("<response>"===t.type){const n=this.callbacks[e];delete this.callbacks[e],n&&(t.error?n(va(t.error)):n(null,va(t.data)))}else{let n=!1;const a=z(this.globalScope)?void 0:[],r=t.hasCallback?(t,r)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Ma(t):null,data:Ma(r,a)},a)}:e=>{n=!0};let i=null;const o=va(t.data);if(this.parent[t.type])i=this.parent[t.type](t.sourceMapId,o,r);else if(this.parent.getWorkerSource){const e=t.type.split(".");i=this.parent.getWorkerSource(t.sourceMapId,e[0],o.source)[e[1]](o,r)}else r(new Error("Could not find function "+t.type));!n&&i&&i.cancel&&(this.cancelCallbacks[e]=i.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.AlphaImage=yo,e.CanonicalTileID=Xc,e.CollisionBoxArray=Tr,e.CollisionCircleLayoutArray=class extends Or{},e.Color=Le,e.DEMData=Vc,e.DataConstantProperty=Qa,e.DictionaryCoder=Gc,e.EXTENT=Wi,e.ErrorEvent=ee,e.EvaluationParameters=Xa,e.Event=Q,e.Evented=te,e.FeatureIndex=Jc,e.FillBucket=is,e.FillExtrusionBucket=xs,e.GeoJSONFeature=Kc,e.ImageAtlas=Al,e.ImagePosition=kl,e.LineBucket=Ps,e.LineStripIndexArray=class extends Wr{},e.LngLat=Sc,e.LngLatBounds=Tc,e.MercatorCoordinate=$c,e.ONE_EM=24,e.OverscaledTileID=Hc,e.PerformanceUtils=iu,e.PosArray=Xr,e.Properties=rr,e.QuadTriangleArray=class extends Ar{},e.RGBAImage=Mo,e.RasterBoundsArray=class extends mr{},e.RequestPerformance=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.ResourceType=B,e.SegmentVector=oi,e.SymbolBucket=zc,e.Transitionable=Ua,e.TriangleIndexArray=ni,e.Uniform1f=_i,e.Uniform1i=class extends gi{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.Uniform2f=class extends gi{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.Uniform3f=class extends gi{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.Uniform4f=yi,e.UniformColor=Mi,e.UniformMatrix4f=class extends gi{constructor(e,t){super(e,t),this.current=vi}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.UnwrappedTileID=Yc,e.ValidationError=ae,e.ZoomHistory=za,e.add=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e},e.addDynamicAttributes=_c,e.asyncAll=function(e,t,n){if(!e.length)return n(null,[]);let a=e.length;const r=new Array(e.length);let i=null;e.forEach((e,o)=>{t(e,(e,t)=>{e&&(i=e),r[o]=t,0==--a&&n(i,r)})})},e.bezier=a,e.bindAll=c,e.cacheEntryPossiblyAdded=function(e){L++,L>j&&(e.getActor().send("enforceCacheSizeLimit",E),L=0)},e.clamp=i,e.clearTileCache=function(e){const t=caches.delete(N);e&&t.catch(e).then(()=>e())},e.clipLine=Gl,e.clone=function(e){var t=new no(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=p,e.clone$2=function(e){var t=new no(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.collisionCircleLayout=Vs,e.config=w,e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.create=function(){var e=new no(16);return no!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=ao,e.createExpression=Nn,e.createFilter=In,e.createLayout=ur,e.createStyleLayer=function(e){return"custom"===e.type?new Ec(e):new jc[e.type](e)},e.cross=function(e,t,n){var a=t[0],r=t[1],i=t[2],o=n[0],s=n[1],l=n[2];return e[0]=r*l-i*s,e[1]=i*o-a*l,e[2]=a*s-r*o,e},e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.dot$1=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.ease=r,e.emitValidationErrors=ha,e.enforceCacheSizeLimit=function(e){W(),q&&q.then(t=>{t.keys().then(n=>{for(let a=0;a<n.length-e;a++)t.delete(n[a])})})},e.equals=function(e,t){var n=e[0],a=e[1],r=e[2],i=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],d=e[9],p=e[10],m=e[11],b=e[12],h=e[13],f=e[14],g=e[15],_=t[0],y=t[1],M=t[2],v=t[3],z=t[4],O=t[5],k=t[6],A=t[7],x=t[8],w=t[9],N=t[10],q=t[11],E=t[12],j=t[13],W=t[14],L=t[15];return Math.abs(n-_)<=to*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(a-y)<=to*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(r-M)<=to*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(i-v)<=to*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-z)<=to*Math.max(1,Math.abs(o),Math.abs(z))&&Math.abs(s-O)<=to*Math.max(1,Math.abs(s),Math.abs(O))&&Math.abs(l-k)<=to*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(c-A)<=to*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(u-x)<=to*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(d-w)<=to*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-N)<=to*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(m-q)<=to*Math.max(1,Math.abs(m),Math.abs(q))&&Math.abs(b-E)<=to*Math.max(1,Math.abs(b),Math.abs(E))&&Math.abs(h-j)<=to*Math.max(1,Math.abs(h),Math.abs(j))&&Math.abs(f-W)<=to*Math.max(1,Math.abs(f),Math.abs(W))&&Math.abs(g-L)<=to*Math.max(1,Math.abs(g),Math.abs(L))},e.evaluateSizeForFeature=function(e,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:r}){return"source"===e.kind?a/Bl:"composite"===e.kind?Ot(a/Bl,r/Bl,n):t},e.evaluateSizeForZoom=function(e,t){let n=0,a=0;if("constant"===e.kind)a=e.layoutSize;else if("source"!==e.kind){const{interpolationType:r,minZoom:o,maxZoom:s}=e,l=r?i(Dt.interpolationFactor(r,t,o,s),0,1):0;"camera"===e.kind?a=Ot(e.minSize,e.maxSize,l):n=l}return{uSizeT:n,uSize:a}},e.evaluateVariableOffset=lc,e.evented=Ba,e.exported=k,e.exported$1=S,e.extend=s,e.filterObject=d,e.fromRotation=function(e,t){var n=Math.sin(t),a=Math.cos(t);return e[0]=a,e[1]=n,e[2]=0,e[3]=-n,e[4]=a,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.getAnchorAlignment=Cl,e.getAnchorJustification=cc,e.getArrayBuffer=Y,e.getImage=K,e.getJSON=function(e,t){return X(s(e,{type:"json"}),t)},e.getOverlapMode=wc,e.getRTLTextPluginStatus=Ia,e.getReferrer=$,e.getVideo=function(e,t){const n=window.document.createElement("video");n.muted=!0,n.onloadstart=function(){t(null,n)};for(let t=0;t<e.length;t++){const a=window.document.createElement("source");H(e[t])||(n.crossOrigin="Anonymous"),a.src=e[t],n.appendChild(a)}return{cancel:()=>{}}},e.identity=ro,e.invert=function(e,t){var n=t[0],a=t[1],r=t[2],i=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],m=t[11],b=t[12],h=t[13],f=t[14],g=t[15],_=n*s-a*o,y=n*l-r*o,M=n*c-i*o,v=a*l-r*s,z=a*c-i*s,O=r*c-i*l,k=u*h-d*b,A=u*f-p*b,x=u*g-m*b,w=d*f-p*h,N=d*g-m*h,q=p*g-m*f,E=_*q-y*N+M*w+v*x-z*A+O*k;return E?(e[0]=(s*q-l*N+c*w)*(E=1/E),e[1]=(r*N-a*q-i*w)*E,e[2]=(h*O-f*z+g*v)*E,e[3]=(p*z-d*O-m*v)*E,e[4]=(l*x-o*q-c*A)*E,e[5]=(n*q-r*x+i*A)*E,e[6]=(f*M-b*O-g*y)*E,e[7]=(u*O-p*M+m*y)*E,e[8]=(o*N-s*x+c*k)*E,e[9]=(a*x-n*N-i*k)*E,e[10]=(b*z-h*M+g*_)*E,e[11]=(d*M-u*z-m*_)*E,e[12]=(s*A-o*w-l*k)*E,e[13]=(n*w-a*A+r*k)*E,e[14]=(h*y-b*v-f*_)*E,e[15]=(u*v-d*y+p*_)*E,e):null},e.isImageBitmap=O,e.isSafari=z,e.isWorker=g,e.keysDifference=function(e,t){const n=[];for(const a in e)a in t||n.push(a);return n},e.lazyLoadRTLTextPlugin=function(){Fa.isLoading()||Fa.isLoaded()||"deferred"!==Ia()||$a()},e.makeRequest=X,e.mapObject=u,e.mercatorXfromLng=Dc,e.mercatorYfromLat=Pc,e.mercatorZfromAltitude=Bc,e.mul=so,e.mul$1=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.multiply=io,e.nextPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.normalize=function(e,t){var n=t[0],a=t[1],r=t[2],i=n*n+a*a+r*r;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},e.number=Ot,e.ortho=function(e,t,n,a,r,i,o){var s=1/(t-n),l=1/(a-r),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(r+a)*l,e[14]=(o+i)*c,e[15]=1,e},e.parseCacheControl=_,e.parseGlyphPbf=function(e){return new Js(e).readFields(Ml,[])},e.pbf=Js,e.performSymbolLayout=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=Wi/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const n=t.bucket.layers[0].layout,a=t.bucket.layers[0]._unevaluatedLayout._values,r={layoutIconSize:a["icon-size"].possiblyEvaluate(new Xa(t.bucket.zoom+1),t.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Xa(t.bucket.zoom+1),t.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Xa(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.textSizeData;r.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Xa(e),t.canonical),a["text-size"].possiblyEvaluate(new Xa(n),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;r.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Xa(e),t.canonical),a["icon-size"].possiblyEvaluate(new Xa(n),t.canonical)]}const i=24*n.get("text-line-height"),o="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),s=n.get("text-keep-upright"),l=n.get("text-size");for(const a of t.bucket.features){const c=n.get("text-font").evaluate(a,{},t.canonical).join(","),u=l.evaluate(a,{},t.canonical),d=r.layoutTextSize.evaluate(a,{},t.canonical),p=r.layoutIconSize.evaluate(a,{},t.canonical),m={horizontal:{},vertical:void 0},h=a.text;let f,g=[0,0];if(h){const r=h.toString(),l=24*n.get("text-letter-spacing").evaluate(a,{},t.canonical),p=Aa(r)?l:0,b=n.get("text-anchor").evaluate(a,{},t.canonical),f=n.get("text-variable-anchor");if(!f){const e=n.get("text-radial-offset").evaluate(a,{},t.canonical);g=e?lc(b,[24*e,sc]):n.get("text-offset").evaluate(a,{},t.canonical).map(e=>24*e)}let _=o?"center":n.get("text-justify").evaluate(a,{},t.canonical);const y=n.get("symbol-placement"),M="point"===y?24*n.get("text-max-width").evaluate(a,{},t.canonical):0,v=()=>{t.bucket.allowVerticalPlacement&&ka(r)&&(m.vertical=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,b,"left",p,g,e.WritingMode.vertical,!0,y,d,u))};if(!o&&f){const n="auto"===_?f.map(e=>cc(e)):[_];let a=!1;for(let r=0;r<n.length;r++){const o=n[r];if(!m.horizontal[o])if(a)m.horizontal[o]=m.horizontal[0];else{const n=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,"center",o,p,g,e.WritingMode.horizontal,!1,y,d,u);n&&(m.horizontal[o]=n,a=1===n.positionedLines.length)}}v()}else{"auto"===_&&(_=cc(b));const n=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,b,_,p,g,e.WritingMode.horizontal,!1,y,d,u);n&&(m.horizontal[_]=n),v(),ka(r)&&o&&s&&(m.vertical=Nl(h,t.glyphMap,t.glyphPositions,t.imagePositions,c,M,i,b,_,p,g,e.WritingMode.vertical,!1,y,d,u))}}let _=!1;if(a.icon&&a.icon.name){const e=t.imageMap[a.icon.name];e&&(f=Dl(t.imagePositions[a.icon.name],n.get("icon-offset").evaluate(a,{},t.canonical),n.get("icon-anchor").evaluate(a,{},t.canonical)),_=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=_:t.bucket.sdfIcons!==_&&b("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const y=mc(m.horizontal)||m.vertical;t.bucket.iconsInText=!!y&&y.iconsInText,(y||f)&&uc(t.bucket,a,m,f,t.imageMap,r,d,p,g,_,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.perspective=function(e,t,n,a,r){var i,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(e[10]=(r+a)*(i=1/(a-r)),e[14]=2*r*a*i):(e[10]=-1,e[14]=-2*a),e},e.pick=function(e,t){const n={};for(let a=0;a<t.length;a++){const r=t[a];r in e&&(n[r]=e[r])}return n},e.plugin=Fa,e.pointGeometry=A,e.polygonIntersectsPolygon=Pi,e.potpack=Ol,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.register=_a,e.registerForPluginStateChange=function(e){return e({pluginStatus:Ca,pluginURL:Ra}),Ba.on("pluginStateChange",e),e},e.renderColorRamp=vo,e.rotateX=function(e,t,n){var a=Math.sin(n),r=Math.cos(n),i=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],d=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*r+c*a,e[5]=o*r+u*a,e[6]=s*r+d*a,e[7]=l*r+p*a,e[8]=c*r-i*a,e[9]=u*r-o*a,e[10]=d*r-s*a,e[11]=p*r-l*a,e},e.rotateZ=function(e,t,n){var a=Math.sin(n),r=Math.cos(n),i=t[0],o=t[1],s=t[2],l=t[3],c=t[4],u=t[5],d=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*r+c*a,e[1]=o*r+u*a,e[2]=s*r+d*a,e[3]=l*r+p*a,e[4]=c*r-i*a,e[5]=u*r-o*a,e[6]=d*r-s*a,e[7]=p*r-l*a,e},e.scale=function(e,t,n){var a=n[0],r=n[1],i=n[2];return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.scale$1=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e},e.setCacheLimits=function(e,t){E=e,j=t},e.setRTLTextPlugin=function(e,t,n=!1){if(Ca===Wa||Ca===La||Ca===Sa)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ra=k.resolveURL(e),Ca=Wa,Ta=t,Pa(),n||$a()},e.spec=ne,e.sphericalToCartesian=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.sqrLen=function(e){var t=e[0],n=e[1];return t*t+n*n},e.sub=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e},e.toEvaluationFeature=Ci,e.transformMat3=function(e,t,n){var a=t[0],r=t[1],i=t[2];return e[0]=a*n[0]+r*n[3]+i*n[6],e[1]=a*n[1]+r*n[4]+i*n[7],e[2]=a*n[2]+r*n[5]+i*n[8],e},e.transformMat4=uo,e.transformMat4$1=function(e,t,n){var a=t[0],r=t[1];return e[0]=n[0]*a+n[4]*r+n[12],e[1]=n[1]*a+n[5]*r+n[13],e},e.translate=function(e,t,n){var a,r,i,o,s,l,c,u,d,p,m,b,h=n[0],f=n[1],g=n[2];return t===e?(e[12]=t[0]*h+t[4]*f+t[8]*g+t[12],e[13]=t[1]*h+t[5]*f+t[9]*g+t[13],e[14]=t[2]*h+t[6]*f+t[10]*g+t[14],e[15]=t[3]*h+t[7]*f+t[11]*g+t[15]):(r=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],m=t[10],b=t[11],e[0]=a=t[0],e[1]=r,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=p,e[10]=m,e[11]=b,e[12]=a*h+s*f+d*g+t[12],e[13]=r*h+l*f+p*g+t[13],e[14]=i*h+c*f+m*g+t[14],e[15]=o*h+u*f+b*g+t[15]),e},e.triggerPluginCompletionEvent=Da,e.unicodeBlockLookup=Oa,e.uniqueId=function(){return l++},e.validateCustomStyleLayer=function(e){const t=[],n=e.id;return void 0===n&&t.push({message:`layers.${n}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.validateLight=pa,e.validateStyle=da,e.vectorTile=ds,e.warnOnce=b,e.wrap=o})),a(0,(function(e){function t(e){const n=typeof e;if("number"===n||"boolean"===n||"string"===n||null==e)return JSON.stringify(e);if(Array.isArray(e)){let n="[";for(const a of e)n+=t(a)+",";return n+"]"}const a=Object.keys(e).sort();let r="{";for(let n=0;n<a.length;n++)r+=`${JSON.stringify(a[n])}:${t(e[a[n]])},`;return r+"}"}function n(n){let a="";for(const r of e.refProperties)a+="/"+t(n[r]);return a}class a{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,a){for(const n of t){this._layerConfigs[n.id]=n;const t=this._layers[n.id]=e.createStyleLayer(n);t._featureFilter=e.createFilter(t.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(const e of a)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=function(e,t){const a={};for(let r=0;r<e.length;r++){const i=t&&t[e[r].id]||n(e[r]);t&&(t[e[r].id]=i);let o=a[i];o||(o=a[i]=[]),o.push(e[r])}const r=[];for(const e in a)r.push(a[e]);return r}(Object.values(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map(e=>this._layers[e.id]),n=t[0];if("none"===n.visibility)continue;const a=n.source||"";let r=this.familiesBySource[a];r||(r=this.familiesBySource[a]={});const i=n.sourceLayer||"_geojsonTileLayer";let o=r[i];o||(o=r[i]=[]),o.push(t)}}}class r{constructor(t){const n={},a=[];for(const e in t){const r=t[e],i=n[e]={};for(const e in r){const t=r[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};a.push(n),i[e]={rect:n,metrics:t.metrics}}}const{w:r,h:i}=e.potpack(a),o=new e.AlphaImage({width:r||1,height:i||1});for(const a in t){const r=t[a];for(const t in r){const i=r[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const s=n[a][t].rect;e.AlphaImage.copy(i.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},i.bitmap)}}this.image=o,this.positions=n}}e.register("GlyphAtlas",r);class i{constructor(t){this.tileID=new e.OverscaledTileID(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,n,a,i,s){this.status="parsing",this.data=t,this.collisionBoxArray=new e.CollisionBoxArray;const l=new e.DictionaryCoder(Object.keys(t.layers).sort()),c=new e.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},d={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:a},p=n.familiesBySource[this.source];for(const n in p){const r=t.layers[n];if(!r)continue;1===r.version&&e.warnOnce(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const i=l.encode(n),s=[];for(let e=0;e<r.length;e++){const t=r.feature(e),a=c.getId(t,n);s.push({feature:t,id:a,index:e,sourceLayerIndex:i})}for(const t of p[n]){const n=t[0];n.source!==this.source&&e.warnOnce(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.minzoom&&this.zoom<Math.floor(n.minzoom)||n.maxzoom&&this.zoom>=n.maxzoom||"none"!==n.visibility&&(o(t,this.zoom,a),(u[n.id]=n.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:i,sourceID:this.source})).populate(s,d,this.tileID.canonical),c.bucketLayerIDs.push(t.map(e=>e.id)))}}let m,b,h,f;const g=e.mapObject(d.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(g).length?i.send("getGlyphs",{uid:this.uid,stacks:g},(e,t)=>{m||(m=e,b=t,M.call(this))}):b={};const _=Object.keys(d.iconDependencies);_.length?i.send("getImages",{icons:_,source:this.source,tileID:this.tileID,type:"icons"},(e,t)=>{m||(m=e,h=t,M.call(this))}):h={};const y=Object.keys(d.patternDependencies);function M(){if(m)return s(m);if(b&&h&&f){const t=new r(b),n=new e.ImageAtlas(h,f);for(const r in u){const i=u[r];i instanceof e.SymbolBucket?(o(i.layers,this.zoom,a),e.performSymbolLayout({bucket:i,glyphMap:b,glyphPositions:t.positions,imageMap:h,imagePositions:n.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):i.hasPattern&&(i instanceof e.LineBucket||i instanceof e.FillBucket||i instanceof e.FillExtrusionBucket)&&(o(i.layers,this.zoom,a),i.addFeatures(d,this.tileID.canonical,n.patternPositions))}this.status="done",s(null,{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:n,glyphMap:this.returnDependencies?b:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?t.positions:null})}}y.length?i.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"patterns"},(e,t)=>{m||(m=e,f=t,M.call(this))}):f={},M.call(this)}}function o(t,n,a){const r=new e.EvaluationParameters(n);for(const e of t)e.recalculate(r,a)}function s(t,n){const a=e.getArrayBuffer(t.request,(t,a,r,i)=>{t?n(t):a&&n(null,{vectorTile:new e.vectorTile.VectorTile(new e.pbf(a)),rawData:a,cacheControl:r,expires:i})});return()=>{a.cancel(),n()}}class l{constructor(e,t,n,a){this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=a||s,this.loading={},this.loaded={}}loadTile(t,n){const a=t.uid;this.loading||(this.loading={});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),o=this.loading[a]=new i(t);o.abort=this.loadVectorData(t,(t,i)=>{if(delete this.loading[a],t||!i)return o.status="done",this.loaded[a]=o,n(t);const s=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(r){const e=r.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=i.vectorTile,o.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,(t,a)=>{if(t||!a)return n(t);n(null,e.extend({rawTileData:s.slice(0)},a,l,c))}),this.loaded=this.loaded||{},this.loaded[a]=o})}reloadTile(e,t){const n=this.loaded,a=e.uid,r=this;if(n&&n[a]){const i=n[a];i.showCollisionBoxes=e.showCollisionBoxes;const o=(e,n)=>{const a=i.reloadCallback;a&&(delete i.reloadCallback,i.parse(i.vectorTile,r.layerIndex,this.availableImages,r.actor,a)),t(e,n)};"parsing"===i.status?i.reloadCallback=o:"done"===i.status&&(i.vectorTile?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,o):o())}}abortTile(e,t){const n=this.loading,a=e.uid;n&&n[a]&&n[a].abort&&(n[a].abort(),delete n[a]),t()}removeTile(e,t){const n=this.loaded,a=e.uid;n&&n[a]&&delete n[a],t()}}class c{constructor(){this.loaded={}}loadTile(t,n){const{uid:a,encoding:r,rawImageData:i}=t,o=e.isImageBitmap(i)?this.getImageData(i):i,s=new e.DEMData(a,o,r);this.loaded=this.loaded||{},this.loaded[a]=s,n(null,s)}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 n=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.RGBAImage({width:n.width,height:n.height},n.data)}removeTile(e){const t=this.loaded,n=e.uid;t&&t[n]&&delete t[n]}}function u(e,t){if(0!==e.length){d(e[0],t);for(var n=1;n<e.length;n++)d(e[n],!t)}}function d(e,t){for(var n=0,a=0,r=0,i=e.length,o=i-1;r<i;o=r++){var s=(e[r][0]-e[o][0])*(e[o][1]+e[r][1]),l=n+s;a+=Math.abs(n)>=Math.abs(s)?n-l+s:s-l+n,n=l}n+a>=0!=!!t&&e.reverse()}const p=e.vectorTile.VectorTileFeature.prototype.toGeoJSON;class m{constructor(t){this._feature=t,this.extent=e.EXTENT,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 n of this._feature.geometry)t.push([new e.pointGeometry(n[0],n[1])]);return t}{const t=[];for(const n of this._feature.geometry){const a=[];for(const t of n)a.push(new e.pointGeometry(t[0],t[1]));t.push(a)}return t}}toGeoJSON(e,t,n){return p.call(this,e,t,n)}}class b{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=t.length,this._features=t}feature(e){return new m(this._features[e])}}var h={exports:{}},f=e.pointGeometry,g=e.vectorTile.VectorTileFeature,_=y;function y(e,t){this.options=t||{},this.features=e,this.length=e.length}function M(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}y.prototype.feature=function(e){return new M(this.features[e],this.options.extent)},M.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var n=e[t],a=[],r=0;r<n.length;r++)a.push(new f(n[r][0],n[r][1]));this.geometry.push(a)}return this.geometry},M.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,n=-1/0,a=1/0,r=-1/0,i=0;i<e.length;i++)for(var o=e[i],s=0;s<o.length;s++){var l=o[s];t=Math.min(t,l.x),n=Math.max(n,l.x),a=Math.min(a,l.y),r=Math.max(r,l.y)}return[t,a,n,r]},M.prototype.toGeoJSON=g.prototype.toGeoJSON;var v=e.pbf,z=_;function O(e){var t=new v;return function(e,t){for(var n in e.layers)t.writeMessage(3,k,e.layers[n])}(e,t),t.finish()}function k(e,t){var n;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var a={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<e.length;n++)a.feature=e.feature(n),t.writeMessage(2,A,a);var r=a.keys;for(n=0;n<r.length;n++)t.writeStringField(3,r[n]);var i=a.values;for(n=0;n<i.length;n++)t.writeMessage(4,E,i[n])}function A(e,t){var n=e.feature;void 0!==n.id&&t.writeVarintField(1,n.id),t.writeMessage(2,x,e),t.writeVarintField(3,n.type),t.writeMessage(4,q,n)}function x(e,t){var n=e.feature,a=e.keys,r=e.values,i=e.keycache,o=e.valuecache;for(var s in n.properties){var l=n.properties[s],c=i[s];if(null!==l){void 0===c&&(a.push(s),i[s]=c=a.length-1),t.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var d=u+":"+l,p=o[d];void 0===p&&(r.push(l),o[d]=p=r.length-1),t.writeVarint(p)}}}function w(e,t){return(t<<3)+(7&e)}function N(e){return e<<1^e>>31}function q(e,t){for(var n=e.loadGeometry(),a=e.type,r=0,i=0,o=n.length,s=0;s<o;s++){var l=n[s],c=1;1===a&&(c=l.length),t.writeVarint(w(1,c));for(var u=3===a?l.length-1:l.length,d=0;d<u;d++){1===d&&1!==a&&t.writeVarint(w(2,u-1));var p=l[d].x-r,m=l[d].y-i;t.writeVarint(N(p)),t.writeVarint(N(m)),r+=p,i+=m}3===a&&t.writeVarint(w(7,1))}}function E(e,t){var n=typeof e;"string"===n?t.writeStringField(1,e):"boolean"===n?t.writeBooleanField(7,e):"number"===n&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}function j(e,t,n,a,r,i){if(r-a<=n)return;const o=a+r>>1;(function e(t,n,a,r,i,o){for(;i>r;){if(i-r>600){const s=i-r+1,l=a-r+1,c=Math.log(s),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);e(t,n,a,Math.max(r,Math.floor(a-l*u/s+d)),Math.min(i,Math.floor(a+(s-l)*u/s+d)),o)}const s=n[2*a+o];let l=r,c=i;for(W(t,n,r,a),n[2*i+o]>s&&W(t,n,r,i);l<c;){for(W(t,n,l,c),l++,c--;n[2*l+o]<s;)l++;for(;n[2*c+o]>s;)c--}n[2*r+o]===s?W(t,n,r,c):(c++,W(t,n,c,i)),c<=a&&(r=c+1),a<=c&&(i=c-1)}})(e,t,o,a,r,i%2),j(e,t,n,a,o-1,i+1),j(e,t,n,o+1,r,i+1)}function W(e,t,n,a){L(e,n,a),L(t,2*n,2*a),L(t,2*n+1,2*a+1)}function L(e,t,n){const a=e[t];e[t]=e[n],e[n]=a}function S(e,t,n,a){const r=e-n,i=t-a;return r*r+i*i}h.exports=O,h.exports.fromVectorTileJs=O,h.exports.fromGeojsonVt=function(e,t){t=t||{};var n={};for(var a in e)n[a]=new z(e[a].features,t),n[a].name=a,n[a].version=t.version,n[a].extent=t.extent;return O({layers:n})},h.exports.GeoJSONWrapper=z;const T=e=>e[0],C=e=>e[1];class R{constructor(e,t=T,n=C,a=64,r=Float64Array){this.nodeSize=a,this.points=e;const i=e.length<65536?Uint16Array:Uint32Array,o=this.ids=new i(e.length),s=this.coords=new r(2*e.length);for(let a=0;a<e.length;a++)o[a]=a,s[2*a]=t(e[a]),s[2*a+1]=n(e[a]);j(o,s,a,0,o.length-1,0)}range(e,t,n,a){return function(e,t,n,a,r,i,o){const s=[0,e.length-1,0],l=[];let c,u;for(;s.length;){const d=s.pop(),p=s.pop(),m=s.pop();if(p-m<=o){for(let o=m;o<=p;o++)c=t[2*o],u=t[2*o+1],c>=n&&c<=r&&u>=a&&u<=i&&l.push(e[o]);continue}const b=Math.floor((m+p)/2);c=t[2*b],u=t[2*b+1],c>=n&&c<=r&&u>=a&&u<=i&&l.push(e[b]);const h=(d+1)%2;(0===d?n<=c:a<=u)&&(s.push(m),s.push(b-1),s.push(h)),(0===d?r>=c:i>=u)&&(s.push(b+1),s.push(p),s.push(h))}return l}(this.ids,this.coords,e,t,n,a,this.nodeSize)}within(e,t,n){return function(e,t,n,a,r,i){const o=[0,e.length-1,0],s=[],l=r*r;for(;o.length;){const c=o.pop(),u=o.pop(),d=o.pop();if(u-d<=i){for(let r=d;r<=u;r++)S(t[2*r],t[2*r+1],n,a)<=l&&s.push(e[r]);continue}const p=Math.floor((d+u)/2),m=t[2*p],b=t[2*p+1];S(m,b,n,a)<=l&&s.push(e[p]);const h=(c+1)%2;(0===c?n-r<=m:a-r<=b)&&(o.push(d),o.push(p-1),o.push(h)),(0===c?n+r>=m:a+r>=b)&&(o.push(p+1),o.push(u),o.push(h))}return s}(this.ids,this.coords,e,t,n,this.nodeSize)}}const D={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},P=Math.fround||(B=new Float32Array(1),e=>(B[0]=+e,B[0]));var B;class I{constructor(e){this.options=G(Object.create(D),e),this.trees=new Array(this.options.maxZoom+1)}load(e){const{log:t,minZoom:n,maxZoom:a,nodeSize:r}=this.options;t&&console.time("total time");const i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let o=[];for(let t=0;t<e.length;t++)e[t].geometry&&o.push(F(e[t],t));this.trees[a+1]=new R(o,K,J,r,Float32Array),t&&console.timeEnd(i);for(let e=a;e>=n;e--){const n=+Date.now();o=this._cluster(o,e),this.trees[e]=new R(o,K,J,r,Float32Array),t&&console.log("z%d: %d clusters in %dms",e,o.length,+Date.now()-n)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,r=180;else if(n>r){const e=this.getClusters([n,a,180,i],t),o=this.getClusters([-180,a,r,i],t);return e.concat(o)}const o=this.trees[this._limitZoom(t)],s=o.range(H(n),U(i),H(r),U(a)),l=[];for(const e of s){const t=o.points[e];l.push(t.numPoints?X(t):this.points[t.index])}return l}getChildren(e){const t=this._getOriginId(e),n=this._getOriginZoom(e),a="No cluster with the specified id.",r=this.trees[n];if(!r)throw new Error(a);const i=r.points[t];if(!i)throw new Error(a);const o=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=r.within(i.x,i.y,o),l=[];for(const t of s){const n=r.points[t];n.parentId===e&&l.push(n.numPoints?X(n):this.points[n.index])}if(0===l.length)throw new Error(a);return l}getLeaves(e,t,n){const a=[];return this._appendLeaves(a,e,t=t||10,n=n||0,0),a}getTile(e,t,n){const a=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:i,radius:o}=this.options,s=o/i,l=(n-s)/r,c=(n+1+s)/r,u={features:[]};return this._addTileFeatures(a.range((t-s)/r,l,(t+1+s)/r,c),a.points,t,n,r,u),0===t&&this._addTileFeatures(a.range(1-s/r,l,1,c),a.points,r,n,r,u),t===r-1&&this._addTileFeatures(a.range(0,l,s/r,c),a.points,-1,n,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const n=this.getChildren(e);if(t++,1!==n.length)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,a,r){const i=this.getChildren(t);for(const t of i){const i=t.properties;if(i&&i.cluster?r+i.point_count<=a?r+=i.point_count:r=this._appendLeaves(e,i.cluster_id,n,a,r):r<a?r++:e.push(t),e.length===n)break}return r}_addTileFeatures(e,t,n,a,r,i){for(const o of e){const e=t[o],s=e.numPoints;let l,c,u;if(s)l=Y(e),c=e.x,u=e.y;else{const t=this.points[e.index];l=t.properties,c=H(t.geometry.coordinates[0]),u=U(t.geometry.coordinates[1])}const d={type:1,geometry:[[Math.round(this.options.extent*(c*r-n)),Math.round(this.options.extent*(u*r-a))]],tags:l};let p;s?p=e.id:this.options.generateId?p=e.index:this.points[e.index].id&&(p=this.points[e.index].id),void 0!==p&&(d.id=p),i.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const n=[],{radius:a,extent:r,reduce:i,minPoints:o}=this.options,s=a/(r*Math.pow(2,t));for(let a=0;a<e.length;a++){const r=e[a];if(r.zoom<=t)continue;r.zoom=t;const l=this.trees[t+1],c=l.within(r.x,r.y,s),u=r.numPoints||1;let d=u;for(const e of c){const n=l.points[e];n.zoom>t&&(d+=n.numPoints||1)}if(d>u&&d>=o){let e=r.x*u,o=r.y*u,s=i&&u>1?this._map(r,!0):null;const p=(a<<5)+(t+1)+this.points.length;for(const n of c){const a=l.points[n];if(a.zoom<=t)continue;a.zoom=t;const c=a.numPoints||1;e+=a.x*c,o+=a.y*c,a.parentId=p,i&&(s||(s=this._map(r,!0)),i(s,this._map(a)))}r.parentId=p,n.push($(e/d,o/d,p,d,s))}else if(n.push(r),d>1)for(const e of c){const a=l.points[e];a.zoom<=t||(a.zoom=t,n.push(a))}}return n}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t){if(e.numPoints)return t?G({},e.properties):e.properties;const n=this.points[e.index].properties,a=this.options.map(n);return t&&a===n?G({},a):a}}function $(e,t,n,a,r){return{x:P(e),y:P(t),zoom:1/0,id:n,parentId:-1,numPoints:a,properties:r}}function F(e,t){const[n,a]=e.geometry.coordinates;return{x:P(H(n)),y:P(U(a)),zoom:1/0,index:t,parentId:-1}}function X(e){return{type:"Feature",id:e.id,properties:Y(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),V(e.y)]}};var t}function Y(e){const t=e.numPoints,n=t>=1e4?Math.round(t/1e3)+"k":t>=1e3?Math.round(t/100)/10+"k":t;return G(G({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:n})}function H(e){return e/360+.5}function U(e){const t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function V(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function G(e,t){for(const n in t)e[n]=t[n];return e}function K(e){return e.x}function J(e){return e.y}function Z(e,t,n,a,r,i){var o=r-n,s=i-a;if(0!==o||0!==s){var l=((e-n)*o+(t-a)*s)/(o*o+s*s);l>1?(n=r,a=i):l>0&&(n+=o*l,a+=s*l)}return(o=e-n)*o+(s=t-a)*s}function Q(e,t,n,a){var r={id:void 0===e?null:e,type:t,geometry:n,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)ee(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var a=0;a<t.length;a++)ee(e,t[a]);else if("MultiPolygon"===n)for(a=0;a<t.length;a++)for(var r=0;r<t[a].length;r++)ee(e,t[a][r])}(r),r}function ee(e,t){for(var n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function te(e,t,n,a){if(t.geometry){var r=t.geometry.coordinates,i=t.geometry.type,o=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),s=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=a||0),"Point"===i)ne(r,s);else if("MultiPoint"===i)for(var c=0;c<r.length;c++)ne(r[c],s);else if("LineString"===i)ae(r,s,o,!1);else if("MultiLineString"===i){if(n.lineMetrics){for(c=0;c<r.length;c++)ae(r[c],s=[],o,!1),e.push(Q(l,"LineString",s,t.properties));return}re(r,s,o,!1)}else if("Polygon"===i)re(r,s,o,!0);else{if("MultiPolygon"!==i){if("GeometryCollection"===i){for(c=0;c<t.geometry.geometries.length;c++)te(e,{id:l,geometry:t.geometry.geometries[c],properties:t.properties},n,a);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<r.length;c++){var u=[];re(r[c],u,o,!0),s.push(u)}}e.push(Q(l,i,s,t.properties))}}function ne(e,t){t.push(ie(e[0])),t.push(oe(e[1])),t.push(0)}function ae(e,t,n,a){for(var r,i,o=0,s=0;s<e.length;s++){var l=ie(e[s][0]),c=oe(e[s][1]);t.push(l),t.push(c),t.push(0),s>0&&(o+=a?(r*c-l*i)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-i,2))),r=l,i=c}var u=t.length-3;t[2]=1,function e(t,n,a,r){for(var i,o=r,s=a-n>>1,l=a-n,c=t[n],u=t[n+1],d=t[a],p=t[a+1],m=n+3;m<a;m+=3){var b=Z(t[m],t[m+1],c,u,d,p);if(b>o)i=m,o=b;else if(b===o){var h=Math.abs(m-s);h<l&&(i=m,l=h)}}o>r&&(i-n>3&&e(t,n,i,r),t[i+2]=o,a-i>3&&e(t,i,a,r))}(t,0,u,n),t[u+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function re(e,t,n,a){for(var r=0;r<e.length;r++){var i=[];ae(e[r],i,n,a),t.push(i)}}function ie(e){return e/360+.5}function oe(e){var t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function se(e,t,n,a,r,i,o,s){if(a/=t,i>=(n/=t)&&o<a)return e;if(o<n||i>=a)return null;for(var l=[],c=0;c<e.length;c++){var u=e[c],d=u.geometry,p=u.type,m=0===r?u.minX:u.minY,b=0===r?u.maxX:u.maxY;if(m>=n&&b<a)l.push(u);else if(!(b<n||m>=a)){var h=[];if("Point"===p||"MultiPoint"===p)le(d,h,n,a,r);else if("LineString"===p)ce(d,h,n,a,r,!1,s.lineMetrics);else if("MultiLineString"===p)de(d,h,n,a,r,!1);else if("Polygon"===p)de(d,h,n,a,r,!0);else if("MultiPolygon"===p)for(var f=0;f<d.length;f++){var g=[];de(d[f],g,n,a,r,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&"LineString"===p){for(f=0;f<h.length;f++)l.push(Q(u.id,p,h[f],u.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===h.length?(p="LineString",h=h[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===h.length?"Point":"MultiPoint"),l.push(Q(u.id,p,h,u.tags))}}}return l.length?l:null}function le(e,t,n,a,r){for(var i=0;i<e.length;i+=3){var o=e[i+r];o>=n&&o<=a&&(t.push(e[i]),t.push(e[i+1]),t.push(e[i+2]))}}function ce(e,t,n,a,r,i,o){for(var s,l,c=ue(e),u=0===r?me:be,d=e.start,p=0;p<e.length-3;p+=3){var m=e[p],b=e[p+1],h=e[p+2],f=e[p+3],g=e[p+4],_=0===r?m:b,y=0===r?f:g,M=!1;o&&(s=Math.sqrt(Math.pow(m-f,2)+Math.pow(b-g,2))),_<n?y>n&&(l=u(c,m,b,f,g,n),o&&(c.start=d+s*l)):_>a?y<a&&(l=u(c,m,b,f,g,a),o&&(c.start=d+s*l)):pe(c,m,b,h),y<n&&_>=n&&(l=u(c,m,b,f,g,n),M=!0),y>a&&_<=a&&(l=u(c,m,b,f,g,a),M=!0),!i&&M&&(o&&(c.end=d+s*l),t.push(c),c=ue(e)),o&&(d+=s)}var v=e.length-3;m=e[v],b=e[v+1],h=e[v+2],(_=0===r?m:b)>=n&&_<=a&&pe(c,m,b,h),v=c.length-3,i&&v>=3&&(c[v]!==c[0]||c[v+1]!==c[1])&&pe(c,c[0],c[1],c[2]),c.length&&t.push(c)}function ue(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function de(e,t,n,a,r,i){for(var o=0;o<e.length;o++)ce(e[o],t,n,a,r,i,!1)}function pe(e,t,n,a){e.push(t),e.push(n),e.push(a)}function me(e,t,n,a,r,i){var o=(i-t)/(a-t);return e.push(i),e.push(n+(r-n)*o),e.push(1),o}function be(e,t,n,a,r,i){var o=(i-n)/(r-n);return e.push(t+(a-t)*o),e.push(i),e.push(1),o}function he(e,t){for(var n=[],a=0;a<e.length;a++){var r,i=e[a],o=i.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=fe(i.geometry,t);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var s=0;s<i.geometry.length;s++)r.push(fe(i.geometry[s],t))}else if("MultiPolygon"===o)for(r=[],s=0;s<i.geometry.length;s++){for(var l=[],c=0;c<i.geometry[s].length;c++)l.push(fe(i.geometry[s][c],t));r.push(l)}n.push(Q(i.id,o,r,i.tags))}return n}function fe(e,t){var n=[];n.size=e.size,void 0!==e.start&&(n.start=e.start,n.end=e.end);for(var a=0;a<e.length;a+=3)n.push(e[a]+t,e[a+1],e[a+2]);return n}function ge(e,t){if(e.transformed)return e;var n,a,r,i=1<<e.z,o=e.x,s=e.y;for(n=0;n<e.features.length;n++){var l=e.features[n],c=l.geometry,u=l.type;if(l.geometry=[],1===u)for(a=0;a<c.length;a+=2)l.geometry.push(_e(c[a],c[a+1],t,i,o,s));else for(a=0;a<c.length;a++){var d=[];for(r=0;r<c[a].length;r+=2)d.push(_e(c[a][r],c[a][r+1],t,i,o,s));l.geometry.push(d)}}return e.transformed=!0,e}function _e(e,t,n,a,r,i){return[Math.round(n*(e*a-r)),Math.round(n*(t*a-i))]}function ye(e,t,n,a,r){for(var i=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:a,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){o.numFeatures++,Me(o,e[s],i,r);var l=e[s].minX,c=e[s].minY,u=e[s].maxX,d=e[s].maxY;l<o.minX&&(o.minX=l),c<o.minY&&(o.minY=c),u>o.maxX&&(o.maxX=u),d>o.maxY&&(o.maxY=d)}return o}function Me(e,t,n,a){var r=t.geometry,i=t.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s<r.length;s+=3)o.push(r[s]),o.push(r[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===i)ve(o,r,e,n,!1,!1);else if("MultiLineString"===i||"Polygon"===i)for(s=0;s<r.length;s++)ve(o,r[s],e,n,"Polygon"===i,0===s);else if("MultiPolygon"===i)for(var l=0;l<r.length;l++){var c=r[l];for(s=0;s<c.length;s++)ve(o,c[s],e,n,!0,0===s)}if(o.length){var u=t.tags||null;if("LineString"===i&&a.lineMetrics){for(var d in u={},t.tags)u[d]=t.tags[d];u.mapbox_clip_start=r.start/r.size,u.mapbox_clip_end=r.end/r.size}var p={geometry:o,type:"Polygon"===i||"MultiPolygon"===i?3:"LineString"===i||"MultiLineString"===i?2:1,tags:u};null!==t.id&&(p.id=t.id),e.features.push(p)}}function ve(e,t,n,a,r,i){var o=a*a;if(a>0&&t.size<(r?o:a))n.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===a||t[l+2]>o)&&(n.numSimplified++,s.push(t[l]),s.push(t[l+1])),n.numPoints++;r&&function(e,t){for(var n=0,a=0,r=e.length,i=r-2;a<r;i=a,a+=2)n+=(e[a]-e[i])*(e[a+1]+e[i+1]);if(n>0===t)for(a=0,r=e.length;a<r/2;a+=2){var o=e[a],s=e[a+1];e[a]=e[r-2-a],e[a+1]=e[r-1-a],e[r-2-a]=o,e[r-1-a]=s}}(s,i),e.push(s)}}function ze(e,t){var n=(t=this.options=function(e,t){for(var n in t)e[n]=t[n];return e}(Object.create(this.options),t)).debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var a=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var a=0;a<e.features.length;a++)te(n,e.features[a],t,a);else te(n,"Feature"===e.type?e:{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=function(e,t){var n=t.buffer/t.extent,a=e,r=se(e,1,-1-n,n,0,-1,2,t),i=se(e,1,1-n,2+n,0,-1,2,t);return(r||i)&&(a=se(e,1,-n,1+n,0,-1,2,t)||[],r&&(a=he(r,1).concat(a)),i&&(a=a.concat(he(i,-1)))),a}(a,t)).length&&this.splitTile(a,0,0,0),n&&(a.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 Oe(e,t,n){return 32*((1<<e)*n+t)+e}function ke(e,t){const n=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);const a=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!a)return t(null,null);const r=new b(a.features);let i=h.exports(r);0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),t(null,{vectorTile:r,rawData:i.buffer})}ze.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ze.prototype.splitTile=function(e,t,n,a,r,i,o){for(var s=[e,t,n,a],l=this.options,c=l.debug;s.length;){a=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();var u=1<<t,d=Oe(t,n,a),p=this.tiles[d];if(!p&&(c>1&&console.time("creation"),p=this.tiles[d]=ye(e,t,n,a,l),this.tileCoords.push({z:t,x:n,y:a}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,a,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var m="z"+t;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(p.source=e,r){if(t===l.maxZoom||t===r)continue;var b=1<<r-t;if(n!==Math.floor(i/b)||a!==Math.floor(o/b))continue}else if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==e.length){c>1&&console.time("clipping");var h,f,g,_,y,M,v=.5*l.buffer/l.extent,z=.5-v,O=.5+v,k=1+v;h=f=g=_=null,y=se(e,u,n-v,n+O,0,p.minX,p.maxX,l),M=se(e,u,n+z,n+k,0,p.minX,p.maxX,l),e=null,y&&(h=se(y,u,a-v,a+O,1,p.minY,p.maxY,l),f=se(y,u,a+z,a+k,1,p.minY,p.maxY,l),y=null),M&&(g=se(M,u,a-v,a+O,1,p.minY,p.maxY,l),_=se(M,u,a+z,a+k,1,p.minY,p.maxY,l),M=null),c>1&&console.timeEnd("clipping"),s.push(h||[],t+1,2*n,2*a),s.push(f||[],t+1,2*n,2*a+1),s.push(g||[],t+1,2*n+1,2*a),s.push(_||[],t+1,2*n+1,2*a+1)}}},ze.prototype.getTile=function(e,t,n){var a=this.options,r=a.extent,i=a.debug;if(e<0||e>24)return null;var o=1<<e,s=Oe(e,t=(t%o+o)%o,n);if(this.tiles[s])return ge(this.tiles[s],r);i>1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,c=e,u=t,d=n;!l&&c>0;)c--,u=Math.floor(u/2),d=Math.floor(d/2),l=this.tiles[Oe(c,u,d)];return l&&l.source?(i>1&&console.log("found parent tile z%d-%d-%d",c,u,d),i>1&&console.time("drilling down"),this.splitTile(l.source,c,u,d,e,t,n),i>1&&console.timeEnd("drilling down"),this.tiles[s]?ge(this.tiles[s],r):null):null};class Ae extends l{constructor(e,t,n,a){super(e,t,n,ke),a&&(this.loadGeoJSON=a)}loadData(t,n){var a;null===(a=this._pendingRequest)||void 0===a||a.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(t,(a,i)=>{if(delete this._pendingCallback,delete this._pendingRequest,a||!i)return n(a);if("object"!=typeof i)return n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{!function e(t,n){var a,r=t&&t.type;if("FeatureCollection"===r)for(a=0;a<t.features.length;a++)e(t.features[a],n);else if("GeometryCollection"===r)for(a=0;a<t.geometries.length;a++)e(t.geometries[a],n);else if("Feature"===r)e(t.geometry,n);else if("Polygon"===r)u(t.coordinates,n);else if("MultiPolygon"===r)for(a=0;a<t.coordinates.length;a++)u(t.coordinates[a],n);return t}(i,!0);try{if(t.filter){const n=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));const a=i.features.filter(e=>n.value.evaluate({zoom:0},e));i={type:"FeatureCollection",features:a}}this._geoJSONIndex=t.cluster?new I(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;const a={},r={},i={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(const t of s){const[i,o]=n[t],s=e.createExpression(o),l=e.createExpression("string"==typeof i?[i,["accumulated"],["get",t]]:i);a[t]=s.value,r[t]=l.value}return t.map=e=>{o.properties=e;const t={};for(const e of s)t[e]=a[e].evaluate(i,o);return t},t.reduce=(e,t)=>{o.properties=t;for(const t of s)i.accumulated=e[t],e[t]=r[t].evaluate(i,o)},t}(t)).load(i.features):function(e,t){return new ze(e,t)}(i,t.geojsonVtOptions)}catch(a){return n(a)}this.loaded={};const o={};if(r){const e=r.finish();e&&(o.resourceTiming={},o.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}n(null,o)}})}reloadTile(e,t){const n=this.loaded;return n&&n[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,n){if(t.request)return e.getJSON(t.request,n);if("string"==typeof t.data)try{n(null,JSON.parse(t.data))}catch(e){n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}else n(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t()}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class xe{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:Ae},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}setReferrer(e,t){this.referrer=t}setImages(e,t,n){this.availableImages[e]=t;for(const n in this.workerSources[e]){const a=this.workerSources[e][n];for(const e in a)a[e].availableImages=t}n()}setLayers(e,t,n){this.getLayerIndex(e).replace(t),n()}updateLayers(e,t,n){this.getLayerIndex(e).update(t.layers,t.removedIds),n()}loadTile(e,t,n){this.getWorkerSource(e,t.type,t.source).loadTile(t,n)}loadDEMTile(e,t,n){this.getDEMWorkerSource(e,t.source).loadTile(t,n)}reloadTile(e,t,n){this.getWorkerSource(e,t.type,t.source).reloadTile(t,n)}abortTile(e,t,n){this.getWorkerSource(e,t.type,t.source).abortTile(t,n)}removeTile(e,t,n){this.getWorkerSource(e,t.type,t.source).removeTile(t,n)}removeDEMTile(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t)}removeSource(e,t,n){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const a=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==a.removeSource?a.removeSource(t,n):n()}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,a){try{e.plugin.setState(n);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const n=e.plugin.isParsed();a(n?void 0:new Error("RTL Text Plugin failed to import scripts from "+t),n)}}catch(e){a(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new a),t}getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){const a={send:(t,n,a)=>{this.actor.send(t,n,a,e)}};this.workerSources[e][t][n]=new this.workerSourceTypes[t](a,this.getLayerIndex(e),this.getAvailableImages(e))}return this.workerSources[e][t][n]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new c),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,n){e.enforceCacheSizeLimit(n)}}return e.isWorker()&&(self.worker=new xe(self)),xe})),a(0,(function(e){var t=n;function n(e){return!function(e){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,n=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(n);try{t=new Worker(a),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(a),e}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var n=t.getImageData(0,0,1,1);return n&&n.width===e.width}()?(void 0===a[t=e&&e.failIfMajorPerformanceCaveat]&&(a[t]=function(e){var t,a=function(e){var t=document.createElement("canvas"),a=Object.create(n.webGLContextAttributes);return a.failIfMajorPerformanceCaveat=e,t.getContext("webgl",a)||t.getContext("experimental-webgl",a)}(e);if(!a)return!1;try{t=a.createShader(a.VERTEX_SHADER)}catch(e){return!1}return!(!t||a.isContextLost())&&(a.shaderSource(t,"void main() {}"),a.compileShader(t),!0===a.getShaderParameter(t,a.COMPILE_STATUS))}(t)),a[t]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var t}(e)}var a={};function r(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!r(e[n],t[n]))return!1;return!0}return e===t}n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class i{static testProp(e){if(!i.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in i.docStyle)return e[t];return e[0]}static create(e,t,n){const a=window.document.createElement(e);return void 0!==t&&(a.className=t),n&&n.appendChild(a),a}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]="none")}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect)}static setTransform(e,t){e.style[i.transformProp]=t}static addEventListener(e,t,n,a={}){e.addEventListener(t,n,"passive"in a?a:a.capture)}static removeEventListener(e,t,n,a={}){e.removeEventListener(t,n,"passive"in a?a:a.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",i.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",i.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",i.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new e.pointGeometry(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),r=[];for(let i=0;i<n.length;i++)r.push(new e.pointGeometry(n[i].clientX-a.left-t.clientLeft,n[i].clientY-a.top-t.clientTop));return r}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}i.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),i.transformProp=i.testProp(["transform","WebkitTransform"]);class o{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeSpriteURL(e,t,n){const a=function(e){const t=e.match(s);if(!t)throw new Error(`Unable to parse URL "${e}"`);return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}(e);return a.path+=`${t}${n}`,function(e){const t=e.params.length?"?"+e.params.join("&"):"";return`${e.protocol}://${e.authority}${e.path}${t}`}(a)}setTransformRequest(e){this._transformRequestFn=e}}const s=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class l{constructor(e,t,n,a){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,a)}update(t,n,a){const{width:r,height:i}=t,o=!(this.size&&this.size[0]===r&&this.size[1]===i||a),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(n&&n.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!n||!1!==n.premultiply)),o)this.size=[r,i],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.isImageBitmap(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,r,i,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:n,y:o}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.isImageBitmap(t)?l.texSubImage2D(l.TEXTURE_2D,0,n,o,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,n,o,r,i,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,n){const{context:a}=this,{gl:r}=a;r.bindTexture(r.TEXTURE_2D,this.texture),n!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=r.LINEAR),e!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function c(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class u extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}getImage(e){return this.images[e]}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(t,n){let a=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(e,t){if(!e)return!0;let n=0;for(const a of e){if(a[0]<n||a[1]<a[0]||t<a[1])return!1;n=a[1]}return!0}_validateContent(e,t){return!(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,t){const n=this.images[e];if(n.data.width!==t.data.width||n.data.height!==t.data.height)throw new Error(`size mismatch between old image (${n.data.width}x${n.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=n.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){const t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,t){let n=!0;if(!this.isLoaded())for(const t of e)this.images[t]||(n=!1);this.isLoaded()||n?this._notify(e,t):this.requestors.push({ids:e,callback:t})}_notify(t,n){const a={};for(const n of t){this.images[n]||this.fire(new e.Event("styleimagemissing",{id:n}));const t=this.images[n];t?a[n]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.warnOnce(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,a)}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const n={w:a.data.width+2,h:a.data.height+2,x:0,y:0},r=new e.ImagePosition(n,a);this.patterns[t]={bin:n,position:r}}return this._updatePatternAtlas(),this.patterns[t].position}bind(e){const t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new l(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:n,h:a}=e.potpack(t),r=this.atlasImage;r.resize({width:n||1,height:a||1});for(const t in this.patterns){const{bin:n}=this.patterns[t],a=n.x+1,i=n.y+1,o=this.images[t].data,s=o.width,l=o.height;e.RGBAImage.copy(o,r,{x:0,y:0},{x:a,y:i},{width:s,height:l}),e.RGBAImage.copy(o,r,{x:0,y:l-1},{x:a,y:i-1},{width:s,height:1}),e.RGBAImage.copy(o,r,{x:0,y:0},{x:a,y:i+l},{width:s,height:1}),e.RGBAImage.copy(o,r,{x:s-1,y:0},{x:a-1,y:i},{width:1,height:l}),e.RGBAImage.copy(o,r,{x:0,y:0},{x:a+s,y:i},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const t=this.images[n];t||e.warnOnce(`Image with ID: "${n}" was not found`),c(t)&&this.updateImage(n,t)}}}const d=1e20;function p(e,t,n,a,r,i,o,s,l){for(let c=t;c<t+a;c++)m(e,n*i+c,i,r,o,s,l);for(let c=n;c<n+r;c++)m(e,c*i+t,1,a,o,s,l)}function m(e,t,n,a,r,i,o){i[0]=0,o[0]=-d,o[1]=d,r[0]=e[t];for(let s=1,l=0,c=0;s<a;s++){r[s]=e[t+s*n];const a=s*s;do{const e=i[l];c=(r[s]-r[e]+a-e*e)/(s-e)/2}while(c<=o[l]&&--l>-1);l++,i[l]=s,o[l]=c,o[l+1]=d}for(let s=0,l=0;s<a;s++){for(;o[l+1]<s;)l++;const a=i[l],c=s-a;e[t+s*n]=r[a]+c*c}}class b{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(t,n){const a=[];for(const e in t)for(const n of t[e])a.push({stack:e,id:n});e.asyncAll(a,({stack:e,id:t},n)=>{let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}});let r=a.glyphs[t];if(void 0!==r)return void n(null,{stack:e,id:t,glyph:r});if(r=this._tinySDF(a,e,t),r)return a.glyphs[t]=r,void n(null,{stack:e,id:t,glyph:r});const i=Math.floor(t/256);if(256*i>65535)return void n(new Error("glyphs > 65535 not supported"));if(a.ranges[i])return void n(null,{stack:e,id:t,glyph:r});let o=a.requests[i];o||(o=a.requests[i]=[],b.loadGlyphRange(e,i,this.url,this.requestManager,(e,t)=>{if(t){for(const e in t)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=t[+e]);a.ranges[i]=!0}for(const n of o)n(e,t);delete a.requests[i]})),o.push((a,r)=>{a?n(a):r&&n(null,{stack:e,id:t,glyph:r[t]||null})})},(e,t)=>{if(e)n(e);else if(t){const e={};for(const{stack:n,id:a,glyph:r}of t)(e[n]||(e[n]={}))[a]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};n(null,e)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(e.unicodeBlockLookup["CJK Unified Ideographs"](t)||e.unicodeBlockLookup["Hangul Syllables"](t)||e.unicodeBlockLookup.Hiragana(t)||e.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(a))return;let i=t.tinySDF;if(!i){let e="400";/bold/i.test(n)?e="900":/medium/i.test(n)?e="500":/light/i.test(n)&&(e="200"),i=t.tinySDF=new b.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:e})}const o=i.draw(String.fromCharCode(a));return{id:a,bitmap:new e.AlphaImage({width:o.width||30,height:o.height||30},o.data),metrics:{width:o.glyphWidth||24,height:o.glyphHeight||24,left:o.glyphLeft||0,top:o.glyphTop-27||-8,advance:o.glyphAdvance||24}}}}b.loadGlyphRange=function(t,n,a,r,i){const o=256*n,s=o+255,l=r.transformRequest(a.replace("{fontstack}",t).replace("{range}",`${o}-${s}`),e.ResourceType.Glyphs);e.getArrayBuffer(l,(t,n)=>{if(t)i(t);else if(n){const t={};for(const a of e.parseGlyphPbf(n))t[a.id]=a;i(null,t)}})},b.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:r="sans-serif",fontWeight:i="normal",fontStyle:o="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const s=this.size=e+4*t,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${i} ${e}px ${r}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:r,actualBoundingBoxRight:i}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.min(this.size-this.buffer,Math.ceil(i-r)),l=Math.min(this.size-this.buffer,o+Math.ceil(a)),c=s+2*this.buffer,u=l+2*this.buffer,m=Math.max(c*u,0),b=new Uint8ClampedArray(m),h={data:b,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return h;const{ctx:f,buffer:g,gridInner:_,gridOuter:y}=this;f.clearRect(g,g,s,l),f.fillText(e,g,g+o);const M=f.getImageData(g,g,s,l);y.fill(d,0,m),_.fill(0,0,m);for(let e=0;e<l;e++)for(let t=0;t<s;t++){const n=M.data[4*(e*s+t)+3]/255;if(0===n)continue;const a=(e+g)*c+t+g;if(1===n)y[a]=0,_[a]=d;else{const e=.5-n;y[a]=e>0?e*e:0,_[a]=e<0?e*e:0}}p(y,0,0,c,u,c,this.f,this.v,this.z),p(_,g,g,s,l,c,this.f,this.v,this.z);for(let e=0;e<m;e++){const t=Math.sqrt(y[e])-Math.sqrt(_[e]);b[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return h}};const h=new e.Properties({anchor:new e.DataConstantProperty(e.spec.light.anchor),position:new class{constructor(){this.specification=e.spec.light.position}possiblyEvaluate(t,n){return e.sphericalToCartesian(t.expression.evaluate(n))}interpolate(t,n,a){return{x:e.number(t.x,n.x,a),y:e.number(t.y,n.y,a),z:e.number(t.z,n.z,a)}}},color:new e.DataConstantProperty(e.spec.light.color),intensity:new e.DataConstantProperty(e.spec.light.intensity)}),f="-transition";class g extends e.Evented{constructor(t){super(),this._transitionable=new e.Transitionable(h),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(e.validateLight,t,n))for(const e in t){const n=t[e];e.endsWith(f)?this._transitionable.setTransition(e.slice(0,-f.length),n):this._transitionable.setValue(e,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,n,a){return(!a||!1!==a.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}class _{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){const n=e.join(",")+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){const a=[];let r=e.length%2==1?-e[e.length-1]*n:0,i=e[0]*n,o=!0;a.push({left:r,right:i,isDash:o,zeroLength:0===e[0]});let s=e[0];for(let t=1;t<e.length;t++){o=!o;const l=e[t];r=s*n,s+=l,i=s*n,a.push({left:r,right:i,isDash:o,zeroLength:0===l})}return a}addRoundDash(e,t,n){const a=t/2;for(let t=-n;t<=n;t++){const r=this.width*(this.nextRow+n+t);let i=0,o=e[i];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++i]);const l=Math.abs(s-o.left),c=Math.abs(s-o.right),u=Math.min(l,c);let d;const p=t/n*(a+1);if(o.isDash){const e=a-Math.abs(p);d=Math.sqrt(u*u+e*e)}else d=a-Math.sqrt(u*u+p*p);this.data[r+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const n=e[t],a=e[t+1];n.zeroLength?e.splice(t,1):a&&a.isDash===n.isDash&&(a.left=n.left,e.splice(t,1))}const t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);const a=this.width*this.nextRow;let r=0,i=e[r];for(let t=0;t<this.width;t++){t/i.right>1&&(i=e[++r]);const n=Math.abs(t-i.left),o=Math.abs(t-i.right),s=Math.min(n,o);this.data[a+t]=Math.max(0,Math.min(255,(i.isDash?s:-s)+128))}}addDash(t,n){const a=n?7:0,r=2*a+1;if(this.nextRow+r>this.height)return e.warnOnce("LineAtlas out of space"),null;let i=0;for(let e=0;e<t.length;e++)i+=t[e];if(0!==i){const e=this.width/i,r=this.getDashRanges(t,this.width,e);n?this.addRoundDash(r,e,a):this.addRegularDash(r)}const o={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:i};return this.nextRow+=r,this.dirty=!0,o}bind(e){const t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}class y{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e.uniqueId();const a=this.workerPool.acquire(this.id);for(let e=0;e<a.length;e++){const t=new y.Actor(a[e],n,this.id);t.name="Worker "+e,this.actors.push(t)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,a){e.asyncAll(this.actors,(e,a)=>{e.send(t,n,a)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function M(t,n,a){const r=function(n,r){if(n)return a(n);if(r){const n=e.pick(e.extend(r,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(n.vectorLayers=r.vector_layers,n.vectorLayerIds=n.vectorLayers.map(e=>e.id)),a(null,n)}};return t.url?e.getJSON(n.transformRequest(t.url,e.ResourceType.Source),r):e.exported.frame(()=>r(null,t))}y.Actor=e.Actor;class v{constructor(t,n,a){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*n),r=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*n),i=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*n),o=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x<i&&t.y>=r&&t.y<o}}class z extends e.Evented{constructor(t,n,a,r){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.extend(this,e.pick(n,["url","scheme","tileSize","promoteId"])),this._options=e.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=M(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new e.ErrorEvent(t)):n&&(e.extend(this,n),n.bounds&&(this.tileBounds=new v(n.bounds,this.minzoom,this.maxzoom)),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(a,e.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function i(a,r){return delete t.request,t.aborted?n(null):a&&404!==a.status?n(a):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=n:t.request=t.actor.send("reloadTile",r,i.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,i.bind(this)))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class O extends e.Evented{constructor(t,n,a,r){super(),this.id=t,this.dispatcher=a,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.extend({type:"raster"},n),e.extend(this,e.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=M(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):n&&(e.extend(this,n),n.bounds&&(this.tileBounds=new v(n.bounds,this.minzoom,this.maxzoom)),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),(a,r,i)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(a)t.state="errored",n(a);else if(r){this.map._refreshExpiredTiles&&t.setExpiryData(i);const a=this.map.painter.context,o=a.gl;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new l(a,r,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),t.state="loaded",e.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}}let k;class A extends O{constructor(t,n,a,r){super(t,n,a,r),this.type="raster-dem",this.maxzoom=22,this._options=e.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function r(e,a){e&&(t.state="errored",n(e)),a&&(t.dem=a,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),function(a,i){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(a)t.state="errored",n(a);else if(i){this.map._refreshExpiredTiles&&t.setExpiryData(i),delete i.cacheControl,delete i.expires;const n=e.isImageBitmap(i)&&(null==k&&(k="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),k)?i:e.exported.getImageData(i,1),a={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:n,encoding:this.encoding};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",a,r.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),r=(n.x-1+a)%a,i=0===n.x?t.wrap-1:t.wrap,o=(n.x+1+a)%a,s=n.x+1===a?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,i,n.z,r,n.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,i,n.z,r,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<a&&(l[new e.OverscaledTileID(t.overscaledZ,i,n.z,r,n.y+1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),l}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}}class x extends e.Evented{constructor(t,n,a,r){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(r),this._data=n.data,this._options=e.extend({},n),this._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const i=e.EXTENT/this.tileSize;this.workerOptions=e.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*i,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*i,extent:e.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:e.EXTENT,radius:(n.clusterRadius||50)*i,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData("content"),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},t),this}getClusterLeaves(e,t,n,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:n},a),this}_updateWorkerData(t){const n=e.extend({},this.workerOptions),a=this._data;"string"==typeof a?(n.request=this.map._requestManager.transformRequest(e.exported.resolveURL(a),e.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(a),this._pendingLoads++,this.fire(new e.Event("dataloading",{dataType:"source"})),this.actor.send(this.type+".loadData",n,(n,a)=>{if(this._pendingLoads--,this._removed||a&&a.abandoned)return void this.fire(new e.Event("dataabort",{dataType:"source",sourceDataType:t}));let r=null;if(a&&a.resourceTiming&&a.resourceTiming[this.id]&&(r=a.resourceTiming[this.id].slice(0)),n)return void this.fire(new e.ErrorEvent(n));const i={dataType:"source",sourceDataType:t};this._collectResourceTiming&&r&&r.length>0&&e.extend(i,{resourceTiming:r}),this.fire(new e.Event("data",i))})}loaded(){return 0===this._pendingLoads}loadTile(e,t){const n=e.actor?"reloadTile":"loadTile";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(n,a,(a,r)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):a?t(a):(e.loadVectorData(r,this.map.painter,"reloadTile"===n),t(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return e.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var w=e.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class N extends e.Evented{constructor(e,t,n,a){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=t}load(t,n){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),(a,r)=>{this._loaded=!0,a?this.fire(new e.ErrorEvent(a)):r&&(this.image=r,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(e.MercatorCoordinate.fromLngLat);this.tileID=function(t){let n=1/0,a=1/0,r=-1/0,i=-1/0;for(const e of t)n=Math.min(n,e.x),a=Math.min(a,e.y),r=Math.max(r,e.x),i=Math.max(i,e.y);const o=Math.max(r-n,i-a),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,s);return new e.CanonicalTileID(s,Math.floor((n+r)/2*l),Math.floor((a+i)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(e=>this.tileID.getTilePoint(e)._round());return this._boundsArray=new e.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,e.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,e.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,e.EXTENT,e.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,w.members)),this.boundsSegments||(this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new l(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class q extends N{constructor(e,t,n,a){super(e,t,n,a),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,e.ResourceType.Source).url);e.getVideo(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):n&&(this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError("sources."+this.id,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,w.members)),this.boundsSegments||(this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new l(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class E extends N{constructor(t,n,a,r){super(t,n,a,r),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof HTMLCanvasElement||this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.ErrorEvent(new e.ValidationError("sources."+t,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,w.members)),this.boundsSegments||(this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l(n,this.canvas,a.RGBA,{premultiply:!0});for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const j={vector:z,raster:O,"raster-dem":A,geojson:x,video:q,image:N,canvas:E};function W(t,n){const a=e.create();return e.translate(a,a,[1,1,0]),e.scale(a,a,[.5*t.width,.5*t.height,1]),e.multiply(a,a,t.calculatePosMatrix(n.toUnwrapped()))}function L(e,t,n,a,r,i){const o=function(e,t,n){if(e)for(const a of e){const e=t[a];if(e&&e.source===n&&"fill-extrusion"===e.type)return!0}else for(const e in t){const a=t[e];if(a.source===n&&"fill-extrusion"===a.type)return!0}return!1}(r&&r.layers,t,e.id),s=i.maxPitchScaleFactor(),l=e.tilesIn(a,s,o);l.sort(S);const c=[];for(const a of l)c.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(t,n,e._state,a.queryGeometry,a.cameraQueryGeometry,a.scale,r,i,s,W(e.transform,a.tileID))});const u=function(e){const t={},n={};for(const a of e){const e=a.queryResults,r=a.wrappedTileID,i=n[r]=n[r]||{};for(const n in e){const a=e[n],r=i[n]=i[n]||{},o=t[n]=t[n]||[];for(const e of a)r[e.featureIndex]||(r[e.featureIndex]=!0,o.push(e))}}return t}(c);for(const t in u)u[t].forEach(t=>{const n=t.feature,a=e.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a});return u}function S(e,t){const n=e.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class T{constructor(t,n){this.tileID=t,this.uid=e.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<e.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.textures.forEach(t=>e.saveTileTexture(t)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(e,t){const n={};if(!t)return n;for(const a of e){const e=a.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){a.layers=e,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)n[t.id]=a}}return n}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const n=this.buckets[t];if(n instanceof e.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const n=this.buckets[t];if(n instanceof e.SymbolBucket&&n.hasRTLText){this.hasRTLText=!0,e.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.CollisionBoxArray}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const n=this.buckets[t];n.uploadPending()&&n.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,a,r,i,o,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:r,scale:i,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:o,queryPadding:this.queryPadding*l},e,t,n):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const r=a.loadVTLayers(),i=n?n.sourceLayer:"",o=r._geojsonTileLayer||r[i];if(!o)return;const s=e.createFilter(n&&n.filter),{z:l,x:c,y:u}=this.tileID.canonical,d={z:l,x:c,y:u};for(let n=0;n<o.length;n++){const r=o.feature(n);if(s.needGeometry){const t=e.toEvaluationFeature(r,!0);if(!s.filter(new e.EvaluationParameters(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new e.EvaluationParameters(this.tileID.overscaledZ),r))continue;const p=a.getId(r,i),m=new e.GeoJSONFeature(r,l,c,u,p);m.tile=d,t.push(m)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const n=e.parseCacheControl(t.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{const a=this.expirationTime-n;a?this.expirationTime=e+Math.max(a,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;const n=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!t.style.hasLayer(a))continue;const r=this.buckets[a],i=r.layers[0].sourceLayer||"_geojsonTileLayer",o=n[i],s=e[i];if(!o||!s||0===Object.keys(s).length)continue;r.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=t&&t.style&&t.style.getLayer(a);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(r)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=e.exported.now()+t}setDependencies(e,t){const n={};for(const e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(const n of e){const e=this.dependencies[n];if(e)for(const n of t)if(e[n])return!0}return!1}}class C{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){const a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);const r={value:t,timeout:void 0};if(void 0!==n&&(r.timeout=setTimeout(()=>{this.remove(e,r)},n)),this.data[a].push(r),this.order.push(a),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const n=e.wrapped().key,a=void 0===t?0:this.data[n].indexOf(t),r=this.data[n][a];return this.data[n].splice(a,1),r.timeout&&clearTimeout(r.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(r.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const n in this.data)for(const a of this.data[n])e(a.value)||t.push(a);for(const e of t)this.remove(e.value.tileID,e)}}class R{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const r=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},e.extend(this.stateChanges[t][r],a),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==r&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][r]){this.deletedStates[t][r]={};for(const e in this.state[t][r])a[e]||(this.deletedStates[t][r][e]=null)}else for(const e in a)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][e]&&delete this.deletedStates[t][r][e]}removeFeatureState(e,t,n){if(null===this.deletedStates[e])return;const a=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&void 0!==t)null!==this.deletedStates[e][a]&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][n]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][a])for(n in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][n]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(t,n){const a=String(n),r=e.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][n];if(null===e)return{};for(const t in e)delete r[t]}return r}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(t,n){const a={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const n={};for(const a in this.stateChanges[t])this.state[t][a]||(this.state[t][a]={}),e.extend(this.state[t][a],this.stateChanges[t][a]),n[a]=this.state[t][a];a[t]=n}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const n={};if(null===this.deletedStates[t])for(const e in this.state[t])n[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const n of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][n];n[e]=this.state[t][e]}a[t]=a[t]||{},e.extend(a[t],n)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(const e in t)t[e].setFeatureState(a,n)}}class D extends e.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(t,n,a,r){const i=new j[n.type](t,n,a,r);if(i.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${i.id}`);return e.bindAll(["load","abort","unload","serialize","prepare"],i),i}(t,n,a,this),this._tiles={},this._cache=new C(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new R}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,t){return this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new e.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(P).map(e=>e.key)}getRenderableIds(t){const n=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&n.push(this._tiles[e]);return t?n.sort((t,n)=>{const a=t.tileID,r=n.tileID,i=new e.pointGeometry(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),o=new e.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-r.overscaledZ||o.y-i.y||o.x-i.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(P).map(e=>e.key)}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(e,"reloading")}}_reloadTile(e,t){const n=this._tiles[e];n&&("loading"!==n.state&&(n.state=t),this._loadTile(n,this._tileLoaded.bind(this,n,e,t)))}_tileLoaded(t,n,a,r){if(r)return t.state="errored",void(404!==r.status?this._source.fire(new e.ErrorEvent(r,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=e.exported.now(),"expired"===a&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(e){const t=this.getRenderableIds();for(let a=0;a<t.length;a++){const r=t[a];if(e.neighboringTiles&&e.neighboringTiles[r]){const t=this.getTileByID(r);n(e,t),n(t,e)}}function n(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x;const a=t.tileID.canonical.y-e.tileID.canonical.y,r=Math.pow(2,e.tileID.canonical.z),i=t.tileID.key;0===n&&0===a||Math.abs(a)>1||(Math.abs(n)>1&&(1===Math.abs(n+r)?n+=r:1===Math.abs(n-r)&&(n-=r)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,a),e.neighboringTiles&&e.neighboringTiles[i]&&(e.neighboringTiles[i].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,a){for(const r in this._tiles){let i=this._tiles[r];if(a[r]||!i.hasData()||i.tileID.overscaledZ<=t||i.tileID.overscaledZ>n)continue;let o=i.tileID;for(;i&&i.tileID.overscaledZ>t+1;){const e=i.tileID.scaledTo(i.tileID.overscaledZ-1);i=this._tiles[e.key],i&&i.hasData()&&(o=e)}let s=o;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){a[o.key]=o;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){const t=e.scaledTo(n),a=this._getLoadedTile(t);if(a)return a}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const t=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,a=Math.floor(t*n*5),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(r)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const n in this._tiles){const a=this._tiles[n];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),e[a.tileID.key]=a}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.OverscaledTileID(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(e=>this._source.hasTile(e)))):a=[];const r=t.coveringZoomLevel(this._source),i=Math.max(r-D.maxOverzooming,this._source.minzoom),o=Math.max(r+D.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of a)if(t.canonical.z>this._source.minzoom){const n=t.scaledTo(t.canonical.z-1);e[n.key]=n;const a=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[a.key]=a}a=a.concat(Object.values(e))}const s=this._updateRetainedTiles(a,r);if(B(this._source.type)){const t={},l={},c=Object.keys(s);for(const n of c){const a=s[n],r=this._tiles[n];if(!r||r.fadeEndTime&&r.fadeEndTime<=e.exported.now())continue;const o=this.findLoadedParent(a,i);o&&(this._addTile(o.tileID),t[o.tileID.key]=o.tileID),l[n]=a}this._retainLoadedChildren(l,r,o,s);for(const e in t)s[e]||(this._coveredTiles[e]=!0,s[e]=t[e]);if(n){const e={},t={};for(const n of a)this._tiles[n.key].hasData()?e[n.key]=n:t[n.key]=n;for(const n in t){const a=t[n].children(this._source.maxzoom);this._tiles[a[0].key]&&this._tiles[a[1].key]&&this._tiles[a[2].key]&&this._tiles[a[3].key]&&(e[a[0].key]=s[a[0].key]=a[0],e[a[1].key]=s[a[1].key]=a[1],e[a[2].key]=s[a[2].key]=a[2],e[a[3].key]=s[a[3].key]=a[3],delete t[n])}for(const n in t){const a=this.findLoadedParent(t[n],this._source.minzoom);if(a){e[a.tileID.key]=s[a.tileID.key]=a.tileID;for(const t in e)e[t].isChildOf(a.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}for(const e in s)this._tiles[e].clearFadeHold();const l=e.keysDifference(this._tiles,s);for(const e of l){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){const n={},a={},r=Math.max(t-D.maxOverzooming,this._source.minzoom),i=Math.max(t+D.maxUnderzooming,this._source.minzoom),o={};for(const a of e){const e=this._addTile(a);n[a.key]=a,e.hasData()||t<this._source.maxzoom&&(o[a.key]=a)}this._retainLoadedChildren(o,t,i,n);for(const i of e){let e=this._tiles[i.key];if(e.hasData())continue;if(t+1>this._source.maxzoom){const e=i.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){n[e.key]=e;continue}}else{const e=i.children(this._source.maxzoom);if(n[e[0].key]&&n[e[1].key]&&n[e[2].key]&&n[e[3].key])continue}let o=e.wasRequested();for(let t=i.overscaledZ-1;t>=r;--t){const r=i.scaledTo(t);if(a[r.key])break;if(a[r.key]=!0,e=this.getTile(r),!e&&o&&(e=this._addTile(r)),e&&(n[r.key]=r,o=e.wasRequested(),e.hasData()))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let n,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){n=this._loadedParentTiles[a.key];break}t.push(a.key);const e=a.scaledTo(a.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;a=e}for(const e of t)this._loadedParentTiles[e]=n}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new T(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new e.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(t,n,a){const r=[],i=this.transform;if(!i)return r;const o=a?i.getCameraQueryGeometry(t):t,s=t.map(e=>i.pointCoordinate(e,this.terrain)),l=o.map(e=>i.pointCoordinate(e,this.terrain)),c=this.getIds();let u=1/0,d=1/0,p=-1/0,m=-1/0;for(const e of l)u=Math.min(u,e.x),d=Math.min(d,e.y),p=Math.max(p,e.x),m=Math.max(m,e.y);for(let t=0;t<c.length;t++){const a=this._tiles[c[t]];if(a.holdingForFade())continue;const o=a.tileID,b=Math.pow(2,i.zoom-a.tileID.overscaledZ),h=n*a.queryPadding*e.EXTENT/a.tileSize/b,f=[o.getTilePoint(new e.MercatorCoordinate(u,d)),o.getTilePoint(new e.MercatorCoordinate(p,m))];if(f[0].x-h<e.EXTENT&&f[0].y-h<e.EXTENT&&f[1].x+h>=0&&f[1].y+h>=0){const e=s.map(e=>o.getTilePoint(e)),t=l.map(e=>o.getTilePoint(e));r.push({tile:a,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:b})}}return r}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map(e=>this._tiles[e].tileID);for(const e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(B(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(void 0!==n.fadeEndTime&&n.fadeEndTime>=e.exported.now())return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e=e||"_geojsonTileLayer",t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,n)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,n){const a=this._tiles[e];a&&a.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(const n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(e,t))}}function P(e,t){const n=Math.abs(2*e.wrap)-+(e.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||a-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function B(e){return"raster"===e||"image"===e||"video"===e}D.maxOverzooming=10,D.maxUnderzooming=3;const I="mapboxgl_preloaded_worker_pool";class ${constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<$.workerCount;)this.workers.push(new Worker(Mr.workerUrl));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[I]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(e.exported.hardwareConcurrency/2);let X;function Y(){return X||(X=new $),X}function H(t,n){const a={};for(const e in t)"ref"!==e&&(a[e]=t[e]);return e.refProperties.forEach(e=>{e in n&&(a[e]=n[e])}),a}function U(e){e=e.slice();const t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)"ref"in e[n]&&(e[n]=H(e[n],t[e[n].ref]));return e}$.workerCount=Math.max(Math.min(F,6),1);const V={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function G(e,t,n){n.push({command:V.addSource,args:[e,t[e]]})}function K(e,t,n){t.push({command:V.removeSource,args:[e]}),n[e]=!0}function J(e,t,n,a){K(e,n,a),G(e,t,n)}function Z(e,t,n){let a;for(a in e[n])if(Object.prototype.hasOwnProperty.call(e[n],a)&&"data"!==a&&!r(e[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&"data"!==a&&!r(e[n][a],t[n][a]))return!1;return!0}function Q(e,t,n,a,i,o){let s;for(s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(r(e[s],t[s])||n.push({command:o,args:[a,s,t[s],i]}));for(s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(r(e[s],t[s])||n.push({command:o,args:[a,s,t[s],i]}))}function ee(e){return e.id}function te(e,t){return e[t.id]=t,e}class ne{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.clamp(t,0,1);let n=1,a=this._distances[n];const r=t*this.paddedLength+this.padding;for(;a<r&&n<this._distances.length;)a=this._distances[++n];const i=n-1,o=this._distances[i],s=a-o,l=s>0?(r-o)/s:0;return this.points[i].mult(1-l).add(this.points[n].mult(l))}}function ae(e,t){let n=!0;return"always"===e||"never"!==e&&"never"!==t||(n=!1),n}class re{constructor(e,t,n){const a=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)a.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,a,r){this._forEachCell(t,n,a,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(r)}insertCircle(e,t,n,a){this._forEachCell(t-a,n-a,t+a,n+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(a)}_insertBoxCell(e,t,n,a,r,i){this.boxCells[r].push(i)}_insertCircleCell(e,t,n,a,r,i){this.circleCells[r].push(i)}_query(e,t,n,a,r,i,o){if(n<0||e>this.width||a<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=a){if(r)return[{key:null,x1:e,y1:t,x2:n,y2:a}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],n=this.circles[3*e+1],a=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-a,y1:n-a,x2:t+a,y2:n+a})}}else this._forEachCell(e,t,n,a,this._queryCell,s,{hitTest:r,overlapMode:i,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,a){return this._query(e,t,n,a,!1,null)}hitTest(e,t,n,a,r,i){return this._query(e,t,n,a,!0,r,i).length>0}hitTestCircle(e,t,n,a,r){const i=e-n,o=e+n,s=t-n,l=t+n;if(o<0||i>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(i,s,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:a,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},r),c.length>0}_queryCell(e,t,n,a,r,i,o,s){const{seenUids:l,hitTest:c,overlapMode:u}=o,d=this.boxCells[r];if(null!==d){const r=this.bboxes;for(const o of d)if(!l.box[o]){l.box[o]=!0;const d=4*o,p=this.boxKeys[o];if(e<=r[d+2]&&t<=r[d+3]&&n>=r[d+0]&&a>=r[d+1]&&(!s||s(p))&&(!c||!ae(u,p.overlapMode))&&(i.push({key:p,x1:r[d],y1:r[d+1],x2:r[d+2],y2:r[d+3]}),c))return!0}}const p=this.circleCells[r];if(null!==p){const r=this.circles;for(const o of p)if(!l.circle[o]){l.circle[o]=!0;const d=3*o,p=this.circleKeys[o];if(this._circleAndRectCollide(r[d],r[d+1],r[d+2],e,t,n,a)&&(!s||s(p))&&(!c||!ae(u,p.overlapMode))){const e=r[d],t=r[d+1],n=r[d+2];if(i.push({key:p,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),c)return!0}}}return!1}_queryCellCircle(e,t,n,a,r,i,o,s){const{circle:l,seenUids:c,overlapMode:u}=o,d=this.boxCells[r];if(null!==d){const e=this.bboxes;for(const t of d)if(!c.box[t]){c.box[t]=!0;const n=4*t,a=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(a))&&!ae(u,a.overlapMode))return i.push(!0),!0}}const p=this.circleCells[r];if(null!==p){const e=this.circles;for(const t of p)if(!c.circle[t]){c.circle[t]=!0;const n=3*t,a=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],l.x,l.y,l.radius)&&(!s||s(a))&&!ae(u,a.overlapMode))return i.push(!0),!0}}}_forEachCell(e,t,n,a,r,i,o,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(a);for(let p=l;p<=u;p++)for(let l=c;l<=d;l++)if(r.call(this,e,t,n,a,this.xCellCount*l+p,i,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,a,r,i){const o=a-e,s=r-t,l=n+i;return l*l>o*o+s*s}_circleAndRectCollide(e,t,n,a,r,i,o){const s=(i-a)/2,l=Math.abs(e-(a+s));if(l>s+n)return!1;const c=(o-r)/2,u=Math.abs(t-(r+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;const d=l-s,p=u-c;return d*d+p*p<=n*n}}function ie(t,n,a,r,i){const o=e.create();return n?(e.scale(o,o,[1/i,1/i,1]),a||e.rotateZ(o,o,r.angle)):e.multiply(o,r.labelPlaneMatrix,t),o}function oe(t,n,a,r,i){if(n){const n=e.clone(t);return e.scale(n,n,[i,i,1]),a||e.rotateZ(n,n,-r.angle),n}return r.glCoordMatrix}function se(t,n,a){let r;a?(r=[t.x,t.y,a(t.x,t.y),1],e.transformMat4(r,r,n)):(r=[t.x,t.y,0,1],_e(r,r,n));const i=r[3];return{point:new e.pointGeometry(r[0]/i,r[1]/i),signedDistanceFromCamera:i}}function le(e,t){return.5+e/t*.5}function ce(e,t){const n=e[0]/e[3],a=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function ue(t,n,a,r,i,o,s,l,c,u){const d=r?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,a.transform.zoom),m=[256/a.width*2+1,256/a.height*2+1],b=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;b.clear();const h=t.lineVertexArray,f=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=a.transform.width/a.transform.height;let _=!1;for(let r=0;r<f.length;r++){const y=f.get(r);if(y.hidden||y.writingMode===e.WritingMode.vertical&&!_){ge(y.numGlyphs,b);continue}let M;if(_=!1,u?(M=[y.anchorX,y.anchorY,u(y.anchorX,y.anchorY),1],e.transformMat4(M,M,n)):(M=[y.anchorX,y.anchorY,0,1],_e(M,M,n)),!ce(M,m)){ge(y.numGlyphs,b);continue}const v=le(a.transform.cameraToCenterDistance,M[3]),z=e.evaluateSizeForFeature(d,p,y),O=s?z/v:z*v,k=new e.pointGeometry(y.anchorX,y.anchorY),A=se(k,i,u).point,x={},w=me(y,O,!1,l,n,i,o,t.glyphOffsetArray,h,b,A,k,x,g,c,u);_=w.useVertical,(w.notEnoughRoom||_||w.needsFlipping&&me(y,O,!0,l,n,i,o,t.glyphOffsetArray,h,b,A,k,x,g,c,u).notEnoughRoom)&&ge(y.numGlyphs,b)}r?t.text.dynamicLayoutVertexBuffer.updateData(b):t.icon.dynamicLayoutVertexBuffer.updateData(b)}function de(e,t,n,a,r,i,o,s,l,c,u,d,p){const m=s.glyphStartIndex+s.numGlyphs,b=s.lineStartIndex,h=s.lineStartIndex+s.lineLength,f=t.getoffsetX(s.glyphStartIndex),g=t.getoffsetX(m-1),_=he(e*f,n,a,r,i,o,s.segment,b,h,l,c,u,d,p);if(!_)return null;const y=he(e*g,n,a,r,i,o,s.segment,b,h,l,c,u,d,p);return y?{first:_,last:y}:null}function pe(t,n,a,r){return t===e.WritingMode.horizontal&&Math.abs(a.y-n.y)>Math.abs(a.x-n.x)*r?{useVertical:!0}:(t===e.WritingMode.vertical?n.y<a.y:n.x>a.x)?{needsFlipping:!0}:null}function me(t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f){const g=n/24,_=t.lineOffsetX*g,y=t.lineOffsetY*g;let M;if(t.numGlyphs>1){const e=t.glyphStartIndex+t.numGlyphs,n=t.lineStartIndex,i=t.lineStartIndex+t.lineLength,u=de(g,l,_,y,a,d,p,t,c,o,m,h,f);if(!u)return{notEnoughRoom:!0};const v=se(u.first.point,s,f).point,z=se(u.last.point,s,f).point;if(r&&!a){const e=pe(t.writingMode,v,z,b);if(e)return e}M=[u.first];for(let r=t.glyphStartIndex+1;r<e-1;r++)M.push(he(g*l.getoffsetX(r),_,y,a,d,p,t.segment,n,i,c,o,m,h,f));M.push(u.last)}else{if(r&&!a){const n=se(p,i,f).point,a=t.lineStartIndex+t.segment+1,r=new e.pointGeometry(c.getx(a),c.gety(a)),o=se(r,i,f),s=o.signedDistanceFromCamera>0?o.point:be(p,r,n,1,i,f),l=pe(t.writingMode,n,s,b);if(l)return l}const n=he(g*l.getoffsetX(t.glyphStartIndex),_,y,a,d,p,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,c,o,m,h,f);if(!n)return{notEnoughRoom:!0};M=[n]}for(const t of M)e.addDynamicAttributes(u,t.point,t.angle);return{}}function be(e,t,n,a,r,i){const o=se(e.add(e.sub(t)._unit()),r,i).point,s=n.sub(o);return n.add(s._mult(a/s.mag()))}function he(t,n,a,r,i,o,s,l,c,u,d,p,m,b){const h=r?t-n:t+n;let f=h>0?1:-1,g=0;r&&(f*=-1,g=Math.PI),f<0&&(g+=Math.PI);let _=f>0?l+s:l+s+1,y=i,M=i,v=0,z=0;const O=Math.abs(h),k=[];for(;v+z<=O;){if(_+=f,_<l||_>=c)return null;if(M=y,k.push(y),y=p[_],void 0===y){const t=new e.pointGeometry(u.getx(_),u.gety(_)),n=se(t,d,b);if(n.signedDistanceFromCamera>0)y=p[_]=n.point;else{const n=_-f;y=be(0===v?o:new e.pointGeometry(u.getx(n),u.gety(n)),t,M,O-v+1,d,b)}}v+=z,z=M.dist(y)}const A=(O-v)/z,x=y.sub(M),w=x.mult(A)._add(M);w._add(x._unit()._perp()._mult(a*f));const N=g+Math.atan2(y.y-M.y,y.x-M.x);return k.push(w),{point:w,angle:m?N:0,path:k}}const fe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ge(e,t){for(let n=0;n<e;n++){const e=t.length;t.resize(e+4),t.float32.set(fe,3*e)}}function _e(e,t,n){const a=t[0],r=t[1];return e[0]=n[0]*a+n[4]*r+n[12],e[1]=n[1]*a+n[5]*r+n[13],e[3]=n[3]*a+n[7]*r+n[15],e}const ye=100;class Me{constructor(e,t=new re(e.width+200,e.height+200,25),n=new re(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+ye,this.screenBottomBoundary=e.height+ye,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,a,r,i){const o=this.projectAndGetPerspectiveRatio(a,e.anchorPointX,e.anchorPointY,i),s=n*o.perspectiveRatio,l=e.x1*s+o.point.x,c=e.y1*s+o.point.y,u=e.x2*s+o.point.x,d=e.y2*s+o.point.y;return!this.isInsideGrid(l,c,u,d)||"always"!==t&&this.grid.hitTest(l,c,u,d,t,r)||o.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,u,d],offscreen:this.isOffscreen(l,c,u,d)}}placeCollisionCircles(t,n,a,r,i,o,s,l,c,u,d,p,m,b){const h=[],f=new e.pointGeometry(n.anchorX,n.anchorY),g=se(f,o,b),_=le(this.transform.cameraToCenterDistance,g.signedDistanceFromCamera),y=(u?i/_:i*_)/e.ONE_EM,M=se(f,s,b).point,v=de(y,r,n.lineOffsetX*y,n.lineOffsetY*y,!1,M,f,n,a,s,{},!1,b);let z=!1,O=!1,k=!0;if(v){const n=.5*p*_+m,a=new e.pointGeometry(-100,-100),r=new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),i=new ne,o=v.first,s=v.last;let u=[];for(let e=o.path.length-1;e>=1;e--)u.push(o.path[e]);for(let e=1;e<s.path.length;e++)u.push(s.path[e]);const f=2.5*n;if(l){const e=u.map(e=>se(e,l,b));u=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(u.length>0){const t=u[0].clone(),n=u[0].clone();for(let e=1;e<u.length;e++)t.x=Math.min(t.x,u[e].x),t.y=Math.min(t.y,u[e].y),n.x=Math.max(n.x,u[e].x),n.y=Math.max(n.y,u[e].y);g=t.x>=a.x&&n.x<=r.x&&t.y>=a.y&&n.y<=r.y?[u]:n.x<a.x||t.x>r.x||n.y<a.y||t.y>r.y?[]:e.clipLine([u],a.x,a.y,r.x,r.y)}for(const e of g){i.reset(e,.25*n);let a=0;a=i.length<=.5*n?1:Math.ceil(i.paddedLength/f)+1;for(let e=0;e<a;e++){const r=e/Math.max(a-1,1),o=i.lerp(r),s=o.x+ye,l=o.y+ye;h.push(s,l,n,0);const u=s-n,p=l-n,m=s+n,b=l+n;if(k=k&&this.isOffscreen(u,p,m,b),O=O||this.isInsideGrid(u,p,m,b),"always"!==t&&this.grid.hitTestCircle(s,l,n,t,d)&&(z=!0,!c))return{circles:[],offscreen:!1,collisionDetected:z}}}}return{circles:!c&&z||!O||_<this.perspectiveRatioCutoff?[]:h,offscreen:k,collisionDetected:z}}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const n=[];let a=1/0,r=1/0,i=-1/0,o=-1/0;for(const s of t){const t=new e.pointGeometry(s.x+ye,s.y+ye);a=Math.min(a,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y),n.push(t)}const s=this.grid.query(a,r,i,o).concat(this.ignoredGrid.query(a,r,i,o)),l={},c={};for(const t of s){const a=t.key;if(void 0===l[a.bucketInstanceId]&&(l[a.bucketInstanceId]={}),l[a.bucketInstanceId][a.featureIndex])continue;const r=[new e.pointGeometry(t.x1,t.y1),new e.pointGeometry(t.x2,t.y1),new e.pointGeometry(t.x2,t.y2),new e.pointGeometry(t.x1,t.y2)];e.polygonIntersectsPolygon(n,r)&&(l[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(e,t,n,a,r,i){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:r,collisionGroupID:i,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,a,r,i){const o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:a,featureIndex:r,collisionGroupID:i,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(t,n,a,r){let i;return r?(i=[n,a,r(n,a),1],e.transformMat4(i,i,t)):(i=[n,a,0,1],_e(i,i,t)),{point:new e.pointGeometry((i[0]/i[3]+1)/2*this.transform.width+ye,(-i[1]/i[3]+1)/2*this.transform.height+ye),perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5}}isOffscreen(e,t,n,a){return n<ye||e>=this.screenRightBoundary||a<ye||t>this.screenBottomBoundary}isInsideGrid(e,t,n,a){return n>=0&&e<this.gridRightBoundary&&a>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.identity([]);return e.translate(t,t,[-100,-100,0]),t}}function ve(t,n,a){return n*(e.EXTENT/(t.tileSize*Math.pow(2,a-t.tileID.overscaledZ)))}class ze{constructor(e,t,n,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):a&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class Oe{constructor(e,t,n,a,r){this.text=new ze(e?e.text:null,t,n,r),this.icon=new ze(e?e.icon:null,t,a,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ke{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class Ae{constructor(){this.invProjMatrix=e.create(),this.viewportMatrix=e.create(),this.circles=[]}}class xe{constructor(e,t,n,a,r){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=a,this.tileID=r}}class we{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function Ne(t,n,a,r,i){const{horizontalAlign:o,verticalAlign:s}=e.getAnchorAlignment(t),l=-(o-.5)*n,c=-(s-.5)*a,u=e.evaluateVariableOffset(t,r);return new e.pointGeometry(l+u[0]*i,c+u[1]*i)}function qe(t,n,a,r,i,o){const{x1:s,x2:l,y1:c,y2:u,anchorPointX:d,anchorPointY:p}=t,m=new e.pointGeometry(n,a);return r&&m._rotate(i?o:-o),{x1:s+m.x,y1:c+m.y,x2:l+m.x,y2:u+m.y,anchorPointX:d,anchorPointY:p}}class Ee{constructor(e,t,n,a,r){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Me(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new we(a),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,r){const i=a.getBucket(n),o=a.latestFeatureIndex;if(!i||!o||n.id!==i.layerIds[0])return;const s=a.collisionBoxArray,l=i.layers[0].layout,c=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),u=a.tileSize/e.EXTENT,d=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),m="map"===l.get("text-rotation-alignment"),b=ve(a,1,this.transform.zoom),h=ie(d,p,m,this.transform,b);let f=null;if(p){const t=oe(d,p,m,this.transform,b);f=e.multiply([],this.transform.labelPlaneMatrix,t)}this.retainedQueryData[i.bucketInstanceId]=new xe(i.bucketInstanceId,o,i.sourceLayerIndex,i.index,a.tileID);const g={bucket:i,layout:l,posMatrix:d,textLabelPlaneMatrix:h,labelToScreenMatrix:f,scale:c,textPixelRatio:u,holdingForFade:a.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(i.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(i.sourceID)};if(r)for(const e of i.sortKeyRanges){const{sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:r}=e;t.push({sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:r,parameters:g})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:i.symbolInstances.length,parameters:g})}attemptAnchorPlacement(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h){const f=[d.textOffset0,d.textOffset1],g=Ne(e,n,a,f,r),_=this.collisionIndex.placeCollisionBox(qe(t,g.x,g.y,i,o,this.transform.angle),u,s,l,c.predicate,h);if((!b||0!==this.collisionIndex.placeCollisionBox(qe(b,g.x,g.y,i,o,this.transform.angle),u,s,l,c.predicate,h).box.length)&&_.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:f,width:n,height:a,anchor:e,textBoxScale:r,prevAnchor:t},this.markUsedJustification(p,e,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[d.crossTileID]=m),{shift:g,placedGlyphBoxes:_}}}placeLayerBucketPart(t,n,a){const{bucket:r,layout:i,posMatrix:o,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:m}=t.parameters,b=i.get("text-optional"),h=i.get("icon-optional"),f=e.getOverlapMode(i,"text-overlap","text-allow-overlap"),g="always"===f,_=e.getOverlapMode(i,"icon-overlap","icon-allow-overlap"),y="always"===_,M="map"===i.get("text-rotation-alignment"),v="map"===i.get("text-pitch-alignment"),z="none"!==i.get("icon-text-fit"),O="viewport-y"===i.get("symbol-z-order"),k=g&&(y||!r.hasIconData()||h),A=y&&(g||!r.hasTextData()||b);!r.collisionArrays&&d&&r.deserializeCollisionBoxes(d);const x=(t,d)=>{if(n[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new ke(!1,!1,!1));let y=!1,O=!1,x=!0,w=null,N={box:null,offscreen:null},q={box:null,offscreen:null},E=null,j=null,W=null,L=0,S=0,T=0;d.textFeatureIndex?L=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(L=t.featureIndex),d.verticalTextFeatureIndex&&(S=d.verticalTextFeatureIndex);const C=this.retainedQueryData[r.bucketInstanceId].tileID,R=this.terrain?(e,t)=>this.terrain.getElevation(C,e,t):null;for(const e of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const t=d[e];t&&(t.elevation=R?R(t.anchorPointX,t.anchorPointY):0)}const D=d.textBox;if(D){const n=n=>{let a=e.WritingMode.horizontal;if(r.allowVerticalPlacement&&!n&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,a=e,this.markUsedOrientation(r,a,t))}return a},a=(n,a)=>{if(r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of r.writingModes)if(t===e.WritingMode.vertical?(N=a(),q=N):N=n(),N&&N.box&&N.box.length)break}else N=n()};if(i.get("text-variable-anchor")){let s=i.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[t.crossTileID]){const e=this.prevPlacement.variableOffsets[t.crossTileID];s.indexOf(e.anchor)>0&&(s=s.filter(t=>t!==e.anchor),s.unshift(e.anchor))}const l=(e,n,a)=>{const i=e.x2-e.x1,l=e.y2-e.y1,u=t.textBoxScale,d=z&&"never"===_?n:null;let p={box:[],offscreen:!1};const b="never"!==f?2*s.length:s.length;for(let n=0;n<b;++n){const b=this.attemptAnchorPlacement(s[n%s.length],e,i,l,u,M,v,c,o,m,n>=s.length?f:"never",t,r,a,d,R);if(b&&(p=b.placedGlyphBoxes,p&&p.box&&p.box.length)){y=!0,w=b.shift;break}}return p};a(()=>l(D,d.iconBox,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return r.allowVerticalPlacement&&!(N&&N.box&&N.box.length)&&t.numVerticalGlyphVertices>0&&n?l(n,d.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null}}),N&&(y=N.box,x=N.offscreen);const u=n(N&&N.box);if(!y&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(r,e.anchor,t,u))}}else{const i=(e,n)=>{const a=this.collisionIndex.placeCollisionBox(e,f,c,o,m.predicate,R);return a&&a.box&&a.box.length&&(this.markUsedOrientation(r,n,t),this.placedOrientations[t.crossTileID]=n),a};a(()=>i(D,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&n?i(n,e.WritingMode.vertical):{box:null,offscreen:null}}),n(N&&N.box&&N.box.length)}}if(E=N,y=E&&E.box&&E.box.length>0,x=E&&E.offscreen,t.useRuntimeCollisionCircles){const n=r.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),c=e.evaluateSizeForFeature(r.textSizeData,p,n),u=i.get("text-padding");j=this.collisionIndex.placeCollisionCircles(f,n,r.lineVertexArray,r.glyphOffsetArray,c,o,s,l,a,v,m.predicate,t.collisionCircleDiameter,u,R),j.circles.length&&j.collisionDetected&&!a&&e.warnOnce("Collisions detected, but collision boxes are not shown"),y=g||j.circles.length>0&&!j.collisionDetected,x=x&&j.offscreen}if(d.iconFeatureIndex&&(T=d.iconFeatureIndex),d.iconBox){const e=e=>{const t=z&&w?qe(e,w.x,w.y,M,v,this.transform.angle):e;return this.collisionIndex.placeCollisionBox(t,_,c,o,m.predicate,R)};q&&q.box&&q.box.length&&d.verticalIconBox?(W=e(d.verticalIconBox),O=W.box.length>0):(W=e(d.iconBox),O=W.box.length>0),x=x&&W.offscreen}const P=b||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,B=h||0===t.numIconVertices;if(P||B?B?P||(O=O&&y):y=O&&y:O=y=O&&y,y&&E&&E.box&&this.collisionIndex.insertCollisionBox(E.box,f,i.get("text-ignore-placement"),r.bucketInstanceId,q&&q.box&&S?S:L,m.ID),O&&W&&this.collisionIndex.insertCollisionBox(W.box,_,i.get("icon-ignore-placement"),r.bucketInstanceId,T,m.ID),j&&(y&&this.collisionIndex.insertCollisionCircles(j.circles,f,i.get("text-ignore-placement"),r.bucketInstanceId,L,m.ID),a)){const e=r.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Ae);for(let e=0;e<j.circles.length;e+=4)t.circles.push(j.circles[e+0]),t.circles.push(j.circles[e+1]),t.circles.push(j.circles[e+2]),t.circles.push(j.collisionDetected?1:0)}if(0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===r.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new ke(y||k,O||A,x||r.justReloaded),n[t.crossTileID]=!0};if(O){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=r.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const n=e[t];x(r.symbolInstances.get(n),r.collisionArrays[n])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)x(r.symbolInstances.get(e),r.collisionArrays[e]);if(a&&r.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[r.bucketInstanceId];e.invert(t.invProjMatrix,o),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}r.justReloaded=!1}markUsedJustification(t,n,a,r){let i;i=r===e.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[e.getAnchorJustification(n)];const o=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const e of o)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=i>=0&&e!==i?0:a.crossTileID)}markUsedOrientation(t,n,a){const r=n===e.WritingMode.horizontal||n===e.WritingMode.horizontalOnly?n:0,i=n===e.WritingMode.vertical?n:0,o=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=r;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=i)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const a=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},i=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],i=r[e];i?(this.opacities[e]=new Oe(i,a,t.text,t.icon),n=n||t.text!==i.text.placed||t.icon!==i.icon.placed):(this.opacities[e]=new Oe(null,a,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(const e in r){const t=r[e];if(!this.opacities[e]){const r=new Oe(t,a,!1,!1);r.isHidden()||(this.opacities[e]=r,n=n||t.text.placed||t.icon.placed)}}for(const e in i)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=i[e]);for(const e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const n={};for(const a of t){const t=a.getBucket(e);t&&a.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n,a.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0].layout,i=new Oe(null,0,!1,!1,!0),o=r.get("text-allow-overlap"),s=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),c="map"===r.get("text-rotation-alignment"),u="map"===r.get("text-pitch-alignment"),d="none"!==r.get("icon-text-fit"),p=new Oe(null,0,o&&(s||!t.hasIconData()||r.get("icon-optional")),s&&(o||!t.hasTextData()||r.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const m=(e,t,n)=>{for(let a=0;a<t/4;a++)e.opacityVertexArray.emplaceBack(n)};for(let a=0;a<t.symbolInstances.length;a++){const r=t.symbolInstances.get(a),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:b}=r;let h=this.opacities[b];n[b]?h=i:h||(h=p,this.opacities[b]=h),n[b]=!0;const f=r.numIconVertices>0,g=this.placedOrientations[r.crossTileID],_=g===e.WritingMode.vertical,y=g===e.WritingMode.horizontal||g===e.WritingMode.horizontalOnly;if(o>0||s>0){const e=Pe(h.text);m(t.text,o,_?Be:e),m(t.text,s,y?Be:e);const n=h.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=n||_?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=n||y?1:0);const a=this.variableOffsets[r.crossTileID];a&&this.markUsedJustification(t,a.anchor,r,g);const i=this.placedOrientations[r.crossTileID];i&&(this.markUsedJustification(t,"left",r,i),this.markUsedOrientation(t,i,r))}if(f){const e=Pe(h.icon),n=!(d&&r.verticalPlacedIconSymbolIndex&&_);r.placedIconSymbolIndex>=0&&(m(t.icon,r.numIconVertices,n?e:Be),t.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=h.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,r.numVerticalIconVertices,n?Be:e),t.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const n=t.collisionArrays[a];if(n){let a=new e.pointGeometry(0,0);if(n.textBox||n.verticalTextBox){let e=!0;if(l){const t=this.variableOffsets[b];t?(a=Ne(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),c&&a._rotate(u?this.transform.angle:-this.transform.angle)):e=!1}n.textBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||_,a.x,a.y),n.verticalTextBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||y,a.x,a.y)}const r=Boolean(!y&&n.verticalIconBox);n.iconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,r,d?a.x:0,d?a.y:0),n.verticalIconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,!r,d?a.x:0,d?a.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function je(e,t,n,a,r){e.emplaceBack(t?1:0,n?1:0,a||0,r||0),e.emplaceBack(t?1:0,n?1:0,a||0,r||0),e.emplaceBack(t?1:0,n?1:0,a||0,r||0),e.emplaceBack(t?1:0,n?1:0,a||0,r||0)}const We=Math.pow(2,25),Le=Math.pow(2,24),Se=Math.pow(2,17),Te=Math.pow(2,16),Ce=Math.pow(2,9),Re=Math.pow(2,8),De=Math.pow(2,1);function Pe(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,n=Math.floor(127*e.opacity);return n*We+t*Le+n*Se+t*Te+n*Ce+t*Re+n*De+t}const Be=0;class Ie{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,a,r){const i=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(i,a,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,i.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<i.length;)if(t.placeLayerBucketPart(i[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,r())return!0;return!1}}class $e{constructor(e,t,n,a,r,i,o,s){this.placement=new Ee(e,t,i,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const r=e.exported.now(),i=()=>{const t=e.exported.now()-r;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=n[t[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=r)&&(!e.maxzoom||e.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Ie(e)),this._inProgressLayer.continuePlacement(a[e.source],this.placement,this._showCollisionBoxes,e,i))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Fe=512/e.EXTENT/2;class Xe{constructor(e,t,n){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;n<t.length;n++){const a=t.get(n),r=a.key;this.indexedSymbolInstances[r]||(this.indexedSymbolInstances[r]=[]),this.indexedSymbolInstances[r].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,e)})}}getScaledCoordinates(t,n){const a=Fe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*e.EXTENT+t.anchorX)*a),y:Math.floor((n.canonical.y*e.EXTENT+t.anchorY)*a)}}findMatches(e,t,n){const a=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let r=0;r<e.length;r++){const i=e.get(r);if(i.crossTileID)continue;const o=this.indexedSymbolInstances[i.key];if(!o)continue;const s=this.getScaledCoordinates(i,t);for(const e of o)if(Math.abs(e.coord.x-s.x)<=a&&Math.abs(e.coord.y-s.y)<=a&&!n[e.crossTileID]){n[e.crossTileID]=!0,i.crossTileID=e.crossTileID;break}}}}class Ye{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class He{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const n=this.indexes[e],a={};for(const e in n){const r=n[e];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),a[r.tileID.key]=r}this.indexes[e]=a}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const a=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const r=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in r){const i=r[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,a)}else{const i=r[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,a)}}for(let e=0;e<t.symbolInstances.length;e++){const r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=n.generate(),a[r.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Xe(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const n in t.indexedSymbolInstances)for(const a of t.indexedSymbolInstances[n])delete this.usedCrossTileIDs[e][a.crossTileID]}removeStaleBuckets(e){let t=!1;for(const n in this.indexes){const a=this.indexes[n];for(const r in a)e[a[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,a[r]),delete a[r],t=!0)}return t}}class Ue{constructor(){this.layerIndexes={},this.crossTileIDs=new Ye,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let a=this.layerIndexes[e.id];void 0===a&&(a=this.layerIndexes[e.id]=new He);let r=!1;const i={};a.handleWrapJump(n);for(const n of t){const t=n.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(n.tileID,t,this.crossTileIDs)&&(r=!0),i[t.bucketInstanceId]=!0)}return a.removeStaleBuckets(i)&&(r=!0),r}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Ve=e.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ge extends e.Evented{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=e._cache.max,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const e in this._tiles){const t=this._tiles[e];t.textures.forEach(e=>e.destroy()),t.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),e.ortho(a.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),this._tiles[a.key]=new T(a,this.tileSize))}removeOutdated(e){const t={};this.renderHistory=this.renderHistory.filter((e,t)=>this.renderHistory.indexOf(e)===t).slice(0,this.renderHistorySize);for(const e of this._renderableTilesKeys)t[e]=!0;for(const e of this.renderHistory)t[e]=!0;for(const n in this._tiles)t[n]||(this._tiles[n].clearTextures(e),delete this._tiles[n])}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const r=this._tiles[a].tileID;if(r.canonical.equals(t.canonical)){const r=t.clone();r.posMatrix=new Float64Array(16),e.ortho(r.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),n[a]=r}else if(r.canonical.isChildOf(t.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=r.canonical.z-t.canonical.z,s=r.canonical.x-(r.canonical.x>>o<<o),l=r.canonical.y-(r.canonical.y>>o<<o),c=e.EXTENT>>o;e.ortho(i.posMatrix,0,c,0,c,0,1),e.translate(i.posMatrix,i.posMatrix,[-s*c,-l*c,0]),n[a]=i}else if(t.canonical.isChildOf(r.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=t.canonical.z-r.canonical.z,s=t.canonical.x-(t.canonical.x>>o<<o),l=t.canonical.y-(t.canonical.y>>o<<o),c=e.EXTENT>>o;e.ortho(i.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),e.translate(i.posMatrix,i.posMatrix,[s*c,l*c,0]),e.scale(i.posMatrix,i.posMatrix,[1/2**o,1/2**o,0]),n[a]=i}}return n}getSourceTile(e,t){const n=this.sourceCache._source;let a=e.overscaledZ-this.deltaZoom;if(a>n.maxzoom&&(a=n.maxzoom),a<n.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(a).key);let r=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!r||!r.dem)&&t)for(;a>=n.minzoom&&(!r||!r.dem);)r=this.sourceCache.getTileByID(e.scaledTo(a--).key);return r}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(t=>t.timeLoaded>=e)}}class Ke{constructor(e,t,n){this.style=e,this.sourceCache=new Ge(t),this.options=n,this.exaggeration="number"==typeof n.exaggeration?n.exaggeration:1,this.elevationOffset="number"==typeof n.elevationOffset?n.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,a,r=e.EXTENT){if(!(n>=0&&n<r&&a>=0&&a<r))return this.elevationOffset;let i=0;const o=this.getTerrainData(t);if(o.tile&&o.tile.dem){const t=e.transformMat4$1([],[n/r*e.EXTENT,a/r*e.EXTENT],o.u_terrain_matrix),s=[t[0]*o.tile.dem.dim,t[1]*o.tile.dem.dim],l=[Math.floor(s[0]),Math.floor(s[1])],c=o.tile.dem.get(l[0],l[1]),u=o.tile.dem.get(l[0],l[1]+1),d=o.tile.dem.get(l[0]+1,l[1]),p=o.tile.dem.get(l[0]+1,l[1]+1);i=e.number(e.number(c,u,s[0]-l[0]),e.number(d,p,s[0]-l[0]),s[1]-l[1])}return i}rememberForRerender(e,t){for(const n in this.sourceCache._tiles){const a=this.sourceCache._tiles[n];(a.tileID.equals(t)||a.tileID.isChildOf(t))&&(e===this.sourceCache.sourceCache.id&&(a.timeLoaded=Date.now()),this._rerender[e]=this._rerender[e]||{},this._rerender[e][a.tileID.key]=!0)}}needsRerender(e,t){return this._rerender[e]&&this._rerender[e][t.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,a,r=e.EXTENT){return(this.getDEMElevation(t,n,a,r)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.style.map.painter.context,n=new e.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new l(t,n,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new l(t,new e.RGBAImage({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const e=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new l(e,n.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),n.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const a=this.sourceCache.sourceCache._source.maxzoom;let r=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?r=t.canonical.z-a:e.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const i=t.canonical.x-(t.canonical.x>>r<<r),o=t.canonical.y-(t.canonical.y>>r<<r),s=e.fromScaling(new Float64Array(16),[1/(e.EXTENT<<r),1/(e.EXTENT<<r),0]);e.translate(s,s,[i*e.EXTENT,o*e.EXTENT,0]),this._demMatrixCache[t.key]={matrix:s,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const e=this.style.map.painter;if(!this._rttFramebuffer){const t=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=e.context.createFramebuffer(t,t,!0),this._rttFramebuffer.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,t))}return this._rttFramebuffer}getFramebuffer(e){const t=this.style.map.painter,n=t.width/devicePixelRatio,a=t.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new l(t.context,{width:n,height:a,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new l(t.context,{width:n,height:a,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(n,a,!0),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,a))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let a=0;a<this._coordsTextureSize;a++,t+=4)n[t+0]=255&a,n[t+1]=255&e,n[t+2]=a>>8<<4|e>>8,n[t+3]=0;const a=new e.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),r=new l(t,a,t.gl.RGBA,{premultiply:!1});return r.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(t){const n=new Uint8Array(4),a=this.style.map.painter,r=a.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(t.x,a.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,n),r.bindFramebuffer.set(null);const o=n[0]+(n[2]>>4<<8),s=n[1]+((15&n[2])<<8),l=this.coordsIndex[255-n[3]],c=l&&this.sourceCache.getTileByID(l);if(!c)return null;const u=this._coordsTextureSize,d=(1<<c.tileID.canonical.z)*u;return new e.MercatorCoordinate((c.tileID.canonical.x*u+o)/d,(c.tileID.canonical.y*u+s)/d,this.getElevation(c.tileID,o,s,u))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new e.PosArray,a=new e.TriangleIndexArray,r=this.meshSize,i=e.EXTENT/r,o=r*r;for(let e=0;e<=r;e++)for(let t=0;t<=r;t++)n.emplaceBack(t*i,e*i);for(let e=0;e<o;e+=r+1)for(let t=0;t<r;t++)a.emplaceBack(t+e,r+t+e+1,r+t+e+2),a.emplaceBack(t+e,r+t+e+2,t+e+1);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,Ve.members),segments:e.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return t&&t.dem&&(n.minElevation=(t.dem.min+this.elevationOffset)*this.exaggeration,n.maxElevation=(t.dem.max+this.elevationOffset)*this.exaggeration),n}}const Je=(t,n)=>e.emitValidationErrors(t,n&&n.filter(e=>"source.canvas"!==e.identifier)),Ze=e.pick(V,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qe=e.pick(V,["setCenter","setZoom","setBearing","setPitch"]),et=function(){const t={},n=e.spec.$version;for(const a in e.spec.$root){const r=e.spec.$root[a];if(r.required){let e=null;e="version"===a?n:"array"===r.type?[]:{},null!=e&&(t[a]=e)}}return t}();class tt extends e.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new y(Y(),this),this.imageManager=new u,this.imageManager.setEventedParent(this),this.glyphManager=new b(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new _(256,512),this.crossTileSymbolIndex=new Ue,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",e.getReferrer());const a=this;this._rtlTextPluginCallback=tt.registerForPluginStateChange(t=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,n)=>{if(e.triggerPluginCompletionEvent(t),n&&n.every(e=>e))for(const e in a.sourceCaches)a.sourceCaches[e].reload()})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.sourceCaches[e.sourceId];if(!t)return;const n=t.getSource();if(n&&n.vectorLayerIds)for(const e in this._layers){const t=this._layers[e];t.source===n.id&&this._validateLayer(t)}})}loadURL(t,n={}){this.fire(new e.Event("dataloading",{dataType:"style"}));const a="boolean"!=typeof n.validate||n.validate,r=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(r,(t,n)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):n&&this._load(n,a)})}loadJSON(t,n={}){this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame(()=>{this._request=null,this._load(t,!1!==n.validate)})}loadEmpty(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(et,!1)}_load(t,n){if(n&&Je(this,e.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const a=U(this.stylesheet.layers);this._order=a.map(e=>e.id),this._layers={},this._serializedLayers={};for(let t of a)t=e.createStyleLayer(t),t.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=t,this._serializedLayers[t.id]=t.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new g(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(t,n,a,r){let i,o,s;const l=a>1?"@2x":"";let c=e.getJSON(n.transformRequest(n.normalizeSpriteURL(t,l,".json"),e.ResourceType.SpriteJSON),(e,t)=>{c=null,s||(s=e,i=t,d())}),u=e.getImage(n.transformRequest(n.normalizeSpriteURL(t,l,".png"),e.ResourceType.SpriteImage),(e,t)=>{u=null,s||(s=e,o=t,d())});function d(){if(s)r(s);else if(i&&o){const t=e.exported.getImageData(o),n={};for(const a in i){const{width:r,height:o,x:s,y:l,sdf:c,pixelRatio:u,stretchX:d,stretchY:p,content:m}=i[a],b=new e.RGBAImage({width:r,height:o});e.RGBAImage.copy(t,b,{x:s,y:l},{x:0,y:0},{width:r,height:o}),n[a]={data:b,pixelRatio:u,sdf:c,stretchX:d,stretchY:p,content:m}}r(null,n)}}return{cancel(){c&&(c.cancel(),c=null),u&&(u.cancel(),u=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(t,n)=>{if(this._spriteRequest=null,t)this.fire(new e.ErrorEvent(t));else if(n)for(const e in n)this.imageManager.addImage(e,n[e]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const r=n.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(a))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){const t=[];for(const n of e){const e=this._layers[n];"custom"!==e.type&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(e.length||n.length)&&this._updateWorkerLayers(e,n);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error("Invalid action "+t);this._clearSource(e)}}this._updateTilesForChangedImages();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];a[e]=t.used,t.used=!1}for(const e of this._order){const n=this._layers[e];n.recalculate(t,this._availableImages),!n.isHidden(t.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(const t in a){const n=this.sourceCaches[t];a[t]!==n.used&&n.fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new e.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const e=this.sourceCaches[t.source];if(!e)throw new Error("cannot load terrain, because there exists no source with ID: "+t.source);this.terrain=new Ke(this,e,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=e=>{e.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=e=>{e.tile&&(e.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(e.sourceId,e.tile.tileID)):"geojson"===e.source.type&&this.terrain.rememberForRerender(e.sourceId,e.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new e.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),Je(this,e.validateStyle(t)))return!1;(t=e.clone$1(t)).layers=U(t.layers);const n=function(e,t){if(!e)return[{command:V.setStyle,args:[t]}];let n=[];try{if(!r(e.version,t.version))return[{command:V.setStyle,args:[t]}];r(e.center,t.center)||n.push({command:V.setCenter,args:[t.center]}),r(e.zoom,t.zoom)||n.push({command:V.setZoom,args:[t.zoom]}),r(e.bearing,t.bearing)||n.push({command:V.setBearing,args:[t.bearing]}),r(e.pitch,t.pitch)||n.push({command:V.setPitch,args:[t.pitch]}),r(e.sprite,t.sprite)||n.push({command:V.setSprite,args:[t.sprite]}),r(e.glyphs,t.glyphs)||n.push({command:V.setGlyphs,args:[t.glyphs]}),r(e.transition,t.transition)||n.push({command:V.setTransition,args:[t.transition]}),r(e.light,t.light)||n.push({command:V.setLight,args:[t.light]});const a={},i=[];!function(e,t,n,a){let i;for(i in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||K(i,n,a));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?r(e[i],t[i])||("geojson"===e[i].type&&"geojson"===t[i].type&&Z(e,t,i)?n.push({command:V.setGeoJSONSourceData,args:[i,t[i].data]}):J(i,t,n,a)):G(i,t,n))}(e.sources,t.sources,i,a);const o=[];e.layers&&e.layers.forEach(e=>{a[e.source]?n.push({command:V.removeLayer,args:[e.id]}):o.push(e)}),n=n.concat(i),function(e,t,n){t=t||[];const a=(e=e||[]).map(ee),i=t.map(ee),o=e.reduce(te,{}),s=t.reduce(te,{}),l=a.slice(),c=Object.create(null);let u,d,p,m,b,h,f;for(u=0,d=0;u<a.length;u++)p=a[u],Object.prototype.hasOwnProperty.call(s,p)?d++:(n.push({command:V.removeLayer,args:[p]}),l.splice(l.indexOf(p,d),1));for(u=0,d=0;u<i.length;u++)p=i[i.length-1-u],l[l.length-1-u]!==p&&(Object.prototype.hasOwnProperty.call(o,p)?(n.push({command:V.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-d),1)):d++,h=l[l.length-u],n.push({command:V.addLayer,args:[s[p],h]}),l.splice(l.length-u,0,p),c[p]=!0);for(u=0;u<i.length;u++)if(p=i[u],m=o[p],b=s[p],!c[p]&&!r(m,b))if(r(m.source,b.source)&&r(m["source-layer"],b["source-layer"])&&r(m.type,b.type)){for(f in Q(m.layout,b.layout,n,p,null,V.setLayoutProperty),Q(m.paint,b.paint,n,p,null,V.setPaintProperty),r(m.filter,b.filter)||n.push({command:V.setFilter,args:[p,b.filter]}),r(m.minzoom,b.minzoom)&&r(m.maxzoom,b.maxzoom)||n.push({command:V.setLayerZoomRange,args:[p,b.minzoom,b.maxzoom]}),m)Object.prototype.hasOwnProperty.call(m,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Q(m[f],b[f],n,p,f.slice(6),V.setPaintProperty):r(m[f],b[f])||n.push({command:V.setLayerProperty,args:[p,f,b[f]]}));for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&!Object.prototype.hasOwnProperty.call(m,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Q(m[f],b[f],n,p,f.slice(6),V.setPaintProperty):r(m[f],b[f])||n.push({command:V.setLayerProperty,args:[p,f,b[f]]}))}else n.push({command:V.removeLayer,args:[p]}),h=l[l.lastIndexOf(p)+1],n.push({command:V.addLayer,args:[b,h]})}(o,t.layers,n)}catch(e){console.warn("Unable to compute style diff:",e),n=[{command:V.setStyle,args:[t]}]}return n}(this.serialize(),t).filter(e=>!(e.command in Qe));if(0===n.length)return!1;const a=n.filter(e=>!(e.command in Ze));if(a.length>0)throw new Error(`Unimplemented: ${a.map(e=>e.command).join(", ")}.`);return n.forEach(e=>{"setTransition"!==e.command&&this[e.command].apply(this,e.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new e.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){if(!this.getImage(t))return this.fire(new e.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(e.validateStyle.source,"sources."+t,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const r=this.sourceCaches[t]=new D(t,n,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:t})),r.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID="+e);const n=this.sourceCaches[e].getSource();if("geojson"!==n.type)throw new Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(t,n,a={}){this._checkLoaded();const r=t.id;if(this.getLayer(r))return void this.fire(new e.ErrorEvent(new Error(`Layer "${r}" already exists on this map.`)));let i;if("custom"===t.type){if(Je(this,e.validateCustomStyleLayer(t)))return;i=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(r,t.source),t=e.clone$1(t),t=e.extend(t,{source:r})),this._validate(e.validateStyle.layer,"layers."+r,t,{arrayIndex:-1},a))return;i=e.createStyleLayer(t),this._validateLayer(i),i.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[i.id]=i.serialize()}const o=n?this._order.indexOf(n):this._order.length;if(n&&-1===o)this.fire(new e.ErrorEvent(new Error(`Cannot add layer "${r}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._layers[r]=i,this._removedLayers[r]&&i.source&&"custom"!==i.type){const e=this._removedLayers[r];delete this._removedLayers[r],e.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const r=n?this._order.indexOf(n):this._order.length;n&&-1===r?this.fire(new e.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(r,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new e.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const r=this.getLayer(t);r?r.minzoom===n&&r.maxzoom===a||(null!=n&&(r.minzoom=n),null!=a&&(r.maxzoom=a),this._updateLayer(r)):this.fire(new e.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const i=this.getLayer(t);if(i){if(!r(i.filter,n))return null==n?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(e.validateStyle.filter,`layers.${i.id}.filter`,n,null,a)||(i.filter=e.clone$1(n),this._updateLayer(i)))}else this.fire(new e.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,i={}){this._checkLoaded();const o=this.getLayer(t);o?r(o.getLayoutProperty(n),a)||(o.setLayoutProperty(n,a,i),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new e.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,i={}){this._checkLoaded();const o=this.getLayer(t);o?r(o.getPaintProperty(n),a)||(o.setPaintProperty(n,a,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new e.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(t,n){this._checkLoaded();const a=t.source,r=t.sourceLayer,i=this.sourceCaches[a];if(void 0===i)return void this.fire(new e.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const o=i.getSource().type;"geojson"===o&&r?this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||r?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),i.setFeatureState(r,t.id,n)):this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,r=this.sourceCaches[a];if(void 0===r)return void this.fire(new e.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const i=r.getSource().type,o="vector"===i?t.sourceLayer:void 0;"vector"!==i||o?n&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(o,t.id,n):this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,r=this.sourceCaches[n];if(void 0!==r)return"vector"!==r.getSource().type||a?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(a,t.id)):void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:e.mapObject(this.sourceCaches,e=>e.serialize()),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,n={},a=[];for(let r=this._order.length-1;r>=0;r--){const i=this._order[r];if(t(i)){n[i]=r;for(const t of e){const e=t[i];if(e)for(const t of e)a.push(t)}}}a.sort((e,t)=>t.intersectionZ-e.intersectionZ);const r=[];for(let i=this._order.length-1;i>=0;i--){const o=this._order[i];if(t(o))for(let e=a.length-1;e>=0;e--){const t=a[e].feature;if(n[t.layer.id]<i)break;r.push(t),a.pop()}else for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t.feature)}}return r}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(e.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const r={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new e.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const t of n.layers){const n=this._layers[t];if(!n)return this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];r[n.source]=!0}}const i=[];n.availableImages=this._availableImages;for(const e in this.sourceCaches)n.layers&&!r[e]||i.push(L(this.sourceCaches[e],this._layers,this._serializedLayers,t,n,a));return this.placement&&i.push(function(e,t,n,a,r,i,o){const s={},l=i.queryRenderedSymbols(a),c=[];for(const e of Object.keys(l).map(Number))c.push(o[e]);c.sort(S);for(const n of c){const a=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,r.filter,r.layers,r.availableImages,e);for(const e in a){const t=s[e]=s[e]||[],r=a[e];r.sort((e,t)=>{const a=n.featureSortOrder;if(a){const n=a.indexOf(e.featureIndex);return a.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(const e of r)t.push(e)}}for(const t in s)s[t].forEach(a=>{const r=a.feature,i=n[e[t].source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i});return s}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(i)}querySourceFeatures(t,n){n&&n.filter&&this._validate(e.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(e,t){const n=e.getRenderableIds().map(t=>e.getTileByID(t)),a=[],r={};for(let e=0;e<n.length;e++){const i=n[e],o=i.tileID.canonical.key;r[o]||(r[o]=!0,i.querySourceFeatures(a,t))}return a}(a,n):[]}addSourceType(e,t,n){return tt.getSourceType(e)?n(new Error(`A source type called "${e}" already exists.`)):(tt.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let i=!1;for(const e in t)if(!r(t[e],a[e])){i=!0;break}if(!i)return;const o={now:e.exported.now(),transition:e.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(o)}_validate(t,n,a,r,i={}){return(!i||!1!==i.validate)&&Je(this,t.call(e.validateStyle,e.extend({key:n,style:this.serialize(),value:a,styleSpec:e.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this.sourceCaches){const t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const t in this.sourceCaches)this.sourceCaches[t].update(e,this.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(t,n,a,r,i=!1){let o=!1,s=!1;const l={};for(const e of this._order){const n=this._layers[e];if("symbol"!==n.type)continue;if(!l[n.source]){const e=this.sourceCaches[n.source];l[n.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const a=this.crossTileSymbolIndex.addLayer(n,l[n.source],t.center.lng);o=o||a}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((i=i||this._layerOrderChanged||0===a)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new $e(t,this.terrain,this._order,i,n,a,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,n){this.imageManager.getImages(t.icons,n),this._updateTilesForChangedImages();const a=this.sourceCaches[t.source];a&&a.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,n){this.glyphManager.getGlyphs(t.stacks,n)}getResource(t,n,a){return e.makeRequest(n,a)}}tt.getSourceType=function(e){return j[e]},tt.setSourceType=function(e,t){j[e]=t},tt.registerForPluginStateChange=e.registerForPluginStateChange;var nt="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const at={prelude:rt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:rt("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:rt("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:rt("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:rt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:rt("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:rt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:rt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:rt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:rt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:rt("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:rt("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:rt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:rt("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:rt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:rt("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:rt("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:rt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:rt("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:rt("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:rt("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:rt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",nt),terrainDepth:rt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",nt),terrainCoords:rt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",nt)};function rt(e,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=i?i.concat(r):r,s={};return{fragmentSource:e=e.replace(n,(e,t,n,a,r)=>(s[r]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${n} ${a} ${r};\n#else\nuniform ${n} ${a} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${n} ${a} ${r} = u_${r};\n#endif\n`)),vertexSource:t=t.replace(n,(e,t,n,a,r)=>{const i="float"===a?"vec2":"vec4",o=r.match(/color/)?"color":i;return s[r]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${i} a_${r};\nvarying ${n} ${a} ${r};\n#else\nuniform ${n} ${a} u_${r};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${o}(a_${r}, u_${r}_t);\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${i} a_${r};\n#else\nuniform ${n} ${a} u_${r};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${a} ${r} = a_${r};\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${a} ${r} = unpack_mix_${o}(a_${r}, u_${r}_t);\n#else\n ${n} ${a} ${r} = u_${r};\n#endif\n`}),staticAttributes:a,staticUniforms:o}}class it{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,n,a,r,i,o,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==a.length;for(let e=0;!c&&e<a.length;e++)this.boundPaintVertexBuffers[e]!==a[e]&&(c=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===t&&this.boundLayoutVertexBuffer===n&&!c&&this.boundIndexBuffer===r&&this.boundVertexOffset===i&&this.boundDynamicVertexBuffer===o&&this.boundDynamicVertexBuffer2===s&&this.boundDynamicVertexBuffer3===l?(e.bindVertexArrayOES.set(this.vao),o&&o.bind(),r&&r.dynamicDraw&&r.bind(),s&&s.bind(),l&&l.bind()):this.freshBind(t,n,a,r,i,o,s,l)}freshBind(e,t,n,a,r,i,o,s){let l;const c=e.numAttributes,u=this.context,d=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),l=0,this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=a,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=i,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s;else{l=u.currentNumAttributes||0;for(let e=c;e<l;e++)d.disableVertexAttribArray(e)}t.enableAttributes(d,e);for(const t of n)t.enableAttributes(d,e);i&&i.enableAttributes(d,e),o&&o.enableAttributes(d,e),s&&s.enableAttributes(d,e),t.bind(),t.setVertexAttribPointers(d,e,r);for(const t of n)t.bind(),t.setVertexAttribPointers(d,e,r);i&&(i.bind(),i.setVertexAttribPointers(d,e,r)),a&&a.bind(),o&&(o.bind(),o.setVertexAttribPointers(d,e,r)),s&&(s.bind(),s.setVertexAttribPointers(d,e,r)),u.currentNumAttributes=c}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function ot(e){const t=[];for(let n=0;n<e.length;n++){if(null===e[n])continue;const a=e[n].split(" ");t.push(a.pop())}return t}class st{constructor(t,n,a,r,i,o,s){const l=t.gl;this.program=l.createProgram();const c=ot(a.staticAttributes),u=r?r.getBinderAttributes():[],d=c.concat(u),p=at.prelude.staticUniforms?ot(at.prelude.staticUniforms):[],m=a.staticUniforms?ot(a.staticUniforms):[],b=r?r.getBinderUniforms():[],h=p.concat(m).concat(b),f=[];for(const e of h)f.indexOf(e)<0&&f.push(e);const g=r?r.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),s&&g.push("#define TERRAIN3D;");const _=g.concat(at.prelude.fragmentSource,a.fragmentSource).join("\n"),y=g.concat(at.prelude.vertexSource,a.vertexSource).join("\n"),M=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(M,_),l.compileShader(M),l.attachShader(this.program,M);const v=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(v,y),l.compileShader(v),l.attachShader(this.program,v),this.attributes={};const z={};this.numAttributes=d.length;for(let e=0;e<this.numAttributes;e++)d[e]&&(l.bindAttribLocation(this.program,e,d[e]),this.attributes[d[e]]=e);l.linkProgram(this.program),l.deleteShader(v),l.deleteShader(M);for(let e=0;e<f.length;e++){const t=f[e];if(t&&!z[t]){const e=l.getUniformLocation(this.program,t);e&&(z[t]=e)}}this.fixedUniforms=i(t,z),this.terrainUniforms=((t,n)=>({u_depth:new e.Uniform1i(t,n.u_depth),u_terrain:new e.Uniform1i(t,n.u_terrain),u_terrain_dim:new e.Uniform1f(t,n.u_terrain_dim),u_terrain_matrix:new e.UniformMatrix4f(t,n.u_terrain_matrix),u_terrain_unpack:new e.Uniform4f(t,n.u_terrain_unpack),u_terrain_offset:new e.Uniform1f(t,n.u_terrain_offset),u_terrain_exaggeration:new e.Uniform1f(t,n.u_terrain_exaggeration)}))(t,z),this.binderUniforms=r?r.getUniforms(t,z):[]}draw(e,t,n,a,r,i,o,s,l,c,u,d,p,m,b,h,f,g){const _=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(a),e.setColorMode(r),e.setCullFace(i),s){e.activeTexture.set(_.TEXTURE2),_.bindTexture(_.TEXTURE_2D,s.depthTexture),e.activeTexture.set(_.TEXTURE3),_.bindTexture(_.TEXTURE_2D,s.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}for(const e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);b&&b.setUniforms(e,this.binderUniforms,p,{zoom:m});let y=0;switch(t){case _.LINES:y=2;break;case _.TRIANGLES:y=3;break;case _.LINE_STRIP:y=1}for(const n of d.get()){const a=n.vaos||(n.vaos={});(a[l]||(a[l]=new it)).bind(e,this,c,b?b.getPaintVertexBuffers():[],u,n.vertexOffset,h,f,g),_.drawElements(t,n.primitiveLength*y,_.UNSIGNED_SHORT,n.primitiveOffset*y*2)}}}function lt(e,t,n){const a=1/ve(n,1,t.transform.tileZoom),r=Math.pow(2,n.tileID.overscaledZ),i=n.tileSize*Math.pow(2,t.transform.tileZoom)/r,o=i*(n.tileID.canonical.x+n.tileID.wrap*r),s=i*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const ct=(t,n,a,r)=>{const i=n.style.light,o=i.properties.get("position"),s=[o.x,o.y,o.z],l=e.create$1();"viewport"===i.properties.get("anchor")&&e.fromRotation(l,-n.transform.angle),e.transformMat3(s,s,l);const c=i.properties.get("color");return{u_matrix:t,u_lightpos:s,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+a,u_opacity:r}},ut=(t,n,a,r,i,o,s)=>e.extend(ct(t,n,a,r),lt(o,n,s),{u_height_factor:-Math.pow(2,i.overscaledZ)/s.tileSize/8}),dt=e=>({u_matrix:e}),pt=(t,n,a,r)=>e.extend(dt(t),lt(a,n,r)),mt=(e,t)=>({u_matrix:e,u_world:t}),bt=(t,n,a,r,i)=>e.extend(pt(t,n,a,r),{u_world:i}),ht=(e,t,n,a)=>{const r=e.transform;let i,o;if("map"===a.paint.get("circle-pitch-alignment")){const e=ve(n,1,r.zoom);i=!0,o=[e,e]}else i=!1,o=r.pixelsToGLUnits;return{u_camera_to_center_distance:r.cameraToCenterDistance,u_scale_with_map:+("map"===a.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+i,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:o}},ft=(e,t,n)=>{const a=ve(n,1,t.zoom),r=Math.pow(2,t.zoom-n.tileID.overscaledZ),i=n.tileID.overscaleFactor();return{u_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*r),t.pixelsToGLUnits[1]/(a*r)],u_overscale_factor:i}},gt=(e,t,n=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:n}),_t=e=>({u_matrix:e}),yt=(e,t,n,a)=>({u_matrix:e,u_extrude_scale:ve(t,1,n),u_intensity:a});function Mt(t,n){const a=Math.pow(2,n.canonical.z),r=n.canonical.y;return[new e.MercatorCoordinate(0,r/a).toLngLat().lat,new e.MercatorCoordinate(0,(r+1)/a).toLngLat().lat]}const vt=(e,t,n,a)=>{const r=e.transform;return{u_matrix:xt(e,t,n,a),u_ratio:1/ve(t,1,r.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},zt=(t,n,a,r,i)=>e.extend(vt(t,n,a,i),{u_image:0,u_image_height:r}),Ot=(e,t,n,a,r)=>{const i=e.transform,o=At(t,i);return{u_matrix:xt(e,t,n,r),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ve(t,1,i.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},kt=(t,n,a,r,i,o)=>{const s=t.lineAtlas,l=At(n,t.transform),c="round"===a.layout.get("line-cap"),u=s.getDash(r.from,c),d=s.getDash(r.to,c),p=u.width*i.fromScale,m=d.width*i.toScale;return e.extend(vt(t,n,a,o),{u_patternscale_a:[l/p,-u.height/2],u_patternscale_b:[l/m,-d.height/2],u_sdfgamma:s.width/(256*Math.min(p,m)*t.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:d.y,u_mix:i.t})};function At(e,t){return 1/ve(e,1,t.tileZoom)}function xt(e,t,n,a){return e.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const wt=(e,t,n,a,r)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(o=r.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(i=r.paint.get("raster-contrast"),i>0?1/(1-i):1+i),u_spin_weights:Nt(r.paint.get("raster-hue-rotate"))};var i,o};function Nt(e){e*=Math.PI/180;const t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const qt=(e,t,n,a,r,i,o,s,l,c)=>{const u=r.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:i,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+a,u_texsize:c,u_texture:0}},Et=(t,n,a,r,i,o,s,l,c,u,d)=>{const p=i.transform;return e.extend(qt(t,n,a,r,i,o,s,l,c,u),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+d})},jt=(t,n,a,r,i,o,s,l,c,u)=>e.extend(Et(t,n,a,r,i,o,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1}),Wt=(e,t,n)=>({u_matrix:e,u_opacity:t,u_color:n}),Lt=(t,n,a,r,i,o)=>e.extend(function(e,t,n,a){const r=n.imageManager.getPattern(e.from.toString()),i=n.imageManager.getPattern(e.to.toString()),{width:o,height:s}=n.imageManager.getPixelSize(),l=Math.pow(2,a.tileID.overscaledZ),c=a.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(a.tileID.canonical.x+a.tileID.wrap*l),d=c*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:i.tl,u_pattern_br_b:i.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:i.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/ve(a,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(r,o,a,i),{u_matrix:t,u_opacity:n}),St={fillExtrusion:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_lightpos:new e.Uniform3f(t,n.u_lightpos),u_lightintensity:new e.Uniform1f(t,n.u_lightintensity),u_lightcolor:new e.Uniform3f(t,n.u_lightcolor),u_vertical_gradient:new e.Uniform1f(t,n.u_vertical_gradient),u_opacity:new e.Uniform1f(t,n.u_opacity)}),fillExtrusionPattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_lightpos:new e.Uniform3f(t,n.u_lightpos),u_lightintensity:new e.Uniform1f(t,n.u_lightintensity),u_lightcolor:new e.Uniform3f(t,n.u_lightcolor),u_vertical_gradient:new e.Uniform1f(t,n.u_vertical_gradient),u_height_factor:new e.Uniform1f(t,n.u_height_factor),u_image:new e.Uniform1i(t,n.u_image),u_texsize:new e.Uniform2f(t,n.u_texsize),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade),u_opacity:new e.Uniform1f(t,n.u_opacity)}),fill:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),fillPattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_image:new e.Uniform1i(t,n.u_image),u_texsize:new e.Uniform2f(t,n.u_texsize),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade)}),fillOutline:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_world:new e.Uniform2f(t,n.u_world)}),fillOutlinePattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_world:new e.Uniform2f(t,n.u_world),u_image:new e.Uniform1i(t,n.u_image),u_texsize:new e.Uniform2f(t,n.u_texsize),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade)}),circle:(t,n)=>({u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_scale_with_map:new e.Uniform1i(t,n.u_scale_with_map),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_extrude_scale:new e.Uniform2f(t,n.u_extrude_scale),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),collisionBox:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pixels_to_tile_units:new e.Uniform1f(t,n.u_pixels_to_tile_units),u_extrude_scale:new e.Uniform2f(t,n.u_extrude_scale),u_overscale_factor:new e.Uniform1f(t,n.u_overscale_factor)}),collisionCircle:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_inv_matrix:new e.UniformMatrix4f(t,n.u_inv_matrix),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_viewport_size:new e.Uniform2f(t,n.u_viewport_size)}),debug:(t,n)=>({u_color:new e.UniformColor(t,n.u_color),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_overlay:new e.Uniform1i(t,n.u_overlay),u_overlay_scale:new e.Uniform1f(t,n.u_overlay_scale)}),clippingMask:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),heatmap:(t,n)=>({u_extrude_scale:new e.Uniform1f(t,n.u_extrude_scale),u_intensity:new e.Uniform1f(t,n.u_intensity),u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),heatmapTexture:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_world:new e.Uniform2f(t,n.u_world),u_image:new e.Uniform1i(t,n.u_image),u_color_ramp:new e.Uniform1i(t,n.u_color_ramp),u_opacity:new e.Uniform1f(t,n.u_opacity)}),hillshade:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_image:new e.Uniform1i(t,n.u_image),u_latrange:new e.Uniform2f(t,n.u_latrange),u_light:new e.Uniform2f(t,n.u_light),u_shadow:new e.UniformColor(t,n.u_shadow),u_highlight:new e.UniformColor(t,n.u_highlight),u_accent:new e.UniformColor(t,n.u_accent)}),hillshadePrepare:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_image:new e.Uniform1i(t,n.u_image),u_dimension:new e.Uniform2f(t,n.u_dimension),u_zoom:new e.Uniform1f(t,n.u_zoom),u_unpack:new e.Uniform4f(t,n.u_unpack)}),line:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels)}),lineGradient:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels),u_image:new e.Uniform1i(t,n.u_image),u_image_height:new e.Uniform1f(t,n.u_image_height)}),linePattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_texsize:new e.Uniform2f(t,n.u_texsize),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_image:new e.Uniform1i(t,n.u_image),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels),u_scale:new e.Uniform3f(t,n.u_scale),u_fade:new e.Uniform1f(t,n.u_fade)}),lineSDF:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_ratio:new e.Uniform1f(t,n.u_ratio),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.Uniform2f(t,n.u_units_to_pixels),u_patternscale_a:new e.Uniform2f(t,n.u_patternscale_a),u_patternscale_b:new e.Uniform2f(t,n.u_patternscale_b),u_sdfgamma:new e.Uniform1f(t,n.u_sdfgamma),u_image:new e.Uniform1i(t,n.u_image),u_tex_y_a:new e.Uniform1f(t,n.u_tex_y_a),u_tex_y_b:new e.Uniform1f(t,n.u_tex_y_b),u_mix:new e.Uniform1f(t,n.u_mix)}),raster:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_tl_parent:new e.Uniform2f(t,n.u_tl_parent),u_scale_parent:new e.Uniform1f(t,n.u_scale_parent),u_buffer_scale:new e.Uniform1f(t,n.u_buffer_scale),u_fade_t:new e.Uniform1f(t,n.u_fade_t),u_opacity:new e.Uniform1f(t,n.u_opacity),u_image0:new e.Uniform1i(t,n.u_image0),u_image1:new e.Uniform1i(t,n.u_image1),u_brightness_low:new e.Uniform1f(t,n.u_brightness_low),u_brightness_high:new e.Uniform1f(t,n.u_brightness_high),u_saturation_factor:new e.Uniform1f(t,n.u_saturation_factor),u_contrast_factor:new e.Uniform1f(t,n.u_contrast_factor),u_spin_weights:new e.Uniform3f(t,n.u_spin_weights)}),symbolIcon:(t,n)=>({u_is_size_zoom_constant:new e.Uniform1i(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.Uniform1i(t,n.u_is_size_feature_constant),u_size_t:new e.Uniform1f(t,n.u_size_t),u_size:new e.Uniform1f(t,n.u_size),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pitch:new e.Uniform1f(t,n.u_pitch),u_rotate_symbol:new e.Uniform1i(t,n.u_rotate_symbol),u_aspect_ratio:new e.Uniform1f(t,n.u_aspect_ratio),u_fade_change:new e.Uniform1f(t,n.u_fade_change),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_label_plane_matrix:new e.UniformMatrix4f(t,n.u_label_plane_matrix),u_coord_matrix:new e.UniformMatrix4f(t,n.u_coord_matrix),u_is_text:new e.Uniform1i(t,n.u_is_text),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_texsize:new e.Uniform2f(t,n.u_texsize),u_texture:new e.Uniform1i(t,n.u_texture)}),symbolSDF:(t,n)=>({u_is_size_zoom_constant:new e.Uniform1i(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.Uniform1i(t,n.u_is_size_feature_constant),u_size_t:new e.Uniform1f(t,n.u_size_t),u_size:new e.Uniform1f(t,n.u_size),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pitch:new e.Uniform1f(t,n.u_pitch),u_rotate_symbol:new e.Uniform1i(t,n.u_rotate_symbol),u_aspect_ratio:new e.Uniform1f(t,n.u_aspect_ratio),u_fade_change:new e.Uniform1f(t,n.u_fade_change),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_label_plane_matrix:new e.UniformMatrix4f(t,n.u_label_plane_matrix),u_coord_matrix:new e.UniformMatrix4f(t,n.u_coord_matrix),u_is_text:new e.Uniform1i(t,n.u_is_text),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_texsize:new e.Uniform2f(t,n.u_texsize),u_texture:new e.Uniform1i(t,n.u_texture),u_gamma_scale:new e.Uniform1f(t,n.u_gamma_scale),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_is_halo:new e.Uniform1i(t,n.u_is_halo)}),symbolTextAndIcon:(t,n)=>({u_is_size_zoom_constant:new e.Uniform1i(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.Uniform1i(t,n.u_is_size_feature_constant),u_size_t:new e.Uniform1f(t,n.u_size_t),u_size:new e.Uniform1f(t,n.u_size),u_camera_to_center_distance:new e.Uniform1f(t,n.u_camera_to_center_distance),u_pitch:new e.Uniform1f(t,n.u_pitch),u_rotate_symbol:new e.Uniform1i(t,n.u_rotate_symbol),u_aspect_ratio:new e.Uniform1f(t,n.u_aspect_ratio),u_fade_change:new e.Uniform1f(t,n.u_fade_change),u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_label_plane_matrix:new e.UniformMatrix4f(t,n.u_label_plane_matrix),u_coord_matrix:new e.UniformMatrix4f(t,n.u_coord_matrix),u_is_text:new e.Uniform1i(t,n.u_is_text),u_pitch_with_map:new e.Uniform1i(t,n.u_pitch_with_map),u_texsize:new e.Uniform2f(t,n.u_texsize),u_texsize_icon:new e.Uniform2f(t,n.u_texsize_icon),u_texture:new e.Uniform1i(t,n.u_texture),u_texture_icon:new e.Uniform1i(t,n.u_texture_icon),u_gamma_scale:new e.Uniform1f(t,n.u_gamma_scale),u_device_pixel_ratio:new e.Uniform1f(t,n.u_device_pixel_ratio),u_is_halo:new e.Uniform1i(t,n.u_is_halo)}),background:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_opacity:new e.Uniform1f(t,n.u_opacity),u_color:new e.UniformColor(t,n.u_color)}),backgroundPattern:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_opacity:new e.Uniform1f(t,n.u_opacity),u_image:new e.Uniform1i(t,n.u_image),u_pattern_tl_a:new e.Uniform2f(t,n.u_pattern_tl_a),u_pattern_br_a:new e.Uniform2f(t,n.u_pattern_br_a),u_pattern_tl_b:new e.Uniform2f(t,n.u_pattern_tl_b),u_pattern_br_b:new e.Uniform2f(t,n.u_pattern_br_b),u_texsize:new e.Uniform2f(t,n.u_texsize),u_mix:new e.Uniform1f(t,n.u_mix),u_pattern_size_a:new e.Uniform2f(t,n.u_pattern_size_a),u_pattern_size_b:new e.Uniform2f(t,n.u_pattern_size_b),u_scale_a:new e.Uniform1f(t,n.u_scale_a),u_scale_b:new e.Uniform1f(t,n.u_scale_b),u_pixel_coord_upper:new e.Uniform2f(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.Uniform2f(t,n.u_pixel_coord_lower),u_tile_units_to_pixels:new e.Uniform1f(t,n.u_tile_units_to_pixels)}),terrain:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_texture:new e.Uniform1i(t,n.u_texture)}),terrainDepth:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix)}),terrainCoords:(t,n)=>({u_matrix:new e.UniformMatrix4f(t,n.u_matrix),u_texture:new e.Uniform1i(t,n.u_texture),u_terrain_coords_id:new e.Uniform1f(t,n.u_terrain_coords_id)})};class Tt{constructor(e,t,n){this.context=e;const a=e.gl;this.buffer=a.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ct={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Rt{constructor(e,t,n,a){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=a,this.context=e;const r=e.gl;this.buffer=r.createBuffer(),e.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n=0;n<this.attributes.length;n++){const a=t.attributes[this.attributes[n].name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,t,n){for(let a=0;a<this.attributes.length;a++){const r=this.attributes[a],i=t.attributes[r.name];void 0!==i&&e.vertexAttribPointer(i,r.components,e[Ct[r.type]],!1,this.itemSize,r.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Dt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Pt extends Dt{getDefault(){return e.Color.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Bt extends Dt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class It extends Dt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class $t extends Dt{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ft extends Dt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Xt extends Dt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Yt extends Dt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Ht extends Dt{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Ut extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class Vt extends Dt{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Gt extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Kt extends Dt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Jt extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Zt extends Dt{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Qt extends Dt{getDefault(){return e.Color.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class en extends Dt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class tn extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class nn extends Dt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class an extends Dt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class rn extends Dt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class on extends Dt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class sn extends Dt{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ln extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class cn extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class un extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class dn extends Dt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class pn extends Dt{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class mn extends Dt{constructor(e){super(e),this.vao=e.extVertexArrayObject}getDefault(){return null}set(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}class bn extends Dt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class hn extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class fn extends Dt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class gn extends Dt{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class _n extends gn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class yn extends gn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Mn{constructor(e,t,n,a){this.context=e,this.width=t,this.height=n;const r=e.gl,i=this.framebuffer=r.createFramebuffer();if(this.colorAttachment=new _n(e,i),a&&(this.depthAttachment=new yn(e,i)),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class vn{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}}vn.Replace=[1,0],vn.disabled=new vn(vn.Replace,e.Color.transparent,[!1,!1,!1,!1]),vn.unblended=new vn(vn.Replace,e.Color.transparent,[!0,!0,!0,!0]),vn.alphaBlended=new vn([1,771],e.Color.transparent,[!0,!0,!0,!0]);class zn{constructor(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Pt(this),this.clearDepth=new Bt(this),this.clearStencil=new It(this),this.colorMask=new $t(this),this.depthMask=new Ft(this),this.stencilMask=new Xt(this),this.stencilFunc=new Yt(this),this.stencilOp=new Ht(this),this.stencilTest=new Ut(this),this.depthRange=new Vt(this),this.depthTest=new Gt(this),this.depthFunc=new Kt(this),this.blend=new Jt(this),this.blendFunc=new Zt(this),this.blendColor=new Qt(this),this.blendEquation=new en(this),this.cullFace=new tn(this),this.cullFaceSide=new nn(this),this.frontFace=new an(this),this.program=new rn(this),this.activeTexture=new on(this),this.viewport=new sn(this),this.bindFramebuffer=new ln(this),this.bindRenderbuffer=new cn(this),this.bindTexture=new un(this),this.bindVertexBuffer=new dn(this),this.bindElementBuffer=new pn(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new mn(this),this.pixelStoreUnpack=new bn(this),this.pixelStoreUnpackPremultiplyAlpha=new hn(this),this.pixelStoreUnpackFlipY=new fn(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(e.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new Tt(this,e,t)}createVertexBuffer(e,t,n){return new Rt(this,e,t,n)}createRenderbuffer(e,t,n){const a=this.gl,r=a.createRenderbuffer();return this.bindRenderbuffer.set(r),a.renderbufferStorage(a.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),r}createFramebuffer(e,t,n){return new Mn(this,e,t,n)}clear({color:e,depth:t}){const n=this.gl;let a=0;e&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n.clear(a)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){r(e.blendFunction,vn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class On{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}}On.ReadOnly=!1,On.ReadWrite=!0,On.disabled=new On(519,On.ReadOnly,[0,1]);class kn{constructor(e,t,n,a,r,i){this.test=e,this.ref=t,this.mask=n,this.fail=a,this.depthFail=r,this.pass=i}}kn.disabled=new kn({func:519,mask:0},0,0,7680,7680,7680);class An{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}}let xn;function wn(t,n,a,r,i,o,s){const l=t.context,c=l.gl,u=t.useProgram("collisionBox"),d=[];let p=0,m=0;for(let b=0;b<r.length;b++){const h=r[b],f=n.getTile(h),g=f.getBucket(a);if(!g)continue;let _=h.posMatrix;0===i[0]&&0===i[1]||(_=t.translatePosMatrix(h.posMatrix,f,i,o));const y=s?g.textCollisionBox:g.iconCollisionBox,M=g.collisionCircleArray;if(M.length>0){const n=e.create(),a=_;e.mul(n,g.placementInvProjMatrix,t.transform.glCoordMatrix),e.mul(n,n,g.placementViewportMatrix),d.push({circleArray:M,circleOffset:m,transform:a,invTransform:n,coord:h}),p+=M.length/4,m=p}y&&u.draw(l,c.LINES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,ft(_,t.transform,f),t.style.terrain&&t.style.terrain.getTerrainData(h),a.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,t.transform.zoom,null,null,y.collisionVertexBuffer)}if(!s||!d.length)return;const b=t.useProgram("collisionCircle"),h=new e.CollisionCircleLayoutArray;h.resize(4*p),h._trim();let f=0;for(const e of d)for(let t=0;t<e.circleArray.length/4;t++){const n=4*t,a=e.circleArray[n+0],r=e.circleArray[n+1],i=e.circleArray[n+2],o=e.circleArray[n+3];h.emplace(f++,a,r,i,o,0),h.emplace(f++,a,r,i,o,1),h.emplace(f++,a,r,i,o,2),h.emplace(f++,a,r,i,o,3)}(!xn||xn.length<2*p)&&(xn=function(t){const n=2*t,a=new e.QuadTriangleArray;a.resize(n),a._trim();for(let e=0;e<n;e++){const t=6*e;a.uint16[t+0]=4*e+0,a.uint16[t+1]=4*e+1,a.uint16[t+2]=4*e+2,a.uint16[t+3]=4*e+2,a.uint16[t+4]=4*e+3,a.uint16[t+5]=4*e+0}return a}(p));const g=l.createIndexBuffer(xn,!0),_=l.createVertexBuffer(h,e.collisionCircleLayout.members,!0);for(const n of d){const r={u_matrix:n.transform,u_inv_matrix:n.invTransform,u_camera_to_center_distance:(y=t.transform).cameraToCenterDistance,u_viewport_size:[y.width,y.height]};b.draw(l,c.TRIANGLES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,r,t.style.terrain&&t.style.terrain.getTerrainData(n.coord),a.id,_,g,e.SegmentVector.simpleSegment(0,2*n.circleOffset,n.circleArray.length,n.circleArray.length/2),null,t.transform.zoom,null,null,null)}var y;_.destroy(),g.destroy()}An.disabled=new An(!1,1029,2305),An.backCCW=new An(!0,1029,2305);const Nn=e.identity(new Float32Array(16));function qn(t,n,a,r,i,o){const{horizontalAlign:s,verticalAlign:l}=e.getAnchorAlignment(t),c=-(s-.5)*n,u=-(l-.5)*a,d=e.evaluateVariableOffset(t,r);return new e.pointGeometry((c/i+d[0])*o,(u/i+d[1])*o)}function En(t,n,a,r,i,o,s,l,c,u,d){const p=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,b=t.icon.dynamicLayoutVertexArray,h={};m.clear();for(let b=0;b<p.length;b++){const f=p.get(b),g=t.allowVerticalPlacement&&!f.placedOrientation,_=f.hidden||!f.crossTileID||g?null:r[f.crossTileID];if(_){const r=new e.pointGeometry(f.anchorX,f.anchorY),p=se(r,a?s:o,d),b=le(i.cameraToCenterDistance,p.signedDistanceFromCamera);let g=e.evaluateSizeForFeature(t.textSizeData,c,f)*b/e.ONE_EM;a&&(g*=t.tilePixelRatio/l);const{width:y,height:M,anchor:v,textOffset:z,textBoxScale:O}=_,k=qn(v,y,M,z,O,g),A=a?se(r.add(k),o,d).point:p.point.add(n?k.rotate(-i.angle):k),x=t.allowVerticalPlacement&&f.placedOrientation===e.WritingMode.vertical?Math.PI/2:0;for(let t=0;t<f.numGlyphs;t++)e.addDynamicAttributes(m,A,x);u&&f.associatedIconIndex>=0&&(h[f.associatedIconIndex]={shiftedAnchor:A,angle:x})}else ge(f.numGlyphs,m)}if(u){b.clear();const n=t.icon.placedSymbolArray;for(let t=0;t<n.length;t++){const a=n.get(t);if(a.hidden)ge(a.numGlyphs,b);else{const n=h[t];if(n)for(let t=0;t<a.numGlyphs;t++)e.addDynamicAttributes(b,n.shiftedAnchor,n.angle);else ge(a.numGlyphs,b)}}t.icon.dynamicLayoutVertexBuffer.updateData(b)}t.text.dynamicLayoutVertexBuffer.updateData(m)}function jn(e,t,n){return n.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Wn(t,n,a,r,i,o,s,l,c,u,d,p){const m=t.context,b=m.gl,h=t.transform,f="map"===l,g="map"===c,_="viewport"!==l&&"point"!==a.layout.get("symbol-placement"),y=f&&!g&&!_,M=!a.layout.get("symbol-sort-key").isConstant();let v=!1;const z=t.depthModeForSublayer(0,On.ReadOnly),O=a.layout.get("text-variable-anchor"),k=[];for(const l of r){const r=n.getTile(l),c=r.getBucket(a);if(!c)continue;const d=i?c.text:c.icon;if(!d||!d.segments.get().length)continue;const p=d.programConfigurations.get(a.id),m=i||c.sdfIcons,z=i?c.textSizeData:c.iconSizeData,A=g||0!==h.pitch,x=t.useProgram(jn(m,i,c),p),w=e.evaluateSizeForZoom(z,h.zoom),N=t.style.terrain&&t.style.terrain.getTerrainData(l);let q,E,j,W,L=[0,0],S=null;if(i){if(E=r.glyphAtlasTexture,j=b.LINEAR,q=r.glyphAtlasTexture.size,c.iconsInText){L=r.imageAtlasTexture.size,S=r.imageAtlasTexture;const e="composite"===z.kind||"camera"===z.kind;W=A||t.options.rotating||t.options.zooming||e?b.LINEAR:b.NEAREST}}else{const e=1!==a.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;E=r.imageAtlasTexture,j=m||t.options.rotating||t.options.zooming||e||A?b.LINEAR:b.NEAREST,q=r.imageAtlasTexture.size}const T=ve(r,1,t.transform.zoom),C=ie(l.posMatrix,g,f,t.transform,T),R=oe(l.posMatrix,g,f,t.transform,T),D=O&&c.hasTextData(),P="none"!==a.layout.get("icon-text-fit")&&D&&c.hasIconData();if(_){const e=t.style.terrain?(e,n)=>t.style.terrain.getElevation(l,e,n):null,n="map"===a.layout.get("text-rotation-alignment");ue(c,l.posMatrix,t,i,C,R,g,u,n,e)}const B=t.translatePosMatrix(l.posMatrix,r,o,s),I=_||i&&O||P?Nn:C,$=t.translatePosMatrix(R,r,o,s,!0),F=m&&0!==a.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1);let X;X=m?c.iconsInText?jt(z.kind,w,y,g,t,B,I,$,q,L):Et(z.kind,w,y,g,t,B,I,$,i,q,!0):qt(z.kind,w,y,g,t,B,I,$,i,q);const Y={program:x,buffers:d,uniformValues:X,atlasTexture:E,atlasTextureIcon:S,atlasInterpolation:j,atlasInterpolationIcon:W,isSDF:m,hasHalo:F};if(M&&c.canOverlap){v=!0;const t=d.segments.get();for(const n of t)k.push({segments:new e.SegmentVector([n]),sortKey:n.sortKey,state:Y,terrainData:N})}else k.push({segments:d.segments,sortKey:0,state:Y,terrainData:N})}v&&k.sort((e,t)=>e.sortKey-t.sortKey);for(const e of k){const n=e.state;if(m.activeTexture.set(b.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,b.CLAMP_TO_EDGE),n.atlasTextureIcon&&(m.activeTexture.set(b.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,b.CLAMP_TO_EDGE)),n.isSDF){const r=n.uniformValues;n.hasHalo&&(r.u_is_halo=1,Ln(n.buffers,e.segments,a,t,n.program,z,d,p,r,e.terrainData)),r.u_is_halo=0}Ln(n.buffers,e.segments,a,t,n.program,z,d,p,n.uniformValues,e.terrainData)}}function Ln(e,t,n,a,r,i,o,s,l,c){const u=a.context;r.draw(u,u.gl.TRIANGLES,i,o,s,An.disabled,l,c,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,a.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Sn(e,t,n,a,r,i,o){const s=e.context.gl,l=n.paint.get("fill-pattern"),c=l&&l.constantOr(1),u=n.getCrossfadeParameters();let d,p,m,b,h;o?(p=c&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=s.LINES):(p=c?"fillPattern":"fill",d=s.TRIANGLES);for(const f of a){const a=t.getTile(f);if(c&&!a.patternsLoaded())continue;const g=a.getBucket(n);if(!g)continue;const _=g.programConfigurations.get(n.id),y=e.useProgram(p,_),M=e.style.terrain&&e.style.terrain.getTerrainData(f);c&&(e.context.activeTexture.set(s.TEXTURE0),a.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),_.updatePaintBuffers(u));const v=l.constantOr(null);if(v&&a.imageAtlas){const e=a.imageAtlas,t=e.patternPositions[v.to.toString()],n=e.patternPositions[v.from.toString()];t&&n&&_.setConstantPatternPositions(t,n)}const z=M?f:null,O=e.translatePosMatrix(z?z.posMatrix:f.posMatrix,a,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(o){b=g.indexBuffer2,h=g.segments2;const t=[s.drawingBufferWidth,s.drawingBufferHeight];m="fillOutlinePattern"===p&&c?bt(O,e,u,a,t):mt(O,t)}else b=g.indexBuffer,h=g.segments,m=c?pt(O,e,u,a):dt(O);y.draw(e.context,d,r,e.stencilModeForClipping(f),i,An.disabled,m,M,n.id,g.layoutVertexBuffer,b,h,n.paint,e.transform.zoom,_)}}function Tn(e,t,n,a,r,i,o){const s=e.context,l=s.gl,c=n.paint.get("fill-extrusion-pattern"),u=c.constantOr(1),d=n.getCrossfadeParameters(),p=n.paint.get("fill-extrusion-opacity");for(const m of a){const a=t.getTile(m),b=a.getBucket(n);if(!b)continue;const h=e.style.terrain&&e.style.terrain.getTerrainData(m),f=b.programConfigurations.get(n.id),g=e.useProgram(u?"fillExtrusionPattern":"fillExtrusion",f);u&&(e.context.activeTexture.set(l.TEXTURE0),a.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),f.updatePaintBuffers(d));const _=c.constantOr(null);if(_&&a.imageAtlas){const e=a.imageAtlas,t=e.patternPositions[_.to.toString()],n=e.patternPositions[_.from.toString()];t&&n&&f.setConstantPatternPositions(t,n)}const y=e.translatePosMatrix(m.posMatrix,a,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),M=n.paint.get("fill-extrusion-vertical-gradient"),v=u?ut(y,e,M,p,m,d,a):ct(y,e,M,p);g.draw(s,s.gl.TRIANGLES,r,i,o,An.backCCW,v,h,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,e.transform.zoom,f,e.style.terrain&&b.centroidVertexBuffer)}}function Cn(e,t,n,a,r,i,o){const s=e.context,l=s.gl,c=n.fbo;if(!c)return;const u=e.useProgram("hillshade"),d=e.style.terrain&&e.style.terrain.getTerrainData(t);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),u.draw(s,l.TRIANGLES,r,i,o,An.disabled,((e,t,n,a)=>{const r=n.paint.get("hillshade-shadow-color"),i=n.paint.get("hillshade-highlight-color"),o=n.paint.get("hillshade-accent-color");let s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);const l=!e.options.moving;return{u_matrix:a?a.posMatrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:Mt(0,t.tileID),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:i,u_accent:o}})(e,n,a,d?t:null),d,a.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function Rn(t,n,a,r,i,o){const s=t.context,c=s.gl,u=n.dem;if(u&&u.data){const d=u.dim,p=u.stride,m=u.getPixels();if(s.activeTexture.set(c.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(p),n.demTexture){const e=n.demTexture;e.update(m,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else n.demTexture=new l(s,m,c.RGBA,{premultiply:!1}),n.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);s.activeTexture.set(c.TEXTURE0);let b=n.fbo;if(!b){const e=new l(s,{width:d,height:d,data:null},c.RGBA);e.bind(c.LINEAR,c.CLAMP_TO_EDGE),b=n.fbo=s.createFramebuffer(d,d,!0),b.colorAttachment.set(e.texture)}s.bindFramebuffer.set(b.framebuffer),s.viewport.set([0,0,d,d]),t.useProgram("hillshadePrepare").draw(s,c.TRIANGLES,r,i,o,An.disabled,((t,n)=>{const a=n.stride,r=e.create();return e.ortho(r,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(r,r,[0,-e.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[a,a],u_zoom:t.overscaledZ,u_unpack:n.getUnpackVector()}})(n.tileID,u),null,a.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Dn(t,n,a,r,i,o){const s=r.paint.get("raster-fade-duration");if(!o&&s>0){const r=e.exported.now(),o=(r-t.timeAdded)/s,l=n?(r-n.timeAdded)/s:-1,c=a.getSource(),u=i.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),d=!n||Math.abs(n.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),p=d&&t.refreshedUponExpiration?1:e.clamp(d?o:1-l,0,1);return t.refreshedUponExpiration&&o>=1&&(t.refreshedUponExpiration=!1),n?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Pn=new e.Color(1,0,0,1),Bn=new e.Color(0,1,0,1),In=new e.Color(0,0,1,1),$n=new e.Color(1,0,1,1),Fn=new e.Color(0,1,1,1);function Xn(e,t,n,a){Hn(e,0,t+n/2,e.transform.width,n,a)}function Yn(e,t,n,a){Hn(e,t-n/2,0,n,e.transform.height,a)}function Hn(e,t,n,a,r,i){const o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,a*e.pixelRatio,r*e.pixelRatio),o.clear({color:i}),s.disable(s.SCISSOR_TEST)}function Un(t,n,a){const r=t.context,i=r.gl,o=a.posMatrix,s=t.useProgram("debug"),l=On.disabled,c=kn.disabled,u=t.colorModeForRenderPass(),d="$debug",p=t.style.terrain&&t.style.terrain.getTerrainData(a);r.activeTexture.set(i.TEXTURE0),t.emptyTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE);const m=n.getTileByID(a.key).latestRawTileData,b=Math.floor((m&&m.byteLength||0)/1024),h=n.getTile(a).tileSize,f=512/Math.min(h,512)*(a.overscaledZ/t.transform.zoom)*.5;let g=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(g+=" => "+a.overscaledZ),function(e,t){e.initDebugOverlayCanvas();const n=e.debugOverlayCanvas,a=e.context.gl,r=e.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,n.width,n.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(t,`${g} ${b}kB`),s.draw(r,i.TRIANGLES,l,c,vn.alphaBlended,An.disabled,gt(o,e.Color.transparent,f),null,d,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(r,i.LINE_STRIP,l,c,u,An.disabled,gt(o,e.Color.red),p,d,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Vn(e,t,n){const a=e.context,r=a.gl,i=e.colorModeForRenderPass(),o=new On(r.LEQUAL,On.ReadWrite,e.depthRangeFor3D),s=e.useProgram("terrain"),l=t.getTerrainMesh(),c=t.getTerrainData(n.tileID);a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]),a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const u=e.transform.calculatePosMatrix(n.tileID.toUnwrapped());s.draw(a,r.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:u,u_texture:0},c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}function Gn(e,t,n,a){const r=e.context,i=n.tileSize*t.qualityFactor;n.textures[a]||(n.textures[a]=e.getTileTexture(i)||new l(r,{width:i,height:i,data:null},r.gl.RGBA),n.textures[a].bind(r.gl.LINEAR,r.gl.CLAMP_TO_EDGE),0===a&&t.sourceCache.renderHistory.unshift(n.tileID.key));const o=t.getRTTFramebuffer();o.colorAttachment.set(n.textures[a].texture),r.bindFramebuffer.set(o.framebuffer),r.viewport.set([0,0,i,i])}class Kn{constructor(e){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=e,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=e.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const e=this.painter.style,t=e.terrain;for(const n in e.sourceCaches){this._coordsDescendingInv[n]={};const a=e.sourceCaches[n].getVisibleCoordinates();for(const e of a){const a=t.sourceCache.getTerrainCoords(e);for(const e in a)this._coordsDescendingInv[n][e]||(this._coordsDescendingInv[n][e]=[]),this._coordsDescendingInv[n][e].push(a[e])}}for(const t of e._order){const n=e._layers[t],a=n.source;if(this._renderToTexture[n.type]&&!this._coordsDescendingInvStr[a]){this._coordsDescendingInvStr[a]={};for(const e in this._coordsDescendingInv[a])this._coordsDescendingInvStr[a][e]=this._coordsDescendingInv[a][e].map(e=>e.key).sort().join()}}return this._renderableTiles.forEach(e=>{for(const n in this._coordsDescendingInvStr){const a=this._coordsDescendingInvStr[n][e.tileID.key];a&&a!==e.textureCoords[n]&&e.clearTextures(this.painter),t.needsRerender(n,e.tileID)&&e.clearTextures(this.painter)}this._rerender[e.tileID.key]=!e.textures.length}),t.clearRerenderCache(),t.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,a=this.painter,r=a.style._order,i=a.currentLayer,o=i+1===r.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(r[i]),!o))return!0;if(this._renderToTexture[this._prevType]||"hillshade"===n||this._renderToTexture[n]&&o){this._prevType=n;const o=this._stacks.length-1,s=this._stacks[o]||[];for(const t of this._renderableTiles){if(Gn(a,a.style.terrain,t,o),this._rerender[t.tileID.key]){a.context.clear({color:e.Color.transparent});for(let e=0;e<s.length;e++){const n=a.style._layers[s[e]],r=n.source?this._coordsDescendingInv[n.source][t.tileID.key]:[t.tileID];a._renderTileClippingMasks(n,r),a.renderLayer(a,a.style.sourceCaches[n.source],n,r),n.source&&(t.textureCoords[n.source]=this._coordsDescendingInvStr[n.source][t.tileID.key])}}Vn(a,a.style.terrain,t)}if("hillshade"===n){this._stacks.push([r[i]]);for(const n of this._renderableTiles){const r=this._coordsDescendingInv[t.source][n.tileID.key];Gn(a,a.style.terrain,n,this._stacks.length-1),a.context.clear({color:e.Color.transparent}),a._renderTileClippingMasks(t,r),a.renderLayer(a,a.style.sourceCaches[t.source],t,r),Vn(a,a.style.terrain,n)}return!0}return this._renderToTexture[n]}return!1}}const Jn={symbol:function(t,n,a,r,i){if("translucent"!==t.renderPass)return;const o=kn.disabled,s=t.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(t,n,a,r,i,o,s){const l=n.transform,c="map"===i,u="map"===o;for(const i of t){const t=r.getTile(i),o=t.getBucket(a);if(!o||!o.text||!o.text.segments.get().length)continue;const d=e.evaluateSizeForZoom(o.textSizeData,l.zoom),p=ve(t,1,n.transform.zoom),m=ie(i.posMatrix,u,c,n.transform,p),b="none"!==a.layout.get("icon-text-fit")&&o.hasIconData();if(d){const e=Math.pow(2,l.zoom-t.tileID.overscaledZ);En(o,c,u,s,l,m,i.posMatrix,e,d,b,n.style.terrain?(e,t)=>n.style.terrain.getElevation(i,e,t):null)}}}(r,t,a,n,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),i),0!==a.paint.get("icon-opacity").constantOr(1)&&Wn(t,n,a,r,!1,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),a.layout.get("icon-rotation-alignment"),a.layout.get("icon-pitch-alignment"),a.layout.get("icon-keep-upright"),o,s),0!==a.paint.get("text-opacity").constantOr(1)&&Wn(t,n,a,r,!0,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.layout.get("text-keep-upright"),o,s),n.map.showCollisionBoxes&&(wn(t,n,a,r,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),wn(t,n,a,r,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(t,n,a,r){if("translucent"!==t.renderPass)return;const i=a.paint.get("circle-opacity"),o=a.paint.get("circle-stroke-width"),s=a.paint.get("circle-stroke-opacity"),l=!a.layout.get("circle-sort-key").isConstant();if(0===i.constantOr(1)&&(0===o.constantOr(1)||0===s.constantOr(1)))return;const c=t.context,u=c.gl,d=t.depthModeForSublayer(0,On.ReadOnly),p=kn.disabled,m=t.colorModeForRenderPass(),b=[];for(let i=0;i<r.length;i++){const o=r[i],s=n.getTile(o),c=s.getBucket(a);if(!c)continue;const u=c.programConfigurations.get(a.id),d=t.useProgram("circle",u),p=c.layoutVertexBuffer,m=c.indexBuffer,h=t.style.terrain&&t.style.terrain.getTerrainData(o),f={programConfiguration:u,program:d,layoutVertexBuffer:p,indexBuffer:m,uniformValues:ht(t,o,s,a),terrainData:h};if(l){const t=c.segments.get();for(const n of t)b.push({segments:new e.SegmentVector([n]),sortKey:n.sortKey,state:f})}else b.push({segments:c.segments,sortKey:0,state:f})}l&&b.sort((e,t)=>e.sortKey-t.sortKey);for(const e of b){const{programConfiguration:n,program:r,layoutVertexBuffer:i,indexBuffer:o,uniformValues:s,terrainData:l}=e.state;r.draw(c,u.TRIANGLES,d,p,m,An.disabled,s,l,a.id,i,o,e.segments,a.paint,t.transform.zoom,n)}},heatmap:function(t,n,a,r){if(0!==a.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const i=t.context,o=i.gl,s=kn.disabled,l=new vn([o.ONE,o.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,n){const a=e.gl;e.activeTexture.set(a.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let r=n.heatmapFbo;if(r)a.bindTexture(a.TEXTURE_2D,r.colorAttachment.get()),e.bindFramebuffer.set(r.framebuffer);else{const i=a.createTexture();a.bindTexture(a.TEXTURE_2D,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),r=n.heatmapFbo=e.createFramebuffer(t.width/4,t.height/4,!1),function(e,t,n,a){const r=e.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t.width/4,t.height/4,0,r.RGBA,e.extRenderToTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),a.colorAttachment.set(n)}(e,t,i,r)}}(i,t,a),i.clear({color:e.Color.transparent});for(let e=0;e<r.length;e++){const c=r[e];if(n.hasRenderableParent(c))continue;const u=n.getTile(c),d=u.getBucket(a);if(!d)continue;const p=d.programConfigurations.get(a.id),m=t.useProgram("heatmap",p),{zoom:b}=t.transform;m.draw(i,o.TRIANGLES,On.disabled,s,l,An.disabled,yt(c.posMatrix,u,b,a.paint.get("heatmap-intensity")),null,a.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,a.paint,t.transform.zoom,p)}i.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,n){const a=t.context,r=a.gl,i=n.heatmapFbo;if(!i)return;a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),a.activeTexture.set(r.TEXTURE1);let o=n.colorRampTexture;o||(o=n.colorRampTexture=new l(a,n.colorRamp,r.RGBA)),o.bind(r.LINEAR,r.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(a,r.TRIANGLES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,((t,n,a,r)=>{const i=e.create();e.ortho(i,0,t.width,t.height,0,0,1);const o=t.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")}})(t,n),null,n.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,n.paint,t.transform.zoom)}(t,a))},line:function(t,n,a,r){if("translucent"!==t.renderPass)return;const i=a.paint.get("line-opacity"),o=a.paint.get("line-width");if(0===i.constantOr(1)||0===o.constantOr(1))return;const s=t.depthModeForSublayer(0,On.ReadOnly),c=t.colorModeForRenderPass(),u=a.paint.get("line-dasharray"),d=a.paint.get("line-pattern"),p=d.constantOr(1),m=a.paint.get("line-gradient"),b=a.getCrossfadeParameters(),h=p?"linePattern":u?"lineSDF":m?"lineGradient":"line",f=t.context,g=f.gl;let _=!0;for(const i of r){const r=n.getTile(i);if(p&&!r.patternsLoaded())continue;const o=r.getBucket(a);if(!o)continue;const y=o.programConfigurations.get(a.id),M=t.context.program.get(),v=t.useProgram(h,y),z=_||v.program!==M,O=t.style.terrain&&t.style.terrain.getTerrainData(i),k=d.constantOr(null);if(k&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[k.to.toString()],n=e.patternPositions[k.from.toString()];t&&n&&y.setConstantPatternPositions(t,n)}const A=O?i:null,x=p?Ot(t,r,a,b,A):u?kt(t,r,a,u,b,A):m?zt(t,r,a,o.lineClipsArray.length,A):vt(t,r,a,A);if(p)f.activeTexture.set(g.TEXTURE0),r.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),y.updatePaintBuffers(b);else if(u&&(z||t.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),t.lineAtlas.bind(f);else if(m){const r=o.gradients[a.id];let s=r.texture;if(a.gradientVersion!==r.version){let c=256;if(a.stepInterpolant){const a=n.getSource().maxzoom,r=i.canonical.z===a?Math.ceil(1<<t.transform.maxZoom-i.canonical.z):1;c=e.clamp(e.nextPowerOfTwo(o.maxLineLength/e.EXTENT*1024*r),256,f.maxTextureSize)}r.gradient=e.renderColorRamp({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:r.gradient||void 0,clips:o.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new l(f,r.gradient,g.RGBA),r.version=a.gradientVersion,s=r.texture}f.activeTexture.set(g.TEXTURE0),s.bind(a.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}v.draw(f,g.TRIANGLES,s,t.stencilModeForClipping(i),c,An.disabled,x,O,a.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,a.paint,t.transform.zoom,y,o.layoutVertexBuffer2),_=!1}},fill:function(t,n,a,r){const i=a.paint.get("fill-color"),o=a.paint.get("fill-opacity");if(0===o.constantOr(1))return;const s=t.colorModeForRenderPass(),l=a.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===i.constantOr(e.Color.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const e=t.depthModeForSublayer(1,"opaque"===t.renderPass?On.ReadWrite:On.ReadOnly);Sn(t,n,a,r,e,s,!1)}if("translucent"===t.renderPass&&a.paint.get("fill-antialias")){const e=t.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,On.ReadOnly);Sn(t,n,a,r,e,s,!0)}},"fill-extrusion":function(e,t,n,a){const r=n.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===e.renderPass){const i=new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D);if(1!==r||n.paint.get("fill-extrusion-pattern").constantOr(1))Tn(e,t,n,a,i,kn.disabled,vn.disabled),Tn(e,t,n,a,i,e.stencilModeFor3D(),e.colorModeForRenderPass());else{const r=e.colorModeForRenderPass();Tn(e,t,n,a,i,kn.disabled,r)}}},hillshade:function(e,t,n,a){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const r=e.context,i=e.depthModeForSublayer(0,On.ReadOnly),o=e.colorModeForRenderPass(),[s,l]="translucent"===e.renderPass?e.stencilConfigForOverlap(a):[{},a];for(const a of l){const r=t.getTile(a);void 0!==r.needsHillshadePrepare&&r.needsHillshadePrepare&&"offscreen"===e.renderPass?Rn(e,r,n,i,kn.disabled,o):"translucent"===e.renderPass&&Cn(e,a,r,n,i,s[a.overscaledZ],o)}r.viewport.set([0,0,e.width,e.height])},raster:function(e,t,n,a){if("translucent"!==e.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!a.length)return;const r=e.context,i=r.gl,o=t.getSource(),s=e.useProgram("raster"),l=e.colorModeForRenderPass(),[c,u]=o instanceof N?[{},a]:e.stencilConfigForOverlap(a),d=u[u.length-1].overscaledZ,p=!e.options.moving;for(const a of u){const u=e.depthModeForSublayer(a.overscaledZ-d,1===n.paint.get("raster-opacity")?On.ReadWrite:On.ReadOnly,i.LESS),m=t.getTile(a);m.registerFadeDuration(n.paint.get("raster-fade-duration"));const b=t.findLoadedParent(a,0),h=Dn(m,b,t,n,e.transform,e.style.terrain);let f,g;const _="nearest"===n.paint.get("raster-resampling")?i.NEAREST:i.LINEAR;r.activeTexture.set(i.TEXTURE0),m.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(i.TEXTURE1),b?(b.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST),f=Math.pow(2,b.tileID.overscaledZ-m.tileID.overscaledZ),g=[m.tileID.canonical.x*f%1,m.tileID.canonical.y*f%1]):m.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST);const y=e.style.terrain&&e.style.terrain.getTerrainData(a),M=y?a:null,v=M?M.posMatrix:e.transform.calculatePosMatrix(a.toUnwrapped(),p),z=wt(v,g||[0,0],f||1,h,n);o instanceof N?s.draw(r,i.TRIANGLES,u,kn.disabled,l,An.disabled,z,y,n.id,o.boundsBuffer,e.quadTriangleIndexBuffer,o.boundsSegments):s.draw(r,i.TRIANGLES,u,c[a.overscaledZ],l,An.disabled,z,y,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}},background:function(e,t,n,a){const r=n.paint.get("background-color"),i=n.paint.get("background-opacity");if(0===i)return;const o=e.context,s=o.gl,l=e.transform,c=l.tileSize,u=n.paint.get("background-pattern");if(e.isPatternMissing(u))return;const d=!u&&1===r.a&&1===i&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==d)return;const p=kn.disabled,m=e.depthModeForSublayer(0,"opaque"===d?On.ReadWrite:On.ReadOnly),b=e.colorModeForRenderPass(),h=e.useProgram(u?"backgroundPattern":"background"),f=a||l.coveringTiles({tileSize:c,terrain:e.style.terrain});u&&(o.activeTexture.set(s.TEXTURE0),e.imageManager.bind(e.context));const g=n.getCrossfadeParameters();for(const t of f){const l=a?t.posMatrix:e.transform.calculatePosMatrix(t.toUnwrapped()),d=u?Lt(l,i,e,u,{tileID:t,tileSize:c},g):Wt(l,i,r),f=e.style.terrain&&e.style.terrain.getTerrainData(t);h.draw(o,s.TRIANGLES,m,p,b,An.disabled,d,f,n.id,e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments)}},debug:function(e,t,n){for(let a=0;a<n.length;a++)Un(e,t,n[a])},custom:function(e,t,n){const a=e.context,r=n.implementation;if("offscreen"===e.renderPass){const t=r.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(r,a.gl,e.transform.customLayerMatrix()),a.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(kn.disabled);const t="3d"===r.renderingMode?new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,On.ReadOnly);a.setDepthMode(t),r.render(a.gl,e.transform.customLayerMatrix()),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}};class Zn{constructor(t,n){this.context=new zn(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.create(),renderTime:0},this.setup(),this.numSublayers=D.maxUnderzooming+D.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ue,this.gpuTimers={}}resize(e,t,n){if(this.width=e*n,this.height=t*n,this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style._order)this.style._layers[e].resize()}setup(){const t=this.context,n=new e.PosArray;n.emplaceBack(0,0),n.emplaceBack(e.EXTENT,0),n.emplaceBack(0,e.EXTENT),n.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Ve.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const a=new e.PosArray;a.emplaceBack(0,0),a.emplaceBack(e.EXTENT,0),a.emplaceBack(0,e.EXTENT),a.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Ve.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const r=new e.RasterBoundsArray;r.emplaceBack(0,0,0,0),r.emplaceBack(e.EXTENT,0,e.EXTENT,0),r.emplaceBack(0,e.EXTENT,0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(r,w.members),this.rasterBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);const i=new e.PosArray;i.emplaceBack(0,0),i.emplaceBack(1,0),i.emplaceBack(0,1),i.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(i,Ve.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);const o=new e.LineStripIndexArray;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);const s=new e.TriangleIndexArray;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s),this.emptyTexture=new l(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const c=this.context.gl;this.stencilClearMode=new kn({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=e.create();e.ortho(a,0,this.width,this.height,0,0,1),e.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,On.disabled,this.stencilClearMode,vn.disabled,An.disabled,_t(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source;const n=this.context,a=n.gl;this.nextStencilID+t.length>256&&this.clearStencil(),n.setColorMode(vn.disabled),n.setDepthMode(On.disabled);const r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of t){const t=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,i=this.style.terrain&&this.style.terrain.getTerrainData(e);r.draw(n,a.TRIANGLES,On.disabled,new kn({func:a.ALWAYS,mask:0},t,255,a.KEEP,a.KEEP,a.REPLACE),vn.disabled,An.disabled,_t(e.posMatrix),i,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new kn({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new kn({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),a=n[n.length-1].overscaledZ,r=n[0].overscaledZ-a+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const e={};for(let n=0;n<r;n++)e[n+a]=new kn({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=r,[e,n]}return[{[a]:kn.disabled},n]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const n=1/8;return new vn([t.CONSTANT_COLOR,t.ONE],new e.Color(n,n,n,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?vn.unblended:vn.alphaBlended}depthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return On.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new On(n||this.context.gl.LEQUAL,t,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.exported.now()),this.imageManager.beginFrame();const a=this.style._order,r=this.style.sourceCaches,i=this.style.terrain&&new Kn(this);for(const e in r){const t=r[e];t.used&&t.prepare(this.context)}const o={},s={},l={};for(const e in r){const t=r[e];o[e]=t.getVisibleCoordinates(),s[e]=o[e].slice().reverse(),l[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<a.length;e++)if(this.style._layers[a[e]].is3D()){this.opaquePassCutoff=e;break}if(i){this.opaquePassCutoff=0;const t=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!e.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||t.length)&&(e.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,n){const a=t.context,r=a.gl,i=vn.unblended,o=new On(r.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");a.bindFramebuffer.set(n.getFramebuffer("depth").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:e.Color.transparent,depth:1});for(const e of l){const l=n.getTerrainData(e.tileID),u=t.transform.calculatePosMatrix(e.tileID.toUnwrapped());c.draw(a,r.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:u},l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain),function(t,n){const a=t.context,r=a.gl,i=vn.unblended,o=new On(r.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.getCoordsTexture(),c=n.sourceCache.getRenderableTiles(),u=t.useProgram("terrainCoords");a.bindFramebuffer.set(n.getFramebuffer("coords").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:e.Color.transparent,depth:1}),n.coordsIndex=[];for(const e of c){const c=n.getTerrainData(e.tileID);a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,l.texture);const d=t.transform.calculatePosMatrix(e.tileID.toUnwrapped());u.draw(a,r.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:d,u_terrain_coords_id:(255-n.coordsIndex.length)/255,u_texture:0},c,"terrain",s.vertexBuffer,s.indexBuffer,s.segments),n.coordsIndex.push(e.tileID.key)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const e of a){const t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;const n=s[t.source];("custom"===t.type||n.length)&&this.renderLayer(this,r[t.source],t,n)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?e.Color.black:e.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!i)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[a[this.currentLayer]],t=r[e.source],n=o[e.source];this._renderTileClippingMasks(e,n),this.renderLayer(this,t,e,n)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const e=this.style._layers[a[this.currentLayer]],t=r[e.source];if(i&&i.renderLayer(e))continue;const n=("symbol"===e.type?l:s)[e.source];this._renderTileClippingMasks(e,o[e.source]),this.renderLayer(this,t,e,n)}if(this.options.showTileBoundaries){let e,t;Object.values(this.style._layers).forEach(n=>{n.source&&!n.isHidden(this.transform.zoom)&&(n.source!==(t&&t.id)&&(t=this.style.sourceCaches[n.source]),(!e||e.getSource().maxzoom<t.getSource().maxzoom)&&(e=t))}),e&&Jn.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&function(e){const t=e.transform.padding;Xn(e,e.transform.height-(t.top||0),3,Pn),Xn(e,t.bottom||0,3,Bn),Yn(e,t.left||0,3,In),Yn(e,e.transform.width-(t.right||0),3,$n);const n=e.transform.centerPoint;!function(e,t,n,a){Hn(e,t-1,n-10,2,20,a),Hn(e,t-10,n-1,20,2,a)}(e,n.x,e.transform.height-n.y,Fn)}(this),this.context.setDefault()}renderLayer(e,t,n,a){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||(a||[]).length)&&(this.id=n.id,this.gpuTimingStart(n),Jn[n.type](e,t,n,a,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;let n=this.gpuTimers[e.id];n||(n=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:t.createQueryEXT()}),n.calls++,t.beginQueryEXT(t.TIME_ELAPSED_EXT,n.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}queryGpuTimers(e){const t={};for(const n in e){const a=e[n],r=this.context.extTimerQuery,i=r.getQueryObjectEXT(a.query,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(a.query),t[n]=i}return t}translatePosMatrix(t,n,a,r,i){if(!a[0]&&!a[1])return t;const o=i?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(o){const e=Math.sin(o),t=Math.cos(o);a=[a[0]*t-a[1]*e,a[0]*e+a[1]*t]}const s=[i?a[0]:ve(n,a[0],this.transform.zoom),i?a[1]:ve(n,a[1],this.transform.zoom),0],l=new Float32Array(16);return e.translate(l,t,s),l}saveTileTexture(e){const t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!t||!n}useProgram(e,t){this.cache=this.cache||{};const n=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[n]||(this.cache[n]=new st(this.context,e,at[e],t,St[e],this._showOverdrawInspector,this.style.terrain)),this.cache[n]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Qn{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(t,n,a){const r=Math.pow(2,a),i=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(a=>{const i=1/(a=e.transformMat4([],a,t))[3]/n*r;return e.mul$1(a,a,[i,i,1/a[3],i])}),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(t=>{const n=e.sub([],i[t[0]],i[t[1]]),a=e.sub([],i[t[2]],i[t[1]]),r=e.normalize([],e.cross([],n,a)),o=-e.dot(r,i[t[1]]);return r.concat(o)});return new Qn(i,o)}}class ea{constructor(t,n){this.min=t,this.max=n,this.center=e.scale$1([],e.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=e.clone$2(this.min),r=e.clone$2(this.max);for(let e=0;e<n.length;e++)a[e]=n[e]?this.min[e]:this.center[e],r[e]=n[e]?this.center[e]:this.max[e];return r[2]=this.max[2],new ea(a,r)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let a=!0;for(let r=0;r<t.planes.length;r++){const i=t.planes[r];let o=0;for(let t=0;t<n.length;t++)e.dot$1(i,n[t])>=0&&o++;if(0===o)return 0;o!==n.length&&(a=!1)}if(a)return 2;for(let e=0;e<3;e++){let n=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let r=0;r<t.points.length;r++){const i=t.points[r][e]-this.min[e];n=Math.min(n,i),a=Math.max(a,i)}if(a<0||n>this.max[e]-this.min[e])return 0}return 1}}class ta{constructor(e=0,t=0,n=0,a=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=n,this.right=a}interpolate(t,n,a){return null!=n.top&&null!=t.top&&(this.top=e.number(t.top,n.top,a)),null!=n.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,n.bottom,a)),null!=n.left&&null!=t.left&&(this.left=e.number(t.left,n.left,a)),null!=n.right&&null!=t.right&&(this.right=e.number(t.right,n.right,a)),this}getCenter(t,n){const a=e.clamp((this.left+t-this.right)/2,0,t),r=e.clamp((this.top+n-this.bottom)/2,0,n);return new e.pointGeometry(a,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class na{constructor(t,n,a,r,i){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===i||!!i,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=null==a?0:a,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ta,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const e=new na(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.tileSize=this.tileSize,e.latRange=this.latRange,e.width=this.width,e.height=this.height,e._center=this._center,e._elevation=this._elevation,e.zoom=this.zoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._calcMatrices(),e}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-e.wrap(t,-180,180)*Math.PI/180;var a;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(a=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a),function(e,t,n){var a=t[0],r=t[1],i=t[2],o=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=a*l+i*s,e[1]=r*l+o*s,e[2]=a*-s+i*l,e[3]=r*-s+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){const n=[new e.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new e.pointGeometry(0,0)),r=this.pointCoordinate(new e.pointGeometry(this.width,0)),i=this.pointCoordinate(new e.pointGeometry(this.width,this.height)),o=this.pointCoordinate(new e.pointGeometry(0,this.height)),s=Math.floor(Math.min(a.x,r.x,i.x,o.x)),l=Math.floor(Math.max(a.x,r.x,i.x,o.x)),c=1;for(let a=s-c;a<=l+c;a++)0!==a&&n.push(new e.UnwrappedTileID(a,t))}return n}coveringTiles(t){var n,a;let r=this.coveringZoomLevel(t);const i=r;if(void 0!==t.minzoom&&r<t.minzoom)return[];void 0!==t.maxzoom&&r>t.maxzoom&&(r=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),s=e.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,r),c=[l*o.x,l*o.y,0],u=[l*s.x,l*s.y,0],d=Qn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r);let p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=r);const m=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,b=e=>({aabb:new ea([e*l,0,0],[(e+1)*l,l,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),h=[],f=[],g=r,_=t.reparseOverscaled?i:r;if(this._renderWorldCopies)for(let e=1;e<=3;e++)h.push(b(-e)),h.push(b(e));for(h.push(b(0));h.length>0;){const r=h.pop(),i=r.x,o=r.y;let s=r.fullyVisible;if(!s){const e=r.aabb.intersects(d);if(0===e)continue;s=2===e}const l=t.terrain?c:u,b=r.aabb.distanceX(l),y=r.aabb.distanceY(l),M=Math.max(Math.abs(b),Math.abs(y)),v=m+(1<<g-r.zoom)-2;if(r.zoom===g||M>v&&r.zoom>=p){const t=g-r.zoom,n=c[0]-.5-(i<<t),a=c[1]-.5-(o<<t);f.push({tileID:new e.OverscaledTileID(r.zoom===g?_:r.zoom,r.wrap,r.zoom,i,o),distanceSq:e.sqrLen([u[0]-.5-i,u[1]-.5-o]),tileDistanceToCamera:Math.sqrt(n*n+a*a)})}else for(let l=0;l<4;l++){const c=(i<<1)+l%2,u=(o<<1)+(l>>1),d=r.zoom+1;let p=r.aabb.quadrant(l);if(t.terrain){const i=new e.OverscaledTileID(d,r.wrap,d,c,u),o=t.terrain.getMinMaxElevation(i),s=null!==(n=o.minElevation)&&void 0!==n?n:this.elevation,l=null!==(a=o.maxElevation)&&void 0!==a?a:this.elevation;p=new ea([p.min[0],p.min[1],s],[p.max[0],p.max[1],l])}h.push({aabb:p,zoom:d,x:c,y:u,wrap:r.wrap,fullyVisible:s})}}return f.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const n=e.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new e.pointGeometry(e.mercatorXfromLng(t.lng)*this.worldSize,e.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new e.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(e){this.freezeElevation||(this.elevation=e?this.getElevation(this._center,e):0)}getElevation(t,n){const a=e.MercatorCoordinate.fromLngLat(t),r=(1<<this.tileZoom)*e.EXTENT,i=a.x*r,o=a.y*r,s=Math.floor(i/e.EXTENT),l=Math.floor(o/e.EXTENT),c=new e.OverscaledTileID(this.tileZoom,0,this.tileZoom,s,l);return n.getElevation(c,i%e.EXTENT,o%e.EXTENT,e.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=this.getElevation(n,t);if(!(this.elevation-a))return;const r=this.getCameraPosition(),i=e.MercatorCoordinate.fromLngLat(r.lngLat,r.altitude),o=e.MercatorCoordinate.fromLngLat(n,a),s=i.x-o.x,l=i.y-o.y,c=i.z-o.z,u=Math.sqrt(s*s+l*l+c*c),d=this.scaleZoom(this.cameraToCenterDistance/u/this.tileSize);this._elevation=a,this._center=n,this.zoom=d}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),r=this.pointCoordinate(this.centerPoint),i=this.locationCoordinate(t),o=new e.MercatorCoordinate(i.x-(a.x-r.x),i.y-(a.y-r.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),this.getElevation(e,t),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(t){return e.MercatorCoordinate.fromLngLat(t)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(t,n){if(n){const e=n.pointCoordinate(t);if(null!=e)return e}const a=[t.x,t.y,0,1],r=[t.x,t.y,1,1];e.transformMat4(a,a,this.pixelMatrixInverse),e.transformMat4(r,r,this.pixelMatrixInverse);const i=a[3],o=r[3],s=a[1]/i,l=r[1]/o,c=a[2]/i,u=r[2]/o,d=c===u?0:(0-c)/(u-c);return new e.MercatorCoordinate(e.number(a[0]/i,r[0]/o,d)/this.worldSize,e.number(s,l,d)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const r=[t.x*this.worldSize,t.y*this.worldSize,n,1];return e.transformMat4(r,r,a),new e.pointGeometry(r[0]/r[3],r[1]/r[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return(new e.LngLatBounds).extend(this.pointLocation(new e.pointGeometry(0,t))).extend(this.pointLocation(new e.pointGeometry(this.width,t))).extend(this.pointLocation(new e.pointGeometry(this.width,this.height))).extend(this.pointLocation(new e.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new e.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,r=n?this._alignedPosMatrixCache:this._posMatrixCache;if(r[a])return r[a];const i=t.canonical,o=this.worldSize/this.zoomScale(i.z),s=i.x+Math.pow(2,i.z)*t.wrap,l=e.identity(new Float64Array(16));return e.translate(l,l,[s*o,i.y*o,0]),e.scale(l,l,[o/e.EXTENT,o/e.EXTENT,1]),e.multiply(l,n?this.alignedProjMatrix:this.projMatrix,l),r[a]=new Float32Array(l),r[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,r,i=-90,o=90,s=-180,l=180;const c=this.size,u=this._unmodified;if(this.latRange){const n=this.latRange;i=e.mercatorYfromLat(n[1])*this.worldSize,o=e.mercatorYfromLat(n[0])*this.worldSize,t=o-i<c.y?c.y/(o-i):0}if(this.lngRange){const t=this.lngRange;s=e.wrap(e.mercatorXfromLng(t[0])*this.worldSize,0,this.worldSize),l=e.wrap(e.mercatorXfromLng(t[1])*this.worldSize,0,this.worldSize),l<s&&(l+=this.worldSize),n=l-s<c.x?c.x/(l-s):0}const d=this.point,p=Math.max(n||0,t||0);if(p)return this.center=this.unproject(new e.pointGeometry(n?(l+s)/2:d.x,t?(o+i)/2:d.y)),this.zoom+=this.scaleZoom(p),this._unmodified=u,void(this._constraining=!1);if(this.latRange){const e=d.y,t=c.y/2;e-t<i&&(r=i+t),e+t>o&&(r=o-t)}if(this.lngRange){const t=(s+l)/2,n=e.wrap(d.x,t-this.worldSize/2,t+this.worldSize/2),r=c.x/2;n-r<s&&(a=s+r),n+r>l&&(a=l-r)}void 0===a&&void 0===r||(this.center=this.unproject(new e.pointGeometry(void 0!==a?a:d.x,void 0!==r?r:d.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let r=e.identity(new Float64Array(16));e.scale(r,r,[this.width/2,-this.height/2,1]),e.translate(r,r,[1,-1,0]),this.labelPlaneMatrix=r,r=e.identity(new Float64Array(16)),e.scale(r,r,[1,-1,1]),e.translate(r,r,[-1,-1,0]),e.scale(r,r,[2/this.width,2/this.height,1]),this.glCoordMatrix=r,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const i=Math.PI/2+this._pitch,o=this._fov*(.5+t.y/this.height),s=Math.sin(o)*this.cameraToSeaLevelDistance/Math.sin(e.clamp(Math.PI-i-o,.01,Math.PI-.01)),l=this.getHorizon(),c=2*Math.atan(l/this.cameraToCenterDistance)*(.5+t.y/(2*l)),u=Math.sin(c)*this.cameraToSeaLevelDistance/Math.sin(e.clamp(Math.PI-i-c,.01,Math.PI-.01)),d=Math.cos(Math.PI/2-this._pitch)*s+this.cameraToSeaLevelDistance,p=Math.cos(Math.PI/2-this._pitch)*u+this.cameraToSeaLevelDistance,m=1.01*Math.min(d,p),b=this.height/50;r=new Float64Array(16),e.perspective(r,this._fov,this.width/this.height,b,m),r[8]=2*-t.x/this.width,r[9]=2*t.y/this.height,e.scale(r,r,[1,-1,1]),e.translate(r,r,[0,0,-this.cameraToCenterDistance]),e.rotateX(r,r,this._pitch),e.rotateZ(r,r,this.angle),e.translate(r,r,[-n,-a,0]),this.mercatorMatrix=e.scale([],r,[this.worldSize,this.worldSize,this.worldSize]),e.scale(r,r,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,r),e.translate(r,r,[0,0,-this.elevation]),this.projMatrix=r,this.invProjMatrix=e.invert([],r),this.pixelMatrix3D=e.multiply(new Float64Array(16),this.labelPlaneMatrix,r);const h=this.width%2/2,f=this.height%2/2,g=Math.cos(this.angle),_=Math.sin(this.angle),y=n-Math.round(n)+g*h+_*f,M=a-Math.round(a)+g*f+_*h,v=new Float64Array(r);if(e.translate(v,v,[y>.5?y-1:y,M>.5?M-1:M,0]),this.alignedProjMatrix=v,r=e.invert(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new e.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(1===t.length)return[t[0],n];{let a=n.x,r=n.y,i=n.x,o=n.y;for(const e of t)a=Math.min(a,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x),o=Math.max(o,e.y);return[new e.pointGeometry(a,r),new e.pointGeometry(i,r),new e.pointGeometry(i,o),new e.pointGeometry(a,o),new e.pointGeometry(a,r)]}}}class aa{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(e,t){let n=!1,a=null;const r=()=>{a=null,n&&(e(),a=setTimeout(r,300),n=!1)};return()=>(n=!0,a||r(),a)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){const t=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,a=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,a),i=Math.round(t.lng*r)/r,o=Math.round(t.lat*r)/r,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${i}/${o}/${n}`:`${n}/${o}/${i}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+="/"+Math.round(l)),this._hashName){const e=this._hashName;let t=!1;const n=window.location.hash.slice(1).split("&").map(n=>{const a=n.split("=")[0];return a===e?(t=!0,`${a}=${c}`):n}).filter(e=>e);return t||n.push(`${e}=${c}`),"#"+n.join("&")}return"#"+c}_getCurrentHash(){const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._getCurrentHash();if(e.length>=3&&!e.some(e=>isNaN(e))){const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){const e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch(e){}}}const ra={linearity:.3,easing:e.bezier(0,0,.3,1)},ia=e.extend({deceleration:2500,maxSpeed:1400},ra),oa=e.extend({deceleration:20,maxSpeed:1400},ra),sa=e.extend({deceleration:1e3,maxSpeed:360},ra),la=e.extend({deceleration:1e3,maxSpeed:90},ra);class ca{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=e.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new e.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,e.panDelta&&n.pan._add(e.panDelta),e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(n.pan.mag()){const i=da(n.pan.mag(),a,e.extend({},ia,t||{}));r.offset=n.pan.mult(i.amount/n.pan.mag()),r.center=this._map.transform.center,ua(r,i)}if(n.zoom){const e=da(n.zoom,a,oa);r.zoom=this._map.transform.zoom+e.amount,ua(r,e)}if(n.bearing){const t=da(n.bearing,a,sa);r.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),ua(r,t)}if(n.pitch){const e=da(n.pitch,a,la);r.pitch=this._map.transform.pitch+e.amount,ua(r,e)}if(r.zoom||r.bearing){const e=void 0===n.pinchAround?n.around:n.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),e.extend(r,{noMoveStart:!0})}}function ua(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function da(t,n,a){const{maxSpeed:r,linearity:i,deceleration:o}=a,s=e.clamp(t*i/(n/1e3),-r,r),l=Math.abs(s)/(o*i);return{easing:a.easing,duration:1e3*l,amount:s*(l/2)}}class pa extends e.Event{constructor(t,n,a,r={}){const o=i.mousePos(n.getCanvasContainer(),a),s=n.unproject(o);super(t,e.extend({point:o,lngLat:s,originalEvent:a},r)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ma extends e.Event{constructor(t,n,a){const r="touchend"===t?a.changedTouches:a.touches,o=i.touchPos(n.getCanvasContainer(),r),s=o.map(e=>n.unproject(e)),l=o.reduce((e,t,n,a)=>e.add(t.div(a.length)),new e.pointGeometry(0,0));super(t,{points:o,point:l,lngLats:s,lngLat:n.unproject(l),originalEvent:a}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ba extends e.Event{constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ha{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ba(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new pa(e.type,this._map,e))}mouseup(e){this._map.fire(new pa(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new pa(e.type,this._map,e))}dblclick(e){return this._firePreventable(new pa(e.type,this._map,e))}mouseover(e){this._map.fire(new pa(e.type,this._map,e))}mouseout(e){this._map.fire(new pa(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ma(e.type,this._map,e))}touchmove(e){this._map.fire(new ma(e.type,this._map,e))}touchend(e){this._map.fire(new ma(e.type,this._map,e))}touchcancel(e){this._map.fire(new ma(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fa{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new pa(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new pa("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new pa(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ga{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(i.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=n,this._box||(this._box=i.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));const r=Math.min(a.x,n.x),o=Math.max(a.x,n.x),s=Math.min(a.y,n.y),l=Math.max(a.y,n.y);i.setTransform(this._box,`translate(${r}px,${s}px)`),this._box.style.width=o-r+"px",this._box.style.height=l-s+"px"}mouseupWindow(t,n){if(!this._active)return;if(0!==t.button)return;const a=this._startPos,r=n;if(this.reset(),i.suppressClick(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(a,r,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new e.Event(t,{originalEvent:n}))}}function _a(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const n={};for(let a=0;a<e.length;a++)n[e[a].identifier]=t[a];return n}class ya{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(t){const n=new e.pointGeometry(0,0);for(const e of t)n._add(e);return n.div(t.length)}(n),this.touches=_a(a,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;const a=_a(n,t);for(const e in this.touches){const t=this.touches[e],n=a[e];(!n||n.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Ma{constructor(e){this.singleTap=new ya(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){const a=this.singleTap.touchend(e,t,n);if(a){const t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(a)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class va{constructor(){this._zoomIn=new Ma({numTouches:1,numTaps:2}),this._zoomOut=new Ma({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){const a=this._zoomIn.touchend(e,t,n),r=this._zoomOut.touchend(e,t,n);return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(a)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const za={0:1,2:2};class Oa{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const n=i.mouseButton(e);this._correctButton(e,n)&&(this._lastPoint=t,this._eventButton=n)}mousemoveWindow(e,t){const n=this._lastPoint;if(n)if(e.preventDefault(),function(e,t){const n=za[t];return void 0===e.buttons||(e.buttons&n)!==n}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(n,t)}mouseupWindow(e){this._lastPoint&&i.mouseButton(e)===this._eventButton&&(this._moved&&i.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ka extends Oa{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0)}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return{around:t,panDelta:t.sub(e)}}}class Aa extends Oa{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const n=.8*(t.x-e.x);if(n)return this._active=!0,{bearingDelta:n}}contextmenu(e){e.preventDefault()}}class xa extends Oa{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const n=-.5*(t.y-e.y);if(n)return this._active=!0,{pitchDelta:n}}contextmenu(e){e.preventDefault()}}class wa{constructor(e,t){this._minTouches=e.cooperativeGestures?2:1,this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._map._cooperativeGestures&&(2===this._minTouches&&n.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(e,!1,n.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(n.length<this._minTouches))return e.preventDefault(),this._calculateTransform(e,t,n)}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&n.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const r=_a(a,n),i=new e.pointGeometry(0,0),o=new e.pointGeometry(0,0);let s=0;for(const e in r){const t=r[e],n=this._touches[e];n&&(i._add(t),o._add(t.sub(n)),s++,r[e]=t)}if(this._touches=r,s<this._minTouches||!o.mag())return;const l=o.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:i.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Na{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(e){}_move(e,t,n){return{}}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();const[a,r]=this._firstTwoTouches,i=qa(n,t,a),o=qa(n,t,r);if(!i||!o)return;const s=this._aroundCenter?null:i.add(o).div(2);return this._move([i,o],s,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;const[a,r]=this._firstTwoTouches,o=qa(n,t,a),s=qa(n,t,r);o&&s||(this._active&&i.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function qa(e,t,n){for(let a=0;a<e.length;a++)if(e[a].identifier===n)return t[a]}function Ea(e,t){return Math.log(e/t)/Math.LN2}class ja extends Na{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const n=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Ea(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ea(this._distance,n),pinchAround:t}}}function Wa(e,t){return 180*e.angleWith(t)/Math.PI}class La extends Na{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t){const n=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Wa(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,n=Wa(e,this._startVector);return Math.abs(n)<t}}function Sa(e){return Math.abs(e.y)>Math.abs(e.x)}class Ta extends Na{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,n){super.touchstart(e,t,n),this._currentTouchCount=n.length}_start(e){this._lastPoints=e,Sa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const a=e[0].sub(this._lastPoints[0]),r=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,r,n.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(a.y+r.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,n){if(void 0!==this._valid)return this._valid;const a=e.mag()>=2,r=t.mag()>=2;if(!a&&!r)return;if(!a||!r)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const i=e.y>0==t.y>0;return Sa(e)&&Sa(t)&&i}}const Ca={panStep:100,bearingStep:15,pitchStep:10};class Ra{constructor(){const e=Ca;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,a=0,r=0,i=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),i=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),i=1);break;default:return}return this._rotationDisabled&&(n=0,a=0),{cameraAnimation:o=>{const s=o.getZoom();o.easeTo({duration:300,easeId:"keyboardHandler",easing:Da,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:o.getBearing()+n*this._bearingStep,pitch:o.getPitch()+a*this._pitchStep,offset:[-r*this._panStep,-i*this._panStep],center:o.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Da(e){return e*(2-e)}const Pa=4.000244140625;class Ba{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=e.exported.now(),r=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==n&&n%Pa==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=i.mousePos(this._el,t);this._around=e.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Pa?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const a="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(a*n))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:t.zoom,a=this._startZoom,r=this._easing;let i,o=!1;if("wheel"===this._type&&a&&r){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),s=r(t);i=e.number(a,n,s),t<1?this._frameId||(this._frameId=!0):o=!0}else i=n,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:i-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=e.ease;if(this._prevEase){const t=this._prevEase,a=(e.exported.now()-t.start)/t.duration,r=t.easing(a+.01)-t.easing(a),i=.27/Math.sqrt(r*r+1e-4)*.01,o=Math.sqrt(.0729-i*i);n=e.bezier(i,o,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ia{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class $a{constructor(){this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(e.shiftKey?-1:1),around:n.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fa{constructor(){this._tap=new Ma({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,t,n){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=t[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(e,t,n))}touchmove(e,t,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const a=t[0],r=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,n)}touchend(e,t,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(e,t,n)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xa{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ya{constructor(e,t,n){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ha{constructor(e,t,n,a){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ua=e=>e.zoom||e.drag||e.pitch||e.rotate;class Va extends e.Event{}function Ga(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ka{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ca(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),e.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,n]of this._listeners)i.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[e,t,n]of this._listeners)i.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){const t=this._map,n=t.getCanvasContainer();this._add("mapEvent",new ha(t,e));const a=t.boxZoom=new ga(t,e);this._add("boxZoom",a);const r=new va,i=new $a;t.doubleClickZoom=new Ia(i,r),this._add("tapZoom",r),this._add("clickZoom",i);const o=new Fa;this._add("tapDragZoom",o);const s=t.touchPitch=new Ta(t);this._add("touchPitch",s);const l=new Aa(e),c=new xa(e);t.dragRotate=new Ya(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new ka(e),d=new wa(e,t);t.dragPan=new Xa(n,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]);const p=new La,m=new ja;t.touchZoomRotate=new Ha(n,m,p,o),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]);const b=t.scrollZoom=new Ba(t,this);this._add("scrollZoom",b,["mousePan"]);const h=t.keyboard=new Ra;this._add("keyboard",h),this._add("blockableMapEvent",new fa(t));for(const n of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[n]&&t[n].enable(e[n])}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ua(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,n){for(const a in e)if(a!==n&&(!t||t.indexOf(a)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,e.type+"Window")}_getMapTouches(e){const t=[];for(const n of e)this._el.contains(n.target)&&t.push(n);return t}handleEvent(e,t){if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===e.type?void 0:e,a={needsRenderFrame:!1},r={},o={},s=e.touches,l=s?this._getMapTouches(s):void 0,c=l?i.touchPos(this._el,l):i.mousePos(this._el,e);for(const{handlerName:i,handler:s,allowed:u}of this._handlers){if(!s.isEnabled())continue;let d;this._blockedByActive(o,u,i)?s.reset():s[t||e.type]&&(d=s[t||e.type](e,c,l),this.mergeHandlerResult(a,r,d,i,n),d&&d.needsRenderFrame&&this._triggerRenderFrame()),(d||s.isActive())&&(o[i]=s)}const u={};for(const e in this._previousActiveHandlers)o[e]||(u[e]=n);this._previousActiveHandlers=o,(Object.keys(u).length||Ga(a))&&(this._changes.push([a,r,u]),this._triggerRenderFrame()),(Object.keys(o).length||Ga(a))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:d}=a;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(t,n,a,r,i){if(!a)return;e.extend(t,a);const o={handlerName:r,originalEvent:a.originalEvent||i};void 0!==a.zoomDelta&&(n.zoom=o),void 0!==a.panDelta&&(n.drag=o),void 0!==a.pitchDelta&&(n.pitch=o),void 0!==a.bearingDelta&&(n.rotate=o)}_applyChanges(){const t={},n={},a={};for(const[r,i,o]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new e.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),e.extend(n,i),e.extend(a,o);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const r=this._map,i=r.transform,o=r.style&&r.style.terrain;if(!(Ga(t)||o&&this._drag))return this._fireEvents(n,a,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:d,pinchAround:p}=t;void 0!==p&&(d=p),r._stop(!0),d=d||r.transform.centerPoint;const m=i.pointLocation(s?d.sub(s):d);c&&(i.bearing+=c),u&&(i.pitch+=u),l&&(i.zoom+=l),o?n.drag&&!this._drag?(this._drag={center:i.centerPoint,lngLat:i.pointLocation(d),point:d,handlerName:n.drag.handlerName},r.fire(new e.Event("freezeElevation",{freeze:!0}))):this._drag&&a[this._drag.handlerName]?(r.fire(new e.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(i.center=i.pointLocation(i.centerPoint.sub(s))):i.setLocationAtPoint(m,d),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const r=Ua(this._eventsInProgress),i=Ua(t),o={};for(const e in t){const{originalEvent:n}=t[e];this._eventsInProgress[e]||(o[e+"start"]=n),this._eventsInProgress[e]=t[e]}!r&&i&&this._fireEvent("movestart",i.originalEvent);for(const e in o)this._fireEvent(e,o[e]);i&&this._fireEvent("move",i.originalEvent);for(const e in t){const{originalEvent:n}=t[e];this._fireEvent(e,n)}const s={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:a}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=n[t]||a,s[e+"end"]=l)}for(const e in s)this._fireEvent(e,s[e]);const c=Ua(this._eventsInProgress);if(a&&(r||i)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;t?(n(t.bearing||this._map.getBearing())&&(t.bearing=0),this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new e.Event("moveend",{originalEvent:l})),n(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new e.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Va("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Ja={extend:(t,...n)=>e.extend(t,...n),run(e){e()},logToElement(e,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+="<br>"+e)}};class Za extends e.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,e.bindAll(["_renderFrameCallback"],this)}getCenter(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,n,a){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(e.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,n,a){return this.easeTo(e.extend({zoom:t},n),a)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,n,a){return this.easeTo(e.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,e.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(t,n){t=e.LngLatBounds.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,r){const i={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=e.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const e=r.padding;r.padding={top:e,bottom:e,right:e,left:e}}r.padding=e.extend(i,r.padding);const o=this.transform,s=o.padding,l=o.project(e.LngLat.convert(t)),c=o.project(e.LngLat.convert(n)),u=l.rotate(-a*Math.PI/180),d=c.rotate(-a*Math.PI/180),p=new e.pointGeometry(Math.max(u.x,d.x),Math.max(u.y,d.y)),m=new e.pointGeometry(Math.min(u.x,d.x),Math.min(u.y,d.y)),b=p.sub(m),h=(o.width-(s.left+s.right+r.padding.left+r.padding.right))/b.x,f=(o.height-(s.top+s.bottom+r.padding.top+r.padding.bottom))/b.y;if(f<0||h<0)return void e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const g=Math.min(o.scaleZoom(o.scale*Math.min(h,f)),r.maxZoom),_=e.pointGeometry.convert(r.offset),y=new e.pointGeometry((r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2).rotate(a*Math.PI/180),M=_.add(y).mult(o.scale/o.zoomScale(g));return{center:o.unproject(l.add(c).div(2).sub(M)),zoom:g,bearing:a}}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(t,n,a,r,i){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(e.pointGeometry.convert(t)),this.transform.pointLocation(e.pointGeometry.convert(n)),a,r),r,i)}_fitInternal(t,n,a){return t?(delete(n=e.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this.transform;let r=!1,i=!1,o=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(r=!0,a.zoom=+t.zoom),void 0!==t.center&&(a.center=e.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(i=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(o=!0,a.pitch=+t.pitch),null==t.padding||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this.fire(new e.Event("movestart",n)).fire(new e.Event("move",n)),r&&this.fire(new e.Event("zoomstart",n)).fire(new e.Event("zoom",n)).fire(new e.Event("zoomend",n)),i&&this.fire(new e.Event("rotatestart",n)).fire(new e.Event("rotate",n)).fire(new e.Event("rotateend",n)),o&&this.fire(new e.Event("pitchstart",n)).fire(new e.Event("pitch",n)).fire(new e.Event("pitchend",n)),this.fire(new e.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,r=0){const i=e.MercatorCoordinate.fromLngLat(t,n),o=e.MercatorCoordinate.fromLngLat(a,r),s=o.x-i.x,l=o.y-i.y,c=o.z-i.z,u=Math.hypot(s,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const d=Math.hypot(s,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/u/this.transform.tileSize),m=180*Math.atan2(s,-l)/Math.PI;let b=180*Math.acos(d/u)/Math.PI;return b=c<0?90-b:90+b,{center:o.toLngLat(),zoom:p,pitch:b,bearing:m}}easeTo(t,n){this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||!t.essential&&e.exported.prefersReducedMotion)&&(t.duration=0);const a=this.transform,r=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?+t.zoom:r,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:a.padding,p=e.pointGeometry.convert(t.offset);let m=a.centerPoint.add(p);const b=a.pointLocation(m),h=e.LngLat.convert(t.center||b);this._normalizeCenter(h);const f=a.project(b),g=a.project(h).sub(f),_=a.zoomScale(l-r);let y,M;t.around&&(y=e.LngLat.convert(t.around),M=a.locationPoint(y));const v={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==r,this._rotating=this._rotating||i!==c,this._pitching=this._pitching||u!==o,this._padding=!a.isPaddingEqual(d),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,v),this._ease(t=>{if(this._zooming&&(a.zoom=e.number(r,l,t)),this._rotating&&(a.bearing=e.number(i,c,t)),this._pitching&&(a.pitch=e.number(o,u,t)),this._padding&&(a.interpolatePadding(s,d,t),m=a.centerPoint.add(p)),y)a.setLocationAtPoint(y,M);else{const e=a.zoomScale(a.zoom-r),n=l>r?Math.min(2,_):Math.max(.5,_),i=Math.pow(n,1-t),o=a.unproject(f.add(g.mult(t*i)).mult(e));a.setLocationAtPoint(a.renderWorldCopies?o.wrap():o,m)}this._fireMoveEvents(n)},e=>{this._afterEase(n,e)},t),this}_prepareEase(t,n,a={}){this._moving=!0,this.fire(new e.Event("freezeElevation",{freeze:!0})),n||a.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new e.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new e.Event("freezeElevation",{freeze:!1}));const a=this._zooming,r=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new e.Event("zoomend",t)),r&&this.fire(new e.Event("rotateend",t)),i&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}flyTo(t,n){if(!t.essential&&e.exported.prefersReducedMotion){const a=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(a,n)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const a=this.transform,r=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,a.minZoom,a.maxZoom):r,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:a.padding,p=a.zoomScale(l-r),m=e.pointGeometry.convert(t.offset);let b=a.centerPoint.add(m);const h=a.pointLocation(b),f=e.LngLat.convert(t.center||h);this._normalizeCenter(f);const g=a.project(h),_=a.project(f).sub(g);let y=t.curve;const M=Math.max(a.width,a.height),v=M/p,z=_.mag();if("minZoom"in t){const n=e.clamp(Math.min(t.minZoom,r,l),a.minZoom,a.maxZoom),i=M/a.zoomScale(n-r);y=Math.sqrt(i/z*2)}const O=y*y;function k(e){const t=(v*v-M*M+(e?-1:1)*O*O*z*z)/(2*(e?v:M)*O*z);return Math.log(Math.sqrt(t*t+1)-t)}function A(e){return(Math.exp(e)-Math.exp(-e))/2}function x(e){return(Math.exp(e)+Math.exp(-e))/2}const w=k(0);let N=function(e){return x(w)/x(w+y*e)},q=function(e){return M*((x(w)*(A(t=w+y*e)/x(t))-A(w))/O)/z;var t},E=(k(1)-w)/y;if(Math.abs(z)<1e-6||!isFinite(E)){if(Math.abs(M-v)<1e-6)return this.easeTo(t,n);const e=v<M?-1:1;E=Math.abs(Math.log(v/M))/y,q=function(){return 0},N=function(t){return Math.exp(e*y*t)}}return t.duration="duration"in t?+t.duration:1e3*E/("screenSpeed"in t?+t.screenSpeed/y:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=i!==c,this._pitching=u!==o,this._padding=!a.isPaddingEqual(d),this._prepareEase(n,!1),this._ease(t=>{const p=t*E,h=1/N(p);a.zoom=1===t?l:r+a.scaleZoom(h),this._rotating&&(a.bearing=e.number(i,c,t)),this._pitching&&(a.pitch=e.number(o,u,t)),this._padding&&(a.interpolatePadding(s,d,t),b=a.centerPoint.add(m));const y=1===t?f:a.unproject(g.add(_.mult(q(p))).mult(h));a.setLocationAtPoint(a.renderWorldCopies?y.wrap():y,b),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,n,a){!1===a.animate||0===a.duration?(t(1),n()):(this._easeStart=e.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=e.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(e){const t=this.transform;if(!t.renderWorldCopies||t.lngRange)return;const n=e.lng-t.center.lng;e.lng+=n>180?-360:n<-180?360:0}}class Qa{constructor(t={}){this.options=t,e.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=i.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=i.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){const n=this._map._getUIString("AttributionControl."+t);e.title=n,e.setAttribute("aria-label",n)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(e){!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"!=typeof e?"":e)):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.sourceCaches;for(const n in t){const a=t[n];if(a.used||a.usedForTerrain){const t=a.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let a=n+1;a<e.length;a++)if(e[a].indexOf(t)>=0)return!1;return!0});const n=e.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class er{constructor(t={}){this.options=t,e.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=i.create("div","maplibregl-ctrl mapboxgl-ctrl");const t=i.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact","mapboxgl-compact"):t.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(const t of n)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const nr={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},ar={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},rr={showCompass:!0,showZoom:!0,visualizePitch:!1};class ir{constructor(t,n,a=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Aa({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,a&&(this.mousePitch=new xa({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener(n,"mousedown",this.mousedown),i.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(n,"touchmove",this.touchmove),i.addEventListener(n,"touchend",this.touchend),i.addEventListener(n,"touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),i.disableDrag()}move(e,t){const n=this.map,a=this.mouseRotate.mousemoveWindow(e,t);if(a&&a.bearingDelta&&n.setBearing(n.getBearing()+a.bearingDelta),this.mousePitch){const a=this.mousePitch.mousemoveWindow(e,t);a&&a.pitchDelta&&n.setPitch(n.getPitch()+a.pitchDelta)}}off(){const e=this.element;i.removeEventListener(e,"mousedown",this.mousedown),i.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(e,"touchmove",this.touchmove),i.removeEventListener(e,"touchend",this.touchend),i.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){i.enableDrag(),i.removeEventListener(window,"mousemove",this.mousemove),i.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),i.mousePos(this.element,t)),i.addEventListener(window,"mousemove",this.mousemove),i.addEventListener(window,"mouseup",this.mouseup)}mousemove(e){this.move(e,i.mousePos(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function or(t,n,a){if(t=new e.LngLat(t.lng,t.lat),n){const r=new e.LngLat(t.lng-360,t.lat),i=new e.LngLat(t.lng+360,t.lat),o=a.locationPoint(t).distSqr(n);a.locationPoint(r).distSqr(n)<o?t=r:a.locationPoint(i).distSqr(n)<o&&(t=i)}for(;Math.abs(t.lng-a.center.lng)>180;){const e=a.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;t.lng>a.center.lng?t.lng-=360:t.lng+=360}return t}const sr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function lr(e,t,n){const a=e.classList;for(const e in sr)a.remove(`maplibregl-${n}-anchor-${e}`,`mapboxgl-${n}-anchor-${e}`);a.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class cr extends e.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=e.extend({element:t},n)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=e.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");const n=i.createNS("http://www.w3.org/2000/svg","svg"),a=41,r=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",a+"px"),n.setAttributeNS(null,"width",r+"px"),n.setAttributeNS(null,"viewBox",`0 0 ${r} ${a}`);const o=i.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const s=i.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const e of c){const t=i.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),l.appendChild(t)}const u=i.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const d=i.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(d);const p=i.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const m=i.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),p.appendChild(m);const b=i.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"transform","translate(6.0, 7.0)"),b.setAttributeNS(null,"fill","#FFFFFF");const h=i.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"transform","translate(8.0, 8.0)");const f=i.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");const g=i.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),h.appendChild(f),h.appendChild(g),s.appendChild(l),s.appendChild(u),s.appendChild(p),s.appendChild(b),s.appendChild(h),n.appendChild(s),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(n),this._offset=e.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),lr(this._element,this._anchor,"marker"),this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,n=13.5,a=Math.sqrt(Math.pow(n,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[a,-1*(t-n+a)],"bottom-right":[-a,-1*(t-n+a)],left:[n,-1*(t-n)],right:[-n,-1*(t-n)]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(e){const t=e.code,n=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==n&&13!==n||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}_update(e){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=or(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let t="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?t=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(t=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),e&&"moveend"!==e.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${sr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${t}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const e=this._map.unproject(this._pos),t=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=e.distanceTo(this._lngLat)>20*t?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=e.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.Event("dragstart"))),this.fire(new e.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new e.Event("dragend")),this._state="inactive"}_addDragHandler(e){this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ur={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let dr,pr=0,mr=!1;const br={maxWidth:100,unit:"metric"};function hr(e,t,n){const a=n&&n.maxWidth||100,r=e._container.clientHeight/2,i=e.unproject([0,r]),o=e.unproject([a,r]),s=i.distanceTo(o);if(n&&"imperial"===n.unit){const n=3.2808*s;n>5280?fr(t,a,n/5280,e._getUIString("ScaleControl.Miles")):fr(t,a,n,e._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?fr(t,a,s/1852,e._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fr(t,a,s/1e3,e._getUIString("ScaleControl.Kilometers")):fr(t,a,s,e._getUIString("ScaleControl.Meters"))}function fr(e,t,n,a){const r=function(e){const t=Math.pow(10,(""+Math.floor(e)).length-1);let n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(n),t*n}(n);e.style.width=t*(r/n)+"px",e.innerHTML=`${r}&nbsp;${a}`}const gr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},_r=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function yr(t){if(t){if("number"==typeof t){const n=Math.round(Math.sqrt(.5*Math.pow(t,2)));return{center:new e.pointGeometry(0,0),top:new e.pointGeometry(0,t),"top-left":new e.pointGeometry(n,n),"top-right":new e.pointGeometry(-n,n),bottom:new e.pointGeometry(0,-t),"bottom-left":new e.pointGeometry(n,-n),"bottom-right":new e.pointGeometry(-n,-n),left:new e.pointGeometry(t,0),right:new e.pointGeometry(-t,0)}}if(t instanceof e.pointGeometry||Array.isArray(t)){const n=e.pointGeometry.convert(t);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:e.pointGeometry.convert(t.center||[0,0]),top:e.pointGeometry.convert(t.top||[0,0]),"top-left":e.pointGeometry.convert(t["top-left"]||[0,0]),"top-right":e.pointGeometry.convert(t["top-right"]||[0,0]),bottom:e.pointGeometry.convert(t.bottom||[0,0]),"bottom-left":e.pointGeometry.convert(t["bottom-left"]||[0,0]),"bottom-right":e.pointGeometry.convert(t["bottom-right"]||[0,0]),left:e.pointGeometry.convert(t.left||[0,0]),right:e.pointGeometry.convert(t.right||[0,0])}}return yr(new e.pointGeometry(0,0))}const Mr={supported:t,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:class extends Za{constructor(t){var n;if(e.PerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},ar,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new na(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._interactive=t.interactive,this._cooperativeGestures=t.cooperativeGestures,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new tr,this._controls=[],this._mapId=e.uniqueId(),this._locale=e.extend({},nr,t.locale),this._clickTolerance=t.clickTolerance,this._pixelRatio=null!==(n=t.pixelRatio)&&void 0!==n?n:devicePixelRatio,this._requestManager=new o(t.transformRequest),"string"==typeof t.container){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Ka(this,t),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=t.hash&&new aa("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Qa({customAttribution:t.customAttribution})),t.maplibreLogo&&this.addControl(new er,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.Event(t.dataType+"data",t))}),this.on("dataloading",t=>{this.fire(new e.Event(t.dataType+"dataloading",t))}),this.on("dataabort",t=>{this.fire(new e.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(t,n){if(void 0===n&&(n=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[n];return-1!==n.indexOf("bottom")?r.insertBefore(a,r.firstChild):r.appendChild(a),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(t);return n>-1&&this._controls.splice(n,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,n,a){return null==a&&this.style.terrain&&(a=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(e,t,n,a)}resize(t){const n=this._containerDimensions(),a=n[0],r=n[1];this._resizeCanvas(a,r,this.getPixelRatio()),this.transform.resize(a,r),this.painter.resize(a,r,this.getPixelRatio());const i=!this._moving;return i&&(this.stop(),this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t))),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(e){const[t,n]=this._containerDimensions();this._pixelRatio=e,this._resizeCanvas(t,n,e),this.painter.resize(t,n,e)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>85)throw new Error("maxPitch must be less than or equal to 85");if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}project(t){return this.transform.locationPoint(e.LngLat.convert(t),this.style&&this.style.terrain)}unproject(t){return this.transform.pointLocation(e.pointGeometry.convert(t),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(e,t,n){if("mouseenter"===e||"mouseover"===e){let a=!1;const r=r=>{const i=this.getLayer(t)?this.queryRenderedFeatures(r.point,{layers:[t]}):[];i.length?a||(a=!0,n.call(this,new pa(e,this,r.originalEvent,{features:i}))):a=!1};return{layer:t,listener:n,delegates:{mousemove:r,mouseout:()=>{a=!1}}}}if("mouseleave"===e||"mouseout"===e){let a=!1;const r=r=>{(this.getLayer(t)?this.queryRenderedFeatures(r.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new pa(e,this,r.originalEvent)))},i=t=>{a&&(a=!1,n.call(this,new pa(e,this,t.originalEvent)))};return{layer:t,listener:n,delegates:{mousemove:r,mouseout:i}}}{const a=e=>{const a=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];a.length&&(e.features=a,n.call(this,e),delete e.features)};return{layer:t,listener:n,delegates:{[e]:a}}}}on(e,t,n){if(void 0===n)return super.on(e,t);const a=this._createDelegatedListener(e,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(a);for(const e in a.delegates)this.on(e,a.delegates[e]);return this}once(e,t,n){if(void 0===n)return super.once(e,t);const a=this._createDelegatedListener(e,t,n);for(const e in a.delegates)this.once(e,a.delegates[e]);return this}off(e,t,n){return void 0===n?super.off(e,t):(this._delegatedListeners&&this._delegatedListeners[e]&&(a=>{const r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){const a=r[e];if(a.layer===t&&a.listener===n){for(const e in a.delegates)this.off(e,a.delegates[e]);return r.splice(e,1),this}}})(),this)}queryRenderedFeatures(t,n){if(!this.style)return[];let a;if(void 0!==n||void 0===t||t instanceof e.pointGeometry||Array.isArray(t)||(n=t,t=void 0),n=n||{},(t=t||[[0,0],[this.transform.width,this.transform.height]])instanceof e.pointGeometry||"number"==typeof t[0])a=[e.pointGeometry.convert(t)];else{const n=e.pointGeometry.convert(t[0]),r=e.pointGeometry.convert(t[1]);a=[n,new e.pointGeometry(r.x,n.y),r,new e.pointGeometry(n.x,r.y),n]}return this.style.queryRenderedFeatures(a,n,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(t,n){return!1!==(n=e.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(t,n))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),e?(this.style=new tt(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e):this.style.loadJSON(e),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tt(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,n){if("string"==typeof t){const a=this._requestManager.transformRequest(t,e.ResourceType.Style);e.getJSON(a,(t,a)=>{t?this.fire(new e.ErrorEvent(t)):a&&this._updateDiff(a,n)})}else"object"==typeof t&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t)&&this._update(!0)}catch(a){e.warnOnce(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(t,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.warnOnce("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(t){const n=this.style&&this.style.sourceCaches[t];if(void 0!==n)return n.loaded();this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`)))}setTerrain(e){return this.style.setTerrain(e),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const e=this.style&&this.style.sourceCaches;for(const t in e){const n=e[t]._tiles;for(const e in n){const t=n[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,n)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,n,{pixelRatio:a=1,sdf:r=!1,stretchX:i,stretchY:o,content:s}={}){if(this._lazyInitEmptyStyle(),n instanceof HTMLImageElement||e.isImageBitmap(n)){const{width:l,height:c,data:u}=e.exported.getImageData(n);this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},u),pixelRatio:a,stretchX:i,stretchY:o,content:s,sdf:r,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:l,height:c,data:u}=n,d=n;this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},new Uint8Array(u)),pixelRatio:a,stretchX:i,stretchY:o,content:s,sdf:r,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t)}}}updateImage(t,n){const a=this.style.getImage(t);if(!a)return this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=n instanceof HTMLImageElement||e.isImageBitmap(n)?e.exported.getImageData(n):n,{width:i,height:o,data:s}=r;if(void 0===i||void 0===o)return this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(i!==a.data.width||o!==a.data.height)return this.fire(new e.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(n instanceof HTMLImageElement||e.isImageBitmap(n));a.data.replace(s,l),this.style.updateImage(t,a)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,n){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),n)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,a={}){return this.style.setPaintProperty(e,t,n,a),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,a={}){return this.style.setLayoutProperty(e,t,n,a),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=i.create("div","maplibregl-canvas-container mapboxgl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=i.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=i.create("div","maplibregl-control-container mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{r[e]=i.create("div",`maplibregl-ctrl-${e} mapboxgl-ctrl-${e}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const e=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=i.create("div","maplibregl-cooperative-gesture-screen",e);let t="Control",n="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(n="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${n}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,document.addEventListener("keydown",e=>{e.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",e=>{e.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",e=>{this._onCooperativeGesture(e,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(e,t,n){this._canvas.width=n*e,this._canvas.height=n*t,this._canvas.style.width=e+"px",this._canvas.style.height=t+"px"}_setupPainter(){const n=e.extend({},t.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);a?(this.painter=new Zn(a,this.transform),e.exported$1.testSupport(a)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(e,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(t){let n,a=0;const r=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(n=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,n),a=e.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,n=e.exported.now();this.style.zoomHistory.update(t,n);const a=new e.EvaluationParameters(t,{now:n,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=a.crossFadingFactor();1===r&&r===this._crossFadingFactor||(i=!0,this._crossFadingFactor=r),this.style.update(a)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.PerformanceUtils.mark(e.PerformanceMarkers.load),this.fire(new e.Event("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const t=e.exported.now()-a;r.endQueryEXT(r.TIME_ELAPSED_EXT,n),setTimeout(()=>{const a=r.getQueryObjectEXT(n,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:a}))},50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout(()=>{const n=this.painter.queryGpuTimers(t);this.fire(new e.Event("gpu-timing-layer",{layerTimes:n}))},50)}const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.Event("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,e.PerformanceUtils.mark(e.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&i.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),e.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new e.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=e.exported.frame(t=>{e.PerformanceUtils.frame(t),this._frame=null,this._render(t)}))}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}_setCacheLimits(t,n){e.setCacheLimits(t,n)}get version(){return"2.4.0"}},NavigationControl:class{constructor(t){this.options=e.extend({},rr,t),this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ir(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){const n=i.create("button",e,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(e,t){const n=this._map._getUIString("NavigationControl."+t);e.title=n,e.setAttribute("aria-label",n)}},GeolocateControl:class extends e.Evented{constructor(t){super(),this.options=e.extend({},ur,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(e){var t;return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,void 0!==dr?t(dr):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(e=>{dr="denied"!==e.state,t(dr)}):(dr=!!window.navigator.geolocation,t(dr)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,pr=0,mr=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),n=e.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState "+this._watchState)}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState "+this._watchState)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}_updateCamera(t){const n=new e.LngLat(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,r=this._map.getBearing(),i=e.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(a),i,{geolocateSource:!0})}_updateMarker(t){if(t){const n=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const e=this._map._container.clientHeight/2,t=this._map.unproject([0,e]),n=this._map.unproject([1,e]),a=t.distanceTo(n),r=Math.ceil(2*this._accuracy/a);this._circleElement.style.width=r+"px",this._circleElement.style.height=r+"px"}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&mr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new cr(this._dotElement),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new cr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new e.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return e.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":pr--,mr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.Event("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState "+this._watchState)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState "+this._watchState)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),pr++,pr>1?(e={maximumAge:6e5,timeout:0},mr=!0):(e=this.options.positionOptions,mr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Qa,LogoControl:er,ScaleControl:class{constructor(t){this.options=e.extend({},br,t),e.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){hr(this._map,this._container,this.options)}onAdd(e){return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(e){this.options.unit=e,hr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(t){this.options=t,e.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=i.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends e.Evented{constructor(t){super(),this.options=e.extend(Object.create(gr),t),e.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new e.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&i.remove(this._content),this._container&&(i.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new e.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=e;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(e){this._update(e.point)}_onMouseMove(e){this._update(e.point)}_onDrag(e){this._update(e.point)}_update(e){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=i.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(e=>this._container.classList.add(e)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=or(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;const t=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);let n=this.options.anchor;const a=yr(this.options.offset);if(!n){const e=this._container.offsetWidth,r=this._container.offsetHeight;let i;i=t.y+a.bottom.y<r?["top"]:t.y>this._map.transform.height-r?["bottom"]:[],t.x<e/2?i.push("left"):t.x>this._map.transform.width-e/2&&i.push("right"),n=0===i.length?"bottom":i.join("-")}const r=t.add(a[n]).round();i.setTransform(this._container,`${sr[n]} translate(${r.x}px,${r.y}px)`),lr(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(_r);e&&e.focus()}_onClose(){this.remove()}},Marker:cr,Style:tt,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.pointGeometry,MercatorCoordinate:e.MercatorCoordinate,Evented:e.Evented,AJAXError:e.AJAXError,config:e.config,CanvasSource:E,GeoJSONSource:x,ImageSource:N,RasterDEMTileSource:A,RasterTileSource:O,VectorTileSource:z,VideoSource:q,prewarm:function(){Y().acquire(I)},clearPrewarmedResources:function(){const e=X;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(I),X=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return $.workerCount},set workerCount(e){$.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.clearTileCache(t)},workerUrl:"",addProtocol(t,n){e.config.REGISTERED_PROTOCOLS[t]=n},removeProtocol(t){delete e.config.REGISTERED_PROTOCOLS[t]}};return Ja.extend(Mr,{isSafari:e.isSafari,getPerformanceMetrics:e.PerformanceUtils.getPerformanceMetrics}),Mr})),n}()},,function(e,t,n){!function(t,n){var a=function(e,t,n){"use strict";var a,r;if(function(){var t,n={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(t in r=e.lazySizesConfig||e.lazysizesConfig||{},n)t in r||(r[t]=n[t])}(),!t||!t.getElementsByClassName)return{init:function(){},cfg:r,noSupport:!0};var i=t.documentElement,o=e.HTMLPictureElement,s=e.addEventListener.bind(e),l=e.setTimeout,c=e.requestAnimationFrame||l,u=e.requestIdleCallback,d=/^picture$/i,p=["load","error","lazyincluded","_lazyloaded"],m={},b=Array.prototype.forEach,h=function(e,t){return m[t]||(m[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),m[t].test(e.getAttribute("class")||"")&&m[t]},f=function(e,t){h(e,t)||e.setAttribute("class",(e.getAttribute("class")||"").trim()+" "+t)},g=function(e,t){var n;(n=h(e,t))&&e.setAttribute("class",(e.getAttribute("class")||"").replace(n," "))},_=function(e,t,n){var a=n?"addEventListener":"removeEventListener";n&&_(e,t),p.forEach((function(n){e[a](n,t)}))},y=function(e,n,r,i,o){var s=t.createEvent("Event");return r||(r={}),r.instance=a,s.initEvent(n,!i,!o),s.detail=r,e.dispatchEvent(s),s},M=function(t,n){var a;!o&&(a=e.picturefill||r.pf)?(n&&n.src&&!t.getAttribute("srcset")&&t.setAttribute("srcset",n.src),a({reevaluate:!0,elements:[t]})):n&&n.src&&(t.src=n.src)},v=function(e,t){return(getComputedStyle(e,null)||{})[t]},z=function(e,t,n){for(n=n||e.offsetWidth;n<r.minSize&&t&&!e._lazysizesWidth;)n=t.offsetWidth,t=t.parentNode;return n},O=(me=[],be=[],he=me,fe=function(){var e=he;for(he=me.length?be:me,de=!0,pe=!1;e.length;)e.shift()();de=!1},ge=function(e,n){de&&!n?e.apply(this,arguments):(he.push(e),pe||(pe=!0,(t.hidden?l:c)(fe)))},ge._lsFlush=fe,ge),k=function(e,t){return t?function(){O(e)}:function(){var t=this,n=arguments;O((function(){e.apply(t,n)}))}},A=function(e){var t,a,r=function(){t=null,e()},i=function(){var e=n.now()-a;e<99?l(i,99-e):(u||r)(r)};return function(){a=n.now(),t||(t=l(i,99))}},x=(Y=/^img$/i,H=/^iframe$/i,U="onscroll"in e&&!/(gle|ing)bot/.test(navigator.userAgent),V=0,G=0,K=-1,J=function(e){G--,(!e||G<0||!e.target)&&(G=0)},Z=function(e){return null==X&&(X="hidden"==v(t.body,"visibility")),X||!("hidden"==v(e.parentNode,"visibility")&&"hidden"==v(e,"visibility"))},Q=function(e,n){var a,r=e,o=Z(e);for(B-=n,F+=n,I-=n,$+=n;o&&(r=r.offsetParent)&&r!=t.body&&r!=i;)(o=(v(r,"opacity")||1)>0)&&"visible"!=v(r,"overflow")&&(a=r.getBoundingClientRect(),o=$>a.left&&I<a.right&&F>a.top-1&&B<a.bottom+1);return o},ee=function(){var e,n,o,s,l,c,u,d,p,m,b,h,f=a.elements;if((C=r.loadMode)&&G<8&&(e=f.length)){for(n=0,K++;n<e;n++)if(f[n]&&!f[n]._lazyRace)if(!U||a.prematureUnveil&&a.prematureUnveil(f[n]))se(f[n]);else if((d=f[n].getAttribute("data-expand"))&&(c=1*d)||(c=V),m||(m=!r.expand||r.expand<1?i.clientHeight>500&&i.clientWidth>500?500:370:r.expand,a._defEx=m,b=m*r.expFactor,h=r.hFac,X=null,V<b&&G<1&&K>2&&C>2&&!t.hidden?(V=b,K=0):V=C>1&&K>1&&G<6?m:0),p!==c&&(D=innerWidth+c*h,P=innerHeight+c,u=-1*c,p=c),o=f[n].getBoundingClientRect(),(F=o.bottom)>=u&&(B=o.top)<=P&&($=o.right)>=u*h&&(I=o.left)<=D&&(F||$||I||B)&&(r.loadHidden||Z(f[n]))&&(S&&G<3&&!d&&(C<3||K<4)||Q(f[n],c))){if(se(f[n]),l=!0,G>9)break}else!l&&S&&!s&&G<4&&K<4&&C>2&&(L[0]||r.preloadAfterLoad)&&(L[0]||!d&&(F||$||I||B||"auto"!=f[n].getAttribute(r.sizesAttr)))&&(s=L[0]||f[n]);s&&!l&&se(s)}},te=function(e){var t,a=0,i=r.throttleDelay,o=r.ricTimeout,s=function(){t=!1,a=n.now(),e()},c=u&&o>49?function(){u(s,{timeout:o}),o!==r.ricTimeout&&(o=r.ricTimeout)}:k((function(){l(s)}),!0);return function(e){var r;(e=!0===e)&&(o=33),t||(t=!0,(r=i-(n.now()-a))<0&&(r=0),e||r<9?c():l(c,r))}}(ee),ne=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(J(e),f(t,r.loadedClass),g(t,r.loadingClass),_(t,re),y(t,"lazyloaded"))},ae=k(ne),re=function(e){ae({target:e.target})},ie=function(e){var t,n=e.getAttribute(r.srcsetAttr);(t=r.customMedia[e.getAttribute("data-media")||e.getAttribute("media")])&&e.setAttribute("media",t),n&&e.setAttribute("srcset",n)},oe=k((function(e,t,n,a,i){var o,s,c,u,p,m;(p=y(e,"lazybeforeunveil",t)).defaultPrevented||(a&&(n?f(e,r.autosizesClass):e.setAttribute("sizes",a)),s=e.getAttribute(r.srcsetAttr),o=e.getAttribute(r.srcAttr),i&&(u=(c=e.parentNode)&&d.test(c.nodeName||"")),m=t.firesLoad||"src"in e&&(s||o||u),p={target:e},f(e,r.loadingClass),m&&(clearTimeout(T),T=l(J,2500),_(e,re,!0)),u&&b.call(c.getElementsByTagName("source"),ie),s?e.setAttribute("srcset",s):o&&!u&&(H.test(e.nodeName)?function(e,t){var n=e.getAttribute("data-load-mode")||r.iframeLoadMode;0==n?e.contentWindow.location.replace(t):1==n&&(e.src=t)}(e,o):e.src=o),i&&(s||u)&&M(e,{src:o})),e._lazyRace&&delete e._lazyRace,g(e,r.lazyClass),O((function(){var t=e.complete&&e.naturalWidth>1;m&&!t||(t&&f(e,r.fastLoadedClass),ne(p),e._lazyCache=!0,l((function(){"_lazyCache"in e&&delete e._lazyCache}),9)),"lazy"==e.loading&&G--}),!0)})),se=function(e){if(!e._lazyRace){var t,n=Y.test(e.nodeName),a=n&&(e.getAttribute(r.sizesAttr)||e.getAttribute("sizes")),i="auto"==a;(!i&&S||!n||!e.getAttribute("src")&&!e.srcset||e.complete||h(e,r.errorClass)||!h(e,r.lazyClass))&&(t=y(e,"lazyunveilread").detail,i&&w.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,G++,oe(e,t,i,a,n))}},le=A((function(){r.loadMode=3,te()})),ce=function(){3==r.loadMode&&(r.loadMode=2),le()},ue=function(){S||(n.now()-R<999?l(ue,999):(S=!0,r.loadMode=3,te(),s("scroll",ce,!0)))},{_:function(){R=n.now(),a.elements=t.getElementsByClassName(r.lazyClass),L=t.getElementsByClassName(r.lazyClass+" "+r.preloadClass),s("scroll",te,!0),s("resize",te,!0),s("pageshow",(function(e){if(e.persisted){var n=t.querySelectorAll("."+r.loadingClass);n.length&&n.forEach&&c((function(){n.forEach((function(e){e.complete&&se(e)}))}))}})),e.MutationObserver?new MutationObserver(te).observe(i,{childList:!0,subtree:!0,attributes:!0}):(i.addEventListener("DOMNodeInserted",te,!0),i.addEventListener("DOMAttrModified",te,!0),setInterval(te,999)),s("hashchange",te,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach((function(e){t.addEventListener(e,te,!0)})),/d$|^c/.test(t.readyState)?ue():(s("load",ue),t.addEventListener("DOMContentLoaded",te),l(ue,2e4)),a.elements.length?(ee(),O._lsFlush()):te()},checkElems:te,unveil:se,_aLSL:ce}),w=(E=k((function(e,t,n,a){var r,i,o;if(e._lazysizesWidth=a,a+="px",e.setAttribute("sizes",a),d.test(t.nodeName||""))for(i=0,o=(r=t.getElementsByTagName("source")).length;i<o;i++)r[i].setAttribute("sizes",a);n.detail.dataAttr||M(e,n.detail)})),j=function(e,t,n){var a,r=e.parentNode;r&&(n=z(e,r,n),(a=y(e,"lazybeforesizes",{width:n,dataAttr:!!t})).defaultPrevented||(n=a.detail.width)&&n!==e._lazysizesWidth&&E(e,r,a,n))},W=A((function(){var e,t=q.length;if(t)for(e=0;e<t;e++)j(q[e])})),{_:function(){q=t.getElementsByClassName(r.autosizesClass),s("resize",W)},checkElems:W,updateElem:j}),N=function(){!N.i&&t.getElementsByClassName&&(N.i=!0,w._(),x._())};var q,E,j,W;var L,S,T,C,R,D,P,B,I,$,F,X,Y,H,U,V,G,K,J,Z,Q,ee,te,ne,ae,re,ie,oe,se,le,ce,ue;var de,pe,me,be,he,fe,ge;return l((function(){r.init&&N()})),a={cfg:r,autoSizer:w,loader:x,init:N,uP:M,aC:f,rC:g,hC:h,fire:y,gW:z,rAF:O}}(t,t.document,Date);t.lazySizes=a,e.exports&&(e.exports=a)}("undefined"!=typeof window?window:{})},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(8),d={increase:"positive",decrease:"negative",neutral:"neutral"},p={increase:"arrow-up",decrease:"arrow-down"};t.a=function(e){var t=e.change,n=void 0===t?"neutral":t,a=e.className,i=e.icon,m=e.id,b=e.value,h=d[n],f=p[n];return i&&(f=i),r.a.createElement(r.a.Fragment,null,b&&r.a.createElement("div",{className:o()(Object(s.b)("pb_stat_change_kit",h),Object(l.c)(e),a),id:m},r.a.createElement(c.a,{status:h},f&&r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,{fixed_width:!0,icon:f})," "),"".concat(b,"%"))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(53),l=n(2),c=n(5),u=n(13),d=n(17),p=n(8),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.alignment,i=void 0===a?"left":a,b=e.className,h=e.data,f=void 0===h?{}:h,g=e.id,_=e.showDayOfWeek,y=void 0!==_&&_,M=e.showIcon,v=void 0!==M&&M,z=e.size,O=void 0===z?"md":z,k=e.unstyled,A=void 0!==k&&k,x=e.value,w=new s.a({value:x}),N=w.toWeekday(),q=w.toMonth(),E=w.toDay(),j=w.toYear(),W=(new Date).getFullYear().toString(),L=Object(l.a)(n),S=Object(l.c)(f),T=o()(Object(l.b)("pb_date_kit",i),Object(c.c)(e),b);return r.a.createElement("div",Object.assign({},L,S,{className:T,id:g}),A?r.a.createElement(r.a.Fragment,null,v&&r.a.createElement("div",null,r.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt"})),y&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",null,N),r.a.createElement("div",null,"•")),r.a.createElement("span",null,r.a.createElement("span",null,q," ",E),W!=j&&r.a.createElement("span",null,", ".concat(j)))):"md"==O||"lg"==O?r.a.createElement(m.a,{size:4,tag:"h4"},v&&r.a.createElement(u.a,{className:"pb_icon_kit_container",color:"light",tag:"span"},r.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt"})),y&&r.a.createElement(r.a.Fragment,null,N,r.a.createElement(u.a,{color:"light",tag:"span",text:" • "})),r.a.createElement("span",null,q," ",E),W!=j&&r.a.createElement("span",null,", ".concat(j))):r.a.createElement(r.a.Fragment,null,v&&r.a.createElement(d.a,{className:"pb_icon_kit_container",tag:"span"},r.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt",size:"sm"})),y&&r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,{tag:"div"},N),r.a.createElement(d.a,{color:"light",tag:"div",text:" • "})),r.a.createElement(d.a,{tag:"span"},q," ",E,W!=j&&r.a.createElement(r.a.Fragment,null,", ".concat(j)))))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(58),u={home:"H#",project:"P#",appointment:"A#",default:"#"};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.dark,d=void 0!==i&&i,p=e.data,m=void 0===p?{}:p,b=e.id,h=e.newWindow,f=e.rel,g=e.text,_=e.type,y=void 0===_?"default":_,M=e.url,v=Object(s.a)(n),z=Object(s.c)(m),O=o()(Object(s.b)("pb_hashtag_kit"),Object(l.c)(e),a);return r.a.createElement("span",Object.assign({},v,z,{className:O,id:b}),r.a.createElement("a",{href:M,rel:h?"noreferrer":f,target:h?"_blank":"_self"},r.a.createElement(c.a,{dark:d,text:u[y]+g,variant:"primary"})))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(15),d=function(e){var t=e.active,n=e.dark,a=e.steps;return r.a.createElement("div",{className:"pb_progress_pill".concat(a<=t?"_active":"_inactive").concat(n?" dark":""),key:a})};t.a=function(e){var t=e.active,n=void 0===t?0:t,a=e.aria,i=void 0===a?{hidden:"true"}:a,p=e.className,m=e.data,b=void 0===m?{}:m,h=e.id,f=e.steps,g=void 0===f?3:f,_=e.title,y=e.value,M=e.dark,v=void 0!==M&&M,z=Object(s.a)(i),O=Object(s.c)(b),k=o()(Object(s.b)("pb_progress_pills_kit"),Object(l.c)(e),p);return r.a.createElement("div",Object.assign({},z,O,{className:k,id:h}),_&&r.a.createElement("div",{className:"progress_pills_status"},r.a.createElement(u.a,{dark:v,size:4,tag:"h4",text:_}),r.a.createElement(c.a,{color:"light",dark:v,text:y})),r.a.createElement("div",{className:"progress_pills"},function(e,t,n){for(var a=[],r=1;r<=e;r++)a.push(d({steps:r,active:t,dark:n}));return a}(g,n,v)))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return B}));var a=n(0),r=n.n(a),i=n(22),o=n(11),s=n(13),l=n(17),c=n(15),u=function(e){return Object(i.isEmpty)(e)&&!0!==e},d=function(e){var t=e.dark,n=e.filters,a=Object(i.omitBy)(n,u);return r.a.createElement("div",{className:"maskContainer"},Object(i.isEmpty)(n)&&r.a.createElement("div",{className:"filters"},r.a.createElement(s.a,{color:"light",paddingLeft:"xs",size:4,tag:"span",text:"No Filter Selected"})),!Object(i.isEmpty)(n)&&r.a.createElement("div",{className:"filters"},r.a.createElement("div",{className:"left_gradient"}),Object(i.map)(a,(function(e,n){return r.a.createElement("div",{className:"filter",key:"filter-".concat(n)},!0===e?r.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:n}):r.a.createElement("div",null,r.a.createElement(l.a,{dark:t,text:n}),r.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:e})))})),r.a.createElement("div",{className:"right_gradient"})))},p=n(3),m=n.n(p),b=n(5),h=n(18),f=function(e){var t=e.background,n=void 0===t||t,a=e.className,i=e.children,o=e.dark;return r.a.createElement("div",{className:m()("pb_filter_kit ".concat(a),Object(b.c)(e))},n?r.a.createElement(h.a,{dark:o,padding:"none"},i):r.a.createElement(r.a.Fragment,null,i))},g=n(48),_=n(77);function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var v=function(e){var t=e.children,n=e.dark,i=e.minWidth,o=e.placement,s=void 0===o?"bottom-start":o,l=y(Object(a.useState)(!0),2),c=l[0],u=l[1],d=r.a.createElement(g.a,{dark:n,icon:"filter",id:"filter",onClick:function(){return u(!c)},variant:"secondary"});return r.a.createElement(_.a,{closeOnClick:"outside",minWidth:i,placement:s,reference:d,shouldClosePopover:u,show:!c},r.a.createElement("div",{className:"pb-form"},"function"==typeof t?t({closePopover:function(){return u(!0)}}):t))},z=n(117),O=function(e){return 1==e?"Result":"Results"},k=function(e){var t=e.dark,n=e.results,a=e.title;return r.a.createElement(r.a.Fragment,null,n&&a?r.a.createElement(r.a.Fragment,null,r.a.createElement(z.a,{align:"center",count:n,dark:t,title:"".concat(O(n),":")})):n?r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{className:"filter-results",dark:t,size:"xs",text:"".concat(n," ").concat(O(n))})):r.a.createElement("div",null))},A=n(25),x=n(8),w=n(81),N=n(47);function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var j=function(e){return"asc"==e?"sort-amount-up":"sort-amount-down"},W=function(e,t,n){return Object(i.map)(e,(function(e,a){var o=function(e,t){var n=Object(i.find)(e,{name:t});return{name:t,dir:n&&"asc"==n.dir?"desc":"asc"}}(t,a);return r.a.createElement(N.a,{key:"option-".concat(o.name,"-").concat(o.dir)},r.a.createElement(A.a,{htmlType:void 0,onClick:Object(i.partial)(n,o),text:" ".concat(e),variant:"link"}))}))},L=function(e){var t=e.dark,n=e.options,o=e.value,s=e.onChange,l=q(Object(a.useState)(!0),2),c=l[0],u=l[1],d=r.a.createElement(A.a,{dark:t,htmlType:void 0,id:"sort-button",onClick:function(){return u(!c)},paddingRight:"none",variant:"link"},Object(i.map)(o,(function(e){var a=e.dir,i=e.name;return r.a.createElement("span",{key:"current-sort-".concat(i,"-").concat(a)}," ".concat(n[i]),r.a.createElement(x.a,{dark:t,icon:j(a)}))})));return r.a.createElement(_.a,{className:"pb_filter_sort_menu",closeOnClick:"outside",padding:"none",placement:"bottom",reference:d,shouldClosePopover:u,show:!c},r.a.createElement(w.a,null,W(n,o,(function(e){u(!0),s([e])}))))},S=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n},T=function(e){var t=e.onSortChange,n=e.sortOptions,a=e.sortValue,s=e.filters,l=e.results,c=e.children,u=e.dark,p=e.minWidth,m=e.placement,b=S(e,["onSortChange","sortOptions","sortValue","filters","results","children","dark","minWidth","placement"]);return r.a.createElement(f,Object.assign({dark:u},b),r.a.createElement(o.a,{orientation:"row",paddingRight:"lg",vertical:"center"},c&&r.a.createElement(r.a.Fragment,null,r.a.createElement(v,{dark:u,minWidth:p,placement:m},c),r.a.createElement(d,{dark:u,filters:s})),r.a.createElement(k,{dark:u,results:l}),!Object(i.isEmpty)(n)&&r.a.createElement(L,{dark:u,onChange:t,options:n,value:a})))},C=n(55),R=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n},D=function(e){var t=e.onSortChange,n=e.sortOptions,a=e.sortValue,i=e.filters,s=e.results,c=e.children,u=e.dark,p=e.minWidth,m=e.placement,b=R(e,["onSortChange","sortOptions","sortValue","filters","results","children","dark","minWidth","placement"]);return r.a.createElement(f,Object.assign({dark:u},b),r.a.createElement(o.a,{orientation:"row",vertical:"center"},r.a.createElement(v,{dark:u,minWidth:p,placement:m},c),r.a.createElement(d,{dark:u,filters:i})),r.a.createElement(C.a,{dark:u}),r.a.createElement(o.a,{className:"filter-bottom",orientation:"row",spacing:"between",vertical:"center"},r.a.createElement(k,{dark:u,results:s,title:!0}),r.a.createElement(o.a,{orientation:"row",vertical:"center"},r.a.createElement(l.a,{dark:u,text:"sort by:"}),r.a.createElement(L,{dark:u,onChange:t,options:n,value:a}))))},P=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n},B=function(e){var t=e.double,n=void 0!==t&&t,a=P(e,["double"]);return r.a.createElement(r.a.Fragment,null,!0===n?r.a.createElement(D,Object.assign({},a)):r.a.createElement(T,Object.assign({},a)))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(13),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,a=e.aria,i=void 0===a?{}:a,d=e.className,p=e.data,m=void 0===p?{}:p,b=e.id,h=Object(s.a)(i),f=Object(s.c)(m),g=o()(Object(s.b)("pb_loading_inline_kit_".concat(n)),Object(l.c)(e),d);return r.a.createElement("div",Object.assign({},h,f,{className:g,id:b}),r.a.createElement(c.a,{color:"light"},r.a.createElement(u.a,{aria:{label:"loading icon"},fixedWidth:!0,icon:"spinner",pulse:!0})," Loading"))}},function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(33),u=n(58);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,a=e.className,i=e.dark,d=void 0!==i&&i,p=e.data,m=void 0===p?{}:p,b=e.id,h=e.users,f=h.length>2,g=1==h.length,_=Object(l.a)(n),y=Object(l.c)(m),M=o()(Object(l.b)("pb_multiple_users_stacked_kit",{single:g}),Object(s.c)(e),a);return r.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),h.slice(0,1).map((function(e,t){return r.a.createElement(c.a,Object.assign({},e,{className:"pb_multiple_users_stacked_item",dark:d,key:t,size:"xs"}))})),function(){if(!1===f)return h.slice(1,2).map((function(e,t){return r.a.createElement(c.a,Object.assign({},e,{className:"pb_multiple_users_stacked_item second_item",dark:d,key:t,size:"xs"}))}))}(),function(){if(!0===f)return r.a.createElement(u.a,{className:"pb_multiple_users_stacked_item second_item",dark:d,rounded:!0,text:"+".concat(h.length-(f?1:h.length)),variant:"primary"})}())}},function(e,t,n){"use strict";var a=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],r={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=i,s=function(e,t){return void 0===t&&(t=2),("000"+e).slice(-1*t)},l=function(e){return!0===e?1:0};function c(e,t){var n;return function(){var a=this,r=arguments;clearTimeout(n),n=setTimeout((function(){return e.apply(a,r)}),t)}}var u=function(e){return e instanceof Array?e:[e]};function d(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function p(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function m(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function b(e,t){var n=p("div","numInputWrapper"),a=p("input","numInput "+e),r=p("span","arrowUp"),i=p("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==t)for(var o in t)a.setAttribute(o,t[o]);return n.appendChild(a),n.appendChild(r),n.appendChild(i),n}function h(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(t){return e.target}}var f=function(){},g=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},_={D:f,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*l(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t,n){var a=parseInt(t),r=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return r.setDate(r.getDate()-r.getDay()+n.firstDayOfWeek),r},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:f,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:f,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},y={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},M={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[M.w(e,t,n)]},F:function(e,t,n){return g(M.n(e,t,n)-1,!1,t)},G:function(e,t,n){return s(M.h(e,t,n))},H:function(e){return s(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[l(e.getHours()>11)]},M:function(e,t){return g(e.getMonth(),!0,t)},S:function(e){return s(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return s(e.getFullYear(),4)},d:function(e){return s(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return s(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return s(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},v=function(e){var t=e.config,n=void 0===t?r:t,a=e.l10n,o=void 0===a?i:a,s=e.isMobile,l=void 0!==s&&s;return function(e,t,a){var r=a||o;return void 0===n.formatDate||l?t.split("").map((function(t,a,i){return M[t]&&"\\"!==i[a-1]?M[t](e,r,n):"\\"!==t?t:""})).join(""):n.formatDate(e,t,r)}},z=function(e){var t=e.config,n=void 0===t?r:t,a=e.l10n,o=void 0===a?i:a;return function(e,t,a,i){if(0===e||e){var s,l=i||o,c=e;if(e instanceof Date)s=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)s=new Date(e);else if("string"==typeof e){var u=t||(n||r).dateFormat,d=String(e).trim();if("today"===d)s=new Date,a=!0;else if(n&&n.parseDate)s=n.parseDate(e,u);else if(/Z$/.test(d)||/GMT$/.test(d))s=new Date(e);else{for(var p=void 0,m=[],b=0,h=0,f="";b<u.length;b++){var g=u[b],M="\\"===g,v="\\"===u[b-1]||M;if(y[g]&&!v){f+=y[g];var z=new RegExp(f).exec(e);z&&(p=!0)&&m["Y"!==g?"push":"unshift"]({fn:_[g],val:z[++h]})}else M||(f+=".")}s=n&&n.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),m.forEach((function(e){var t=e.fn,n=e.val;return s=t(s,n,l)||s})),s=p?s:void 0}}if(s instanceof Date&&!isNaN(s.getTime()))return!0===a&&s.setHours(0,0,0,0),s;n.errorHandler(new Error("Invalid date provided: "+c))}}};function O(e,t,n){return void 0===n&&(n=!0),!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}var k=function(e,t,n){return 3600*e+60*t+n},A=864e5;function x(e){var t=e.defaultHour,n=e.defaultMinute,a=e.defaultSeconds;if(void 0!==e.minDate){var r=e.minDate.getHours(),i=e.minDate.getMinutes(),o=e.minDate.getSeconds();t<r&&(t=r),t===r&&n<i&&(n=i),t===r&&n===i&&a<o&&(a=e.minDate.getSeconds())}if(void 0!==e.maxDate){var s=e.maxDate.getHours(),l=e.maxDate.getMinutes();(t=Math.min(t,s))===s&&(n=Math.min(l,n)),t===s&&n===l&&(a=e.maxDate.getSeconds())}return{hours:t,minutes:n,seconds:a}}n(353);var w=function(){return(w=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},N=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var a=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,r++)a[r]=i[o];return a};function q(e,t){var n={config:w(w({},r),j.defaultConfig),l10n:o};function i(){var e;return(null===(e=n.calendarContainer)||void 0===e?void 0:e.getRootNode()).activeElement||document.activeElement}function f(e){return e.bind(n)}function _(){var e=n.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame((function(){if(void 0!==n.calendarContainer&&(n.calendarContainer.style.visibility="hidden",n.calendarContainer.style.display="block"),void 0!==n.daysContainer){var t=(n.days.offsetWidth+1)*e.showMonths;n.daysContainer.style.width=t+"px",n.calendarContainer.style.width=t+(void 0!==n.weekWrapper?n.weekWrapper.offsetWidth:0)+"px",n.calendarContainer.style.removeProperty("visibility"),n.calendarContainer.style.removeProperty("display")}}))}function M(e){if(0===n.selectedDates.length){var t=void 0===n.config.minDate||O(new Date,n.config.minDate)>=0?new Date:new Date(n.config.minDate.getTime()),a=x(n.config);t.setHours(a.hours,a.minutes,a.seconds,t.getMilliseconds()),n.selectedDates=[t],n.latestSelectedDateObj=t}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var t="keydown"===e.type,a=h(e),r=a;void 0!==n.amPM&&a===n.amPM&&(n.amPM.textContent=n.l10n.amPM[l(n.amPM.textContent===n.l10n.amPM[0])]);var i=parseFloat(r.getAttribute("min")),o=parseFloat(r.getAttribute("max")),c=parseFloat(r.getAttribute("step")),u=parseInt(r.value,10),d=e.delta||(t?38===e.which?1:-1:0),p=u+c*d;if(void 0!==r.value&&2===r.value.length){var m=r===n.hourElement,b=r===n.minuteElement;p<i?(p=o+p+l(!m)+(l(m)&&l(!n.amPM)),b&&D(void 0,-1,n.hourElement)):p>o&&(p=r===n.hourElement?p-o-l(!n.amPM):i,b&&D(void 0,1,n.hourElement)),n.amPM&&m&&(1===c?p+u===23:Math.abs(p-u)>c)&&(n.amPM.textContent=n.l10n.amPM[l(n.amPM.textContent===n.l10n.amPM[0])]),r.value=s(p)}}(e);var r=n._input.value;q(),ze(),n._input.value!==r&&n._debouncedChange()}function q(){if(void 0!==n.hourElement&&void 0!==n.minuteElement){var e,t,a=(parseInt(n.hourElement.value.slice(-2),10)||0)%24,r=(parseInt(n.minuteElement.value,10)||0)%60,i=void 0!==n.secondElement?(parseInt(n.secondElement.value,10)||0)%60:0;void 0!==n.amPM&&(e=a,t=n.amPM.textContent,a=e%12+12*l(t===n.l10n.amPM[1]));var o=void 0!==n.config.minTime||n.config.minDate&&n.minDateHasTime&&n.latestSelectedDateObj&&0===O(n.latestSelectedDateObj,n.config.minDate,!0),s=void 0!==n.config.maxTime||n.config.maxDate&&n.maxDateHasTime&&n.latestSelectedDateObj&&0===O(n.latestSelectedDateObj,n.config.maxDate,!0);if(void 0!==n.config.maxTime&&void 0!==n.config.minTime&&n.config.minTime>n.config.maxTime){var c=k(n.config.minTime.getHours(),n.config.minTime.getMinutes(),n.config.minTime.getSeconds()),u=k(n.config.maxTime.getHours(),n.config.maxTime.getMinutes(),n.config.maxTime.getSeconds()),d=k(a,r,i);if(d>u&&d<c){var p=function(e){var t=Math.floor(e/3600),n=(e-3600*t)/60;return[t,n,e-3600*t-60*n]}(c);a=p[0],r=p[1],i=p[2]}}else{if(s){var m=void 0!==n.config.maxTime?n.config.maxTime:n.config.maxDate;(a=Math.min(a,m.getHours()))===m.getHours()&&(r=Math.min(r,m.getMinutes())),r===m.getMinutes()&&(i=Math.min(i,m.getSeconds()))}if(o){var b=void 0!==n.config.minTime?n.config.minTime:n.config.minDate;(a=Math.max(a,b.getHours()))===b.getHours()&&r<b.getMinutes()&&(r=b.getMinutes()),r===b.getMinutes()&&(i=Math.max(i,b.getSeconds()))}}W(a,r,i)}}function E(e){var t=e||n.latestSelectedDateObj;t&&t instanceof Date&&W(t.getHours(),t.getMinutes(),t.getSeconds())}function W(e,t,a){void 0!==n.latestSelectedDateObj&&n.latestSelectedDateObj.setHours(e%24,t,a||0,0),n.hourElement&&n.minuteElement&&!n.isMobile&&(n.hourElement.value=s(n.config.time_24hr?e:(12+e)%12+12*l(e%12==0)),n.minuteElement.value=s(t),void 0!==n.amPM&&(n.amPM.textContent=n.l10n.amPM[l(e>=12)]),void 0!==n.secondElement&&(n.secondElement.value=s(a)))}function L(e){var t=h(e),n=parseInt(t.value)+(e.delta||0);(n/1e3>1||"Enter"===e.key&&!/[^\d]/.test(n.toString()))&&Q(n)}function S(e,t,a,r){return t instanceof Array?t.forEach((function(t){return S(e,t,a,r)})):e instanceof Array?e.forEach((function(e){return S(e,t,a,r)})):(e.addEventListener(t,a,r),void n._handlers.push({remove:function(){return e.removeEventListener(t,a,r)}}))}function T(){ge("onChange")}function C(e,t){var a=void 0!==e?n.parseDate(e):n.latestSelectedDateObj||(n.config.minDate&&n.config.minDate>n.now?n.config.minDate:n.config.maxDate&&n.config.maxDate<n.now?n.config.maxDate:n.now),r=n.currentYear,i=n.currentMonth;try{void 0!==a&&(n.currentYear=a.getFullYear(),n.currentMonth=a.getMonth())}catch(e){e.message="Invalid date supplied: "+a,n.config.errorHandler(e)}t&&n.currentYear!==r&&(ge("onYearChange"),Y()),!t||n.currentYear===r&&n.currentMonth===i||ge("onMonthChange"),n.redraw()}function R(e){var t=h(e);~t.className.indexOf("arrow")&&D(e,t.classList.contains("arrowUp")?1:-1)}function D(e,t,n){var a=e&&h(e),r=n||a&&a.parentNode&&a.parentNode.firstChild,i=_e("increment");i.delta=t,r&&r.dispatchEvent(i)}function P(e,t,a,r){var i=ee(t,!0),o=p("span",e,t.getDate().toString());return o.dateObj=t,o.$i=r,o.setAttribute("aria-label",n.formatDate(t,n.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===O(t,n.now)&&(n.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,ye(t)&&(o.classList.add("selected"),n.selectedDateElem=o,"range"===n.config.mode&&(d(o,"startRange",n.selectedDates[0]&&0===O(t,n.selectedDates[0],!0)),d(o,"endRange",n.selectedDates[1]&&0===O(t,n.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===n.config.mode&&function(e){return!("range"!==n.config.mode||n.selectedDates.length<2)&&(O(e,n.selectedDates[0])>=0&&O(e,n.selectedDates[1])<=0)}(t)&&!ye(t)&&o.classList.add("inRange"),n.weekNumbers&&1===n.config.showMonths&&"prevMonthDay"!==e&&r%7==6&&n.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+n.config.getWeek(t)+"</span>"),ge("onDayCreate",o),o}function B(e){e.focus(),"range"===n.config.mode&&re(e)}function I(e){for(var t=e>0?0:n.config.showMonths-1,a=e>0?n.config.showMonths:-1,r=t;r!=a;r+=e)for(var i=n.daysContainer.children[r],o=e>0?0:i.children.length-1,s=e>0?i.children.length:-1,l=o;l!=s;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&ee(c.dateObj))return c}}function $(e,t){var a=i(),r=te(a||document.body),o=void 0!==e?e:r?a:void 0!==n.selectedDateElem&&te(n.selectedDateElem)?n.selectedDateElem:void 0!==n.todayDateElem&&te(n.todayDateElem)?n.todayDateElem:I(t>0?1:-1);void 0===o?n._input.focus():r?function(e,t){for(var a=-1===e.className.indexOf("Month")?e.dateObj.getMonth():n.currentMonth,r=t>0?n.config.showMonths:-1,i=t>0?1:-1,o=a-n.currentMonth;o!=r;o+=i)for(var s=n.daysContainer.children[o],l=a-n.currentMonth===o?e.$i+t:t<0?s.children.length-1:0,c=s.children.length,u=l;u>=0&&u<c&&u!=(t>0?c:-1);u+=i){var d=s.children[u];if(-1===d.className.indexOf("hidden")&&ee(d.dateObj)&&Math.abs(e.$i-u)>=Math.abs(t))return B(d)}n.changeMonth(i),$(I(i),0)}(o,t):B(o)}function F(e,t){for(var a=(new Date(e,t,1).getDay()-n.l10n.firstDayOfWeek+7)%7,r=n.utils.getDaysInMonth((t-1+12)%12,e),i=n.utils.getDaysInMonth(t,e),o=window.document.createDocumentFragment(),s=n.config.showMonths>1,l=s?"prevMonthDay hidden":"prevMonthDay",c=s?"nextMonthDay hidden":"nextMonthDay",u=r+1-a,d=0;u<=r;u++,d++)o.appendChild(P("flatpickr-day "+l,new Date(e,t-1,u),0,d));for(u=1;u<=i;u++,d++)o.appendChild(P("flatpickr-day",new Date(e,t,u),0,d));for(var m=i+1;m<=42-a&&(1===n.config.showMonths||d%7!=0);m++,d++)o.appendChild(P("flatpickr-day "+c,new Date(e,t+1,m%i),0,d));var b=p("div","dayContainer");return b.appendChild(o),b}function X(){if(void 0!==n.daysContainer){m(n.daysContainer),n.weekNumbers&&m(n.weekNumbers);for(var e=document.createDocumentFragment(),t=0;t<n.config.showMonths;t++){var a=new Date(n.currentYear,n.currentMonth,1);a.setMonth(n.currentMonth+t),e.appendChild(F(a.getFullYear(),a.getMonth()))}n.daysContainer.appendChild(e),n.days=n.daysContainer.firstChild,"range"===n.config.mode&&1===n.selectedDates.length&&re()}}function Y(){if(!(n.config.showMonths>1||"dropdown"!==n.config.monthSelectorType)){var e=function(e){return!(void 0!==n.config.minDate&&n.currentYear===n.config.minDate.getFullYear()&&e<n.config.minDate.getMonth())&&!(void 0!==n.config.maxDate&&n.currentYear===n.config.maxDate.getFullYear()&&e>n.config.maxDate.getMonth())};n.monthsDropdownContainer.tabIndex=-1,n.monthsDropdownContainer.innerHTML="";for(var t=0;t<12;t++)if(e(t)){var a=p("option","flatpickr-monthDropdown-month");a.value=new Date(n.currentYear,t).getMonth().toString(),a.textContent=g(t,n.config.shorthandCurrentMonth,n.l10n),a.tabIndex=-1,n.currentMonth===t&&(a.selected=!0),n.monthsDropdownContainer.appendChild(a)}}}function H(){var e,t=p("div","flatpickr-month"),a=window.document.createDocumentFragment();n.config.showMonths>1||"static"===n.config.monthSelectorType?e=p("span","cur-month"):(n.monthsDropdownContainer=p("select","flatpickr-monthDropdown-months"),n.monthsDropdownContainer.setAttribute("aria-label",n.l10n.monthAriaLabel),S(n.monthsDropdownContainer,"change",(function(e){var t=h(e),a=parseInt(t.value,10);n.changeMonth(a-n.currentMonth),ge("onMonthChange")})),Y(),e=n.monthsDropdownContainer);var r=b("cur-year",{tabindex:"-1"}),i=r.getElementsByTagName("input")[0];i.setAttribute("aria-label",n.l10n.yearAriaLabel),n.config.minDate&&i.setAttribute("min",n.config.minDate.getFullYear().toString()),n.config.maxDate&&(i.setAttribute("max",n.config.maxDate.getFullYear().toString()),i.disabled=!!n.config.minDate&&n.config.minDate.getFullYear()===n.config.maxDate.getFullYear());var o=p("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(r),a.appendChild(o),t.appendChild(a),{container:t,yearElement:i,monthElement:e}}function U(){m(n.monthNav),n.monthNav.appendChild(n.prevMonthNav),n.config.showMonths&&(n.yearElements=[],n.monthElements=[]);for(var e=n.config.showMonths;e--;){var t=H();n.yearElements.push(t.yearElement),n.monthElements.push(t.monthElement),n.monthNav.appendChild(t.container)}n.monthNav.appendChild(n.nextMonthNav)}function V(){n.weekdayContainer?m(n.weekdayContainer):n.weekdayContainer=p("div","flatpickr-weekdays");for(var e=n.config.showMonths;e--;){var t=p("div","flatpickr-weekdaycontainer");n.weekdayContainer.appendChild(t)}return G(),n.weekdayContainer}function G(){if(n.weekdayContainer){var e=n.l10n.firstDayOfWeek,t=N(n.l10n.weekdays.shorthand);e>0&&e<t.length&&(t=N(t.splice(e,t.length),t.splice(0,e)));for(var a=n.config.showMonths;a--;)n.weekdayContainer.children[a].innerHTML="\n <span class='flatpickr-weekday'>\n "+t.join("</span><span class='flatpickr-weekday'>")+"\n </span>\n "}}function K(e,t){void 0===t&&(t=!0);var a=t?e:e-n.currentMonth;a<0&&!0===n._hidePrevMonthArrow||a>0&&!0===n._hideNextMonthArrow||(n.currentMonth+=a,(n.currentMonth<0||n.currentMonth>11)&&(n.currentYear+=n.currentMonth>11?1:-1,n.currentMonth=(n.currentMonth+12)%12,ge("onYearChange"),Y()),X(),ge("onMonthChange"),Me())}function J(e){return n.calendarContainer.contains(e)}function Z(e){if(n.isOpen&&!n.config.inline){var t=h(e),a=J(t),r=!(t===n.input||t===n.altInput||n.element.contains(t)||e.path&&e.path.indexOf&&(~e.path.indexOf(n.input)||~e.path.indexOf(n.altInput)))&&!a&&!J(e.relatedTarget),i=!n.config.ignoredFocusElements.some((function(e){return e.contains(t)}));r&&i&&(n.config.allowInput&&n.setDate(n._input.value,!1,n.config.altInput?n.config.altFormat:n.config.dateFormat),void 0!==n.timeContainer&&void 0!==n.minuteElement&&void 0!==n.hourElement&&""!==n.input.value&&void 0!==n.input.value&&M(),n.close(),n.config&&"range"===n.config.mode&&1===n.selectedDates.length&&n.clear(!1))}}function Q(e){if(!(!e||n.config.minDate&&e<n.config.minDate.getFullYear()||n.config.maxDate&&e>n.config.maxDate.getFullYear())){var t=e,a=n.currentYear!==t;n.currentYear=t||n.currentYear,n.config.maxDate&&n.currentYear===n.config.maxDate.getFullYear()?n.currentMonth=Math.min(n.config.maxDate.getMonth(),n.currentMonth):n.config.minDate&&n.currentYear===n.config.minDate.getFullYear()&&(n.currentMonth=Math.max(n.config.minDate.getMonth(),n.currentMonth)),a&&(n.redraw(),ge("onYearChange"),Y())}}function ee(e,t){var a;void 0===t&&(t=!0);var r=n.parseDate(e,void 0,t);if(n.config.minDate&&r&&O(r,n.config.minDate,void 0!==t?t:!n.minDateHasTime)<0||n.config.maxDate&&r&&O(r,n.config.maxDate,void 0!==t?t:!n.maxDateHasTime)>0)return!1;if(!n.config.enable&&0===n.config.disable.length)return!0;if(void 0===r)return!1;for(var i=!!n.config.enable,o=null!==(a=n.config.enable)&&void 0!==a?a:n.config.disable,s=0,l=void 0;s<o.length;s++){if("function"==typeof(l=o[s])&&l(r))return i;if(l instanceof Date&&void 0!==r&&l.getTime()===r.getTime())return i;if("string"==typeof l){var c=n.parseDate(l,void 0,!0);return c&&c.getTime()===r.getTime()?i:!i}if("object"==typeof l&&void 0!==r&&l.from&&l.to&&r.getTime()>=l.from.getTime()&&r.getTime()<=l.to.getTime())return i}return!i}function te(e){return void 0!==n.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&n.daysContainer.contains(e))}function ne(e){var t=e.target===n._input,a=n._input.value.trimEnd()!==ve();!t||!a||e.relatedTarget&&J(e.relatedTarget)||n.setDate(n._input.value,!0,e.target===n.altInput?n.config.altFormat:n.config.dateFormat)}function ae(t){var a=h(t),r=n.config.wrap?e.contains(a):a===n._input,o=n.config.allowInput,s=n.isOpen&&(!o||!r),l=n.config.inline&&r&&!o;if(13===t.keyCode&&r){if(o)return n.setDate(n._input.value,!0,a===n.altInput?n.config.altFormat:n.config.dateFormat),n.close(),a.blur();n.open()}else if(J(a)||s||l){var c=!!n.timeContainer&&n.timeContainer.contains(a);switch(t.keyCode){case 13:c?(t.preventDefault(),M(),de()):pe(t);break;case 27:t.preventDefault(),de();break;case 8:case 46:r&&!n.config.allowInput&&(t.preventDefault(),n.clear());break;case 37:case 39:if(c||r)n.hourElement&&n.hourElement.focus();else{t.preventDefault();var u=i();if(void 0!==n.daysContainer&&(!1===o||u&&te(u))){var d=39===t.keyCode?1:-1;t.ctrlKey?(t.stopPropagation(),K(d),$(I(1),0)):$(void 0,d)}}break;case 38:case 40:t.preventDefault();var p=40===t.keyCode?1:-1;n.daysContainer&&void 0!==a.$i||a===n.input||a===n.altInput?t.ctrlKey?(t.stopPropagation(),Q(n.currentYear-p),$(I(1),0)):c||$(void 0,7*p):a===n.currentYearElement?Q(n.currentYear-p):n.config.enableTime&&(!c&&n.hourElement&&n.hourElement.focus(),M(t),n._debouncedChange());break;case 9:if(c){var m=[n.hourElement,n.minuteElement,n.secondElement,n.amPM].concat(n.pluginElements).filter((function(e){return e})),b=m.indexOf(a);if(-1!==b){var f=m[b+(t.shiftKey?-1:1)];t.preventDefault(),(f||n._input).focus()}}else!n.config.noCalendar&&n.daysContainer&&n.daysContainer.contains(a)&&t.shiftKey&&(t.preventDefault(),n._input.focus())}}if(void 0!==n.amPM&&a===n.amPM)switch(t.key){case n.l10n.amPM[0].charAt(0):case n.l10n.amPM[0].charAt(0).toLowerCase():n.amPM.textContent=n.l10n.amPM[0],q(),ze();break;case n.l10n.amPM[1].charAt(0):case n.l10n.amPM[1].charAt(0).toLowerCase():n.amPM.textContent=n.l10n.amPM[1],q(),ze()}(r||J(a))&&ge("onKeyDown",t)}function re(e,t){if(void 0===t&&(t="flatpickr-day"),1===n.selectedDates.length&&(!e||e.classList.contains(t)&&!e.classList.contains("flatpickr-disabled"))){for(var a=e?e.dateObj.getTime():n.days.firstElementChild.dateObj.getTime(),r=n.parseDate(n.selectedDates[0],void 0,!0).getTime(),i=Math.min(a,n.selectedDates[0].getTime()),o=Math.max(a,n.selectedDates[0].getTime()),s=!1,l=0,c=0,u=i;u<o;u+=A)ee(new Date(u),!0)||(s=s||u>i&&u<o,u<r&&(!l||u>l)?l=u:u>r&&(!c||u<c)&&(c=u));Array.from(n.rContainer.querySelectorAll("*:nth-child(-n+"+n.config.showMonths+") > ."+t)).forEach((function(t){var i,o,u,d=t.dateObj.getTime(),p=l>0&&d<l||c>0&&d>c;if(p)return t.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(e){t.classList.remove(e)}));s&&!p||(["startRange","inRange","endRange","notAllowed"].forEach((function(e){t.classList.remove(e)})),void 0!==e&&(e.classList.add(a<=n.selectedDates[0].getTime()?"startRange":"endRange"),r<a&&d===r?t.classList.add("startRange"):r>a&&d===r&&t.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=r,u=a,(i=d)>Math.min(o,u)&&i<Math.max(o,u))&&t.classList.add("inRange")))}))}}function ie(){!n.isOpen||n.config.static||n.config.inline||ce()}function oe(e){return function(t){var a=n.config["_"+e+"Date"]=n.parseDate(t,n.config.dateFormat),r=n.config["_"+("min"===e?"max":"min")+"Date"];void 0!==a&&(n["min"===e?"minDateHasTime":"maxDateHasTime"]=a.getHours()>0||a.getMinutes()>0||a.getSeconds()>0),n.selectedDates&&(n.selectedDates=n.selectedDates.filter((function(e){return ee(e)})),n.selectedDates.length||"min"!==e||E(a),ze()),n.daysContainer&&(ue(),void 0!==a?n.currentYearElement[e]=a.getFullYear().toString():n.currentYearElement.removeAttribute(e),n.currentYearElement.disabled=!!r&&void 0!==a&&r.getFullYear()===a.getFullYear())}}function se(){return n.config.wrap?e.querySelector("[data-input]"):e}function le(){"object"!=typeof n.config.locale&&void 0===j.l10ns[n.config.locale]&&n.config.errorHandler(new Error("flatpickr: invalid locale "+n.config.locale)),n.l10n=w(w({},j.l10ns.default),"object"==typeof n.config.locale?n.config.locale:"default"!==n.config.locale?j.l10ns[n.config.locale]:void 0),y.D="("+n.l10n.weekdays.shorthand.join("|")+")",y.l="("+n.l10n.weekdays.longhand.join("|")+")",y.M="("+n.l10n.months.shorthand.join("|")+")",y.F="("+n.l10n.months.longhand.join("|")+")",y.K="("+n.l10n.amPM[0]+"|"+n.l10n.amPM[1]+"|"+n.l10n.amPM[0].toLowerCase()+"|"+n.l10n.amPM[1].toLowerCase()+")",void 0===w(w({},t),JSON.parse(JSON.stringify(e.dataset||{}))).time_24hr&&void 0===j.defaultConfig.time_24hr&&(n.config.time_24hr=n.l10n.time_24hr),n.formatDate=v(n),n.parseDate=z({config:n.config,l10n:n.l10n})}function ce(e){if("function"!=typeof n.config.position){if(void 0!==n.calendarContainer){ge("onPreCalendarPosition");var t=e||n._positionElement,a=Array.prototype.reduce.call(n.calendarContainer.children,(function(e,t){return e+t.offsetHeight}),0),r=n.calendarContainer.offsetWidth,i=n.config.position.split(" "),o=i[0],s=i.length>1?i[1]:null,l=t.getBoundingClientRect(),c=window.innerHeight-l.bottom,u="above"===o||"below"!==o&&c<a&&l.top>a,p=window.pageYOffset+l.top+(u?-a-2:t.offsetHeight+2);if(d(n.calendarContainer,"arrowTop",!u),d(n.calendarContainer,"arrowBottom",u),!n.config.inline){var m=window.pageXOffset+l.left,b=!1,h=!1;"center"===s?(m-=(r-l.width)/2,b=!0):"right"===s&&(m-=r-l.width,h=!0),d(n.calendarContainer,"arrowLeft",!b&&!h),d(n.calendarContainer,"arrowCenter",b),d(n.calendarContainer,"arrowRight",h);var f=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=m+r>window.document.body.offsetWidth,_=f+r>window.document.body.offsetWidth;if(d(n.calendarContainer,"rightMost",g),!n.config.static)if(n.calendarContainer.style.top=p+"px",g)if(_){var y=function(){for(var e=null,t=0;t<document.styleSheets.length;t++){var n=document.styleSheets[t];if(n.cssRules){try{n.cssRules}catch(e){continue}e=n;break}}return null!=e?e:(a=document.createElement("style"),document.head.appendChild(a),a.sheet);var a}();if(void 0===y)return;var M=window.document.body.offsetWidth,v=Math.max(0,M/2-r/2),z=y.cssRules.length,O="{left:"+l.left+"px;right:auto;}";d(n.calendarContainer,"rightMost",!1),d(n.calendarContainer,"centerMost",!0),y.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+O,z),n.calendarContainer.style.left=v+"px",n.calendarContainer.style.right="auto"}else n.calendarContainer.style.left="auto",n.calendarContainer.style.right=f+"px";else n.calendarContainer.style.left=m+"px",n.calendarContainer.style.right="auto"}}}else n.config.position(n,e)}function ue(){n.config.noCalendar||n.isMobile||(Y(),Me(),X())}function de(){n._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(n.close,0):n.close()}function pe(e){e.preventDefault(),e.stopPropagation();var t=function e(t,n){return n(t)?t:t.parentNode?e(t.parentNode,n):void 0}(h(e),(function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")}));if(void 0!==t){var a=t,r=n.latestSelectedDateObj=new Date(a.dateObj.getTime()),i=(r.getMonth()<n.currentMonth||r.getMonth()>n.currentMonth+n.config.showMonths-1)&&"range"!==n.config.mode;if(n.selectedDateElem=a,"single"===n.config.mode)n.selectedDates=[r];else if("multiple"===n.config.mode){var o=ye(r);o?n.selectedDates.splice(parseInt(o),1):n.selectedDates.push(r)}else"range"===n.config.mode&&(2===n.selectedDates.length&&n.clear(!1,!1),n.latestSelectedDateObj=r,n.selectedDates.push(r),0!==O(r,n.selectedDates[0],!0)&&n.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()})));if(q(),i){var s=n.currentYear!==r.getFullYear();n.currentYear=r.getFullYear(),n.currentMonth=r.getMonth(),s&&(ge("onYearChange"),Y()),ge("onMonthChange")}if(Me(),X(),ze(),i||"range"===n.config.mode||1!==n.config.showMonths?void 0!==n.selectedDateElem&&void 0===n.hourElement&&n.selectedDateElem&&n.selectedDateElem.focus():B(a),void 0!==n.hourElement&&void 0!==n.hourElement&&n.hourElement.focus(),n.config.closeOnSelect){var l="single"===n.config.mode&&!n.config.enableTime,c="range"===n.config.mode&&2===n.selectedDates.length&&!n.config.enableTime;(l||c)&&de()}T()}}n.parseDate=z({config:n.config,l10n:n.l10n}),n._handlers=[],n.pluginElements=[],n.loadedPlugins=[],n._bind=S,n._setHoursFromDate=E,n._positionCalendar=ce,n.changeMonth=K,n.changeYear=Q,n.clear=function(e,t){void 0===e&&(e=!0);void 0===t&&(t=!0);n.input.value="",void 0!==n.altInput&&(n.altInput.value="");void 0!==n.mobileInput&&(n.mobileInput.value="");n.selectedDates=[],n.latestSelectedDateObj=void 0,!0===t&&(n.currentYear=n._initialDate.getFullYear(),n.currentMonth=n._initialDate.getMonth());if(!0===n.config.enableTime){var a=x(n.config),r=a.hours,i=a.minutes,o=a.seconds;W(r,i,o)}n.redraw(),e&&ge("onChange")},n.close=function(){n.isOpen=!1,n.isMobile||(void 0!==n.calendarContainer&&n.calendarContainer.classList.remove("open"),void 0!==n._input&&n._input.classList.remove("active"));ge("onClose")},n.onMouseOver=re,n._createElement=p,n.createDay=P,n.destroy=function(){void 0!==n.config&&ge("onDestroy");for(var e=n._handlers.length;e--;)n._handlers[e].remove();if(n._handlers=[],n.mobileInput)n.mobileInput.parentNode&&n.mobileInput.parentNode.removeChild(n.mobileInput),n.mobileInput=void 0;else if(n.calendarContainer&&n.calendarContainer.parentNode)if(n.config.static&&n.calendarContainer.parentNode){var t=n.calendarContainer.parentNode;if(t.lastChild&&t.removeChild(t.lastChild),t.parentNode){for(;t.firstChild;)t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t)}}else n.calendarContainer.parentNode.removeChild(n.calendarContainer);n.altInput&&(n.input.type="text",n.altInput.parentNode&&n.altInput.parentNode.removeChild(n.altInput),delete n.altInput);n.input&&(n.input.type=n.input._type,n.input.classList.remove("flatpickr-input"),n.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete n[e]}catch(e){}}))},n.isEnabled=ee,n.jumpToDate=C,n.updateValue=ze,n.open=function(e,t){void 0===t&&(t=n._positionElement);if(!0===n.isMobile){if(e){e.preventDefault();var a=h(e);a&&a.blur()}return void 0!==n.mobileInput&&(n.mobileInput.focus(),n.mobileInput.click()),void ge("onOpen")}if(n._input.disabled||n.config.inline)return;var r=n.isOpen;n.isOpen=!0,r||(n.calendarContainer.classList.add("open"),n._input.classList.add("active"),ge("onOpen"),ce(t));!0===n.config.enableTime&&!0===n.config.noCalendar&&(!1!==n.config.allowInput||void 0!==e&&n.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return n.hourElement.select()}),50))},n.redraw=ue,n.set=function(e,t){if(null!==e&&"object"==typeof e)for(var r in Object.assign(n.config,e),e)void 0!==me[r]&&me[r].forEach((function(e){return e()}));else n.config[e]=t,void 0!==me[e]?me[e].forEach((function(e){return e()})):a.indexOf(e)>-1&&(n.config[e]=u(t));n.redraw(),ze(!0)},n.setDate=function(e,t,a){void 0===t&&(t=!1);void 0===a&&(a=n.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return n.clear(t);be(e,a),n.latestSelectedDateObj=n.selectedDates[n.selectedDates.length-1],n.redraw(),C(void 0,t),E(),0===n.selectedDates.length&&n.clear(!1);ze(t),t&&ge("onChange")},n.toggle=function(e){if(!0===n.isOpen)return n.close();n.open(e)};var me={locale:[le,G],showMonths:[U,_,V],minDate:[C],maxDate:[C],positionElement:[fe],clickOpens:[function(){!0===n.config.clickOpens?(S(n._input,"focus",n.open),S(n._input,"click",n.open)):(n._input.removeEventListener("focus",n.open),n._input.removeEventListener("click",n.open))}]};function be(e,t){var a=[];if(e instanceof Array)a=e.map((function(e){return n.parseDate(e,t)}));else if(e instanceof Date||"number"==typeof e)a=[n.parseDate(e,t)];else if("string"==typeof e)switch(n.config.mode){case"single":case"time":a=[n.parseDate(e,t)];break;case"multiple":a=e.split(n.config.conjunction).map((function(e){return n.parseDate(e,t)}));break;case"range":a=e.split(n.l10n.rangeSeparator).map((function(e){return n.parseDate(e,t)}))}else n.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));n.selectedDates=n.config.allowInvalidPreload?a:a.filter((function(e){return e instanceof Date&&ee(e,!1)})),"range"===n.config.mode&&n.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()}))}function he(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?n.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:n.parseDate(e.from,void 0),to:n.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function fe(){n._positionElement=n.config.positionElement||n._input}function ge(e,t){if(void 0!==n.config){var a=n.config[e];if(void 0!==a&&a.length>0)for(var r=0;a[r]&&r<a.length;r++)a[r](n.selectedDates,n.input.value,n,t);"onChange"===e&&(n.input.dispatchEvent(_e("change")),n.input.dispatchEvent(_e("input")))}}function _e(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}function ye(e){for(var t=0;t<n.selectedDates.length;t++){var a=n.selectedDates[t];if(a instanceof Date&&0===O(a,e))return""+t}return!1}function Me(){n.config.noCalendar||n.isMobile||!n.monthNav||(n.yearElements.forEach((function(e,t){var a=new Date(n.currentYear,n.currentMonth,1);a.setMonth(n.currentMonth+t),n.config.showMonths>1||"static"===n.config.monthSelectorType?n.monthElements[t].textContent=g(a.getMonth(),n.config.shorthandCurrentMonth,n.l10n)+" ":n.monthsDropdownContainer.value=a.getMonth().toString(),e.value=a.getFullYear().toString()})),n._hidePrevMonthArrow=void 0!==n.config.minDate&&(n.currentYear===n.config.minDate.getFullYear()?n.currentMonth<=n.config.minDate.getMonth():n.currentYear<n.config.minDate.getFullYear()),n._hideNextMonthArrow=void 0!==n.config.maxDate&&(n.currentYear===n.config.maxDate.getFullYear()?n.currentMonth+1>n.config.maxDate.getMonth():n.currentYear>n.config.maxDate.getFullYear()))}function ve(e){var t=e||(n.config.altInput?n.config.altFormat:n.config.dateFormat);return n.selectedDates.map((function(e){return n.formatDate(e,t)})).filter((function(e,t,a){return"range"!==n.config.mode||n.config.enableTime||a.indexOf(e)===t})).join("range"!==n.config.mode?n.config.conjunction:n.l10n.rangeSeparator)}function ze(e){void 0===e&&(e=!0),void 0!==n.mobileInput&&n.mobileFormatStr&&(n.mobileInput.value=void 0!==n.latestSelectedDateObj?n.formatDate(n.latestSelectedDateObj,n.mobileFormatStr):""),n.input.value=ve(n.config.dateFormat),void 0!==n.altInput&&(n.altInput.value=ve(n.config.altFormat)),!1!==e&&ge("onValueUpdate")}function Oe(e){var t=h(e),a=n.prevMonthNav.contains(t),r=n.nextMonthNav.contains(t);a||r?K(a?-1:1):n.yearElements.indexOf(t)>=0?t.select():t.classList.contains("arrowUp")?n.changeYear(n.currentYear+1):t.classList.contains("arrowDown")&&n.changeYear(n.currentYear-1)}return function(){n.element=n.input=e,n.isOpen=!1,function(){var i=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],o=w(w({},JSON.parse(JSON.stringify(e.dataset||{}))),t),s={};n.config.parseDate=o.parseDate,n.config.formatDate=o.formatDate,Object.defineProperty(n.config,"enable",{get:function(){return n.config._enable},set:function(e){n.config._enable=he(e)}}),Object.defineProperty(n.config,"disable",{get:function(){return n.config._disable},set:function(e){n.config._disable=he(e)}});var l="time"===o.mode;if(!o.dateFormat&&(o.enableTime||l)){var c=j.defaultConfig.dateFormat||r.dateFormat;s.dateFormat=o.noCalendar||l?"H:i"+(o.enableSeconds?":S":""):c+" H:i"+(o.enableSeconds?":S":"")}if(o.altInput&&(o.enableTime||l)&&!o.altFormat){var d=j.defaultConfig.altFormat||r.altFormat;s.altFormat=o.noCalendar||l?"h:i"+(o.enableSeconds?":S K":" K"):d+" h:i"+(o.enableSeconds?":S":"")+" K"}Object.defineProperty(n.config,"minDate",{get:function(){return n.config._minDate},set:oe("min")}),Object.defineProperty(n.config,"maxDate",{get:function(){return n.config._maxDate},set:oe("max")});var p=function(e){return function(t){n.config["min"===e?"_minTime":"_maxTime"]=n.parseDate(t,"H:i:S")}};Object.defineProperty(n.config,"minTime",{get:function(){return n.config._minTime},set:p("min")}),Object.defineProperty(n.config,"maxTime",{get:function(){return n.config._maxTime},set:p("max")}),"time"===o.mode&&(n.config.noCalendar=!0,n.config.enableTime=!0);Object.assign(n.config,s,o);for(var m=0;m<i.length;m++)n.config[i[m]]=!0===n.config[i[m]]||"true"===n.config[i[m]];a.filter((function(e){return void 0!==n.config[e]})).forEach((function(e){n.config[e]=u(n.config[e]||[]).map(f)})),n.isMobile=!n.config.disableMobile&&!n.config.inline&&"single"===n.config.mode&&!n.config.disable.length&&!n.config.enable&&!n.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(m=0;m<n.config.plugins.length;m++){var b=n.config.plugins[m](n)||{};for(var h in b)a.indexOf(h)>-1?n.config[h]=u(b[h]).map(f).concat(n.config[h]):void 0===o[h]&&(n.config[h]=b[h])}o.altInputClass||(n.config.altInputClass=se().className+" "+n.config.altInputClass);ge("onParseConfig")}(),le(),function(){if(n.input=se(),!n.input)return void n.config.errorHandler(new Error("Invalid input element specified"));n.input._type=n.input.type,n.input.type="text",n.input.classList.add("flatpickr-input"),n._input=n.input,n.config.altInput&&(n.altInput=p(n.input.nodeName,n.config.altInputClass),n._input=n.altInput,n.altInput.placeholder=n.input.placeholder,n.altInput.disabled=n.input.disabled,n.altInput.required=n.input.required,n.altInput.tabIndex=n.input.tabIndex,n.altInput.type="text",n.input.setAttribute("type","hidden"),!n.config.static&&n.input.parentNode&&n.input.parentNode.insertBefore(n.altInput,n.input.nextSibling));n.config.allowInput||n._input.setAttribute("readonly","readonly");fe()}(),function(){n.selectedDates=[],n.now=n.parseDate(n.config.now)||new Date;var e=n.config.defaultDate||("INPUT"!==n.input.nodeName&&"TEXTAREA"!==n.input.nodeName||!n.input.placeholder||n.input.value!==n.input.placeholder?n.input.value:null);e&&be(e,n.config.dateFormat);n._initialDate=n.selectedDates.length>0?n.selectedDates[0]:n.config.minDate&&n.config.minDate.getTime()>n.now.getTime()?n.config.minDate:n.config.maxDate&&n.config.maxDate.getTime()<n.now.getTime()?n.config.maxDate:n.now,n.currentYear=n._initialDate.getFullYear(),n.currentMonth=n._initialDate.getMonth(),n.selectedDates.length>0&&(n.latestSelectedDateObj=n.selectedDates[0]);void 0!==n.config.minTime&&(n.config.minTime=n.parseDate(n.config.minTime,"H:i"));void 0!==n.config.maxTime&&(n.config.maxTime=n.parseDate(n.config.maxTime,"H:i"));n.minDateHasTime=!!n.config.minDate&&(n.config.minDate.getHours()>0||n.config.minDate.getMinutes()>0||n.config.minDate.getSeconds()>0),n.maxDateHasTime=!!n.config.maxDate&&(n.config.maxDate.getHours()>0||n.config.maxDate.getMinutes()>0||n.config.maxDate.getSeconds()>0)}(),n.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=n.currentMonth),void 0===t&&(t=n.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:n.l10n.daysInMonth[e]}},n.isMobile||function(){var e=window.document.createDocumentFragment();if(n.calendarContainer=p("div","flatpickr-calendar"),n.calendarContainer.tabIndex=-1,!n.config.noCalendar){if(e.appendChild((n.monthNav=p("div","flatpickr-months"),n.yearElements=[],n.monthElements=[],n.prevMonthNav=p("span","flatpickr-prev-month"),n.prevMonthNav.innerHTML=n.config.prevArrow,n.nextMonthNav=p("span","flatpickr-next-month"),n.nextMonthNav.innerHTML=n.config.nextArrow,U(),Object.defineProperty(n,"_hidePrevMonthArrow",{get:function(){return n.__hidePrevMonthArrow},set:function(e){n.__hidePrevMonthArrow!==e&&(d(n.prevMonthNav,"flatpickr-disabled",e),n.__hidePrevMonthArrow=e)}}),Object.defineProperty(n,"_hideNextMonthArrow",{get:function(){return n.__hideNextMonthArrow},set:function(e){n.__hideNextMonthArrow!==e&&(d(n.nextMonthNav,"flatpickr-disabled",e),n.__hideNextMonthArrow=e)}}),n.currentYearElement=n.yearElements[0],Me(),n.monthNav)),n.innerContainer=p("div","flatpickr-innerContainer"),n.config.weekNumbers){var t=function(){n.calendarContainer.classList.add("hasWeeks");var e=p("div","flatpickr-weekwrapper");e.appendChild(p("span","flatpickr-weekday",n.l10n.weekAbbreviation));var t=p("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}(),a=t.weekWrapper,r=t.weekNumbers;n.innerContainer.appendChild(a),n.weekNumbers=r,n.weekWrapper=a}n.rContainer=p("div","flatpickr-rContainer"),n.rContainer.appendChild(V()),n.daysContainer||(n.daysContainer=p("div","flatpickr-days"),n.daysContainer.tabIndex=-1),X(),n.rContainer.appendChild(n.daysContainer),n.innerContainer.appendChild(n.rContainer),e.appendChild(n.innerContainer)}n.config.enableTime&&e.appendChild(function(){n.calendarContainer.classList.add("hasTime"),n.config.noCalendar&&n.calendarContainer.classList.add("noCalendar");var e=x(n.config);n.timeContainer=p("div","flatpickr-time"),n.timeContainer.tabIndex=-1;var t=p("span","flatpickr-time-separator",":"),a=b("flatpickr-hour",{"aria-label":n.l10n.hourAriaLabel});n.hourElement=a.getElementsByTagName("input")[0];var r=b("flatpickr-minute",{"aria-label":n.l10n.minuteAriaLabel});n.minuteElement=r.getElementsByTagName("input")[0],n.hourElement.tabIndex=n.minuteElement.tabIndex=-1,n.hourElement.value=s(n.latestSelectedDateObj?n.latestSelectedDateObj.getHours():n.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),n.minuteElement.value=s(n.latestSelectedDateObj?n.latestSelectedDateObj.getMinutes():e.minutes),n.hourElement.setAttribute("step",n.config.hourIncrement.toString()),n.minuteElement.setAttribute("step",n.config.minuteIncrement.toString()),n.hourElement.setAttribute("min",n.config.time_24hr?"0":"1"),n.hourElement.setAttribute("max",n.config.time_24hr?"23":"12"),n.hourElement.setAttribute("maxlength","2"),n.minuteElement.setAttribute("min","0"),n.minuteElement.setAttribute("max","59"),n.minuteElement.setAttribute("maxlength","2"),n.timeContainer.appendChild(a),n.timeContainer.appendChild(t),n.timeContainer.appendChild(r),n.config.time_24hr&&n.timeContainer.classList.add("time24hr");if(n.config.enableSeconds){n.timeContainer.classList.add("hasSeconds");var i=b("flatpickr-second");n.secondElement=i.getElementsByTagName("input")[0],n.secondElement.value=s(n.latestSelectedDateObj?n.latestSelectedDateObj.getSeconds():e.seconds),n.secondElement.setAttribute("step",n.minuteElement.getAttribute("step")),n.secondElement.setAttribute("min","0"),n.secondElement.setAttribute("max","59"),n.secondElement.setAttribute("maxlength","2"),n.timeContainer.appendChild(p("span","flatpickr-time-separator",":")),n.timeContainer.appendChild(i)}n.config.time_24hr||(n.amPM=p("span","flatpickr-am-pm",n.l10n.amPM[l((n.latestSelectedDateObj?n.hourElement.value:n.config.defaultHour)>11)]),n.amPM.title=n.l10n.toggleTitle,n.amPM.tabIndex=-1,n.timeContainer.appendChild(n.amPM));return n.timeContainer}());d(n.calendarContainer,"rangeMode","range"===n.config.mode),d(n.calendarContainer,"animate",!0===n.config.animate),d(n.calendarContainer,"multiMonth",n.config.showMonths>1),n.calendarContainer.appendChild(e);var i=void 0!==n.config.appendTo&&void 0!==n.config.appendTo.nodeType;if((n.config.inline||n.config.static)&&(n.calendarContainer.classList.add(n.config.inline?"inline":"static"),n.config.inline&&(!i&&n.element.parentNode?n.element.parentNode.insertBefore(n.calendarContainer,n._input.nextSibling):void 0!==n.config.appendTo&&n.config.appendTo.appendChild(n.calendarContainer)),n.config.static)){var o=p("div","flatpickr-wrapper");n.element.parentNode&&n.element.parentNode.insertBefore(o,n.element),o.appendChild(n.element),n.altInput&&o.appendChild(n.altInput),o.appendChild(n.calendarContainer)}n.config.static||n.config.inline||(void 0!==n.config.appendTo?n.config.appendTo:window.document.body).appendChild(n.calendarContainer)}(),function(){n.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(n.element.querySelectorAll("[data-"+e+"]"),(function(t){return S(t,"click",n[e])}))}));if(n.isMobile)return void function(){var e=n.config.enableTime?n.config.noCalendar?"time":"datetime-local":"date";n.mobileInput=p("input",n.input.className+" flatpickr-mobile"),n.mobileInput.tabIndex=1,n.mobileInput.type=e,n.mobileInput.disabled=n.input.disabled,n.mobileInput.required=n.input.required,n.mobileInput.placeholder=n.input.placeholder,n.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",n.selectedDates.length>0&&(n.mobileInput.defaultValue=n.mobileInput.value=n.formatDate(n.selectedDates[0],n.mobileFormatStr));n.config.minDate&&(n.mobileInput.min=n.formatDate(n.config.minDate,"Y-m-d"));n.config.maxDate&&(n.mobileInput.max=n.formatDate(n.config.maxDate,"Y-m-d"));n.input.getAttribute("step")&&(n.mobileInput.step=String(n.input.getAttribute("step")));n.input.type="hidden",void 0!==n.altInput&&(n.altInput.type="hidden");try{n.input.parentNode&&n.input.parentNode.insertBefore(n.mobileInput,n.input.nextSibling)}catch(e){}S(n.mobileInput,"change",(function(e){n.setDate(h(e).value,!1,n.mobileFormatStr),ge("onChange"),ge("onClose")}))}();var e=c(ie,50);n._debouncedChange=c(T,300),n.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&S(n.daysContainer,"mouseover",(function(e){"range"===n.config.mode&&re(h(e))}));S(n._input,"keydown",ae),void 0!==n.calendarContainer&&S(n.calendarContainer,"keydown",ae);n.config.inline||n.config.static||S(window,"resize",e);void 0!==window.ontouchstart?S(window.document,"touchstart",Z):S(window.document,"mousedown",Z);S(window.document,"focus",Z,{capture:!0}),!0===n.config.clickOpens&&(S(n._input,"focus",n.open),S(n._input,"click",n.open));void 0!==n.daysContainer&&(S(n.monthNav,"click",Oe),S(n.monthNav,["keyup","increment"],L),S(n.daysContainer,"click",pe));if(void 0!==n.timeContainer&&void 0!==n.minuteElement&&void 0!==n.hourElement){S(n.timeContainer,["increment"],M),S(n.timeContainer,"blur",M,{capture:!0}),S(n.timeContainer,"click",R),S([n.hourElement,n.minuteElement],["focus","click"],(function(e){return h(e).select()})),void 0!==n.secondElement&&S(n.secondElement,"focus",(function(){return n.secondElement&&n.secondElement.select()})),void 0!==n.amPM&&S(n.amPM,"click",(function(e){M(e)}))}n.config.allowInput&&S(n._input,"blur",ne)}(),(n.selectedDates.length||n.config.noCalendar)&&(n.config.enableTime&&E(n.config.noCalendar?n.latestSelectedDateObj:void 0),ze(!1)),_();var i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!n.isMobile&&i&&ce(),ge("onReady")}(),n}function E(e,t){for(var n=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],r=0;r<n.length;r++){var i=n[r];try{if(null!==i.getAttribute("data-fp-omit"))continue;void 0!==i._flatpickr&&(i._flatpickr.destroy(),i._flatpickr=void 0),i._flatpickr=q(i,t||{}),a.push(i._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return E(this,e)},HTMLElement.prototype.flatpickr=function(e){return E([this],e)});var j=function(e,t){return"string"==typeof e?E(window.document.querySelectorAll(e),t):e instanceof Node?E([e],t):E(e,t)};j.defaultConfig={},j.l10ns={en:w({},o),default:w({},o)},j.localize=function(e){j.l10ns.default=w(w({},j.l10ns.default),e)},j.setDefaults=function(e){j.defaultConfig=w(w({},j.defaultConfig),e)},j.parseDate=z({}),j.formatDate=v({}),j.compareDates=O,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return E(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=j);t.a=j},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){return[].slice.call(t.querySelectorAll("*"),0).reduce((function(t,n){return t.concat(n.shadowRoot?e(n.shadowRoot):[n])}),[]).filter(o)};
22
22
  /*!
23
23
  * Adapted from jQuery UI core
24
24
  *